@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/dist/joint.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- /*! JointJS v4.1.3 (2025-02-04) - JavaScript diagramming library
2
-
1
+ /*! JointJS v4.2.0-alpha.1 (2025-09-25) - JavaScript diagramming library
3
2
 
4
3
  This Source Code Form is subject to the terms of the Mozilla Public
5
4
  License, v. 2.0. If a copy of the MPL was not distributed with this
6
5
  file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
6
  */
7
+
8
8
  // Definitions by:
9
9
  // Aidan Reel <http://github.com/areel>,
10
10
  // David Durman <http://github.com/DavidDurman>,
@@ -20,7 +20,11 @@ export as namespace joint;
20
20
 
21
21
  export declare namespace anchors {
22
22
 
23
- export interface RotateAnchorArguments {
23
+ export interface ElementAnchorArguments {
24
+ useModelGeometry?: boolean;
25
+ }
26
+
27
+ export interface RotateAnchorArguments extends ElementAnchorArguments {
24
28
  rotate?: boolean;
25
29
  }
26
30
 
@@ -29,12 +33,13 @@ export declare namespace anchors {
29
33
  dy?: number | string;
30
34
  }
31
35
 
32
- export interface PaddingAnchorArguments {
36
+ export interface PaddingAnchorArguments extends ElementAnchorArguments {
33
37
  padding?: number;
34
38
  }
35
39
 
36
40
  export interface MidSideAnchorArguments extends RotateAnchorArguments, PaddingAnchorArguments {
37
-
41
+ mode?: 'prefer-horizontal' | 'prefer-vertical' | 'horizontal' | 'vertical' | 'auto';
42
+ preferenceThreshold?: dia.Sides;
38
43
  }
39
44
 
40
45
  export interface ModelCenterAnchorArguments {
@@ -424,6 +429,8 @@ export declare namespace config {
424
429
  var classNamePrefix: string;
425
430
  var defaultTheme: string;
426
431
  var doubleTapInterval: number;
432
+ var cellMergeStrategy: util.MergeCustomizer | null;
433
+ var cellDefaultsMergeStrategy: util.MergeCustomizer | null;
427
434
  }
428
435
 
429
436
  export declare namespace connectionPoints {
@@ -936,6 +943,7 @@ export declare namespace dia {
936
943
  export interface GenericAttributes<T> {
937
944
  attrs?: T;
938
945
  z?: number;
946
+ layer?: string;
939
947
  [key: string]: any;
940
948
  }
941
949
 
@@ -1124,6 +1132,8 @@ export declare namespace dia {
1124
1132
 
1125
1133
  getBBox(): g.Rect;
1126
1134
 
1135
+ getCenter(): g.Point;
1136
+
1127
1137
  getPointFromConnectedLink(link: dia.Link, endType: dia.LinkEnd): g.Point;
1128
1138
 
1129
1139
  getPointRotatedAroundCenter(angle: number, x: number, y: number): g.Point;
@@ -1139,6 +1149,8 @@ export declare namespace dia {
1139
1149
 
1140
1150
  static define(type: string, defaults?: any, protoProps?: any, staticProps?: any): Cell.Constructor<Cell>;
1141
1151
 
1152
+ static getAttributeDefinition(attrName: string): Cell.PresentationAttributeDefinition<CellView> | null;
1153
+
1142
1154
  /**
1143
1155
  * @deprecated
1144
1156
  */
@@ -1163,23 +1175,40 @@ export declare namespace dia {
1163
1175
  export interface Attributes extends GenericAttributes<Cell.Selectors> {
1164
1176
  }
1165
1177
 
1166
- export type PortPositionCallback = (ports: Port[], bbox: g.Rect) => dia.Point[];
1178
+ export interface ConstructorOptions extends Cell.ConstructorOptions {
1179
+ portLayoutNamespace?: { [key: string]: layout.Port.LayoutFunction };
1180
+ portLabelLayoutNamespace?: { [key: string]: layout.PortLabel.LayoutFunction };
1181
+ }
1182
+
1183
+ export type PortPositionCallback = layout.Port.LayoutFunction;
1184
+
1185
+ export type PortLabelPositionCallback = layout.PortLabel.LayoutFunction;
1167
1186
 
1168
1187
  export interface PortPositionJSON {
1169
1188
  name?: string;
1170
- args?: { [key: string]: any };
1189
+ args?: layout.Port.Options;
1190
+ }
1191
+
1192
+ export interface PortLabelPositionJSON {
1193
+ name?: string;
1194
+ args?: layout.PortLabel.Options;
1171
1195
  }
1172
1196
 
1173
1197
  export type PositionType = string | PortPositionCallback | PortPositionJSON;
1174
1198
 
1199
+ export type PortLabelPositionType = PortLabelPositionCallback | PortPositionJSON;
1200
+
1175
1201
  export interface PortGroup {
1176
1202
  position?: PositionType;
1177
1203
  markup?: string | MarkupJSON;
1178
1204
  attrs?: Cell.Selectors;
1179
- label?: {
1180
- markup?: string | MarkupJSON;
1181
- position?: PositionType;
1182
- };
1205
+ size?: Size;
1206
+ label?: PortLabel;
1207
+ }
1208
+
1209
+ export interface PortLabel {
1210
+ markup?: string | MarkupJSON;
1211
+ position?: PortLabelPositionType;
1183
1212
  }
1184
1213
 
1185
1214
  export interface Port {
@@ -1187,11 +1216,13 @@ export declare namespace dia {
1187
1216
  markup?: string | MarkupJSON;
1188
1217
  group?: string;
1189
1218
  attrs?: Cell.Selectors;
1190
- args?: { [key: string]: any };
1191
- label?: {
1192
- markup?: string | MarkupJSON;
1193
- position?: PositionType;
1219
+ position?: {
1220
+ args?: layout.Port.Options;
1194
1221
  };
1222
+ /** @deprecated use `position.args` instead */
1223
+ args?: layout.Port.Options;
1224
+ size?: Size;
1225
+ label?: PortLabel;
1195
1226
  z?: number | 'auto';
1196
1227
  }
1197
1228
 
@@ -1199,6 +1230,10 @@ export declare namespace dia {
1199
1230
  angle: number;
1200
1231
  }
1201
1232
 
1233
+ export interface PortRect extends BBox {
1234
+ angle: number;
1235
+ }
1236
+
1202
1237
  export interface TranslateOptions extends Cell.Options {
1203
1238
  restrictedArea?: BBox | Paper.PointConstraintCallback;
1204
1239
  transition?: Cell.TransitionOptions;
@@ -1213,13 +1248,32 @@ export declare namespace dia {
1213
1248
  direction?: Direction;
1214
1249
  }
1215
1250
 
1216
- export interface BBoxOptions extends Cell.EmbeddableOptions {
1251
+ export interface FitToChildrenOptions {
1252
+ filter?: (cell: Cell) => boolean;
1253
+ deep?: boolean;
1254
+ padding?: Padding;
1255
+ minRect?: Partial<BBox>;
1256
+ expandOnly?: boolean;
1257
+ shrinkOnly?: boolean;
1258
+ }
1259
+
1260
+ export interface FitParentOptions extends FitToChildrenOptions {
1261
+ terminator?: Cell | Cell.ID;
1262
+ }
1263
+
1264
+ export interface RotateOptions {
1217
1265
  rotate?: boolean;
1218
1266
  }
1267
+
1268
+ export interface BBoxOptions extends Cell.EmbeddableOptions, RotateOptions {
1269
+
1270
+ }
1219
1271
  }
1220
1272
 
1221
1273
  export class Element<A extends ObjectHash = Element.Attributes, S extends mvc.ModelSetOptions = dia.ModelSetOptions> extends Cell<A, S> {
1222
1274
 
1275
+ constructor(attributes?: DeepPartial<A>, opt?: Element.ConstructorOptions);
1276
+
1223
1277
  translate(tx: number, ty?: number, opt?: Element.TranslateOptions): this;
1224
1278
 
1225
1279
  position(opt?: Element.PositionOptions): g.Point;
@@ -1237,10 +1291,10 @@ export declare namespace dia {
1237
1291
 
1238
1292
  scale(scaleX: number, scaleY: number, origin?: Point, opt?: { [key: string]: any }): this;
1239
1293
 
1240
- fitEmbeds(opt?: { deep?: boolean, padding?: Padding, expandOnly?: boolean, shrinkOnly?: boolean }): this;
1241
- fitToChildren(opt?: { deep?: boolean, padding?: Padding, expandOnly?: boolean, shrinkOnly?: boolean }): this;
1294
+ fitEmbeds(opt?: Element.FitToChildrenOptions): this;
1295
+ fitToChildren(opt?: Element.FitToChildrenOptions): this;
1242
1296
 
1243
- fitParent(opt?: { deep?: boolean, padding?: Padding, expandOnly?: boolean, shrinkOnly?: boolean, terminator?: Cell | Cell.ID }): this;
1297
+ fitParent(opt?: Element.FitParentOptions): this;
1244
1298
 
1245
1299
  getBBox(opt?: Element.BBoxOptions): g.Rect;
1246
1300
 
@@ -1267,6 +1321,14 @@ export declare namespace dia {
1267
1321
 
1268
1322
  getPortsPositions(groupName: string): { [id: string]: Element.PortPosition };
1269
1323
 
1324
+ getPortRelativePosition(portId: string): Element.PortPosition;
1325
+
1326
+ getPortRelativeRect(portId: string): Element.PortRect;
1327
+
1328
+ getPortCenter(portId: string): g.Point;
1329
+
1330
+ getPortBBox(portId: string, opt?: Element.RotateOptions): g.Rect;
1331
+
1270
1332
  getPortIndex(port: string | Element.Port): number;
1271
1333
 
1272
1334
  getPortGroupNames(): string[];
@@ -1549,6 +1611,10 @@ export declare namespace dia {
1549
1611
 
1550
1612
  isIntersecting(geometryShape: g.Shape, geometryData?: g.SegmentSubdivisionsOpt | null): boolean;
1551
1613
 
1614
+ cleanNodesCache(): void;
1615
+
1616
+ cleanNodeCache(node: SVGElement): void
1617
+
1552
1618
  protected isEnclosedIn(area: g.Rect): boolean;
1553
1619
 
1554
1620
  protected isInArea(area: g.Rect, options: g.StrictOpt): boolean;
@@ -1605,8 +1671,6 @@ export declare namespace dia {
1605
1671
 
1606
1672
  protected addLinkFromMagnet(magnet: SVGElement, x: number, y: number): LinkView;
1607
1673
 
1608
- protected cleanNodesCache(): void;
1609
-
1610
1674
  protected nodeCache(magnet: SVGElement): CellView.NodeMetrics;
1611
1675
 
1612
1676
  protected getNodeData(magnet: SVGElement): CellView.NodeData;
@@ -1929,36 +1993,94 @@ export declare namespace dia {
1929
1993
  GRID = 'grid',
1930
1994
  }
1931
1995
 
1932
- export type UpdateStats = {
1996
+ export interface RenderStats {
1933
1997
  priority: number;
1934
1998
  updated: number;
1935
- empty?: boolean;
1936
- postponed?: number;
1937
- unmounted?: number;
1938
- mounted?: number;
1999
+ }
2000
+
2001
+ export interface UpdateVisibilityStats {
2002
+ mounted: number;
2003
+ unmounted: number;
2004
+ }
2005
+
2006
+ export interface RenderBatchStats extends RenderStats, UpdateVisibilityStats {
2007
+ postponed: number;
2008
+ empty: boolean;
2009
+ }
2010
+
2011
+ export type UpdateStats = RenderStats & Partial<RenderBatchStats> & {
1939
2012
  batches?: number;
1940
2013
  };
1941
2014
 
1942
2015
  export type ViewportCallback = (view: mvc.View<any, any>, isMounted: boolean, paper: Paper) => boolean;
2016
+ export type CellVisibilityCallback = (cell: Cell, isMounted: boolean, paper: Paper) => boolean;
1943
2017
  export type ProgressCallback = (done: boolean, processed: number, total: number, stats: UpdateStats, paper: Paper) => void;
1944
2018
  export type BeforeRenderCallback = (opt: { [key: string]: any }, paper: Paper) => void;
1945
2019
  export type AfterRenderCallback = (stats: UpdateStats, opt: { [key: string]: any }, paper: Paper) => void;
1946
2020
 
1947
- export interface FreezeOptions {
1948
- key?: string;
2021
+ export interface CellVisibilityOptions {
2022
+ cellVisibility?: CellVisibilityCallback | null;
2023
+
2024
+ /** @deprecated disable `legacyMode` and use `cellVisibility` instead */
2025
+ viewport?: ViewportCallback | null;
1949
2026
  }
1950
2027
 
1951
- export interface UnfreezeOptions {
1952
- key?: string;
2028
+ export interface MountOptions {
1953
2029
  mountBatchSize?: number;
2030
+ }
2031
+
2032
+ export interface UnmountOptions {
1954
2033
  unmountBatchSize?: number;
2034
+ }
2035
+
2036
+ export interface BatchSizeOptions {
1955
2037
  batchSize?: number;
1956
- viewport?: ViewportCallback;
1957
- progress?: ProgressCallback;
2038
+ }
2039
+
2040
+ export interface BeforeRenderOptions {
1958
2041
  beforeRender?: BeforeRenderCallback;
2042
+ }
2043
+
2044
+ export interface AfterRenderOptions {
1959
2045
  afterRender?: AfterRenderCallback;
1960
2046
  }
1961
2047
 
2048
+ export interface RenderCallbackOptions extends BeforeRenderOptions, AfterRenderOptions, mvc.Silenceable {
2049
+
2050
+ }
2051
+
2052
+ export interface KeyOptions {
2053
+ key?: string;
2054
+ }
2055
+
2056
+ export interface UpdateViewOptions {
2057
+ [key: string]: any;
2058
+ }
2059
+
2060
+ export interface UpdateViewsBatchOptions extends UpdateViewOptions, BatchSizeOptions, CellVisibilityOptions {
2061
+
2062
+ }
2063
+
2064
+ export interface UpdateViewsOptions extends UpdateViewsBatchOptions, RenderCallbackOptions {
2065
+
2066
+ }
2067
+
2068
+ export interface UpdateViewsAsyncOptions extends UpdateViewsBatchOptions, ScheduleCellsVisibilityUpdateOptions, RenderCallbackOptions {
2069
+ progress?: ProgressCallback;
2070
+ }
2071
+
2072
+ export interface ScheduleCellsVisibilityUpdateOptions extends CellVisibilityOptions, MountOptions, UnmountOptions {
2073
+
2074
+ }
2075
+
2076
+ export interface FreezeOptions extends KeyOptions {
2077
+
2078
+ }
2079
+
2080
+ export interface UnfreezeOptions extends KeyOptions, UpdateViewsAsyncOptions, UpdateViewsOptions {
2081
+
2082
+ }
2083
+
1962
2084
  export interface SnapLinksOptions {
1963
2085
  radius?: number;
1964
2086
  findInAreaOptions?: FindInAreaOptions;
@@ -1968,8 +2090,9 @@ export declare namespace dia {
1968
2090
  export type RestrictTranslateCallback = (elementView: ElementView, x0: number, y0: number) => BBox | boolean | PointConstraintCallback;
1969
2091
  export type FindParentByType = 'bbox' | 'pointer' | PositionName;
1970
2092
  export type FindParentByCallback = ((this: dia.Graph, elementView: ElementView, evt: dia.Event, x: number, y: number) => Cell[]);
2093
+ export type MeasureNodeCallback = (node: SVGGraphicsElement, cellView: dia.CellView) => g.Rect;
1971
2094
 
1972
- export interface Options extends mvc.ViewOptions<Graph> {
2095
+ export interface Options extends mvc.ViewOptions<Graph>, CellVisibilityOptions, BeforeRenderOptions, AfterRenderOptions {
1973
2096
  // appearance
1974
2097
  width?: Dimension;
1975
2098
  height?: Dimension;
@@ -2003,6 +2126,7 @@ export declare namespace dia {
2003
2126
  // views
2004
2127
  elementView?: typeof ElementView | ((element: Element) => typeof ElementView);
2005
2128
  linkView?: typeof LinkView | ((link: Link) => typeof LinkView);
2129
+ measureNode?: MeasureNodeCallback;
2006
2130
  // embedding
2007
2131
  embeddingMode?: boolean;
2008
2132
  frontParentOnly?: boolean;
@@ -2030,14 +2154,17 @@ export declare namespace dia {
2030
2154
  sorting?: sorting;
2031
2155
  frozen?: boolean;
2032
2156
  autoFreeze?: boolean;
2033
- viewport?: ViewportCallback | null;
2157
+ viewManagement?: ViewManagementOptions | boolean;
2034
2158
  onViewUpdate?: (view: mvc.View<any, any>, flag: number, priority: number, opt: { [key: string]: any }, paper: Paper) => void;
2035
2159
  onViewPostponed?: (view: mvc.View<any, any>, flag: number, paper: Paper) => boolean;
2036
- beforeRender?: Paper.BeforeRenderCallback;
2037
- afterRender?: Paper.AfterRenderCallback;
2038
2160
  overflow?: boolean;
2039
2161
  }
2040
2162
 
2163
+ export interface ViewManagementOptions {
2164
+ lazyInitialize?: boolean;
2165
+ disposeHidden?: boolean;
2166
+ }
2167
+
2041
2168
  export interface TransformToFitContentOptions {
2042
2169
  padding?: Padding;
2043
2170
  preserveAspectRatio?: boolean;
@@ -2170,6 +2297,17 @@ export declare namespace dia {
2170
2297
 
2171
2298
  export interface FindInAreaOptions extends Graph.FindInAreaOptions, BufferOptions {
2172
2299
  }
2300
+
2301
+ export interface FindClosestMagnetToPointOptions {
2302
+ radius?: number;
2303
+ findInAreaOptions?: FindInAreaOptions;
2304
+ filter?: (view: CellView, magnet: SVGElement) => boolean;
2305
+ }
2306
+
2307
+ export interface ClosestMagnet {
2308
+ view: CellView;
2309
+ magnet: SVGElement;
2310
+ }
2173
2311
  }
2174
2312
 
2175
2313
  export class Paper extends mvc.View<Graph> {
@@ -2305,6 +2443,13 @@ export declare namespace dia {
2305
2443
  */
2306
2444
  findCellViewsInArea(area: BBox, opt?: Paper.FindInAreaOptions): CellView[];
2307
2445
 
2446
+ /**
2447
+ * Finds the closest magnet to the specified point
2448
+ * @param point a point in local paper coordinates
2449
+ * @param opt options for the search
2450
+ */
2451
+ findClosestMagnetToPoint(point: Point, opt?: Paper.FindClosestMagnetToPointOptions): Paper.ClosestMagnet | null;
2452
+
2308
2453
  fitToContent(opt?: Paper.FitToContentOptions): g.Rect;
2309
2454
  fitToContent(gridWidth?: number, gridHeight?: number, padding?: number, opt?: any): g.Rect;
2310
2455
 
@@ -2354,7 +2499,7 @@ export declare namespace dia {
2354
2499
 
2355
2500
  getLayerNode(layerName: Paper.Layers | string): SVGGElement;
2356
2501
 
2357
- getLayerView(layerName: Paper.Layers | string): any;
2502
+ getLayerView(layerName: Paper.Layers | string): PaperLayer;
2358
2503
 
2359
2504
  hasLayerView(layerName: Paper.Layers | string): boolean;
2360
2505
 
@@ -2364,44 +2509,48 @@ export declare namespace dia {
2364
2509
 
2365
2510
  protected resetLayers(): void;
2366
2511
 
2512
+ addLayer(layerName: string, layerView: PaperLayer, options?: { insertBefore?: string }): void;
2513
+
2514
+ removeLayer(layer: string | PaperLayer): void;
2515
+
2516
+ moveLayer(layer: string | PaperLayer, insertBefore: string | PaperLayer | null): void;
2517
+
2518
+ hasLayer(layer: string | PaperLayer): boolean;
2519
+
2520
+ getLayerNames(): string[];
2521
+
2522
+ getLayers(): Array<PaperLayer>;
2523
+
2367
2524
  // rendering
2368
2525
 
2369
2526
  freeze(opt?: Paper.FreezeOptions): void;
2370
2527
 
2371
2528
  unfreeze(opt?: Paper.UnfreezeOptions): void;
2372
2529
 
2530
+ wakeUp(): void;
2531
+
2373
2532
  isFrozen(): boolean;
2374
2533
 
2375
2534
  requestViewUpdate(view: mvc.View<any, any>, flag: number, priority: number, opt?: { [key: string]: any }): void;
2376
2535
 
2377
- requireView<T extends ElementView | LinkView>(model: Cell | Cell.ID, opt?: dia.Cell.Options): T;
2536
+ requireView<T extends ElementView | LinkView>(cellOrId: Cell | Cell.ID, opt?: Paper.UpdateViewOptions & Paper.RenderCallbackOptions): T;
2378
2537
 
2379
- dumpViews(opt?: {
2380
- batchSize?: number;
2381
- mountBatchSize?: number;
2382
- unmountBatchSize?: number;
2383
- viewport?: Paper.ViewportCallback;
2384
- }): void;
2538
+ updateViews(opt?: Paper.UpdateViewsOptions): Paper.RenderStats & { batches: number };
2385
2539
 
2386
- checkViewport(opt?: {
2387
- mountBatchSize?: number;
2388
- unmountBatchSize?: number;
2389
- viewport?: Paper.ViewportCallback;
2390
- }): {
2391
- mounted: number;
2392
- unmounted: number;
2393
- };
2540
+ hasScheduledUpdates(): boolean;
2394
2541
 
2395
- updateViews(opt?: {
2396
- batchSize?: number;
2397
- viewport?: Paper.ViewportCallback;
2398
- }): {
2399
- updated: number;
2400
- batches: number;
2401
- priority: number;
2402
- };
2542
+ disposeHiddenCellViews(): void;
2403
2543
 
2404
- hasScheduledUpdates(): boolean;
2544
+ isCellVisible(cellOrId: dia.Cell | dia.Cell.ID): boolean;
2545
+
2546
+ updateCellVisibility(
2547
+ cell: Cell | Cell.ID,
2548
+ opt?: Paper.CellVisibilityOptions & Paper.UpdateViewOptions & Paper.RenderCallbackOptions
2549
+ ): void;
2550
+
2551
+ updateCellsVisibility(
2552
+ opt?: Paper.ScheduleCellsVisibilityUpdateOptions & Paper.UpdateViewsOptions
2553
+ ): void;
2405
2554
 
2406
2555
  // events
2407
2556
 
@@ -2412,52 +2561,51 @@ export declare namespace dia {
2412
2561
  // protected
2413
2562
 
2414
2563
  /**
2415
- * For the specified view, calls the visibility viewport function specified by the paper.options.viewport function.
2564
+ * For the specified view, calls the cell visibility function specified by the `paper.options.cellVisibility` function.
2416
2565
  * If the function returns true, the view is attached to the DOM; in other case it is detached.
2417
- * 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().
2418
- * 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.
2566
+ * 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()`.
2567
+ * 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.
2419
2568
  * @param cellView cellView for which the visibility check is performed
2420
- * @param opt if opt.viewport is provided, it is used as the callback function instead of paper.options.viewport.
2569
+ * @param opt if opt.cellVisibility is provided, it is used as the callback function instead of paper.options.cellVisibility.
2421
2570
  */
2422
- protected checkViewVisibility(cellView: dia.CellView, opt?: {
2423
- viewport?: Paper.ViewportCallback;
2424
- }): {
2425
- mounted: number;
2426
- unmounted: number;
2427
- };
2571
+ protected checkViewVisibility(
2572
+ cellView: dia.CellView,
2573
+ opt?: Paper.CellVisibilityOptions
2574
+ ): Paper.UpdateVisibilityStats;
2575
+
2576
+
2577
+ protected scheduleCellsVisibilityUpdate(opt?: Paper.ScheduleCellsVisibilityUpdateOptions): Paper.UpdateVisibilityStats;
2428
2578
 
2429
2579
  protected scheduleViewUpdate(view: mvc.View<any, any>, flag: number, priority: number, opt?: { [key: string]: any }): void;
2430
2580
 
2431
2581
  protected dumpViewUpdate(view: mvc.View<any, any>): number;
2432
2582
 
2433
- protected dumpView(view: mvc.View<any, any>, opt?: { [key: string]: any }): number;
2583
+ protected dumpView(view: mvc.View<any, any>, opt?: Paper.UpdateViewOptions & Paper.RenderCallbackOptions): number;
2434
2584
 
2435
- protected updateView(view: mvc.View<any, any>, flag: number, opt?: { [key: string]: any }): number;
2585
+ protected updateView(view: mvc.View<any, any>, flag: number, opt?: Paper.UpdateViewOptions): number;
2436
2586
 
2437
2587
  protected registerUnmountedView(view: mvc.View<any, any>): number;
2438
2588
 
2439
2589
  protected registerMountedView(view: mvc.View<any, any>): number;
2440
2590
 
2441
- protected updateViewsAsync(opt?: {
2442
- batchSize?: number;
2443
- mountBatchSize?: number;
2444
- unmountBatchSize?: number;
2445
- viewport?: Paper.ViewportCallback;
2446
- progress?: Paper.ProgressCallback;
2447
- before?: Paper.BeforeRenderCallback;
2448
- }): void;
2591
+ protected updateViewsAsync(opt?: Paper.UpdateViewsAsyncOptions): void;
2449
2592
 
2450
- protected updateViewsBatch(opt?: {
2451
- batchSize?: number;
2452
- viewport?: Paper.ViewportCallback;
2453
- }): Paper.UpdateStats;
2593
+ protected updateViewsBatch(opt?: Paper.UpdateViewsBatchOptions): Paper.RenderBatchStats;
2594
+
2595
+ protected checkMountedViews(viewport: Paper.ViewportCallback, opt?: Paper.UnmountOptions): number;
2596
+
2597
+ protected checkUnmountedViews(viewport: Paper.ViewportCallback, opt?: Paper.MountOptions): number;
2454
2598
 
2455
- protected checkMountedViews(viewport: Paper.ViewportCallback, opt?: { unmountBatchSize?: number }): number;
2599
+ protected prioritizeCellViewMount(cellOrId: dia.Cell | dia.Cell.ID): boolean;
2456
2600
 
2457
- protected checkUnmountedViews(viewport: Paper.ViewportCallback, opt?: { mountBatchSize?: number }): number;
2601
+ protected prioritizeCellViewUnmount(cellOrId: dia.Cell | dia.Cell.ID): boolean;
2602
+
2603
+ protected isViewMounted(viewOrCid: dia.CellView | string): boolean;
2458
2604
 
2459
2605
  protected isAsync(): boolean;
2460
2606
 
2607
+ protected isIdle(): boolean;
2608
+
2461
2609
  protected isExactSorting(): boolean;
2462
2610
 
2463
2611
  protected sortViews(): void;
@@ -2533,7 +2681,9 @@ export declare namespace dia {
2533
2681
 
2534
2682
  protected insertView(cellView: CellView, isInitialInsert: boolean): void;
2535
2683
 
2536
- protected detachView(cellView: CellView): void;
2684
+ protected _hideCellView(cellView: CellView): void;
2685
+
2686
+ protected _detachCellView(cellView: CellView): void;
2537
2687
 
2538
2688
  protected customEventTrigger(event: dia.Event, view: CellView, rootNode?: SVGElement): dia.Event | null;
2539
2689
 
@@ -2553,6 +2703,16 @@ export declare namespace dia {
2553
2703
  * @deprecated use transformToFitContent
2554
2704
  */
2555
2705
  scaleContentToFit(opt?: Paper.ScaleContentOptions): void;
2706
+
2707
+ /**
2708
+ * @deprecated Use `updateCellsVisibility()`
2709
+ */
2710
+ checkViewport(opt?: Paper.ScheduleCellsVisibilityUpdateOptions): Paper.UpdateVisibilityStats;
2711
+
2712
+ /**
2713
+ * @deprecated Use `updateCellsVisibility()`
2714
+ */
2715
+ dumpViews(opt?: Paper.ScheduleCellsVisibilityUpdateOptions & Paper.UpdateViewsOptions): void;
2556
2716
  }
2557
2717
 
2558
2718
  export namespace PaperLayer {
@@ -2611,6 +2771,10 @@ export declare namespace dia {
2611
2771
  hide(): this;
2612
2772
 
2613
2773
  mount(): this;
2774
+
2775
+ getLayer(): string | null;
2776
+
2777
+ hasLayer(): boolean;
2614
2778
  }
2615
2779
 
2616
2780
  export namespace ToolView {
@@ -2654,6 +2818,8 @@ export declare namespace dia {
2654
2818
 
2655
2819
  update(): void;
2656
2820
 
2821
+ isOverlay(): boolean;
2822
+
2657
2823
  protected guard(evt: dia.Event): boolean;
2658
2824
  }
2659
2825
 
@@ -2745,6 +2911,8 @@ export declare namespace dia {
2745
2911
  id?: string
2746
2912
  ): T[];
2747
2913
 
2914
+ static has(cellView: dia.CellView, id?: string): boolean;
2915
+
2748
2916
  static update(cellView: dia.CellView, id?: string): void;
2749
2917
 
2750
2918
  static transform(cellView: dia.CellView, id?: string): void;
@@ -2822,7 +2990,7 @@ export declare namespace elementTools {
2822
2990
 
2823
2991
  export namespace Boundary {
2824
2992
  export interface Options extends dia.ToolView.Options<dia.ElementView> {
2825
- padding?: number | dia.Sides;
2993
+ padding?: dia.Sides;
2826
2994
  useModelGeometry?: boolean;
2827
2995
  rotate?: boolean;
2828
2996
  }
@@ -2900,12 +3068,16 @@ export declare namespace g {
2900
3068
  }
2901
3069
 
2902
3070
  export type Shape = Path | Point | Line | Polyline | Polygon | Rect | Ellipse;
3071
+
2903
3072
  export interface PlainPoint {
2904
3073
 
2905
3074
  x: number;
2906
3075
  y: number;
2907
3076
  }
2908
3077
 
3078
+ /** Can be understood by `g.Point` constructor */
3079
+ export type PointInit = Partial<PlainPoint> | string;
3080
+
2909
3081
  export interface PlainRect {
2910
3082
 
2911
3083
  x: number;
@@ -2965,15 +3137,15 @@ export declare namespace g {
2965
3137
 
2966
3138
  clone(): Segment;
2967
3139
 
2968
- closestPoint(p: Point, opt?: SubdivisionsOpt): Point;
3140
+ closestPoint(p: PlainPoint, opt?: SubdivisionsOpt): Point;
2969
3141
 
2970
- closestPointLength(p: Point, opt?: SubdivisionsOpt): number;
3142
+ closestPointLength(p: PlainPoint, opt?: SubdivisionsOpt): number;
2971
3143
 
2972
- closestPointNormalizedLength(p: Point, opt?: SubdivisionsOpt): number;
3144
+ closestPointNormalizedLength(p: PlainPoint, opt?: SubdivisionsOpt): number;
2973
3145
 
2974
- closestPointT(p: Point): number;
3146
+ closestPointT(p: PlainPoint): number;
2975
3147
 
2976
- closestPointTangent(p: Point): Line | null;
3148
+ closestPointTangent(p: PlainPoint): Line | null;
2977
3149
 
2978
3150
  divideAt(ratio: number, opt?: SubdivisionsOpt): [Segment, Segment];
2979
3151
 
@@ -2999,7 +3171,7 @@ export declare namespace g {
2999
3171
 
3000
3172
  round(precision?: number): this;
3001
3173
 
3002
- scale(sx: number, sy: number, origin?: PlainPoint): this;
3174
+ scale(sx: number, sy: number, origin?: PointInit): this;
3003
3175
 
3004
3176
  tangentAt(ratio: number): Line | null;
3005
3177
 
@@ -3056,7 +3228,7 @@ export declare namespace g {
3056
3228
  end: Point;
3057
3229
  type: types.Curve;
3058
3230
 
3059
- constructor(p1: PlainPoint | string, p2: PlainPoint | string, p3: PlainPoint | string, p4: PlainPoint | string);
3231
+ constructor(p1: PointInit, p2: PointInit, p3: PointInit, p4: PointInit);
3060
3232
  constructor(curve: Curve);
3061
3233
 
3062
3234
  bbox(): Rect;
@@ -3104,7 +3276,7 @@ export declare namespace g {
3104
3276
 
3105
3277
  round(precision?: number): this;
3106
3278
 
3107
- scale(sx: number, sy: number, origin?: PlainPoint | string): this;
3279
+ scale(sx: number, sy: number, origin?: PointInit): this;
3108
3280
 
3109
3281
  tangentAt(ratio: number, opt?: SubdivisionsOpt): Line | null;
3110
3282
 
@@ -3136,7 +3308,7 @@ export declare namespace g {
3136
3308
  b: number;
3137
3309
  type: types.Ellipse;
3138
3310
 
3139
- constructor(center: PlainPoint | string, a: number, b: number);
3311
+ constructor(center: PointInit, a: number, b: number);
3140
3312
  constructor(ellipse: Ellipse);
3141
3313
 
3142
3314
  bbox(): Rect;
@@ -3153,7 +3325,7 @@ export declare namespace g {
3153
3325
 
3154
3326
  intersectionWithLine(l: Line): Point[] | null;
3155
3327
 
3156
- intersectionWithLineFromCenterToPoint(p: PlainPoint, angle?: number): Point;
3328
+ intersectionWithLineFromCenterToPoint(p: PointInit, angle?: number): Point;
3157
3329
 
3158
3330
  normalizedDistance(point: PlainPoint): number;
3159
3331
 
@@ -3172,7 +3344,7 @@ export declare namespace g {
3172
3344
  end: Point;
3173
3345
  type: types.Line;
3174
3346
 
3175
- constructor(p1: PlainPoint | string, p2: PlainPoint | string);
3347
+ constructor(p1: PointInit, p2: PointInit);
3176
3348
  constructor(line: Line);
3177
3349
  constructor();
3178
3350
 
@@ -3186,13 +3358,13 @@ export declare namespace g {
3186
3358
 
3187
3359
  parallel(distance: number): Line;
3188
3360
 
3189
- closestPoint(p: PlainPoint | string): Point;
3361
+ closestPoint(p: PointInit): Point;
3190
3362
 
3191
- closestPointLength(p: PlainPoint | string): number;
3363
+ closestPointLength(p: PointInit): number;
3192
3364
 
3193
- closestPointNormalizedLength(p: PlainPoint | string): number;
3365
+ closestPointNormalizedLength(p: PointInit): number;
3194
3366
 
3195
- closestPointTangent(p: PlainPoint | string): Line | null;
3367
+ closestPointTangent(p: PointInit): Line | null;
3196
3368
 
3197
3369
  containsPoint(p: PlainPoint): boolean;
3198
3370
 
@@ -3220,13 +3392,13 @@ export declare namespace g {
3220
3392
 
3221
3393
  pointAtLength(length: number): Point;
3222
3394
 
3223
- pointOffset(p: PlainPoint | string): number;
3395
+ pointOffset(p: PointInit): number;
3224
3396
 
3225
3397
  rotate(origin: PlainPoint, angle: number): this;
3226
3398
 
3227
3399
  round(precision?: number): this;
3228
3400
 
3229
- scale(sx: number, sy: number, origin?: PlainPoint): this;
3401
+ scale(sx: number, sy: number, origin?: PointInit): this;
3230
3402
 
3231
3403
  setLength(length: number): this;
3232
3404
 
@@ -3265,13 +3437,13 @@ export declare namespace g {
3265
3437
 
3266
3438
  clone(): Path;
3267
3439
 
3268
- closestPoint(p: Point, opt?: SegmentSubdivisionsOpt): Point | null;
3440
+ closestPoint(p: PlainPoint, opt?: SegmentSubdivisionsOpt): Point | null;
3269
3441
 
3270
- closestPointLength(p: Point, opt?: SegmentSubdivisionsOpt): number;
3442
+ closestPointLength(p: PlainPoint, opt?: SegmentSubdivisionsOpt): number;
3271
3443
 
3272
- closestPointNormalizedLength(p: Point, opt?: SegmentSubdivisionsOpt): number;
3444
+ closestPointNormalizedLength(p: PlainPoint, opt?: SegmentSubdivisionsOpt): number;
3273
3445
 
3274
- closestPointTangent(p: Point, opt?: SegmentSubdivisionsOpt): Line | null;
3446
+ closestPointTangent(p: PlainPoint, opt?: SegmentSubdivisionsOpt): Line | null;
3275
3447
 
3276
3448
  containsPoint(p: PlainPoint, opt?: SegmentSubdivisionsOpt): boolean;
3277
3449
 
@@ -3307,7 +3479,7 @@ export declare namespace g {
3307
3479
 
3308
3480
  round(precision?: number): this;
3309
3481
 
3310
- scale(sx: number, sy: number, origin?: PlainPoint | string): this;
3482
+ scale(sx: number, sy: number, origin?: PointInit): this;
3311
3483
 
3312
3484
  segmentAt(ratio: number, opt?: SegmentSubdivisionsOpt): Segment | null;
3313
3485
 
@@ -3334,7 +3506,7 @@ export declare namespace g {
3334
3506
 
3335
3507
  validate(): this;
3336
3508
 
3337
- private closestPointT(p: Point, opt?: SegmentSubdivisionsOpt): PathT | null;
3509
+ private closestPointT(p: PlainPoint, opt?: SegmentSubdivisionsOpt): PathT | null;
3338
3510
 
3339
3511
  private lengthAtT(t: PathT, opt?: SegmentSubdivisionsOpt): number;
3340
3512
 
@@ -3362,17 +3534,17 @@ export declare namespace g {
3362
3534
  type: types.Point;
3363
3535
 
3364
3536
  constructor(x?: number, y?: number);
3365
- constructor(p: PlainPoint | string);
3537
+ constructor(p: PointInit);
3366
3538
 
3367
- chooseClosest(points: PlainPoint[]): Point | null;
3539
+ chooseClosest(points: PointInit[]): Point | null;
3368
3540
 
3369
3541
  adhereToRect(r: Rect): this;
3370
3542
 
3371
3543
  angleBetween(p1: PlainPoint, p2: PlainPoint): number;
3372
3544
 
3373
- bearing(p: Point): CardinalDirection;
3545
+ bearing(p: PlainPoint): CardinalDirection;
3374
3546
 
3375
- changeInAngle(dx: number, dy: number, ref: PlainPoint | string): number;
3547
+ changeInAngle(dx: number, dy: number, ref: PointInit): number;
3376
3548
 
3377
3549
  clone(): Point;
3378
3550
 
@@ -3381,42 +3553,42 @@ export declare namespace g {
3381
3553
  difference(dx?: number, dy?: number): Point;
3382
3554
  difference(p: PlainPoint): Point;
3383
3555
 
3384
- distance(p: PlainPoint | string): number;
3556
+ distance(p: PlainPoint): number;
3385
3557
 
3386
3558
  dot(p: PlainPoint): number;
3387
3559
 
3388
- equals(p: Point): boolean;
3560
+ equals(p: PlainPoint): boolean;
3389
3561
 
3390
- lerp(p: Point, t: number): Point;
3562
+ lerp(p: PlainPoint, t: number): Point;
3391
3563
 
3392
3564
  magnitude(): number;
3393
3565
 
3394
3566
  manhattanDistance(p: PlainPoint): number;
3395
3567
 
3396
- move(ref: PlainPoint | string, distance: number): this;
3568
+ move(ref: PointInit, distance: number): this;
3397
3569
 
3398
3570
  normalize(length: number): this;
3399
3571
 
3400
3572
  offset(dx?: number, dy?: number): this;
3401
3573
  offset(p: PlainPoint): this;
3402
3574
 
3403
- reflection(ref: PlainPoint | string): Point;
3575
+ reflection(ref: PointInit): Point;
3404
3576
 
3405
- rotate(origin: PlainPoint | string, angle: number): this;
3577
+ rotate(origin: PlainPoint, angle: number): this;
3406
3578
 
3407
3579
  round(precision?: number): this;
3408
3580
 
3409
- scale(sx: number, sy: number, origin?: PlainPoint | string): this;
3581
+ scale(sx: number, sy: number, origin?: PointInit): this;
3410
3582
 
3411
3583
  snapToGrid(gx: number, gy?: number): this;
3412
3584
 
3413
- squaredDistance(p: PlainPoint | string): number;
3585
+ squaredDistance(p: PlainPoint): number;
3414
3586
 
3415
- theta(p: PlainPoint | string): number;
3587
+ theta(p: PointInit): number;
3416
3588
 
3417
3589
  toJSON(): PlainPoint;
3418
3590
 
3419
- toPolar(origin?: PlainPoint | string): this;
3591
+ toPolar(origin?: PointInit): this;
3420
3592
 
3421
3593
  toString(): string;
3422
3594
 
@@ -3430,7 +3602,7 @@ export declare namespace g {
3430
3602
 
3431
3603
  vectorAngle(p: PlainPoint): number;
3432
3604
 
3433
- static fromPolar(distance: number, angle: number, origin?: PlainPoint | string): Point;
3605
+ static fromPolar(distance: number, angle: number, origin?: PointInit): Point;
3434
3606
 
3435
3607
  static random(x1: number, x2: number, y1: number, y2: number): Point;
3436
3608
  }
@@ -3442,17 +3614,17 @@ export declare namespace g {
3442
3614
 
3443
3615
  constructor();
3444
3616
  constructor(svgString: string);
3445
- constructor(points: PlainPoint[]);
3617
+ constructor(points: PointInit[]);
3446
3618
 
3447
3619
  bbox(): Rect | null;
3448
3620
 
3449
- closestPoint(p: PlainPoint | string): Point | null;
3621
+ closestPoint(p: PlainPoint): Point | null;
3450
3622
 
3451
- closestPointLength(p: PlainPoint | string): number;
3623
+ closestPointLength(p: PlainPoint): number;
3452
3624
 
3453
- closestPointNormalizedLength(p: PlainPoint | string): number;
3625
+ closestPointNormalizedLength(p: PlainPoint): number;
3454
3626
 
3455
- closestPointTangent(p: PlainPoint | string): Line | null;
3627
+ closestPointTangent(p: PlainPoint): Line | null;
3456
3628
 
3457
3629
  containsPoint(p: PlainPoint): boolean;
3458
3630
 
@@ -3472,7 +3644,7 @@ export declare namespace g {
3472
3644
 
3473
3645
  round(precision?: number): this;
3474
3646
 
3475
- scale(sx: number, sy: number, origin?: PlainPoint | string): this;
3647
+ scale(sx: number, sy: number, origin?: PointInit): this;
3476
3648
 
3477
3649
  simplify(opt?: { threshold?: number }): this;
3478
3650
 
@@ -3537,7 +3709,7 @@ export declare namespace g {
3537
3709
 
3538
3710
  clone(): Rect;
3539
3711
 
3540
- containsPoint(p: PlainPoint | string, opt?: StrictOpt): boolean;
3712
+ containsPoint(p: PointInit, opt?: StrictOpt): boolean;
3541
3713
 
3542
3714
  containsRect(r: PlainRect): boolean;
3543
3715
 
@@ -3551,7 +3723,7 @@ export declare namespace g {
3551
3723
 
3552
3724
  intersectionWithLine(l: Line): Point[] | null;
3553
3725
 
3554
- intersectionWithLineFromCenterToPoint(p: PlainPoint | string, angle?: number): Point;
3726
+ intersectionWithLineFromCenterToPoint(p: PointInit, angle?: number): Point;
3555
3727
 
3556
3728
  leftLine(): Line;
3557
3729
 
@@ -3563,6 +3735,8 @@ export declare namespace g {
3563
3735
 
3564
3736
  moveAndExpand(r: PlainRect): this;
3565
3737
 
3738
+ moveAroundPoint(origin: PlainPoint, angle: number): this;
3739
+
3566
3740
  normalize(): this;
3567
3741
 
3568
3742
  offset(dx?: number, dy?: number): this;
@@ -3570,7 +3744,7 @@ export declare namespace g {
3570
3744
 
3571
3745
  origin(): Point;
3572
3746
 
3573
- pointNearestToPoint(point: PlainPoint | string): Point;
3747
+ pointNearestToPoint(point: PointInit): Point;
3574
3748
 
3575
3749
  rightLine(): Line;
3576
3750
 
@@ -3578,9 +3752,9 @@ export declare namespace g {
3578
3752
 
3579
3753
  round(precision?: number): this;
3580
3754
 
3581
- scale(sx: number, sy: number, origin?: PlainPoint | string): this;
3755
+ scale(sx: number, sy: number, origin?: PointInit): this;
3582
3756
 
3583
- sideNearestToPoint(point: PlainPoint | string): RectangleSide;
3757
+ sideNearestToPoint(point: PointInit): RectangleSide;
3584
3758
 
3585
3759
  snapToGrid(gx: number, gy?: number): this;
3586
3760
 
@@ -3620,24 +3794,24 @@ export declare namespace g {
3620
3794
  p3: Point;
3621
3795
  }
3622
3796
 
3623
- export function curveThroughPoints(points: PlainPoint[] | Point[]): string[];
3797
+ export function curveThroughPoints(points: PlainPoint[]): string[];
3624
3798
 
3625
- export function getCurveControlPoints(points: PlainPoint[] | Point[]): [Point[], Point[]];
3799
+ export function getCurveControlPoints(points: PlainPoint[]): [Point[], Point[]];
3626
3800
 
3627
3801
  export function getCurveDivider(
3628
- p0: string | PlainPoint,
3629
- p1: string | PlainPoint,
3630
- p2: string | PlainPoint,
3631
- p3: string | PlainPoint
3802
+ p0: PointInit,
3803
+ p1: PointInit,
3804
+ p2: PointInit,
3805
+ p3: PointInit
3632
3806
  ): (t: number) => [IBezierCurve, IBezierCurve];
3633
3807
 
3634
3808
  export function getFirstControlPoints(rhs: number[]): number[];
3635
3809
 
3636
3810
  export function getInversionSolver(
3637
- p0: PlainPoint,
3638
- p1: PlainPoint,
3639
- p2: PlainPoint,
3640
- p3: PlainPoint
3811
+ p0: PointInit,
3812
+ p1: PointInit,
3813
+ p2: PointInit,
3814
+ p3: PointInit
3641
3815
  ): (p: PlainPoint) => number;
3642
3816
  }
3643
3817
 
@@ -3823,7 +3997,7 @@ export declare namespace highlighters {
3823
3997
  position?: Positions | dia.PositionName;
3824
3998
  size?: number | dia.Size;
3825
3999
  gap?: number;
3826
- margin?: number | dia.Sides;
4000
+ margin?: dia.Sides;
3827
4001
  }
3828
4002
  }
3829
4003
 
@@ -3872,7 +4046,7 @@ export declare namespace layout {
3872
4046
  angle: number;
3873
4047
  };
3874
4048
 
3875
- export type LayoutFunction = (ports: Array<Object>, elBBox: g.Rect, opt: Options) => Array<Transformation>;
4049
+ export type LayoutFunction = (ports: Array<dia.Element.Port>, elBBox: g.Rect, opt: Options) => Array<Transformation>;
3876
4050
 
3877
4051
  export interface Options {
3878
4052
  x?: number | string;
@@ -3885,9 +4059,11 @@ export declare namespace layout {
3885
4059
  startAngle?: number;
3886
4060
  step?: number;
3887
4061
  compensateRotation?: boolean;
4062
+ [key: string]: any;
3888
4063
  }
3889
4064
 
3890
4065
  var absolute: LayoutFunction;
4066
+ /** @deprecated */
3891
4067
  var fn: LayoutFunction;
3892
4068
  var line: LayoutFunction;
3893
4069
  var left: LayoutFunction;
@@ -3906,6 +4082,7 @@ export declare namespace layout {
3906
4082
  angle?: number;
3907
4083
  offset?: number;
3908
4084
  attrs?: dia.Cell.Selectors;
4085
+ [key: string]: any;
3909
4086
  }
3910
4087
 
3911
4088
  export interface LabelAttributes {
@@ -4142,7 +4319,7 @@ export declare namespace linkTools {
4142
4319
 
4143
4320
  export namespace Boundary {
4144
4321
  export interface Options extends dia.ToolView.Options<dia.LinkView> {
4145
- padding?: number | dia.Sides;
4322
+ padding?: dia.Sides;
4146
4323
  useModelGeometry?: boolean;
4147
4324
  }
4148
4325
  }
@@ -4640,6 +4817,7 @@ export declare namespace mvc {
4640
4817
  collection?: Collection<any> | undefined; // was: Collection<TModel>;
4641
4818
  el?: $Element<TElement> | string | undefined;
4642
4819
  id?: string | undefined;
4820
+ cid?: string | undefined;
4643
4821
  attributes?: Record<string, any> | undefined;
4644
4822
  className?: string | undefined;
4645
4823
  tagName?: string | undefined;
@@ -4666,7 +4844,7 @@ export declare namespace mvc {
4666
4844
 
4667
4845
  /**
4668
4846
  * Events hash or a method returning the events hash that maps events/selectors to methods on your View.
4669
- * For assigning events as object hash, do it like this: this.events = <any>{ "event:selector": callback, ... };
4847
+ * For assigning events as object hash, do it like this: `this.events = <any>{ "event:selector": callback, ... };`
4670
4848
  * That works only if you set it in the constructor or the initialize method.
4671
4849
  */
4672
4850
  events(): EventsHash;
@@ -4682,9 +4860,9 @@ export declare namespace mvc {
4682
4860
 
4683
4861
  el: TElement;
4684
4862
  attributes: Record<string, any>;
4685
- /* @deprecated use `el` instead */
4863
+ /** @deprecated use `el` instead */
4686
4864
  $el: Dom;
4687
- /* @deprecated use `el.querySelector()` instead */
4865
+ /** @deprecated use `el.querySelector()` instead */
4688
4866
  $(selector: string): Dom;
4689
4867
  render(): this;
4690
4868
  remove(): this;
@@ -5221,11 +5399,7 @@ export declare namespace util {
5221
5399
 
5222
5400
  export function parseCssNumeric(val: any, restrictUnits: string | string[]): { value: number, unit?: string } | null;
5223
5401
 
5224
- export type BreakTextFunction = (
5225
- text: string,
5226
- size: { width: number, height?: number },
5227
- attrs?: attributes.NativeSVGAttributes,
5228
- opt?: {
5402
+ export type BreakTextOptions = {
5229
5403
  svgDocument?: SVGElement;
5230
5404
  separator?: string | any;
5231
5405
  eol?: string;
@@ -5234,6 +5408,12 @@ export declare namespace util {
5234
5408
  maxLineCount?: number;
5235
5409
  preserveSpaces?: boolean;
5236
5410
  }
5411
+
5412
+ export type BreakTextFunction = (
5413
+ text: string,
5414
+ size: { width: number, height?: number },
5415
+ attrs?: attributes.NativeSVGAttributes,
5416
+ opt?: BreakTextOptions
5237
5417
  ) => string;
5238
5418
 
5239
5419
  var breakText: BreakTextFunction;
@@ -5494,6 +5674,8 @@ export declare namespace util {
5494
5674
 
5495
5675
  export function merge(destinationObject: object, ...args: any[]): object;
5496
5676
 
5677
+ export type MergeCustomizer = (value: any, srcValue: any, key: string, object: any, source: any, stack: any) => any;
5678
+
5497
5679
  // ADDITIONAL SIMPLE UTIL FUNCTIONS:
5498
5680
 
5499
5681
  export function isBoolean(value: any): boolean;
@@ -5545,6 +5727,7 @@ export declare namespace Vectorizer {
5545
5727
  annotations?: TextAnnotation[];
5546
5728
  includeAnnotationIndices?: boolean;
5547
5729
  displayEmpty?: boolean;
5730
+ useNoBreakSpace?: boolean;
5548
5731
  }
5549
5732
 
5550
5733
  export interface GetBBoxOptions {
@@ -5566,6 +5749,10 @@ export declare namespace Vectorizer {
5566
5749
  attrs: { [key: string]: any };
5567
5750
  }
5568
5751
 
5752
+ export interface TransformToElementOptions {
5753
+ safe?: boolean;
5754
+ }
5755
+
5569
5756
  // modifiable Matrix. SVGMatrix doesn't allow set on properties or a constructor.
5570
5757
  export interface Matrix {
5571
5758
  a: number;
@@ -5635,7 +5822,7 @@ export declare class VElement {
5635
5822
  id: string;
5636
5823
  node: SVGElement;
5637
5824
 
5638
- getTransformToElement(toElem: SVGGElement | VElement): SVGMatrix;
5825
+ getTransformToElement(target: SVGElement | VElement, opt?: Vectorizer.TransformToElementOptions): SVGMatrix;
5639
5826
 
5640
5827
  transform(): SVGMatrix;
5641
5828
  transform(matrix: SVGMatrix | Vectorizer.Matrix, opt?: Vectorizer.TransformOptions): this;
@@ -5744,6 +5931,9 @@ declare interface VStatic {
5744
5931
 
5745
5932
  ensureId(node: SVGElement | VElement): string;
5746
5933
 
5934
+ /**
5935
+ * @deprecated Use regular spaces and rely on xml:space="preserve" instead.
5936
+ */
5747
5937
  sanitizeText(text: string): string;
5748
5938
 
5749
5939
  isUndefined(value: any): boolean;
@@ -5758,6 +5948,8 @@ declare interface VStatic {
5758
5948
 
5759
5949
  qualifyAttr(name: string): Vectorizer.QualifiedAttribute;
5760
5950
 
5951
+ getCommonAncestor(node1: SVGElement | VElement, node2: SVGElement | VElement): SVGElement | null;
5952
+
5761
5953
  transformStringToMatrix(transform: string): SVGMatrix;
5762
5954
 
5763
5955
  matrixToTransformString(matrix: SVGMatrix | Vectorizer.Matrix): string;