@joint/core 4.0.0
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/LICENSE +376 -0
- package/README.md +49 -0
- package/dist/geometry.js +6486 -0
- package/dist/geometry.min.js +8 -0
- package/dist/joint.d.ts +5536 -0
- package/dist/joint.js +39629 -0
- package/dist/joint.min.js +8 -0
- package/dist/joint.nowrap.js +39626 -0
- package/dist/joint.nowrap.min.js +8 -0
- package/dist/vectorizer.js +9135 -0
- package/dist/vectorizer.min.js +8 -0
- package/dist/version.mjs +3 -0
- package/index.js +3 -0
- package/joint.mjs +27 -0
- package/package.json +192 -0
- package/src/V/annotation.mjs +0 -0
- package/src/V/index.mjs +2642 -0
- package/src/anchors/index.mjs +123 -0
- package/src/config/index.mjs +12 -0
- package/src/connectionPoints/index.mjs +202 -0
- package/src/connectionStrategies/index.mjs +73 -0
- package/src/connectors/curve.mjs +553 -0
- package/src/connectors/index.mjs +6 -0
- package/src/connectors/jumpover.mjs +452 -0
- package/src/connectors/normal.mjs +12 -0
- package/src/connectors/rounded.mjs +17 -0
- package/src/connectors/smooth.mjs +44 -0
- package/src/connectors/straight.mjs +110 -0
- package/src/dia/Cell.mjs +945 -0
- package/src/dia/CellView.mjs +1316 -0
- package/src/dia/Element.mjs +519 -0
- package/src/dia/ElementView.mjs +859 -0
- package/src/dia/Graph.mjs +1112 -0
- package/src/dia/HighlighterView.mjs +319 -0
- package/src/dia/Link.mjs +565 -0
- package/src/dia/LinkView.mjs +2207 -0
- package/src/dia/Paper.mjs +3171 -0
- package/src/dia/PaperLayer.mjs +75 -0
- package/src/dia/ToolView.mjs +69 -0
- package/src/dia/ToolsView.mjs +128 -0
- package/src/dia/attributes/calc.mjs +128 -0
- package/src/dia/attributes/connection.mjs +75 -0
- package/src/dia/attributes/defs.mjs +76 -0
- package/src/dia/attributes/eval.mjs +64 -0
- package/src/dia/attributes/index.mjs +69 -0
- package/src/dia/attributes/legacy.mjs +148 -0
- package/src/dia/attributes/offset.mjs +53 -0
- package/src/dia/attributes/props.mjs +30 -0
- package/src/dia/attributes/shape.mjs +92 -0
- package/src/dia/attributes/text.mjs +180 -0
- package/src/dia/index.mjs +13 -0
- package/src/dia/layers/GridLayer.mjs +176 -0
- package/src/dia/ports.mjs +874 -0
- package/src/elementTools/Control.mjs +153 -0
- package/src/elementTools/HoverConnect.mjs +37 -0
- package/src/elementTools/index.mjs +5 -0
- package/src/env/index.mjs +43 -0
- package/src/g/bezier.mjs +175 -0
- package/src/g/curve.mjs +956 -0
- package/src/g/ellipse.mjs +245 -0
- package/src/g/extend.mjs +64 -0
- package/src/g/geometry.helpers.mjs +58 -0
- package/src/g/index.mjs +17 -0
- package/src/g/intersection.mjs +511 -0
- package/src/g/line.bearing.mjs +30 -0
- package/src/g/line.length.mjs +5 -0
- package/src/g/line.mjs +356 -0
- package/src/g/line.squaredLength.mjs +10 -0
- package/src/g/path.mjs +2260 -0
- package/src/g/point.mjs +375 -0
- package/src/g/points.mjs +247 -0
- package/src/g/polygon.mjs +51 -0
- package/src/g/polyline.mjs +523 -0
- package/src/g/rect.mjs +556 -0
- package/src/g/types.mjs +10 -0
- package/src/highlighters/addClass.mjs +27 -0
- package/src/highlighters/index.mjs +5 -0
- package/src/highlighters/list.mjs +111 -0
- package/src/highlighters/mask.mjs +220 -0
- package/src/highlighters/opacity.mjs +17 -0
- package/src/highlighters/stroke.mjs +100 -0
- package/src/layout/index.mjs +4 -0
- package/src/layout/ports/port.mjs +188 -0
- package/src/layout/ports/portLabel.mjs +224 -0
- package/src/linkAnchors/index.mjs +76 -0
- package/src/linkTools/Anchor.mjs +235 -0
- package/src/linkTools/Arrowhead.mjs +103 -0
- package/src/linkTools/Boundary.mjs +48 -0
- package/src/linkTools/Button.mjs +121 -0
- package/src/linkTools/Connect.mjs +85 -0
- package/src/linkTools/HoverConnect.mjs +161 -0
- package/src/linkTools/Segments.mjs +393 -0
- package/src/linkTools/Vertices.mjs +253 -0
- package/src/linkTools/helpers.mjs +33 -0
- package/src/linkTools/index.mjs +8 -0
- package/src/mvc/Collection.mjs +560 -0
- package/src/mvc/Data.mjs +46 -0
- package/src/mvc/Dom/Dom.mjs +587 -0
- package/src/mvc/Dom/Event.mjs +130 -0
- package/src/mvc/Dom/animations.mjs +122 -0
- package/src/mvc/Dom/events.mjs +69 -0
- package/src/mvc/Dom/index.mjs +13 -0
- package/src/mvc/Dom/methods.mjs +392 -0
- package/src/mvc/Dom/props.mjs +77 -0
- package/src/mvc/Dom/vars.mjs +5 -0
- package/src/mvc/Events.mjs +337 -0
- package/src/mvc/Listener.mjs +33 -0
- package/src/mvc/Model.mjs +239 -0
- package/src/mvc/View.mjs +323 -0
- package/src/mvc/ViewBase.mjs +182 -0
- package/src/mvc/index.mjs +9 -0
- package/src/mvc/mvcUtils.mjs +90 -0
- package/src/polyfills/array.js +4 -0
- package/src/polyfills/base64.js +68 -0
- package/src/polyfills/index.mjs +5 -0
- package/src/polyfills/number.js +3 -0
- package/src/polyfills/string.js +3 -0
- package/src/polyfills/typedArray.js +47 -0
- package/src/routers/index.mjs +6 -0
- package/src/routers/manhattan.mjs +856 -0
- package/src/routers/metro.mjs +91 -0
- package/src/routers/normal.mjs +6 -0
- package/src/routers/oneSide.mjs +60 -0
- package/src/routers/orthogonal.mjs +323 -0
- package/src/routers/rightAngle.mjs +1056 -0
- package/src/shapes/index.mjs +3 -0
- package/src/shapes/standard.mjs +755 -0
- package/src/util/cloneCells.mjs +67 -0
- package/src/util/getRectPoint.mjs +65 -0
- package/src/util/index.mjs +5 -0
- package/src/util/svgTagTemplate.mjs +110 -0
- package/src/util/util.mjs +1754 -0
- package/src/util/utilHelpers.mjs +2402 -0
- package/src/util/wrappers.mjs +56 -0
- package/types/geometry.d.ts +815 -0
- package/types/index.d.ts +53 -0
- package/types/joint.d.ts +4391 -0
- package/types/joint.head.d.ts +12 -0
- package/types/vectorizer.d.ts +327 -0
package/types/joint.d.ts
ADDED
|
@@ -0,0 +1,4391 @@
|
|
|
1
|
+
import { g } from './geometry';
|
|
2
|
+
import { Vectorizer } from './vectorizer';
|
|
3
|
+
|
|
4
|
+
export const version: string;
|
|
5
|
+
|
|
6
|
+
export namespace config {
|
|
7
|
+
var useCSSSelectors: boolean;
|
|
8
|
+
var classNamePrefix: string;
|
|
9
|
+
var defaultTheme: string;
|
|
10
|
+
var doubleTapInterval: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
type NativeEvent = Event;
|
|
14
|
+
|
|
15
|
+
export namespace dia {
|
|
16
|
+
|
|
17
|
+
type Event = mvc.TriggeredEvent;
|
|
18
|
+
|
|
19
|
+
type ObjectHash = { [key: string]: any };
|
|
20
|
+
|
|
21
|
+
type Point = g.PlainPoint;
|
|
22
|
+
|
|
23
|
+
type BBox = g.PlainRect;
|
|
24
|
+
|
|
25
|
+
type Size = Pick<BBox, 'width' | 'height'>;
|
|
26
|
+
|
|
27
|
+
type PaddingJSON = {
|
|
28
|
+
left?: number;
|
|
29
|
+
top?: number;
|
|
30
|
+
right?: number;
|
|
31
|
+
bottom?: number;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
type Padding = number | PaddingJSON;
|
|
35
|
+
|
|
36
|
+
type SidesJSON = {
|
|
37
|
+
left?: number;
|
|
38
|
+
top?: number;
|
|
39
|
+
right?: number;
|
|
40
|
+
bottom?: number;
|
|
41
|
+
horizontal?: number;
|
|
42
|
+
vertical?: number;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
type LegacyPositionName = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' |
|
|
46
|
+
'topMiddle' | 'bottomMiddle' | 'leftMiddle' | 'rightMiddle' |
|
|
47
|
+
'corner' | 'origin';
|
|
48
|
+
|
|
49
|
+
type PositionName = 'top' | 'left' | 'bottom' | 'right' | 'center' |
|
|
50
|
+
'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' |
|
|
51
|
+
LegacyPositionName;
|
|
52
|
+
|
|
53
|
+
type Sides = number | SidesJSON;
|
|
54
|
+
|
|
55
|
+
type OrthogonalDirection =
|
|
56
|
+
'left' | 'top' | 'right' | 'bottom';
|
|
57
|
+
|
|
58
|
+
type Direction =
|
|
59
|
+
OrthogonalDirection |
|
|
60
|
+
'top-left' | 'top-right' | 'bottom-right' | 'bottom-left';
|
|
61
|
+
|
|
62
|
+
type LinkEnd =
|
|
63
|
+
'source' | 'target';
|
|
64
|
+
|
|
65
|
+
type MarkupNodeJSON = {
|
|
66
|
+
tagName: string;
|
|
67
|
+
selector?: string;
|
|
68
|
+
groupSelector?: string | string[];
|
|
69
|
+
namespaceURI?: string;
|
|
70
|
+
className?: string;
|
|
71
|
+
attributes?: attributes.NativeSVGAttributes;
|
|
72
|
+
style?: { [key: string]: any };
|
|
73
|
+
children?: MarkupJSON;
|
|
74
|
+
textContent?: string;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
type MarkupJSON = Array<MarkupNodeJSON | string>;
|
|
78
|
+
|
|
79
|
+
type Path = string | Array<string | number>;
|
|
80
|
+
|
|
81
|
+
interface ModelSetOptions extends mvc.ModelSetOptions {
|
|
82
|
+
dry?: boolean;
|
|
83
|
+
isolate?: boolean;
|
|
84
|
+
[key: string]: any;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
interface CollectionAddOptions extends mvc.AddOptions {
|
|
88
|
+
dry?: boolean;
|
|
89
|
+
[key: string]: any;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
interface SVGPatternJSON {
|
|
93
|
+
id?: string;
|
|
94
|
+
type: 'pattern';
|
|
95
|
+
attrs?: attributes.NativeSVGAttributes;
|
|
96
|
+
markup: string | MarkupJSON;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
interface SVGGradientJSON {
|
|
100
|
+
id?: string;
|
|
101
|
+
type: 'linearGradient' | 'radialGradient';
|
|
102
|
+
attrs?: attributes.NativeSVGAttributes;
|
|
103
|
+
stops: Array<{
|
|
104
|
+
offset: number | string;
|
|
105
|
+
color: string;
|
|
106
|
+
opacity?: number;
|
|
107
|
+
}>;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
type SVGMarkerJSON = SVGComplexMarkerJSON | SVGSimpleMarkerJSON;
|
|
111
|
+
|
|
112
|
+
interface SVGComplexMarkerJSON {
|
|
113
|
+
id?: string;
|
|
114
|
+
markup: string | MarkupJSON;
|
|
115
|
+
attrs?: attributes.NativeSVGAttributes;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
interface SVGSimpleMarkerJSON extends attributes.NativeSVGAttributes {
|
|
119
|
+
id?: string;
|
|
120
|
+
type?: string;
|
|
121
|
+
/**
|
|
122
|
+
* @deprecated use `attrs` instead
|
|
123
|
+
*/
|
|
124
|
+
markerUnits?: string;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
type SVGFilterJSON =
|
|
128
|
+
util.filter.FilterJSON<'outline'> |
|
|
129
|
+
util.filter.FilterJSON<'highlight'> |
|
|
130
|
+
util.filter.FilterJSON<'blur'> |
|
|
131
|
+
util.filter.FilterJSON<'dropShadow'> |
|
|
132
|
+
util.filter.FilterJSON<'grayscale'> |
|
|
133
|
+
util.filter.FilterJSON<'sepia'> |
|
|
134
|
+
util.filter.FilterJSON<'saturate'> |
|
|
135
|
+
util.filter.FilterJSON<'hueRotate'> |
|
|
136
|
+
util.filter.FilterJSON<'invert'> |
|
|
137
|
+
util.filter.FilterJSON<'brightness'> |
|
|
138
|
+
util.filter.FilterJSON<'contrast'>;
|
|
139
|
+
|
|
140
|
+
export namespace Graph {
|
|
141
|
+
|
|
142
|
+
interface Options {
|
|
143
|
+
[key: string]: any;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
interface ConnectionOptions extends Cell.EmbeddableOptions {
|
|
147
|
+
inbound?: boolean;
|
|
148
|
+
outbound?: boolean;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
interface ExploreOptions extends ConnectionOptions {
|
|
152
|
+
breadthFirst?: boolean;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
class Cells extends mvc.Collection<Cell> {
|
|
156
|
+
graph: Graph;
|
|
157
|
+
cellNamespace: any;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
interface Attributes {
|
|
161
|
+
cells?: Cells;
|
|
162
|
+
[key: string]: any;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
class Graph<A extends ObjectHash = Graph.Attributes, S = dia.ModelSetOptions> extends mvc.Model<A, S> {
|
|
167
|
+
|
|
168
|
+
constructor(attributes?: Graph.Attributes, opt?: { cellNamespace?: any, cellModel?: typeof Cell });
|
|
169
|
+
|
|
170
|
+
addCell(cell: Cell.JSON | Cell, opt?: CollectionAddOptions): this;
|
|
171
|
+
addCell(cell: Array<Cell | Cell.JSON>, opt?: CollectionAddOptions): this;
|
|
172
|
+
|
|
173
|
+
addCells(cells: Array<Cell | Cell.JSON>, opt?: CollectionAddOptions): this;
|
|
174
|
+
|
|
175
|
+
resetCells(cells: Array<Cell | Cell.JSON>, opt?: Graph.Options): this;
|
|
176
|
+
|
|
177
|
+
getCell(id: Cell.ID | Cell): Cell;
|
|
178
|
+
|
|
179
|
+
getElements(): Element[];
|
|
180
|
+
|
|
181
|
+
getLinks(): Link[];
|
|
182
|
+
|
|
183
|
+
getCells(): Cell[];
|
|
184
|
+
|
|
185
|
+
getFirstCell(): Cell | undefined;
|
|
186
|
+
|
|
187
|
+
getLastCell(): Cell | undefined;
|
|
188
|
+
|
|
189
|
+
getConnectedLinks(cell: Cell, opt?: Graph.ConnectionOptions): Link[];
|
|
190
|
+
|
|
191
|
+
disconnectLinks(cell: Cell, opt?: S): void;
|
|
192
|
+
|
|
193
|
+
removeLinks(cell: Cell, opt?: Cell.DisconnectableOptions): void;
|
|
194
|
+
|
|
195
|
+
translate(tx: number, ty?: number, opt?: Element.TranslateOptions): this;
|
|
196
|
+
|
|
197
|
+
cloneCells(cells: Cell[]): { [id: string]: Cell };
|
|
198
|
+
|
|
199
|
+
getSubgraph(cells: Cell[], opt?: Cell.EmbeddableOptions): Cell[];
|
|
200
|
+
|
|
201
|
+
cloneSubgraph(cells: Cell[], opt?: Cell.EmbeddableOptions): { [id: string]: Cell };
|
|
202
|
+
|
|
203
|
+
dfs(element: Element, iteratee: (element: Element, distance: number) => boolean, opt?: Graph.ConnectionOptions): void;
|
|
204
|
+
|
|
205
|
+
bfs(element: Element, iteratee: (element: Element, distance: number) => boolean, opt?: Graph.ConnectionOptions): void;
|
|
206
|
+
|
|
207
|
+
search(element: Element, iteratee: (element: Element, distance: number) => boolean, opt?: Graph.ExploreOptions): void;
|
|
208
|
+
|
|
209
|
+
getSuccessors(element: Element, opt?: Graph.ExploreOptions): Element[];
|
|
210
|
+
|
|
211
|
+
getPredecessors(element: Element, opt?: Graph.ExploreOptions): Element[];
|
|
212
|
+
|
|
213
|
+
isSuccessor(elementA: Element, elementB: Element): boolean;
|
|
214
|
+
|
|
215
|
+
isPredecessor(elementA: Element, elementB: Element): boolean;
|
|
216
|
+
|
|
217
|
+
isSource(element: Element): boolean;
|
|
218
|
+
|
|
219
|
+
isSink(element: Element): boolean;
|
|
220
|
+
|
|
221
|
+
getSources(): Element[];
|
|
222
|
+
|
|
223
|
+
getSinks(): Element[];
|
|
224
|
+
|
|
225
|
+
getNeighbors(element: Element, opt?: Graph.ConnectionOptions): Element[];
|
|
226
|
+
|
|
227
|
+
isNeighbor(elementA: Element, elementB: Element, opt?: Graph.ConnectionOptions): boolean;
|
|
228
|
+
|
|
229
|
+
getCommonAncestor(...cells: Cell[]): Element | undefined;
|
|
230
|
+
|
|
231
|
+
toJSON(): any;
|
|
232
|
+
|
|
233
|
+
fromJSON(json: any, opt?: S): this;
|
|
234
|
+
|
|
235
|
+
clear(opt?: { [key: string]: any }): this;
|
|
236
|
+
|
|
237
|
+
findModelsFromPoint(p: Point): Element[];
|
|
238
|
+
|
|
239
|
+
findModelsInArea(rect: BBox, opt?: { strict?: boolean }): Element[];
|
|
240
|
+
|
|
241
|
+
findModelsUnderElement(element: Element, opt?: { searchBy?: 'bbox' | PositionName }): Element[];
|
|
242
|
+
|
|
243
|
+
getBBox(): g.Rect | null;
|
|
244
|
+
|
|
245
|
+
getCellsBBox(cells: Cell[], opt?: Cell.EmbeddableOptions): g.Rect | null;
|
|
246
|
+
|
|
247
|
+
hasActiveBatch(name?: string | string[]): boolean;
|
|
248
|
+
|
|
249
|
+
maxZIndex(): number;
|
|
250
|
+
|
|
251
|
+
minZIndex(): number;
|
|
252
|
+
|
|
253
|
+
removeCells(cells: Cell[], opt?: Cell.DisconnectableOptions): this;
|
|
254
|
+
|
|
255
|
+
resize(width: number, height: number, opt?: S): this;
|
|
256
|
+
|
|
257
|
+
resizeCells(width: number, height: number, cells: Cell[], opt?: S): this;
|
|
258
|
+
|
|
259
|
+
startBatch(name: string, data?: { [key: string]: any }): this;
|
|
260
|
+
|
|
261
|
+
stopBatch(name: string, data?: { [key: string]: any }): this;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// dia.Cell
|
|
265
|
+
|
|
266
|
+
export namespace Cell {
|
|
267
|
+
|
|
268
|
+
type ID = string | number;
|
|
269
|
+
|
|
270
|
+
interface GenericAttributes<T> {
|
|
271
|
+
attrs?: T;
|
|
272
|
+
z?: number;
|
|
273
|
+
[key: string]: any;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
interface Selectors {
|
|
277
|
+
[selector: string]: attributes.SVGAttributes | undefined;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
interface Attributes extends GenericAttributes<Selectors> {
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
type JSON<K extends Selectors = Selectors, T extends GenericAttributes<K> = GenericAttributes<K>> = T & {
|
|
284
|
+
[attribute in keyof T]: T[attribute];
|
|
285
|
+
} & {
|
|
286
|
+
id: ID;
|
|
287
|
+
type: string;
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
interface Constructor<T extends mvc.Model> {
|
|
291
|
+
new(opt?: { id?: ID, [key: string]: any }): T;
|
|
292
|
+
define(type: string, defaults?: any, protoProps?: any, staticProps?: any): dia.Cell.Constructor<T>;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
interface Options {
|
|
296
|
+
[key: string]: any;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
interface EmbeddableOptions<T = boolean> extends Options {
|
|
300
|
+
deep?: T;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
interface DisconnectableOptions extends Options {
|
|
304
|
+
disconnectLinks?: boolean;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
interface GetEmbeddedCellsOptions extends EmbeddableOptions {
|
|
308
|
+
breadthFirst?: boolean;
|
|
309
|
+
sortSiblings?: boolean;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
interface ToFrontAndBackOptions extends GetEmbeddedCellsOptions {
|
|
313
|
+
foregroundEmbeds?: boolean;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
interface TransitionOptions extends Options {
|
|
317
|
+
delay?: number;
|
|
318
|
+
duration?: number;
|
|
319
|
+
timingFunction?: util.timing.TimingFunction;
|
|
320
|
+
valueFunction?: util.interpolate.InterpolateFunction<any>;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
interface ConstructorOptions extends Graph.Options {
|
|
324
|
+
mergeArrays?: boolean;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
class Cell<A extends ObjectHash = Cell.Attributes, S extends mvc.ModelSetOptions = dia.ModelSetOptions> extends mvc.Model<A, S> {
|
|
329
|
+
|
|
330
|
+
constructor(attributes?: A, opt?: Cell.ConstructorOptions);
|
|
331
|
+
|
|
332
|
+
id: Cell.ID;
|
|
333
|
+
graph: Graph;
|
|
334
|
+
markup: string | MarkupJSON;
|
|
335
|
+
useCSSSelectors: boolean;
|
|
336
|
+
|
|
337
|
+
protected generateId(): string | number;
|
|
338
|
+
|
|
339
|
+
protected stopPendingTransitions(path?: string, delim?: string): void;
|
|
340
|
+
|
|
341
|
+
protected stopScheduledTransitions(path?: string, delim?: string): void;
|
|
342
|
+
|
|
343
|
+
toJSON(): Cell.JSON<any, A>;
|
|
344
|
+
|
|
345
|
+
remove(opt?: Cell.DisconnectableOptions): this;
|
|
346
|
+
|
|
347
|
+
toFront(opt?: Cell.ToFrontAndBackOptions): this;
|
|
348
|
+
|
|
349
|
+
toBack(opt?: Cell.ToFrontAndBackOptions): this;
|
|
350
|
+
|
|
351
|
+
parent(): string;
|
|
352
|
+
|
|
353
|
+
getParentCell(): Cell | null;
|
|
354
|
+
|
|
355
|
+
getAncestors(): Cell[];
|
|
356
|
+
|
|
357
|
+
getEmbeddedCells(opt?: Cell.GetEmbeddedCellsOptions): Cell[];
|
|
358
|
+
|
|
359
|
+
isEmbeddedIn(cell: Cell, opt?: Cell.EmbeddableOptions): boolean;
|
|
360
|
+
|
|
361
|
+
isEmbedded(): boolean;
|
|
362
|
+
|
|
363
|
+
prop(key: Path): any;
|
|
364
|
+
prop(object: Partial<A>, opt?: Cell.Options): this;
|
|
365
|
+
prop(key: Path, value: any, opt?: Cell.Options): this;
|
|
366
|
+
|
|
367
|
+
removeProp(path: Path, opt?: Cell.Options): this;
|
|
368
|
+
|
|
369
|
+
attr(key?: Path): any;
|
|
370
|
+
attr(object: Cell.Selectors, opt?: Cell.Options): this;
|
|
371
|
+
attr(key: Path, value: any, opt?: Cell.Options): this;
|
|
372
|
+
|
|
373
|
+
clone(): this;
|
|
374
|
+
clone(opt: Cell.EmbeddableOptions<false>): this;
|
|
375
|
+
clone(opt: Cell.EmbeddableOptions<true>): Cell[];
|
|
376
|
+
|
|
377
|
+
removeAttr(path: Path, opt?: Cell.Options): this;
|
|
378
|
+
|
|
379
|
+
transition(path: string, value?: any, opt?: Cell.TransitionOptions, delim?: string): number;
|
|
380
|
+
|
|
381
|
+
getTransitions(): string[];
|
|
382
|
+
|
|
383
|
+
stopTransitions(path?: string, delim?: string): this;
|
|
384
|
+
|
|
385
|
+
embed(cell: Cell | Cell[], opt?: Graph.Options): this;
|
|
386
|
+
|
|
387
|
+
unembed(cell: Cell | Cell[], opt?: Graph.Options): this;
|
|
388
|
+
|
|
389
|
+
canEmbed(cell: Cell | Cell[]): boolean;
|
|
390
|
+
|
|
391
|
+
addTo(graph: Graph, opt?: Graph.Options): this;
|
|
392
|
+
|
|
393
|
+
findView(paper: Paper): CellView;
|
|
394
|
+
|
|
395
|
+
isLink(): this is Link;
|
|
396
|
+
|
|
397
|
+
isElement(): this is Element;
|
|
398
|
+
|
|
399
|
+
startBatch(name: string, opt?: Graph.Options): this;
|
|
400
|
+
|
|
401
|
+
stopBatch(name: string, opt?: Graph.Options): this;
|
|
402
|
+
|
|
403
|
+
position(): g.Point;
|
|
404
|
+
|
|
405
|
+
z(): number;
|
|
406
|
+
|
|
407
|
+
angle(): number;
|
|
408
|
+
|
|
409
|
+
getBBox(): g.Rect;
|
|
410
|
+
|
|
411
|
+
getPointFromConnectedLink(link: dia.Link, endType: dia.LinkEnd): g.Point;
|
|
412
|
+
|
|
413
|
+
getPointRotatedAroundCenter(angle: number, x: number, y: number): g.Point;
|
|
414
|
+
getPointRotatedAroundCenter(angle: number, point: dia.Point): g.Point;
|
|
415
|
+
|
|
416
|
+
getRelativePointFromAbsolute(x: number, y: number): g.Point;
|
|
417
|
+
getRelativePointFromAbsolute(absolutePoint: dia.Point): g.Point;
|
|
418
|
+
|
|
419
|
+
getAbsolutePointFromRelative(x: number, y: number): g.Point;
|
|
420
|
+
getAbsolutePointFromRelative(relativePoint: dia.Point): g.Point;
|
|
421
|
+
|
|
422
|
+
getChangeFlag(attributes: { [key: string]: number }): number;
|
|
423
|
+
|
|
424
|
+
static define(type: string, defaults?: any, protoProps?: any, staticProps?: any): Cell.Constructor<Cell>;
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* @deprecated
|
|
428
|
+
*/
|
|
429
|
+
protected processPorts(): void;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
// dia.Element
|
|
433
|
+
|
|
434
|
+
export namespace Element {
|
|
435
|
+
|
|
436
|
+
interface GenericAttributes<T> extends Cell.GenericAttributes<T> {
|
|
437
|
+
markup?: string | MarkupJSON;
|
|
438
|
+
position?: Point;
|
|
439
|
+
size?: Size;
|
|
440
|
+
angle?: number;
|
|
441
|
+
ports?: {
|
|
442
|
+
groups?: { [key: string]: PortGroup };
|
|
443
|
+
items?: Port[];
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
interface Attributes extends GenericAttributes<Cell.Selectors> {
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
type PortPositionCallback = (ports: Port[], bbox: g.Rect) => dia.Point[];
|
|
451
|
+
|
|
452
|
+
interface PortPositionJSON {
|
|
453
|
+
name?: string;
|
|
454
|
+
args?: { [key: string]: any };
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
type PositionType = string | PortPositionCallback | PortPositionJSON;
|
|
458
|
+
|
|
459
|
+
interface PortGroup {
|
|
460
|
+
position?: PositionType;
|
|
461
|
+
markup?: string | MarkupJSON;
|
|
462
|
+
attrs?: Cell.Selectors;
|
|
463
|
+
label?: {
|
|
464
|
+
markup?: string | MarkupJSON;
|
|
465
|
+
position?: PositionType;
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
interface Port {
|
|
470
|
+
id?: string;
|
|
471
|
+
markup?: string | MarkupJSON;
|
|
472
|
+
group?: string;
|
|
473
|
+
attrs?: Cell.Selectors;
|
|
474
|
+
args?: { [key: string]: any };
|
|
475
|
+
label?: {
|
|
476
|
+
markup?: string | MarkupJSON;
|
|
477
|
+
position?: PositionType;
|
|
478
|
+
};
|
|
479
|
+
z?: number | 'auto';
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
interface PortPosition extends Point {
|
|
483
|
+
angle: number;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
interface TranslateOptions extends Cell.Options {
|
|
487
|
+
restrictedArea?: BBox | Paper.PointConstraintCallback;
|
|
488
|
+
transition?: Cell.TransitionOptions;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
interface PositionOptions extends TranslateOptions {
|
|
492
|
+
parentRelative?: boolean;
|
|
493
|
+
deep?: boolean;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
interface BBoxOptions extends Cell.EmbeddableOptions {
|
|
497
|
+
rotate?: boolean;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
class Element<A extends ObjectHash = Element.Attributes, S extends mvc.ModelSetOptions = dia.ModelSetOptions> extends Cell<A, S> {
|
|
502
|
+
|
|
503
|
+
translate(tx: number, ty?: number, opt?: Element.TranslateOptions): this;
|
|
504
|
+
|
|
505
|
+
position(opt?: Element.PositionOptions): g.Point;
|
|
506
|
+
position(x: number, y: number, opt?: Element.PositionOptions): this;
|
|
507
|
+
|
|
508
|
+
size(): Size;
|
|
509
|
+
size(width: number, height?: number, opt?: { direction?: Direction, [key: string]: any }): this;
|
|
510
|
+
|
|
511
|
+
resize(width: number, height: number, opt?: { direction?: Direction, [key: string]: any }): this;
|
|
512
|
+
|
|
513
|
+
rotate(deg: number, absolute?: boolean, origin?: Point, opt?: { [key: string]: any }): this;
|
|
514
|
+
|
|
515
|
+
angle(): number;
|
|
516
|
+
|
|
517
|
+
scale(scaleX: number, scaleY: number, origin?: Point, opt?: { [key: string]: any }): this;
|
|
518
|
+
|
|
519
|
+
fitEmbeds(opt?: { deep?: boolean, padding?: Padding, expandOnly?: boolean, shrinkOnly?: boolean }): this;
|
|
520
|
+
fitToChildren(opt?: { deep?: boolean, padding?: Padding, expandOnly?: boolean, shrinkOnly?: boolean }): this;
|
|
521
|
+
|
|
522
|
+
fitParent(opt?: { deep?: boolean, padding?: Padding, expandOnly?: boolean, shrinkOnly?: boolean, terminator?: Cell | Cell.ID }): this;
|
|
523
|
+
|
|
524
|
+
getBBox(opt?: Element.BBoxOptions): g.Rect;
|
|
525
|
+
|
|
526
|
+
addPort(port: Element.Port, opt?: S): this;
|
|
527
|
+
|
|
528
|
+
addPorts(ports: Element.Port[], opt?: S): this;
|
|
529
|
+
|
|
530
|
+
insertPort(before: number | string | Element.Port, port: Element.Port, opt?: S): this;
|
|
531
|
+
|
|
532
|
+
removePort(port: string | Element.Port, opt?: S): this;
|
|
533
|
+
|
|
534
|
+
removePorts(opt?: S): this;
|
|
535
|
+
removePorts(ports: Array<Element.Port | string>, opt?: S): this;
|
|
536
|
+
|
|
537
|
+
hasPorts(): boolean;
|
|
538
|
+
|
|
539
|
+
hasPort(id: string): boolean;
|
|
540
|
+
|
|
541
|
+
getPorts(): Element.Port[];
|
|
542
|
+
|
|
543
|
+
getGroupPorts(groupName: string): Element.Port[];
|
|
544
|
+
|
|
545
|
+
getPort(id: string): Element.Port;
|
|
546
|
+
|
|
547
|
+
getPortsPositions(groupName: string): { [id: string]: Element.PortPosition };
|
|
548
|
+
|
|
549
|
+
getPortIndex(port: string | Element.Port): number;
|
|
550
|
+
|
|
551
|
+
portProp(portId: string, path: dia.Path): any;
|
|
552
|
+
|
|
553
|
+
portProp(portId: string, path: dia.Path, value?: any, opt?: S): Element;
|
|
554
|
+
|
|
555
|
+
protected generatePortId(): string | number;
|
|
556
|
+
|
|
557
|
+
static define(type: string, defaults?: any, protoProps?: any, staticProps?: any): Cell.Constructor<Element>;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
// dia.Link
|
|
561
|
+
|
|
562
|
+
export namespace Link {
|
|
563
|
+
|
|
564
|
+
interface EndCellArgs {
|
|
565
|
+
magnet?: string;
|
|
566
|
+
selector?: string;
|
|
567
|
+
port?: string;
|
|
568
|
+
anchor?: anchors.AnchorJSON;
|
|
569
|
+
connectionPoint?: connectionPoints.ConnectionPointJSON;
|
|
570
|
+
priority?: boolean;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
interface EndJSON extends EndCellArgs {
|
|
574
|
+
id?: Cell.ID;
|
|
575
|
+
x?: number;
|
|
576
|
+
y?: number;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
interface GenericAttributes<T> extends Cell.GenericAttributes<T> {
|
|
580
|
+
source?: EndJSON;
|
|
581
|
+
target?: EndJSON;
|
|
582
|
+
labels?: Label[];
|
|
583
|
+
vertices?: Point[];
|
|
584
|
+
router?: routers.Router | routers.RouterJSON;
|
|
585
|
+
connector?: connectors.Connector | connectors.ConnectorJSON;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
interface LinkSelectors extends Cell.Selectors {
|
|
589
|
+
'.connection'?: attributes.SVGPathAttributes;
|
|
590
|
+
'.connection-wrap'?: attributes.SVGPathAttributes;
|
|
591
|
+
'.marker-source'?: attributes.SVGPathAttributes;
|
|
592
|
+
'.marker-target'?: attributes.SVGPathAttributes;
|
|
593
|
+
'.labels'?: attributes.SVGAttributes;
|
|
594
|
+
'.marker-vertices'?: attributes.SVGAttributes;
|
|
595
|
+
'.marker-arrowheads'?: attributes.SVGAttributes;
|
|
596
|
+
'.link-tools'?: attributes.SVGAttributes;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
interface Attributes extends Cell.GenericAttributes<LinkSelectors> {
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
interface LabelPosition {
|
|
603
|
+
distance?: number; // optional for default labels
|
|
604
|
+
offset?: number | { x: number, y: number };
|
|
605
|
+
angle?: number;
|
|
606
|
+
args?: LinkView.LabelOptions;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
interface Label {
|
|
610
|
+
markup?: string | MarkupJSON;
|
|
611
|
+
position?: LabelPosition | number; // optional for default labels
|
|
612
|
+
attrs?: Cell.Selectors;
|
|
613
|
+
size?: Size;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
interface Vertex extends Point {
|
|
617
|
+
[key: string]: any;
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
class Link<A extends ObjectHash = Link.Attributes, S extends mvc.ModelSetOptions = dia.ModelSetOptions> extends Cell<A, S> {
|
|
622
|
+
|
|
623
|
+
toolMarkup: string;
|
|
624
|
+
doubleToolMarkup?: string;
|
|
625
|
+
vertexMarkup: string;
|
|
626
|
+
arrowHeadMarkup: string;
|
|
627
|
+
defaultLabel?: Link.Label; // default label props
|
|
628
|
+
/**
|
|
629
|
+
* @deprecated use `defaultLabel.markup` instead
|
|
630
|
+
*/
|
|
631
|
+
labelMarkup?: string | MarkupJSON; // default label markup
|
|
632
|
+
|
|
633
|
+
disconnect(): this;
|
|
634
|
+
|
|
635
|
+
source(): Link.EndJSON;
|
|
636
|
+
source(source: Link.EndJSON, opt?: S): this;
|
|
637
|
+
source(source: Cell, args?: Link.EndCellArgs, opt?: S): this;
|
|
638
|
+
|
|
639
|
+
target(): Link.EndJSON;
|
|
640
|
+
target(target: Link.EndJSON, opt?: S): this;
|
|
641
|
+
target(target: Cell, args?: Link.EndCellArgs, opt?: S): this;
|
|
642
|
+
|
|
643
|
+
router(): routers.Router | routers.RouterJSON | null;
|
|
644
|
+
router(router: routers.Router | routers.RouterJSON, opt?: S): this;
|
|
645
|
+
router(name: routers.RouterType, args?: routers.RouterArguments, opt?: S): this;
|
|
646
|
+
|
|
647
|
+
connector(): connectors.Connector | connectors.ConnectorJSON | null;
|
|
648
|
+
connector(connector: connectors.Connector | connectors.ConnectorJSON, opt?: S): this;
|
|
649
|
+
connector(name: connectors.ConnectorType, args?: connectors.ConnectorArguments, opt?: S): this;
|
|
650
|
+
|
|
651
|
+
label(index?: number): Link.Label;
|
|
652
|
+
label(index: number, label: Link.Label, opt?: S): this;
|
|
653
|
+
|
|
654
|
+
labels(): Link.Label[];
|
|
655
|
+
labels(labels: Link.Label[], opt?: S): this;
|
|
656
|
+
|
|
657
|
+
hasLabels(): boolean;
|
|
658
|
+
|
|
659
|
+
insertLabel(index: number, label: Link.Label, opt?: S): Link.Label[];
|
|
660
|
+
|
|
661
|
+
appendLabel(label: Link.Label, opt?: S): Link.Label[];
|
|
662
|
+
|
|
663
|
+
removeLabel(index?: number, opt?: S): Link.Label[];
|
|
664
|
+
|
|
665
|
+
vertex(index?: number): Link.Vertex;
|
|
666
|
+
vertex(index: number, vertex: Link.Vertex, opt?: S): this;
|
|
667
|
+
|
|
668
|
+
vertices(): Link.Vertex[];
|
|
669
|
+
vertices(vertices: Link.Vertex[], opt?: S): this;
|
|
670
|
+
|
|
671
|
+
insertVertex(index: number, vertex: Link.Vertex, opt?: S): Link.Vertex[];
|
|
672
|
+
|
|
673
|
+
removeVertex(index?: number, opt?: S): Link.Vertex[];
|
|
674
|
+
|
|
675
|
+
reparent(opt?: S): Element;
|
|
676
|
+
|
|
677
|
+
getSourceElement(): null | Element;
|
|
678
|
+
|
|
679
|
+
getTargetElement(): null | Element;
|
|
680
|
+
|
|
681
|
+
getSourceCell(): null | Cell;
|
|
682
|
+
|
|
683
|
+
getTargetCell(): null | Cell;
|
|
684
|
+
|
|
685
|
+
getPolyline(): g.Polyline;
|
|
686
|
+
|
|
687
|
+
getSourcePoint(): g.Point;
|
|
688
|
+
|
|
689
|
+
getTargetPoint(): g.Point;
|
|
690
|
+
|
|
691
|
+
getBBox(): g.Rect;
|
|
692
|
+
|
|
693
|
+
hasLoop(opt?: Cell.EmbeddableOptions): boolean;
|
|
694
|
+
|
|
695
|
+
getRelationshipAncestor(): undefined | Element;
|
|
696
|
+
|
|
697
|
+
isRelationshipEmbeddedIn(cell: Cell): boolean;
|
|
698
|
+
|
|
699
|
+
applyToPoints(fn: (p: Point) => Point, opt?: S): this;
|
|
700
|
+
|
|
701
|
+
scale(sx: number, sy: number, origin?: Point, opt?: S): this;
|
|
702
|
+
|
|
703
|
+
translate(tx: number, ty: number, opt?: S): this;
|
|
704
|
+
|
|
705
|
+
static define(type: string, defaults?: any, protoProps?: any, staticProps?: any): Cell.Constructor<Link>;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
// dia.CellView
|
|
709
|
+
|
|
710
|
+
export namespace CellView {
|
|
711
|
+
|
|
712
|
+
enum Highlighting {
|
|
713
|
+
DEFAULT = 'default',
|
|
714
|
+
EMBEDDING = 'embedding',
|
|
715
|
+
CONNECTING = 'connecting',
|
|
716
|
+
MAGNET_AVAILABILITY = 'magnetAvailability',
|
|
717
|
+
ELEMENT_AVAILABILITY = 'elementAvailability'
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
interface EventHighlightOptions {
|
|
721
|
+
partial: boolean;
|
|
722
|
+
type: Highlighting;
|
|
723
|
+
[key: string]: any;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
interface Options<T extends Cell> extends mvc.ViewOptions<T, SVGElement> {
|
|
727
|
+
id?: string;
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
interface InteractivityOptions extends ElementView.InteractivityOptions, LinkView.InteractivityOptions {
|
|
731
|
+
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
type FlagLabel = string | string[];
|
|
735
|
+
type PresentationAttributes = { [key: string]: FlagLabel };
|
|
736
|
+
|
|
737
|
+
type NodeData = { [key: string]: any };
|
|
738
|
+
|
|
739
|
+
type NodeMetrics = {
|
|
740
|
+
data: NodeData;
|
|
741
|
+
boundingRect: g.Rect;
|
|
742
|
+
magnetMatrix: SVGMatrix;
|
|
743
|
+
geometryShape: g.Shape;
|
|
744
|
+
};
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
abstract class CellViewGeneric<T extends Cell> extends mvc.View<T, SVGElement> {
|
|
748
|
+
|
|
749
|
+
constructor(opt?: CellView.Options<T>);
|
|
750
|
+
|
|
751
|
+
paper: Paper | null;
|
|
752
|
+
|
|
753
|
+
initFlag(): CellView.FlagLabel;
|
|
754
|
+
|
|
755
|
+
presentationAttributes(): CellView.PresentationAttributes;
|
|
756
|
+
|
|
757
|
+
highlight(el?: mvc.$SVGElement, opt?: { [key: string]: any }): this;
|
|
758
|
+
|
|
759
|
+
unhighlight(el?: mvc.$SVGElement, opt?: { [key: string]: any }): this;
|
|
760
|
+
|
|
761
|
+
can(feature: string): boolean;
|
|
762
|
+
|
|
763
|
+
findMagnet(el: mvc.$SVGElement): SVGElement | undefined;
|
|
764
|
+
|
|
765
|
+
findNode(selector: string): SVGElement | HTMLElement | null;
|
|
766
|
+
|
|
767
|
+
findNodes(groupSelector: string): Array<SVGElement | HTMLElement>;
|
|
768
|
+
|
|
769
|
+
findProxyNode(el: SVGElement | null, type: string): SVGElement;
|
|
770
|
+
|
|
771
|
+
getSelector(el: SVGElement, prevSelector?: string): string;
|
|
772
|
+
|
|
773
|
+
notify(eventName: string, ...eventArguments: any[]): void;
|
|
774
|
+
|
|
775
|
+
addTools(tools: dia.ToolsView): this;
|
|
776
|
+
|
|
777
|
+
hasTools(name?: string): boolean;
|
|
778
|
+
|
|
779
|
+
removeTools(): this;
|
|
780
|
+
|
|
781
|
+
showTools(): this;
|
|
782
|
+
|
|
783
|
+
hideTools(): this;
|
|
784
|
+
|
|
785
|
+
updateTools(opt?: { [key: string]: any }): this;
|
|
786
|
+
|
|
787
|
+
mountTools(): this;
|
|
788
|
+
|
|
789
|
+
unmountTools(): this;
|
|
790
|
+
|
|
791
|
+
getNodeMatrix(node: SVGElement): SVGMatrix;
|
|
792
|
+
|
|
793
|
+
getNodeRotateMatrix(node: SVGElement): SVGMatrix;
|
|
794
|
+
|
|
795
|
+
getNodeBoundingRect(node: SVGElement): g.Rect;
|
|
796
|
+
|
|
797
|
+
getBBox(opt?: { useModelGeometry?: boolean }): g.Rect;
|
|
798
|
+
|
|
799
|
+
getNodeBBox(node: SVGElement): g.Rect;
|
|
800
|
+
|
|
801
|
+
getNodeUnrotatedBBox(node: SVGElement): g.Rect;
|
|
802
|
+
|
|
803
|
+
isNodeConnection(node: SVGElement): boolean;
|
|
804
|
+
|
|
805
|
+
getEventTarget(evt: dia.Event, opt?: { fromPoint?: boolean }): Element;
|
|
806
|
+
|
|
807
|
+
checkMouseleave(evt: dia.Event): void;
|
|
808
|
+
|
|
809
|
+
getFlag(label: CellView.FlagLabel): number;
|
|
810
|
+
|
|
811
|
+
requestUpdate(flags: number, opt?: { [key: string]: any }): void;
|
|
812
|
+
|
|
813
|
+
dragLinkStart(evt: dia.Event, magnet: SVGElement, x: number, y: number): void;
|
|
814
|
+
|
|
815
|
+
dragLink(evt: dia.Event, x: number, y: number): void;
|
|
816
|
+
|
|
817
|
+
dragLinkEnd(evt: dia.Event, x: number, y: number): void;
|
|
818
|
+
|
|
819
|
+
preventDefaultInteraction(evt: dia.Event): void;
|
|
820
|
+
|
|
821
|
+
isDefaultInteractionPrevented(evt: dia.Event): boolean;
|
|
822
|
+
|
|
823
|
+
protected findBySelector(selector: string, root?: SVGElement): SVGElement[];
|
|
824
|
+
|
|
825
|
+
protected removeHighlighters(): void;
|
|
826
|
+
|
|
827
|
+
protected updateHighlighters(): void;
|
|
828
|
+
|
|
829
|
+
protected transformHighlighters(): void;
|
|
830
|
+
|
|
831
|
+
protected hasFlag(flags: number, label: CellView.FlagLabel): boolean;
|
|
832
|
+
|
|
833
|
+
protected removeFlag(flags: number, label: CellView.FlagLabel): number;
|
|
834
|
+
|
|
835
|
+
protected setFlags(): void;
|
|
836
|
+
|
|
837
|
+
protected onToolEvent(eventName: string): void;
|
|
838
|
+
|
|
839
|
+
protected pointerdblclick(evt: dia.Event, x: number, y: number): void;
|
|
840
|
+
|
|
841
|
+
protected pointerclick(evt: dia.Event, x: number, y: number): void;
|
|
842
|
+
|
|
843
|
+
protected contextmenu(evt: dia.Event, x: number, y: number): void;
|
|
844
|
+
|
|
845
|
+
protected pointerdown(evt: dia.Event, x: number, y: number): void;
|
|
846
|
+
|
|
847
|
+
protected pointermove(evt: dia.Event, x: number, y: number): void;
|
|
848
|
+
|
|
849
|
+
protected pointerup(evt: dia.Event, x: number, y: number): void;
|
|
850
|
+
|
|
851
|
+
protected mouseover(evt: dia.Event): void;
|
|
852
|
+
|
|
853
|
+
protected mouseout(evt: dia.Event): void;
|
|
854
|
+
|
|
855
|
+
protected mouseenter(evt: dia.Event): void;
|
|
856
|
+
|
|
857
|
+
protected mouseleave(evt: dia.Event): void;
|
|
858
|
+
|
|
859
|
+
protected mousewheel(evt: dia.Event, x: number, y: number, delta: number): void;
|
|
860
|
+
|
|
861
|
+
protected onevent(evt: dia.Event, eventName: string, x: number, y: number): void;
|
|
862
|
+
|
|
863
|
+
protected onmagnet(evt: dia.Event, x: number, y: number): void;
|
|
864
|
+
|
|
865
|
+
protected getLinkEnd(magnet: SVGElement, x: number, y: number, link: dia.Link, endType: dia.LinkEnd): dia.Link.EndJSON;
|
|
866
|
+
|
|
867
|
+
protected getMagnetFromLinkEnd(end: dia.Link.EndJSON): SVGElement;
|
|
868
|
+
|
|
869
|
+
protected customizeLinkEnd(end: dia.Link.EndJSON, magnet: SVGElement, x: number, y: number, link: dia.Link, endType: dia.LinkEnd): dia.Link.EndJSON;
|
|
870
|
+
|
|
871
|
+
protected addLinkFromMagnet(magnet: SVGElement, x: number, y: number): LinkView;
|
|
872
|
+
|
|
873
|
+
protected cleanNodesCache(): void;
|
|
874
|
+
|
|
875
|
+
protected nodeCache(magnet: SVGElement): CellView.NodeMetrics;
|
|
876
|
+
|
|
877
|
+
protected getNodeData(magnet: SVGElement): CellView.NodeData;
|
|
878
|
+
|
|
879
|
+
protected getNodeShape(magnet: SVGElement): g.Shape;
|
|
880
|
+
|
|
881
|
+
protected onMount(isInitialMount: boolean): void;
|
|
882
|
+
|
|
883
|
+
protected onDetach(): void;
|
|
884
|
+
|
|
885
|
+
static addPresentationAttributes(attributes: CellView.PresentationAttributes): CellView.PresentationAttributes;
|
|
886
|
+
|
|
887
|
+
static evalAttribute(attrName: string, attrValue: any, refBBox: dia.BBox): any;
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
class CellView extends CellViewGeneric<Cell> {
|
|
891
|
+
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
// dia.ElementView
|
|
895
|
+
|
|
896
|
+
|
|
897
|
+
export namespace ElementView {
|
|
898
|
+
|
|
899
|
+
enum Flags {
|
|
900
|
+
UPDATE = 'UPDATE',
|
|
901
|
+
TRANSLATE = 'TRANSLATE',
|
|
902
|
+
TOOLS = 'TOOLS',
|
|
903
|
+
RESIZE = 'RESIZE',
|
|
904
|
+
PORTS = 'PORTS',
|
|
905
|
+
ROTATE = 'ROTATE',
|
|
906
|
+
RENDER = 'RENDER'
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
interface InteractivityOptions {
|
|
910
|
+
elementMove?: boolean;
|
|
911
|
+
addLinkFromMagnet?: boolean;
|
|
912
|
+
stopDelegation?: boolean;
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
class ElementView extends CellViewGeneric<Element> {
|
|
917
|
+
|
|
918
|
+
update(element?: Element, renderingOnlyAttrs?: { [key: string]: any }): void;
|
|
919
|
+
|
|
920
|
+
setInteractivity(value: boolean | ElementView.InteractivityOptions): void;
|
|
921
|
+
|
|
922
|
+
getDelegatedView(): ElementView | null;
|
|
923
|
+
|
|
924
|
+
findPortNode(portId: string | number): SVGElement | null;
|
|
925
|
+
findPortNode(portId: string | number, selector: string): Element | null;
|
|
926
|
+
|
|
927
|
+
findPortNodes(portId: string | number, groupSelector: string): Element[];
|
|
928
|
+
|
|
929
|
+
protected renderMarkup(): void;
|
|
930
|
+
|
|
931
|
+
protected renderJSONMarkup(markup: MarkupJSON): void;
|
|
932
|
+
|
|
933
|
+
protected renderStringMarkup(markup: string): void;
|
|
934
|
+
|
|
935
|
+
protected updateTransformation(): void;
|
|
936
|
+
|
|
937
|
+
protected resize(): void;
|
|
938
|
+
|
|
939
|
+
protected translate(): void;
|
|
940
|
+
|
|
941
|
+
protected rotate(): void;
|
|
942
|
+
|
|
943
|
+
protected getTranslateString(): string;
|
|
944
|
+
|
|
945
|
+
protected getRotateString(): string;
|
|
946
|
+
|
|
947
|
+
protected dragStart(evt: dia.Event, x: number, y: number): void;
|
|
948
|
+
|
|
949
|
+
protected dragMagnetStart(evt: dia.Event, x: number, y: number): void;
|
|
950
|
+
|
|
951
|
+
protected drag(evt: dia.Event, x: number, y: number): void;
|
|
952
|
+
|
|
953
|
+
protected dragMagnet(evt: dia.Event, x: number, y: number): void;
|
|
954
|
+
|
|
955
|
+
protected dragEnd(evt: dia.Event, x: number, y: number): void;
|
|
956
|
+
|
|
957
|
+
protected dragMagnetEnd(evt: dia.Event, x: number, y: number): void;
|
|
958
|
+
|
|
959
|
+
protected prepareEmbedding(data: any): void;
|
|
960
|
+
|
|
961
|
+
protected processEmbedding(data: any, evt: dia.Event, x: number, y: number): void;
|
|
962
|
+
|
|
963
|
+
protected clearEmbedding(data: any): void;
|
|
964
|
+
|
|
965
|
+
protected finalizeEmbedding(data: any): void;
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
// dia.LinkView
|
|
969
|
+
|
|
970
|
+
|
|
971
|
+
export namespace LinkView {
|
|
972
|
+
|
|
973
|
+
enum Flags {
|
|
974
|
+
RENDER = 'RENDER',
|
|
975
|
+
UPDATE = 'UPDATE',
|
|
976
|
+
TOOLS = 'TOOLS',
|
|
977
|
+
LEGACY_TOOLS = 'LEGACY_TOOLS',
|
|
978
|
+
LABELS = 'LABELS',
|
|
979
|
+
VERTICES = 'VERTICES',
|
|
980
|
+
SOURCE = 'SOURCE',
|
|
981
|
+
TARGET = 'TARGET',
|
|
982
|
+
CONNECTOR = 'CONNECTOR'
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
interface InteractivityOptions {
|
|
986
|
+
labelMove?: boolean;
|
|
987
|
+
linkMove?: boolean;
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
interface LabelOptions extends Cell.Options {
|
|
991
|
+
absoluteDistance?: boolean;
|
|
992
|
+
reverseDistance?: boolean;
|
|
993
|
+
absoluteOffset?: boolean;
|
|
994
|
+
keepGradient?: boolean;
|
|
995
|
+
ensureLegibility?: boolean;
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
interface VertexOptions extends Cell.Options {
|
|
999
|
+
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
interface Options extends mvc.ViewOptions<Link, SVGElement> {
|
|
1003
|
+
labelsLayer?: Paper.Layers | string | false;
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
class LinkView extends CellViewGeneric<Link> {
|
|
1008
|
+
|
|
1009
|
+
options: LinkView.Options;
|
|
1010
|
+
sourceAnchor: g.Point;
|
|
1011
|
+
targetAnchor: g.Point;
|
|
1012
|
+
|
|
1013
|
+
sendToken(token: SVGElement, duration?: number, callback?: () => void): void;
|
|
1014
|
+
sendToken(token: SVGElement, opt?: { duration?: number, direction?: string, connection?: string }, callback?: () => void): void;
|
|
1015
|
+
|
|
1016
|
+
addLabel(coordinates: Point, opt?: LinkView.LabelOptions): number;
|
|
1017
|
+
addLabel(coordinates: Point, angle: number, opt?: LinkView.LabelOptions): number;
|
|
1018
|
+
addLabel(x: number, y: number, opt?: LinkView.LabelOptions): number;
|
|
1019
|
+
addLabel(x: number, y: number, angle: number, opt?: LinkView.LabelOptions): number;
|
|
1020
|
+
|
|
1021
|
+
addVertex(coordinates: Point, opt?: LinkView.VertexOptions): number;
|
|
1022
|
+
addVertex(x: number, y: number, opt?: LinkView.VertexOptions): number;
|
|
1023
|
+
|
|
1024
|
+
getConnection(): g.Path;
|
|
1025
|
+
|
|
1026
|
+
getSerializedConnection(): string;
|
|
1027
|
+
|
|
1028
|
+
getConnectionSubdivisions(): g.Curve[][];
|
|
1029
|
+
|
|
1030
|
+
getConnectionLength(): number;
|
|
1031
|
+
|
|
1032
|
+
getPointAtLength(length: number): g.Point;
|
|
1033
|
+
|
|
1034
|
+
getPointAtRatio(ratio: number): g.Point;
|
|
1035
|
+
|
|
1036
|
+
getTangentAtLength(length: number): g.Line;
|
|
1037
|
+
|
|
1038
|
+
getTangentAtRatio(ratio: number): g.Line;
|
|
1039
|
+
|
|
1040
|
+
getClosestPoint(point: Point): g.Point;
|
|
1041
|
+
|
|
1042
|
+
getClosestPointLength(point: Point): number;
|
|
1043
|
+
|
|
1044
|
+
getClosestPointRatio(point: Point): number;
|
|
1045
|
+
|
|
1046
|
+
getLabelPosition(x: number, y: number, opt?: LinkView.LabelOptions): Link.LabelPosition;
|
|
1047
|
+
getLabelPosition(x: number, y: number, angle: number, opt?: LinkView.LabelOptions): Link.LabelPosition;
|
|
1048
|
+
|
|
1049
|
+
getLabelCoordinates(labelPosition: Link.LabelPosition): g.Point;
|
|
1050
|
+
|
|
1051
|
+
getVertexIndex(x: number, y: number): number;
|
|
1052
|
+
getVertexIndex(point: Point): number;
|
|
1053
|
+
|
|
1054
|
+
update(): this;
|
|
1055
|
+
|
|
1056
|
+
translate(tx: number, ty: number): void;
|
|
1057
|
+
|
|
1058
|
+
requestConnectionUpdate(opt?: { [key: string]: any }): void;
|
|
1059
|
+
|
|
1060
|
+
setInteractivity(value: boolean | LinkView.InteractivityOptions): void;
|
|
1061
|
+
|
|
1062
|
+
getEndView(endType: dia.LinkEnd): dia.CellView | null;
|
|
1063
|
+
|
|
1064
|
+
getEndAnchor(endType: dia.LinkEnd): g.Point;
|
|
1065
|
+
|
|
1066
|
+
getEndConnectionPoint(endType: dia.LinkEnd): g.Point;
|
|
1067
|
+
|
|
1068
|
+
getEndMagnet(endType: dia.LinkEnd): SVGElement | null;
|
|
1069
|
+
|
|
1070
|
+
findLabelNode(labelIndex: string | number): SVGElement | null;
|
|
1071
|
+
findLabelNode(labelIndex: string | number, selector: string): Element | null;
|
|
1072
|
+
|
|
1073
|
+
findLabelNodes(labelIndex: string | number, groupSelector: string): Element[];
|
|
1074
|
+
|
|
1075
|
+
removeRedundantLinearVertices(opt?: dia.ModelSetOptions): number;
|
|
1076
|
+
|
|
1077
|
+
protected updateRoute(): void;
|
|
1078
|
+
|
|
1079
|
+
protected updatePath(): void;
|
|
1080
|
+
|
|
1081
|
+
protected updateDOM(): void;
|
|
1082
|
+
|
|
1083
|
+
protected onLabelsChange(link: Link, labels: Link.Label[], opt: { [key: string]: any }): void;
|
|
1084
|
+
|
|
1085
|
+
protected onToolsChange(link: Link, toolsMarkup: string, opt: { [key: string]: any }): void;
|
|
1086
|
+
|
|
1087
|
+
protected onVerticesChange(link: Link, vertices: Point[], opt: { [key: string]: any }): void;
|
|
1088
|
+
|
|
1089
|
+
protected onSourceChange(element: Element, sourceEnd: any, opt: { [key: string]: any }): void;
|
|
1090
|
+
|
|
1091
|
+
protected onTargetChange(element: Element, targetEnd: any, opt: { [key: string]: any }): void;
|
|
1092
|
+
|
|
1093
|
+
protected onlabel(evt: dia.Event, x: number, y: number): void;
|
|
1094
|
+
|
|
1095
|
+
protected dragLabelStart(evt: dia.Event, x: number, y: number): void;
|
|
1096
|
+
|
|
1097
|
+
protected dragArrowheadStart(evt: dia.Event, x: number, y: number): void;
|
|
1098
|
+
|
|
1099
|
+
protected dragStart(evt: dia.Event, x: number, y: number): void;
|
|
1100
|
+
|
|
1101
|
+
protected dragLabel(evt: dia.Event, x: number, y: number): void;
|
|
1102
|
+
|
|
1103
|
+
protected dragArrowhead(evt: dia.Event, x: number, y: number): void;
|
|
1104
|
+
|
|
1105
|
+
protected drag(evt: dia.Event, x: number, y: number): void;
|
|
1106
|
+
|
|
1107
|
+
protected dragLabelEnd(evt: dia.Event, x: number, y: number): void;
|
|
1108
|
+
|
|
1109
|
+
protected dragArrowheadEnd(evt: dia.Event, x: number, y: number): void;
|
|
1110
|
+
|
|
1111
|
+
protected dragEnd(evt: dia.Event, x: number, y: number): void;
|
|
1112
|
+
|
|
1113
|
+
protected findPath(route: Point[], sourcePoint: Point, targetPoint: Point): g.Path;
|
|
1114
|
+
|
|
1115
|
+
protected notifyPointerdown(evt: dia.Event, x: number, y: number): void;
|
|
1116
|
+
|
|
1117
|
+
protected notifyPointermove(evt: dia.Event, x: number, y: number): void;
|
|
1118
|
+
|
|
1119
|
+
protected notifyPointerup(evt: dia.Event, x: number, y: number): void;
|
|
1120
|
+
|
|
1121
|
+
protected mountLabels(): void;
|
|
1122
|
+
|
|
1123
|
+
protected unmountLabels(): void;
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
// dia.Paper
|
|
1127
|
+
|
|
1128
|
+
export namespace Paper {
|
|
1129
|
+
|
|
1130
|
+
interface GradientOptions {
|
|
1131
|
+
id?: string;
|
|
1132
|
+
type: 'linearGradient' | 'radialGradient';
|
|
1133
|
+
stops: Array<{
|
|
1134
|
+
offset: string;
|
|
1135
|
+
color: string;
|
|
1136
|
+
opacity?: number;
|
|
1137
|
+
}>;
|
|
1138
|
+
}
|
|
1139
|
+
interface FilterOptions {
|
|
1140
|
+
[key: string]: any;
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
interface PatternOptions {
|
|
1144
|
+
[key: string]: any;
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
interface MarkerOptions {
|
|
1148
|
+
[key: string]: any;
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
interface GridOptions {
|
|
1152
|
+
color?: string;
|
|
1153
|
+
thickness?: number;
|
|
1154
|
+
name?: 'dot' | 'fixedDot' | 'mesh' | 'doubleMesh';
|
|
1155
|
+
args?: Array<{ [key: string]: any }> | { [key: string]: any };
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
interface BackgroundOptions {
|
|
1159
|
+
color?: string;
|
|
1160
|
+
image?: string;
|
|
1161
|
+
quality?: number;
|
|
1162
|
+
position?: Point | string;
|
|
1163
|
+
size?: Size | string;
|
|
1164
|
+
repeat?: string;
|
|
1165
|
+
opacity?: number;
|
|
1166
|
+
waterMarkAngle?: number;
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
type Dimension = number | string | null;
|
|
1170
|
+
|
|
1171
|
+
enum sorting {
|
|
1172
|
+
EXACT = 'sorting-exact',
|
|
1173
|
+
APPROX = 'sorting-approximate',
|
|
1174
|
+
NONE = 'sorting-none'
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
enum Layers {
|
|
1178
|
+
CELLS = 'cells',
|
|
1179
|
+
LABELS = 'labels',
|
|
1180
|
+
BACK = 'back',
|
|
1181
|
+
FRONT = 'front',
|
|
1182
|
+
TOOLS = 'tools',
|
|
1183
|
+
GRID = 'grid',
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
type UpdateStats = {
|
|
1187
|
+
priority: number;
|
|
1188
|
+
updated: number;
|
|
1189
|
+
empty?: boolean;
|
|
1190
|
+
postponed?: number;
|
|
1191
|
+
unmounted?: number;
|
|
1192
|
+
mounted?: number;
|
|
1193
|
+
batches?: number;
|
|
1194
|
+
};
|
|
1195
|
+
|
|
1196
|
+
type ViewportCallback = (view: mvc.View<any, any>, isMounted: boolean, paper: Paper) => boolean;
|
|
1197
|
+
type ProgressCallback = (done: boolean, processed: number, total: number, stats: UpdateStats, paper: Paper) => void;
|
|
1198
|
+
type BeforeRenderCallback = (opt: { [key: string]: any }, paper: Paper) => void;
|
|
1199
|
+
type AfterRenderCallback = (stats: UpdateStats, opt: { [key: string]: any }, paper: Paper) => void;
|
|
1200
|
+
|
|
1201
|
+
interface FreezeOptions {
|
|
1202
|
+
key?: string;
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
interface UnfreezeOptions {
|
|
1206
|
+
key?: string;
|
|
1207
|
+
mountBatchSize?: number;
|
|
1208
|
+
unmountBatchSize?: number;
|
|
1209
|
+
batchSize?: number;
|
|
1210
|
+
viewport?: ViewportCallback;
|
|
1211
|
+
progress?: ProgressCallback;
|
|
1212
|
+
beforeRender?: BeforeRenderCallback;
|
|
1213
|
+
afterRender?: AfterRenderCallback;
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
type PointConstraintCallback = (x: number, y: number, opt: any) => Point;
|
|
1217
|
+
type RestrictTranslateCallback = (elementView: ElementView, x0: number, y0: number) => BBox | boolean | PointConstraintCallback;
|
|
1218
|
+
type FindParentByType = 'bbox' | 'pointer' | PositionName;
|
|
1219
|
+
type FindParentByCallback = ((this: dia.Graph, elementView: ElementView, evt: dia.Event, x: number, y: number) => Cell[]);
|
|
1220
|
+
|
|
1221
|
+
interface Options extends mvc.ViewOptions<Graph> {
|
|
1222
|
+
// appearance
|
|
1223
|
+
width?: Dimension;
|
|
1224
|
+
height?: Dimension;
|
|
1225
|
+
drawGrid?: boolean | GridOptions | GridOptions[];
|
|
1226
|
+
drawGridSize?: number | null;
|
|
1227
|
+
background?: BackgroundOptions;
|
|
1228
|
+
labelsLayer?: boolean | Paper.Layers | string;
|
|
1229
|
+
// interactions
|
|
1230
|
+
gridSize?: number;
|
|
1231
|
+
highlighting?: boolean | Record<string | dia.CellView.Highlighting, highlighters.HighlighterJSON | boolean>;
|
|
1232
|
+
interactive?: ((cellView: CellView, event: string) => boolean | CellView.InteractivityOptions) | boolean | CellView.InteractivityOptions;
|
|
1233
|
+
snapLabels?: boolean;
|
|
1234
|
+
snapLinks?: boolean | { radius: number };
|
|
1235
|
+
snapLinksSelf?: boolean | { distance: number };
|
|
1236
|
+
markAvailable?: boolean;
|
|
1237
|
+
// validations
|
|
1238
|
+
validateMagnet?: (cellView: CellView, magnet: SVGElement, evt: dia.Event) => boolean;
|
|
1239
|
+
validateConnection?: (cellViewS: CellView, magnetS: SVGElement, cellViewT: CellView, magnetT: SVGElement, end: LinkEnd, linkView: LinkView) => boolean;
|
|
1240
|
+
restrictTranslate?: RestrictTranslateCallback | boolean | BBox;
|
|
1241
|
+
multiLinks?: boolean;
|
|
1242
|
+
linkPinning?: boolean;
|
|
1243
|
+
allowLink?: ((linkView: LinkView, paper: Paper) => boolean) | null;
|
|
1244
|
+
// events
|
|
1245
|
+
guard?: (evt: dia.Event, view: CellView) => boolean;
|
|
1246
|
+
preventContextMenu?: boolean;
|
|
1247
|
+
preventDefaultViewAction?: boolean;
|
|
1248
|
+
preventDefaultBlankAction?: boolean;
|
|
1249
|
+
clickThreshold?: number;
|
|
1250
|
+
moveThreshold?: number;
|
|
1251
|
+
magnetThreshold?: number | string;
|
|
1252
|
+
// views
|
|
1253
|
+
elementView?: typeof ElementView | ((element: Element) => typeof ElementView);
|
|
1254
|
+
linkView?: typeof LinkView | ((link: Link) => typeof LinkView);
|
|
1255
|
+
// embedding
|
|
1256
|
+
embeddingMode?: boolean;
|
|
1257
|
+
frontParentOnly?: boolean;
|
|
1258
|
+
findParentBy?: FindParentByType | FindParentByCallback;
|
|
1259
|
+
validateEmbedding?: (this: Paper, childView: ElementView, parentView: ElementView) => boolean;
|
|
1260
|
+
validateUnembedding?: (this: Paper, childView: ElementView) => boolean;
|
|
1261
|
+
// default views, models & attributes
|
|
1262
|
+
cellViewNamespace?: any;
|
|
1263
|
+
routerNamespace?: any;
|
|
1264
|
+
connectorNamespace?: any;
|
|
1265
|
+
highlighterNamespace?: any;
|
|
1266
|
+
anchorNamespace?: any;
|
|
1267
|
+
linkAnchorNamespace?: any;
|
|
1268
|
+
connectionPointNamespace?: any;
|
|
1269
|
+
defaultLink?: ((cellView: CellView, magnet: SVGElement) => Link) | Link;
|
|
1270
|
+
defaultRouter?: routers.Router | routers.RouterJSON;
|
|
1271
|
+
defaultConnector?: connectors.Connector | connectors.ConnectorJSON;
|
|
1272
|
+
defaultAnchor?: anchors.AnchorJSON | anchors.Anchor;
|
|
1273
|
+
defaultLinkAnchor?: anchors.AnchorJSON | anchors.Anchor;
|
|
1274
|
+
defaultConnectionPoint?: connectionPoints.ConnectionPointJSON | connectionPoints.ConnectionPoint | ((...args: any[]) => connectionPoints.ConnectionPoint);
|
|
1275
|
+
// connecting
|
|
1276
|
+
connectionStrategy?: connectionStrategies.ConnectionStrategy;
|
|
1277
|
+
// rendering
|
|
1278
|
+
async?: boolean;
|
|
1279
|
+
sorting?: sorting;
|
|
1280
|
+
frozen?: boolean;
|
|
1281
|
+
autoFreeze?: boolean;
|
|
1282
|
+
viewport?: ViewportCallback | null;
|
|
1283
|
+
onViewUpdate?: (view: mvc.View<any, any>, flag: number, priority: number, opt: { [key: string]: any }, paper: Paper) => void;
|
|
1284
|
+
onViewPostponed?: (view: mvc.View<any, any>, flag: number, paper: Paper) => boolean;
|
|
1285
|
+
beforeRender?: Paper.BeforeRenderCallback;
|
|
1286
|
+
afterRender?: Paper.AfterRenderCallback;
|
|
1287
|
+
overflow?: boolean;
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
interface TransformToFitContentOptions {
|
|
1291
|
+
padding?: Padding;
|
|
1292
|
+
preserveAspectRatio?: boolean;
|
|
1293
|
+
minScale?: number;
|
|
1294
|
+
minScaleX?: number;
|
|
1295
|
+
minScaleY?: number;
|
|
1296
|
+
maxScale?: number;
|
|
1297
|
+
maxScaleX?: number;
|
|
1298
|
+
maxScaleY?: number;
|
|
1299
|
+
scaleGrid?: number;
|
|
1300
|
+
useModelGeometry?: boolean;
|
|
1301
|
+
fittingBBox?: BBox;
|
|
1302
|
+
contentArea?: BBox;
|
|
1303
|
+
verticalAlign?: 'top' | 'middle' | 'bottom';
|
|
1304
|
+
horizontalAlign?: 'left' | 'middle' | 'right';
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
/**
|
|
1308
|
+
* @deprecated
|
|
1309
|
+
*/
|
|
1310
|
+
type ScaleContentOptions = TransformToFitContentOptions;
|
|
1311
|
+
|
|
1312
|
+
interface FitToContentOptions {
|
|
1313
|
+
gridWidth?: number;
|
|
1314
|
+
gridHeight?: number;
|
|
1315
|
+
padding?: Padding;
|
|
1316
|
+
allowNewOrigin?: 'negative' | 'positive' | 'any';
|
|
1317
|
+
allowNegativeBottomRight?: boolean;
|
|
1318
|
+
minWidth?: number;
|
|
1319
|
+
minHeight?: number;
|
|
1320
|
+
maxWidth?: number;
|
|
1321
|
+
maxHeight?: number;
|
|
1322
|
+
useModelGeometry?: boolean;
|
|
1323
|
+
contentArea?: BBox;
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
interface EventMap {
|
|
1327
|
+
// pointerclick
|
|
1328
|
+
'cell:pointerclick': (cellView: dia.CellView, evt: dia.Event, x: number, y: number) => void;
|
|
1329
|
+
'element:pointerclick': (elementView: dia.ElementView, evt: dia.Event, x: number, y: number) => void;
|
|
1330
|
+
'link:pointerclick': (linkView: dia.LinkView, evt: dia.Event, x: number, y: number) => void;
|
|
1331
|
+
'blank:pointerclick': (evt: dia.Event, x: number, y: number) => void;
|
|
1332
|
+
// pointerdblclick
|
|
1333
|
+
'cell:pointerdblclick': (cellView: dia.CellView, evt: dia.Event, x: number, y: number) => void;
|
|
1334
|
+
'element:pointerdblclick': (elementView: dia.ElementView, evt: dia.Event, x: number, y: number) => void;
|
|
1335
|
+
'link:pointerdblclick': (linkView: dia.LinkView, evt: dia.Event, x: number, y: number) => void;
|
|
1336
|
+
'blank:pointerdblclick': (evt: dia.Event, x: number, y: number) => void;
|
|
1337
|
+
// contextmenu
|
|
1338
|
+
'cell:contextmenu': (cellView: dia.CellView, evt: dia.Event, x: number, y: number) => void;
|
|
1339
|
+
'element:contextmenu': (elementView: dia.ElementView, evt: dia.Event, x: number, y: number) => void;
|
|
1340
|
+
'link:contextmenu': (linkView: dia.LinkView, evt: dia.Event, x: number, y: number) => void;
|
|
1341
|
+
'blank:contextmenu': (evt: dia.Event, x: number, y: number) => void;
|
|
1342
|
+
// pointerdown
|
|
1343
|
+
'cell:pointerdown': (cellView: dia.CellView, evt: dia.Event, x: number, y: number) => void;
|
|
1344
|
+
'element:pointerdown': (elementView: dia.ElementView, evt: dia.Event, x: number, y: number) => void;
|
|
1345
|
+
'link:pointerdown': (linkView: dia.LinkView, evt: dia.Event, x: number, y: number) => void;
|
|
1346
|
+
'blank:pointerdown': (evt: dia.Event, x: number, y: number) => void;
|
|
1347
|
+
// pointerdown
|
|
1348
|
+
'cell:pointermove': (cellView: dia.CellView, evt: dia.Event, x: number, y: number) => void;
|
|
1349
|
+
'element:pointermove': (elementView: dia.ElementView, evt: dia.Event, x: number, y: number) => void;
|
|
1350
|
+
'link:pointermove': (linkView: dia.LinkView, evt: dia.Event, x: number, y: number) => void;
|
|
1351
|
+
'blank:pointermove': (evt: dia.Event, x: number, y: number) => void;
|
|
1352
|
+
// pointerup
|
|
1353
|
+
'cell:pointerup': (cellView: dia.CellView, evt: dia.Event, x: number, y: number) => void;
|
|
1354
|
+
'element:pointerup': (elementView: dia.ElementView, evt: dia.Event, x: number, y: number) => void;
|
|
1355
|
+
'link:pointerup': (linkView: dia.LinkView, evt: dia.Event, x: number, y: number) => void;
|
|
1356
|
+
'blank:pointerup': (evt: dia.Event, x: number, y: number) => void;
|
|
1357
|
+
// mouseover
|
|
1358
|
+
'cell:mouseover': (cellView: dia.CellView, evt: dia.Event) => void;
|
|
1359
|
+
'element:mouseover': (elementView: dia.ElementView, evt: dia.Event) => void;
|
|
1360
|
+
'link:mouseover': (linkView: dia.LinkView, evt: dia.Event) => void;
|
|
1361
|
+
'blank:mouseover': (evt: dia.Event) => void;
|
|
1362
|
+
// mouseout
|
|
1363
|
+
'cell:mouseout': (cellView: dia.CellView, evt: dia.Event) => void;
|
|
1364
|
+
'element:mouseout': (elementView: dia.ElementView, evt: dia.Event) => void;
|
|
1365
|
+
'link:mouseout': (linkView: dia.LinkView, evt: dia.Event) => void;
|
|
1366
|
+
'blank:mouseout': (evt: dia.Event) => void;
|
|
1367
|
+
// mouseenter
|
|
1368
|
+
'cell:mouseenter': (cellView: dia.CellView, evt: dia.Event) => void;
|
|
1369
|
+
'element:mouseenter': (elementView: dia.ElementView, evt: dia.Event) => void;
|
|
1370
|
+
'link:mouseenter': (linkView: dia.LinkView, evt: dia.Event) => void;
|
|
1371
|
+
'blank:mouseenter': (evt: dia.Event) => void;
|
|
1372
|
+
// mouseleave
|
|
1373
|
+
'cell:mouseleave': (cellView: dia.CellView, evt: dia.Event) => void;
|
|
1374
|
+
'element:mouseleave': (elementView: dia.ElementView, evt: dia.Event) => void;
|
|
1375
|
+
'link:mouseleave': (linkView: dia.LinkView, evt: dia.Event) => void;
|
|
1376
|
+
'blank:mouseleave': (evt: dia.Event) => void;
|
|
1377
|
+
// mousewheel
|
|
1378
|
+
'cell:mousewheel': (cellView: dia.CellView, evt: dia.Event, x: number, y: number, delta: number) => void;
|
|
1379
|
+
'element:mousewheel': (elementView: dia.ElementView, evt: dia.Event, x: number, y: number, delta: number) => void;
|
|
1380
|
+
'link:mousewheel': (linkView: dia.LinkView, evt: dia.Event, x: number, y: number, delta: number) => void;
|
|
1381
|
+
'blank:mousewheel': (evt: dia.Event, x: number, y: number, delta: number) => void;
|
|
1382
|
+
// touchpad
|
|
1383
|
+
'paper:pan': (evt: dia.Event, deltaX: number, deltaY: number) => void;
|
|
1384
|
+
'paper:pinch': (evt: dia.Event, x: number, y: number, scale: number) => void;
|
|
1385
|
+
// magnet
|
|
1386
|
+
'element:magnet:pointerclick': (elementView: dia.ElementView, evt: dia.Event, magnetNode: SVGElement, x: number, y: number) => void;
|
|
1387
|
+
'element:magnet:pointerdblclick': (elementView: dia.ElementView, evt: dia.Event, magnetNode: SVGElement, x: number, y: number) => void;
|
|
1388
|
+
'element:magnet:contextmenu': (elementView: dia.ElementView, evt: dia.Event, magnetNode: SVGElement, x: number, y: number) => void;
|
|
1389
|
+
// highlighting
|
|
1390
|
+
'cell:highlight': (cellView: dia.CellView, node: SVGElement, options: dia.CellView.EventHighlightOptions) => void;
|
|
1391
|
+
'cell:unhighlight': (cellView: dia.CellView, node: SVGElement, options: dia.CellView.EventHighlightOptions) => void;
|
|
1392
|
+
'cell:highlight:invalid': (cellView: dia.CellView, highlighterId: string, highlighter: dia.HighlighterView) => void;
|
|
1393
|
+
// connect
|
|
1394
|
+
'link:connect': (linkView: dia.LinkView, evt: dia.Event, newCellView: dia.CellView, newCellViewMagnet: SVGElement, arrowhead: dia.LinkEnd) => void;
|
|
1395
|
+
'link:disconnect': (linkView: dia.LinkView, evt: dia.Event, prevCellView: dia.CellView, prevCellViewMagnet: SVGElement, arrowhead: dia.LinkEnd) => void;
|
|
1396
|
+
'link:snap:connect': (linkView: dia.LinkView, evt: dia.Event, newCellView: dia.CellView, newCellViewMagnet: SVGElement, arrowhead: dia.LinkEnd) => void;
|
|
1397
|
+
'link:snap:disconnect': (linkView: dia.LinkView, evt: dia.Event, prevCellView: dia.CellView, prevCellViewMagnet: SVGElement, arrowhead: dia.LinkEnd) => void;
|
|
1398
|
+
// render
|
|
1399
|
+
'render:done': (stats: UpdateStats, opt: any) => void;
|
|
1400
|
+
// transformations
|
|
1401
|
+
'translate': (tx: number, ty: number, data: unknown) => void;
|
|
1402
|
+
'scale': (sx: number, sy: number, data: unknown) => void;
|
|
1403
|
+
'resize': (width: number, height: number, data: unknown) => void;
|
|
1404
|
+
'transform': (matrix: SVGMatrix, data: unknown) => void;
|
|
1405
|
+
// custom
|
|
1406
|
+
[eventName: string]: mvc.EventHandler;
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
class Paper extends mvc.View<Graph> {
|
|
1411
|
+
|
|
1412
|
+
constructor(opt: Paper.Options);
|
|
1413
|
+
|
|
1414
|
+
options: Paper.Options;
|
|
1415
|
+
|
|
1416
|
+
stylesheet: string;
|
|
1417
|
+
|
|
1418
|
+
svg: SVGSVGElement;
|
|
1419
|
+
defs: SVGDefsElement;
|
|
1420
|
+
cells: SVGGElement;
|
|
1421
|
+
tools: SVGGElement;
|
|
1422
|
+
layers: SVGGElement;
|
|
1423
|
+
viewport: SVGGElement;
|
|
1424
|
+
|
|
1425
|
+
GUARDED_TAG_NAMES: string[];
|
|
1426
|
+
FORM_CONTROLS_TAG_NAMES: string[];
|
|
1427
|
+
|
|
1428
|
+
matrix(): SVGMatrix;
|
|
1429
|
+
matrix(ctm: SVGMatrix | Vectorizer.Matrix, data?: any): this;
|
|
1430
|
+
|
|
1431
|
+
clientMatrix(): SVGMatrix;
|
|
1432
|
+
|
|
1433
|
+
clientOffset(): g.Point;
|
|
1434
|
+
|
|
1435
|
+
pageOffset(): g.Point;
|
|
1436
|
+
|
|
1437
|
+
clientToLocalPoint(x: number, y: number): g.Point;
|
|
1438
|
+
clientToLocalPoint(point: Point): g.Point;
|
|
1439
|
+
|
|
1440
|
+
clientToLocalRect(x: number, y: number, width: number, height: number): g.Rect;
|
|
1441
|
+
clientToLocalRect(rect: BBox): g.Rect;
|
|
1442
|
+
|
|
1443
|
+
localToClientPoint(x: number, y: number): g.Point;
|
|
1444
|
+
localToClientPoint(point: Point): g.Point;
|
|
1445
|
+
|
|
1446
|
+
localToClientRect(x: number, y: number, width: number, height: number): g.Rect;
|
|
1447
|
+
localToClientRect(rect: BBox): g.Rect;
|
|
1448
|
+
|
|
1449
|
+
localToPagePoint(x: number, y: number): g.Point;
|
|
1450
|
+
localToPagePoint(point: Point): g.Point;
|
|
1451
|
+
|
|
1452
|
+
localToPageRect(x: number, y: number, width: number, height: number): g.Rect;
|
|
1453
|
+
localToPageRect(rect: BBox): g.Rect;
|
|
1454
|
+
|
|
1455
|
+
localToPaperPoint(x: number, y: number): g.Point;
|
|
1456
|
+
localToPaperPoint(point: Point): g.Point;
|
|
1457
|
+
|
|
1458
|
+
localToPaperRect(x: number, y: number, width: number, height: number): g.Rect;
|
|
1459
|
+
localToPaperRect(rect: BBox): g.Rect;
|
|
1460
|
+
|
|
1461
|
+
pageToLocalPoint(x: number, y: number): g.Point;
|
|
1462
|
+
pageToLocalPoint(point: Point): g.Point;
|
|
1463
|
+
|
|
1464
|
+
pageToLocalRect(x: number, y: number, width: number, height: number): g.Rect;
|
|
1465
|
+
pageToLocalRect(rect: BBox): g.Rect;
|
|
1466
|
+
|
|
1467
|
+
paperToLocalPoint(x: number, y: number): g.Point;
|
|
1468
|
+
paperToLocalPoint(point: Point): g.Point;
|
|
1469
|
+
|
|
1470
|
+
paperToLocalRect(x: number, y: number, width: number, height: number): g.Rect;
|
|
1471
|
+
paperToLocalRect(x: BBox): g.Rect;
|
|
1472
|
+
|
|
1473
|
+
snapToGrid(x: number, y: number): g.Point;
|
|
1474
|
+
snapToGrid(point: Point): g.Point;
|
|
1475
|
+
|
|
1476
|
+
defineFilter(filter: SVGFilterJSON): string;
|
|
1477
|
+
|
|
1478
|
+
defineGradient(gradient: SVGGradientJSON): string;
|
|
1479
|
+
|
|
1480
|
+
defineMarker(marker: SVGMarkerJSON): string;
|
|
1481
|
+
|
|
1482
|
+
definePattern(pattern: Omit<SVGPatternJSON, 'type'>): string;
|
|
1483
|
+
|
|
1484
|
+
isDefined(defId: string): boolean;
|
|
1485
|
+
|
|
1486
|
+
getComputedSize(): Size;
|
|
1487
|
+
|
|
1488
|
+
getArea(): g.Rect;
|
|
1489
|
+
|
|
1490
|
+
getRestrictedArea(): g.Rect | null;
|
|
1491
|
+
getRestrictedArea(elementView: ElementView, x: number, y: number): g.Rect | null | Paper.PointConstraintCallback;
|
|
1492
|
+
|
|
1493
|
+
getContentArea(opt?: { useModelGeometry: boolean }): g.Rect;
|
|
1494
|
+
|
|
1495
|
+
getContentBBox(opt?: { useModelGeometry: boolean }): g.Rect;
|
|
1496
|
+
|
|
1497
|
+
findView<T extends ElementView | LinkView>(element: mvc.$SVGElement): T;
|
|
1498
|
+
|
|
1499
|
+
findViewByModel<T extends ElementView | LinkView>(model: Cell | Cell.ID): T;
|
|
1500
|
+
|
|
1501
|
+
findViewsFromPoint(point: string | Point): ElementView[];
|
|
1502
|
+
|
|
1503
|
+
findViewsInArea(rect: BBox, opt?: { strict?: boolean }): ElementView[];
|
|
1504
|
+
|
|
1505
|
+
fitToContent(opt?: Paper.FitToContentOptions): g.Rect;
|
|
1506
|
+
fitToContent(gridWidth?: number, gridHeight?: number, padding?: number, opt?: any): g.Rect;
|
|
1507
|
+
|
|
1508
|
+
getFitToContentArea(opt?: Paper.FitToContentOptions): g.Rect;
|
|
1509
|
+
|
|
1510
|
+
/**
|
|
1511
|
+
* @deprecated use transformToFitContent
|
|
1512
|
+
*/
|
|
1513
|
+
scaleContentToFit(opt?: Paper.ScaleContentOptions): void;
|
|
1514
|
+
|
|
1515
|
+
transformToFitContent(opt?: Paper.TransformToFitContentOptions): void;
|
|
1516
|
+
|
|
1517
|
+
drawBackground(opt?: Paper.BackgroundOptions): this;
|
|
1518
|
+
|
|
1519
|
+
getDefaultLink(cellView: CellView, magnet: SVGElement): Link;
|
|
1520
|
+
|
|
1521
|
+
getModelById(id: Cell.ID | Cell): Cell;
|
|
1522
|
+
|
|
1523
|
+
setDimensions(width: Paper.Dimension, height: Paper.Dimension, data?: any): void;
|
|
1524
|
+
|
|
1525
|
+
setInteractivity(value: any): void;
|
|
1526
|
+
|
|
1527
|
+
scale(): Vectorizer.Scale;
|
|
1528
|
+
scale(sx: number, sy?: number, data?: any): this;
|
|
1529
|
+
|
|
1530
|
+
scaleUniformAtPoint(scale: number, point: Point, data?: any): this;
|
|
1531
|
+
|
|
1532
|
+
translate(): Vectorizer.Translation;
|
|
1533
|
+
translate(tx: number, ty?: number, data?: any): this;
|
|
1534
|
+
|
|
1535
|
+
update(): this;
|
|
1536
|
+
|
|
1537
|
+
getPointerArgs(evt: dia.Event): [dia.Event, number, number];
|
|
1538
|
+
|
|
1539
|
+
// grid
|
|
1540
|
+
|
|
1541
|
+
setGrid(opt?: null | boolean | string | Paper.GridOptions | Paper.GridOptions[]): this;
|
|
1542
|
+
|
|
1543
|
+
setGridSize(gridSize: number): this;
|
|
1544
|
+
|
|
1545
|
+
// tools
|
|
1546
|
+
|
|
1547
|
+
removeTools(): this;
|
|
1548
|
+
|
|
1549
|
+
hideTools(): this;
|
|
1550
|
+
|
|
1551
|
+
showTools(): this;
|
|
1552
|
+
|
|
1553
|
+
dispatchToolsEvent(eventName: string, ...args: any[]): void;
|
|
1554
|
+
|
|
1555
|
+
// layers
|
|
1556
|
+
|
|
1557
|
+
getLayerNode(layerName: Paper.Layers | string): SVGGElement;
|
|
1558
|
+
|
|
1559
|
+
getLayerView(layerName: Paper.Layers | string): any;
|
|
1560
|
+
|
|
1561
|
+
hasLayerView(layerName: Paper.Layers | string): boolean;
|
|
1562
|
+
|
|
1563
|
+
renderLayers(layers: Array<{ name: string }>): void;
|
|
1564
|
+
|
|
1565
|
+
protected removeLayers(): void;
|
|
1566
|
+
|
|
1567
|
+
protected resetLayers(): void;
|
|
1568
|
+
|
|
1569
|
+
// rendering
|
|
1570
|
+
|
|
1571
|
+
freeze(opt?: Paper.FreezeOptions): void;
|
|
1572
|
+
|
|
1573
|
+
unfreeze(opt?: Paper.UnfreezeOptions): void;
|
|
1574
|
+
|
|
1575
|
+
isFrozen(): boolean;
|
|
1576
|
+
|
|
1577
|
+
requestViewUpdate(view: mvc.View<any, any>, flag: number, priority: number, opt?: { [key: string]: any }): void;
|
|
1578
|
+
|
|
1579
|
+
requireView<T extends ElementView | LinkView>(model: Cell | Cell.ID, opt?: dia.Cell.Options): T;
|
|
1580
|
+
|
|
1581
|
+
dumpViews(opt?: {
|
|
1582
|
+
batchSize?: number;
|
|
1583
|
+
mountBatchSize?: number;
|
|
1584
|
+
unmountBatchSize?: number;
|
|
1585
|
+
viewport?: Paper.ViewportCallback;
|
|
1586
|
+
progress?: Paper.ProgressCallback;
|
|
1587
|
+
}): void;
|
|
1588
|
+
|
|
1589
|
+
checkViewport(opt?: {
|
|
1590
|
+
mountBatchSize?: number;
|
|
1591
|
+
unmountBatchSize?: number;
|
|
1592
|
+
viewport?: Paper.ViewportCallback;
|
|
1593
|
+
}): {
|
|
1594
|
+
mounted: number;
|
|
1595
|
+
unmounted: number;
|
|
1596
|
+
};
|
|
1597
|
+
|
|
1598
|
+
updateViews(opt?: {
|
|
1599
|
+
batchSize?: number;
|
|
1600
|
+
viewport?: Paper.ViewportCallback;
|
|
1601
|
+
progress?: Paper.ProgressCallback;
|
|
1602
|
+
}): {
|
|
1603
|
+
updated: number;
|
|
1604
|
+
batches: number;
|
|
1605
|
+
};
|
|
1606
|
+
|
|
1607
|
+
hasScheduledUpdates(): boolean;
|
|
1608
|
+
|
|
1609
|
+
// events
|
|
1610
|
+
|
|
1611
|
+
on<T extends keyof Paper.EventMap = keyof Paper.EventMap>(eventName: T, callback: Paper.EventMap[T], context?: any): this;
|
|
1612
|
+
|
|
1613
|
+
on<T extends keyof Paper.EventMap = keyof Paper.EventMap>(events: { [eventName in T]: Paper.EventMap[eventName]; }, context?: any): this;
|
|
1614
|
+
|
|
1615
|
+
// protected
|
|
1616
|
+
|
|
1617
|
+
/**
|
|
1618
|
+
* For the specified view, calls the visibility viewport function specified by the paper.options.viewport function.
|
|
1619
|
+
* If the function returns true, the view is attached to the DOM; in other case it is detached.
|
|
1620
|
+
* While async papers do this automatically, synchronous papers require an explicit call to this method for this functionality to be applied. To show the view again, use paper.requestView().
|
|
1621
|
+
* If you are using autoFreeze option you should call this function if you are calling paper.requestView() if you want paper.options.viewport function to be applied.
|
|
1622
|
+
* @param cellView cellView for which the visibility check is performed
|
|
1623
|
+
* @param opt if opt.viewport is provided, it is used as the callback function instead of paper.options.viewport.
|
|
1624
|
+
*/
|
|
1625
|
+
protected checkViewVisibility(cellView: dia.CellView, opt?: {
|
|
1626
|
+
viewport?: Paper.ViewportCallback;
|
|
1627
|
+
}): {
|
|
1628
|
+
mounted: number;
|
|
1629
|
+
unmounted: number;
|
|
1630
|
+
};
|
|
1631
|
+
|
|
1632
|
+
protected scheduleViewUpdate(view: mvc.View<any, any>, flag: number, priority: number, opt?: { [key: string]: any }): void;
|
|
1633
|
+
|
|
1634
|
+
protected dumpViewUpdate(view: mvc.View<any, any>): number;
|
|
1635
|
+
|
|
1636
|
+
protected dumpView(view: mvc.View<any, any>, opt?: { [key: string]: any }): number;
|
|
1637
|
+
|
|
1638
|
+
protected updateView(view: mvc.View<any, any>, flag: number, opt?: { [key: string]: any }): number;
|
|
1639
|
+
|
|
1640
|
+
protected registerUnmountedView(view: mvc.View<any, any>): number;
|
|
1641
|
+
|
|
1642
|
+
protected registerMountedView(view: mvc.View<any, any>): number;
|
|
1643
|
+
|
|
1644
|
+
protected updateViewsAsync(opt?: {
|
|
1645
|
+
batchSize?: number;
|
|
1646
|
+
mountBatchSize?: number;
|
|
1647
|
+
unmountBatchSize?: number;
|
|
1648
|
+
viewport?: Paper.ViewportCallback;
|
|
1649
|
+
progress?: Paper.ProgressCallback;
|
|
1650
|
+
before?: Paper.BeforeRenderCallback;
|
|
1651
|
+
}): void;
|
|
1652
|
+
|
|
1653
|
+
protected updateViewsBatch(opt?: {
|
|
1654
|
+
batchSize?: number;
|
|
1655
|
+
viewport?: Paper.ViewportCallback;
|
|
1656
|
+
}): Paper.UpdateStats;
|
|
1657
|
+
|
|
1658
|
+
protected checkMountedViews(viewport: Paper.ViewportCallback, opt?: { unmountBatchSize?: number }): number;
|
|
1659
|
+
|
|
1660
|
+
protected checkUnmountedViews(viewport: Paper.ViewportCallback, opt?: { mountBatchSize?: number }): number;
|
|
1661
|
+
|
|
1662
|
+
protected isAsync(): boolean;
|
|
1663
|
+
|
|
1664
|
+
protected isExactSorting(): boolean;
|
|
1665
|
+
|
|
1666
|
+
protected sortViews(): void;
|
|
1667
|
+
|
|
1668
|
+
protected sortViewsExact(): void;
|
|
1669
|
+
|
|
1670
|
+
protected pointerdblclick(evt: dia.Event): void;
|
|
1671
|
+
|
|
1672
|
+
protected pointerclick(evt: dia.Event): void;
|
|
1673
|
+
|
|
1674
|
+
protected contextmenu(evt: dia.Event): void;
|
|
1675
|
+
|
|
1676
|
+
protected pointerdown(evt: dia.Event): void;
|
|
1677
|
+
|
|
1678
|
+
protected pointermove(evt: dia.Event): void;
|
|
1679
|
+
|
|
1680
|
+
protected pointerup(evt: dia.Event): void;
|
|
1681
|
+
|
|
1682
|
+
protected mouseover(evt: dia.Event): void;
|
|
1683
|
+
|
|
1684
|
+
protected mouseout(evt: dia.Event): void;
|
|
1685
|
+
|
|
1686
|
+
protected mouseenter(evt: dia.Event): void;
|
|
1687
|
+
|
|
1688
|
+
protected mouseleave(evt: dia.Event): void;
|
|
1689
|
+
|
|
1690
|
+
protected mousewheel(evt: dia.Event): void;
|
|
1691
|
+
|
|
1692
|
+
protected onevent(evt: dia.Event): void;
|
|
1693
|
+
|
|
1694
|
+
protected onmagnet(evt: dia.Event): void;
|
|
1695
|
+
|
|
1696
|
+
protected onlabel(evt: dia.Event): void;
|
|
1697
|
+
|
|
1698
|
+
protected guard(evt: dia.Event, view: CellView): boolean;
|
|
1699
|
+
|
|
1700
|
+
protected drawBackgroundImage(img: HTMLImageElement, opt: { [key: string]: any }): void;
|
|
1701
|
+
|
|
1702
|
+
protected updateBackgroundColor(color: string): void;
|
|
1703
|
+
|
|
1704
|
+
protected updateBackgroundImage(opt: { position?: any, size?: any }): void;
|
|
1705
|
+
|
|
1706
|
+
protected createViewForModel(cell: Cell): CellView;
|
|
1707
|
+
|
|
1708
|
+
protected cloneOptions(): Paper.Options;
|
|
1709
|
+
|
|
1710
|
+
protected onCellAdded(cell: Cell, collection: mvc.Collection<Cell>, opt: dia.Graph.Options): void;
|
|
1711
|
+
|
|
1712
|
+
protected onCellRemoved(cell: Cell, collection: mvc.Collection<Cell>, opt: dia.Graph.Options): void;
|
|
1713
|
+
|
|
1714
|
+
protected onCellChanged(cell: Cell, opt: dia.Cell.Options): void;
|
|
1715
|
+
protected onCellChanged(cell: mvc.Collection<Cell>, opt: dia.Graph.Options): void;
|
|
1716
|
+
|
|
1717
|
+
protected onGraphReset(cells: mvc.Collection<Cell>, opt: dia.Graph.Options): void;
|
|
1718
|
+
|
|
1719
|
+
protected onGraphSort(): void;
|
|
1720
|
+
|
|
1721
|
+
protected onGraphBatchStop(): void;
|
|
1722
|
+
|
|
1723
|
+
protected onCellHighlight(cellView: CellView, magnetEl: SVGElement, opt?: { highlighter?: highlighters.HighlighterJSON }): void;
|
|
1724
|
+
|
|
1725
|
+
protected onCellUnhighlight(cellView: CellView, magnetEl: SVGElement, opt?: { highlighter?: highlighters.HighlighterJSON }): void;
|
|
1726
|
+
|
|
1727
|
+
protected onRemove(): void;
|
|
1728
|
+
|
|
1729
|
+
protected removeView(cell: Cell): CellView;
|
|
1730
|
+
|
|
1731
|
+
protected removeViews(): void;
|
|
1732
|
+
|
|
1733
|
+
protected renderView(cell: Cell): CellView;
|
|
1734
|
+
|
|
1735
|
+
protected resetViews(cells?: Cell[], opt?: { [key: string]: any }): void;
|
|
1736
|
+
|
|
1737
|
+
protected insertView(cellView: CellView, isInitialInsert: boolean): void;
|
|
1738
|
+
|
|
1739
|
+
protected detachView(cellView: CellView): void;
|
|
1740
|
+
|
|
1741
|
+
protected customEventTrigger(event: dia.Event, view: CellView, rootNode?: SVGElement): dia.Event | null;
|
|
1742
|
+
|
|
1743
|
+
protected addStylesheet(stylesheet: string): void;
|
|
1744
|
+
}
|
|
1745
|
+
|
|
1746
|
+
namespace PaperLayer {
|
|
1747
|
+
|
|
1748
|
+
interface Options extends mvc.ViewOptions<undefined, SVGElement> {
|
|
1749
|
+
name: string;
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
class PaperLayer extends mvc.View<undefined, SVGElement> {
|
|
1753
|
+
|
|
1754
|
+
constructor(opt?: PaperLayer.Options);
|
|
1755
|
+
|
|
1756
|
+
options: PaperLayer.Options;
|
|
1757
|
+
|
|
1758
|
+
pivotNodes: { [z: number]: Comment };
|
|
1759
|
+
|
|
1760
|
+
insertSortedNode(node: SVGElement, z: number): void;
|
|
1761
|
+
|
|
1762
|
+
insertNode(node: SVGElement): void;
|
|
1763
|
+
|
|
1764
|
+
insertPivot(z: number): Comment;
|
|
1765
|
+
|
|
1766
|
+
removePivots(): void;
|
|
1767
|
+
}
|
|
1768
|
+
|
|
1769
|
+
namespace ToolsView {
|
|
1770
|
+
|
|
1771
|
+
interface Options extends mvc.ViewOptions<undefined, SVGElement> {
|
|
1772
|
+
tools?: dia.ToolView[];
|
|
1773
|
+
name?: string | null;
|
|
1774
|
+
relatedView?: dia.CellView;
|
|
1775
|
+
component?: boolean;
|
|
1776
|
+
layer?: dia.Paper.Layers | string | null;
|
|
1777
|
+
z?: number;
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
|
|
1781
|
+
class ToolsView extends mvc.View<undefined, SVGElement> {
|
|
1782
|
+
|
|
1783
|
+
constructor(opt?: ToolsView.Options);
|
|
1784
|
+
|
|
1785
|
+
isRendered: boolean;
|
|
1786
|
+
|
|
1787
|
+
options: ToolsView.Options;
|
|
1788
|
+
|
|
1789
|
+
configure(opt?: ToolsView.Options): this;
|
|
1790
|
+
|
|
1791
|
+
getName(): string | null;
|
|
1792
|
+
|
|
1793
|
+
focusTool(tool: ToolView): this;
|
|
1794
|
+
|
|
1795
|
+
blurTool(tool?: ToolView): this;
|
|
1796
|
+
|
|
1797
|
+
show(): this;
|
|
1798
|
+
|
|
1799
|
+
hide(): this;
|
|
1800
|
+
|
|
1801
|
+
mount(): this;
|
|
1802
|
+
|
|
1803
|
+
protected simulateRelatedView(el: SVGElement): void;
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
namespace ToolView {
|
|
1807
|
+
interface Options extends mvc.ViewOptions<undefined, SVGElement> {
|
|
1808
|
+
focusOpacity?: number;
|
|
1809
|
+
}
|
|
1810
|
+
}
|
|
1811
|
+
|
|
1812
|
+
class ToolView extends mvc.View<undefined, SVGElement> {
|
|
1813
|
+
|
|
1814
|
+
name: string | null;
|
|
1815
|
+
parentView: ToolsView;
|
|
1816
|
+
relatedView: dia.CellView;
|
|
1817
|
+
paper: Paper;
|
|
1818
|
+
|
|
1819
|
+
constructor(opt?: ToolView.Options);
|
|
1820
|
+
|
|
1821
|
+
configure(opt?: ToolView.Options): this;
|
|
1822
|
+
|
|
1823
|
+
show(): void;
|
|
1824
|
+
|
|
1825
|
+
hide(): void;
|
|
1826
|
+
|
|
1827
|
+
isVisible(): boolean;
|
|
1828
|
+
|
|
1829
|
+
focus(): void;
|
|
1830
|
+
|
|
1831
|
+
blur(): void;
|
|
1832
|
+
|
|
1833
|
+
update(): void;
|
|
1834
|
+
|
|
1835
|
+
protected guard(evt: dia.Event): boolean;
|
|
1836
|
+
}
|
|
1837
|
+
|
|
1838
|
+
|
|
1839
|
+
namespace HighlighterView {
|
|
1840
|
+
|
|
1841
|
+
type Constructor<T> = { new(): T };
|
|
1842
|
+
|
|
1843
|
+
type NodeSelectorJSON = {
|
|
1844
|
+
selector?: string;
|
|
1845
|
+
port?: string;
|
|
1846
|
+
label?: number;
|
|
1847
|
+
};
|
|
1848
|
+
|
|
1849
|
+
type NodeSelector = string | SVGElement | NodeSelectorJSON;
|
|
1850
|
+
|
|
1851
|
+
interface Options extends mvc.ViewOptions<undefined, SVGElement> {
|
|
1852
|
+
layer?: dia.Paper.Layers | string | null;
|
|
1853
|
+
z?: number;
|
|
1854
|
+
}
|
|
1855
|
+
}
|
|
1856
|
+
|
|
1857
|
+
class HighlighterView<Options extends mvc.ViewOptions<undefined, SVGElement> = HighlighterView.Options> extends mvc.View<undefined, SVGElement> {
|
|
1858
|
+
|
|
1859
|
+
constructor(options?: Options);
|
|
1860
|
+
|
|
1861
|
+
options: Options;
|
|
1862
|
+
|
|
1863
|
+
UPDATABLE: boolean;
|
|
1864
|
+
MOUNTABLE: boolean;
|
|
1865
|
+
UPDATE_ATTRIBUTES: string[] | ((this: HighlighterView<Options>) => string[]);
|
|
1866
|
+
|
|
1867
|
+
cellView: dia.CellView;
|
|
1868
|
+
nodeSelector: HighlighterView.NodeSelector | null;
|
|
1869
|
+
node: SVGElement | null;
|
|
1870
|
+
updateRequested: boolean;
|
|
1871
|
+
postponedUpdate: boolean;
|
|
1872
|
+
transformGroup: Vectorizer | null;
|
|
1873
|
+
detachedTransformGroup: Vectorizer | null;
|
|
1874
|
+
|
|
1875
|
+
protected findNode(cellView: dia.CellView, nodeSelector: HighlighterView.NodeSelector): SVGElement | null;
|
|
1876
|
+
|
|
1877
|
+
protected transform(): void;
|
|
1878
|
+
|
|
1879
|
+
protected update(): void;
|
|
1880
|
+
|
|
1881
|
+
protected highlight(cellView: dia.CellView, node: SVGElement): void;
|
|
1882
|
+
|
|
1883
|
+
protected unhighlight(cellView: dia.CellView, node: SVGElement): void;
|
|
1884
|
+
|
|
1885
|
+
protected listenToUpdateAttributes(cellView: dia.CellView): void;
|
|
1886
|
+
|
|
1887
|
+
protected onCellAttributeChange(): void;
|
|
1888
|
+
|
|
1889
|
+
protected getNodeMatrix(cellView: dia.CellView, node: SVGElement): SVGMatrix;
|
|
1890
|
+
|
|
1891
|
+
static uniqueId(node: SVGElement, options?: any): string;
|
|
1892
|
+
|
|
1893
|
+
static add<T extends HighlighterView>(
|
|
1894
|
+
this: HighlighterView.Constructor<T>,
|
|
1895
|
+
cellView: dia.CellView,
|
|
1896
|
+
selector: HighlighterView.NodeSelector,
|
|
1897
|
+
id: string,
|
|
1898
|
+
options?: any
|
|
1899
|
+
): T;
|
|
1900
|
+
|
|
1901
|
+
static remove(
|
|
1902
|
+
cellView: dia.CellView,
|
|
1903
|
+
id?: string
|
|
1904
|
+
): void;
|
|
1905
|
+
|
|
1906
|
+
static removeAll(
|
|
1907
|
+
paper: dia.Paper,
|
|
1908
|
+
id?: string
|
|
1909
|
+
): void;
|
|
1910
|
+
|
|
1911
|
+
static get<T extends HighlighterView>(
|
|
1912
|
+
this: HighlighterView.Constructor<T>,
|
|
1913
|
+
cellView: dia.CellView,
|
|
1914
|
+
id: string
|
|
1915
|
+
): T | null;
|
|
1916
|
+
static get<T extends HighlighterView>(
|
|
1917
|
+
this: HighlighterView.Constructor<T>,
|
|
1918
|
+
cellView: dia.CellView
|
|
1919
|
+
): T[];
|
|
1920
|
+
|
|
1921
|
+
static update(cellView: dia.CellView, id?: string): void;
|
|
1922
|
+
|
|
1923
|
+
static transform(cellView: dia.CellView, id?: string): void;
|
|
1924
|
+
|
|
1925
|
+
static highlight(cellView: dia.CellView, node: SVGElement, options?: any): void;
|
|
1926
|
+
|
|
1927
|
+
static unhighlight(cellView: dia.CellView, node: SVGElement, options?: any): void;
|
|
1928
|
+
|
|
1929
|
+
protected static _addRef(cellView: dia.CellView, id: string, view: HighlighterView): void;
|
|
1930
|
+
|
|
1931
|
+
protected static _removeRef(cellView: dia.CellView, id?: string): void;
|
|
1932
|
+
}
|
|
1933
|
+
}
|
|
1934
|
+
|
|
1935
|
+
// highlighters
|
|
1936
|
+
|
|
1937
|
+
export namespace highlighters {
|
|
1938
|
+
|
|
1939
|
+
import HighlighterView = dia.HighlighterView;
|
|
1940
|
+
|
|
1941
|
+
interface AddClassHighlighterArguments extends HighlighterView.Options {
|
|
1942
|
+
className?: string;
|
|
1943
|
+
}
|
|
1944
|
+
|
|
1945
|
+
interface OpacityHighlighterArguments extends HighlighterView.Options {
|
|
1946
|
+
alphaValue?: number;
|
|
1947
|
+
}
|
|
1948
|
+
|
|
1949
|
+
interface StrokeHighlighterArguments extends HighlighterView.Options {
|
|
1950
|
+
padding?: number;
|
|
1951
|
+
rx?: number;
|
|
1952
|
+
ry?: number;
|
|
1953
|
+
useFirstSubpath?: boolean;
|
|
1954
|
+
nonScalingStroke?: boolean;
|
|
1955
|
+
attrs?: attributes.NativeSVGAttributes;
|
|
1956
|
+
}
|
|
1957
|
+
|
|
1958
|
+
interface MaskHighlighterArguments extends HighlighterView.Options {
|
|
1959
|
+
padding?: number;
|
|
1960
|
+
maskClip?: number;
|
|
1961
|
+
deep?: boolean;
|
|
1962
|
+
attrs?: attributes.NativeSVGAttributes;
|
|
1963
|
+
}
|
|
1964
|
+
|
|
1965
|
+
interface HighlighterArgumentsMap {
|
|
1966
|
+
'addClass': AddClassHighlighterArguments;
|
|
1967
|
+
'opacity': OpacityHighlighterArguments;
|
|
1968
|
+
'stroke': StrokeHighlighterArguments;
|
|
1969
|
+
'mask': MaskHighlighterArguments;
|
|
1970
|
+
[key: string]: { [key: string]: any };
|
|
1971
|
+
}
|
|
1972
|
+
|
|
1973
|
+
type HighlighterType = keyof HighlighterArgumentsMap;
|
|
1974
|
+
|
|
1975
|
+
type GenericHighlighterArguments<K extends HighlighterType> = HighlighterArgumentsMap[K];
|
|
1976
|
+
|
|
1977
|
+
interface GenericHighlighterJSON<K extends HighlighterType> {
|
|
1978
|
+
name: K;
|
|
1979
|
+
options?: GenericHighlighterArguments<K>;
|
|
1980
|
+
}
|
|
1981
|
+
|
|
1982
|
+
type HighlighterJSON = GenericHighlighterJSON<HighlighterType>;
|
|
1983
|
+
|
|
1984
|
+
class mask extends dia.HighlighterView<MaskHighlighterArguments> {
|
|
1985
|
+
|
|
1986
|
+
VISIBLE: string;
|
|
1987
|
+
INVISIBLE: string;
|
|
1988
|
+
MASK_ROOT_ATTRIBUTE_BLACKLIST: string[];
|
|
1989
|
+
MASK_CHILD_ATTRIBUTE_BLACKLIST: string[];
|
|
1990
|
+
MASK_REPLACE_TAGS: string[];
|
|
1991
|
+
MASK_REMOVE_TAGS: string[];
|
|
1992
|
+
|
|
1993
|
+
public getMaskId(): string;
|
|
1994
|
+
|
|
1995
|
+
protected getMask(cellView: dia.CellView, vel: Vectorizer): Vectorizer;
|
|
1996
|
+
|
|
1997
|
+
protected getMaskShape(cellView: dia.CellView, vel: Vectorizer): Vectorizer;
|
|
1998
|
+
|
|
1999
|
+
protected transformMaskRoot(cellView: dia.CellView, root: Vectorizer): void;
|
|
2000
|
+
|
|
2001
|
+
protected transformMaskChild(cellView: dia.CellView, child: Vectorizer): boolean;
|
|
2002
|
+
|
|
2003
|
+
protected addMask(paper: dia.Paper, mask: Vectorizer): void;
|
|
2004
|
+
|
|
2005
|
+
protected removeMask(paper: dia.Paper): void;
|
|
2006
|
+
}
|
|
2007
|
+
|
|
2008
|
+
class stroke extends dia.HighlighterView<StrokeHighlighterArguments> {
|
|
2009
|
+
|
|
2010
|
+
protected getPathData(cellView: dia.CellView, node: SVGElement): string;
|
|
2011
|
+
|
|
2012
|
+
protected highlightConnection(cellView: dia.CellView): void;
|
|
2013
|
+
|
|
2014
|
+
protected highlightNode(cellView: dia.CellView, node: SVGElement): void;
|
|
2015
|
+
}
|
|
2016
|
+
|
|
2017
|
+
class addClass extends dia.HighlighterView<AddClassHighlighterArguments> {
|
|
2018
|
+
|
|
2019
|
+
}
|
|
2020
|
+
|
|
2021
|
+
class opacity extends dia.HighlighterView<OpacityHighlighterArguments> {
|
|
2022
|
+
|
|
2023
|
+
opacityClassName: string;
|
|
2024
|
+
}
|
|
2025
|
+
|
|
2026
|
+
|
|
2027
|
+
namespace list {
|
|
2028
|
+
|
|
2029
|
+
enum Directions {
|
|
2030
|
+
ROW = 'row',
|
|
2031
|
+
COLUMN = 'column'
|
|
2032
|
+
}
|
|
2033
|
+
|
|
2034
|
+
type DirectionsType = 'row' | 'column';
|
|
2035
|
+
|
|
2036
|
+
enum Positions {
|
|
2037
|
+
TOP = 'top',
|
|
2038
|
+
RIGHT = 'right',
|
|
2039
|
+
BOTTOM = 'bottom',
|
|
2040
|
+
LEFT = 'left',
|
|
2041
|
+
TOP_LEFT = 'top-left',
|
|
2042
|
+
TOP_RIGHT = 'top-right',
|
|
2043
|
+
BOTTOM_LEFT = 'bottom-left',
|
|
2044
|
+
BOTTOM_RIGHT = 'bottom-right',
|
|
2045
|
+
CENTER = 'center',
|
|
2046
|
+
}
|
|
2047
|
+
|
|
2048
|
+
interface Options extends dia.HighlighterView.Options {
|
|
2049
|
+
direction?: Directions | DirectionsType;
|
|
2050
|
+
position?: Positions | dia.PositionName;
|
|
2051
|
+
size?: number | dia.Size;
|
|
2052
|
+
gap?: number;
|
|
2053
|
+
margin?: number | dia.Sides;
|
|
2054
|
+
}
|
|
2055
|
+
}
|
|
2056
|
+
|
|
2057
|
+
class list<Item = any, Options extends mvc.ViewOptions<undefined, SVGElement> = list.Options> extends dia.HighlighterView<Options> {
|
|
2058
|
+
|
|
2059
|
+
options: Options;
|
|
2060
|
+
|
|
2061
|
+
protected createListItem(item: Item, itemSize: dia.Size, itemEl: SVGElement | null): SVGElement;
|
|
2062
|
+
|
|
2063
|
+
protected position(element: dia.Element, listSize: dia.Size): void;
|
|
2064
|
+
}
|
|
2065
|
+
|
|
2066
|
+
/**
|
|
2067
|
+
* @deprecated
|
|
2068
|
+
*/
|
|
2069
|
+
interface GenericHighlighter<K extends HighlighterType> {
|
|
2070
|
+
|
|
2071
|
+
highlight(cellView: dia.CellView, magnetEl: SVGElement, opt?: GenericHighlighterArguments<K>): void;
|
|
2072
|
+
|
|
2073
|
+
unhighlight(cellView: dia.CellView, magnetEl: SVGElement, opt?: GenericHighlighterArguments<K>): void;
|
|
2074
|
+
}
|
|
2075
|
+
|
|
2076
|
+
/**
|
|
2077
|
+
* @deprecated
|
|
2078
|
+
*/
|
|
2079
|
+
type HighlighterArguments = GenericHighlighterArguments<HighlighterType>;
|
|
2080
|
+
|
|
2081
|
+
/**
|
|
2082
|
+
* @deprecated
|
|
2083
|
+
*/
|
|
2084
|
+
type Highlighter = GenericHighlighter<HighlighterType>;
|
|
2085
|
+
}
|
|
2086
|
+
|
|
2087
|
+
export namespace shapes {
|
|
2088
|
+
|
|
2089
|
+
interface SVGTextSelector extends dia.Cell.Selectors {
|
|
2090
|
+
text?: attributes.SVGTextAttributes;
|
|
2091
|
+
}
|
|
2092
|
+
|
|
2093
|
+
interface SVGRectSelector extends dia.Cell.Selectors {
|
|
2094
|
+
rect?: attributes.SVGRectAttributes;
|
|
2095
|
+
}
|
|
2096
|
+
|
|
2097
|
+
interface SVGCircleSelector extends dia.Cell.Selectors {
|
|
2098
|
+
circle?: attributes.SVGCircleAttributes;
|
|
2099
|
+
}
|
|
2100
|
+
|
|
2101
|
+
interface SVGEllipseSelector extends dia.Cell.Selectors {
|
|
2102
|
+
ellipse?: attributes.SVGEllipseAttributes;
|
|
2103
|
+
}
|
|
2104
|
+
|
|
2105
|
+
interface SVGPolygonSelector extends dia.Cell.Selectors {
|
|
2106
|
+
polygon?: attributes.SVGPolygonAttributes;
|
|
2107
|
+
}
|
|
2108
|
+
|
|
2109
|
+
interface SVGPolylineSelector extends dia.Cell.Selectors {
|
|
2110
|
+
polyline?: attributes.SVGPolylineAttributes;
|
|
2111
|
+
}
|
|
2112
|
+
|
|
2113
|
+
interface SVGImageSelector extends dia.Cell.Selectors {
|
|
2114
|
+
image?: attributes.SVGImageAttributes;
|
|
2115
|
+
}
|
|
2116
|
+
|
|
2117
|
+
interface SVGPathSelector extends dia.Cell.Selectors {
|
|
2118
|
+
path?: attributes.SVGPathAttributes;
|
|
2119
|
+
}
|
|
2120
|
+
|
|
2121
|
+
namespace standard {
|
|
2122
|
+
|
|
2123
|
+
interface RectangleSelectors extends dia.Cell.Selectors {
|
|
2124
|
+
root?: attributes.SVGAttributes;
|
|
2125
|
+
body?: attributes.SVGRectAttributes;
|
|
2126
|
+
label?: attributes.SVGTextAttributes;
|
|
2127
|
+
}
|
|
2128
|
+
|
|
2129
|
+
type RectangleAttributes = dia.Element.GenericAttributes<RectangleSelectors>;
|
|
2130
|
+
|
|
2131
|
+
class Rectangle extends dia.Element<RectangleAttributes> {
|
|
2132
|
+
}
|
|
2133
|
+
|
|
2134
|
+
interface CircleSelectors extends dia.Cell.Selectors {
|
|
2135
|
+
root?: attributes.SVGAttributes;
|
|
2136
|
+
body?: attributes.SVGCircleAttributes;
|
|
2137
|
+
label?: attributes.SVGTextAttributes;
|
|
2138
|
+
}
|
|
2139
|
+
|
|
2140
|
+
type CircleAttributes = dia.Element.GenericAttributes<CircleSelectors>;
|
|
2141
|
+
|
|
2142
|
+
class Circle extends dia.Element<CircleAttributes> {
|
|
2143
|
+
}
|
|
2144
|
+
|
|
2145
|
+
interface EllipseSelectors extends dia.Cell.Selectors {
|
|
2146
|
+
root?: attributes.SVGAttributes;
|
|
2147
|
+
body?: attributes.SVGEllipseAttributes;
|
|
2148
|
+
label?: attributes.SVGTextAttributes;
|
|
2149
|
+
}
|
|
2150
|
+
|
|
2151
|
+
type EllipseAttributes = dia.Element.GenericAttributes<EllipseSelectors>;
|
|
2152
|
+
|
|
2153
|
+
class Ellipse extends dia.Element<EllipseAttributes> {
|
|
2154
|
+
}
|
|
2155
|
+
|
|
2156
|
+
interface PathSelectors extends dia.Cell.Selectors {
|
|
2157
|
+
root?: attributes.SVGAttributes;
|
|
2158
|
+
body?: attributes.SVGPathAttributes;
|
|
2159
|
+
label?: attributes.SVGTextAttributes;
|
|
2160
|
+
}
|
|
2161
|
+
|
|
2162
|
+
type PathAttributes = dia.Element.GenericAttributes<PathSelectors>;
|
|
2163
|
+
|
|
2164
|
+
class Path extends dia.Element<PathAttributes> {
|
|
2165
|
+
}
|
|
2166
|
+
|
|
2167
|
+
interface PolygonSelectors extends dia.Cell.Selectors {
|
|
2168
|
+
root?: attributes.SVGAttributes;
|
|
2169
|
+
body?: attributes.SVGPolygonAttributes;
|
|
2170
|
+
label?: attributes.SVGTextAttributes;
|
|
2171
|
+
}
|
|
2172
|
+
|
|
2173
|
+
type PolygonAttributes = dia.Element.GenericAttributes<PolygonSelectors>;
|
|
2174
|
+
|
|
2175
|
+
class Polygon extends dia.Element<PolygonAttributes> {
|
|
2176
|
+
}
|
|
2177
|
+
|
|
2178
|
+
interface PolylineSelectors extends dia.Cell.Selectors {
|
|
2179
|
+
root?: attributes.SVGAttributes;
|
|
2180
|
+
body?: attributes.SVGPolylineAttributes;
|
|
2181
|
+
label?: attributes.SVGTextAttributes;
|
|
2182
|
+
}
|
|
2183
|
+
|
|
2184
|
+
type PolylineAttributes = dia.Element.GenericAttributes<PolylineSelectors>;
|
|
2185
|
+
|
|
2186
|
+
class Polyline extends dia.Element<PolylineAttributes> {
|
|
2187
|
+
}
|
|
2188
|
+
|
|
2189
|
+
interface ImageSelectors extends dia.Cell.Selectors {
|
|
2190
|
+
root?: attributes.SVGAttributes;
|
|
2191
|
+
image?: attributes.SVGImageAttributes;
|
|
2192
|
+
label?: attributes.SVGTextAttributes;
|
|
2193
|
+
}
|
|
2194
|
+
|
|
2195
|
+
type ImageAttributes = dia.Element.GenericAttributes<ImageSelectors>;
|
|
2196
|
+
|
|
2197
|
+
class Image extends dia.Element<ImageAttributes> {
|
|
2198
|
+
}
|
|
2199
|
+
|
|
2200
|
+
interface BorderedImageSelectors extends dia.Cell.Selectors {
|
|
2201
|
+
root?: attributes.SVGAttributes;
|
|
2202
|
+
border?: attributes.SVGRectAttributes;
|
|
2203
|
+
background?: attributes.SVGRectAttributes;
|
|
2204
|
+
image?: attributes.SVGImageAttributes;
|
|
2205
|
+
label?: attributes.SVGTextAttributes;
|
|
2206
|
+
}
|
|
2207
|
+
|
|
2208
|
+
type BorderedImageAttributes = dia.Element.GenericAttributes<BorderedImageSelectors>;
|
|
2209
|
+
|
|
2210
|
+
class BorderedImage extends dia.Element<BorderedImageAttributes> {
|
|
2211
|
+
}
|
|
2212
|
+
|
|
2213
|
+
interface EmbeddedImageSelectors extends dia.Cell.Selectors {
|
|
2214
|
+
root?: attributes.SVGAttributes;
|
|
2215
|
+
body?: attributes.SVGRectAttributes;
|
|
2216
|
+
image?: attributes.SVGImageAttributes;
|
|
2217
|
+
label?: attributes.SVGTextAttributes;
|
|
2218
|
+
}
|
|
2219
|
+
|
|
2220
|
+
type EmbeddedImageAttributes = dia.Element.GenericAttributes<EmbeddedImageSelectors>;
|
|
2221
|
+
|
|
2222
|
+
class EmbeddedImage extends dia.Element<EmbeddedImageAttributes> {
|
|
2223
|
+
}
|
|
2224
|
+
|
|
2225
|
+
interface InscribedImageSelectors extends dia.Cell.Selectors {
|
|
2226
|
+
root?: attributes.SVGAttributes;
|
|
2227
|
+
border?: attributes.SVGEllipseAttributes;
|
|
2228
|
+
background?: attributes.SVGEllipseAttributes;
|
|
2229
|
+
image?: attributes.SVGImageAttributes;
|
|
2230
|
+
label?: attributes.SVGTextAttributes;
|
|
2231
|
+
}
|
|
2232
|
+
|
|
2233
|
+
type InscribedImageAttributes = dia.Element.GenericAttributes<InscribedImageSelectors>;
|
|
2234
|
+
|
|
2235
|
+
class InscribedImage extends dia.Element<InscribedImageAttributes> {
|
|
2236
|
+
}
|
|
2237
|
+
|
|
2238
|
+
interface HeaderedRectangleSelectors extends dia.Cell.Selectors {
|
|
2239
|
+
root?: attributes.SVGAttributes;
|
|
2240
|
+
body?: attributes.SVGRectAttributes;
|
|
2241
|
+
header?: attributes.SVGRectAttributes;
|
|
2242
|
+
headerText?: attributes.SVGTextAttributes;
|
|
2243
|
+
bodyText?: attributes.SVGTextAttributes;
|
|
2244
|
+
}
|
|
2245
|
+
|
|
2246
|
+
type HeaderedRectangleAttributes = dia.Element.GenericAttributes<HeaderedRectangleSelectors>;
|
|
2247
|
+
|
|
2248
|
+
class HeaderedRectangle extends dia.Element<HeaderedRectangleAttributes> {
|
|
2249
|
+
}
|
|
2250
|
+
|
|
2251
|
+
interface CylinderBodyAttributes extends attributes.SVGPathAttributes {
|
|
2252
|
+
lateralArea?: string | number;
|
|
2253
|
+
}
|
|
2254
|
+
|
|
2255
|
+
interface CylinderSelectors extends dia.Cell.Selectors {
|
|
2256
|
+
root?: attributes.SVGAttributes;
|
|
2257
|
+
body?: CylinderBodyAttributes;
|
|
2258
|
+
top?: attributes.SVGEllipseAttributes;
|
|
2259
|
+
}
|
|
2260
|
+
|
|
2261
|
+
type CylinderAttributes = dia.Element.GenericAttributes<CylinderSelectors>;
|
|
2262
|
+
|
|
2263
|
+
class Cylinder<S extends mvc.ModelSetOptions = dia.ModelSetOptions> extends dia.Element<CylinderAttributes, S> {
|
|
2264
|
+
topRy(): string | number;
|
|
2265
|
+
topRy(t: string | number, opt?: S): this;
|
|
2266
|
+
}
|
|
2267
|
+
|
|
2268
|
+
interface TextBlockSelectors extends dia.Cell.Selectors {
|
|
2269
|
+
root?: attributes.SVGAttributes;
|
|
2270
|
+
body?: attributes.SVGRectAttributes;
|
|
2271
|
+
label?: {
|
|
2272
|
+
text?: string;
|
|
2273
|
+
style?: { [key: string]: any };
|
|
2274
|
+
[key: string]: any;
|
|
2275
|
+
};
|
|
2276
|
+
}
|
|
2277
|
+
|
|
2278
|
+
type TextBlockAttributes = dia.Element.GenericAttributes<TextBlockSelectors>;
|
|
2279
|
+
|
|
2280
|
+
class TextBlock extends dia.Element<TextBlockAttributes> {
|
|
2281
|
+
}
|
|
2282
|
+
|
|
2283
|
+
interface LinkSelectors extends dia.Cell.Selectors {
|
|
2284
|
+
root?: attributes.SVGAttributes;
|
|
2285
|
+
line?: attributes.SVGPathAttributes;
|
|
2286
|
+
wrapper?: attributes.SVGPathAttributes;
|
|
2287
|
+
}
|
|
2288
|
+
|
|
2289
|
+
type LinkAttributes = dia.Link.GenericAttributes<LinkSelectors>;
|
|
2290
|
+
|
|
2291
|
+
class Link extends dia.Link<LinkAttributes> {
|
|
2292
|
+
}
|
|
2293
|
+
|
|
2294
|
+
interface DoubleLinkSelectors extends dia.Cell.Selectors {
|
|
2295
|
+
root?: attributes.SVGAttributes;
|
|
2296
|
+
line?: attributes.SVGPathAttributes;
|
|
2297
|
+
outline?: attributes.SVGPathAttributes;
|
|
2298
|
+
}
|
|
2299
|
+
|
|
2300
|
+
type DoubleLinkAttributes = dia.Link.GenericAttributes<DoubleLinkSelectors>;
|
|
2301
|
+
|
|
2302
|
+
class DoubleLink extends dia.Link<DoubleLinkAttributes> {
|
|
2303
|
+
}
|
|
2304
|
+
|
|
2305
|
+
interface ShadowLinkSelectors extends dia.Cell.Selectors {
|
|
2306
|
+
root?: attributes.SVGAttributes;
|
|
2307
|
+
line?: attributes.SVGPathAttributes;
|
|
2308
|
+
shadow?: attributes.SVGPathAttributes;
|
|
2309
|
+
}
|
|
2310
|
+
|
|
2311
|
+
type ShadowLinkAttributes = dia.Link.GenericAttributes<ShadowLinkSelectors>;
|
|
2312
|
+
|
|
2313
|
+
class ShadowLink extends dia.Link<ShadowLinkAttributes> {
|
|
2314
|
+
}
|
|
2315
|
+
}
|
|
2316
|
+
|
|
2317
|
+
namespace devs {
|
|
2318
|
+
|
|
2319
|
+
interface ModelSelectors extends dia.Cell.Selectors {
|
|
2320
|
+
'.label'?: attributes.SVGTextAttributes;
|
|
2321
|
+
'.body'?: attributes.SVGRectAttributes;
|
|
2322
|
+
}
|
|
2323
|
+
|
|
2324
|
+
interface ModelAttributes extends dia.Element.GenericAttributes<ModelSelectors> {
|
|
2325
|
+
inPorts?: string[];
|
|
2326
|
+
outPorts?: string[];
|
|
2327
|
+
}
|
|
2328
|
+
|
|
2329
|
+
class Model extends dia.Element {
|
|
2330
|
+
|
|
2331
|
+
constructor(attributes?: ModelAttributes, opt?: { [key: string]: any });
|
|
2332
|
+
|
|
2333
|
+
changeInGroup(properties: any, opt?: any): boolean;
|
|
2334
|
+
|
|
2335
|
+
changeOutGroup(properties: any, opt?: any): boolean;
|
|
2336
|
+
|
|
2337
|
+
createPortItem(group: string, port: string): any;
|
|
2338
|
+
|
|
2339
|
+
createPortItems(group: string, ports: string[]): any[];
|
|
2340
|
+
|
|
2341
|
+
addOutPort(port: string, opt?: any): this;
|
|
2342
|
+
|
|
2343
|
+
addInPort(port: string, opt?: any): this;
|
|
2344
|
+
|
|
2345
|
+
removeOutPort(port: string, opt?: any): this;
|
|
2346
|
+
|
|
2347
|
+
removeInPort(port: string, opt?: any): this;
|
|
2348
|
+
}
|
|
2349
|
+
|
|
2350
|
+
class Coupled extends Model {
|
|
2351
|
+
|
|
2352
|
+
}
|
|
2353
|
+
|
|
2354
|
+
class Atomic extends Model {
|
|
2355
|
+
|
|
2356
|
+
}
|
|
2357
|
+
|
|
2358
|
+
class Link extends dia.Link {
|
|
2359
|
+
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
}
|
|
2363
|
+
|
|
2364
|
+
// util
|
|
2365
|
+
|
|
2366
|
+
export namespace util {
|
|
2367
|
+
|
|
2368
|
+
export function hashCode(str: string): string;
|
|
2369
|
+
|
|
2370
|
+
export function getByPath(object: { [key: string]: any }, path: string | string[], delim?: string): any;
|
|
2371
|
+
|
|
2372
|
+
export function setByPath(object: { [key: string]: any }, path: string | string[], value: any, delim?: string): any;
|
|
2373
|
+
|
|
2374
|
+
export function unsetByPath(object: { [key: string]: any }, path: string | string[], delim?: string): any;
|
|
2375
|
+
|
|
2376
|
+
export function flattenObject(object: { [key: string]: any }, delim?: string, stop?: (node: any) => boolean): any;
|
|
2377
|
+
|
|
2378
|
+
export function uuid(): string;
|
|
2379
|
+
|
|
2380
|
+
export function svg(strings: TemplateStringsArray, ...expressions: any): dia.MarkupJSON;
|
|
2381
|
+
|
|
2382
|
+
export function guid(obj?: { [key: string]: any }): string;
|
|
2383
|
+
|
|
2384
|
+
export function toKebabCase(str: string): string;
|
|
2385
|
+
|
|
2386
|
+
export function normalizeEvent(evt: dia.Event): dia.Event;
|
|
2387
|
+
|
|
2388
|
+
export function nextFrame(callback: () => void, context?: { [key: string]: any }, ...args: any[]): number;
|
|
2389
|
+
|
|
2390
|
+
export function cancelFrame(requestId: number): void;
|
|
2391
|
+
|
|
2392
|
+
export function isPercentage(val: any): boolean;
|
|
2393
|
+
|
|
2394
|
+
export function parseCssNumeric(val: any, restrictUnits: string | string[]): { value: number, unit?: string } | null;
|
|
2395
|
+
|
|
2396
|
+
type BreakTextFunction = (
|
|
2397
|
+
text: string,
|
|
2398
|
+
size: { width: number, height?: number },
|
|
2399
|
+
attrs?: attributes.NativeSVGAttributes,
|
|
2400
|
+
opt?: {
|
|
2401
|
+
svgDocument?: SVGElement;
|
|
2402
|
+
separator?: string | any;
|
|
2403
|
+
eol?: string;
|
|
2404
|
+
ellipsis?: boolean | string;
|
|
2405
|
+
hyphen?: string | RegExp;
|
|
2406
|
+
maxLineCount?: number;
|
|
2407
|
+
preserveSpaces?: boolean;
|
|
2408
|
+
}
|
|
2409
|
+
) => string;
|
|
2410
|
+
|
|
2411
|
+
export var breakText: BreakTextFunction;
|
|
2412
|
+
|
|
2413
|
+
export function sanitizeHTML(html: string): string;
|
|
2414
|
+
|
|
2415
|
+
export function downloadBlob(blob: Blob, fileName: string): void;
|
|
2416
|
+
|
|
2417
|
+
export function downloadDataUri(dataUri: string, fileName: string): void;
|
|
2418
|
+
|
|
2419
|
+
export function dataUriToBlob(dataUri: string): Blob;
|
|
2420
|
+
|
|
2421
|
+
export function imageToDataUri(url: string, callback: (err: Error | null, dataUri: string) => void): void;
|
|
2422
|
+
|
|
2423
|
+
export function getElementBBox(el: Element): dia.BBox;
|
|
2424
|
+
|
|
2425
|
+
export function sortElements(
|
|
2426
|
+
elements: mvc.$Element,
|
|
2427
|
+
comparator: (a: Element, b: Element) => number
|
|
2428
|
+
): Element[];
|
|
2429
|
+
|
|
2430
|
+
export function setAttributesBySelector(el: Element, attrs: { [selector: string]: { [attribute: string]: any }}): void;
|
|
2431
|
+
|
|
2432
|
+
export function normalizeSides(sides: dia.Sides): dia.PaddingJSON;
|
|
2433
|
+
|
|
2434
|
+
export function template(html: string): (data: any) => string;
|
|
2435
|
+
|
|
2436
|
+
export function toggleFullScreen(el?: Element): void;
|
|
2437
|
+
|
|
2438
|
+
interface DOMJSONDocument {
|
|
2439
|
+
fragment: DocumentFragment;
|
|
2440
|
+
selectors: { [key: string]: Element };
|
|
2441
|
+
groupSelectors: { [key: string]: Element[] };
|
|
2442
|
+
}
|
|
2443
|
+
|
|
2444
|
+
export function parseDOMJSON(json: dia.MarkupJSON): DOMJSONDocument;
|
|
2445
|
+
|
|
2446
|
+
export namespace timing {
|
|
2447
|
+
|
|
2448
|
+
type TimingFunction = (time: number) => number;
|
|
2449
|
+
|
|
2450
|
+
export var linear: TimingFunction;
|
|
2451
|
+
export var quad: TimingFunction;
|
|
2452
|
+
export var cubic: TimingFunction;
|
|
2453
|
+
export var inout: TimingFunction;
|
|
2454
|
+
export var exponential: TimingFunction;
|
|
2455
|
+
export var bounce: TimingFunction;
|
|
2456
|
+
|
|
2457
|
+
export function reverse(f: TimingFunction): TimingFunction;
|
|
2458
|
+
|
|
2459
|
+
export function reflect(f: TimingFunction): TimingFunction;
|
|
2460
|
+
|
|
2461
|
+
export function clamp(f: TimingFunction, min?: number, max?: number): TimingFunction;
|
|
2462
|
+
|
|
2463
|
+
export function back(s?: number): TimingFunction;
|
|
2464
|
+
|
|
2465
|
+
export function elastic(x?: number): TimingFunction;
|
|
2466
|
+
}
|
|
2467
|
+
|
|
2468
|
+
export namespace interpolate {
|
|
2469
|
+
|
|
2470
|
+
type InterpolateFunction<T> = (start: T, end: T) => ((time: number) => T);
|
|
2471
|
+
|
|
2472
|
+
export var number: InterpolateFunction<number>;
|
|
2473
|
+
export var object: InterpolateFunction<{ [key: string]: any }>;
|
|
2474
|
+
export var hexColor: InterpolateFunction<string>;
|
|
2475
|
+
export var unit: InterpolateFunction<string>;
|
|
2476
|
+
}
|
|
2477
|
+
|
|
2478
|
+
export namespace filter {
|
|
2479
|
+
|
|
2480
|
+
interface FilterArgumentsMap {
|
|
2481
|
+
'outline': {
|
|
2482
|
+
color?: string;
|
|
2483
|
+
opacity?: number;
|
|
2484
|
+
margin?: number;
|
|
2485
|
+
width?: number;
|
|
2486
|
+
};
|
|
2487
|
+
'highlight': {
|
|
2488
|
+
color?: string;
|
|
2489
|
+
blur?: number;
|
|
2490
|
+
opacity?: number;
|
|
2491
|
+
width?: number;
|
|
2492
|
+
};
|
|
2493
|
+
'blur': {
|
|
2494
|
+
x?: number;
|
|
2495
|
+
y?: number;
|
|
2496
|
+
};
|
|
2497
|
+
'dropShadow': {
|
|
2498
|
+
dx?: number;
|
|
2499
|
+
dy?: number;
|
|
2500
|
+
opacity?: number;
|
|
2501
|
+
color?: string;
|
|
2502
|
+
blur?: number;
|
|
2503
|
+
};
|
|
2504
|
+
'grayscale': {
|
|
2505
|
+
amount?: number;
|
|
2506
|
+
};
|
|
2507
|
+
'sepia': {
|
|
2508
|
+
amount?: number;
|
|
2509
|
+
};
|
|
2510
|
+
'saturate': {
|
|
2511
|
+
amount?: number;
|
|
2512
|
+
};
|
|
2513
|
+
'hueRotate': {
|
|
2514
|
+
angle?: number;
|
|
2515
|
+
};
|
|
2516
|
+
'invert': {
|
|
2517
|
+
amount?: number;
|
|
2518
|
+
};
|
|
2519
|
+
'brightness': {
|
|
2520
|
+
amount?: number;
|
|
2521
|
+
};
|
|
2522
|
+
'contrast': {
|
|
2523
|
+
amount?: number;
|
|
2524
|
+
};
|
|
2525
|
+
}
|
|
2526
|
+
|
|
2527
|
+
type FilterFunction<K extends keyof FilterArgumentsMap> = (args: FilterArgumentsMap[K]) => string;
|
|
2528
|
+
interface FilterJSON<K extends keyof FilterArgumentsMap> {
|
|
2529
|
+
name: K;
|
|
2530
|
+
id?: string;
|
|
2531
|
+
args?: FilterArgumentsMap[K];
|
|
2532
|
+
attrs?: attributes.NativeSVGAttributes;
|
|
2533
|
+
}
|
|
2534
|
+
|
|
2535
|
+
export var outline: FilterFunction<'outline'>;
|
|
2536
|
+
export var highlight: FilterFunction<'highlight'>;
|
|
2537
|
+
export var blur: FilterFunction<'blur'>;
|
|
2538
|
+
export var dropShadow: FilterFunction<'dropShadow'>;
|
|
2539
|
+
export var grayscale: FilterFunction<'grayscale'>;
|
|
2540
|
+
export var sepia: FilterFunction<'sepia'>;
|
|
2541
|
+
export var saturate: FilterFunction<'saturate'>;
|
|
2542
|
+
export var hueRotate: FilterFunction<'hueRotate'>;
|
|
2543
|
+
export var invert: FilterFunction<'invert'>;
|
|
2544
|
+
export var brightness: FilterFunction<'brightness'>;
|
|
2545
|
+
export var contrast: FilterFunction<'contrast'>;
|
|
2546
|
+
}
|
|
2547
|
+
|
|
2548
|
+
namespace format {
|
|
2549
|
+
|
|
2550
|
+
interface NumberLocale {
|
|
2551
|
+
currency: [string, string];
|
|
2552
|
+
decimal: string;
|
|
2553
|
+
thousands: string;
|
|
2554
|
+
grouping: number[];
|
|
2555
|
+
}
|
|
2556
|
+
|
|
2557
|
+
export function number(specifier: string, value: number, locale?: NumberLocale): string;
|
|
2558
|
+
|
|
2559
|
+
export function string(str: string, value: string): string;
|
|
2560
|
+
|
|
2561
|
+
export function convert(type: string, value: number, precision: number): string;
|
|
2562
|
+
|
|
2563
|
+
export function round(value: number, precision?: number): number;
|
|
2564
|
+
|
|
2565
|
+
export function precision(value: number, precision: number): number;
|
|
2566
|
+
|
|
2567
|
+
export function prefix(value: number, precision: number): { scale: (d: number) => number, symbol: string } | undefined;
|
|
2568
|
+
}
|
|
2569
|
+
|
|
2570
|
+
// LODASH FUNCTIONS:
|
|
2571
|
+
|
|
2572
|
+
type NotVoid = {} | null | undefined; // the `any` type without `void` and `never`
|
|
2573
|
+
|
|
2574
|
+
type Collection = object | any[]; // an object or an array
|
|
2575
|
+
|
|
2576
|
+
type PropertyPath = string | string[];
|
|
2577
|
+
|
|
2578
|
+
type IterateeFunction<T> = (value: T) => NotVoid;
|
|
2579
|
+
|
|
2580
|
+
interface Cancelable {
|
|
2581
|
+
cancel(): void;
|
|
2582
|
+
flush(): void;
|
|
2583
|
+
}
|
|
2584
|
+
|
|
2585
|
+
type SourceObjectsOptionalFinalCustomizer = Array<object | CustomizerFunction>; // typescript cannot express "any number of objects optionally followed by CustomizerFunction"
|
|
2586
|
+
type CustomizerFunction = (objValue: any, srcValue: any, key: string, object: any, source: any, stack: any) => NotVoid;
|
|
2587
|
+
|
|
2588
|
+
/** @deprecated do not use */
|
|
2589
|
+
export function mixin(destinationObject: object, ...sourceObjects: object[]): object;
|
|
2590
|
+
|
|
2591
|
+
/** @deprecated do not use */
|
|
2592
|
+
export function deepMixin(destinationObject: object, ...sourceObjects: object[]): object;
|
|
2593
|
+
|
|
2594
|
+
/** @deprecated do not use */
|
|
2595
|
+
export function assign(destinationObject: object, ...sourceObjects: object[]): object;
|
|
2596
|
+
|
|
2597
|
+
/** @deprecated use joint.util.defaults */
|
|
2598
|
+
export function supplement(destinationObject: object, ...sourceObjects: object[]): object;
|
|
2599
|
+
|
|
2600
|
+
/** @deprecated use joint.util.defaultsDeep */
|
|
2601
|
+
export function deepSupplement(destinationObject: object, ...sourceObjects: object[]): object;
|
|
2602
|
+
|
|
2603
|
+
export function defaults(destinationObject: object, ...sourceObjects: object[]): object;
|
|
2604
|
+
|
|
2605
|
+
export function defaultsDeep(destinationObject: object, ...sourceObjects: object[]): object;
|
|
2606
|
+
|
|
2607
|
+
export function invoke(collection: Collection, methodPath: PropertyPath, args?: any[]): any[];
|
|
2608
|
+
export function invoke<ArgsT>(collection: Collection, functionToInvokeForAll: IterateeFunction<ArgsT>, ...args: ArgsT[]): any[];
|
|
2609
|
+
|
|
2610
|
+
export function invokeProperty(object: object, propertyPath: PropertyPath, args?: any[]): any;
|
|
2611
|
+
|
|
2612
|
+
export function sortedIndex<T>(sortedArray: T[], valueToInsert: T, iteratee?: IterateeFunction<T>): number;
|
|
2613
|
+
|
|
2614
|
+
export function uniq<T>(array: Array<T> | null | undefined, iteratee?: IterateeFunction<T>): T[];
|
|
2615
|
+
|
|
2616
|
+
export function clone<T>(value: T): T;
|
|
2617
|
+
|
|
2618
|
+
export function cloneDeep<T>(value: T): T;
|
|
2619
|
+
|
|
2620
|
+
export function isEmpty(value: any): boolean;
|
|
2621
|
+
|
|
2622
|
+
export function isEqual(value: any, otherValue: any): boolean;
|
|
2623
|
+
|
|
2624
|
+
export function isFunction(value: any): boolean;
|
|
2625
|
+
|
|
2626
|
+
export function isPlainObject(value: any): boolean;
|
|
2627
|
+
|
|
2628
|
+
export function toArray(value: any): any[];
|
|
2629
|
+
|
|
2630
|
+
export function debounce<T extends Function>(func: T, wait?: number, options?: { leading?: boolean, maxWait?: number, trailing?: boolean }): T & Cancelable;
|
|
2631
|
+
|
|
2632
|
+
export function groupBy(collection: Collection, iteratee?: IterateeFunction<any>): object;
|
|
2633
|
+
|
|
2634
|
+
export function sortBy<T>(collection: object, iteratee?: IterateeFunction<any>[] | IterateeFunction<any>): any[];
|
|
2635
|
+
export function sortBy<T>(collection: T[], iteratee?: IterateeFunction<T>[] | IterateeFunction<T>): any[];
|
|
2636
|
+
|
|
2637
|
+
export function flattenDeep(array: any[]): any[];
|
|
2638
|
+
|
|
2639
|
+
export function without<T>(array: T[], ...values: T[]): T[];
|
|
2640
|
+
|
|
2641
|
+
export function difference<T>(array: T[], ...excludedValuesArrays: T[][]): T[];
|
|
2642
|
+
|
|
2643
|
+
export function intersection<T>(...arrays: T[][]): T[];
|
|
2644
|
+
|
|
2645
|
+
export function union<T>(...arrays: T[][]): T[];
|
|
2646
|
+
|
|
2647
|
+
export function has(object: object, path: PropertyPath): boolean;
|
|
2648
|
+
|
|
2649
|
+
export function result(object: object, propertyPath: PropertyPath, defaultValue?: any): any;
|
|
2650
|
+
|
|
2651
|
+
export function omit(object: object, ...propertyPathsToOmit: PropertyPath[]): object;
|
|
2652
|
+
|
|
2653
|
+
export function pick(object: object, ...propertyPathsToPick: PropertyPath[]): object;
|
|
2654
|
+
|
|
2655
|
+
export function bindAll(object: object, methodNames: string | string[]): object;
|
|
2656
|
+
|
|
2657
|
+
export function forIn<T>(object: T, iteratee?: (value: any, key: string, iterable: object) => void | boolean): void;
|
|
2658
|
+
|
|
2659
|
+
export function camelCase(string: string): string;
|
|
2660
|
+
|
|
2661
|
+
export function uniqueId(prefix?: string | number): string;
|
|
2662
|
+
|
|
2663
|
+
export function getRectPoint(rect: dia.BBox, position: dia.PositionName): g.Point;
|
|
2664
|
+
|
|
2665
|
+
export function merge(destinationObject: object, ...args: any[]): object;
|
|
2666
|
+
|
|
2667
|
+
// ADDITIONAL SIMPLE UTIL FUNCTIONS:
|
|
2668
|
+
|
|
2669
|
+
export function isBoolean(value: any): boolean;
|
|
2670
|
+
|
|
2671
|
+
export function isObject(value: any): boolean;
|
|
2672
|
+
|
|
2673
|
+
export function isNumber(value: any): boolean;
|
|
2674
|
+
|
|
2675
|
+
export function isString(value: any): boolean;
|
|
2676
|
+
|
|
2677
|
+
export function noop(): void;
|
|
2678
|
+
}
|
|
2679
|
+
|
|
2680
|
+
// env
|
|
2681
|
+
|
|
2682
|
+
export namespace env {
|
|
2683
|
+
|
|
2684
|
+
export function addTest(name: string, fn: () => boolean): void;
|
|
2685
|
+
|
|
2686
|
+
export function test(name: string): boolean;
|
|
2687
|
+
}
|
|
2688
|
+
|
|
2689
|
+
// layout
|
|
2690
|
+
|
|
2691
|
+
export namespace layout {
|
|
2692
|
+
|
|
2693
|
+
export namespace Port {
|
|
2694
|
+
|
|
2695
|
+
type Position = {
|
|
2696
|
+
x: number | string;
|
|
2697
|
+
y: number | string;
|
|
2698
|
+
};
|
|
2699
|
+
|
|
2700
|
+
type Transformation = {
|
|
2701
|
+
x: number;
|
|
2702
|
+
y: number;
|
|
2703
|
+
angle: number;
|
|
2704
|
+
};
|
|
2705
|
+
|
|
2706
|
+
type LayoutFunction = (ports: Array<Object>, elBBox: g.Rect, opt: Options) => Array<Transformation>;
|
|
2707
|
+
|
|
2708
|
+
interface Options {
|
|
2709
|
+
x?: number | string;
|
|
2710
|
+
y?: number | string;
|
|
2711
|
+
dx?: number;
|
|
2712
|
+
dy?: number;
|
|
2713
|
+
angle?: number;
|
|
2714
|
+
start?: Position;
|
|
2715
|
+
end?: Position;
|
|
2716
|
+
startAngle?: number;
|
|
2717
|
+
step?: number;
|
|
2718
|
+
compensateRotation?: boolean;
|
|
2719
|
+
}
|
|
2720
|
+
|
|
2721
|
+
export var absolute: LayoutFunction;
|
|
2722
|
+
export var fn: LayoutFunction;
|
|
2723
|
+
export var line: LayoutFunction;
|
|
2724
|
+
export var left: LayoutFunction;
|
|
2725
|
+
export var right: LayoutFunction;
|
|
2726
|
+
export var top: LayoutFunction;
|
|
2727
|
+
export var bottom: LayoutFunction;
|
|
2728
|
+
export var ellipseSpread: LayoutFunction;
|
|
2729
|
+
export var ellipse: LayoutFunction;
|
|
2730
|
+
}
|
|
2731
|
+
|
|
2732
|
+
export namespace PortLabel {
|
|
2733
|
+
|
|
2734
|
+
interface Options {
|
|
2735
|
+
x?: number;
|
|
2736
|
+
y?: number;
|
|
2737
|
+
angle?: number;
|
|
2738
|
+
offset?: number;
|
|
2739
|
+
attrs?: dia.Cell.Selectors;
|
|
2740
|
+
}
|
|
2741
|
+
|
|
2742
|
+
interface LabelAttributes {
|
|
2743
|
+
x: number;
|
|
2744
|
+
y: number;
|
|
2745
|
+
angle: number;
|
|
2746
|
+
attrs: dia.Cell.Selectors;
|
|
2747
|
+
}
|
|
2748
|
+
|
|
2749
|
+
type LayoutFunction = (portPosition: g.Point, elBBox: g.Rect, opt: Options) => LabelAttributes;
|
|
2750
|
+
|
|
2751
|
+
export var manual: LayoutFunction;
|
|
2752
|
+
export var left: LayoutFunction;
|
|
2753
|
+
export var right: LayoutFunction;
|
|
2754
|
+
export var top: LayoutFunction;
|
|
2755
|
+
export var bottom: LayoutFunction;
|
|
2756
|
+
export var outsideOriented: LayoutFunction;
|
|
2757
|
+
export var outside: LayoutFunction;
|
|
2758
|
+
export var insideOriented: LayoutFunction;
|
|
2759
|
+
export var inside: LayoutFunction;
|
|
2760
|
+
export var radial: LayoutFunction;
|
|
2761
|
+
export var radialOriented: LayoutFunction;
|
|
2762
|
+
}
|
|
2763
|
+
}
|
|
2764
|
+
|
|
2765
|
+
// mvc
|
|
2766
|
+
|
|
2767
|
+
export namespace mvc {
|
|
2768
|
+
|
|
2769
|
+
type Dom = unknown;
|
|
2770
|
+
// The following types represent the DOM elements that can be passed to the
|
|
2771
|
+
// $() function.
|
|
2772
|
+
type $Element<T extends Element = Element> = string | T | T[] | Dom;
|
|
2773
|
+
type $HTMLElement = $Element<HTMLElement>;
|
|
2774
|
+
type $SVGElement = $Element<SVGElement>;
|
|
2775
|
+
|
|
2776
|
+
interface $AnimationOptions {
|
|
2777
|
+
duration?: number;
|
|
2778
|
+
delay?: number;
|
|
2779
|
+
easing?: string;
|
|
2780
|
+
complete?: (this: Element) => void;
|
|
2781
|
+
}
|
|
2782
|
+
|
|
2783
|
+
interface Event {
|
|
2784
|
+
// Event
|
|
2785
|
+
bubbles: boolean | undefined;
|
|
2786
|
+
cancelable: boolean | undefined;
|
|
2787
|
+
eventPhase: number | undefined;
|
|
2788
|
+
// UIEvent
|
|
2789
|
+
detail: number | undefined;
|
|
2790
|
+
view: Window | undefined;
|
|
2791
|
+
// MouseEvent
|
|
2792
|
+
button: number | undefined;
|
|
2793
|
+
buttons: number | undefined;
|
|
2794
|
+
clientX: number | undefined;
|
|
2795
|
+
clientY: number | undefined;
|
|
2796
|
+
offsetX: number | undefined;
|
|
2797
|
+
offsetY: number | undefined;
|
|
2798
|
+
pageX: number | undefined;
|
|
2799
|
+
pageY: number | undefined;
|
|
2800
|
+
screenX: number | undefined;
|
|
2801
|
+
screenY: number | undefined;
|
|
2802
|
+
/** @deprecated */
|
|
2803
|
+
toElement: Element | undefined;
|
|
2804
|
+
// PointerEvent
|
|
2805
|
+
pointerId: number | undefined;
|
|
2806
|
+
pointerType: string | undefined;
|
|
2807
|
+
// KeyboardEvent
|
|
2808
|
+
/** @deprecated */
|
|
2809
|
+
char: string | undefined;
|
|
2810
|
+
/** @deprecated */
|
|
2811
|
+
charCode: number | undefined;
|
|
2812
|
+
key: string | undefined;
|
|
2813
|
+
/** @deprecated */
|
|
2814
|
+
keyCode: number | undefined;
|
|
2815
|
+
// TouchEvent
|
|
2816
|
+
changedTouches: TouchList | undefined;
|
|
2817
|
+
targetTouches: TouchList | undefined;
|
|
2818
|
+
touches: TouchList | undefined;
|
|
2819
|
+
// MouseEvent, KeyboardEvent
|
|
2820
|
+
which: number | undefined;
|
|
2821
|
+
// MouseEvent, KeyboardEvent, TouchEvent
|
|
2822
|
+
altKey: boolean | undefined;
|
|
2823
|
+
ctrlKey: boolean | undefined;
|
|
2824
|
+
metaKey: boolean | undefined;
|
|
2825
|
+
shiftKey: boolean | undefined;
|
|
2826
|
+
timeStamp: number;
|
|
2827
|
+
type: string;
|
|
2828
|
+
isDefaultPrevented(): boolean;
|
|
2829
|
+
isImmediatePropagationStopped(): boolean;
|
|
2830
|
+
isPropagationStopped(): boolean;
|
|
2831
|
+
preventDefault(): void;
|
|
2832
|
+
stopImmediatePropagation(): void;
|
|
2833
|
+
stopPropagation(): void;
|
|
2834
|
+
}
|
|
2835
|
+
|
|
2836
|
+
interface TriggeredEvent<
|
|
2837
|
+
TDelegateTarget = any,
|
|
2838
|
+
TData = any,
|
|
2839
|
+
TCurrentTarget = any,
|
|
2840
|
+
TTarget = any
|
|
2841
|
+
> extends Event {
|
|
2842
|
+
currentTarget: TCurrentTarget;
|
|
2843
|
+
delegateTarget: TDelegateTarget;
|
|
2844
|
+
target: TTarget;
|
|
2845
|
+
data: TData;
|
|
2846
|
+
namespace?: string | undefined;
|
|
2847
|
+
originalEvent?: NativeEvent | undefined;
|
|
2848
|
+
result?: any;
|
|
2849
|
+
}
|
|
2850
|
+
|
|
2851
|
+
type List<T> = ArrayLike<T>;
|
|
2852
|
+
type ListIterator<T, TResult> = (value: T, index: number, collection: List<T>) => TResult;
|
|
2853
|
+
type MemoIterator<T, TResult> = (prev: TResult, curr: T, indexOrKey: any, list: T[]) => TResult;
|
|
2854
|
+
|
|
2855
|
+
type _Result<T> = T | (() => T);
|
|
2856
|
+
type _StringKey<T> = keyof T & string;
|
|
2857
|
+
|
|
2858
|
+
interface AddOptions extends Silenceable {
|
|
2859
|
+
at?: number | undefined;
|
|
2860
|
+
merge?: boolean | undefined;
|
|
2861
|
+
sort?: boolean | undefined;
|
|
2862
|
+
}
|
|
2863
|
+
|
|
2864
|
+
interface CollectionSetOptions extends Parseable, Silenceable {
|
|
2865
|
+
add?: boolean | undefined;
|
|
2866
|
+
remove?: boolean | undefined;
|
|
2867
|
+
merge?: boolean | undefined;
|
|
2868
|
+
at?: number | undefined;
|
|
2869
|
+
sort?: boolean | undefined;
|
|
2870
|
+
}
|
|
2871
|
+
|
|
2872
|
+
interface Silenceable {
|
|
2873
|
+
silent?: boolean | undefined;
|
|
2874
|
+
}
|
|
2875
|
+
|
|
2876
|
+
interface Validable {
|
|
2877
|
+
validate?: boolean | undefined;
|
|
2878
|
+
}
|
|
2879
|
+
|
|
2880
|
+
interface Parseable {
|
|
2881
|
+
parse?: boolean | undefined;
|
|
2882
|
+
}
|
|
2883
|
+
|
|
2884
|
+
interface ModelConstructorOptions<TModel extends Model = Model> extends ModelSetOptions, Parseable {
|
|
2885
|
+
collection?: Collection<TModel> | undefined;
|
|
2886
|
+
}
|
|
2887
|
+
|
|
2888
|
+
type CombinedModelConstructorOptions<E, M extends Model<any, any, E> = Model> = ModelConstructorOptions<M> & E;
|
|
2889
|
+
|
|
2890
|
+
interface ModelSetOptions extends Silenceable, Validable {}
|
|
2891
|
+
|
|
2892
|
+
type ObjectHash = Record<string, any>;
|
|
2893
|
+
|
|
2894
|
+
/**
|
|
2895
|
+
* DOM events (used in the events property of a View)
|
|
2896
|
+
*/
|
|
2897
|
+
interface EventsHash {
|
|
2898
|
+
[selector: string]: string | { (eventObject: mvc.TriggeredEvent): void };
|
|
2899
|
+
}
|
|
2900
|
+
|
|
2901
|
+
/**
|
|
2902
|
+
* JavaScript events (used in the methods of the Events interface)
|
|
2903
|
+
*/
|
|
2904
|
+
interface EventHandler {
|
|
2905
|
+
(...args: any[]): void;
|
|
2906
|
+
}
|
|
2907
|
+
interface EventMap {
|
|
2908
|
+
[event: string]: EventHandler;
|
|
2909
|
+
}
|
|
2910
|
+
|
|
2911
|
+
const Events: Events;
|
|
2912
|
+
interface Events extends EventsMixin {}
|
|
2913
|
+
|
|
2914
|
+
/**
|
|
2915
|
+
* Helper shorthands for classes that implement the Events interface.
|
|
2916
|
+
* Define your class like this:
|
|
2917
|
+
*
|
|
2918
|
+
*
|
|
2919
|
+
* class YourClass implements Events {
|
|
2920
|
+
* on: Events_On<YourClass>;
|
|
2921
|
+
* off: Events_Off<YourClass>;
|
|
2922
|
+
* trigger: Events_Trigger<YourClass>;
|
|
2923
|
+
* bind: Events_On<YourClass>;
|
|
2924
|
+
* unbind: Events_Off<YourClass>;
|
|
2925
|
+
*
|
|
2926
|
+
* once: Events_On<YourClass>;
|
|
2927
|
+
* listenTo: Events_Listen<YourClass>;
|
|
2928
|
+
* listenToOnce: Events_Listen<YourClass>;
|
|
2929
|
+
* stopListening: Events_Stop<YourClass>;
|
|
2930
|
+
*
|
|
2931
|
+
* // ... (other methods)
|
|
2932
|
+
* }
|
|
2933
|
+
*
|
|
2934
|
+
* Object.assign(YourClass.prototype, Events); // can also use _.extend
|
|
2935
|
+
*
|
|
2936
|
+
* If you are just writing a class type declaration that doesn't already
|
|
2937
|
+
* extend some other base class, you can use the EventsMixin instead;
|
|
2938
|
+
* see below.
|
|
2939
|
+
*/
|
|
2940
|
+
interface Events_On<BaseT> {
|
|
2941
|
+
<T extends BaseT>(this: T, eventName: string, callback: EventHandler, context?: any): T;
|
|
2942
|
+
<T extends BaseT>(this: T, eventMap: EventMap, context?: any): T;
|
|
2943
|
+
}
|
|
2944
|
+
interface Events_Off<BaseT> {
|
|
2945
|
+
<T extends BaseT>(this: T, eventName?: string | null, callback?: EventHandler | null, context?: any): T;
|
|
2946
|
+
}
|
|
2947
|
+
interface Events_Trigger<BaseT> {
|
|
2948
|
+
<T extends BaseT>(this: T, eventName: string, ...args: any[]): T;
|
|
2949
|
+
}
|
|
2950
|
+
interface Events_Listen<BaseT> {
|
|
2951
|
+
<T extends BaseT>(this: T, object: any, events: string, callback: EventHandler): T;
|
|
2952
|
+
<T extends BaseT>(this: T, object: any, eventMap: EventMap): T;
|
|
2953
|
+
}
|
|
2954
|
+
interface Events_Stop<BaseT> {
|
|
2955
|
+
<T extends BaseT>(this: T, object?: any, events?: string, callback?: EventHandler): T;
|
|
2956
|
+
}
|
|
2957
|
+
|
|
2958
|
+
/**
|
|
2959
|
+
* Helper to avoid code repetition in type declarations.
|
|
2960
|
+
* Events cannot be extended, hence a separate abstract
|
|
2961
|
+
* class with a different name. Both classes and interfaces can
|
|
2962
|
+
* extend from this helper class to reuse the signatures.
|
|
2963
|
+
*
|
|
2964
|
+
* For class type declarations that already extend another base
|
|
2965
|
+
* class, and for actual class definitions, please see the
|
|
2966
|
+
* Events_* interfaces above.
|
|
2967
|
+
*/
|
|
2968
|
+
abstract class EventsMixin implements Events {
|
|
2969
|
+
on(eventName: string, callback: EventHandler, context?: any): this;
|
|
2970
|
+
on(eventMap: EventMap, context?: any): this;
|
|
2971
|
+
off(eventName?: string | null, callback?: EventHandler | null, context?: any): this;
|
|
2972
|
+
trigger(eventName: string, ...args: any[]): this;
|
|
2973
|
+
bind(eventName: string, callback: EventHandler, context?: any): this;
|
|
2974
|
+
bind(eventMap: EventMap, context?: any): this;
|
|
2975
|
+
unbind(eventName?: string, callback?: EventHandler, context?: any): this;
|
|
2976
|
+
|
|
2977
|
+
once(events: string, callback: EventHandler, context?: any): this;
|
|
2978
|
+
once(eventMap: EventMap, context?: any): this;
|
|
2979
|
+
listenTo(object: any, events: string, callback: EventHandler): this;
|
|
2980
|
+
listenTo(object: any, eventMap: EventMap): this;
|
|
2981
|
+
listenToOnce(object: any, events: string, callback: EventHandler): this;
|
|
2982
|
+
listenToOnce(object: any, eventMap: EventMap): this;
|
|
2983
|
+
stopListening(object?: any, events?: string, callback?: EventHandler): this;
|
|
2984
|
+
}
|
|
2985
|
+
|
|
2986
|
+
class ModelBase extends EventsMixin {
|
|
2987
|
+
toJSON(options?: any): any;
|
|
2988
|
+
}
|
|
2989
|
+
|
|
2990
|
+
/**
|
|
2991
|
+
* E - Extensions to the model constructor options. You can accept additional constructor options
|
|
2992
|
+
* by listing them in the E parameter.
|
|
2993
|
+
*/
|
|
2994
|
+
class Model<T extends ObjectHash = any, S = ModelSetOptions, E = any> extends ModelBase implements Events {
|
|
2995
|
+
/**
|
|
2996
|
+
* Do not use, prefer TypeScript's extend functionality.
|
|
2997
|
+
*/
|
|
2998
|
+
static extend(properties: any, classProperties?: any): any;
|
|
2999
|
+
|
|
3000
|
+
attributes: Partial<T>;
|
|
3001
|
+
changed: Partial<T>;
|
|
3002
|
+
cidPrefix: string;
|
|
3003
|
+
cid: string;
|
|
3004
|
+
collection: Collection<this>;
|
|
3005
|
+
|
|
3006
|
+
private _changing: boolean;
|
|
3007
|
+
private _previousAttributes: Partial<T>;
|
|
3008
|
+
private _pending: boolean;
|
|
3009
|
+
|
|
3010
|
+
/**
|
|
3011
|
+
* Default attributes for the model. It can be an object hash or a method returning an object hash.
|
|
3012
|
+
* For assigning an object hash, do it like this: this.defaults = <any>{ attribute: value, ... };
|
|
3013
|
+
* That works only if you set it in the constructor or the initialize method.
|
|
3014
|
+
*/
|
|
3015
|
+
defaults(): Partial<T>;
|
|
3016
|
+
id: string | number;
|
|
3017
|
+
idAttribute: string;
|
|
3018
|
+
validationError: any;
|
|
3019
|
+
|
|
3020
|
+
/**
|
|
3021
|
+
* For use with models as ES classes. If you define a preinitialize
|
|
3022
|
+
* method, it will be invoked when the Model is first created, before
|
|
3023
|
+
* any instantiation logic is run for the Model.
|
|
3024
|
+
*/
|
|
3025
|
+
preinitialize(attributes?: T, options?: CombinedModelConstructorOptions<E, this>): void;
|
|
3026
|
+
|
|
3027
|
+
constructor(attributes?: T, options?: CombinedModelConstructorOptions<E>);
|
|
3028
|
+
initialize(attributes?: T, options?: CombinedModelConstructorOptions<E, this>): void;
|
|
3029
|
+
|
|
3030
|
+
|
|
3031
|
+
/**
|
|
3032
|
+
* For strongly-typed access to attributes, use the `get` method only privately in public getter properties.
|
|
3033
|
+
* @example
|
|
3034
|
+
* get name(): string {
|
|
3035
|
+
* return super.get("name");
|
|
3036
|
+
* }
|
|
3037
|
+
*/
|
|
3038
|
+
get<A extends _StringKey<T>>(attributeName: A): T[A] | undefined;
|
|
3039
|
+
|
|
3040
|
+
/**
|
|
3041
|
+
* For strongly-typed assignment of attributes, use the `set` method only privately in public setter properties.
|
|
3042
|
+
* @example
|
|
3043
|
+
* set name(value: string) {
|
|
3044
|
+
* super.set("name", value);
|
|
3045
|
+
* }
|
|
3046
|
+
*/
|
|
3047
|
+
set<A extends _StringKey<T>>(attributeName: A, value?: T[A], options?: S): this;
|
|
3048
|
+
set(attributeName: Partial<T>, options?: S): this;
|
|
3049
|
+
set<A extends _StringKey<T>>(attributeName: A | Partial<T>, value?: T[A] | S, options?: S): this;
|
|
3050
|
+
|
|
3051
|
+
/**
|
|
3052
|
+
* Return an object containing all the attributes that have changed, or
|
|
3053
|
+
* false if there are no changed attributes. Useful for determining what
|
|
3054
|
+
* parts of a view need to be updated and/or what attributes need to be
|
|
3055
|
+
* persisted to the server. Unset attributes will be set to undefined.
|
|
3056
|
+
* You can also pass an attributes object to diff against the model,
|
|
3057
|
+
* determining if there *would be* a change.
|
|
3058
|
+
*/
|
|
3059
|
+
changedAttributes(attributes?: Partial<T>): Partial<T> | false;
|
|
3060
|
+
clear(options?: Silenceable): this;
|
|
3061
|
+
clone(): Model;
|
|
3062
|
+
escape(attribute: _StringKey<T>): string;
|
|
3063
|
+
has(attribute: _StringKey<T>): boolean;
|
|
3064
|
+
hasChanged(attribute?: _StringKey<T>): boolean;
|
|
3065
|
+
isValid(options?: any): boolean;
|
|
3066
|
+
previous<A extends _StringKey<T>>(attribute: A): T[A] | null | undefined;
|
|
3067
|
+
previousAttributes(): Partial<T>;
|
|
3068
|
+
unset(attribute: _StringKey<T>, options?: Silenceable): this;
|
|
3069
|
+
validate(attributes: Partial<T>, options?: any): any;
|
|
3070
|
+
private _validate(attributes: Partial<T>, options: any): boolean;
|
|
3071
|
+
|
|
3072
|
+
}
|
|
3073
|
+
|
|
3074
|
+
class Collection<TModel extends Model = Model> extends ModelBase implements Events {
|
|
3075
|
+
/**
|
|
3076
|
+
* Do not use, prefer TypeScript's extend functionality.
|
|
3077
|
+
*/
|
|
3078
|
+
static extend(properties: any, classProperties?: any): any;
|
|
3079
|
+
|
|
3080
|
+
model: new (...args: any[]) => TModel;
|
|
3081
|
+
models: TModel[];
|
|
3082
|
+
length: number;
|
|
3083
|
+
|
|
3084
|
+
/**
|
|
3085
|
+
* For use with collections as ES classes. If you define a preinitialize
|
|
3086
|
+
* method, it will be invoked when the Collection is first created and
|
|
3087
|
+
* before any instantiation logic is run for the Collection.
|
|
3088
|
+
*/
|
|
3089
|
+
preinitialize(models?: TModel[] | Array<Record<string, any>>, options?: any): void;
|
|
3090
|
+
|
|
3091
|
+
constructor(models?: TModel[] | Array<Record<string, any>>, options?: any);
|
|
3092
|
+
initialize(models?: TModel[] | Array<Record<string, any>>, options?: any): void;
|
|
3093
|
+
|
|
3094
|
+
|
|
3095
|
+
/**
|
|
3096
|
+
* Specify a model attribute name (string) or function that will be used to sort the collection.
|
|
3097
|
+
*/
|
|
3098
|
+
comparator:
|
|
3099
|
+
| string
|
|
3100
|
+
| { bivarianceHack(element: TModel): number | string }['bivarianceHack']
|
|
3101
|
+
| { bivarianceHack(compare: TModel, to?: TModel): number }['bivarianceHack'];
|
|
3102
|
+
|
|
3103
|
+
add(model: {} | TModel, options?: AddOptions): TModel;
|
|
3104
|
+
add(models: Array<{} | TModel>, options?: AddOptions): TModel[];
|
|
3105
|
+
at(index: number): TModel;
|
|
3106
|
+
/**
|
|
3107
|
+
* Get a model from a collection, specified by an id, a cid, or by passing in a model.
|
|
3108
|
+
*/
|
|
3109
|
+
get(id: number | string | Model): TModel;
|
|
3110
|
+
has(key: number | string | Model): boolean;
|
|
3111
|
+
clone(): this;
|
|
3112
|
+
push(model: TModel, options?: AddOptions): TModel;
|
|
3113
|
+
pop(options?: Silenceable): TModel;
|
|
3114
|
+
remove(model: {} | TModel, options?: Silenceable): TModel;
|
|
3115
|
+
remove(models: Array<{} | TModel>, options?: Silenceable): TModel[];
|
|
3116
|
+
reset(models?: Array<{} | TModel>, options?: Silenceable): TModel[];
|
|
3117
|
+
|
|
3118
|
+
/**
|
|
3119
|
+
*
|
|
3120
|
+
* The set method performs a "smart" update of the collection with the passed list of models.
|
|
3121
|
+
* If a model in the list isn't yet in the collection it will be added; if the model is already in the
|
|
3122
|
+
* collection its attributes will be merged; and if the collection contains any models that aren't present
|
|
3123
|
+
* in the list, they'll be removed. All of the appropriate "add", "remove", and "change" events are fired as
|
|
3124
|
+
* this happens. Returns the touched models in the collection. If you'd like to customize the behavior, you can
|
|
3125
|
+
* disable it with options: {add: false}, {remove: false}, or {merge: false}.
|
|
3126
|
+
* @param models
|
|
3127
|
+
* @param options
|
|
3128
|
+
*/
|
|
3129
|
+
set(models?: Array<{} | TModel>, options?: CollectionSetOptions): TModel[];
|
|
3130
|
+
shift(options?: Silenceable): TModel;
|
|
3131
|
+
sort(options?: Silenceable): this;
|
|
3132
|
+
unshift(model: TModel, options?: AddOptions): TModel;
|
|
3133
|
+
modelId(attrs: any): any;
|
|
3134
|
+
|
|
3135
|
+
values(): Iterator<TModel>;
|
|
3136
|
+
keys(): Iterator<any>;
|
|
3137
|
+
entries(): Iterator<[any, TModel]>;
|
|
3138
|
+
[Symbol.iterator](): Iterator<TModel>;
|
|
3139
|
+
|
|
3140
|
+
private _prepareModel(attributes?: any, options?: any): any;
|
|
3141
|
+
private _removeReference(model: TModel): void;
|
|
3142
|
+
private _onModelEvent(event: string, model: TModel, collection: Collection<TModel>, options: any): void;
|
|
3143
|
+
private _isModel(obj: any): obj is Model;
|
|
3144
|
+
|
|
3145
|
+
/**
|
|
3146
|
+
* Return a shallow copy of this collection's models, using the same options as native Array#slice.
|
|
3147
|
+
*/
|
|
3148
|
+
slice(min?: number, max?: number): TModel[];
|
|
3149
|
+
|
|
3150
|
+
// array methods
|
|
3151
|
+
|
|
3152
|
+
each(iterator: ListIterator<TModel, void>, context?: any): void;
|
|
3153
|
+
find(iterator: ListIterator<TModel, boolean>, context?: any): TModel | undefined;
|
|
3154
|
+
findIndex(iterator: ListIterator<TModel, boolean>, context?: any): number;
|
|
3155
|
+
filter(iterator: ListIterator<TModel, boolean>, context?: any): TModel[];
|
|
3156
|
+
first(): TModel;
|
|
3157
|
+
includes(value: TModel): boolean;
|
|
3158
|
+
isEmpty(): boolean;
|
|
3159
|
+
last(): TModel;
|
|
3160
|
+
map<TResult>(iterator: ListIterator<TModel, TResult>, context?: any): TResult[];
|
|
3161
|
+
reduce<TResult>(iterator: MemoIterator<TModel, TResult>, memo?: TResult): TResult;
|
|
3162
|
+
sortBy(iterator?: ListIterator<TModel, any>, context?: any): TModel[];
|
|
3163
|
+
sortBy(iterator: string, context?: any): TModel[];
|
|
3164
|
+
toArray(): TModel[];
|
|
3165
|
+
|
|
3166
|
+
}
|
|
3167
|
+
|
|
3168
|
+
interface ViewBaseOptions<TModel extends (Model | undefined) = Model, TElement extends Element = HTMLElement> {
|
|
3169
|
+
model?: TModel | undefined;
|
|
3170
|
+
// TODO: quickfix, this can't be fixed easy. The collection does not need to have the same model as the parent view.
|
|
3171
|
+
collection?: Collection<any> | undefined; // was: Collection<TModel>;
|
|
3172
|
+
el?: $Element<TElement> | string | undefined;
|
|
3173
|
+
id?: string | undefined;
|
|
3174
|
+
attributes?: Record<string, any> | undefined;
|
|
3175
|
+
className?: string | undefined;
|
|
3176
|
+
tagName?: string | undefined;
|
|
3177
|
+
events?: _Result<EventsHash> | undefined;
|
|
3178
|
+
}
|
|
3179
|
+
|
|
3180
|
+
type ViewBaseEventListener = (event: mvc.Event) => void;
|
|
3181
|
+
|
|
3182
|
+
class ViewBase<TModel extends (Model | undefined) = Model, TElement extends Element = HTMLElement> extends EventsMixin implements Events {
|
|
3183
|
+
/**
|
|
3184
|
+
* Do not use, prefer TypeScript's extend functionality.
|
|
3185
|
+
*/
|
|
3186
|
+
static extend(properties: any, classProperties?: any): any;
|
|
3187
|
+
|
|
3188
|
+
/**
|
|
3189
|
+
* For use with views as ES classes. If you define a preinitialize
|
|
3190
|
+
* method, it will be invoked when the view is first created, before any
|
|
3191
|
+
* instantiation logic is run.
|
|
3192
|
+
*/
|
|
3193
|
+
preinitialize(options?: ViewBaseOptions<TModel, TElement>): void;
|
|
3194
|
+
|
|
3195
|
+
constructor(options?: ViewBaseOptions<TModel, TElement>);
|
|
3196
|
+
initialize(options?: ViewBaseOptions<TModel, TElement>): void;
|
|
3197
|
+
|
|
3198
|
+
/**
|
|
3199
|
+
* Events hash or a method returning the events hash that maps events/selectors to methods on your View.
|
|
3200
|
+
* For assigning events as object hash, do it like this: this.events = <any>{ "event:selector": callback, ... };
|
|
3201
|
+
* That works only if you set it in the constructor or the initialize method.
|
|
3202
|
+
*/
|
|
3203
|
+
events(): EventsHash;
|
|
3204
|
+
|
|
3205
|
+
// A conditional type used here to prevent `TS2532: Object is possibly 'undefined'`
|
|
3206
|
+
model: TModel extends Model ? TModel : undefined;
|
|
3207
|
+
collection: Collection<any>;
|
|
3208
|
+
setElement(element: $Element<TElement>): this;
|
|
3209
|
+
id?: string | undefined;
|
|
3210
|
+
cid: string;
|
|
3211
|
+
className?: string | undefined;
|
|
3212
|
+
tagName: string;
|
|
3213
|
+
|
|
3214
|
+
el: TElement;
|
|
3215
|
+
attributes: Record<string, any>;
|
|
3216
|
+
/* @deprecated use `el` instead */
|
|
3217
|
+
$el: Dom;
|
|
3218
|
+
/* @deprecated use `el.querySelector()` instead */
|
|
3219
|
+
$(selector: string): Dom;
|
|
3220
|
+
render(): this;
|
|
3221
|
+
remove(): this;
|
|
3222
|
+
delegateEvents(events?: _Result<EventsHash>): this;
|
|
3223
|
+
delegate(eventName: string, selector: string, listener: ViewBaseEventListener): this;
|
|
3224
|
+
undelegateEvents(): this;
|
|
3225
|
+
undelegate(eventName: string, selector?: string, listener?: ViewBaseEventListener): this;
|
|
3226
|
+
|
|
3227
|
+
protected _removeElement(): void;
|
|
3228
|
+
protected _setElement(el: $Element<TElement>): void;
|
|
3229
|
+
protected _createElement(tagName: string): void;
|
|
3230
|
+
protected _ensureElement(): void;
|
|
3231
|
+
protected _setAttributes(attributes: Record<string, any>): void;
|
|
3232
|
+
}
|
|
3233
|
+
|
|
3234
|
+
interface ViewOptions<T extends (mvc.Model | undefined), E extends Element = HTMLElement> extends mvc.ViewBaseOptions<T, E> {
|
|
3235
|
+
theme?: string;
|
|
3236
|
+
[key: string]: any;
|
|
3237
|
+
}
|
|
3238
|
+
|
|
3239
|
+
interface viewEventData {
|
|
3240
|
+
[key: string]: any;
|
|
3241
|
+
}
|
|
3242
|
+
|
|
3243
|
+
class View<T extends (mvc.Model | undefined), E extends Element = HTMLElement> extends mvc.ViewBase<T, E> {
|
|
3244
|
+
|
|
3245
|
+
constructor(opt?: ViewOptions<T, E>);
|
|
3246
|
+
|
|
3247
|
+
UPDATE_PRIORITY: number;
|
|
3248
|
+
DETACHABLE: boolean;
|
|
3249
|
+
FLAG_INSERT: number;
|
|
3250
|
+
FLAG_REMOVE: number;
|
|
3251
|
+
FLAG_INIT: number;
|
|
3252
|
+
|
|
3253
|
+
vel: E extends HTMLElement ? null : Vectorizer;
|
|
3254
|
+
|
|
3255
|
+
svgElement: boolean;
|
|
3256
|
+
|
|
3257
|
+
options: ViewOptions<T, E>;
|
|
3258
|
+
|
|
3259
|
+
theme: string;
|
|
3260
|
+
|
|
3261
|
+
themeClassNamePrefix: string;
|
|
3262
|
+
|
|
3263
|
+
defaultTheme: string;
|
|
3264
|
+
|
|
3265
|
+
requireSetThemeOverride: boolean;
|
|
3266
|
+
|
|
3267
|
+
documentEvents?: mvc.EventsHash;
|
|
3268
|
+
|
|
3269
|
+
children?: dia.MarkupJSON;
|
|
3270
|
+
|
|
3271
|
+
childNodes?: { [key: string]: Element } | null;
|
|
3272
|
+
|
|
3273
|
+
style?: { [key: string]: any };
|
|
3274
|
+
|
|
3275
|
+
setTheme(theme: string, opt?: { override?: boolean }): this;
|
|
3276
|
+
|
|
3277
|
+
getEventNamespace(): string;
|
|
3278
|
+
|
|
3279
|
+
delegateDocumentEvents(events?: mvc.EventsHash, data?: viewEventData): this;
|
|
3280
|
+
|
|
3281
|
+
undelegateDocumentEvents(): this;
|
|
3282
|
+
|
|
3283
|
+
delegateElementEvents(element: Element, events?: mvc.EventsHash, data?: viewEventData): this;
|
|
3284
|
+
|
|
3285
|
+
undelegateElementEvents(element: Element): this;
|
|
3286
|
+
|
|
3287
|
+
eventData(evt: dia.Event): viewEventData;
|
|
3288
|
+
eventData(evt: dia.Event, data: viewEventData): this;
|
|
3289
|
+
|
|
3290
|
+
stopPropagation(evt: dia.Event): this;
|
|
3291
|
+
isPropagationStopped(evt: dia.Event): boolean;
|
|
3292
|
+
|
|
3293
|
+
renderChildren(children?: dia.MarkupJSON): this;
|
|
3294
|
+
|
|
3295
|
+
findAttribute(attributeName: string, node: Element): string | null;
|
|
3296
|
+
|
|
3297
|
+
confirmUpdate(flag: number, opt: { [key: string]: any }): number;
|
|
3298
|
+
|
|
3299
|
+
unmount(): void;
|
|
3300
|
+
|
|
3301
|
+
isMounted(): boolean;
|
|
3302
|
+
|
|
3303
|
+
protected init(): void;
|
|
3304
|
+
|
|
3305
|
+
protected onRender(): void;
|
|
3306
|
+
|
|
3307
|
+
protected onSetTheme(oldTheme: string, newTheme: string): void;
|
|
3308
|
+
|
|
3309
|
+
protected onRemove(): void;
|
|
3310
|
+
}
|
|
3311
|
+
|
|
3312
|
+
type ModifiedCallback<CallbackArgs extends any[], EventCallback extends Callback> = (...args: [...CallbackArgs, ...Parameters<EventCallback>]) => any;
|
|
3313
|
+
|
|
3314
|
+
type EventHashMap<CallbackArgs extends any[], T extends Record<keyof T, Callback>> = {
|
|
3315
|
+
[Property in keyof T]?: ModifiedCallback<CallbackArgs, T[Property]>;
|
|
3316
|
+
};
|
|
3317
|
+
|
|
3318
|
+
type Callback = (...args: any[]) => any;
|
|
3319
|
+
|
|
3320
|
+
class Listener<Args extends any[]> {
|
|
3321
|
+
constructor(...callbackArguments: Args);
|
|
3322
|
+
|
|
3323
|
+
callbackArguments: Args;
|
|
3324
|
+
|
|
3325
|
+
listenTo<CB extends Callback>(object: any, evt: string, callback: ModifiedCallback<Args, CB>, context?: any): void;
|
|
3326
|
+
listenTo<EventCBMap extends Record<keyof EventCBMap, Callback> = { [eventName: string]: Callback }>(object: any, eventHashMap: EventHashMap<Args, EventCBMap>, context?: any): void;
|
|
3327
|
+
|
|
3328
|
+
stopListening(): void;
|
|
3329
|
+
}
|
|
3330
|
+
}
|
|
3331
|
+
|
|
3332
|
+
// routers
|
|
3333
|
+
|
|
3334
|
+
export namespace routers {
|
|
3335
|
+
|
|
3336
|
+
interface NormalRouterArguments {
|
|
3337
|
+
|
|
3338
|
+
}
|
|
3339
|
+
|
|
3340
|
+
interface ManhattanRouterArguments {
|
|
3341
|
+
step?: number;
|
|
3342
|
+
padding?: dia.Sides;
|
|
3343
|
+
maximumLoops?: number;
|
|
3344
|
+
maxAllowedDirectionChange?: number;
|
|
3345
|
+
perpendicular?: boolean;
|
|
3346
|
+
excludeEnds?: dia.LinkEnd[];
|
|
3347
|
+
excludeTypes?: string[];
|
|
3348
|
+
startDirections?: dia.OrthogonalDirection[];
|
|
3349
|
+
endDirections?: dia.OrthogonalDirection[];
|
|
3350
|
+
isPointObstacle?: (point: dia.Point) => boolean;
|
|
3351
|
+
fallbackRouter: (vertices: dia.Point[], opts?: ManhattanRouterArguments, linkView?: dia.LinkView) => dia.Point[];
|
|
3352
|
+
}
|
|
3353
|
+
|
|
3354
|
+
interface OrthogonalRouterArguments {
|
|
3355
|
+
elementPadding?: number;
|
|
3356
|
+
padding?: dia.Sides;
|
|
3357
|
+
}
|
|
3358
|
+
|
|
3359
|
+
interface OneSideRouterArguments {
|
|
3360
|
+
side?: dia.OrthogonalDirection;
|
|
3361
|
+
padding?: dia.Sides;
|
|
3362
|
+
}
|
|
3363
|
+
|
|
3364
|
+
interface RouterArgumentsMap {
|
|
3365
|
+
'normal': NormalRouterArguments;
|
|
3366
|
+
'manhattan': ManhattanRouterArguments;
|
|
3367
|
+
'metro': ManhattanRouterArguments;
|
|
3368
|
+
'orthogonal': OrthogonalRouterArguments;
|
|
3369
|
+
/**
|
|
3370
|
+
* @deprecated use `rightAngle` instead
|
|
3371
|
+
*/
|
|
3372
|
+
'oneSide': OneSideRouterArguments;
|
|
3373
|
+
'rightAngle': RightAngleRouterArguments;
|
|
3374
|
+
[key: string]: { [key: string]: any };
|
|
3375
|
+
}
|
|
3376
|
+
|
|
3377
|
+
type RouterType = keyof RouterArgumentsMap;
|
|
3378
|
+
|
|
3379
|
+
type GenericRouterArguments<K extends RouterType> = RouterArgumentsMap[K];
|
|
3380
|
+
|
|
3381
|
+
interface GenericRouter<K extends RouterType> {
|
|
3382
|
+
(
|
|
3383
|
+
vertices: dia.Point[],
|
|
3384
|
+
args?: GenericRouterArguments<K>,
|
|
3385
|
+
linkView?: dia.LinkView
|
|
3386
|
+
): dia.Point[];
|
|
3387
|
+
}
|
|
3388
|
+
|
|
3389
|
+
interface GenericRouterJSON<K extends RouterType> {
|
|
3390
|
+
name: K;
|
|
3391
|
+
args?: GenericRouterArguments<K>;
|
|
3392
|
+
}
|
|
3393
|
+
|
|
3394
|
+
type RouterArguments = GenericRouterArguments<RouterType>;
|
|
3395
|
+
|
|
3396
|
+
type Router = GenericRouter<RouterType>;
|
|
3397
|
+
|
|
3398
|
+
type RouterJSON = GenericRouterJSON<RouterType>;
|
|
3399
|
+
|
|
3400
|
+
export var manhattan: GenericRouter<'manhattan'>;
|
|
3401
|
+
export var metro: GenericRouter<'metro'>;
|
|
3402
|
+
export var normal: GenericRouter<'normal'>;
|
|
3403
|
+
export var orthogonal: GenericRouter<'orthogonal'>;
|
|
3404
|
+
/**
|
|
3405
|
+
* @deprecated use `rightAngle` instead
|
|
3406
|
+
*/
|
|
3407
|
+
export var oneSide: GenericRouter<'oneSide'>;
|
|
3408
|
+
|
|
3409
|
+
/* Right Angle Router */
|
|
3410
|
+
|
|
3411
|
+
enum RightAngleDirections {
|
|
3412
|
+
AUTO = 'auto',
|
|
3413
|
+
LEFT = 'left',
|
|
3414
|
+
RIGHT = 'right',
|
|
3415
|
+
TOP = 'top',
|
|
3416
|
+
BOTTOM = 'bottom',
|
|
3417
|
+
ANCHOR_SIDE = 'anchor-side',
|
|
3418
|
+
MAGNET_SIDE = 'magnet-side'
|
|
3419
|
+
}
|
|
3420
|
+
|
|
3421
|
+
interface RightAngleRouterArguments {
|
|
3422
|
+
margin?: number;
|
|
3423
|
+
/** @experimental before version 4.0 */
|
|
3424
|
+
useVertices?: boolean;
|
|
3425
|
+
sourceDirection?: RightAngleDirections;
|
|
3426
|
+
targetDirection?: RightAngleDirections;
|
|
3427
|
+
}
|
|
3428
|
+
|
|
3429
|
+
interface RightAngleRouter extends GenericRouter<'rightAngle'> {
|
|
3430
|
+
Directions: typeof RightAngleDirections;
|
|
3431
|
+
}
|
|
3432
|
+
|
|
3433
|
+
export var rightAngle: RightAngleRouter;
|
|
3434
|
+
}
|
|
3435
|
+
|
|
3436
|
+
// connectors
|
|
3437
|
+
|
|
3438
|
+
export namespace connectors {
|
|
3439
|
+
|
|
3440
|
+
interface NormalConnectorArguments {
|
|
3441
|
+
raw?: boolean;
|
|
3442
|
+
}
|
|
3443
|
+
|
|
3444
|
+
interface RoundedConnectorArguments {
|
|
3445
|
+
raw?: boolean;
|
|
3446
|
+
radius?: number;
|
|
3447
|
+
}
|
|
3448
|
+
|
|
3449
|
+
interface SmoothConnectorArguments {
|
|
3450
|
+
raw?: boolean;
|
|
3451
|
+
}
|
|
3452
|
+
|
|
3453
|
+
interface JumpOverConnectorArguments {
|
|
3454
|
+
raw?: boolean;
|
|
3455
|
+
size?: number;
|
|
3456
|
+
jump?: 'arc' | 'gap' | 'cubic';
|
|
3457
|
+
radius?: number;
|
|
3458
|
+
}
|
|
3459
|
+
|
|
3460
|
+
interface StraightConnectorArguments {
|
|
3461
|
+
raw?: boolean;
|
|
3462
|
+
cornerType?: 'point' | 'cubic' | 'line' | 'gap';
|
|
3463
|
+
cornerRadius?: number;
|
|
3464
|
+
cornerPreserveAspectRatio?: boolean;
|
|
3465
|
+
precision?: number;
|
|
3466
|
+
}
|
|
3467
|
+
|
|
3468
|
+
enum CurveDirections {
|
|
3469
|
+
AUTO = 'auto',
|
|
3470
|
+
HORIZONTAL = 'horizontal',
|
|
3471
|
+
VERTICAL = 'vertical',
|
|
3472
|
+
CLOSEST_POINT = 'closest-point',
|
|
3473
|
+
OUTWARDS = 'outwards'
|
|
3474
|
+
}
|
|
3475
|
+
|
|
3476
|
+
enum CurveTangentDirections {
|
|
3477
|
+
UP = 'up',
|
|
3478
|
+
DOWN = 'down',
|
|
3479
|
+
LEFT = 'left',
|
|
3480
|
+
RIGHT = 'right',
|
|
3481
|
+
AUTO = 'auto',
|
|
3482
|
+
CLOSEST_POINT = 'closest-point',
|
|
3483
|
+
OUTWARDS = 'outwards'
|
|
3484
|
+
}
|
|
3485
|
+
|
|
3486
|
+
interface CurveConnectorArguments {
|
|
3487
|
+
raw?: boolean;
|
|
3488
|
+
direction?: CurveDirections;
|
|
3489
|
+
sourceDirection?: CurveTangentDirections | dia.Point | number;
|
|
3490
|
+
targetDirection?: CurveTangentDirections | dia.Point | number;
|
|
3491
|
+
sourceTangent?: dia.Point;
|
|
3492
|
+
targetTangent?: dia.Point;
|
|
3493
|
+
distanceCoefficient?: number;
|
|
3494
|
+
angleTangentCoefficient?: number;
|
|
3495
|
+
tension?: number;
|
|
3496
|
+
precision?: number;
|
|
3497
|
+
}
|
|
3498
|
+
|
|
3499
|
+
interface ConnectorArgumentsMap {
|
|
3500
|
+
'normal': NormalConnectorArguments;
|
|
3501
|
+
'rounded': RoundedConnectorArguments;
|
|
3502
|
+
'smooth': SmoothConnectorArguments;
|
|
3503
|
+
'jumpover': JumpOverConnectorArguments;
|
|
3504
|
+
'straight': StraightConnectorArguments;
|
|
3505
|
+
'curve': CurveConnectorArguments;
|
|
3506
|
+
[key: string]: { [key: string]: any };
|
|
3507
|
+
}
|
|
3508
|
+
|
|
3509
|
+
type ConnectorType = keyof ConnectorArgumentsMap;
|
|
3510
|
+
|
|
3511
|
+
type GenericConnectorArguments<K extends ConnectorType> = ConnectorArgumentsMap[K];
|
|
3512
|
+
|
|
3513
|
+
interface GenericConnector<K extends ConnectorType> {
|
|
3514
|
+
(
|
|
3515
|
+
sourcePoint: dia.Point,
|
|
3516
|
+
targetPoint: dia.Point,
|
|
3517
|
+
routePoints: dia.Point[],
|
|
3518
|
+
args?: GenericConnectorArguments<K>,
|
|
3519
|
+
linkView?: dia.LinkView
|
|
3520
|
+
): string | g.Path;
|
|
3521
|
+
}
|
|
3522
|
+
|
|
3523
|
+
interface GenericConnectorJSON<K extends ConnectorType> {
|
|
3524
|
+
name: K;
|
|
3525
|
+
args?: GenericConnectorArguments<K>;
|
|
3526
|
+
}
|
|
3527
|
+
|
|
3528
|
+
interface CurveConnector extends GenericConnector<'curve'> {
|
|
3529
|
+
Directions: typeof CurveDirections;
|
|
3530
|
+
TangentDirections: typeof CurveTangentDirections;
|
|
3531
|
+
}
|
|
3532
|
+
|
|
3533
|
+
type ConnectorArguments = GenericConnectorArguments<ConnectorType>;
|
|
3534
|
+
|
|
3535
|
+
type Connector = GenericConnector<ConnectorType>;
|
|
3536
|
+
|
|
3537
|
+
type ConnectorJSON = GenericConnectorJSON<ConnectorType>;
|
|
3538
|
+
|
|
3539
|
+
export var normal: GenericConnector<'normal'>;
|
|
3540
|
+
export var rounded: GenericConnector<'rounded'>;
|
|
3541
|
+
export var smooth: GenericConnector<'smooth'>;
|
|
3542
|
+
export var jumpover: GenericConnector<'jumpover'>;
|
|
3543
|
+
export var straight: GenericConnector<'straight'>;
|
|
3544
|
+
export var curve: CurveConnector;
|
|
3545
|
+
}
|
|
3546
|
+
|
|
3547
|
+
// anchors
|
|
3548
|
+
|
|
3549
|
+
export namespace anchors {
|
|
3550
|
+
|
|
3551
|
+
interface RotateAnchorArguments {
|
|
3552
|
+
rotate?: boolean;
|
|
3553
|
+
}
|
|
3554
|
+
|
|
3555
|
+
interface BBoxAnchorArguments extends RotateAnchorArguments {
|
|
3556
|
+
dx?: number | string;
|
|
3557
|
+
dy?: number | string;
|
|
3558
|
+
}
|
|
3559
|
+
|
|
3560
|
+
interface PaddingAnchorArguments {
|
|
3561
|
+
padding?: number;
|
|
3562
|
+
}
|
|
3563
|
+
|
|
3564
|
+
interface MidSideAnchorArguments extends RotateAnchorArguments, PaddingAnchorArguments {
|
|
3565
|
+
|
|
3566
|
+
}
|
|
3567
|
+
|
|
3568
|
+
interface ModelCenterAnchorArguments {
|
|
3569
|
+
dx?: number;
|
|
3570
|
+
dy?: number;
|
|
3571
|
+
}
|
|
3572
|
+
|
|
3573
|
+
interface AnchorArgumentsMap {
|
|
3574
|
+
'center': BBoxAnchorArguments;
|
|
3575
|
+
'top': BBoxAnchorArguments;
|
|
3576
|
+
'bottom': BBoxAnchorArguments;
|
|
3577
|
+
'left': BBoxAnchorArguments;
|
|
3578
|
+
'right': BBoxAnchorArguments;
|
|
3579
|
+
'topLeft': BBoxAnchorArguments;
|
|
3580
|
+
'topRight': BBoxAnchorArguments;
|
|
3581
|
+
'bottomLeft': BBoxAnchorArguments;
|
|
3582
|
+
'bottomRight': BBoxAnchorArguments;
|
|
3583
|
+
'perpendicular': PaddingAnchorArguments;
|
|
3584
|
+
'midSide': MidSideAnchorArguments;
|
|
3585
|
+
'modelCenter': ModelCenterAnchorArguments;
|
|
3586
|
+
'connectionRatio': linkAnchors.ConnectionLengthAnchorArguments;
|
|
3587
|
+
'connectionLength': linkAnchors.ConnectionLengthAnchorArguments;
|
|
3588
|
+
'connectionPerpendicular': linkAnchors.ConnectionPerpendicularAnchorArguments;
|
|
3589
|
+
'connectionClosest': linkAnchors.ConnectionClosestAnchorArguments;
|
|
3590
|
+
[key: string]: { [key: string]: any };
|
|
3591
|
+
}
|
|
3592
|
+
|
|
3593
|
+
type AnchorType = keyof AnchorArgumentsMap;
|
|
3594
|
+
|
|
3595
|
+
type GenericAnchorArguments<K extends AnchorType> = AnchorArgumentsMap[K];
|
|
3596
|
+
|
|
3597
|
+
interface GenericAnchor<K extends AnchorType> {
|
|
3598
|
+
(
|
|
3599
|
+
endView: dia.CellView,
|
|
3600
|
+
endMagnet: SVGElement,
|
|
3601
|
+
anchorReference: g.Point | SVGElement,
|
|
3602
|
+
opt: AnchorArgumentsMap[K],
|
|
3603
|
+
endType: string,
|
|
3604
|
+
linkView: dia.LinkView
|
|
3605
|
+
): g.Point;
|
|
3606
|
+
}
|
|
3607
|
+
|
|
3608
|
+
interface GenericAnchorJSON<K extends AnchorType> {
|
|
3609
|
+
name: K;
|
|
3610
|
+
args?: AnchorArgumentsMap[K];
|
|
3611
|
+
}
|
|
3612
|
+
|
|
3613
|
+
type AnchorArguments = GenericAnchorArguments<AnchorType>;
|
|
3614
|
+
|
|
3615
|
+
type Anchor = GenericAnchor<AnchorType>;
|
|
3616
|
+
|
|
3617
|
+
type AnchorJSON = GenericAnchorJSON<AnchorType>;
|
|
3618
|
+
|
|
3619
|
+
export var center: GenericAnchor<'center'>;
|
|
3620
|
+
export var top: GenericAnchor<'top'>;
|
|
3621
|
+
export var bottom: GenericAnchor<'bottom'>;
|
|
3622
|
+
export var left: GenericAnchor<'left'>;
|
|
3623
|
+
export var right: GenericAnchor<'right'>;
|
|
3624
|
+
export var topLeft: GenericAnchor<'topLeft'>;
|
|
3625
|
+
export var topRight: GenericAnchor<'topRight'>;
|
|
3626
|
+
export var bottomLeft: GenericAnchor<'bottomLeft'>;
|
|
3627
|
+
export var bottomRight: GenericAnchor<'bottomRight'>;
|
|
3628
|
+
export var perpendicular: GenericAnchor<'perpendicular'>;
|
|
3629
|
+
export var midSide: GenericAnchor<'midSide'>;
|
|
3630
|
+
}
|
|
3631
|
+
|
|
3632
|
+
export namespace linkAnchors {
|
|
3633
|
+
|
|
3634
|
+
interface ConnectionLengthAnchorArguments {
|
|
3635
|
+
length?: number;
|
|
3636
|
+
}
|
|
3637
|
+
|
|
3638
|
+
interface ConnectionRatioAnchorArguments {
|
|
3639
|
+
ratio?: number;
|
|
3640
|
+
}
|
|
3641
|
+
|
|
3642
|
+
interface ConnectionPerpendicularAnchorArguments {
|
|
3643
|
+
fallbackAt?: number | string;
|
|
3644
|
+
fixedAt?: number | string;
|
|
3645
|
+
}
|
|
3646
|
+
|
|
3647
|
+
interface ConnectionClosestAnchorArguments {
|
|
3648
|
+
fixedAt?: number | string;
|
|
3649
|
+
}
|
|
3650
|
+
|
|
3651
|
+
export var connectionRatio: anchors.GenericAnchor<'connectionRatio'>;
|
|
3652
|
+
export var connectionLength: anchors.GenericAnchor<'connectionLength'>;
|
|
3653
|
+
export var connectionPerpendicular: anchors.GenericAnchor<'connectionPerpendicular'>;
|
|
3654
|
+
export var connectionClosest: anchors.GenericAnchor<'connectionClosest'>;
|
|
3655
|
+
}
|
|
3656
|
+
|
|
3657
|
+
// connection points
|
|
3658
|
+
|
|
3659
|
+
export namespace connectionPoints {
|
|
3660
|
+
|
|
3661
|
+
type ConnectionPointAlignment = 'top' | 'bottom' | 'left' | 'right';
|
|
3662
|
+
|
|
3663
|
+
interface DefaultConnectionPointArguments {
|
|
3664
|
+
offset?: number | dia.Point;
|
|
3665
|
+
}
|
|
3666
|
+
|
|
3667
|
+
interface AlignConnectionPointArguments extends DefaultConnectionPointArguments {
|
|
3668
|
+
align?: ConnectionPointAlignment | null;
|
|
3669
|
+
alignOffset?: number;
|
|
3670
|
+
}
|
|
3671
|
+
|
|
3672
|
+
interface StrokeConnectionPointArguments extends DefaultConnectionPointArguments {
|
|
3673
|
+
stroke?: boolean;
|
|
3674
|
+
}
|
|
3675
|
+
|
|
3676
|
+
interface BoundaryConnectionPointArguments extends StrokeConnectionPointArguments {
|
|
3677
|
+
selector?: Array<string | number> | string | false;
|
|
3678
|
+
precision?: number;
|
|
3679
|
+
extrapolate?: boolean;
|
|
3680
|
+
sticky?: boolean;
|
|
3681
|
+
insideout?: boolean;
|
|
3682
|
+
}
|
|
3683
|
+
|
|
3684
|
+
interface ConnectionPointArgumentsMap {
|
|
3685
|
+
'anchor': DefaultConnectionPointArguments;
|
|
3686
|
+
'bbox': StrokeConnectionPointArguments;
|
|
3687
|
+
'rectangle': StrokeConnectionPointArguments;
|
|
3688
|
+
'boundary': BoundaryConnectionPointArguments;
|
|
3689
|
+
[key: string]: { [key: string]: any };
|
|
3690
|
+
}
|
|
3691
|
+
|
|
3692
|
+
type ConnectionPointType = keyof ConnectionPointArgumentsMap;
|
|
3693
|
+
|
|
3694
|
+
type GenericConnectionPointArguments<K extends ConnectionPointType> = ConnectionPointArgumentsMap[K];
|
|
3695
|
+
|
|
3696
|
+
interface GenericConnectionPoint<K extends ConnectionPointType> {
|
|
3697
|
+
(
|
|
3698
|
+
endPathSegmentLine: g.Line,
|
|
3699
|
+
endView: dia.CellView,
|
|
3700
|
+
endMagnet: SVGElement,
|
|
3701
|
+
opt: ConnectionPointArgumentsMap[K],
|
|
3702
|
+
endType: string,
|
|
3703
|
+
linkView: dia.LinkView
|
|
3704
|
+
): g.Point;
|
|
3705
|
+
}
|
|
3706
|
+
|
|
3707
|
+
interface GenericConnectionPointJSON<K extends ConnectionPointType> {
|
|
3708
|
+
name: K;
|
|
3709
|
+
args?: ConnectionPointArgumentsMap[K];
|
|
3710
|
+
}
|
|
3711
|
+
|
|
3712
|
+
type ConnectionPointArguments = GenericConnectionPointArguments<ConnectionPointType>;
|
|
3713
|
+
|
|
3714
|
+
type ConnectionPoint = GenericConnectionPoint<ConnectionPointType>;
|
|
3715
|
+
|
|
3716
|
+
type ConnectionPointJSON = GenericConnectionPointJSON<ConnectionPointType>;
|
|
3717
|
+
|
|
3718
|
+
export var anchor: GenericConnectionPoint<'anchor'>;
|
|
3719
|
+
export var bbox: GenericConnectionPoint<'bbox'>;
|
|
3720
|
+
export var rectangle: GenericConnectionPoint<'rectangle'>;
|
|
3721
|
+
export var boundary: GenericConnectionPoint<'boundary'>;
|
|
3722
|
+
}
|
|
3723
|
+
|
|
3724
|
+
export namespace connectionStrategies {
|
|
3725
|
+
|
|
3726
|
+
interface ConnectionStrategy {
|
|
3727
|
+
(
|
|
3728
|
+
endDefinition: dia.Link.EndJSON,
|
|
3729
|
+
endView: dia.CellView,
|
|
3730
|
+
endMagnet: SVGElement,
|
|
3731
|
+
coords: dia.Point,
|
|
3732
|
+
link: dia.Link,
|
|
3733
|
+
endType: dia.LinkEnd
|
|
3734
|
+
): dia.Link.EndJSON;
|
|
3735
|
+
}
|
|
3736
|
+
|
|
3737
|
+
export var useDefaults: ConnectionStrategy;
|
|
3738
|
+
export var pinAbsolute: ConnectionStrategy;
|
|
3739
|
+
export var pinRelative: ConnectionStrategy;
|
|
3740
|
+
}
|
|
3741
|
+
|
|
3742
|
+
export namespace attributes {
|
|
3743
|
+
|
|
3744
|
+
interface SVGCoreAttributes {
|
|
3745
|
+
'id'?: string;
|
|
3746
|
+
'xml:base'?: string;
|
|
3747
|
+
'xml:lang'?: string;
|
|
3748
|
+
'xml:space'?: string;
|
|
3749
|
+
'tabindex'?: number;
|
|
3750
|
+
}
|
|
3751
|
+
|
|
3752
|
+
interface SVGConditionalProcessingAttributes {
|
|
3753
|
+
'requiredExtensions'?: boolean;
|
|
3754
|
+
'requiredFeatures'?: string;
|
|
3755
|
+
'systemLanguage'?: string;
|
|
3756
|
+
}
|
|
3757
|
+
|
|
3758
|
+
interface SVGXLinkAttributes {
|
|
3759
|
+
'xlink:href'?: string;
|
|
3760
|
+
'xlink:type'?: string;
|
|
3761
|
+
'xlink:role'?: string;
|
|
3762
|
+
'xlink:arcrole'?: string;
|
|
3763
|
+
'xlink:title'?: string;
|
|
3764
|
+
'xlink:show'?: string;
|
|
3765
|
+
'xlink:actuate'?: string;
|
|
3766
|
+
}
|
|
3767
|
+
|
|
3768
|
+
interface SVGPresentationAttributes {
|
|
3769
|
+
'alignment-baseline'?: any;
|
|
3770
|
+
'baseline-shift'?: any;
|
|
3771
|
+
'clip'?: any;
|
|
3772
|
+
'clip-path'?: any;
|
|
3773
|
+
'clip-rule'?: any;
|
|
3774
|
+
'color'?: any;
|
|
3775
|
+
'color-interpolation'?: any;
|
|
3776
|
+
'color-interpolation-filters'?: any;
|
|
3777
|
+
'color-profile'?: any;
|
|
3778
|
+
'color-rendering'?: any;
|
|
3779
|
+
'cursor'?: any;
|
|
3780
|
+
'direction'?: any;
|
|
3781
|
+
'display'?: any;
|
|
3782
|
+
'dominant-baseline'?: any;
|
|
3783
|
+
'enable-background'?: any;
|
|
3784
|
+
'fill'?: any;
|
|
3785
|
+
'fill-opacity'?: any;
|
|
3786
|
+
'fill-rule'?: any;
|
|
3787
|
+
'filter'?: any;
|
|
3788
|
+
'flood-color'?: any;
|
|
3789
|
+
'flood-opacity'?: any;
|
|
3790
|
+
'font-family'?: any;
|
|
3791
|
+
'font-size'?: any;
|
|
3792
|
+
'font-size-adjust'?: any;
|
|
3793
|
+
'font-stretch'?: any;
|
|
3794
|
+
'font-style'?: any;
|
|
3795
|
+
'font-variant'?: any;
|
|
3796
|
+
'font-weight'?: any;
|
|
3797
|
+
'glyph-orientation-horizontal'?: any;
|
|
3798
|
+
'glyph-orientation-vertical'?: any;
|
|
3799
|
+
'image-rendering'?: any;
|
|
3800
|
+
'kerning'?: any;
|
|
3801
|
+
'letter-spacing'?: any;
|
|
3802
|
+
'lighting-color'?: any;
|
|
3803
|
+
'marker-end'?: any;
|
|
3804
|
+
'marker-mid'?: any;
|
|
3805
|
+
'marker-start'?: any;
|
|
3806
|
+
'mask'?: any;
|
|
3807
|
+
'opacity'?: any;
|
|
3808
|
+
'overflow'?: any;
|
|
3809
|
+
'pointer-events'?: any;
|
|
3810
|
+
'shape-rendering'?: any;
|
|
3811
|
+
'stop-color'?: any;
|
|
3812
|
+
'stop-opacity'?: any;
|
|
3813
|
+
'stroke'?: any;
|
|
3814
|
+
'stroke-dasharray'?: any;
|
|
3815
|
+
'stroke-dashoffset'?: any;
|
|
3816
|
+
'stroke-linecap'?: any;
|
|
3817
|
+
'stroke-linejoin'?: any;
|
|
3818
|
+
'stroke-miterlimit'?: any;
|
|
3819
|
+
'stroke-opacity'?: any;
|
|
3820
|
+
'stroke-width'?: any;
|
|
3821
|
+
'text-anchor'?: any;
|
|
3822
|
+
'text-decoration'?: any;
|
|
3823
|
+
'text-rendering'?: any;
|
|
3824
|
+
'unicode-bidi'?: any;
|
|
3825
|
+
'visibility'?: any;
|
|
3826
|
+
'word-spacing'?: any;
|
|
3827
|
+
'writing-mode'?: any;
|
|
3828
|
+
}
|
|
3829
|
+
|
|
3830
|
+
interface NativeSVGAttributes extends SVGCoreAttributes, SVGPresentationAttributes, SVGConditionalProcessingAttributes, SVGXLinkAttributes {
|
|
3831
|
+
'class'?: string;
|
|
3832
|
+
'style'?: any;
|
|
3833
|
+
'transform'?: string;
|
|
3834
|
+
'externalResourcesRequired'?: boolean;
|
|
3835
|
+
|
|
3836
|
+
[key: string]: any;
|
|
3837
|
+
}
|
|
3838
|
+
|
|
3839
|
+
interface SVGAttributeTextWrap {
|
|
3840
|
+
width?: string | number | null;
|
|
3841
|
+
height?: string | number | null;
|
|
3842
|
+
ellipsis?: boolean | string;
|
|
3843
|
+
separator?: string;
|
|
3844
|
+
hyphen?: string;
|
|
3845
|
+
maxLineCount?: number;
|
|
3846
|
+
preserveSpaces?: boolean;
|
|
3847
|
+
breakText?: util.BreakTextFunction;
|
|
3848
|
+
[key: string]: any;
|
|
3849
|
+
/**
|
|
3850
|
+
* @deprecated use SVGAttributes.text instead
|
|
3851
|
+
**/
|
|
3852
|
+
text?: string;
|
|
3853
|
+
}
|
|
3854
|
+
|
|
3855
|
+
interface SVGAttributeProps {
|
|
3856
|
+
checked?: boolean;
|
|
3857
|
+
disabled?: boolean;
|
|
3858
|
+
multiple?: boolean;
|
|
3859
|
+
readOnly?: boolean;
|
|
3860
|
+
selected?: boolean;
|
|
3861
|
+
indeterminate?: boolean;
|
|
3862
|
+
contentEditable?: boolean;
|
|
3863
|
+
value?: any;
|
|
3864
|
+
}
|
|
3865
|
+
|
|
3866
|
+
interface SVGAttributes extends NativeSVGAttributes {
|
|
3867
|
+
// Special attributes
|
|
3868
|
+
eol?: string;
|
|
3869
|
+
filter?: string | dia.SVGFilterJSON;
|
|
3870
|
+
fill?: string | dia.SVGPatternJSON | dia.SVGGradientJSON;
|
|
3871
|
+
stroke?: string | dia.SVGPatternJSON | dia.SVGGradientJSON;
|
|
3872
|
+
sourceMarker?: dia.SVGMarkerJSON;
|
|
3873
|
+
targetMarker?: dia.SVGMarkerJSON;
|
|
3874
|
+
vertexMarker?: dia.SVGMarkerJSON;
|
|
3875
|
+
props?: SVGAttributeProps;
|
|
3876
|
+
text?: string;
|
|
3877
|
+
textWrap?: SVGAttributeTextWrap;
|
|
3878
|
+
lineHeight?: number | string;
|
|
3879
|
+
textPath?: any;
|
|
3880
|
+
annotations?: any;
|
|
3881
|
+
port?: string | { [key: string]: any };
|
|
3882
|
+
style?: { [key: string]: any };
|
|
3883
|
+
html?: string;
|
|
3884
|
+
ref?: string;
|
|
3885
|
+
refX?: string | number;
|
|
3886
|
+
refY?: string | number;
|
|
3887
|
+
refX2?: string | number;
|
|
3888
|
+
refY2?: string | number;
|
|
3889
|
+
refDx?: string | number;
|
|
3890
|
+
refDy?: string | number;
|
|
3891
|
+
refWidth?: string | number;
|
|
3892
|
+
refHeight?: string | number;
|
|
3893
|
+
refRx?: string | number;
|
|
3894
|
+
refRy?: string | number;
|
|
3895
|
+
refR?: string | number;
|
|
3896
|
+
refRInscribed?: string | number; // alias for refR
|
|
3897
|
+
refRCircumscribed?: string | number;
|
|
3898
|
+
refCx?: string | number;
|
|
3899
|
+
refCy?: string | number;
|
|
3900
|
+
refD?: string;
|
|
3901
|
+
refDResetOffset?: string; // alias for refD
|
|
3902
|
+
refDKeepOffset?: string;
|
|
3903
|
+
refPoints?: string;
|
|
3904
|
+
refPointsResetOffset?: string; // alias for refPoints
|
|
3905
|
+
refPointsKeepOffset?: string;
|
|
3906
|
+
resetOffset?: boolean;
|
|
3907
|
+
displayEmpty?: boolean;
|
|
3908
|
+
xAlignment?: 'middle' | 'right' | number | string;
|
|
3909
|
+
yAlignment?: 'middle' | 'bottom' | number | string;
|
|
3910
|
+
event?: string;
|
|
3911
|
+
magnet?: boolean | string;
|
|
3912
|
+
title?: string;
|
|
3913
|
+
textVerticalAnchor?: 'bottom' | 'top' | 'middle' | number | string;
|
|
3914
|
+
connection?: boolean | { stubs?: number };
|
|
3915
|
+
atConnectionLength?: number;
|
|
3916
|
+
atConnectionLengthKeepGradient?: number; // alias for atConnectionLength
|
|
3917
|
+
atConnectionLengthIgnoreGradient?: number;
|
|
3918
|
+
atConnectionRatio?: number;
|
|
3919
|
+
atConnectionRatioKeepGradient?: number; // alias for atConnectionRatio
|
|
3920
|
+
atConnectionRatioIgnoreGradient?: number;
|
|
3921
|
+
magnetSelector?: string;
|
|
3922
|
+
highlighterSelector?: string;
|
|
3923
|
+
containerSelector?: string;
|
|
3924
|
+
// CamelCase variants of native attributes
|
|
3925
|
+
alignmentBaseline?: any;
|
|
3926
|
+
baselineShift?: any;
|
|
3927
|
+
clipPath?: any;
|
|
3928
|
+
clipRule?: any;
|
|
3929
|
+
colorInterpolation?: any;
|
|
3930
|
+
colorInterpolationFilters?: any;
|
|
3931
|
+
colorProfile?: any;
|
|
3932
|
+
colorRendering?: any;
|
|
3933
|
+
dominantBaseline?: any;
|
|
3934
|
+
enableBackground?: any;
|
|
3935
|
+
fillOpacity?: any;
|
|
3936
|
+
fillRule?: any;
|
|
3937
|
+
floodColor?: any;
|
|
3938
|
+
floodOpacity?: any;
|
|
3939
|
+
fontFamily?: any;
|
|
3940
|
+
fontSize?: any;
|
|
3941
|
+
fontSizeAdjust?: any;
|
|
3942
|
+
fontStretch?: any;
|
|
3943
|
+
fontStyle?: any;
|
|
3944
|
+
fontVariant?: any;
|
|
3945
|
+
fontWeight?: any;
|
|
3946
|
+
glyphOrientationHorizontal?: any;
|
|
3947
|
+
glyphOrientationVertical?: any;
|
|
3948
|
+
imageRendering?: any;
|
|
3949
|
+
letterSpacing?: any;
|
|
3950
|
+
lightingColor?: any;
|
|
3951
|
+
markerEnd?: any;
|
|
3952
|
+
markerMid?: any;
|
|
3953
|
+
markerStart?: any;
|
|
3954
|
+
pointerEvents?: any;
|
|
3955
|
+
shapeRendering?: any;
|
|
3956
|
+
stopColor?: any;
|
|
3957
|
+
stopOpacity?: any;
|
|
3958
|
+
strokeDasharray?: any;
|
|
3959
|
+
strokeDashoffset?: any;
|
|
3960
|
+
strokeLinecap?: any;
|
|
3961
|
+
strokeLinejoin?: any;
|
|
3962
|
+
strokeMiterlimit?: any;
|
|
3963
|
+
strokeOpacity?: any;
|
|
3964
|
+
strokeWidth?: any;
|
|
3965
|
+
textAnchor?: any;
|
|
3966
|
+
textDecoration?: any;
|
|
3967
|
+
textRendering?: any;
|
|
3968
|
+
unicodeBidi?: any;
|
|
3969
|
+
wordSpacing?: any;
|
|
3970
|
+
writingMode?: any;
|
|
3971
|
+
xlinkHref?: string;
|
|
3972
|
+
xlinkShow?: string;
|
|
3973
|
+
xlinkType?: string;
|
|
3974
|
+
xlinkRole?: string;
|
|
3975
|
+
xlinkArcrole?: string;
|
|
3976
|
+
xlinkTitle?: string;
|
|
3977
|
+
xlinkActuate?: string;
|
|
3978
|
+
xmlSpace?: string;
|
|
3979
|
+
xmlBase?: string;
|
|
3980
|
+
xmlLang?: string;
|
|
3981
|
+
// Backwards compatibility
|
|
3982
|
+
'ref-x'?: string | number;
|
|
3983
|
+
'ref-y'?: string | number;
|
|
3984
|
+
'ref-dx'?: string | number;
|
|
3985
|
+
'ref-dy'?: string | number;
|
|
3986
|
+
'ref-width'?: string | number;
|
|
3987
|
+
'ref-height'?: string | number;
|
|
3988
|
+
'x-alignment'?: 'middle' | 'right' | number | string;
|
|
3989
|
+
'y-alignment'?: 'middle' | 'bottom' | number | string;
|
|
3990
|
+
}
|
|
3991
|
+
|
|
3992
|
+
interface SVGTextAttributes extends SVGAttributes {
|
|
3993
|
+
x?: string | number;
|
|
3994
|
+
y?: string | number;
|
|
3995
|
+
dx?: string | number;
|
|
3996
|
+
dy?: string | number;
|
|
3997
|
+
rotate?: string;
|
|
3998
|
+
textAnchor?: string;
|
|
3999
|
+
textLength?: number;
|
|
4000
|
+
lengthAdjust?: string;
|
|
4001
|
+
'text-anchor'?: string;
|
|
4002
|
+
'text-length'?: number;
|
|
4003
|
+
'length-adjust'?: string;
|
|
4004
|
+
}
|
|
4005
|
+
|
|
4006
|
+
interface SVGRectAttributes extends SVGAttributes {
|
|
4007
|
+
x?: string | number;
|
|
4008
|
+
y?: string | number;
|
|
4009
|
+
width?: string | number;
|
|
4010
|
+
height?: string | number;
|
|
4011
|
+
ry?: string | number;
|
|
4012
|
+
rx?: string | number;
|
|
4013
|
+
}
|
|
4014
|
+
|
|
4015
|
+
interface SVGCircleAttributes extends SVGAttributes {
|
|
4016
|
+
cx?: string | number;
|
|
4017
|
+
cy?: string | number;
|
|
4018
|
+
r?: string | number;
|
|
4019
|
+
}
|
|
4020
|
+
|
|
4021
|
+
interface SVGEllipseAttributes extends SVGAttributes {
|
|
4022
|
+
cx?: string | number;
|
|
4023
|
+
cy?: string | number;
|
|
4024
|
+
rx?: string | number;
|
|
4025
|
+
ry?: string | number;
|
|
4026
|
+
}
|
|
4027
|
+
|
|
4028
|
+
interface SVGPolygonAttributes extends SVGAttributes {
|
|
4029
|
+
points?: string;
|
|
4030
|
+
}
|
|
4031
|
+
|
|
4032
|
+
interface SVGPolylineAttributes extends SVGAttributes {
|
|
4033
|
+
points?: string;
|
|
4034
|
+
}
|
|
4035
|
+
|
|
4036
|
+
interface SVGImageAttributes extends SVGAttributes {
|
|
4037
|
+
x?: string | number;
|
|
4038
|
+
y?: string | number;
|
|
4039
|
+
width?: string | number;
|
|
4040
|
+
height?: string | number;
|
|
4041
|
+
preserveAspectRatio?: string;
|
|
4042
|
+
}
|
|
4043
|
+
|
|
4044
|
+
interface SVGPathAttributes extends SVGAttributes {
|
|
4045
|
+
d?: string;
|
|
4046
|
+
pathLength?: number;
|
|
4047
|
+
'path-length'?: number;
|
|
4048
|
+
}
|
|
4049
|
+
|
|
4050
|
+
interface SVGLineAttributes extends SVGAttributes {
|
|
4051
|
+
x1?: number | string;
|
|
4052
|
+
x2?: number | string;
|
|
4053
|
+
y1?: number | string;
|
|
4054
|
+
y2?: number | string;
|
|
4055
|
+
pathLength?: number;
|
|
4056
|
+
'path-length'?: number;
|
|
4057
|
+
}
|
|
4058
|
+
}
|
|
4059
|
+
|
|
4060
|
+
export function setTheme(theme: string): void;
|
|
4061
|
+
|
|
4062
|
+
export namespace elementTools {
|
|
4063
|
+
|
|
4064
|
+
namespace Button {
|
|
4065
|
+
|
|
4066
|
+
type ActionCallback = (evt: dia.Event, view: dia.ElementView, tool: dia.ToolView) => void;
|
|
4067
|
+
|
|
4068
|
+
interface Options extends dia.ToolView.Options {
|
|
4069
|
+
x?: number | string;
|
|
4070
|
+
y?: number | string;
|
|
4071
|
+
offset?: { x?: number, y?: number };
|
|
4072
|
+
rotate?: boolean;
|
|
4073
|
+
action?: ActionCallback;
|
|
4074
|
+
markup?: dia.MarkupJSON;
|
|
4075
|
+
useModelGeometry?: boolean;
|
|
4076
|
+
scale?: number;
|
|
4077
|
+
}
|
|
4078
|
+
}
|
|
4079
|
+
|
|
4080
|
+
class Button extends dia.ToolView {
|
|
4081
|
+
|
|
4082
|
+
constructor(opt?: Button.Options);
|
|
4083
|
+
|
|
4084
|
+
protected onPointerDown(evt: dia.Event): void;
|
|
4085
|
+
}
|
|
4086
|
+
|
|
4087
|
+
class Remove extends Button {
|
|
4088
|
+
|
|
4089
|
+
}
|
|
4090
|
+
|
|
4091
|
+
namespace Connect {
|
|
4092
|
+
|
|
4093
|
+
type MagnetCallback = ((this: Connect, view: dia.ElementView, tool: Connect) => SVGElement);
|
|
4094
|
+
|
|
4095
|
+
interface Options extends Button.Options {
|
|
4096
|
+
magnet?: string | SVGElement | MagnetCallback;
|
|
4097
|
+
}
|
|
4098
|
+
}
|
|
4099
|
+
|
|
4100
|
+
class Connect extends Button {
|
|
4101
|
+
|
|
4102
|
+
constructor(opt?: Connect.Options);
|
|
4103
|
+
|
|
4104
|
+
protected getMagnetNode(): SVGElement;
|
|
4105
|
+
|
|
4106
|
+
protected dragstart(evt: dia.Event): void;
|
|
4107
|
+
|
|
4108
|
+
protected drag(evt: dia.Event): void;
|
|
4109
|
+
|
|
4110
|
+
protected dragend(evt: dia.Event): void;
|
|
4111
|
+
}
|
|
4112
|
+
|
|
4113
|
+
namespace Boundary {
|
|
4114
|
+
interface Options extends dia.ToolView.Options {
|
|
4115
|
+
padding?: number | dia.Sides;
|
|
4116
|
+
useModelGeometry?: boolean;
|
|
4117
|
+
rotate?: boolean;
|
|
4118
|
+
}
|
|
4119
|
+
}
|
|
4120
|
+
|
|
4121
|
+
class Boundary extends dia.ToolView {
|
|
4122
|
+
|
|
4123
|
+
constructor(opt?: Boundary.Options);
|
|
4124
|
+
}
|
|
4125
|
+
|
|
4126
|
+
namespace Control {
|
|
4127
|
+
interface Options extends dia.ToolView.Options {
|
|
4128
|
+
selector?: string | null;
|
|
4129
|
+
padding?: number;
|
|
4130
|
+
handleAttributes?: Partial<attributes.NativeSVGAttributes>;
|
|
4131
|
+
scale?: number;
|
|
4132
|
+
}
|
|
4133
|
+
}
|
|
4134
|
+
|
|
4135
|
+
abstract class Control<T extends mvc.ViewOptions<undefined, SVGElement> = Control.Options> extends dia.ToolView {
|
|
4136
|
+
options: T;
|
|
4137
|
+
constructor(opt?: T);
|
|
4138
|
+
|
|
4139
|
+
protected getPosition(view: dia.ElementView): dia.Point;
|
|
4140
|
+
protected setPosition(view: dia.ElementView, coordinates: g.Point): void;
|
|
4141
|
+
protected resetPosition(view: dia.ElementView): void;
|
|
4142
|
+
|
|
4143
|
+
protected updateHandle(handleNode: SVGElement): void;
|
|
4144
|
+
protected updateExtras(extrasNode: SVGElement): void;
|
|
4145
|
+
protected toggleExtras(visible: boolean): void;
|
|
4146
|
+
|
|
4147
|
+
protected onPointerDown(evt: dia.Event): void;
|
|
4148
|
+
protected onPointerMove(evt: dia.Event): void;
|
|
4149
|
+
protected onPointerUp(evt: dia.Event): void;
|
|
4150
|
+
protected onPointerDblClick(evt: dia.Event): void;
|
|
4151
|
+
}
|
|
4152
|
+
|
|
4153
|
+
namespace HoverConnect {
|
|
4154
|
+
|
|
4155
|
+
type TrackPath = string;
|
|
4156
|
+
|
|
4157
|
+
type TrackPathCallback = (this: HoverConnect, view: dia.ElementView) => TrackPath;
|
|
4158
|
+
|
|
4159
|
+
interface Options extends Connect.Options {
|
|
4160
|
+
useModelGeometry?: boolean;
|
|
4161
|
+
trackWidth?: number;
|
|
4162
|
+
trackPath?: TrackPath | TrackPathCallback;
|
|
4163
|
+
}
|
|
4164
|
+
}
|
|
4165
|
+
|
|
4166
|
+
class HoverConnect extends linkTools.Connect {
|
|
4167
|
+
|
|
4168
|
+
constructor(opt?: HoverConnect.Options);
|
|
4169
|
+
}
|
|
4170
|
+
}
|
|
4171
|
+
|
|
4172
|
+
export namespace linkTools {
|
|
4173
|
+
|
|
4174
|
+
type AnchorCallback<T> = (
|
|
4175
|
+
coords: g.Point,
|
|
4176
|
+
view: dia.CellView,
|
|
4177
|
+
magnet: SVGElement,
|
|
4178
|
+
type: string,
|
|
4179
|
+
linkView: dia.LinkView,
|
|
4180
|
+
toolView: dia.ToolView
|
|
4181
|
+
) => T;
|
|
4182
|
+
|
|
4183
|
+
namespace Vertices {
|
|
4184
|
+
|
|
4185
|
+
class VertexHandle extends mvc.View<undefined, SVGElement> {
|
|
4186
|
+
position(x: number, y: number): void;
|
|
4187
|
+
protected onPointerDown(evt: dia.Event): void;
|
|
4188
|
+
protected onPointerMove(evt: dia.Event): void;
|
|
4189
|
+
protected onPointerUp(evt: dia.Event): void;
|
|
4190
|
+
protected onPointerClick(evt: dia.Event): void;
|
|
4191
|
+
}
|
|
4192
|
+
|
|
4193
|
+
interface Options extends dia.ToolView.Options {
|
|
4194
|
+
handleClass?: typeof VertexHandle;
|
|
4195
|
+
snapRadius?: number;
|
|
4196
|
+
redundancyRemoval?: boolean;
|
|
4197
|
+
vertexAdding?: boolean;
|
|
4198
|
+
vertexRemoving?: boolean;
|
|
4199
|
+
vertexMoving?: boolean;
|
|
4200
|
+
stopPropagation?: boolean;
|
|
4201
|
+
scale?: number;
|
|
4202
|
+
}
|
|
4203
|
+
}
|
|
4204
|
+
|
|
4205
|
+
class Vertices extends dia.ToolView {
|
|
4206
|
+
|
|
4207
|
+
constructor(opt?: Vertices.Options);
|
|
4208
|
+
}
|
|
4209
|
+
|
|
4210
|
+
namespace Segments {
|
|
4211
|
+
|
|
4212
|
+
class SegmentHandle extends mvc.View<undefined, SVGElement> {
|
|
4213
|
+
position(x: number, y: number, angle: number, view: dia.LinkView): void;
|
|
4214
|
+
show(): void;
|
|
4215
|
+
hide(): void;
|
|
4216
|
+
protected onPointerDown(evt: dia.Event): void;
|
|
4217
|
+
protected onPointerMove(evt: dia.Event): void;
|
|
4218
|
+
protected onPointerUp(evt: dia.Event): void;
|
|
4219
|
+
}
|
|
4220
|
+
|
|
4221
|
+
interface Options extends dia.ToolView.Options {
|
|
4222
|
+
handleClass?: typeof SegmentHandle;
|
|
4223
|
+
snapRadius?: number;
|
|
4224
|
+
snapHandle?: boolean;
|
|
4225
|
+
redundancyRemoval?: boolean;
|
|
4226
|
+
segmentLengthThreshold?: number;
|
|
4227
|
+
anchor?: AnchorCallback<anchors.AnchorJSON>;
|
|
4228
|
+
stopPropagation?: boolean;
|
|
4229
|
+
scale?: number;
|
|
4230
|
+
}
|
|
4231
|
+
}
|
|
4232
|
+
|
|
4233
|
+
class Segments extends dia.ToolView {
|
|
4234
|
+
|
|
4235
|
+
constructor(opt?: Segments.Options);
|
|
4236
|
+
}
|
|
4237
|
+
|
|
4238
|
+
namespace Arrowhead {
|
|
4239
|
+
|
|
4240
|
+
interface Options extends dia.ToolView.Options {
|
|
4241
|
+
scale?: number;
|
|
4242
|
+
}
|
|
4243
|
+
}
|
|
4244
|
+
|
|
4245
|
+
abstract class Arrowhead extends dia.ToolView {
|
|
4246
|
+
|
|
4247
|
+
ratio: number;
|
|
4248
|
+
arrowheadType: string;
|
|
4249
|
+
|
|
4250
|
+
constructor(opt?: Arrowhead.Options);
|
|
4251
|
+
|
|
4252
|
+
protected onPointerDown(evt: dia.Event): void;
|
|
4253
|
+
|
|
4254
|
+
protected onPointerMove(evt: dia.Event): void;
|
|
4255
|
+
|
|
4256
|
+
protected onPointerUp(evt: dia.Event): void;
|
|
4257
|
+
}
|
|
4258
|
+
|
|
4259
|
+
class SourceArrowhead extends Arrowhead {
|
|
4260
|
+
|
|
4261
|
+
|
|
4262
|
+
}
|
|
4263
|
+
|
|
4264
|
+
class TargetArrowhead extends Arrowhead {
|
|
4265
|
+
|
|
4266
|
+
|
|
4267
|
+
}
|
|
4268
|
+
|
|
4269
|
+
namespace Anchor {
|
|
4270
|
+
interface Options extends dia.ToolView.Options {
|
|
4271
|
+
snap?: AnchorCallback<dia.Point>;
|
|
4272
|
+
anchor?: AnchorCallback<anchors.AnchorJSON>;
|
|
4273
|
+
resetAnchor?: boolean | anchors.AnchorJSON;
|
|
4274
|
+
customAnchorAttributes?: attributes.NativeSVGAttributes;
|
|
4275
|
+
defaultAnchorAttributes?: attributes.NativeSVGAttributes;
|
|
4276
|
+
areaPadding?: number;
|
|
4277
|
+
snapRadius?: number;
|
|
4278
|
+
restrictArea?: boolean;
|
|
4279
|
+
redundancyRemoval?: boolean;
|
|
4280
|
+
scale?: number;
|
|
4281
|
+
}
|
|
4282
|
+
}
|
|
4283
|
+
|
|
4284
|
+
abstract class Anchor extends dia.ToolView {
|
|
4285
|
+
|
|
4286
|
+
type: string;
|
|
4287
|
+
|
|
4288
|
+
constructor(opt?: Anchor.Options);
|
|
4289
|
+
}
|
|
4290
|
+
|
|
4291
|
+
class SourceAnchor extends Anchor {
|
|
4292
|
+
|
|
4293
|
+
|
|
4294
|
+
}
|
|
4295
|
+
|
|
4296
|
+
class TargetAnchor extends Anchor {
|
|
4297
|
+
|
|
4298
|
+
|
|
4299
|
+
}
|
|
4300
|
+
|
|
4301
|
+
namespace Button {
|
|
4302
|
+
|
|
4303
|
+
type ActionCallback = (evt: dia.Event, view: dia.LinkView, tool: dia.ToolView) => void;
|
|
4304
|
+
|
|
4305
|
+
interface Options extends dia.ToolView.Options {
|
|
4306
|
+
distance?: number | string;
|
|
4307
|
+
offset?: number;
|
|
4308
|
+
rotate?: boolean;
|
|
4309
|
+
action?: ActionCallback;
|
|
4310
|
+
markup?: dia.MarkupJSON;
|
|
4311
|
+
scale?: number;
|
|
4312
|
+
}
|
|
4313
|
+
}
|
|
4314
|
+
|
|
4315
|
+
class Button extends dia.ToolView {
|
|
4316
|
+
|
|
4317
|
+
constructor(opt?: Button.Options);
|
|
4318
|
+
|
|
4319
|
+
protected onPointerDown(evt: dia.Event): void;
|
|
4320
|
+
}
|
|
4321
|
+
|
|
4322
|
+
class Remove extends Button {
|
|
4323
|
+
|
|
4324
|
+
}
|
|
4325
|
+
|
|
4326
|
+
namespace Connect {
|
|
4327
|
+
|
|
4328
|
+
type MagnetCallback = ((this: Connect, view: dia.LinkView, tool: Connect) => SVGElement);
|
|
4329
|
+
|
|
4330
|
+
interface Options extends Button.Options {
|
|
4331
|
+
magnet?: string | SVGElement | MagnetCallback;
|
|
4332
|
+
}
|
|
4333
|
+
}
|
|
4334
|
+
|
|
4335
|
+
class Connect extends Button {
|
|
4336
|
+
|
|
4337
|
+
constructor(opt?: Connect.Options);
|
|
4338
|
+
|
|
4339
|
+
protected getMagnetNode(): SVGElement;
|
|
4340
|
+
|
|
4341
|
+
protected dragstart(evt: dia.Event): void;
|
|
4342
|
+
|
|
4343
|
+
protected drag(evt: dia.Event): void;
|
|
4344
|
+
|
|
4345
|
+
protected dragend(evt: dia.Event): void;
|
|
4346
|
+
}
|
|
4347
|
+
|
|
4348
|
+
namespace Boundary {
|
|
4349
|
+
interface Options extends dia.ToolView.Options {
|
|
4350
|
+
padding?: number | dia.Sides;
|
|
4351
|
+
useModelGeometry?: boolean;
|
|
4352
|
+
}
|
|
4353
|
+
}
|
|
4354
|
+
|
|
4355
|
+
class Boundary extends dia.ToolView {
|
|
4356
|
+
|
|
4357
|
+
constructor(opt?: Boundary.Options);
|
|
4358
|
+
}
|
|
4359
|
+
|
|
4360
|
+
namespace HoverConnect {
|
|
4361
|
+
interface Options extends Connect.Options {
|
|
4362
|
+
}
|
|
4363
|
+
}
|
|
4364
|
+
|
|
4365
|
+
class HoverConnect extends Connect {
|
|
4366
|
+
|
|
4367
|
+
constructor(opt?: HoverConnect.Options);
|
|
4368
|
+
|
|
4369
|
+
trackPath: g.Path;
|
|
4370
|
+
|
|
4371
|
+
protected getButtonMatrix(): SVGMatrix;
|
|
4372
|
+
|
|
4373
|
+
protected getTrackPath(): g.Path;
|
|
4374
|
+
|
|
4375
|
+
protected getTrackMatrix(): SVGMatrix;
|
|
4376
|
+
|
|
4377
|
+
protected getTrackRatioFromEvent(evt: dia.Event): number;
|
|
4378
|
+
|
|
4379
|
+
protected canShowButton(): boolean;
|
|
4380
|
+
|
|
4381
|
+
protected showButton(): void;
|
|
4382
|
+
|
|
4383
|
+
protected hideButton(): void;
|
|
4384
|
+
|
|
4385
|
+
protected onMousemove(evt: dia.Event): void;
|
|
4386
|
+
|
|
4387
|
+
protected onMouseenter(evt: dia.Event): void;
|
|
4388
|
+
|
|
4389
|
+
protected onMouseleave(evt: dia.Event): void;
|
|
4390
|
+
}
|
|
4391
|
+
}
|