@joint/core 4.2.0-alpha.0 → 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.
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;
@@ -539,6 +541,8 @@ export namespace dia {
539
541
 
540
542
  static define(type: string, defaults?: any, protoProps?: any, staticProps?: any): Cell.Constructor<Cell>;
541
543
 
544
+ static getAttributeDefinition(attrName: string): Cell.PresentationAttributeDefinition<CellView> | null;
545
+
542
546
  /**
543
547
  * @deprecated
544
548
  */
@@ -563,24 +567,40 @@ export namespace dia {
563
567
  interface Attributes extends GenericAttributes<Cell.Selectors> {
564
568
  }
565
569
 
566
- 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;
567
578
 
568
579
  interface PortPositionJSON {
569
580
  name?: string;
570
- args?: { [key: string]: any };
581
+ args?: layout.Port.Options;
582
+ }
583
+
584
+ interface PortLabelPositionJSON {
585
+ name?: string;
586
+ args?: layout.PortLabel.Options;
571
587
  }
572
588
 
573
589
  type PositionType = string | PortPositionCallback | PortPositionJSON;
574
590
 
591
+ type PortLabelPositionType = PortLabelPositionCallback | PortPositionJSON;
592
+
575
593
  interface PortGroup {
576
594
  position?: PositionType;
577
595
  markup?: string | MarkupJSON;
578
596
  attrs?: Cell.Selectors;
579
597
  size?: Size;
580
- label?: {
581
- markup?: string | MarkupJSON;
582
- position?: PositionType;
583
- };
598
+ label?: PortLabel;
599
+ }
600
+
601
+ interface PortLabel {
602
+ markup?: string | MarkupJSON;
603
+ position?: PortLabelPositionType;
584
604
  }
585
605
 
586
606
  interface Port {
@@ -589,14 +609,12 @@ export namespace dia {
589
609
  group?: string;
590
610
  attrs?: Cell.Selectors;
591
611
  position?: {
592
- args?: { [key: string]: any };
612
+ args?: layout.Port.Options;
593
613
  };
594
- args?: { [key: string]: any };
614
+ /** @deprecated use `position.args` instead */
615
+ args?: layout.Port.Options;
595
616
  size?: Size;
596
- label?: {
597
- markup?: string | MarkupJSON;
598
- position?: PositionType;
599
- };
617
+ label?: PortLabel;
600
618
  z?: number | 'auto';
601
619
  }
602
620
 
@@ -626,7 +644,7 @@ export namespace dia {
626
644
  filter?: (cell: Cell) => boolean;
627
645
  deep?: boolean;
628
646
  padding?: Padding;
629
- minRect?: g.Rect;
647
+ minRect?: Partial<BBox>;
630
648
  expandOnly?: boolean;
631
649
  shrinkOnly?: boolean;
632
650
  }
@@ -646,6 +664,8 @@ export namespace dia {
646
664
 
647
665
  class Element<A extends ObjectHash = Element.Attributes, S extends mvc.ModelSetOptions = dia.ModelSetOptions> extends Cell<A, S> {
648
666
 
667
+ constructor(attributes?: DeepPartial<A>, opt?: Element.ConstructorOptions);
668
+
649
669
  translate(tx: number, ty?: number, opt?: Element.TranslateOptions): this;
650
670
 
651
671
  position(opt?: Element.PositionOptions): g.Point;
@@ -1365,36 +1385,94 @@ export namespace dia {
1365
1385
  GRID = 'grid',
1366
1386
  }
1367
1387
 
1368
- type UpdateStats = {
1388
+ interface RenderStats {
1369
1389
  priority: number;
1370
1390
  updated: number;
1371
- empty?: boolean;
1372
- postponed?: number;
1373
- unmounted?: number;
1374
- 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> & {
1375
1404
  batches?: number;
1376
1405
  };
1377
1406
 
1378
1407
  type ViewportCallback = (view: mvc.View<any, any>, isMounted: boolean, paper: Paper) => boolean;
1408
+ type CellVisibilityCallback = (cell: Cell, isMounted: boolean, paper: Paper) => boolean;
1379
1409
  type ProgressCallback = (done: boolean, processed: number, total: number, stats: UpdateStats, paper: Paper) => void;
1380
1410
  type BeforeRenderCallback = (opt: { [key: string]: any }, paper: Paper) => void;
1381
1411
  type AfterRenderCallback = (stats: UpdateStats, opt: { [key: string]: any }, paper: Paper) => void;
1382
1412
 
1383
- interface FreezeOptions {
1384
- key?: string;
1413
+ interface CellVisibilityOptions {
1414
+ cellVisibility?: CellVisibilityCallback | null;
1415
+
1416
+ /** @deprecated disable `legacyMode` and use `cellVisibility` instead */
1417
+ viewport?: ViewportCallback | null;
1385
1418
  }
1386
1419
 
1387
- interface UnfreezeOptions {
1388
- key?: string;
1420
+ interface MountOptions {
1389
1421
  mountBatchSize?: number;
1422
+ }
1423
+
1424
+ interface UnmountOptions {
1390
1425
  unmountBatchSize?: number;
1426
+ }
1427
+
1428
+ interface BatchSizeOptions {
1391
1429
  batchSize?: number;
1392
- viewport?: ViewportCallback;
1393
- progress?: ProgressCallback;
1430
+ }
1431
+
1432
+ interface BeforeRenderOptions {
1394
1433
  beforeRender?: BeforeRenderCallback;
1434
+ }
1435
+
1436
+ interface AfterRenderOptions {
1395
1437
  afterRender?: AfterRenderCallback;
1396
1438
  }
1397
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
+
1398
1476
  interface SnapLinksOptions {
1399
1477
  radius?: number;
1400
1478
  findInAreaOptions?: FindInAreaOptions;
@@ -1406,7 +1484,7 @@ export namespace dia {
1406
1484
  type FindParentByCallback = ((this: dia.Graph, elementView: ElementView, evt: dia.Event, x: number, y: number) => Cell[]);
1407
1485
  type MeasureNodeCallback = (node: SVGGraphicsElement, cellView: dia.CellView) => g.Rect;
1408
1486
 
1409
- interface Options extends mvc.ViewOptions<Graph> {
1487
+ interface Options extends mvc.ViewOptions<Graph>, CellVisibilityOptions, BeforeRenderOptions, AfterRenderOptions {
1410
1488
  // appearance
1411
1489
  width?: Dimension;
1412
1490
  height?: Dimension;
@@ -1468,14 +1546,17 @@ export namespace dia {
1468
1546
  sorting?: sorting;
1469
1547
  frozen?: boolean;
1470
1548
  autoFreeze?: boolean;
1471
- viewport?: ViewportCallback | null;
1549
+ viewManagement?: ViewManagementOptions | boolean;
1472
1550
  onViewUpdate?: (view: mvc.View<any, any>, flag: number, priority: number, opt: { [key: string]: any }, paper: Paper) => void;
1473
1551
  onViewPostponed?: (view: mvc.View<any, any>, flag: number, paper: Paper) => boolean;
1474
- beforeRender?: Paper.BeforeRenderCallback;
1475
- afterRender?: Paper.AfterRenderCallback;
1476
1552
  overflow?: boolean;
1477
1553
  }
1478
1554
 
1555
+ interface ViewManagementOptions {
1556
+ lazyInitialize?: boolean;
1557
+ disposeHidden?: boolean;
1558
+ }
1559
+
1479
1560
  interface TransformToFitContentOptions {
1480
1561
  padding?: Padding;
1481
1562
  preserveAspectRatio?: boolean;
@@ -1608,6 +1689,17 @@ export namespace dia {
1608
1689
 
1609
1690
  interface FindInAreaOptions extends Graph.FindInAreaOptions, BufferOptions {
1610
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
+ }
1611
1703
  }
1612
1704
 
1613
1705
  class Paper extends mvc.View<Graph> {
@@ -1743,6 +1835,13 @@ export namespace dia {
1743
1835
  */
1744
1836
  findCellViewsInArea(area: BBox, opt?: Paper.FindInAreaOptions): CellView[];
1745
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
+
1746
1845
  fitToContent(opt?: Paper.FitToContentOptions): g.Rect;
1747
1846
  fitToContent(gridWidth?: number, gridHeight?: number, padding?: number, opt?: any): g.Rect;
1748
1847
 
@@ -1820,38 +1919,30 @@ export namespace dia {
1820
1919
 
1821
1920
  unfreeze(opt?: Paper.UnfreezeOptions): void;
1822
1921
 
1922
+ wakeUp(): void;
1923
+
1823
1924
  isFrozen(): boolean;
1824
1925
 
1825
1926
  requestViewUpdate(view: mvc.View<any, any>, flag: number, priority: number, opt?: { [key: string]: any }): void;
1826
1927
 
1827
- 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;
1828
1929
 
1829
- dumpViews(opt?: {
1830
- batchSize?: number;
1831
- mountBatchSize?: number;
1832
- unmountBatchSize?: number;
1833
- viewport?: Paper.ViewportCallback;
1834
- }): void;
1930
+ updateViews(opt?: Paper.UpdateViewsOptions): Paper.RenderStats & { batches: number };
1835
1931
 
1836
- checkViewport(opt?: {
1837
- mountBatchSize?: number;
1838
- unmountBatchSize?: number;
1839
- viewport?: Paper.ViewportCallback;
1840
- }): {
1841
- mounted: number;
1842
- unmounted: number;
1843
- };
1932
+ hasScheduledUpdates(): boolean;
1844
1933
 
1845
- updateViews(opt?: {
1846
- batchSize?: number;
1847
- viewport?: Paper.ViewportCallback;
1848
- }): {
1849
- updated: number;
1850
- batches: number;
1851
- priority: number;
1852
- };
1934
+ disposeHiddenCellViews(): void;
1853
1935
 
1854
- 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;
1855
1946
 
1856
1947
  // events
1857
1948
 
@@ -1862,52 +1953,51 @@ export namespace dia {
1862
1953
  // protected
1863
1954
 
1864
1955
  /**
1865
- * 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.
1866
1957
  * If the function returns true, the view is attached to the DOM; in other case it is detached.
1867
- * 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().
1868
- * 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.
1869
1960
  * @param cellView cellView for which the visibility check is performed
1870
- * @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.
1871
1962
  */
1872
- protected checkViewVisibility(cellView: dia.CellView, opt?: {
1873
- viewport?: Paper.ViewportCallback;
1874
- }): {
1875
- mounted: number;
1876
- unmounted: number;
1877
- };
1963
+ protected checkViewVisibility(
1964
+ cellView: dia.CellView,
1965
+ opt?: Paper.CellVisibilityOptions
1966
+ ): Paper.UpdateVisibilityStats;
1967
+
1968
+
1969
+ protected scheduleCellsVisibilityUpdate(opt?: Paper.ScheduleCellsVisibilityUpdateOptions): Paper.UpdateVisibilityStats;
1878
1970
 
1879
1971
  protected scheduleViewUpdate(view: mvc.View<any, any>, flag: number, priority: number, opt?: { [key: string]: any }): void;
1880
1972
 
1881
1973
  protected dumpViewUpdate(view: mvc.View<any, any>): number;
1882
1974
 
1883
- 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;
1884
1976
 
1885
- 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;
1886
1978
 
1887
1979
  protected registerUnmountedView(view: mvc.View<any, any>): number;
1888
1980
 
1889
1981
  protected registerMountedView(view: mvc.View<any, any>): number;
1890
1982
 
1891
- protected updateViewsAsync(opt?: {
1892
- batchSize?: number;
1893
- mountBatchSize?: number;
1894
- unmountBatchSize?: number;
1895
- viewport?: Paper.ViewportCallback;
1896
- progress?: Paper.ProgressCallback;
1897
- before?: Paper.BeforeRenderCallback;
1898
- }): void;
1983
+ protected updateViewsAsync(opt?: Paper.UpdateViewsAsyncOptions): void;
1899
1984
 
1900
- protected updateViewsBatch(opt?: {
1901
- batchSize?: number;
1902
- viewport?: Paper.ViewportCallback;
1903
- }): 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;
1904
1990
 
1905
- protected checkMountedViews(viewport: Paper.ViewportCallback, opt?: { unmountBatchSize?: number }): number;
1991
+ protected prioritizeCellViewMount(cellOrId: dia.Cell | dia.Cell.ID): boolean;
1906
1992
 
1907
- 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;
1908
1996
 
1909
1997
  protected isAsync(): boolean;
1910
1998
 
1999
+ protected isIdle(): boolean;
2000
+
1911
2001
  protected isExactSorting(): boolean;
1912
2002
 
1913
2003
  protected sortViews(): void;
@@ -1983,7 +2073,9 @@ export namespace dia {
1983
2073
 
1984
2074
  protected insertView(cellView: CellView, isInitialInsert: boolean): void;
1985
2075
 
1986
- protected detachView(cellView: CellView): void;
2076
+ protected _hideCellView(cellView: CellView): void;
2077
+
2078
+ protected _detachCellView(cellView: CellView): void;
1987
2079
 
1988
2080
  protected customEventTrigger(event: dia.Event, view: CellView, rootNode?: SVGElement): dia.Event | null;
1989
2081
 
@@ -2003,6 +2095,16 @@ export namespace dia {
2003
2095
  * @deprecated use transformToFitContent
2004
2096
  */
2005
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;
2006
2108
  }
2007
2109
 
2008
2110
  namespace PaperLayer {
@@ -2061,6 +2163,10 @@ export namespace dia {
2061
2163
  hide(): this;
2062
2164
 
2063
2165
  mount(): this;
2166
+
2167
+ getLayer(): string | null;
2168
+
2169
+ hasLayer(): boolean;
2064
2170
  }
2065
2171
 
2066
2172
  namespace ToolView {
@@ -2104,6 +2210,8 @@ export namespace dia {
2104
2210
 
2105
2211
  update(): void;
2106
2212
 
2213
+ isOverlay(): boolean;
2214
+
2107
2215
  protected guard(evt: dia.Event): boolean;
2108
2216
  }
2109
2217
 
@@ -2195,6 +2303,8 @@ export namespace dia {
2195
2303
  id?: string
2196
2304
  ): T[];
2197
2305
 
2306
+ static has(cellView: dia.CellView, id?: string): boolean;
2307
+
2198
2308
  static update(cellView: dia.CellView, id?: string): void;
2199
2309
 
2200
2310
  static transform(cellView: dia.CellView, id?: string): void;
@@ -2327,7 +2437,7 @@ export namespace highlighters {
2327
2437
  position?: Positions | dia.PositionName;
2328
2438
  size?: number | dia.Size;
2329
2439
  gap?: number;
2330
- margin?: number | dia.Sides;
2440
+ margin?: dia.Sides;
2331
2441
  }
2332
2442
  }
2333
2443
 
@@ -2677,7 +2787,7 @@ export namespace util {
2677
2787
  export function isPercentage(val: any): boolean;
2678
2788
 
2679
2789
  export function parseCssNumeric(val: any, restrictUnits: string | string[]): { value: number, unit?: string } | null;
2680
-
2790
+
2681
2791
  type BreakTextOptions = {
2682
2792
  svgDocument?: SVGElement;
2683
2793
  separator?: string | any;
@@ -2687,7 +2797,7 @@ export namespace util {
2687
2797
  maxLineCount?: number;
2688
2798
  preserveSpaces?: boolean;
2689
2799
  }
2690
-
2800
+
2691
2801
  type BreakTextFunction = (
2692
2802
  text: string,
2693
2803
  size: { width: number, height?: number },
@@ -2953,6 +3063,8 @@ export namespace util {
2953
3063
 
2954
3064
  export function merge(destinationObject: object, ...args: any[]): object;
2955
3065
 
3066
+ type MergeCustomizer = (value: any, srcValue: any, key: string, object: any, source: any, stack: any) => any;
3067
+
2956
3068
  // ADDITIONAL SIMPLE UTIL FUNCTIONS:
2957
3069
 
2958
3070
  export function isBoolean(value: any): boolean;
@@ -2992,7 +3104,7 @@ export namespace layout {
2992
3104
  angle: number;
2993
3105
  };
2994
3106
 
2995
- 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>;
2996
3108
 
2997
3109
  interface Options {
2998
3110
  x?: number | string;
@@ -3005,9 +3117,11 @@ export namespace layout {
3005
3117
  startAngle?: number;
3006
3118
  step?: number;
3007
3119
  compensateRotation?: boolean;
3120
+ [key: string]: any;
3008
3121
  }
3009
3122
 
3010
3123
  export var absolute: LayoutFunction;
3124
+ /** @deprecated */
3011
3125
  export var fn: LayoutFunction;
3012
3126
  export var line: LayoutFunction;
3013
3127
  export var left: LayoutFunction;
@@ -3026,6 +3140,7 @@ export namespace layout {
3026
3140
  angle?: number;
3027
3141
  offset?: number;
3028
3142
  attrs?: dia.Cell.Selectors;
3143
+ [key: string]: any;
3029
3144
  }
3030
3145
 
3031
3146
  interface LabelAttributes {
@@ -3460,6 +3575,7 @@ export namespace mvc {
3460
3575
  collection?: Collection<any> | undefined; // was: Collection<TModel>;
3461
3576
  el?: $Element<TElement> | string | undefined;
3462
3577
  id?: string | undefined;
3578
+ cid?: string | undefined;
3463
3579
  attributes?: Record<string, any> | undefined;
3464
3580
  className?: string | undefined;
3465
3581
  tagName?: string | undefined;
@@ -3502,9 +3618,9 @@ export namespace mvc {
3502
3618
 
3503
3619
  el: TElement;
3504
3620
  attributes: Record<string, any>;
3505
- /* @deprecated use `el` instead */
3621
+ /** @deprecated use `el` instead */
3506
3622
  $el: Dom;
3507
- /* @deprecated use `el.querySelector()` instead */
3623
+ /** @deprecated use `el.querySelector()` instead */
3508
3624
  $(selector: string): Dom;
3509
3625
  render(): this;
3510
3626
  remove(): this;
@@ -3857,7 +3973,8 @@ export namespace anchors {
3857
3973
  }
3858
3974
 
3859
3975
  interface MidSideAnchorArguments extends RotateAnchorArguments, PaddingAnchorArguments {
3860
-
3976
+ mode?: 'prefer-horizontal' | 'prefer-vertical' | 'horizontal' | 'vertical' | 'auto';
3977
+ preferenceThreshold?: dia.Sides;
3861
3978
  }
3862
3979
 
3863
3980
  interface ModelCenterAnchorArguments {
@@ -4415,7 +4532,7 @@ export namespace elementTools {
4415
4532
 
4416
4533
  namespace Boundary {
4417
4534
  interface Options extends dia.ToolView.Options<dia.ElementView> {
4418
- padding?: number | dia.Sides;
4535
+ padding?: dia.Sides;
4419
4536
  useModelGeometry?: boolean;
4420
4537
  rotate?: boolean;
4421
4538
  }
@@ -4658,7 +4775,7 @@ export namespace linkTools {
4658
4775
 
4659
4776
  namespace Boundary {
4660
4777
  interface Options extends dia.ToolView.Options<dia.LinkView> {
4661
- padding?: number | dia.Sides;
4778
+ padding?: dia.Sides;
4662
4779
  useModelGeometry?: boolean;
4663
4780
  }
4664
4781
  }
@@ -27,6 +27,7 @@ export namespace Vectorizer {
27
27
  annotations?: TextAnnotation[];
28
28
  includeAnnotationIndices?: boolean;
29
29
  displayEmpty?: boolean;
30
+ useNoBreakSpace?: boolean;
30
31
  }
31
32
 
32
33
  interface GetBBoxOptions {
@@ -48,6 +49,10 @@ export namespace Vectorizer {
48
49
  attrs: { [key: string]: any };
49
50
  }
50
51
 
52
+ interface TransformToElementOptions {
53
+ safe?: boolean;
54
+ }
55
+
51
56
  // modifiable Matrix. SVGMatrix doesn't allow set on properties or a constructor.
52
57
  interface Matrix {
53
58
  a: number;
@@ -126,7 +131,7 @@ export class VElement {
126
131
  id: string;
127
132
  node: SVGElement;
128
133
 
129
- getTransformToElement(toElem: SVGGElement | VElement): SVGMatrix;
134
+ getTransformToElement(target: SVGElement | VElement, opt?: Vectorizer.TransformToElementOptions): SVGMatrix;
130
135
 
131
136
  transform(): SVGMatrix;
132
137
  transform(matrix: SVGMatrix | Vectorizer.Matrix, opt?: Vectorizer.TransformOptions): this;
@@ -233,6 +238,9 @@ interface VStatic {
233
238
 
234
239
  ensureId(node: SVGElement | VElement): string;
235
240
 
241
+ /**
242
+ * @deprecated Use regular spaces and rely on xml:space="preserve" instead.
243
+ */
236
244
  sanitizeText(text: string): string;
237
245
 
238
246
  isUndefined(value: any): boolean;
@@ -247,6 +255,8 @@ interface VStatic {
247
255
 
248
256
  qualifyAttr(name: string): Vectorizer.QualifiedAttribute;
249
257
 
258
+ getCommonAncestor(node1: SVGElement | VElement, node2: SVGElement | VElement): SVGElement | null;
259
+
250
260
  transformStringToMatrix(transform: string): SVGMatrix;
251
261
 
252
262
  matrixToTransformString(matrix: SVGMatrix | Vectorizer.Matrix): string;