@joint/core 4.0.4 → 4.1.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.
Files changed (54) hide show
  1. package/README.md +0 -8
  2. package/dist/geometry.js +4962 -6132
  3. package/dist/geometry.min.js +2 -2
  4. package/dist/joint.d.ts +328 -50
  5. package/dist/joint.js +34067 -37565
  6. package/dist/joint.min.js +2 -2
  7. package/dist/joint.nowrap.js +34067 -37565
  8. package/dist/joint.nowrap.min.js +2 -2
  9. package/dist/vectorizer.js +7288 -8907
  10. package/dist/vectorizer.min.js +2 -2
  11. package/dist/version.mjs +1 -1
  12. package/package.json +10 -15
  13. package/src/{linkTools → cellTools}/Button.mjs +8 -6
  14. package/src/{elementTools → cellTools}/Control.mjs +3 -3
  15. package/src/{linkTools → cellTools}/HoverConnect.mjs +1 -1
  16. package/src/dia/Cell.mjs +60 -33
  17. package/src/dia/CellView.mjs +75 -8
  18. package/src/dia/ElementView.mjs +13 -8
  19. package/src/dia/Graph.mjs +148 -40
  20. package/src/dia/HighlighterView.mjs +8 -4
  21. package/src/dia/LinkView.mjs +42 -3
  22. package/src/dia/Paper.mjs +84 -0
  23. package/src/dia/ToolView.mjs +29 -4
  24. package/src/dia/ToolsView.mjs +25 -10
  25. package/src/dia/attributes/connection.mjs +5 -0
  26. package/src/dia/attributes/defs.mjs +3 -0
  27. package/src/dia/attributes/eval.mjs +3 -3
  28. package/src/dia/attributes/index.mjs +3 -0
  29. package/src/dia/attributes/shape.mjs +4 -0
  30. package/src/dia/attributes/text.mjs +15 -5
  31. package/src/dia/ports.mjs +4 -0
  32. package/src/elementTools/HoverConnect.mjs +5 -5
  33. package/src/elementTools/index.mjs +5 -4
  34. package/src/g/rect.mjs +13 -5
  35. package/src/layout/ports/port.mjs +4 -5
  36. package/src/linkTools/Anchor.mjs +1 -1
  37. package/src/linkTools/Arrowhead.mjs +2 -1
  38. package/src/linkTools/RotateLabel.mjs +110 -0
  39. package/src/linkTools/Segments.mjs +1 -1
  40. package/src/linkTools/Vertices.mjs +41 -4
  41. package/src/linkTools/index.mjs +7 -4
  42. package/src/mvc/View.mjs +0 -1
  43. package/src/mvc/ViewBase.mjs +2 -1
  44. package/src/routers/rightAngle.mjs +538 -140
  45. package/src/shapes/standard.mjs +8 -1
  46. package/src/{dia/attributes → util}/calc.mjs +24 -12
  47. package/src/util/index.mjs +1 -0
  48. package/src/util/util.mjs +39 -0
  49. package/src/util/utilHelpers.mjs +2 -1
  50. package/types/geometry.d.ts +6 -1
  51. package/types/joint.d.ts +321 -48
  52. /package/src/{linkTools → cellTools}/Boundary.mjs +0 -0
  53. /package/src/{linkTools → cellTools}/Connect.mjs +0 -0
  54. /package/src/{linkTools → cellTools}/helpers.mjs +0 -0
package/dist/joint.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /*! JointJS v4.0.4 (2024-05-31) - JavaScript diagramming library
1
+ /*! JointJS v4.1.0 (2024-11-27) - JavaScript diagramming library
2
2
 
3
3
 
4
4
  This Source Code Form is subject to the terms of the Mozilla Public
@@ -671,10 +671,11 @@ export declare namespace dia {
671
671
  export type OrthogonalDirection =
672
672
  'left' | 'top' | 'right' | 'bottom';
673
673
 
674
- export type Direction =
675
- OrthogonalDirection |
674
+ export type DiagonalDirection =
676
675
  'top-left' | 'top-right' | 'bottom-right' | 'bottom-left';
677
676
 
677
+ export type Direction = OrthogonalDirection | DiagonalDirection;
678
+
678
679
  export type LinkEnd =
679
680
  'source' | 'target';
680
681
 
@@ -768,6 +769,20 @@ export declare namespace dia {
768
769
  breadthFirst?: boolean;
769
770
  }
770
771
 
772
+ export interface FindAtPointOptions extends Options {
773
+ strict?: boolean;
774
+ }
775
+
776
+ export interface FindInAreaOptions extends Options {
777
+ strict?: boolean;
778
+ }
779
+
780
+ export type SearchByKey = 'bbox' | PositionName;
781
+
782
+ export interface FindUnderElementOptions extends FindInAreaOptions, FindAtPointOptions {
783
+ searchBy?: SearchByKey;
784
+ }
785
+
771
786
  export class Cells extends mvc.Collection<Cell> {
772
787
  graph: Graph;
773
788
  cellNamespace: any;
@@ -844,17 +859,48 @@ export declare namespace dia {
844
859
 
845
860
  getCommonAncestor(...cells: Cell[]): Element | undefined;
846
861
 
847
- toJSON(): any;
862
+ toJSON(opt?: { cellAttributes?: dia.Cell.ExportOptions }): any;
848
863
 
849
864
  fromJSON(json: any, opt?: S): this;
850
865
 
851
866
  clear(opt?: { [key: string]: any }): this;
852
867
 
868
+ findElementsAtPoint(p: Point, opt?: Graph.FindAtPointOptions): Element[];
869
+
870
+ findElementsInArea(rect: BBox, opt?: Graph.FindInAreaOptions): Element[];
871
+
872
+ findElementsUnderElement(element: Element, opt?: Graph.FindUnderElementOptions): Element[];
873
+
874
+ findLinksAtPoint(p: Point, opt?: Graph.FindAtPointOptions): Link[];
875
+
876
+ findLinksInArea(rect: BBox, opt?: Graph.FindInAreaOptions): Link[];
877
+
878
+ findLinksUnderElement(element: Element, opt?: Graph.FindUnderElementOptions): Link[];
879
+
880
+ findCellsAtPoint(p: Point, opt?: Graph.FindAtPointOptions): Cell[];
881
+
882
+ findCellsInArea(rect: BBox, opt?: Graph.FindInAreaOptions): Cell[];
883
+
884
+ findCellsUnderElement(element: Element, opt?: Graph.FindUnderElementOptions): Cell[];
885
+
886
+ protected _getFindUnderElementGeometry(element: Element, searchBy: Graph.SearchByKey): g.Point | g.Rect;
887
+
888
+ protected _validateCellsUnderElement<T extends Cell[]>(cells: T, element: Element): T;
889
+
890
+ protected _isValidElementUnderElement(el1: Element, el2: Element): boolean;
891
+
892
+ protected _isValidLinkUnderElement(link: Link, element: Element): boolean;
893
+
894
+ protected _filterCellsUnderElement(cells: Cell[], element: Element, opt: Graph.FindUnderElementOptions): Cell[];
895
+
896
+ /** @deprecated use `findElementsAtPoint` instead */
853
897
  findModelsFromPoint(p: Point): Element[];
854
898
 
855
- findModelsInArea(rect: BBox, opt?: { strict?: boolean }): Element[];
899
+ /** @deprecated use `findElementsInArea` instead */
900
+ findModelsInArea(rect: BBox, opt?: Graph.FindInAreaOptions): Element[];
856
901
 
857
- findModelsUnderElement(element: Element, opt?: { searchBy?: 'bbox' | PositionName }): Element[];
902
+ /** @deprecated use `findElementsUnderElement` instead */
903
+ findModelsUnderElement(element: Element, opt?: Graph.FindUnderElementOptions): Element[];
858
904
 
859
905
  getBBox(): g.Rect | null;
860
906
 
@@ -868,6 +914,10 @@ export declare namespace dia {
868
914
 
869
915
  removeCells(cells: Cell[], opt?: Cell.DisconnectableOptions): this;
870
916
 
917
+ transferCellEmbeds(sourceCell: Cell, targetCell: Cell, opt?: S): void;
918
+
919
+ transferCellConnectedLinks(sourceCell: Cell, targetCell: Cell, opt?: Graph.ConnectionOptions): void;
920
+
871
921
  resize(width: number, height: number, opt?: S): this;
872
922
 
873
923
  resizeCells(width: number, height: number, cells: Cell[], opt?: S): this;
@@ -912,6 +962,10 @@ export declare namespace dia {
912
962
  [key: string]: any;
913
963
  }
914
964
 
965
+ export interface EmbedOptions extends Options {
966
+ reparent?: boolean;
967
+ }
968
+
915
969
  export interface EmbeddableOptions<T = boolean> extends Options {
916
970
  deep?: T;
917
971
  }
@@ -939,6 +993,52 @@ export declare namespace dia {
939
993
  export interface ConstructorOptions extends Graph.Options {
940
994
  mergeArrays?: boolean;
941
995
  }
996
+
997
+ export interface ExportOptions {
998
+ ignoreDefault?: boolean | string[];
999
+ ignoreEmptyAttributes?: boolean;
1000
+ }
1001
+
1002
+ export type UnsetCallback<V> = (
1003
+ this: V,
1004
+ node: Element,
1005
+ nodeAttributes: { [name: string]: any },
1006
+ cellView: V
1007
+ ) => string | Array<string> | null | void;
1008
+
1009
+ export type SetCallback<V> = (
1010
+ this: V,
1011
+ attributeValue: any,
1012
+ refBBox: g.Rect,
1013
+ node: Element,
1014
+ nodeAttributes: { [name: string]: any },
1015
+ cellView: V
1016
+ ) => { [key: string]: any } | string | number | void;
1017
+
1018
+ export type PositionCallback<V> = (
1019
+ this: V,
1020
+ attributeValue: any,
1021
+ refBBox: g.Rect,
1022
+ node: Element,
1023
+ nodeAttributes: { [name: string]: any },
1024
+ cellView: V
1025
+ ) => dia.Point | null | void;
1026
+
1027
+ export type OffsetCallback<V> = (
1028
+ this: V,
1029
+ attributeValue: any,
1030
+ nodeBBox: g.Rect,
1031
+ node: Element,
1032
+ nodeAttributes: { [name: string]: any },
1033
+ cellView: V
1034
+ ) => dia.Point | null | void;
1035
+
1036
+ export interface PresentationAttributeDefinition<V = dia.CellView> {
1037
+ set?: SetCallback<V> | string;
1038
+ unset?: UnsetCallback<V> | string | Array<string>;
1039
+ position?: PositionCallback<V>;
1040
+ offset?: OffsetCallback<V>;
1041
+ }
942
1042
  }
943
1043
 
944
1044
  export class Cell<A extends ObjectHash = Cell.Attributes, S extends mvc.ModelSetOptions = dia.ModelSetOptions> extends mvc.Model<A, S> {
@@ -956,7 +1056,7 @@ export declare namespace dia {
956
1056
 
957
1057
  protected stopScheduledTransitions(path?: string, delim?: string): void;
958
1058
 
959
- toJSON(): Cell.JSON<any, A>;
1059
+ toJSON(opt?: dia.Cell.ExportOptions): Cell.JSON<any, A>;
960
1060
 
961
1061
  remove(opt?: Cell.DisconnectableOptions): this;
962
1062
 
@@ -998,7 +1098,7 @@ export declare namespace dia {
998
1098
 
999
1099
  stopTransitions(path?: string, delim?: string): this;
1000
1100
 
1001
- embed(cell: Cell | Cell[], opt?: Graph.Options): this;
1101
+ embed(cell: Cell | Cell[], opt?: Cell.EmbedOptions): this;
1002
1102
 
1003
1103
  unembed(cell: Cell | Cell[], opt?: Graph.Options): this;
1004
1104
 
@@ -1109,6 +1209,10 @@ export declare namespace dia {
1109
1209
  deep?: boolean;
1110
1210
  }
1111
1211
 
1212
+ export interface ResizeOptions extends Cell.Options {
1213
+ direction?: Direction;
1214
+ }
1215
+
1112
1216
  export interface BBoxOptions extends Cell.EmbeddableOptions {
1113
1217
  rotate?: boolean;
1114
1218
  }
@@ -1122,9 +1226,10 @@ export declare namespace dia {
1122
1226
  position(x: number, y: number, opt?: Element.PositionOptions): this;
1123
1227
 
1124
1228
  size(): Size;
1125
- size(width: number, height?: number, opt?: { direction?: Direction, [key: string]: any }): this;
1229
+ size(size: Partial<Size>, opt?: Element.ResizeOptions): this;
1230
+ size(width: number, height: number, opt?: Element.ResizeOptions): this;
1126
1231
 
1127
- resize(width: number, height: number, opt?: { direction?: Direction, [key: string]: any }): this;
1232
+ resize(width: number, height: number, opt?: Element.ResizeOptions): this;
1128
1233
 
1129
1234
  rotate(deg: number, absolute?: boolean, origin?: Point, opt?: { [key: string]: any }): this;
1130
1235
 
@@ -1164,6 +1269,8 @@ export declare namespace dia {
1164
1269
 
1165
1270
  getPortIndex(port: string | Element.Port): number;
1166
1271
 
1272
+ getPortGroupNames(): string[];
1273
+
1167
1274
  portProp(portId: string, path: dia.Path): any;
1168
1275
 
1169
1276
  portProp(portId: string, path: dia.Path, value?: any, opt?: S): Element;
@@ -1171,6 +1278,8 @@ export declare namespace dia {
1171
1278
  protected generatePortId(): string | number;
1172
1279
 
1173
1280
  static define(type: string, defaults?: any, protoProps?: any, staticProps?: any): Cell.Constructor<Element>;
1281
+
1282
+ static attributes: { [attributeName: string]: Cell.PresentationAttributeDefinition<ElementView> };
1174
1283
  }
1175
1284
 
1176
1285
  // dia.Link
@@ -1319,6 +1428,8 @@ export declare namespace dia {
1319
1428
  translate(tx: number, ty: number, opt?: S): this;
1320
1429
 
1321
1430
  static define(type: string, defaults?: any, protoProps?: any, staticProps?: any): Cell.Constructor<Link>;
1431
+
1432
+ static attributes: { [attributeName: string]: Cell.PresentationAttributeDefinition<LinkView> };
1322
1433
  }
1323
1434
 
1324
1435
  // dia.CellView
@@ -1436,6 +1547,14 @@ export declare namespace dia {
1436
1547
 
1437
1548
  isDefaultInteractionPrevented(evt: dia.Event): boolean;
1438
1549
 
1550
+ isIntersecting(geometryShape: g.Shape, geometryData?: g.SegmentSubdivisionsOpt | null): boolean;
1551
+
1552
+ protected isEnclosedIn(area: g.Rect): boolean;
1553
+
1554
+ protected isInArea(area: g.Rect, options: g.StrictOpt): boolean;
1555
+
1556
+ protected isAtPoint(point: g.Point, options: g.StrictOpt): boolean;
1557
+
1439
1558
  protected findBySelector(selector: string, root?: SVGElement): SVGElement[];
1440
1559
 
1441
1560
  protected removeHighlighters(): void;
@@ -1537,6 +1656,8 @@ export declare namespace dia {
1537
1656
 
1538
1657
  getDelegatedView(): ElementView | null;
1539
1658
 
1659
+ getTargetParentView(evt: dia.Event): CellView | null;
1660
+
1540
1661
  findPortNode(portId: string | number): SVGElement | null;
1541
1662
  findPortNode(portId: string | number, selector: string): E | null;
1542
1663
 
@@ -1625,6 +1746,11 @@ export declare namespace dia {
1625
1746
  options: LinkView.Options<L>;
1626
1747
  sourceAnchor: g.Point;
1627
1748
  targetAnchor: g.Point;
1749
+ sourcePoint: g.Point;
1750
+ targetPoint: g.Point;
1751
+ sourceBBox: g.Rect;
1752
+ targetBBox: g.Rect;
1753
+ route: g.Point[];
1628
1754
 
1629
1755
  sendToken(token: SVGElement, duration?: number, callback?: () => void): void;
1630
1756
  sendToken(token: SVGElement, opt?: { duration?: number, direction?: string, connection?: string }, callback?: () => void): void;
@@ -1831,6 +1957,11 @@ export declare namespace dia {
1831
1957
  afterRender?: AfterRenderCallback;
1832
1958
  }
1833
1959
 
1960
+ export interface SnapLinksOptions {
1961
+ radius?: number;
1962
+ findInAreaOptions?: FindInAreaOptions;
1963
+ }
1964
+
1834
1965
  export type PointConstraintCallback = (x: number, y: number, opt: any) => Point;
1835
1966
  export type RestrictTranslateCallback = (elementView: ElementView, x0: number, y0: number) => BBox | boolean | PointConstraintCallback;
1836
1967
  export type FindParentByType = 'bbox' | 'pointer' | PositionName;
@@ -1849,7 +1980,7 @@ export declare namespace dia {
1849
1980
  highlighting?: boolean | Record<string | dia.CellView.Highlighting, highlighters.HighlighterJSON | boolean>;
1850
1981
  interactive?: ((cellView: CellView, event: string) => boolean | CellView.InteractivityOptions) | boolean | CellView.InteractivityOptions;
1851
1982
  snapLabels?: boolean;
1852
- snapLinks?: boolean | { radius: number };
1983
+ snapLinks?: boolean | SnapLinksOptions;
1853
1984
  snapLinksSelf?: boolean | { distance: number };
1854
1985
  markAvailable?: boolean;
1855
1986
  // validations
@@ -2023,6 +2154,20 @@ export declare namespace dia {
2023
2154
  // custom
2024
2155
  [eventName: string]: mvc.EventHandler;
2025
2156
  }
2157
+
2158
+ export interface BufferOptions {
2159
+ /**
2160
+ * A buffer around the area to extend the search to
2161
+ * to mitigate the differences between the model and view geometry.
2162
+ */
2163
+ buffer?: number;
2164
+ }
2165
+
2166
+ export interface FindAtPointOptions extends Graph.FindAtPointOptions, BufferOptions {
2167
+ }
2168
+
2169
+ export interface FindInAreaOptions extends Graph.FindInAreaOptions, BufferOptions {
2170
+ }
2026
2171
  }
2027
2172
 
2028
2173
  export class Paper extends mvc.View<Graph> {
@@ -2116,19 +2261,52 @@ export declare namespace dia {
2116
2261
 
2117
2262
  findViewByModel<T extends ElementView | LinkView>(model: Cell | Cell.ID): T;
2118
2263
 
2119
- findViewsFromPoint(point: string | Point): ElementView[];
2264
+ /**
2265
+ * Finds all the element views at the specified point
2266
+ * @param point a point in local paper coordinates
2267
+ * @param opt options for the search
2268
+ */
2269
+ findElementViewsAtPoint(point: Point, opt?: Paper.FindAtPointOptions): ElementView[];
2120
2270
 
2121
- findViewsInArea(rect: BBox, opt?: { strict?: boolean }): ElementView[];
2271
+ /**
2272
+ * Finds all the link views at the specified point
2273
+ * @param point a point in local paper coordinates
2274
+ * @param opt options for the search
2275
+ */
2276
+ findLinkViewsAtPoint(point: Point, opt?: Paper.FindAtPointOptions): LinkView[];
2122
2277
 
2123
- fitToContent(opt?: Paper.FitToContentOptions): g.Rect;
2124
- fitToContent(gridWidth?: number, gridHeight?: number, padding?: number, opt?: any): g.Rect;
2278
+ /**
2279
+ * Finds all the cell views at the specified point
2280
+ * @param point a point in local paper coordinates
2281
+ * @param opt options for the search
2282
+ */
2283
+ findCellViewsAtPoint(point: Point, opt?: Paper.FindAtPointOptions): CellView[];
2125
2284
 
2126
- getFitToContentArea(opt?: Paper.FitToContentOptions): g.Rect;
2285
+ /**
2286
+ * Finds all the element views in the specified area
2287
+ * @param area a rectangle in local paper coordinates
2288
+ * @param opt options for the search
2289
+ */
2290
+ findElementViewsInArea(area: BBox, opt?: Paper.FindInAreaOptions): ElementView[];
2127
2291
 
2128
2292
  /**
2129
- * @deprecated use transformToFitContent
2293
+ * Finds all the link views in the specified area
2294
+ * @param area a rectangle in local paper coordinates
2295
+ * @param opt options for the search
2130
2296
  */
2131
- scaleContentToFit(opt?: Paper.ScaleContentOptions): void;
2297
+ findLinkViewsInArea(area: BBox, opt?: Paper.FindInAreaOptions): LinkView[];
2298
+
2299
+ /**
2300
+ * Finds all the cell views in the specified area
2301
+ * @param area a rectangle in local paper coordinates
2302
+ * @param opt options for the search
2303
+ */
2304
+ findCellViewsInArea(area: BBox, opt?: Paper.FindInAreaOptions): CellView[];
2305
+
2306
+ fitToContent(opt?: Paper.FitToContentOptions): g.Rect;
2307
+ fitToContent(gridWidth?: number, gridHeight?: number, padding?: number, opt?: any): g.Rect;
2308
+
2309
+ getFitToContentArea(opt?: Paper.FitToContentOptions): g.Rect;
2132
2310
 
2133
2311
  transformToFitContent(opt?: Paper.TransformToFitContentOptions): void;
2134
2312
 
@@ -2201,7 +2379,6 @@ export declare namespace dia {
2201
2379
  mountBatchSize?: number;
2202
2380
  unmountBatchSize?: number;
2203
2381
  viewport?: Paper.ViewportCallback;
2204
- progress?: Paper.ProgressCallback;
2205
2382
  }): void;
2206
2383
 
2207
2384
  checkViewport(opt?: {
@@ -2216,10 +2393,10 @@ export declare namespace dia {
2216
2393
  updateViews(opt?: {
2217
2394
  batchSize?: number;
2218
2395
  viewport?: Paper.ViewportCallback;
2219
- progress?: Paper.ProgressCallback;
2220
2396
  }): {
2221
2397
  updated: number;
2222
2398
  batches: number;
2399
+ priority: number;
2223
2400
  };
2224
2401
 
2225
2402
  hasScheduledUpdates(): boolean;
@@ -2359,6 +2536,21 @@ export declare namespace dia {
2359
2536
  protected customEventTrigger(event: dia.Event, view: CellView, rootNode?: SVGElement): dia.Event | null;
2360
2537
 
2361
2538
  protected addStylesheet(stylesheet: string): void;
2539
+
2540
+ /**
2541
+ * @deprecated use `findElementViewsAtPoint()
2542
+ */
2543
+ findViewsFromPoint(point: string | Point): ElementView[];
2544
+
2545
+ /**
2546
+ * @deprecated use `findElementViewsInArea()
2547
+ */
2548
+ findViewsInArea(rect: BBox, opt?: { strict?: boolean }): ElementView[];
2549
+
2550
+ /**
2551
+ * @deprecated use transformToFitContent
2552
+ */
2553
+ scaleContentToFit(opt?: Paper.ScaleContentOptions): void;
2362
2554
  }
2363
2555
 
2364
2556
  export namespace PaperLayer {
@@ -2420,21 +2612,25 @@ export declare namespace dia {
2420
2612
  }
2421
2613
 
2422
2614
  export namespace ToolView {
2423
- export interface Options extends mvc.ViewOptions<undefined, SVGElement> {
2615
+
2616
+ export type VisibilityCallback<V = dia.CellView> = (this: ToolView, view: V, tool: ToolView) => boolean;
2617
+
2618
+ export interface Options<V = dia.CellView> extends mvc.ViewOptions<undefined, SVGElement> {
2424
2619
  focusOpacity?: number;
2620
+ visibility?: VisibilityCallback<V>;
2425
2621
  }
2426
2622
  }
2427
2623
 
2428
- export class ToolView extends mvc.View<undefined, SVGElement> {
2624
+ export class ToolView<V = dia.CellView> extends mvc.View<undefined, SVGElement> {
2429
2625
 
2430
2626
  name: string | null;
2431
2627
  parentView: ToolsView;
2432
2628
  relatedView: dia.CellView;
2433
2629
  paper: Paper;
2434
2630
 
2435
- constructor(opt?: ToolView.Options);
2631
+ constructor(opt?: ToolView.Options<V>);
2436
2632
 
2437
- configure(opt?: ToolView.Options): this;
2633
+ configure(opt?: ToolView.Options<V>): this;
2438
2634
 
2439
2635
  protected simulateRelatedView(el: SVGElement): void;
2440
2636
 
@@ -2444,6 +2640,12 @@ export declare namespace dia {
2444
2640
 
2445
2641
  isVisible(): boolean;
2446
2642
 
2643
+ isExplicitlyVisible(): boolean;
2644
+
2645
+ updateVisibility(): void;
2646
+
2647
+ protected computeVisibility(): boolean;
2648
+
2447
2649
  focus(): void;
2448
2650
 
2449
2651
  blur(): void;
@@ -2536,6 +2738,11 @@ export declare namespace dia {
2536
2738
  cellView: dia.CellView
2537
2739
  ): T[];
2538
2740
 
2741
+ static getAll<T extends HighlighterView = HighlighterView>(
2742
+ paper: dia.Paper,
2743
+ id?: string
2744
+ ): T[];
2745
+
2539
2746
  static update(cellView: dia.CellView, id?: string): void;
2540
2747
 
2541
2748
  static transform(cellView: dia.CellView, id?: string): void;
@@ -2554,9 +2761,9 @@ export declare namespace elementTools {
2554
2761
 
2555
2762
  export namespace Button {
2556
2763
 
2557
- export type ActionCallback = (evt: dia.Event, view: dia.ElementView, tool: dia.ToolView) => void;
2764
+ export type ActionCallback = (evt: dia.Event, view: dia.ElementView, tool: Button) => void;
2558
2765
 
2559
- export interface Options extends dia.ToolView.Options {
2766
+ export interface Options extends dia.ToolView.Options<dia.ElementView> {
2560
2767
  x?: number | string;
2561
2768
  y?: number | string;
2562
2769
  offset?: { x?: number, y?: number };
@@ -2568,7 +2775,7 @@ export declare namespace elementTools {
2568
2775
  }
2569
2776
  }
2570
2777
 
2571
- export class Button extends dia.ToolView {
2778
+ export class Button extends dia.ToolView<dia.ElementView> {
2572
2779
 
2573
2780
  constructor(opt?: Button.Options);
2574
2781
 
@@ -2610,20 +2817,20 @@ export declare namespace elementTools {
2610
2817
  }
2611
2818
 
2612
2819
  export namespace Boundary {
2613
- export interface Options extends dia.ToolView.Options {
2820
+ export interface Options extends dia.ToolView.Options<dia.ElementView> {
2614
2821
  padding?: number | dia.Sides;
2615
2822
  useModelGeometry?: boolean;
2616
2823
  rotate?: boolean;
2617
2824
  }
2618
2825
  }
2619
2826
 
2620
- export class Boundary extends dia.ToolView {
2827
+ export class Boundary extends dia.ToolView<dia.ElementView> {
2621
2828
 
2622
2829
  constructor(opt?: Boundary.Options);
2623
2830
  }
2624
2831
 
2625
2832
  export namespace Control {
2626
- export interface Options extends dia.ToolView.Options {
2833
+ export interface Options extends dia.ToolView.Options<dia.ElementView> {
2627
2834
  selector?: string | null;
2628
2835
  padding?: number;
2629
2836
  handleAttributes?: Partial<attributes.NativeSVGAttributes>;
@@ -2631,13 +2838,13 @@ export declare namespace elementTools {
2631
2838
  }
2632
2839
  }
2633
2840
 
2634
- export abstract class Control<T extends mvc.ViewOptions<undefined, SVGElement> = Control.Options> extends dia.ToolView {
2841
+ export abstract class Control<T extends mvc.ViewOptions<undefined, SVGElement> = Control.Options> extends dia.ToolView<dia.ElementView> {
2635
2842
  options: T;
2636
2843
  constructor(opt?: T);
2637
2844
 
2638
2845
  protected getPosition(view: dia.ElementView): dia.Point;
2639
- protected setPosition(view: dia.ElementView, coordinates: g.Point): void;
2640
- protected resetPosition(view: dia.ElementView): void;
2846
+ protected setPosition(view: dia.ElementView, coordinates: g.Point, evt: dia.Event): void;
2847
+ protected resetPosition(view: dia.ElementView, evt: dia.Event): void;
2641
2848
 
2642
2849
  protected updateHandle(handleNode: SVGElement): void;
2643
2850
  protected updateExtras(extrasNode: SVGElement): void;
@@ -2662,7 +2869,7 @@ export declare namespace elementTools {
2662
2869
  }
2663
2870
  }
2664
2871
 
2665
- export class HoverConnect extends linkTools.Connect {
2872
+ export class HoverConnect extends Connect {
2666
2873
 
2667
2874
  constructor(opt?: HoverConnect.Options);
2668
2875
  }
@@ -2714,6 +2921,11 @@ export declare namespace g {
2714
2921
  precision?: number;
2715
2922
  }
2716
2923
 
2924
+ export interface StrictOpt {
2925
+
2926
+ strict?: boolean;
2927
+ }
2928
+
2717
2929
  export interface SubdivisionsOpt extends PrecisionOpt {
2718
2930
 
2719
2931
  subdivisions?: Curve[];
@@ -3321,7 +3533,7 @@ export declare namespace g {
3321
3533
 
3322
3534
  clone(): Rect;
3323
3535
 
3324
- containsPoint(p: PlainPoint | string): boolean;
3536
+ containsPoint(p: PlainPoint | string, opt?: StrictOpt): boolean;
3325
3537
 
3326
3538
  containsRect(r: PlainRect): boolean;
3327
3539
 
@@ -3761,11 +3973,15 @@ export declare namespace linkTools {
3761
3973
  protected onPointerClick(evt: dia.Event): void;
3762
3974
  }
3763
3975
 
3764
- export interface Options extends dia.ToolView.Options {
3976
+ export interface VertexAddingOptions {
3977
+ interactiveLineNode: string;
3978
+ }
3979
+
3980
+ export interface Options extends dia.ToolView.Options<dia.LinkView> {
3765
3981
  handleClass?: typeof VertexHandle;
3766
3982
  snapRadius?: number;
3767
3983
  redundancyRemoval?: boolean;
3768
- vertexAdding?: boolean;
3984
+ vertexAdding?: boolean | Partial<VertexAddingOptions>;
3769
3985
  vertexRemoving?: boolean;
3770
3986
  vertexMoving?: boolean;
3771
3987
  stopPropagation?: boolean;
@@ -3773,7 +3989,7 @@ export declare namespace linkTools {
3773
3989
  }
3774
3990
  }
3775
3991
 
3776
- export class Vertices extends dia.ToolView {
3992
+ export class Vertices extends dia.ToolView<dia.LinkView> {
3777
3993
 
3778
3994
  constructor(opt?: Vertices.Options);
3779
3995
  }
@@ -3789,7 +4005,7 @@ export declare namespace linkTools {
3789
4005
  protected onPointerUp(evt: dia.Event): void;
3790
4006
  }
3791
4007
 
3792
- export interface Options extends dia.ToolView.Options {
4008
+ export interface Options extends dia.ToolView.Options<dia.LinkView> {
3793
4009
  handleClass?: typeof SegmentHandle;
3794
4010
  snapRadius?: number;
3795
4011
  snapHandle?: boolean;
@@ -3801,19 +4017,19 @@ export declare namespace linkTools {
3801
4017
  }
3802
4018
  }
3803
4019
 
3804
- export class Segments extends dia.ToolView {
4020
+ export class Segments extends dia.ToolView<dia.LinkView> {
3805
4021
 
3806
4022
  constructor(opt?: Segments.Options);
3807
4023
  }
3808
4024
 
3809
4025
  export namespace Arrowhead {
3810
4026
 
3811
- export interface Options extends dia.ToolView.Options {
4027
+ export interface Options extends dia.ToolView.Options<dia.LinkView> {
3812
4028
  scale?: number;
3813
4029
  }
3814
4030
  }
3815
4031
 
3816
- export abstract class Arrowhead extends dia.ToolView {
4032
+ export abstract class Arrowhead extends dia.ToolView<dia.LinkView> {
3817
4033
 
3818
4034
  ratio: number;
3819
4035
  arrowheadType: string;
@@ -3838,7 +4054,7 @@ export declare namespace linkTools {
3838
4054
  }
3839
4055
 
3840
4056
  export namespace Anchor {
3841
- export interface Options extends dia.ToolView.Options {
4057
+ export interface Options extends dia.ToolView.Options<dia.LinkView> {
3842
4058
  snap?: AnchorCallback<dia.Point>;
3843
4059
  anchor?: AnchorCallback<anchors.AnchorJSON>;
3844
4060
  resetAnchor?: boolean | anchors.AnchorJSON;
@@ -3852,7 +4068,7 @@ export declare namespace linkTools {
3852
4068
  }
3853
4069
  }
3854
4070
 
3855
- export abstract class Anchor extends dia.ToolView {
4071
+ export abstract class Anchor extends dia.ToolView<dia.LinkView> {
3856
4072
 
3857
4073
  type: string;
3858
4074
 
@@ -3871,10 +4087,14 @@ export declare namespace linkTools {
3871
4087
 
3872
4088
  export namespace Button {
3873
4089
 
3874
- export type ActionCallback = (evt: dia.Event, view: dia.LinkView, tool: dia.ToolView) => void;
4090
+ export type ActionCallback = (evt: dia.Event, view: dia.LinkView, tool: Button) => void;
3875
4091
 
3876
- export interface Options extends dia.ToolView.Options {
3877
- distance?: number | string;
4092
+ export type Distance = number | string;
4093
+
4094
+ export type DistanceCallback = (this: Button, view: dia.LinkView, tool: Button) => Distance;
4095
+
4096
+ export interface Options extends dia.ToolView.Options<dia.LinkView> {
4097
+ distance?: Distance | DistanceCallback;
3878
4098
  offset?: number;
3879
4099
  rotate?: boolean;
3880
4100
  action?: ActionCallback;
@@ -3883,7 +4103,7 @@ export declare namespace linkTools {
3883
4103
  }
3884
4104
  }
3885
4105
 
3886
- export class Button extends dia.ToolView {
4106
+ export class Button extends dia.ToolView<dia.LinkView> {
3887
4107
 
3888
4108
  constructor(opt?: Button.Options);
3889
4109
 
@@ -3917,13 +4137,13 @@ export declare namespace linkTools {
3917
4137
  }
3918
4138
 
3919
4139
  export namespace Boundary {
3920
- export interface Options extends dia.ToolView.Options {
4140
+ export interface Options extends dia.ToolView.Options<dia.LinkView> {
3921
4141
  padding?: number | dia.Sides;
3922
4142
  useModelGeometry?: boolean;
3923
4143
  }
3924
4144
  }
3925
4145
 
3926
- export class Boundary extends dia.ToolView {
4146
+ export class Boundary extends dia.ToolView<dia.LinkView> {
3927
4147
 
3928
4148
  constructor(opt?: Boundary.Options);
3929
4149
  }
@@ -3959,6 +4179,54 @@ export declare namespace linkTools {
3959
4179
 
3960
4180
  protected onMouseleave(evt: dia.Event): void;
3961
4181
  }
4182
+
4183
+ export namespace Control {
4184
+ export interface Options extends dia.ToolView.Options {
4185
+ selector?: string | null;
4186
+ padding?: number;
4187
+ handleAttributes?: Partial<attributes.NativeSVGAttributes>;
4188
+ scale?: number;
4189
+ }
4190
+ }
4191
+
4192
+ export abstract class Control<T extends mvc.ViewOptions<undefined, SVGElement> = Control.Options> extends dia.ToolView {
4193
+ options: T;
4194
+ constructor(opt?: T);
4195
+
4196
+ protected getPosition(view: dia.LinkView): dia.Point;
4197
+ protected setPosition(view: dia.LinkView, coordinates: g.Point): void;
4198
+ protected resetPosition(view: dia.LinkView): void;
4199
+
4200
+ protected updateHandle(handleNode: SVGElement): void;
4201
+ protected updateExtras(extrasNode: SVGElement): void;
4202
+ protected toggleExtras(visible: boolean): void;
4203
+
4204
+ protected onPointerDown(evt: dia.Event): void;
4205
+ protected onPointerMove(evt: dia.Event): void;
4206
+ protected onPointerUp(evt: dia.Event): void;
4207
+ protected onPointerDblClick(evt: dia.Event): void;
4208
+ }
4209
+
4210
+ export namespace RotateLabel {
4211
+
4212
+ export interface Options extends Control.Options {
4213
+ offset?: number | dia.Point;
4214
+ buttonColor?: string;
4215
+ iconColor?: string;
4216
+ outlineColor?: string;
4217
+ }
4218
+ }
4219
+
4220
+ export class RotateLabel extends Control<RotateLabel.Options> {
4221
+
4222
+ constructor(opt?: RotateLabel.Options);
4223
+
4224
+ protected getLabelPosition(label: dia.Link.Label): dia.Link.LabelPosition;
4225
+
4226
+ protected getLabelIndex(): number;
4227
+
4228
+ protected getLabel(): dia.Link.Label | null;
4229
+ }
3962
4230
  }
3963
4231
 
3964
4232
  export declare namespace mvc {
@@ -4913,6 +5181,14 @@ export declare namespace shapes {
4913
5181
 
4914
5182
  export declare namespace util {
4915
5183
 
5184
+ export function cloneCells(cells: dia.Cell[]): { [id: string]: dia.Cell };
5185
+
5186
+ export function isCalcExpression(value: any): boolean;
5187
+
5188
+ export function evalCalcFormula(formula: string, rect: g.PlainRect): number;
5189
+
5190
+ export function evalCalcExpression(expression: string, rect: g.PlainRect): string;
5191
+
4916
5192
  export function hashCode(str: string): string;
4917
5193
 
4918
5194
  export function getByPath(object: { [key: string]: any }, path: string | string[], delim?: string): any;
@@ -4983,6 +5259,8 @@ export declare namespace util {
4983
5259
 
4984
5260
  export function toggleFullScreen(el?: Element): void;
4985
5261
 
5262
+ export function objectDifference(object: object, base: object, opt?: { maxDepth?: number }): object;
5263
+
4986
5264
  export interface DOMJSONDocument {
4987
5265
  fragment: DocumentFragment;
4988
5266
  selectors: { [key: string]: Element };