@joint/core 4.0.4 → 4.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -8
- package/dist/geometry.js +4962 -6132
- package/dist/geometry.min.js +2 -2
- package/dist/joint.d.ts +326 -50
- package/dist/joint.js +34067 -37565
- package/dist/joint.min.js +2 -2
- package/dist/joint.nowrap.js +34067 -37565
- package/dist/joint.nowrap.min.js +2 -2
- package/dist/vectorizer.js +7288 -8907
- package/dist/vectorizer.min.js +2 -2
- package/dist/version.mjs +1 -1
- package/package.json +10 -15
- package/src/{linkTools → cellTools}/Button.mjs +8 -6
- package/src/{elementTools → cellTools}/Control.mjs +3 -3
- package/src/{linkTools → cellTools}/HoverConnect.mjs +1 -1
- package/src/dia/Cell.mjs +60 -33
- package/src/dia/CellView.mjs +75 -8
- package/src/dia/ElementView.mjs +13 -8
- package/src/dia/Graph.mjs +148 -40
- package/src/dia/HighlighterView.mjs +8 -4
- package/src/dia/LinkView.mjs +42 -3
- package/src/dia/Paper.mjs +84 -0
- package/src/dia/ToolView.mjs +29 -4
- package/src/dia/ToolsView.mjs +25 -10
- package/src/dia/attributes/connection.mjs +5 -0
- package/src/dia/attributes/defs.mjs +3 -0
- package/src/dia/attributes/eval.mjs +3 -3
- package/src/dia/attributes/index.mjs +3 -0
- package/src/dia/attributes/shape.mjs +4 -0
- package/src/dia/attributes/text.mjs +15 -5
- package/src/dia/ports.mjs +4 -0
- package/src/elementTools/HoverConnect.mjs +5 -5
- package/src/elementTools/index.mjs +5 -4
- package/src/g/rect.mjs +13 -5
- package/src/layout/ports/port.mjs +4 -5
- package/src/linkTools/Anchor.mjs +1 -1
- package/src/linkTools/Arrowhead.mjs +2 -1
- package/src/linkTools/RotateLabel.mjs +110 -0
- package/src/linkTools/Segments.mjs +1 -1
- package/src/linkTools/Vertices.mjs +41 -4
- package/src/linkTools/index.mjs +7 -4
- package/src/mvc/View.mjs +0 -1
- package/src/mvc/ViewBase.mjs +2 -1
- package/src/routers/rightAngle.mjs +538 -140
- package/src/shapes/standard.mjs +8 -1
- package/src/{dia/attributes → util}/calc.mjs +24 -12
- package/src/util/index.mjs +1 -0
- package/src/util/util.mjs +39 -0
- package/src/util/utilHelpers.mjs +2 -1
- package/types/geometry.d.ts +6 -1
- package/types/joint.d.ts +319 -48
- /package/src/{linkTools → cellTools}/Boundary.mjs +0 -0
- /package/src/{linkTools → cellTools}/Connect.mjs +0 -0
- /package/src/{linkTools → cellTools}/helpers.mjs +0 -0
package/types/joint.d.ts
CHANGED
|
@@ -65,10 +65,11 @@ export namespace dia {
|
|
|
65
65
|
type OrthogonalDirection =
|
|
66
66
|
'left' | 'top' | 'right' | 'bottom';
|
|
67
67
|
|
|
68
|
-
type
|
|
69
|
-
OrthogonalDirection |
|
|
68
|
+
type DiagonalDirection =
|
|
70
69
|
'top-left' | 'top-right' | 'bottom-right' | 'bottom-left';
|
|
71
70
|
|
|
71
|
+
type Direction = OrthogonalDirection | DiagonalDirection;
|
|
72
|
+
|
|
72
73
|
type LinkEnd =
|
|
73
74
|
'source' | 'target';
|
|
74
75
|
|
|
@@ -162,6 +163,20 @@ export namespace dia {
|
|
|
162
163
|
breadthFirst?: boolean;
|
|
163
164
|
}
|
|
164
165
|
|
|
166
|
+
interface FindAtPointOptions extends Options {
|
|
167
|
+
strict?: boolean;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
interface FindInAreaOptions extends Options {
|
|
171
|
+
strict?: boolean;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
type SearchByKey = 'bbox' | PositionName;
|
|
175
|
+
|
|
176
|
+
interface FindUnderElementOptions extends FindInAreaOptions, FindAtPointOptions {
|
|
177
|
+
searchBy?: SearchByKey;
|
|
178
|
+
}
|
|
179
|
+
|
|
165
180
|
class Cells extends mvc.Collection<Cell> {
|
|
166
181
|
graph: Graph;
|
|
167
182
|
cellNamespace: any;
|
|
@@ -238,17 +253,48 @@ export namespace dia {
|
|
|
238
253
|
|
|
239
254
|
getCommonAncestor(...cells: Cell[]): Element | undefined;
|
|
240
255
|
|
|
241
|
-
toJSON(): any;
|
|
256
|
+
toJSON(opt?: { cellAttributes?: dia.Cell.ExportOptions }): any;
|
|
242
257
|
|
|
243
258
|
fromJSON(json: any, opt?: S): this;
|
|
244
259
|
|
|
245
260
|
clear(opt?: { [key: string]: any }): this;
|
|
246
261
|
|
|
262
|
+
findElementsAtPoint(p: Point, opt?: Graph.FindAtPointOptions): Element[];
|
|
263
|
+
|
|
264
|
+
findElementsInArea(rect: BBox, opt?: Graph.FindInAreaOptions): Element[];
|
|
265
|
+
|
|
266
|
+
findElementsUnderElement(element: Element, opt?: Graph.FindUnderElementOptions): Element[];
|
|
267
|
+
|
|
268
|
+
findLinksAtPoint(p: Point, opt?: Graph.FindAtPointOptions): Link[];
|
|
269
|
+
|
|
270
|
+
findLinksInArea(rect: BBox, opt?: Graph.FindInAreaOptions): Link[];
|
|
271
|
+
|
|
272
|
+
findLinksUnderElement(element: Element, opt?: Graph.FindUnderElementOptions): Link[];
|
|
273
|
+
|
|
274
|
+
findCellsAtPoint(p: Point, opt?: Graph.FindAtPointOptions): Cell[];
|
|
275
|
+
|
|
276
|
+
findCellsInArea(rect: BBox, opt?: Graph.FindInAreaOptions): Cell[];
|
|
277
|
+
|
|
278
|
+
findCellsUnderElement(element: Element, opt?: Graph.FindUnderElementOptions): Cell[];
|
|
279
|
+
|
|
280
|
+
protected _getFindUnderElementGeometry(element: Element, searchBy: Graph.SearchByKey): g.Point | g.Rect;
|
|
281
|
+
|
|
282
|
+
protected _validateCellsUnderElement<T extends Cell[]>(cells: T, element: Element): T;
|
|
283
|
+
|
|
284
|
+
protected _isValidElementUnderElement(el1: Element, el2: Element): boolean;
|
|
285
|
+
|
|
286
|
+
protected _isValidLinkUnderElement(link: Link, element: Element): boolean;
|
|
287
|
+
|
|
288
|
+
protected _filterCellsUnderElement(cells: Cell[], element: Element, opt: Graph.FindUnderElementOptions): Cell[];
|
|
289
|
+
|
|
290
|
+
/** @deprecated use `findElementsAtPoint` instead */
|
|
247
291
|
findModelsFromPoint(p: Point): Element[];
|
|
248
292
|
|
|
249
|
-
|
|
293
|
+
/** @deprecated use `findElementsInArea` instead */
|
|
294
|
+
findModelsInArea(rect: BBox, opt?: Graph.FindInAreaOptions): Element[];
|
|
250
295
|
|
|
251
|
-
|
|
296
|
+
/** @deprecated use `findElementsUnderElement` instead */
|
|
297
|
+
findModelsUnderElement(element: Element, opt?: Graph.FindUnderElementOptions): Element[];
|
|
252
298
|
|
|
253
299
|
getBBox(): g.Rect | null;
|
|
254
300
|
|
|
@@ -262,6 +308,10 @@ export namespace dia {
|
|
|
262
308
|
|
|
263
309
|
removeCells(cells: Cell[], opt?: Cell.DisconnectableOptions): this;
|
|
264
310
|
|
|
311
|
+
transferCellEmbeds(sourceCell: Cell, targetCell: Cell, opt?: S): void;
|
|
312
|
+
|
|
313
|
+
transferCellConnectedLinks(sourceCell: Cell, targetCell: Cell, opt?: Graph.ConnectionOptions): void;
|
|
314
|
+
|
|
265
315
|
resize(width: number, height: number, opt?: S): this;
|
|
266
316
|
|
|
267
317
|
resizeCells(width: number, height: number, cells: Cell[], opt?: S): this;
|
|
@@ -306,6 +356,10 @@ export namespace dia {
|
|
|
306
356
|
[key: string]: any;
|
|
307
357
|
}
|
|
308
358
|
|
|
359
|
+
interface EmbedOptions extends Options {
|
|
360
|
+
reparent?: boolean;
|
|
361
|
+
}
|
|
362
|
+
|
|
309
363
|
interface EmbeddableOptions<T = boolean> extends Options {
|
|
310
364
|
deep?: T;
|
|
311
365
|
}
|
|
@@ -333,6 +387,52 @@ export namespace dia {
|
|
|
333
387
|
interface ConstructorOptions extends Graph.Options {
|
|
334
388
|
mergeArrays?: boolean;
|
|
335
389
|
}
|
|
390
|
+
|
|
391
|
+
interface ExportOptions {
|
|
392
|
+
ignoreDefault?: boolean | string[];
|
|
393
|
+
ignoreEmptyAttributes?: boolean;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
type UnsetCallback<V> = (
|
|
397
|
+
this: V,
|
|
398
|
+
node: Element,
|
|
399
|
+
nodeAttributes: { [name: string]: any },
|
|
400
|
+
cellView: V
|
|
401
|
+
) => string | Array<string> | null | void;
|
|
402
|
+
|
|
403
|
+
type SetCallback<V> = (
|
|
404
|
+
this: V,
|
|
405
|
+
attributeValue: any,
|
|
406
|
+
refBBox: g.Rect,
|
|
407
|
+
node: Element,
|
|
408
|
+
nodeAttributes: { [name: string]: any },
|
|
409
|
+
cellView: V
|
|
410
|
+
) => { [key: string]: any } | string | number | void;
|
|
411
|
+
|
|
412
|
+
type PositionCallback<V> = (
|
|
413
|
+
this: V,
|
|
414
|
+
attributeValue: any,
|
|
415
|
+
refBBox: g.Rect,
|
|
416
|
+
node: Element,
|
|
417
|
+
nodeAttributes: { [name: string]: any },
|
|
418
|
+
cellView: V
|
|
419
|
+
) => dia.Point | null | void;
|
|
420
|
+
|
|
421
|
+
type OffsetCallback<V> = (
|
|
422
|
+
this: V,
|
|
423
|
+
attributeValue: any,
|
|
424
|
+
nodeBBox: g.Rect,
|
|
425
|
+
node: Element,
|
|
426
|
+
nodeAttributes: { [name: string]: any },
|
|
427
|
+
cellView: V
|
|
428
|
+
) => dia.Point | null | void;
|
|
429
|
+
|
|
430
|
+
interface PresentationAttributeDefinition<V = dia.CellView> {
|
|
431
|
+
set?: SetCallback<V> | string;
|
|
432
|
+
unset?: UnsetCallback<V> | string | Array<string>;
|
|
433
|
+
position?: PositionCallback<V>;
|
|
434
|
+
offset?: OffsetCallback<V>;
|
|
435
|
+
}
|
|
336
436
|
}
|
|
337
437
|
|
|
338
438
|
class Cell<A extends ObjectHash = Cell.Attributes, S extends mvc.ModelSetOptions = dia.ModelSetOptions> extends mvc.Model<A, S> {
|
|
@@ -350,7 +450,7 @@ export namespace dia {
|
|
|
350
450
|
|
|
351
451
|
protected stopScheduledTransitions(path?: string, delim?: string): void;
|
|
352
452
|
|
|
353
|
-
toJSON(): Cell.JSON<any, A>;
|
|
453
|
+
toJSON(opt?: dia.Cell.ExportOptions): Cell.JSON<any, A>;
|
|
354
454
|
|
|
355
455
|
remove(opt?: Cell.DisconnectableOptions): this;
|
|
356
456
|
|
|
@@ -392,7 +492,7 @@ export namespace dia {
|
|
|
392
492
|
|
|
393
493
|
stopTransitions(path?: string, delim?: string): this;
|
|
394
494
|
|
|
395
|
-
embed(cell: Cell | Cell[], opt?:
|
|
495
|
+
embed(cell: Cell | Cell[], opt?: Cell.EmbedOptions): this;
|
|
396
496
|
|
|
397
497
|
unembed(cell: Cell | Cell[], opt?: Graph.Options): this;
|
|
398
498
|
|
|
@@ -503,6 +603,10 @@ export namespace dia {
|
|
|
503
603
|
deep?: boolean;
|
|
504
604
|
}
|
|
505
605
|
|
|
606
|
+
interface ResizeOptions extends Cell.Options {
|
|
607
|
+
direction?: Direction;
|
|
608
|
+
}
|
|
609
|
+
|
|
506
610
|
interface BBoxOptions extends Cell.EmbeddableOptions {
|
|
507
611
|
rotate?: boolean;
|
|
508
612
|
}
|
|
@@ -516,9 +620,10 @@ export namespace dia {
|
|
|
516
620
|
position(x: number, y: number, opt?: Element.PositionOptions): this;
|
|
517
621
|
|
|
518
622
|
size(): Size;
|
|
519
|
-
size(
|
|
623
|
+
size(size: Partial<Size>, opt?: Element.ResizeOptions): this;
|
|
624
|
+
size(width: number, height: number, opt?: Element.ResizeOptions): this;
|
|
520
625
|
|
|
521
|
-
resize(width: number, height: number, opt?:
|
|
626
|
+
resize(width: number, height: number, opt?: Element.ResizeOptions): this;
|
|
522
627
|
|
|
523
628
|
rotate(deg: number, absolute?: boolean, origin?: Point, opt?: { [key: string]: any }): this;
|
|
524
629
|
|
|
@@ -558,6 +663,8 @@ export namespace dia {
|
|
|
558
663
|
|
|
559
664
|
getPortIndex(port: string | Element.Port): number;
|
|
560
665
|
|
|
666
|
+
getPortGroupNames(): string[];
|
|
667
|
+
|
|
561
668
|
portProp(portId: string, path: dia.Path): any;
|
|
562
669
|
|
|
563
670
|
portProp(portId: string, path: dia.Path, value?: any, opt?: S): Element;
|
|
@@ -565,6 +672,8 @@ export namespace dia {
|
|
|
565
672
|
protected generatePortId(): string | number;
|
|
566
673
|
|
|
567
674
|
static define(type: string, defaults?: any, protoProps?: any, staticProps?: any): Cell.Constructor<Element>;
|
|
675
|
+
|
|
676
|
+
static attributes: { [attributeName: string]: Cell.PresentationAttributeDefinition<ElementView> };
|
|
568
677
|
}
|
|
569
678
|
|
|
570
679
|
// dia.Link
|
|
@@ -713,6 +822,8 @@ export namespace dia {
|
|
|
713
822
|
translate(tx: number, ty: number, opt?: S): this;
|
|
714
823
|
|
|
715
824
|
static define(type: string, defaults?: any, protoProps?: any, staticProps?: any): Cell.Constructor<Link>;
|
|
825
|
+
|
|
826
|
+
static attributes: { [attributeName: string]: Cell.PresentationAttributeDefinition<LinkView> };
|
|
716
827
|
}
|
|
717
828
|
|
|
718
829
|
// dia.CellView
|
|
@@ -830,6 +941,14 @@ export namespace dia {
|
|
|
830
941
|
|
|
831
942
|
isDefaultInteractionPrevented(evt: dia.Event): boolean;
|
|
832
943
|
|
|
944
|
+
isIntersecting(geometryShape: g.Shape, geometryData?: g.SegmentSubdivisionsOpt | null): boolean;
|
|
945
|
+
|
|
946
|
+
protected isEnclosedIn(area: g.Rect): boolean;
|
|
947
|
+
|
|
948
|
+
protected isInArea(area: g.Rect, options: g.StrictOpt): boolean;
|
|
949
|
+
|
|
950
|
+
protected isAtPoint(point: g.Point, options: g.StrictOpt): boolean;
|
|
951
|
+
|
|
833
952
|
protected findBySelector(selector: string, root?: SVGElement): SVGElement[];
|
|
834
953
|
|
|
835
954
|
protected removeHighlighters(): void;
|
|
@@ -931,6 +1050,8 @@ export namespace dia {
|
|
|
931
1050
|
|
|
932
1051
|
getDelegatedView(): ElementView | null;
|
|
933
1052
|
|
|
1053
|
+
getTargetParentView(evt: dia.Event): CellView | null;
|
|
1054
|
+
|
|
934
1055
|
findPortNode(portId: string | number): SVGElement | null;
|
|
935
1056
|
findPortNode(portId: string | number, selector: string): E | null;
|
|
936
1057
|
|
|
@@ -1019,6 +1140,11 @@ export namespace dia {
|
|
|
1019
1140
|
options: LinkView.Options<L>;
|
|
1020
1141
|
sourceAnchor: g.Point;
|
|
1021
1142
|
targetAnchor: g.Point;
|
|
1143
|
+
sourcePoint: g.Point;
|
|
1144
|
+
targetPoint: g.Point;
|
|
1145
|
+
sourceBBox: g.Rect;
|
|
1146
|
+
targetBBox: g.Rect;
|
|
1147
|
+
route: g.Point[];
|
|
1022
1148
|
|
|
1023
1149
|
sendToken(token: SVGElement, duration?: number, callback?: () => void): void;
|
|
1024
1150
|
sendToken(token: SVGElement, opt?: { duration?: number, direction?: string, connection?: string }, callback?: () => void): void;
|
|
@@ -1225,6 +1351,11 @@ export namespace dia {
|
|
|
1225
1351
|
afterRender?: AfterRenderCallback;
|
|
1226
1352
|
}
|
|
1227
1353
|
|
|
1354
|
+
interface SnapLinksOptions {
|
|
1355
|
+
radius?: number;
|
|
1356
|
+
findInAreaOptions?: FindInAreaOptions;
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1228
1359
|
type PointConstraintCallback = (x: number, y: number, opt: any) => Point;
|
|
1229
1360
|
type RestrictTranslateCallback = (elementView: ElementView, x0: number, y0: number) => BBox | boolean | PointConstraintCallback;
|
|
1230
1361
|
type FindParentByType = 'bbox' | 'pointer' | PositionName;
|
|
@@ -1243,7 +1374,7 @@ export namespace dia {
|
|
|
1243
1374
|
highlighting?: boolean | Record<string | dia.CellView.Highlighting, highlighters.HighlighterJSON | boolean>;
|
|
1244
1375
|
interactive?: ((cellView: CellView, event: string) => boolean | CellView.InteractivityOptions) | boolean | CellView.InteractivityOptions;
|
|
1245
1376
|
snapLabels?: boolean;
|
|
1246
|
-
snapLinks?: boolean |
|
|
1377
|
+
snapLinks?: boolean | SnapLinksOptions;
|
|
1247
1378
|
snapLinksSelf?: boolean | { distance: number };
|
|
1248
1379
|
markAvailable?: boolean;
|
|
1249
1380
|
// validations
|
|
@@ -1417,6 +1548,20 @@ export namespace dia {
|
|
|
1417
1548
|
// custom
|
|
1418
1549
|
[eventName: string]: mvc.EventHandler;
|
|
1419
1550
|
}
|
|
1551
|
+
|
|
1552
|
+
interface BufferOptions {
|
|
1553
|
+
/**
|
|
1554
|
+
* A buffer around the area to extend the search to
|
|
1555
|
+
* to mitigate the differences between the model and view geometry.
|
|
1556
|
+
*/
|
|
1557
|
+
buffer?: number;
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
interface FindAtPointOptions extends Graph.FindAtPointOptions, BufferOptions {
|
|
1561
|
+
}
|
|
1562
|
+
|
|
1563
|
+
interface FindInAreaOptions extends Graph.FindInAreaOptions, BufferOptions {
|
|
1564
|
+
}
|
|
1420
1565
|
}
|
|
1421
1566
|
|
|
1422
1567
|
class Paper extends mvc.View<Graph> {
|
|
@@ -1510,19 +1655,52 @@ export namespace dia {
|
|
|
1510
1655
|
|
|
1511
1656
|
findViewByModel<T extends ElementView | LinkView>(model: Cell | Cell.ID): T;
|
|
1512
1657
|
|
|
1513
|
-
|
|
1658
|
+
/**
|
|
1659
|
+
* Finds all the element views at the specified point
|
|
1660
|
+
* @param point a point in local paper coordinates
|
|
1661
|
+
* @param opt options for the search
|
|
1662
|
+
*/
|
|
1663
|
+
findElementViewsAtPoint(point: Point, opt?: Paper.FindAtPointOptions): ElementView[];
|
|
1514
1664
|
|
|
1515
|
-
|
|
1665
|
+
/**
|
|
1666
|
+
* Finds all the link views at the specified point
|
|
1667
|
+
* @param point a point in local paper coordinates
|
|
1668
|
+
* @param opt options for the search
|
|
1669
|
+
*/
|
|
1670
|
+
findLinkViewsAtPoint(point: Point, opt?: Paper.FindAtPointOptions): LinkView[];
|
|
1516
1671
|
|
|
1517
|
-
|
|
1518
|
-
|
|
1672
|
+
/**
|
|
1673
|
+
* Finds all the cell views at the specified point
|
|
1674
|
+
* @param point a point in local paper coordinates
|
|
1675
|
+
* @param opt options for the search
|
|
1676
|
+
*/
|
|
1677
|
+
findCellViewsAtPoint(point: Point, opt?: Paper.FindAtPointOptions): CellView[];
|
|
1519
1678
|
|
|
1520
|
-
|
|
1679
|
+
/**
|
|
1680
|
+
* Finds all the element views in the specified area
|
|
1681
|
+
* @param area a rectangle in local paper coordinates
|
|
1682
|
+
* @param opt options for the search
|
|
1683
|
+
*/
|
|
1684
|
+
findElementViewsInArea(area: BBox, opt?: Paper.FindInAreaOptions): ElementView[];
|
|
1521
1685
|
|
|
1522
1686
|
/**
|
|
1523
|
-
*
|
|
1687
|
+
* Finds all the link views in the specified area
|
|
1688
|
+
* @param area a rectangle in local paper coordinates
|
|
1689
|
+
* @param opt options for the search
|
|
1524
1690
|
*/
|
|
1525
|
-
|
|
1691
|
+
findLinkViewsInArea(area: BBox, opt?: Paper.FindInAreaOptions): LinkView[];
|
|
1692
|
+
|
|
1693
|
+
/**
|
|
1694
|
+
* Finds all the cell views in the specified area
|
|
1695
|
+
* @param area a rectangle in local paper coordinates
|
|
1696
|
+
* @param opt options for the search
|
|
1697
|
+
*/
|
|
1698
|
+
findCellViewsInArea(area: BBox, opt?: Paper.FindInAreaOptions): CellView[];
|
|
1699
|
+
|
|
1700
|
+
fitToContent(opt?: Paper.FitToContentOptions): g.Rect;
|
|
1701
|
+
fitToContent(gridWidth?: number, gridHeight?: number, padding?: number, opt?: any): g.Rect;
|
|
1702
|
+
|
|
1703
|
+
getFitToContentArea(opt?: Paper.FitToContentOptions): g.Rect;
|
|
1526
1704
|
|
|
1527
1705
|
transformToFitContent(opt?: Paper.TransformToFitContentOptions): void;
|
|
1528
1706
|
|
|
@@ -1595,7 +1773,6 @@ export namespace dia {
|
|
|
1595
1773
|
mountBatchSize?: number;
|
|
1596
1774
|
unmountBatchSize?: number;
|
|
1597
1775
|
viewport?: Paper.ViewportCallback;
|
|
1598
|
-
progress?: Paper.ProgressCallback;
|
|
1599
1776
|
}): void;
|
|
1600
1777
|
|
|
1601
1778
|
checkViewport(opt?: {
|
|
@@ -1610,10 +1787,10 @@ export namespace dia {
|
|
|
1610
1787
|
updateViews(opt?: {
|
|
1611
1788
|
batchSize?: number;
|
|
1612
1789
|
viewport?: Paper.ViewportCallback;
|
|
1613
|
-
progress?: Paper.ProgressCallback;
|
|
1614
1790
|
}): {
|
|
1615
1791
|
updated: number;
|
|
1616
1792
|
batches: number;
|
|
1793
|
+
priority: number;
|
|
1617
1794
|
};
|
|
1618
1795
|
|
|
1619
1796
|
hasScheduledUpdates(): boolean;
|
|
@@ -1753,6 +1930,21 @@ export namespace dia {
|
|
|
1753
1930
|
protected customEventTrigger(event: dia.Event, view: CellView, rootNode?: SVGElement): dia.Event | null;
|
|
1754
1931
|
|
|
1755
1932
|
protected addStylesheet(stylesheet: string): void;
|
|
1933
|
+
|
|
1934
|
+
/**
|
|
1935
|
+
* @deprecated use `findElementViewsAtPoint()
|
|
1936
|
+
*/
|
|
1937
|
+
findViewsFromPoint(point: string | Point): ElementView[];
|
|
1938
|
+
|
|
1939
|
+
/**
|
|
1940
|
+
* @deprecated use `findElementViewsInArea()
|
|
1941
|
+
*/
|
|
1942
|
+
findViewsInArea(rect: BBox, opt?: { strict?: boolean }): ElementView[];
|
|
1943
|
+
|
|
1944
|
+
/**
|
|
1945
|
+
* @deprecated use transformToFitContent
|
|
1946
|
+
*/
|
|
1947
|
+
scaleContentToFit(opt?: Paper.ScaleContentOptions): void;
|
|
1756
1948
|
}
|
|
1757
1949
|
|
|
1758
1950
|
namespace PaperLayer {
|
|
@@ -1814,21 +2006,25 @@ export namespace dia {
|
|
|
1814
2006
|
}
|
|
1815
2007
|
|
|
1816
2008
|
namespace ToolView {
|
|
1817
|
-
|
|
2009
|
+
|
|
2010
|
+
type VisibilityCallback<V = dia.CellView> = (this: ToolView, view: V, tool: ToolView) => boolean;
|
|
2011
|
+
|
|
2012
|
+
interface Options<V = dia.CellView> extends mvc.ViewOptions<undefined, SVGElement> {
|
|
1818
2013
|
focusOpacity?: number;
|
|
2014
|
+
visibility?: VisibilityCallback<V>;
|
|
1819
2015
|
}
|
|
1820
2016
|
}
|
|
1821
2017
|
|
|
1822
|
-
class ToolView extends mvc.View<undefined, SVGElement> {
|
|
2018
|
+
class ToolView<V = dia.CellView> extends mvc.View<undefined, SVGElement> {
|
|
1823
2019
|
|
|
1824
2020
|
name: string | null;
|
|
1825
2021
|
parentView: ToolsView;
|
|
1826
2022
|
relatedView: dia.CellView;
|
|
1827
2023
|
paper: Paper;
|
|
1828
2024
|
|
|
1829
|
-
constructor(opt?: ToolView.Options);
|
|
2025
|
+
constructor(opt?: ToolView.Options<V>);
|
|
1830
2026
|
|
|
1831
|
-
configure(opt?: ToolView.Options): this;
|
|
2027
|
+
configure(opt?: ToolView.Options<V>): this;
|
|
1832
2028
|
|
|
1833
2029
|
protected simulateRelatedView(el: SVGElement): void;
|
|
1834
2030
|
|
|
@@ -1838,6 +2034,12 @@ export namespace dia {
|
|
|
1838
2034
|
|
|
1839
2035
|
isVisible(): boolean;
|
|
1840
2036
|
|
|
2037
|
+
isExplicitlyVisible(): boolean;
|
|
2038
|
+
|
|
2039
|
+
updateVisibility(): void;
|
|
2040
|
+
|
|
2041
|
+
protected computeVisibility(): boolean;
|
|
2042
|
+
|
|
1841
2043
|
focus(): void;
|
|
1842
2044
|
|
|
1843
2045
|
blur(): void;
|
|
@@ -1930,6 +2132,11 @@ export namespace dia {
|
|
|
1930
2132
|
cellView: dia.CellView
|
|
1931
2133
|
): T[];
|
|
1932
2134
|
|
|
2135
|
+
static getAll<T extends HighlighterView = HighlighterView>(
|
|
2136
|
+
paper: dia.Paper,
|
|
2137
|
+
id?: string
|
|
2138
|
+
): T[];
|
|
2139
|
+
|
|
1933
2140
|
static update(cellView: dia.CellView, id?: string): void;
|
|
1934
2141
|
|
|
1935
2142
|
static transform(cellView: dia.CellView, id?: string): void;
|
|
@@ -2377,6 +2584,12 @@ export namespace shapes {
|
|
|
2377
2584
|
|
|
2378
2585
|
export namespace util {
|
|
2379
2586
|
|
|
2587
|
+
export function isCalcExpression(value: any): boolean;
|
|
2588
|
+
|
|
2589
|
+
export function evalCalcFormula(formula: string, rect: g.PlainRect): number;
|
|
2590
|
+
|
|
2591
|
+
export function evalCalcExpression(expression: string, rect: g.PlainRect): string;
|
|
2592
|
+
|
|
2380
2593
|
export function hashCode(str: string): string;
|
|
2381
2594
|
|
|
2382
2595
|
export function getByPath(object: { [key: string]: any }, path: string | string[], delim?: string): any;
|
|
@@ -2447,6 +2660,8 @@ export namespace util {
|
|
|
2447
2660
|
|
|
2448
2661
|
export function toggleFullScreen(el?: Element): void;
|
|
2449
2662
|
|
|
2663
|
+
export function objectDifference(object: object, base: object, opt?: { maxDepth?: number }): object;
|
|
2664
|
+
|
|
2450
2665
|
interface DOMJSONDocument {
|
|
2451
2666
|
fragment: DocumentFragment;
|
|
2452
2667
|
selectors: { [key: string]: Element };
|
|
@@ -4077,9 +4292,9 @@ export namespace elementTools {
|
|
|
4077
4292
|
|
|
4078
4293
|
namespace Button {
|
|
4079
4294
|
|
|
4080
|
-
type ActionCallback = (evt: dia.Event, view: dia.ElementView, tool:
|
|
4295
|
+
type ActionCallback = (evt: dia.Event, view: dia.ElementView, tool: Button) => void;
|
|
4081
4296
|
|
|
4082
|
-
interface Options extends dia.ToolView.Options {
|
|
4297
|
+
interface Options extends dia.ToolView.Options<dia.ElementView> {
|
|
4083
4298
|
x?: number | string;
|
|
4084
4299
|
y?: number | string;
|
|
4085
4300
|
offset?: { x?: number, y?: number };
|
|
@@ -4091,7 +4306,7 @@ export namespace elementTools {
|
|
|
4091
4306
|
}
|
|
4092
4307
|
}
|
|
4093
4308
|
|
|
4094
|
-
class Button extends dia.ToolView {
|
|
4309
|
+
class Button extends dia.ToolView<dia.ElementView> {
|
|
4095
4310
|
|
|
4096
4311
|
constructor(opt?: Button.Options);
|
|
4097
4312
|
|
|
@@ -4133,20 +4348,20 @@ export namespace elementTools {
|
|
|
4133
4348
|
}
|
|
4134
4349
|
|
|
4135
4350
|
namespace Boundary {
|
|
4136
|
-
interface Options extends dia.ToolView.Options {
|
|
4351
|
+
interface Options extends dia.ToolView.Options<dia.ElementView> {
|
|
4137
4352
|
padding?: number | dia.Sides;
|
|
4138
4353
|
useModelGeometry?: boolean;
|
|
4139
4354
|
rotate?: boolean;
|
|
4140
4355
|
}
|
|
4141
4356
|
}
|
|
4142
4357
|
|
|
4143
|
-
class Boundary extends dia.ToolView {
|
|
4358
|
+
class Boundary extends dia.ToolView<dia.ElementView> {
|
|
4144
4359
|
|
|
4145
4360
|
constructor(opt?: Boundary.Options);
|
|
4146
4361
|
}
|
|
4147
4362
|
|
|
4148
4363
|
namespace Control {
|
|
4149
|
-
interface Options extends dia.ToolView.Options {
|
|
4364
|
+
interface Options extends dia.ToolView.Options<dia.ElementView> {
|
|
4150
4365
|
selector?: string | null;
|
|
4151
4366
|
padding?: number;
|
|
4152
4367
|
handleAttributes?: Partial<attributes.NativeSVGAttributes>;
|
|
@@ -4154,13 +4369,13 @@ export namespace elementTools {
|
|
|
4154
4369
|
}
|
|
4155
4370
|
}
|
|
4156
4371
|
|
|
4157
|
-
abstract class Control<T extends mvc.ViewOptions<undefined, SVGElement> = Control.Options> extends dia.ToolView {
|
|
4372
|
+
abstract class Control<T extends mvc.ViewOptions<undefined, SVGElement> = Control.Options> extends dia.ToolView<dia.ElementView> {
|
|
4158
4373
|
options: T;
|
|
4159
4374
|
constructor(opt?: T);
|
|
4160
4375
|
|
|
4161
4376
|
protected getPosition(view: dia.ElementView): dia.Point;
|
|
4162
|
-
protected setPosition(view: dia.ElementView, coordinates: g.Point): void;
|
|
4163
|
-
protected resetPosition(view: dia.ElementView): void;
|
|
4377
|
+
protected setPosition(view: dia.ElementView, coordinates: g.Point, evt: dia.Event): void;
|
|
4378
|
+
protected resetPosition(view: dia.ElementView, evt: dia.Event): void;
|
|
4164
4379
|
|
|
4165
4380
|
protected updateHandle(handleNode: SVGElement): void;
|
|
4166
4381
|
protected updateExtras(extrasNode: SVGElement): void;
|
|
@@ -4185,7 +4400,7 @@ export namespace elementTools {
|
|
|
4185
4400
|
}
|
|
4186
4401
|
}
|
|
4187
4402
|
|
|
4188
|
-
class HoverConnect extends
|
|
4403
|
+
class HoverConnect extends Connect {
|
|
4189
4404
|
|
|
4190
4405
|
constructor(opt?: HoverConnect.Options);
|
|
4191
4406
|
}
|
|
@@ -4212,11 +4427,15 @@ export namespace linkTools {
|
|
|
4212
4427
|
protected onPointerClick(evt: dia.Event): void;
|
|
4213
4428
|
}
|
|
4214
4429
|
|
|
4215
|
-
interface
|
|
4430
|
+
interface VertexAddingOptions {
|
|
4431
|
+
interactiveLineNode: string;
|
|
4432
|
+
}
|
|
4433
|
+
|
|
4434
|
+
interface Options extends dia.ToolView.Options<dia.LinkView> {
|
|
4216
4435
|
handleClass?: typeof VertexHandle;
|
|
4217
4436
|
snapRadius?: number;
|
|
4218
4437
|
redundancyRemoval?: boolean;
|
|
4219
|
-
vertexAdding?: boolean
|
|
4438
|
+
vertexAdding?: boolean | Partial<VertexAddingOptions>;
|
|
4220
4439
|
vertexRemoving?: boolean;
|
|
4221
4440
|
vertexMoving?: boolean;
|
|
4222
4441
|
stopPropagation?: boolean;
|
|
@@ -4224,7 +4443,7 @@ export namespace linkTools {
|
|
|
4224
4443
|
}
|
|
4225
4444
|
}
|
|
4226
4445
|
|
|
4227
|
-
class Vertices extends dia.ToolView {
|
|
4446
|
+
class Vertices extends dia.ToolView<dia.LinkView> {
|
|
4228
4447
|
|
|
4229
4448
|
constructor(opt?: Vertices.Options);
|
|
4230
4449
|
}
|
|
@@ -4240,7 +4459,7 @@ export namespace linkTools {
|
|
|
4240
4459
|
protected onPointerUp(evt: dia.Event): void;
|
|
4241
4460
|
}
|
|
4242
4461
|
|
|
4243
|
-
interface Options extends dia.ToolView.Options {
|
|
4462
|
+
interface Options extends dia.ToolView.Options<dia.LinkView> {
|
|
4244
4463
|
handleClass?: typeof SegmentHandle;
|
|
4245
4464
|
snapRadius?: number;
|
|
4246
4465
|
snapHandle?: boolean;
|
|
@@ -4252,19 +4471,19 @@ export namespace linkTools {
|
|
|
4252
4471
|
}
|
|
4253
4472
|
}
|
|
4254
4473
|
|
|
4255
|
-
class Segments extends dia.ToolView {
|
|
4474
|
+
class Segments extends dia.ToolView<dia.LinkView> {
|
|
4256
4475
|
|
|
4257
4476
|
constructor(opt?: Segments.Options);
|
|
4258
4477
|
}
|
|
4259
4478
|
|
|
4260
4479
|
namespace Arrowhead {
|
|
4261
4480
|
|
|
4262
|
-
interface Options extends dia.ToolView.Options {
|
|
4481
|
+
interface Options extends dia.ToolView.Options<dia.LinkView> {
|
|
4263
4482
|
scale?: number;
|
|
4264
4483
|
}
|
|
4265
4484
|
}
|
|
4266
4485
|
|
|
4267
|
-
abstract class Arrowhead extends dia.ToolView {
|
|
4486
|
+
abstract class Arrowhead extends dia.ToolView<dia.LinkView> {
|
|
4268
4487
|
|
|
4269
4488
|
ratio: number;
|
|
4270
4489
|
arrowheadType: string;
|
|
@@ -4289,7 +4508,7 @@ export namespace linkTools {
|
|
|
4289
4508
|
}
|
|
4290
4509
|
|
|
4291
4510
|
namespace Anchor {
|
|
4292
|
-
interface Options extends dia.ToolView.Options {
|
|
4511
|
+
interface Options extends dia.ToolView.Options<dia.LinkView> {
|
|
4293
4512
|
snap?: AnchorCallback<dia.Point>;
|
|
4294
4513
|
anchor?: AnchorCallback<anchors.AnchorJSON>;
|
|
4295
4514
|
resetAnchor?: boolean | anchors.AnchorJSON;
|
|
@@ -4303,7 +4522,7 @@ export namespace linkTools {
|
|
|
4303
4522
|
}
|
|
4304
4523
|
}
|
|
4305
4524
|
|
|
4306
|
-
abstract class Anchor extends dia.ToolView {
|
|
4525
|
+
abstract class Anchor extends dia.ToolView<dia.LinkView> {
|
|
4307
4526
|
|
|
4308
4527
|
type: string;
|
|
4309
4528
|
|
|
@@ -4322,10 +4541,14 @@ export namespace linkTools {
|
|
|
4322
4541
|
|
|
4323
4542
|
namespace Button {
|
|
4324
4543
|
|
|
4325
|
-
type ActionCallback = (evt: dia.Event, view: dia.LinkView, tool:
|
|
4544
|
+
type ActionCallback = (evt: dia.Event, view: dia.LinkView, tool: Button) => void;
|
|
4326
4545
|
|
|
4327
|
-
|
|
4328
|
-
|
|
4546
|
+
type Distance = number | string;
|
|
4547
|
+
|
|
4548
|
+
type DistanceCallback = (this: Button, view: dia.LinkView, tool: Button) => Distance;
|
|
4549
|
+
|
|
4550
|
+
interface Options extends dia.ToolView.Options<dia.LinkView> {
|
|
4551
|
+
distance?: Distance | DistanceCallback;
|
|
4329
4552
|
offset?: number;
|
|
4330
4553
|
rotate?: boolean;
|
|
4331
4554
|
action?: ActionCallback;
|
|
@@ -4334,7 +4557,7 @@ export namespace linkTools {
|
|
|
4334
4557
|
}
|
|
4335
4558
|
}
|
|
4336
4559
|
|
|
4337
|
-
class Button extends dia.ToolView {
|
|
4560
|
+
class Button extends dia.ToolView<dia.LinkView> {
|
|
4338
4561
|
|
|
4339
4562
|
constructor(opt?: Button.Options);
|
|
4340
4563
|
|
|
@@ -4368,13 +4591,13 @@ export namespace linkTools {
|
|
|
4368
4591
|
}
|
|
4369
4592
|
|
|
4370
4593
|
namespace Boundary {
|
|
4371
|
-
interface Options extends dia.ToolView.Options {
|
|
4594
|
+
interface Options extends dia.ToolView.Options<dia.LinkView> {
|
|
4372
4595
|
padding?: number | dia.Sides;
|
|
4373
4596
|
useModelGeometry?: boolean;
|
|
4374
4597
|
}
|
|
4375
4598
|
}
|
|
4376
4599
|
|
|
4377
|
-
class Boundary extends dia.ToolView {
|
|
4600
|
+
class Boundary extends dia.ToolView<dia.LinkView> {
|
|
4378
4601
|
|
|
4379
4602
|
constructor(opt?: Boundary.Options);
|
|
4380
4603
|
}
|
|
@@ -4410,4 +4633,52 @@ export namespace linkTools {
|
|
|
4410
4633
|
|
|
4411
4634
|
protected onMouseleave(evt: dia.Event): void;
|
|
4412
4635
|
}
|
|
4636
|
+
|
|
4637
|
+
namespace Control {
|
|
4638
|
+
interface Options extends dia.ToolView.Options {
|
|
4639
|
+
selector?: string | null;
|
|
4640
|
+
padding?: number;
|
|
4641
|
+
handleAttributes?: Partial<attributes.NativeSVGAttributes>;
|
|
4642
|
+
scale?: number;
|
|
4643
|
+
}
|
|
4644
|
+
}
|
|
4645
|
+
|
|
4646
|
+
abstract class Control<T extends mvc.ViewOptions<undefined, SVGElement> = Control.Options> extends dia.ToolView {
|
|
4647
|
+
options: T;
|
|
4648
|
+
constructor(opt?: T);
|
|
4649
|
+
|
|
4650
|
+
protected getPosition(view: dia.LinkView): dia.Point;
|
|
4651
|
+
protected setPosition(view: dia.LinkView, coordinates: g.Point): void;
|
|
4652
|
+
protected resetPosition(view: dia.LinkView): void;
|
|
4653
|
+
|
|
4654
|
+
protected updateHandle(handleNode: SVGElement): void;
|
|
4655
|
+
protected updateExtras(extrasNode: SVGElement): void;
|
|
4656
|
+
protected toggleExtras(visible: boolean): void;
|
|
4657
|
+
|
|
4658
|
+
protected onPointerDown(evt: dia.Event): void;
|
|
4659
|
+
protected onPointerMove(evt: dia.Event): void;
|
|
4660
|
+
protected onPointerUp(evt: dia.Event): void;
|
|
4661
|
+
protected onPointerDblClick(evt: dia.Event): void;
|
|
4662
|
+
}
|
|
4663
|
+
|
|
4664
|
+
namespace RotateLabel {
|
|
4665
|
+
|
|
4666
|
+
interface Options extends Control.Options {
|
|
4667
|
+
offset?: number | dia.Point;
|
|
4668
|
+
buttonColor?: string;
|
|
4669
|
+
iconColor?: string;
|
|
4670
|
+
outlineColor?: string;
|
|
4671
|
+
}
|
|
4672
|
+
}
|
|
4673
|
+
|
|
4674
|
+
class RotateLabel extends Control<RotateLabel.Options> {
|
|
4675
|
+
|
|
4676
|
+
constructor(opt?: RotateLabel.Options);
|
|
4677
|
+
|
|
4678
|
+
protected getLabelPosition(label: dia.Link.Label): dia.Link.LabelPosition;
|
|
4679
|
+
|
|
4680
|
+
protected getLabelIndex(): number;
|
|
4681
|
+
|
|
4682
|
+
protected getLabel(): dia.Link.Label | null;
|
|
4683
|
+
}
|
|
4413
4684
|
}
|