@joint/core 4.2.0-alpha.0 → 4.2.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +3 -1
  2. package/dist/geometry.js +2 -2
  3. package/dist/geometry.min.js +3 -3
  4. package/dist/joint.d.ts +595 -198
  5. package/dist/joint.js +3895 -1304
  6. package/dist/joint.min.js +3 -3
  7. package/dist/joint.nowrap.js +3895 -1304
  8. package/dist/joint.nowrap.min.js +3 -3
  9. package/dist/vectorizer.js +21 -8
  10. package/dist/vectorizer.min.js +3 -3
  11. package/dist/version.mjs +1 -1
  12. package/package.json +13 -13
  13. package/src/V/index.mjs +20 -5
  14. package/src/alg/Deque.mjs +126 -0
  15. package/src/cellTools/Boundary.mjs +15 -13
  16. package/src/cellTools/Button.mjs +7 -5
  17. package/src/cellTools/Control.mjs +37 -14
  18. package/src/cellTools/HoverConnect.mjs +5 -1
  19. package/src/cellTools/helpers.mjs +44 -3
  20. package/src/config/index.mjs +11 -1
  21. package/src/dia/Cell.mjs +96 -83
  22. package/src/dia/CellCollection.mjs +136 -0
  23. package/src/dia/CellView.mjs +6 -0
  24. package/src/dia/Element.mjs +6 -5
  25. package/src/dia/ElementView.mjs +2 -1
  26. package/src/dia/Graph.mjs +610 -317
  27. package/src/dia/GraphLayer.mjs +53 -0
  28. package/src/dia/GraphLayerCollection.mjs +313 -0
  29. package/src/dia/GraphLayerView.mjs +128 -0
  30. package/src/dia/GraphLayersController.mjs +166 -0
  31. package/src/dia/GraphTopologyIndex.mjs +222 -0
  32. package/src/dia/{layers/GridLayer.mjs → GridLayerView.mjs} +23 -16
  33. package/src/dia/HighlighterView.mjs +22 -0
  34. package/src/dia/{PaperLayer.mjs → LayerView.mjs} +52 -17
  35. package/src/dia/LegacyGraphLayerView.mjs +14 -0
  36. package/src/dia/LinkView.mjs +118 -98
  37. package/src/dia/Paper.mjs +1441 -620
  38. package/src/dia/ToolView.mjs +4 -0
  39. package/src/dia/ToolsView.mjs +14 -5
  40. package/src/dia/attributes/text.mjs +4 -2
  41. package/src/dia/index.mjs +6 -1
  42. package/src/dia/ports.mjs +213 -84
  43. package/src/dia/symbols.mjs +24 -0
  44. package/src/elementTools/HoverConnect.mjs +14 -8
  45. package/src/env/index.mjs +6 -3
  46. package/src/layout/ports/port.mjs +30 -15
  47. package/src/layout/ports/portLabel.mjs +1 -1
  48. package/src/mvc/Collection.mjs +19 -19
  49. package/src/mvc/Model.mjs +13 -10
  50. package/src/mvc/View.mjs +4 -0
  51. package/src/mvc/ViewBase.mjs +1 -1
  52. package/types/geometry.d.ts +64 -60
  53. package/types/joint.d.ts +520 -137
  54. package/types/vectorizer.d.ts +11 -1
package/types/joint.d.ts CHANGED
@@ -8,6 +8,9 @@ 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;
13
+ var layerAttribute: string;
11
14
  }
12
15
 
13
16
  type NativeEvent = Event;
@@ -151,6 +154,89 @@ export namespace dia {
151
154
  util.filter.FilterJSON<'brightness'> |
152
155
  util.filter.FilterJSON<'contrast'>;
153
156
 
157
+ class CellCollection<C extends Cell = Cell> extends mvc.Collection<C> {
158
+
159
+ cellNamespace: any;
160
+ layer: GraphLayer;
161
+
162
+ minZIndex(): number;
163
+
164
+ maxZIndex(): number;
165
+ }
166
+
167
+ class GraphLayerCollection<L extends GraphLayer = GraphLayer> extends mvc.Collection<L> {
168
+
169
+ cellNamespace: any;
170
+ layerNamespace: any;
171
+ graph: Graph;
172
+
173
+ insert(layer: Graph.LayerInit, beforeId: GraphLayer.ID | null, opt?: ObjectHash): void;
174
+
175
+ getCell(cellRef: Graph.CellRef): Cell | undefined;
176
+
177
+ getCells(): Cell[];
178
+
179
+ removeCell(cell: Cell, opt?: ObjectHash): void;
180
+
181
+ moveCellBetweenLayers(cell: Cell, targetLayerId: GraphLayer.ID, opt?: ObjectHash): void;
182
+
183
+ addCellToLayer(cell: Cell, layerId: GraphLayer.ID, opt?: ObjectHash): void;
184
+ }
185
+
186
+ class GraphLayersController extends mvc.Listener<[]> {
187
+
188
+ graph: Graph;
189
+
190
+ layerCollection: GraphLayerCollection;
191
+
192
+ startListening(): void;
193
+
194
+ protected onCellChange(cell: Cell, opt: ObjectHash): void;
195
+
196
+ protected onCellRemove(cell: Cell, opt: ObjectHash): void;
197
+
198
+ protected onLayerCollectionEvent(eventName: string, ...args: any[]): void;
199
+
200
+ protected forwardLayerEvent(...args: any[]): void;
201
+
202
+ protected forwardCellEvent(...args: any[]): void;
203
+
204
+ protected forwardCellCollectionEvent(...args: any[]): void;
205
+
206
+ protected forwardLayerCollectionEvent(...args: any[]): void;
207
+ }
208
+
209
+ class GraphTopologyIndex extends mvc.Listener<[]> {
210
+
211
+ layerCollection: GraphLayerCollection;
212
+
213
+ startListening(): void;
214
+
215
+ getOutboundEdges(id: Cell.ID): { [edgeId: string]: true };
216
+
217
+ getInboundEdges(id: Cell.ID): { [edgeId: string]: true };
218
+
219
+ getSinkNodes(): string[];
220
+
221
+ getSourceNodes(): string[];
222
+
223
+ isSinkNode(id: Cell.ID): boolean;
224
+
225
+ isSourceNode(id: Cell.ID): boolean;
226
+
227
+ protected initializeIndex(): void;
228
+
229
+ protected _restructureOnReset(): void;
230
+
231
+ protected _restructureOnAdd(cell: Cell): void;
232
+
233
+ protected _restructureOnRemove(cell: Cell): void;
234
+
235
+ protected _restructureOnChangeSource(cell: Cell): void;
236
+
237
+ protected _restructureOnChangeTarget(cell: Cell): void;
238
+ }
239
+
154
240
  export namespace Graph {
155
241
 
156
242
  interface Options {
@@ -174,35 +260,100 @@ export namespace dia {
174
260
  strict?: boolean;
175
261
  }
176
262
 
263
+ interface SyncCellOptions extends Options {
264
+ remove?: boolean;
265
+ }
266
+
267
+ interface RemoveCellOptions extends Options {
268
+ disconnectLinks?: boolean;
269
+ replace?: boolean;
270
+ clear?: boolean;
271
+ }
272
+
177
273
  type SearchByKey = 'bbox' | PositionName;
178
274
 
179
275
  interface FindUnderElementOptions extends FindInAreaOptions, FindAtPointOptions {
180
276
  searchBy?: SearchByKey;
181
277
  }
182
278
 
183
- class Cells extends mvc.Collection<Cell> {
184
- graph: Graph;
185
- cellNamespace: any;
186
- }
279
+ type Cells = CellCollection;
280
+
281
+ type CellInit = Cell | Cell.JSON;
282
+
283
+ type CellRef = Cell | Cell.ID;
284
+
285
+ type LayerInit = GraphLayer | GraphLayer.Attributes;
286
+
287
+ type LayerRef = GraphLayer | GraphLayer.ID;
187
288
 
188
289
  interface Attributes {
189
- cells?: Cells;
290
+ /** @deprecated use cellsCollection property **/
291
+ cells?: CellCollection;
190
292
  [key: string]: any;
191
293
  }
294
+
295
+ interface JSON {
296
+ cells: Array<Cell.JSON>;
297
+ layers?: Array<GraphLayer.Attributes>;
298
+ defaultLayer?: string;
299
+ [key: string]: any;
300
+ }
301
+
302
+ interface InsertLayerOptions extends Options {
303
+ before?: GraphLayer.ID | null;
304
+ index?: number;
305
+ }
192
306
  }
193
307
 
194
308
  class Graph<A extends ObjectHash = Graph.Attributes, S = dia.ModelSetOptions> extends mvc.Model<A, S> {
195
309
 
196
- constructor(attributes?: Graph.Attributes, opt?: { cellNamespace?: any, cellModel?: typeof Cell });
310
+ layerCollection: GraphLayerCollection;
311
+
312
+ defaultLayerId: GraphLayer.ID;
313
+
314
+ layersController: GraphLayersController;
315
+
316
+ topologyIndex: GraphTopologyIndex;
317
+
318
+ constructor(attributes?: Graph.Attributes, opt?: {
319
+ cellNamespace?: any,
320
+ layerNamespace?: any,
321
+ /** @deprecated use cellNamespace instead */
322
+ cellModel?: typeof Cell
323
+ });
324
+
325
+ addCell(cell: Graph.CellInit, opt?: CollectionAddOptions): this;
326
+ addCell(cell: Array<Graph.CellInit>, opt?: CollectionAddOptions): this;
327
+
328
+ addCells(cells: Array<Graph.CellInit>, opt?: CollectionAddOptions): this;
329
+
330
+ removeCell(cell: Graph.CellRef, opt?: Graph.RemoveCellOptions): void;
331
+
332
+ removeCells(cells: Array<Graph.CellRef>, opt?: Graph.RemoveCellOptions): this;
197
333
 
198
- addCell(cell: Cell.JSON | Cell, opt?: CollectionAddOptions): this;
199
- addCell(cell: Array<Cell | Cell.JSON>, opt?: CollectionAddOptions): this;
334
+ resetCells(cells: Array<Graph.CellInit>, opt?: Graph.Options): this;
200
335
 
201
- addCells(cells: Array<Cell | Cell.JSON>, opt?: CollectionAddOptions): this;
336
+ syncCells(cells: Array<Graph.CellInit>, opt?: Graph.SyncCellOptions): void;
202
337
 
203
- resetCells(cells: Array<Cell | Cell.JSON>, opt?: Graph.Options): this;
338
+ addLayer(layerInit: Graph.LayerInit, opt?: Graph.InsertLayerOptions): void;
204
339
 
205
- getCell(id: Cell.ID | Cell): Cell;
340
+ moveLayer(layerRef: Graph.LayerRef, opt?: Graph.InsertLayerOptions): void;
341
+
342
+ removeLayer(layerRef: Graph.LayerRef, opt?: Graph.Options): void;
343
+
344
+ getDefaultLayer(): GraphLayer;
345
+
346
+ setDefaultLayer(id: string, opt?: Graph.Options): void;
347
+
348
+ getLayer(id: string): GraphLayer;
349
+
350
+ hasLayer(id: string): boolean;
351
+
352
+ getLayers(): GraphLayer[];
353
+
354
+ getCellLayerId(cell: Graph.CellRef): GraphLayer.ID;
355
+
356
+ getCell(id: Graph.CellRef): Cell;
206
357
 
207
358
  getElements(): Element[];
208
359
 
@@ -210,15 +361,15 @@ export namespace dia {
210
361
 
211
362
  getCells(): Cell[];
212
363
 
213
- getFirstCell(): Cell | undefined;
364
+ getFirstCell(layerId?: string): Cell | undefined;
214
365
 
215
- getLastCell(): Cell | undefined;
366
+ getLastCell(layerId?: string): Cell | undefined;
216
367
 
217
368
  getConnectedLinks(cell: Cell, opt?: Graph.ConnectionOptions): Link[];
218
369
 
219
370
  disconnectLinks(cell: Cell, opt?: S): void;
220
371
 
221
- removeLinks(cell: Cell, opt?: Cell.DisconnectableOptions): void;
372
+ removeLinks(cell: Graph.CellRef, opt?: Graph.RemoveCellOptions): void;
222
373
 
223
374
  translate(tx: number, ty?: number, opt?: Element.TranslateOptions): this;
224
375
 
@@ -290,6 +441,12 @@ export namespace dia {
290
441
 
291
442
  protected _filterCellsUnderElement(cells: Cell[], element: Element, opt: Graph.FindUnderElementOptions): Cell[];
292
443
 
444
+ protected _syncCell(cellInit: Graph.CellInit, opt?: Graph.Options): void;
445
+
446
+ protected _replaceCell(currentCell: Cell, newCellInit: Graph.CellInit, opt?: Graph.Options): void;
447
+
448
+ protected _resetLayers(layers: Array<Graph.LayerInit>, defaultLayerId: GraphLayer.ID | null, opt?: Graph.Options): this;
449
+
293
450
  /** @deprecated use `findElementsAtPoint` instead */
294
451
  findModelsFromPoint(p: Point): Element[];
295
452
 
@@ -305,11 +462,9 @@ export namespace dia {
305
462
 
306
463
  hasActiveBatch(name?: string | string[]): boolean;
307
464
 
308
- maxZIndex(): number;
309
-
310
- minZIndex(): number;
465
+ maxZIndex(layerId?: GraphLayer.ID): number;
311
466
 
312
- removeCells(cells: Cell[], opt?: Cell.DisconnectableOptions): this;
467
+ minZIndex(layerId?: GraphLayer.ID): number;
313
468
 
314
469
  transferCellEmbeds(sourceCell: Cell, targetCell: Cell, opt?: S): void;
315
470
 
@@ -368,9 +523,7 @@ export namespace dia {
368
523
  deep?: T;
369
524
  }
370
525
 
371
- interface DisconnectableOptions extends Options {
372
- disconnectLinks?: boolean;
373
- }
526
+ type DisconnectableOptions = Graph.RemoveCellOptions;
374
527
 
375
528
  interface GetEmbeddedCellsOptions extends EmbeddableOptions {
376
529
  breadthFirst?: boolean;
@@ -450,9 +603,9 @@ export namespace dia {
450
603
 
451
604
  protected generateId(): string | number;
452
605
 
453
- protected stopPendingTransitions(path?: string, delim?: string): void;
606
+ protected stopPendingTransitions(path?: Path, delim?: string): void;
454
607
 
455
- protected stopScheduledTransitions(path?: string, delim?: string): void;
608
+ protected stopScheduledTransitions(path?: Path, delim?: string): void;
456
609
 
457
610
  toJSON(opt?: dia.Cell.ExportOptions): Cell.JSON<any, A>;
458
611
 
@@ -490,11 +643,11 @@ export namespace dia {
490
643
 
491
644
  removeAttr(path: Path, opt?: Cell.Options): this;
492
645
 
493
- transition(path: string, value?: any, opt?: Cell.TransitionOptions, delim?: string): number;
646
+ transition(path: Path, value?: any, opt?: Cell.TransitionOptions, delim?: string): number;
494
647
 
495
648
  getTransitions(): string[];
496
649
 
497
- stopTransitions(path?: string, delim?: string): this;
650
+ stopTransitions(path?: Path, delim?: string): this;
498
651
 
499
652
  embed(cell: Cell | Cell[], opt?: Cell.EmbedOptions): this;
500
653
 
@@ -518,6 +671,9 @@ export namespace dia {
518
671
 
519
672
  z(): number;
520
673
 
674
+ layer(): string | null;
675
+ layer(id: string | null, opt?: Graph.Options): this;
676
+
521
677
  angle(): number;
522
678
 
523
679
  getBBox(): g.Rect;
@@ -539,6 +695,8 @@ export namespace dia {
539
695
 
540
696
  static define(type: string, defaults?: any, protoProps?: any, staticProps?: any): Cell.Constructor<Cell>;
541
697
 
698
+ static getAttributeDefinition(attrName: string): Cell.PresentationAttributeDefinition<CellView> | null;
699
+
542
700
  /**
543
701
  * @deprecated
544
702
  */
@@ -563,24 +721,40 @@ export namespace dia {
563
721
  interface Attributes extends GenericAttributes<Cell.Selectors> {
564
722
  }
565
723
 
566
- type PortPositionCallback = (ports: Port[], bbox: g.Rect) => dia.Point[];
724
+ interface ConstructorOptions extends Cell.ConstructorOptions {
725
+ portLayoutNamespace?: { [key: string]: layout.Port.LayoutFunction };
726
+ portLabelLayoutNamespace?: { [key: string]: layout.PortLabel.LayoutFunction };
727
+ }
728
+
729
+ type PortPositionCallback = layout.Port.LayoutFunction;
730
+
731
+ type PortLabelPositionCallback = layout.PortLabel.LayoutFunction;
567
732
 
568
733
  interface PortPositionJSON {
569
734
  name?: string;
570
- args?: { [key: string]: any };
735
+ args?: layout.Port.Options;
736
+ }
737
+
738
+ interface PortLabelPositionJSON {
739
+ name?: string;
740
+ args?: layout.PortLabel.Options;
571
741
  }
572
742
 
573
743
  type PositionType = string | PortPositionCallback | PortPositionJSON;
574
744
 
745
+ type PortLabelPositionType = PortLabelPositionCallback | PortPositionJSON;
746
+
575
747
  interface PortGroup {
576
748
  position?: PositionType;
577
749
  markup?: string | MarkupJSON;
578
750
  attrs?: Cell.Selectors;
579
751
  size?: Size;
580
- label?: {
581
- markup?: string | MarkupJSON;
582
- position?: PositionType;
583
- };
752
+ label?: PortLabel;
753
+ }
754
+
755
+ interface PortLabel {
756
+ markup?: string | MarkupJSON;
757
+ position?: PortLabelPositionType;
584
758
  }
585
759
 
586
760
  interface Port {
@@ -589,14 +763,12 @@ export namespace dia {
589
763
  group?: string;
590
764
  attrs?: Cell.Selectors;
591
765
  position?: {
592
- args?: { [key: string]: any };
766
+ args?: layout.Port.Options;
593
767
  };
594
- args?: { [key: string]: any };
768
+ /** @deprecated use `position.args` instead */
769
+ args?: layout.Port.Options;
595
770
  size?: Size;
596
- label?: {
597
- markup?: string | MarkupJSON;
598
- position?: PositionType;
599
- };
771
+ label?: PortLabel;
600
772
  z?: number | 'auto';
601
773
  }
602
774
 
@@ -626,13 +798,13 @@ export namespace dia {
626
798
  filter?: (cell: Cell) => boolean;
627
799
  deep?: boolean;
628
800
  padding?: Padding;
629
- minRect?: g.Rect;
801
+ minRect?: Partial<BBox>;
630
802
  expandOnly?: boolean;
631
803
  shrinkOnly?: boolean;
632
804
  }
633
805
 
634
806
  interface FitParentOptions extends FitToChildrenOptions {
635
- terminator?: Cell | Cell.ID;
807
+ terminator?: Graph.CellRef;
636
808
  }
637
809
 
638
810
  interface RotateOptions {
@@ -646,6 +818,8 @@ export namespace dia {
646
818
 
647
819
  class Element<A extends ObjectHash = Element.Attributes, S extends mvc.ModelSetOptions = dia.ModelSetOptions> extends Cell<A, S> {
648
820
 
821
+ constructor(attributes?: DeepPartial<A>, opt?: Element.ConstructorOptions);
822
+
649
823
  translate(tx: number, ty?: number, opt?: Element.TranslateOptions): this;
650
824
 
651
825
  position(opt?: Element.PositionOptions): g.Point;
@@ -1357,44 +1531,105 @@ export namespace dia {
1357
1531
  }
1358
1532
 
1359
1533
  enum Layers {
1360
- CELLS = 'cells',
1361
1534
  LABELS = 'labels',
1362
1535
  BACK = 'back',
1363
1536
  FRONT = 'front',
1537
+ /** @deprecated */
1538
+ CELLS = 'cells',
1364
1539
  TOOLS = 'tools',
1365
1540
  GRID = 'grid',
1366
1541
  }
1367
1542
 
1368
- type UpdateStats = {
1543
+ type LayerRef = Layers | string | dia.LayerView | dia.GraphLayer;
1544
+
1545
+ interface RenderStats {
1369
1546
  priority: number;
1370
1547
  updated: number;
1371
- empty?: boolean;
1372
- postponed?: number;
1373
- unmounted?: number;
1374
- mounted?: number;
1548
+ }
1549
+
1550
+ interface UpdateVisibilityStats {
1551
+ mounted: number;
1552
+ unmounted: number;
1553
+ }
1554
+
1555
+ interface RenderBatchStats extends RenderStats, UpdateVisibilityStats {
1556
+ postponed: number;
1557
+ empty: boolean;
1558
+ }
1559
+
1560
+ type UpdateStats = RenderStats & Partial<RenderBatchStats> & {
1375
1561
  batches?: number;
1376
1562
  };
1377
1563
 
1378
1564
  type ViewportCallback = (view: mvc.View<any, any>, isMounted: boolean, paper: Paper) => boolean;
1565
+ type CellVisibilityCallback = (cell: Cell, isMounted: boolean, paper: Paper) => boolean;
1379
1566
  type ProgressCallback = (done: boolean, processed: number, total: number, stats: UpdateStats, paper: Paper) => void;
1380
1567
  type BeforeRenderCallback = (opt: { [key: string]: any }, paper: Paper) => void;
1381
1568
  type AfterRenderCallback = (stats: UpdateStats, opt: { [key: string]: any }, paper: Paper) => void;
1382
1569
 
1383
- interface FreezeOptions {
1384
- key?: string;
1570
+ interface CellVisibilityOptions {
1571
+ cellVisibility?: CellVisibilityCallback | null;
1572
+
1573
+ /** @deprecated disable `legacyMode` and use `cellVisibility` instead */
1574
+ viewport?: ViewportCallback | null;
1385
1575
  }
1386
1576
 
1387
- interface UnfreezeOptions {
1388
- key?: string;
1577
+ interface MountOptions {
1389
1578
  mountBatchSize?: number;
1579
+ }
1580
+
1581
+ interface UnmountOptions {
1390
1582
  unmountBatchSize?: number;
1583
+ }
1584
+
1585
+ interface BatchSizeOptions {
1391
1586
  batchSize?: number;
1392
- viewport?: ViewportCallback;
1393
- progress?: ProgressCallback;
1587
+ }
1588
+
1589
+ interface BeforeRenderOptions {
1394
1590
  beforeRender?: BeforeRenderCallback;
1591
+ }
1592
+
1593
+ interface AfterRenderOptions {
1395
1594
  afterRender?: AfterRenderCallback;
1396
1595
  }
1397
1596
 
1597
+ interface RenderCallbackOptions extends BeforeRenderOptions, AfterRenderOptions, mvc.Silenceable {
1598
+
1599
+ }
1600
+
1601
+ interface KeyOptions {
1602
+ key?: string;
1603
+ }
1604
+
1605
+ interface UpdateViewOptions {
1606
+ [key: string]: any;
1607
+ }
1608
+
1609
+ interface UpdateViewsBatchOptions extends UpdateViewOptions, BatchSizeOptions, CellVisibilityOptions {
1610
+
1611
+ }
1612
+
1613
+ interface UpdateViewsOptions extends UpdateViewsBatchOptions, RenderCallbackOptions {
1614
+
1615
+ }
1616
+
1617
+ interface UpdateViewsAsyncOptions extends UpdateViewsBatchOptions, ScheduleCellsVisibilityUpdateOptions, RenderCallbackOptions {
1618
+ progress?: ProgressCallback;
1619
+ }
1620
+
1621
+ interface ScheduleCellsVisibilityUpdateOptions extends CellVisibilityOptions, MountOptions, UnmountOptions {
1622
+
1623
+ }
1624
+
1625
+ interface FreezeOptions extends KeyOptions {
1626
+
1627
+ }
1628
+
1629
+ interface UnfreezeOptions extends KeyOptions, UpdateViewsAsyncOptions, UpdateViewsOptions {
1630
+
1631
+ }
1632
+
1398
1633
  interface SnapLinksOptions {
1399
1634
  radius?: number;
1400
1635
  findInAreaOptions?: FindInAreaOptions;
@@ -1406,7 +1641,7 @@ export namespace dia {
1406
1641
  type FindParentByCallback = ((this: dia.Graph, elementView: ElementView, evt: dia.Event, x: number, y: number) => Cell[]);
1407
1642
  type MeasureNodeCallback = (node: SVGGraphicsElement, cellView: dia.CellView) => g.Rect;
1408
1643
 
1409
- interface Options extends mvc.ViewOptions<Graph> {
1644
+ interface Options extends mvc.ViewOptions<Graph>, CellVisibilityOptions, BeforeRenderOptions, AfterRenderOptions {
1410
1645
  // appearance
1411
1646
  width?: Dimension;
1412
1647
  height?: Dimension;
@@ -1449,6 +1684,7 @@ export namespace dia {
1449
1684
  validateUnembedding?: (this: Paper, childView: ElementView) => boolean;
1450
1685
  // default views, models & attributes
1451
1686
  cellViewNamespace?: any;
1687
+ layerViewNamespace?: any;
1452
1688
  routerNamespace?: any;
1453
1689
  connectorNamespace?: any;
1454
1690
  highlighterNamespace?: any;
@@ -1468,14 +1704,17 @@ export namespace dia {
1468
1704
  sorting?: sorting;
1469
1705
  frozen?: boolean;
1470
1706
  autoFreeze?: boolean;
1471
- viewport?: ViewportCallback | null;
1707
+ viewManagement?: ViewManagementOptions | boolean;
1472
1708
  onViewUpdate?: (view: mvc.View<any, any>, flag: number, priority: number, opt: { [key: string]: any }, paper: Paper) => void;
1473
1709
  onViewPostponed?: (view: mvc.View<any, any>, flag: number, paper: Paper) => boolean;
1474
- beforeRender?: Paper.BeforeRenderCallback;
1475
- afterRender?: Paper.AfterRenderCallback;
1476
1710
  overflow?: boolean;
1477
1711
  }
1478
1712
 
1713
+ interface ViewManagementOptions {
1714
+ lazyInitialize?: boolean;
1715
+ disposeHidden?: boolean;
1716
+ }
1717
+
1479
1718
  interface TransformToFitContentOptions {
1480
1719
  padding?: Padding;
1481
1720
  preserveAspectRatio?: boolean;
@@ -1608,6 +1847,22 @@ export namespace dia {
1608
1847
 
1609
1848
  interface FindInAreaOptions extends Graph.FindInAreaOptions, BufferOptions {
1610
1849
  }
1850
+
1851
+ interface FindClosestMagnetToPointOptions {
1852
+ radius?: number;
1853
+ findInAreaOptions?: FindInAreaOptions;
1854
+ filter?: (view: CellView, magnet: SVGElement) => boolean;
1855
+ }
1856
+
1857
+ interface ClosestMagnet {
1858
+ view: CellView;
1859
+ magnet: SVGElement;
1860
+ }
1861
+
1862
+ interface InsertLayerViewOptions {
1863
+ before?: LayerRef | null;
1864
+ index?: number;
1865
+ }
1611
1866
  }
1612
1867
 
1613
1868
  class Paper extends mvc.View<Graph> {
@@ -1620,10 +1875,14 @@ export namespace dia {
1620
1875
 
1621
1876
  svg: SVGSVGElement;
1622
1877
  defs: SVGDefsElement;
1878
+
1879
+ /** @deprecated use getLayerViewNode()*/
1623
1880
  cells: SVGGElement;
1881
+ /** @deprecated use layers property*/
1882
+ viewport: SVGGElement;
1883
+
1624
1884
  tools: SVGGElement;
1625
1885
  layers: SVGGElement;
1626
- viewport: SVGGElement;
1627
1886
 
1628
1887
  GUARDED_TAG_NAMES: string[];
1629
1888
  FORM_CONTROLS_TAG_NAMES: string[];
@@ -1699,7 +1958,7 @@ export namespace dia {
1699
1958
 
1700
1959
  findView<T extends ElementView | LinkView>(element: mvc.$SVGElement): T;
1701
1960
 
1702
- findViewByModel<T extends ElementView | LinkView>(model: Cell | Cell.ID): T;
1961
+ findViewByModel<T extends ElementView | LinkView>(model: Graph.CellRef): T;
1703
1962
 
1704
1963
  /**
1705
1964
  * Finds all the element views at the specified point
@@ -1743,6 +2002,13 @@ export namespace dia {
1743
2002
  */
1744
2003
  findCellViewsInArea(area: BBox, opt?: Paper.FindInAreaOptions): CellView[];
1745
2004
 
2005
+ /**
2006
+ * Finds the closest magnet to the specified point
2007
+ * @param point a point in local paper coordinates
2008
+ * @param opt options for the search
2009
+ */
2010
+ findClosestMagnetToPoint(point: Point, opt?: Paper.FindClosestMagnetToPointOptions): Paper.ClosestMagnet | null;
2011
+
1746
2012
  fitToContent(opt?: Paper.FitToContentOptions): g.Rect;
1747
2013
  fitToContent(gridWidth?: number, gridHeight?: number, padding?: number, opt?: any): g.Rect;
1748
2014
 
@@ -1754,7 +2020,7 @@ export namespace dia {
1754
2020
 
1755
2021
  getDefaultLink(cellView: CellView, magnet: SVGElement): Link;
1756
2022
 
1757
- getModelById(id: Cell.ID | Cell): Cell;
2023
+ getModelById(id: Graph.CellRef): Cell;
1758
2024
 
1759
2025
  setDimensions(width: Paper.Dimension, height: Paper.Dimension, data?: any): void;
1760
2026
 
@@ -1790,29 +2056,38 @@ export namespace dia {
1790
2056
 
1791
2057
  // layers
1792
2058
 
1793
- getLayerNode(layerName: Paper.Layers | string): SVGGElement;
2059
+ getLayerView(layerRef: Paper.LayerRef): LayerView;
2060
+ getLayerView(layer: GraphLayer): GraphLayerView;
1794
2061
 
1795
- getLayerView(layerName: Paper.Layers | string): PaperLayer;
2062
+ hasLayerView(layerRef: Paper.LayerRef): boolean;
1796
2063
 
1797
- hasLayerView(layerName: Paper.Layers | string): boolean;
2064
+ getLayerViews(): Array<LayerView>;
1798
2065
 
1799
- renderLayers(layers: Array<{ name: string }>): void;
2066
+ getGraphLayerViews(): Array<GraphLayerView>;
1800
2067
 
1801
- protected removeLayers(): void;
2068
+ addLayerView(layerView: LayerView, options?: Paper.InsertLayerViewOptions): void;
1802
2069
 
1803
- protected resetLayers(): void;
2070
+ moveLayerView(layerRef: Paper.LayerRef, options?: Paper.InsertLayerViewOptions): void;
1804
2071
 
1805
- addLayer(layerName: string, layerView: PaperLayer, options?: { insertBefore?: string }): void;
2072
+ removeLayerView(layerRef: Paper.LayerRef): void;
1806
2073
 
1807
- removeLayer(layer: string | PaperLayer): void;
2074
+ protected insertLayerView(layerView: LayerView, before?: Paper.LayerRef): void;
1808
2075
 
1809
- moveLayer(layer: string | PaperLayer, insertBefore: string | PaperLayer | null): void;
2076
+ protected requestLayerViewRemoval(layerRef: Paper.LayerRef): void;
1810
2077
 
1811
- hasLayer(layer: string | PaperLayer): boolean;
2078
+ protected createLayerView(options: Omit<LayerView.Options, 'paper'>): LayerView;
1812
2079
 
1813
- getLayerNames(): string[];
2080
+ protected getLayerViewOrder(): string[];
1814
2081
 
1815
- getLayers(): Array<PaperLayer>;
2082
+ protected renderLayerViews(): void;
2083
+
2084
+ protected renderImplicitLayerViews(): void;
2085
+
2086
+ protected renderGraphLayerViews(): void;
2087
+
2088
+ protected removeLayerViews(): void;
2089
+
2090
+ protected resetLayerViews(): void;
1816
2091
 
1817
2092
  // rendering
1818
2093
 
@@ -1820,39 +2095,33 @@ export namespace dia {
1820
2095
 
1821
2096
  unfreeze(opt?: Paper.UnfreezeOptions): void;
1822
2097
 
2098
+ wakeUp(): void;
2099
+
1823
2100
  isFrozen(): boolean;
1824
2101
 
1825
2102
  requestViewUpdate(view: mvc.View<any, any>, flag: number, priority: number, opt?: { [key: string]: any }): void;
1826
2103
 
1827
- requireView<T extends ElementView | LinkView>(model: Cell | Cell.ID, opt?: dia.Cell.Options): T;
1828
-
1829
- dumpViews(opt?: {
1830
- batchSize?: number;
1831
- mountBatchSize?: number;
1832
- unmountBatchSize?: number;
1833
- viewport?: Paper.ViewportCallback;
1834
- }): void;
2104
+ requestCellViewInsertion(cell: Graph.CellRef, opt?: { [key: string]: any }): void;
1835
2105
 
1836
- checkViewport(opt?: {
1837
- mountBatchSize?: number;
1838
- unmountBatchSize?: number;
1839
- viewport?: Paper.ViewportCallback;
1840
- }): {
1841
- mounted: number;
1842
- unmounted: number;
1843
- };
2106
+ requireView<T extends ElementView | LinkView>(cellOrId: Graph.CellRef, opt?: Paper.UpdateViewOptions & Paper.RenderCallbackOptions): T;
1844
2107
 
1845
- updateViews(opt?: {
1846
- batchSize?: number;
1847
- viewport?: Paper.ViewportCallback;
1848
- }): {
1849
- updated: number;
1850
- batches: number;
1851
- priority: number;
1852
- };
2108
+ updateViews(opt?: Paper.UpdateViewsOptions): Paper.RenderStats & { batches: number };
1853
2109
 
1854
2110
  hasScheduledUpdates(): boolean;
1855
2111
 
2112
+ disposeHiddenCellViews(): void;
2113
+
2114
+ isCellVisible(cellOrId: Graph.CellRef): boolean;
2115
+
2116
+ updateCellVisibility(
2117
+ cell: Graph.CellRef,
2118
+ opt?: Paper.CellVisibilityOptions & Paper.UpdateViewOptions & Paper.RenderCallbackOptions
2119
+ ): void;
2120
+
2121
+ updateCellsVisibility(
2122
+ opt?: Paper.ScheduleCellsVisibilityUpdateOptions & Paper.UpdateViewsOptions
2123
+ ): void;
2124
+
1856
2125
  // events
1857
2126
 
1858
2127
  on<T extends keyof Paper.EventMap = keyof Paper.EventMap>(eventName: T, callback: Paper.EventMap[T], context?: any): this;
@@ -1862,52 +2131,51 @@ export namespace dia {
1862
2131
  // protected
1863
2132
 
1864
2133
  /**
1865
- * For the specified view, calls the visibility viewport function specified by the paper.options.viewport function.
2134
+ * For the specified view, calls the cell visibility function specified by the `paper.options.cellVisibility` function.
1866
2135
  * 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.
2136
+ * 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()`.
2137
+ * 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
2138
  * @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.
2139
+ * @param opt if opt.cellVisibility is provided, it is used as the callback function instead of paper.options.cellVisibility.
1871
2140
  */
1872
- protected checkViewVisibility(cellView: dia.CellView, opt?: {
1873
- viewport?: Paper.ViewportCallback;
1874
- }): {
1875
- mounted: number;
1876
- unmounted: number;
1877
- };
2141
+ protected checkViewVisibility(
2142
+ cellView: dia.CellView,
2143
+ opt?: Paper.CellVisibilityOptions
2144
+ ): Paper.UpdateVisibilityStats;
2145
+
2146
+
2147
+ protected scheduleCellsVisibilityUpdate(opt?: Paper.ScheduleCellsVisibilityUpdateOptions): Paper.UpdateVisibilityStats;
1878
2148
 
1879
2149
  protected scheduleViewUpdate(view: mvc.View<any, any>, flag: number, priority: number, opt?: { [key: string]: any }): void;
1880
2150
 
1881
2151
  protected dumpViewUpdate(view: mvc.View<any, any>): number;
1882
2152
 
1883
- protected dumpView(view: mvc.View<any, any>, opt?: { [key: string]: any }): number;
2153
+ protected dumpView(view: mvc.View<any, any>, opt?: Paper.UpdateViewOptions & Paper.RenderCallbackOptions): number;
1884
2154
 
1885
- protected updateView(view: mvc.View<any, any>, flag: number, opt?: { [key: string]: any }): number;
2155
+ protected updateView(view: mvc.View<any, any>, flag: number, opt?: Paper.UpdateViewOptions): number;
1886
2156
 
1887
2157
  protected registerUnmountedView(view: mvc.View<any, any>): number;
1888
2158
 
1889
2159
  protected registerMountedView(view: mvc.View<any, any>): number;
1890
2160
 
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;
2161
+ protected updateViewsAsync(opt?: Paper.UpdateViewsAsyncOptions): void;
1899
2162
 
1900
- protected updateViewsBatch(opt?: {
1901
- batchSize?: number;
1902
- viewport?: Paper.ViewportCallback;
1903
- }): Paper.UpdateStats;
2163
+ protected updateViewsBatch(opt?: Paper.UpdateViewsBatchOptions): Paper.RenderBatchStats;
2164
+
2165
+ protected checkMountedViews(viewport: Paper.ViewportCallback, opt?: Paper.UnmountOptions): number;
1904
2166
 
1905
- protected checkMountedViews(viewport: Paper.ViewportCallback, opt?: { unmountBatchSize?: number }): number;
2167
+ protected checkUnmountedViews(viewport: Paper.ViewportCallback, opt?: Paper.MountOptions): number;
1906
2168
 
1907
- protected checkUnmountedViews(viewport: Paper.ViewportCallback, opt?: { mountBatchSize?: number }): number;
2169
+ protected prioritizeCellViewMount(cellOrId: Graph.CellRef): boolean;
2170
+
2171
+ protected prioritizeCellViewUnmount(cellOrId: Graph.CellRef): boolean;
2172
+
2173
+ protected isViewMounted(viewOrCid: dia.CellView | string): boolean;
1908
2174
 
1909
2175
  protected isAsync(): boolean;
1910
2176
 
2177
+ protected isIdle(): boolean;
2178
+
1911
2179
  protected isExactSorting(): boolean;
1912
2180
 
1913
2181
  protected sortViews(): void;
@@ -1961,6 +2229,14 @@ export namespace dia {
1961
2229
  protected onCellChanged(cell: Cell, opt: dia.Cell.Options): void;
1962
2230
  protected onCellChanged(cell: mvc.Collection<Cell>, opt: dia.Graph.Options): void;
1963
2231
 
2232
+ protected onGraphLayerAdd(layer: GraphLayer, collection: mvc.Collection<GraphLayer>, opt: dia.Graph.Options): void;
2233
+
2234
+ protected onGraphLayerRemove(layer: GraphLayer, collection: mvc.Collection<GraphLayer>, opt: dia.Graph.Options): void;
2235
+
2236
+ protected onGraphLayerCollectionReset(layer: mvc.Collection<GraphLayer>, opt: dia.Graph.Options): void;
2237
+
2238
+ protected onGraphLayerCollectionSort(layer: GraphLayer[]): void;
2239
+
1964
2240
  protected onGraphReset(cells: mvc.Collection<Cell>, opt: dia.Graph.Options): void;
1965
2241
 
1966
2242
  protected onGraphSort(): void;
@@ -1983,12 +2259,19 @@ export namespace dia {
1983
2259
 
1984
2260
  protected insertView(cellView: CellView, isInitialInsert: boolean): void;
1985
2261
 
1986
- protected detachView(cellView: CellView): void;
2262
+ protected _hideCellView(cellView: CellView): void;
2263
+
2264
+ protected _detachCellView(cellView: CellView): void;
1987
2265
 
1988
2266
  protected customEventTrigger(event: dia.Event, view: CellView, rootNode?: SVGElement): dia.Event | null;
1989
2267
 
1990
2268
  protected addStylesheet(stylesheet: string): void;
1991
2269
 
2270
+ /**
2271
+ * @deprecated use `getLayerView(id).el` instead
2272
+ * **/
2273
+ getLayerNode(id: Paper.Layers | string): SVGElement;
2274
+
1992
2275
  /**
1993
2276
  * @deprecated use `findElementViewsAtPoint()
1994
2277
  */
@@ -2003,19 +2286,32 @@ export namespace dia {
2003
2286
  * @deprecated use transformToFitContent
2004
2287
  */
2005
2288
  scaleContentToFit(opt?: Paper.ScaleContentOptions): void;
2289
+
2290
+ /**
2291
+ * @deprecated Use `updateCellsVisibility()`
2292
+ */
2293
+ checkViewport(opt?: Paper.ScheduleCellsVisibilityUpdateOptions): Paper.UpdateVisibilityStats;
2294
+
2295
+ /**
2296
+ * @deprecated Use `updateCellsVisibility()`
2297
+ */
2298
+ dumpViews(opt?: Paper.ScheduleCellsVisibilityUpdateOptions & Paper.UpdateViewsOptions): void;
2006
2299
  }
2007
2300
 
2008
- namespace PaperLayer {
2301
+ namespace LayerView {
2009
2302
 
2010
- interface Options extends mvc.ViewOptions<undefined, SVGElement> {
2011
- name: string;
2303
+ interface Options<T extends mvc.Model | undefined = undefined> extends mvc.ViewOptions<T, SVGElement> {
2304
+ id: string;
2305
+ paper: Paper;
2306
+ type?: string;
2012
2307
  }
2013
2308
  }
2014
- class PaperLayer extends mvc.View<undefined, SVGElement> {
2015
2309
 
2016
- constructor(opt?: PaperLayer.Options);
2310
+ class LayerView<T extends mvc.Model | undefined = undefined> extends mvc.View<T, SVGElement> {
2311
+
2312
+ constructor(opt?: LayerView.Options);
2017
2313
 
2018
- options: PaperLayer.Options;
2314
+ options: LayerView.Options;
2019
2315
 
2020
2316
  pivotNodes: { [z: number]: Comment };
2021
2317
 
@@ -2025,7 +2321,78 @@ export namespace dia {
2025
2321
 
2026
2322
  insertPivot(z: number): Comment;
2027
2323
 
2028
- removePivots(): void;
2324
+ isEmpty(): boolean;
2325
+
2326
+ reset(): void;
2327
+
2328
+ setPaperReference(paper: Paper): void;
2329
+
2330
+ unsetPaperReference(): void;
2331
+
2332
+ protected removePivots(): void;
2333
+
2334
+ protected afterPaperReferenceSet(paper: Paper): void;
2335
+
2336
+ protected beforePaperReferenceUnset(paper: Paper): void;
2337
+
2338
+ protected assertPaperReferenceSet(): void;
2339
+ }
2340
+
2341
+ namespace GraphLayer {
2342
+
2343
+ type ID = string;
2344
+
2345
+ interface Attributes extends mvc.ObjectHash {
2346
+ id: ID;
2347
+ type?: string;
2348
+ }
2349
+ }
2350
+
2351
+ class GraphLayer<C extends CellCollection = CellCollection, A extends GraphLayer.Attributes = GraphLayer.Attributes, S extends mvc.ModelSetOptions = dia.ModelSetOptions> extends mvc.Model<A, S> {
2352
+
2353
+ declare id: string;
2354
+
2355
+ cellCollection: C;
2356
+ graph: Graph | null;
2357
+
2358
+ constructor(attributes?: DeepPartial<A>, options?: mvc.ModelConstructorOptions<GraphLayer>);
2359
+
2360
+ getCells(): Cell[];
2361
+ }
2362
+
2363
+ class GraphLayerView<T extends GraphLayer = GraphLayer> extends LayerView<T> {
2364
+
2365
+ sort(): void;
2366
+
2367
+ sortExact(): void;
2368
+
2369
+ insertCellView(cellView: CellView): void;
2370
+
2371
+ protected onCellMove(cell: Cell, opt: Graph.Options): void;
2372
+
2373
+ protected onCellChange(cell: Cell, opt: Cell.Options): void;
2374
+
2375
+ protected onCellCollectionSort(collection: CellCollection, opt: Graph.Options): void;
2376
+
2377
+ protected onGraphBatchStop(data: any): void;
2378
+ }
2379
+
2380
+ namespace GridLayerView {
2381
+
2382
+ interface Options extends LayerView.Options {
2383
+ patterns?: Record<string, Paper.GridOptions[]>;
2384
+ }
2385
+ }
2386
+
2387
+ class GridLayerView extends LayerView {
2388
+
2389
+ setGrid(opt?: null | boolean | string | Paper.GridOptions | Paper.GridOptions[]): void;
2390
+
2391
+ renderGrid(): void;
2392
+
2393
+ updateGrid(): void;
2394
+
2395
+ removeGrid(): void;
2029
2396
  }
2030
2397
 
2031
2398
  namespace ToolsView {
@@ -2061,6 +2428,10 @@ export namespace dia {
2061
2428
  hide(): this;
2062
2429
 
2063
2430
  mount(): this;
2431
+
2432
+ getLayer(): string | null;
2433
+
2434
+ hasLayer(): boolean;
2064
2435
  }
2065
2436
 
2066
2437
  namespace ToolView {
@@ -2104,6 +2475,8 @@ export namespace dia {
2104
2475
 
2105
2476
  update(): void;
2106
2477
 
2478
+ isOverlay(): boolean;
2479
+
2107
2480
  protected guard(evt: dia.Event): boolean;
2108
2481
  }
2109
2482
 
@@ -2195,6 +2568,8 @@ export namespace dia {
2195
2568
  id?: string
2196
2569
  ): T[];
2197
2570
 
2571
+ static has(cellView: dia.CellView, id?: string): boolean;
2572
+
2198
2573
  static update(cellView: dia.CellView, id?: string): void;
2199
2574
 
2200
2575
  static transform(cellView: dia.CellView, id?: string): void;
@@ -2327,7 +2702,7 @@ export namespace highlighters {
2327
2702
  position?: Positions | dia.PositionName;
2328
2703
  size?: number | dia.Size;
2329
2704
  gap?: number;
2330
- margin?: number | dia.Sides;
2705
+ margin?: dia.Sides;
2331
2706
  }
2332
2707
  }
2333
2708
 
@@ -2677,7 +3052,7 @@ export namespace util {
2677
3052
  export function isPercentage(val: any): boolean;
2678
3053
 
2679
3054
  export function parseCssNumeric(val: any, restrictUnits: string | string[]): { value: number, unit?: string } | null;
2680
-
3055
+
2681
3056
  type BreakTextOptions = {
2682
3057
  svgDocument?: SVGElement;
2683
3058
  separator?: string | any;
@@ -2687,7 +3062,7 @@ export namespace util {
2687
3062
  maxLineCount?: number;
2688
3063
  preserveSpaces?: boolean;
2689
3064
  }
2690
-
3065
+
2691
3066
  type BreakTextFunction = (
2692
3067
  text: string,
2693
3068
  size: { width: number, height?: number },
@@ -2953,6 +3328,8 @@ export namespace util {
2953
3328
 
2954
3329
  export function merge(destinationObject: object, ...args: any[]): object;
2955
3330
 
3331
+ type MergeCustomizer = (value: any, srcValue: any, key: string, object: any, source: any, stack: any) => any;
3332
+
2956
3333
  // ADDITIONAL SIMPLE UTIL FUNCTIONS:
2957
3334
 
2958
3335
  export function isBoolean(value: any): boolean;
@@ -2992,7 +3369,7 @@ export namespace layout {
2992
3369
  angle: number;
2993
3370
  };
2994
3371
 
2995
- type LayoutFunction = (ports: Array<Object>, elBBox: g.Rect, opt: Options) => Array<Transformation>;
3372
+ type LayoutFunction = (ports: Array<dia.Element.Port>, elBBox: g.Rect, opt: Options) => Array<Transformation>;
2996
3373
 
2997
3374
  interface Options {
2998
3375
  x?: number | string;
@@ -3005,9 +3382,11 @@ export namespace layout {
3005
3382
  startAngle?: number;
3006
3383
  step?: number;
3007
3384
  compensateRotation?: boolean;
3385
+ [key: string]: any;
3008
3386
  }
3009
3387
 
3010
3388
  export var absolute: LayoutFunction;
3389
+ /** @deprecated */
3011
3390
  export var fn: LayoutFunction;
3012
3391
  export var line: LayoutFunction;
3013
3392
  export var left: LayoutFunction;
@@ -3026,6 +3405,7 @@ export namespace layout {
3026
3405
  angle?: number;
3027
3406
  offset?: number;
3028
3407
  attrs?: dia.Cell.Selectors;
3408
+ [key: string]: any;
3029
3409
  }
3030
3410
 
3031
3411
  interface LabelAttributes {
@@ -3172,6 +3552,7 @@ export namespace mvc {
3172
3552
 
3173
3553
  interface ModelConstructorOptions<TModel extends Model = Model> extends ModelSetOptions, Parseable {
3174
3554
  collection?: Collection<TModel> | undefined;
3555
+ eventPrefix?: string | undefined;
3175
3556
  }
3176
3557
 
3177
3558
  type CombinedModelConstructorOptions<E, M extends Model<any, any, E> = Model> = ModelConstructorOptions<M> & E;
@@ -3460,6 +3841,7 @@ export namespace mvc {
3460
3841
  collection?: Collection<any> | undefined; // was: Collection<TModel>;
3461
3842
  el?: $Element<TElement> | string | undefined;
3462
3843
  id?: string | undefined;
3844
+ cid?: string | undefined;
3463
3845
  attributes?: Record<string, any> | undefined;
3464
3846
  className?: string | undefined;
3465
3847
  tagName?: string | undefined;
@@ -3502,9 +3884,9 @@ export namespace mvc {
3502
3884
 
3503
3885
  el: TElement;
3504
3886
  attributes: Record<string, any>;
3505
- /* @deprecated use `el` instead */
3887
+ /** @deprecated use `el` instead */
3506
3888
  $el: Dom;
3507
- /* @deprecated use `el.querySelector()` instead */
3889
+ /** @deprecated use `el.querySelector()` instead */
3508
3890
  $(selector: string): Dom;
3509
3891
  render(): this;
3510
3892
  remove(): this;
@@ -3857,7 +4239,8 @@ export namespace anchors {
3857
4239
  }
3858
4240
 
3859
4241
  interface MidSideAnchorArguments extends RotateAnchorArguments, PaddingAnchorArguments {
3860
-
4242
+ mode?: 'prefer-horizontal' | 'prefer-vertical' | 'horizontal' | 'vertical' | 'auto';
4243
+ preferenceThreshold?: dia.Sides;
3861
4244
  }
3862
4245
 
3863
4246
  interface ModelCenterAnchorArguments {
@@ -4415,7 +4798,7 @@ export namespace elementTools {
4415
4798
 
4416
4799
  namespace Boundary {
4417
4800
  interface Options extends dia.ToolView.Options<dia.ElementView> {
4418
- padding?: number | dia.Sides;
4801
+ padding?: dia.Sides;
4419
4802
  useModelGeometry?: boolean;
4420
4803
  rotate?: boolean;
4421
4804
  }
@@ -4658,7 +5041,7 @@ export namespace linkTools {
4658
5041
 
4659
5042
  namespace Boundary {
4660
5043
  interface Options extends dia.ToolView.Options<dia.LinkView> {
4661
- padding?: number | dia.Sides;
5044
+ padding?: dia.Sides;
4662
5045
  useModelGeometry?: boolean;
4663
5046
  }
4664
5047
  }