@joint/core 4.1.3 → 4.2.0-alpha.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.
Files changed (58) hide show
  1. package/README.md +4 -2
  2. package/dist/geometry.js +129 -124
  3. package/dist/geometry.min.js +4 -3
  4. package/dist/joint.d.ts +352 -160
  5. package/dist/joint.js +3654 -2191
  6. package/dist/joint.min.js +4 -3
  7. package/dist/joint.nowrap.js +3653 -2188
  8. package/dist/joint.nowrap.min.js +4 -3
  9. package/dist/vectorizer.js +489 -279
  10. package/dist/vectorizer.min.js +4 -3
  11. package/dist/version.mjs +1 -1
  12. package/package.json +33 -27
  13. package/src/V/create.mjs +51 -0
  14. package/src/V/index.mjs +89 -159
  15. package/src/V/namespace.mjs +9 -0
  16. package/src/V/transform.mjs +183 -0
  17. package/src/V/traverse.mjs +16 -0
  18. package/src/alg/Deque.mjs +126 -0
  19. package/src/anchors/index.mjs +140 -33
  20. package/src/cellTools/Boundary.mjs +15 -13
  21. package/src/cellTools/Button.mjs +7 -5
  22. package/src/cellTools/Control.mjs +38 -15
  23. package/src/cellTools/HoverConnect.mjs +5 -1
  24. package/src/cellTools/helpers.mjs +44 -3
  25. package/src/config/index.mjs +8 -0
  26. package/src/connectionPoints/index.mjs +24 -9
  27. package/src/connectionStrategies/index.mjs +1 -1
  28. package/src/connectors/jumpover.mjs +1 -1
  29. package/src/dia/Cell.mjs +32 -12
  30. package/src/dia/CellView.mjs +53 -38
  31. package/src/dia/Element.mjs +81 -35
  32. package/src/dia/ElementView.mjs +2 -1
  33. package/src/dia/HighlighterView.mjs +54 -11
  34. package/src/dia/LinkView.mjs +118 -98
  35. package/src/dia/Paper.mjs +831 -231
  36. package/src/dia/PaperLayer.mjs +9 -2
  37. package/src/dia/ToolView.mjs +4 -0
  38. package/src/dia/ToolsView.mjs +12 -3
  39. package/src/dia/attributes/text.mjs +16 -5
  40. package/src/dia/layers/GridLayer.mjs +5 -0
  41. package/src/dia/ports.mjs +344 -111
  42. package/src/elementTools/HoverConnect.mjs +14 -8
  43. package/src/env/index.mjs +7 -4
  44. package/src/g/rect.mjs +7 -0
  45. package/src/highlighters/stroke.mjs +1 -1
  46. package/src/layout/ports/port.mjs +30 -15
  47. package/src/layout/ports/portLabel.mjs +1 -1
  48. package/src/linkAnchors/index.mjs +2 -2
  49. package/src/linkTools/Anchor.mjs +2 -2
  50. package/src/linkTools/Vertices.mjs +4 -6
  51. package/src/mvc/View.mjs +4 -0
  52. package/src/mvc/ViewBase.mjs +1 -1
  53. package/src/util/util.mjs +1 -1
  54. package/src/util/utilHelpers.mjs +2 -0
  55. package/types/geometry.d.ts +65 -59
  56. package/types/joint.d.ts +278 -102
  57. package/types/vectorizer.d.ts +11 -1
  58. package/src/V/annotation.mjs +0 -0
package/types/joint.d.ts CHANGED
@@ -8,6 +8,8 @@ export namespace config {
8
8
  var classNamePrefix: string;
9
9
  var defaultTheme: string;
10
10
  var doubleTapInterval: number;
11
+ var cellMergeStrategy: util.MergeCustomizer | null;
12
+ var cellDefaultsMergeStrategy: util.MergeCustomizer | null;
11
13
  }
12
14
 
13
15
  type NativeEvent = Event;
@@ -333,6 +335,7 @@ export namespace dia {
333
335
  interface GenericAttributes<T> {
334
336
  attrs?: T;
335
337
  z?: number;
338
+ layer?: string;
336
339
  [key: string]: any;
337
340
  }
338
341
 
@@ -521,6 +524,8 @@ export namespace dia {
521
524
 
522
525
  getBBox(): g.Rect;
523
526
 
527
+ getCenter(): g.Point;
528
+
524
529
  getPointFromConnectedLink(link: dia.Link, endType: dia.LinkEnd): g.Point;
525
530
 
526
531
  getPointRotatedAroundCenter(angle: number, x: number, y: number): g.Point;
@@ -536,6 +541,8 @@ export namespace dia {
536
541
 
537
542
  static define(type: string, defaults?: any, protoProps?: any, staticProps?: any): Cell.Constructor<Cell>;
538
543
 
544
+ static getAttributeDefinition(attrName: string): Cell.PresentationAttributeDefinition<CellView> | null;
545
+
539
546
  /**
540
547
  * @deprecated
541
548
  */
@@ -560,23 +567,40 @@ export namespace dia {
560
567
  interface Attributes extends GenericAttributes<Cell.Selectors> {
561
568
  }
562
569
 
563
- type PortPositionCallback = (ports: Port[], bbox: g.Rect) => dia.Point[];
570
+ interface ConstructorOptions extends Cell.ConstructorOptions {
571
+ portLayoutNamespace?: { [key: string]: layout.Port.LayoutFunction };
572
+ portLabelLayoutNamespace?: { [key: string]: layout.PortLabel.LayoutFunction };
573
+ }
574
+
575
+ type PortPositionCallback = layout.Port.LayoutFunction;
576
+
577
+ type PortLabelPositionCallback = layout.PortLabel.LayoutFunction;
564
578
 
565
579
  interface PortPositionJSON {
566
580
  name?: string;
567
- args?: { [key: string]: any };
581
+ args?: layout.Port.Options;
582
+ }
583
+
584
+ interface PortLabelPositionJSON {
585
+ name?: string;
586
+ args?: layout.PortLabel.Options;
568
587
  }
569
588
 
570
589
  type PositionType = string | PortPositionCallback | PortPositionJSON;
571
590
 
591
+ type PortLabelPositionType = PortLabelPositionCallback | PortPositionJSON;
592
+
572
593
  interface PortGroup {
573
594
  position?: PositionType;
574
595
  markup?: string | MarkupJSON;
575
596
  attrs?: Cell.Selectors;
576
- label?: {
577
- markup?: string | MarkupJSON;
578
- position?: PositionType;
579
- };
597
+ size?: Size;
598
+ label?: PortLabel;
599
+ }
600
+
601
+ interface PortLabel {
602
+ markup?: string | MarkupJSON;
603
+ position?: PortLabelPositionType;
580
604
  }
581
605
 
582
606
  interface Port {
@@ -584,11 +608,13 @@ export namespace dia {
584
608
  markup?: string | MarkupJSON;
585
609
  group?: string;
586
610
  attrs?: Cell.Selectors;
587
- args?: { [key: string]: any };
588
- label?: {
589
- markup?: string | MarkupJSON;
590
- position?: PositionType;
611
+ position?: {
612
+ args?: layout.Port.Options;
591
613
  };
614
+ /** @deprecated use `position.args` instead */
615
+ args?: layout.Port.Options;
616
+ size?: Size;
617
+ label?: PortLabel;
592
618
  z?: number | 'auto';
593
619
  }
594
620
 
@@ -596,6 +622,10 @@ export namespace dia {
596
622
  angle: number;
597
623
  }
598
624
 
625
+ interface PortRect extends BBox {
626
+ angle: number;
627
+ }
628
+
599
629
  interface TranslateOptions extends Cell.Options {
600
630
  restrictedArea?: BBox | Paper.PointConstraintCallback;
601
631
  transition?: Cell.TransitionOptions;
@@ -610,13 +640,32 @@ export namespace dia {
610
640
  direction?: Direction;
611
641
  }
612
642
 
613
- interface BBoxOptions extends Cell.EmbeddableOptions {
643
+ interface FitToChildrenOptions {
644
+ filter?: (cell: Cell) => boolean;
645
+ deep?: boolean;
646
+ padding?: Padding;
647
+ minRect?: Partial<BBox>;
648
+ expandOnly?: boolean;
649
+ shrinkOnly?: boolean;
650
+ }
651
+
652
+ interface FitParentOptions extends FitToChildrenOptions {
653
+ terminator?: Cell | Cell.ID;
654
+ }
655
+
656
+ interface RotateOptions {
614
657
  rotate?: boolean;
615
658
  }
659
+
660
+ interface BBoxOptions extends Cell.EmbeddableOptions, RotateOptions {
661
+
662
+ }
616
663
  }
617
664
 
618
665
  class Element<A extends ObjectHash = Element.Attributes, S extends mvc.ModelSetOptions = dia.ModelSetOptions> extends Cell<A, S> {
619
666
 
667
+ constructor(attributes?: DeepPartial<A>, opt?: Element.ConstructorOptions);
668
+
620
669
  translate(tx: number, ty?: number, opt?: Element.TranslateOptions): this;
621
670
 
622
671
  position(opt?: Element.PositionOptions): g.Point;
@@ -634,10 +683,10 @@ export namespace dia {
634
683
 
635
684
  scale(scaleX: number, scaleY: number, origin?: Point, opt?: { [key: string]: any }): this;
636
685
 
637
- fitEmbeds(opt?: { deep?: boolean, padding?: Padding, expandOnly?: boolean, shrinkOnly?: boolean }): this;
638
- fitToChildren(opt?: { deep?: boolean, padding?: Padding, expandOnly?: boolean, shrinkOnly?: boolean }): this;
686
+ fitEmbeds(opt?: Element.FitToChildrenOptions): this;
687
+ fitToChildren(opt?: Element.FitToChildrenOptions): this;
639
688
 
640
- fitParent(opt?: { deep?: boolean, padding?: Padding, expandOnly?: boolean, shrinkOnly?: boolean, terminator?: Cell | Cell.ID }): this;
689
+ fitParent(opt?: Element.FitParentOptions): this;
641
690
 
642
691
  getBBox(opt?: Element.BBoxOptions): g.Rect;
643
692
 
@@ -664,6 +713,14 @@ export namespace dia {
664
713
 
665
714
  getPortsPositions(groupName: string): { [id: string]: Element.PortPosition };
666
715
 
716
+ getPortRelativePosition(portId: string): Element.PortPosition;
717
+
718
+ getPortRelativeRect(portId: string): Element.PortRect;
719
+
720
+ getPortCenter(portId: string): g.Point;
721
+
722
+ getPortBBox(portId: string, opt?: Element.RotateOptions): g.Rect;
723
+
667
724
  getPortIndex(port: string | Element.Port): number;
668
725
 
669
726
  getPortGroupNames(): string[];
@@ -946,6 +1003,10 @@ export namespace dia {
946
1003
 
947
1004
  isIntersecting(geometryShape: g.Shape, geometryData?: g.SegmentSubdivisionsOpt | null): boolean;
948
1005
 
1006
+ cleanNodesCache(): void;
1007
+
1008
+ cleanNodeCache(node: SVGElement): void
1009
+
949
1010
  protected isEnclosedIn(area: g.Rect): boolean;
950
1011
 
951
1012
  protected isInArea(area: g.Rect, options: g.StrictOpt): boolean;
@@ -1002,8 +1063,6 @@ export namespace dia {
1002
1063
 
1003
1064
  protected addLinkFromMagnet(magnet: SVGElement, x: number, y: number): LinkView;
1004
1065
 
1005
- protected cleanNodesCache(): void;
1006
-
1007
1066
  protected nodeCache(magnet: SVGElement): CellView.NodeMetrics;
1008
1067
 
1009
1068
  protected getNodeData(magnet: SVGElement): CellView.NodeData;
@@ -1326,36 +1385,94 @@ export namespace dia {
1326
1385
  GRID = 'grid',
1327
1386
  }
1328
1387
 
1329
- type UpdateStats = {
1388
+ interface RenderStats {
1330
1389
  priority: number;
1331
1390
  updated: number;
1332
- empty?: boolean;
1333
- postponed?: number;
1334
- unmounted?: number;
1335
- mounted?: number;
1391
+ }
1392
+
1393
+ interface UpdateVisibilityStats {
1394
+ mounted: number;
1395
+ unmounted: number;
1396
+ }
1397
+
1398
+ interface RenderBatchStats extends RenderStats, UpdateVisibilityStats {
1399
+ postponed: number;
1400
+ empty: boolean;
1401
+ }
1402
+
1403
+ type UpdateStats = RenderStats & Partial<RenderBatchStats> & {
1336
1404
  batches?: number;
1337
1405
  };
1338
1406
 
1339
1407
  type ViewportCallback = (view: mvc.View<any, any>, isMounted: boolean, paper: Paper) => boolean;
1408
+ type CellVisibilityCallback = (cell: Cell, isMounted: boolean, paper: Paper) => boolean;
1340
1409
  type ProgressCallback = (done: boolean, processed: number, total: number, stats: UpdateStats, paper: Paper) => void;
1341
1410
  type BeforeRenderCallback = (opt: { [key: string]: any }, paper: Paper) => void;
1342
1411
  type AfterRenderCallback = (stats: UpdateStats, opt: { [key: string]: any }, paper: Paper) => void;
1343
1412
 
1344
- interface FreezeOptions {
1345
- key?: string;
1413
+ interface CellVisibilityOptions {
1414
+ cellVisibility?: CellVisibilityCallback | null;
1415
+
1416
+ /** @deprecated disable `legacyMode` and use `cellVisibility` instead */
1417
+ viewport?: ViewportCallback | null;
1346
1418
  }
1347
1419
 
1348
- interface UnfreezeOptions {
1349
- key?: string;
1420
+ interface MountOptions {
1350
1421
  mountBatchSize?: number;
1422
+ }
1423
+
1424
+ interface UnmountOptions {
1351
1425
  unmountBatchSize?: number;
1426
+ }
1427
+
1428
+ interface BatchSizeOptions {
1352
1429
  batchSize?: number;
1353
- viewport?: ViewportCallback;
1354
- progress?: ProgressCallback;
1430
+ }
1431
+
1432
+ interface BeforeRenderOptions {
1355
1433
  beforeRender?: BeforeRenderCallback;
1434
+ }
1435
+
1436
+ interface AfterRenderOptions {
1356
1437
  afterRender?: AfterRenderCallback;
1357
1438
  }
1358
1439
 
1440
+ interface RenderCallbackOptions extends BeforeRenderOptions, AfterRenderOptions, mvc.Silenceable {
1441
+
1442
+ }
1443
+
1444
+ interface KeyOptions {
1445
+ key?: string;
1446
+ }
1447
+
1448
+ interface UpdateViewOptions {
1449
+ [key: string]: any;
1450
+ }
1451
+
1452
+ interface UpdateViewsBatchOptions extends UpdateViewOptions, BatchSizeOptions, CellVisibilityOptions {
1453
+
1454
+ }
1455
+
1456
+ interface UpdateViewsOptions extends UpdateViewsBatchOptions, RenderCallbackOptions {
1457
+
1458
+ }
1459
+
1460
+ interface UpdateViewsAsyncOptions extends UpdateViewsBatchOptions, ScheduleCellsVisibilityUpdateOptions, RenderCallbackOptions {
1461
+ progress?: ProgressCallback;
1462
+ }
1463
+
1464
+ interface ScheduleCellsVisibilityUpdateOptions extends CellVisibilityOptions, MountOptions, UnmountOptions {
1465
+
1466
+ }
1467
+
1468
+ interface FreezeOptions extends KeyOptions {
1469
+
1470
+ }
1471
+
1472
+ interface UnfreezeOptions extends KeyOptions, UpdateViewsAsyncOptions, UpdateViewsOptions {
1473
+
1474
+ }
1475
+
1359
1476
  interface SnapLinksOptions {
1360
1477
  radius?: number;
1361
1478
  findInAreaOptions?: FindInAreaOptions;
@@ -1365,8 +1482,9 @@ export namespace dia {
1365
1482
  type RestrictTranslateCallback = (elementView: ElementView, x0: number, y0: number) => BBox | boolean | PointConstraintCallback;
1366
1483
  type FindParentByType = 'bbox' | 'pointer' | PositionName;
1367
1484
  type FindParentByCallback = ((this: dia.Graph, elementView: ElementView, evt: dia.Event, x: number, y: number) => Cell[]);
1485
+ type MeasureNodeCallback = (node: SVGGraphicsElement, cellView: dia.CellView) => g.Rect;
1368
1486
 
1369
- interface Options extends mvc.ViewOptions<Graph> {
1487
+ interface Options extends mvc.ViewOptions<Graph>, CellVisibilityOptions, BeforeRenderOptions, AfterRenderOptions {
1370
1488
  // appearance
1371
1489
  width?: Dimension;
1372
1490
  height?: Dimension;
@@ -1400,6 +1518,7 @@ export namespace dia {
1400
1518
  // views
1401
1519
  elementView?: typeof ElementView | ((element: Element) => typeof ElementView);
1402
1520
  linkView?: typeof LinkView | ((link: Link) => typeof LinkView);
1521
+ measureNode?: MeasureNodeCallback;
1403
1522
  // embedding
1404
1523
  embeddingMode?: boolean;
1405
1524
  frontParentOnly?: boolean;
@@ -1427,14 +1546,17 @@ export namespace dia {
1427
1546
  sorting?: sorting;
1428
1547
  frozen?: boolean;
1429
1548
  autoFreeze?: boolean;
1430
- viewport?: ViewportCallback | null;
1549
+ viewManagement?: ViewManagementOptions | boolean;
1431
1550
  onViewUpdate?: (view: mvc.View<any, any>, flag: number, priority: number, opt: { [key: string]: any }, paper: Paper) => void;
1432
1551
  onViewPostponed?: (view: mvc.View<any, any>, flag: number, paper: Paper) => boolean;
1433
- beforeRender?: Paper.BeforeRenderCallback;
1434
- afterRender?: Paper.AfterRenderCallback;
1435
1552
  overflow?: boolean;
1436
1553
  }
1437
1554
 
1555
+ interface ViewManagementOptions {
1556
+ lazyInitialize?: boolean;
1557
+ disposeHidden?: boolean;
1558
+ }
1559
+
1438
1560
  interface TransformToFitContentOptions {
1439
1561
  padding?: Padding;
1440
1562
  preserveAspectRatio?: boolean;
@@ -1567,6 +1689,17 @@ export namespace dia {
1567
1689
 
1568
1690
  interface FindInAreaOptions extends Graph.FindInAreaOptions, BufferOptions {
1569
1691
  }
1692
+
1693
+ interface FindClosestMagnetToPointOptions {
1694
+ radius?: number;
1695
+ findInAreaOptions?: FindInAreaOptions;
1696
+ filter?: (view: CellView, magnet: SVGElement) => boolean;
1697
+ }
1698
+
1699
+ interface ClosestMagnet {
1700
+ view: CellView;
1701
+ magnet: SVGElement;
1702
+ }
1570
1703
  }
1571
1704
 
1572
1705
  class Paper extends mvc.View<Graph> {
@@ -1702,6 +1835,13 @@ export namespace dia {
1702
1835
  */
1703
1836
  findCellViewsInArea(area: BBox, opt?: Paper.FindInAreaOptions): CellView[];
1704
1837
 
1838
+ /**
1839
+ * Finds the closest magnet to the specified point
1840
+ * @param point a point in local paper coordinates
1841
+ * @param opt options for the search
1842
+ */
1843
+ findClosestMagnetToPoint(point: Point, opt?: Paper.FindClosestMagnetToPointOptions): Paper.ClosestMagnet | null;
1844
+
1705
1845
  fitToContent(opt?: Paper.FitToContentOptions): g.Rect;
1706
1846
  fitToContent(gridWidth?: number, gridHeight?: number, padding?: number, opt?: any): g.Rect;
1707
1847
 
@@ -1751,7 +1891,7 @@ export namespace dia {
1751
1891
 
1752
1892
  getLayerNode(layerName: Paper.Layers | string): SVGGElement;
1753
1893
 
1754
- getLayerView(layerName: Paper.Layers | string): any;
1894
+ getLayerView(layerName: Paper.Layers | string): PaperLayer;
1755
1895
 
1756
1896
  hasLayerView(layerName: Paper.Layers | string): boolean;
1757
1897
 
@@ -1761,44 +1901,48 @@ export namespace dia {
1761
1901
 
1762
1902
  protected resetLayers(): void;
1763
1903
 
1904
+ addLayer(layerName: string, layerView: PaperLayer, options?: { insertBefore?: string }): void;
1905
+
1906
+ removeLayer(layer: string | PaperLayer): void;
1907
+
1908
+ moveLayer(layer: string | PaperLayer, insertBefore: string | PaperLayer | null): void;
1909
+
1910
+ hasLayer(layer: string | PaperLayer): boolean;
1911
+
1912
+ getLayerNames(): string[];
1913
+
1914
+ getLayers(): Array<PaperLayer>;
1915
+
1764
1916
  // rendering
1765
1917
 
1766
1918
  freeze(opt?: Paper.FreezeOptions): void;
1767
1919
 
1768
1920
  unfreeze(opt?: Paper.UnfreezeOptions): void;
1769
1921
 
1922
+ wakeUp(): void;
1923
+
1770
1924
  isFrozen(): boolean;
1771
1925
 
1772
1926
  requestViewUpdate(view: mvc.View<any, any>, flag: number, priority: number, opt?: { [key: string]: any }): void;
1773
1927
 
1774
- requireView<T extends ElementView | LinkView>(model: Cell | Cell.ID, opt?: dia.Cell.Options): T;
1928
+ requireView<T extends ElementView | LinkView>(cellOrId: Cell | Cell.ID, opt?: Paper.UpdateViewOptions & Paper.RenderCallbackOptions): T;
1775
1929
 
1776
- dumpViews(opt?: {
1777
- batchSize?: number;
1778
- mountBatchSize?: number;
1779
- unmountBatchSize?: number;
1780
- viewport?: Paper.ViewportCallback;
1781
- }): void;
1930
+ updateViews(opt?: Paper.UpdateViewsOptions): Paper.RenderStats & { batches: number };
1782
1931
 
1783
- checkViewport(opt?: {
1784
- mountBatchSize?: number;
1785
- unmountBatchSize?: number;
1786
- viewport?: Paper.ViewportCallback;
1787
- }): {
1788
- mounted: number;
1789
- unmounted: number;
1790
- };
1932
+ hasScheduledUpdates(): boolean;
1791
1933
 
1792
- updateViews(opt?: {
1793
- batchSize?: number;
1794
- viewport?: Paper.ViewportCallback;
1795
- }): {
1796
- updated: number;
1797
- batches: number;
1798
- priority: number;
1799
- };
1934
+ disposeHiddenCellViews(): void;
1800
1935
 
1801
- hasScheduledUpdates(): boolean;
1936
+ isCellVisible(cellOrId: dia.Cell | dia.Cell.ID): boolean;
1937
+
1938
+ updateCellVisibility(
1939
+ cell: Cell | Cell.ID,
1940
+ opt?: Paper.CellVisibilityOptions & Paper.UpdateViewOptions & Paper.RenderCallbackOptions
1941
+ ): void;
1942
+
1943
+ updateCellsVisibility(
1944
+ opt?: Paper.ScheduleCellsVisibilityUpdateOptions & Paper.UpdateViewsOptions
1945
+ ): void;
1802
1946
 
1803
1947
  // events
1804
1948
 
@@ -1809,52 +1953,51 @@ export namespace dia {
1809
1953
  // protected
1810
1954
 
1811
1955
  /**
1812
- * For the specified view, calls the visibility viewport function specified by the paper.options.viewport function.
1956
+ * For the specified view, calls the cell visibility function specified by the `paper.options.cellVisibility` function.
1813
1957
  * If the function returns true, the view is attached to the DOM; in other case it is detached.
1814
- * 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().
1815
- * 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.
1958
+ * 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()`.
1959
+ * If you are using `autoFreeze` option you should call this function if you are calling `paper.requestView()` if you want `paper.options.cellVisibility` function to be applied.
1816
1960
  * @param cellView cellView for which the visibility check is performed
1817
- * @param opt if opt.viewport is provided, it is used as the callback function instead of paper.options.viewport.
1961
+ * @param opt if opt.cellVisibility is provided, it is used as the callback function instead of paper.options.cellVisibility.
1818
1962
  */
1819
- protected checkViewVisibility(cellView: dia.CellView, opt?: {
1820
- viewport?: Paper.ViewportCallback;
1821
- }): {
1822
- mounted: number;
1823
- unmounted: number;
1824
- };
1963
+ protected checkViewVisibility(
1964
+ cellView: dia.CellView,
1965
+ opt?: Paper.CellVisibilityOptions
1966
+ ): Paper.UpdateVisibilityStats;
1967
+
1968
+
1969
+ protected scheduleCellsVisibilityUpdate(opt?: Paper.ScheduleCellsVisibilityUpdateOptions): Paper.UpdateVisibilityStats;
1825
1970
 
1826
1971
  protected scheduleViewUpdate(view: mvc.View<any, any>, flag: number, priority: number, opt?: { [key: string]: any }): void;
1827
1972
 
1828
1973
  protected dumpViewUpdate(view: mvc.View<any, any>): number;
1829
1974
 
1830
- protected dumpView(view: mvc.View<any, any>, opt?: { [key: string]: any }): number;
1975
+ protected dumpView(view: mvc.View<any, any>, opt?: Paper.UpdateViewOptions & Paper.RenderCallbackOptions): number;
1831
1976
 
1832
- protected updateView(view: mvc.View<any, any>, flag: number, opt?: { [key: string]: any }): number;
1977
+ protected updateView(view: mvc.View<any, any>, flag: number, opt?: Paper.UpdateViewOptions): number;
1833
1978
 
1834
1979
  protected registerUnmountedView(view: mvc.View<any, any>): number;
1835
1980
 
1836
1981
  protected registerMountedView(view: mvc.View<any, any>): number;
1837
1982
 
1838
- protected updateViewsAsync(opt?: {
1839
- batchSize?: number;
1840
- mountBatchSize?: number;
1841
- unmountBatchSize?: number;
1842
- viewport?: Paper.ViewportCallback;
1843
- progress?: Paper.ProgressCallback;
1844
- before?: Paper.BeforeRenderCallback;
1845
- }): void;
1983
+ protected updateViewsAsync(opt?: Paper.UpdateViewsAsyncOptions): void;
1846
1984
 
1847
- protected updateViewsBatch(opt?: {
1848
- batchSize?: number;
1849
- viewport?: Paper.ViewportCallback;
1850
- }): Paper.UpdateStats;
1985
+ protected updateViewsBatch(opt?: Paper.UpdateViewsBatchOptions): Paper.RenderBatchStats;
1986
+
1987
+ protected checkMountedViews(viewport: Paper.ViewportCallback, opt?: Paper.UnmountOptions): number;
1988
+
1989
+ protected checkUnmountedViews(viewport: Paper.ViewportCallback, opt?: Paper.MountOptions): number;
1851
1990
 
1852
- protected checkMountedViews(viewport: Paper.ViewportCallback, opt?: { unmountBatchSize?: number }): number;
1991
+ protected prioritizeCellViewMount(cellOrId: dia.Cell | dia.Cell.ID): boolean;
1853
1992
 
1854
- protected checkUnmountedViews(viewport: Paper.ViewportCallback, opt?: { mountBatchSize?: number }): number;
1993
+ protected prioritizeCellViewUnmount(cellOrId: dia.Cell | dia.Cell.ID): boolean;
1994
+
1995
+ protected isViewMounted(viewOrCid: dia.CellView | string): boolean;
1855
1996
 
1856
1997
  protected isAsync(): boolean;
1857
1998
 
1999
+ protected isIdle(): boolean;
2000
+
1858
2001
  protected isExactSorting(): boolean;
1859
2002
 
1860
2003
  protected sortViews(): void;
@@ -1930,7 +2073,9 @@ export namespace dia {
1930
2073
 
1931
2074
  protected insertView(cellView: CellView, isInitialInsert: boolean): void;
1932
2075
 
1933
- protected detachView(cellView: CellView): void;
2076
+ protected _hideCellView(cellView: CellView): void;
2077
+
2078
+ protected _detachCellView(cellView: CellView): void;
1934
2079
 
1935
2080
  protected customEventTrigger(event: dia.Event, view: CellView, rootNode?: SVGElement): dia.Event | null;
1936
2081
 
@@ -1950,6 +2095,16 @@ export namespace dia {
1950
2095
  * @deprecated use transformToFitContent
1951
2096
  */
1952
2097
  scaleContentToFit(opt?: Paper.ScaleContentOptions): void;
2098
+
2099
+ /**
2100
+ * @deprecated Use `updateCellsVisibility()`
2101
+ */
2102
+ checkViewport(opt?: Paper.ScheduleCellsVisibilityUpdateOptions): Paper.UpdateVisibilityStats;
2103
+
2104
+ /**
2105
+ * @deprecated Use `updateCellsVisibility()`
2106
+ */
2107
+ dumpViews(opt?: Paper.ScheduleCellsVisibilityUpdateOptions & Paper.UpdateViewsOptions): void;
1953
2108
  }
1954
2109
 
1955
2110
  namespace PaperLayer {
@@ -2008,6 +2163,10 @@ export namespace dia {
2008
2163
  hide(): this;
2009
2164
 
2010
2165
  mount(): this;
2166
+
2167
+ getLayer(): string | null;
2168
+
2169
+ hasLayer(): boolean;
2011
2170
  }
2012
2171
 
2013
2172
  namespace ToolView {
@@ -2051,6 +2210,8 @@ export namespace dia {
2051
2210
 
2052
2211
  update(): void;
2053
2212
 
2213
+ isOverlay(): boolean;
2214
+
2054
2215
  protected guard(evt: dia.Event): boolean;
2055
2216
  }
2056
2217
 
@@ -2142,6 +2303,8 @@ export namespace dia {
2142
2303
  id?: string
2143
2304
  ): T[];
2144
2305
 
2306
+ static has(cellView: dia.CellView, id?: string): boolean;
2307
+
2145
2308
  static update(cellView: dia.CellView, id?: string): void;
2146
2309
 
2147
2310
  static transform(cellView: dia.CellView, id?: string): void;
@@ -2274,7 +2437,7 @@ export namespace highlighters {
2274
2437
  position?: Positions | dia.PositionName;
2275
2438
  size?: number | dia.Size;
2276
2439
  gap?: number;
2277
- margin?: number | dia.Sides;
2440
+ margin?: dia.Sides;
2278
2441
  }
2279
2442
  }
2280
2443
 
@@ -2625,19 +2788,21 @@ export namespace util {
2625
2788
 
2626
2789
  export function parseCssNumeric(val: any, restrictUnits: string | string[]): { value: number, unit?: string } | null;
2627
2790
 
2791
+ type BreakTextOptions = {
2792
+ svgDocument?: SVGElement;
2793
+ separator?: string | any;
2794
+ eol?: string;
2795
+ ellipsis?: boolean | string;
2796
+ hyphen?: string | RegExp;
2797
+ maxLineCount?: number;
2798
+ preserveSpaces?: boolean;
2799
+ }
2800
+
2628
2801
  type BreakTextFunction = (
2629
2802
  text: string,
2630
2803
  size: { width: number, height?: number },
2631
2804
  attrs?: attributes.NativeSVGAttributes,
2632
- opt?: {
2633
- svgDocument?: SVGElement;
2634
- separator?: string | any;
2635
- eol?: string;
2636
- ellipsis?: boolean | string;
2637
- hyphen?: string | RegExp;
2638
- maxLineCount?: number;
2639
- preserveSpaces?: boolean;
2640
- }
2805
+ opt?: BreakTextOptions
2641
2806
  ) => string;
2642
2807
 
2643
2808
  export var breakText: BreakTextFunction;
@@ -2898,6 +3063,8 @@ export namespace util {
2898
3063
 
2899
3064
  export function merge(destinationObject: object, ...args: any[]): object;
2900
3065
 
3066
+ type MergeCustomizer = (value: any, srcValue: any, key: string, object: any, source: any, stack: any) => any;
3067
+
2901
3068
  // ADDITIONAL SIMPLE UTIL FUNCTIONS:
2902
3069
 
2903
3070
  export function isBoolean(value: any): boolean;
@@ -2937,7 +3104,7 @@ export namespace layout {
2937
3104
  angle: number;
2938
3105
  };
2939
3106
 
2940
- type LayoutFunction = (ports: Array<Object>, elBBox: g.Rect, opt: Options) => Array<Transformation>;
3107
+ type LayoutFunction = (ports: Array<dia.Element.Port>, elBBox: g.Rect, opt: Options) => Array<Transformation>;
2941
3108
 
2942
3109
  interface Options {
2943
3110
  x?: number | string;
@@ -2950,9 +3117,11 @@ export namespace layout {
2950
3117
  startAngle?: number;
2951
3118
  step?: number;
2952
3119
  compensateRotation?: boolean;
3120
+ [key: string]: any;
2953
3121
  }
2954
3122
 
2955
3123
  export var absolute: LayoutFunction;
3124
+ /** @deprecated */
2956
3125
  export var fn: LayoutFunction;
2957
3126
  export var line: LayoutFunction;
2958
3127
  export var left: LayoutFunction;
@@ -2971,6 +3140,7 @@ export namespace layout {
2971
3140
  angle?: number;
2972
3141
  offset?: number;
2973
3142
  attrs?: dia.Cell.Selectors;
3143
+ [key: string]: any;
2974
3144
  }
2975
3145
 
2976
3146
  interface LabelAttributes {
@@ -3405,6 +3575,7 @@ export namespace mvc {
3405
3575
  collection?: Collection<any> | undefined; // was: Collection<TModel>;
3406
3576
  el?: $Element<TElement> | string | undefined;
3407
3577
  id?: string | undefined;
3578
+ cid?: string | undefined;
3408
3579
  attributes?: Record<string, any> | undefined;
3409
3580
  className?: string | undefined;
3410
3581
  tagName?: string | undefined;
@@ -3431,7 +3602,7 @@ export namespace mvc {
3431
3602
 
3432
3603
  /**
3433
3604
  * Events hash or a method returning the events hash that maps events/selectors to methods on your View.
3434
- * For assigning events as object hash, do it like this: this.events = <any>{ "event:selector": callback, ... };
3605
+ * For assigning events as object hash, do it like this: `this.events = <any>{ "event:selector": callback, ... };`
3435
3606
  * That works only if you set it in the constructor or the initialize method.
3436
3607
  */
3437
3608
  events(): EventsHash;
@@ -3447,9 +3618,9 @@ export namespace mvc {
3447
3618
 
3448
3619
  el: TElement;
3449
3620
  attributes: Record<string, any>;
3450
- /* @deprecated use `el` instead */
3621
+ /** @deprecated use `el` instead */
3451
3622
  $el: Dom;
3452
- /* @deprecated use `el.querySelector()` instead */
3623
+ /** @deprecated use `el.querySelector()` instead */
3453
3624
  $(selector: string): Dom;
3454
3625
  render(): this;
3455
3626
  remove(): this;
@@ -3784,7 +3955,11 @@ export namespace connectors {
3784
3955
 
3785
3956
  export namespace anchors {
3786
3957
 
3787
- interface RotateAnchorArguments {
3958
+ interface ElementAnchorArguments {
3959
+ useModelGeometry?: boolean;
3960
+ }
3961
+
3962
+ interface RotateAnchorArguments extends ElementAnchorArguments {
3788
3963
  rotate?: boolean;
3789
3964
  }
3790
3965
 
@@ -3793,12 +3968,13 @@ export namespace anchors {
3793
3968
  dy?: number | string;
3794
3969
  }
3795
3970
 
3796
- interface PaddingAnchorArguments {
3971
+ interface PaddingAnchorArguments extends ElementAnchorArguments {
3797
3972
  padding?: number;
3798
3973
  }
3799
3974
 
3800
3975
  interface MidSideAnchorArguments extends RotateAnchorArguments, PaddingAnchorArguments {
3801
-
3976
+ mode?: 'prefer-horizontal' | 'prefer-vertical' | 'horizontal' | 'vertical' | 'auto';
3977
+ preferenceThreshold?: dia.Sides;
3802
3978
  }
3803
3979
 
3804
3980
  interface ModelCenterAnchorArguments {
@@ -4356,7 +4532,7 @@ export namespace elementTools {
4356
4532
 
4357
4533
  namespace Boundary {
4358
4534
  interface Options extends dia.ToolView.Options<dia.ElementView> {
4359
- padding?: number | dia.Sides;
4535
+ padding?: dia.Sides;
4360
4536
  useModelGeometry?: boolean;
4361
4537
  rotate?: boolean;
4362
4538
  }
@@ -4599,7 +4775,7 @@ export namespace linkTools {
4599
4775
 
4600
4776
  namespace Boundary {
4601
4777
  interface Options extends dia.ToolView.Options<dia.LinkView> {
4602
- padding?: number | dia.Sides;
4778
+ padding?: dia.Sides;
4603
4779
  useModelGeometry?: boolean;
4604
4780
  }
4605
4781
  }