@visuallyjs/browser-ui-angular 1.2.0 → 1.2.2

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 (55) hide show
  1. package/esm2022/index.mjs +6 -0
  2. package/esm2022/lib/background.component.mjs +38 -0
  3. package/esm2022/lib/base.group.component.mjs +3 -3
  4. package/esm2022/lib/base.node.component.mjs +3 -3
  5. package/esm2022/lib/base.port.component.mjs +4 -4
  6. package/esm2022/lib/base.vertex.component.mjs +33 -12
  7. package/esm2022/lib/browser-ui-angular.module.mjs +38 -8
  8. package/esm2022/lib/charts/area.chart.component.mjs +3 -3
  9. package/esm2022/lib/charts/bar.chart.component.mjs +3 -3
  10. package/esm2022/lib/charts/bubble.chart.component.mjs +3 -3
  11. package/esm2022/lib/charts/column.chart.component.mjs +3 -3
  12. package/esm2022/lib/charts/line.chart.component.mjs +3 -3
  13. package/esm2022/lib/charts/pie.chart.component.mjs +3 -3
  14. package/esm2022/lib/charts/sankey.chart.component.mjs +4 -4
  15. package/esm2022/lib/charts/scatter.chart.component.mjs +3 -3
  16. package/esm2022/lib/charts/series.based.chart.component.mjs +4 -4
  17. package/esm2022/lib/charts/xy.chart.component.mjs +3 -3
  18. package/esm2022/lib/color.tag.component.mjs +6 -6
  19. package/esm2022/lib/controls-component.mjs +4 -4
  20. package/esm2022/lib/decorator-component.mjs +3 -3
  21. package/esm2022/lib/default-group-component.mjs +3 -3
  22. package/esm2022/lib/default-node-component.mjs +3 -3
  23. package/esm2022/lib/diagram-component.mjs +34 -12
  24. package/esm2022/lib/diagram-palette-component.mjs +4 -4
  25. package/esm2022/lib/edge.type.picker.component.mjs +5 -5
  26. package/esm2022/lib/export-controls-component.mjs +3 -3
  27. package/esm2022/lib/grid-background.component.mjs +77 -0
  28. package/esm2022/lib/image-background.component.mjs +38 -0
  29. package/esm2022/lib/inspector.component.mjs +4 -4
  30. package/esm2022/lib/miniview-component.mjs +4 -4
  31. package/esm2022/lib/overlay-component.mjs +52 -1
  32. package/esm2022/lib/palette.component.mjs +4 -4
  33. package/esm2022/lib/paper-component.mjs +354 -0
  34. package/esm2022/lib/shape.component.mjs +4 -4
  35. package/esm2022/lib/shape.palette.component.mjs +4 -4
  36. package/esm2022/lib/surface-component.mjs +87 -16
  37. package/esm2022/lib/surface-popup-component.mjs +62 -0
  38. package/esm2022/lib/tiled-image-background.component.mjs +62 -0
  39. package/esm2022/lib/vjs-service.mjs +3 -3
  40. package/fesm2022/visuallyjs-browser-ui-angular.mjs +938 -144
  41. package/fesm2022/visuallyjs-browser-ui-angular.mjs.map +1 -1
  42. package/index.d.ts +6 -0
  43. package/lib/background.component.d.ts +13 -0
  44. package/lib/base.vertex.component.d.ts +29 -3
  45. package/lib/browser-ui-angular.module.d.ts +27 -21
  46. package/lib/diagram-component.d.ts +7 -5
  47. package/lib/grid-background.component.d.ts +81 -0
  48. package/lib/image-background.component.d.ts +18 -0
  49. package/lib/overlay-component.d.ts +32 -8
  50. package/lib/paper-component.d.ts +162 -0
  51. package/lib/surface-component.d.ts +25 -11
  52. package/lib/surface-popup-component.d.ts +62 -0
  53. package/lib/tiled-image-background.component.d.ts +72 -0
  54. package/package.json +2 -2
  55. package/visuallyjs-browser-ui-angular.tgz +0 -0
package/index.d.ts CHANGED
@@ -17,6 +17,8 @@ export * from './lib/default-group-component';
17
17
  export * from './lib/common';
18
18
  export * from './lib/miniview-component';
19
19
  export * from './lib/surface-component';
20
+ export * from './lib/surface-popup-component';
21
+ export * from './lib/paper-component';
20
22
  export * from './lib/overlay-component';
21
23
  export * from './lib/palette.component';
22
24
  export * from './lib/decorator-component';
@@ -41,3 +43,7 @@ export * from './lib/charts/bubble.chart.component';
41
43
  export * from './lib/charts/sankey.chart.component';
42
44
  export * from './lib/hooks/use-zoom';
43
45
  export * from './lib/hooks/use-visuallyjs-update';
46
+ export * from './lib/background.component';
47
+ export * from './lib/image-background.component';
48
+ export * from './lib/tiled-image-background.component';
49
+ export * from './lib/grid-background.component';
@@ -0,0 +1,13 @@
1
+ import { AfterViewInit } from "@angular/core";
2
+ import { BackgroundOptions } from "@visuallyjs/browser-ui";
3
+ import { VisuallyJsService } from "./vjs-service";
4
+ import * as i0 from "@angular/core";
5
+ export declare class BackgroundComponent implements AfterViewInit {
6
+ options: BackgroundOptions;
7
+ $vjs: VisuallyJsService;
8
+ private _bg;
9
+ private _optionsEffect;
10
+ ngAfterViewInit(): void;
11
+ static ɵfac: i0.ɵɵFactoryDeclaration<BackgroundComponent, never>;
12
+ static ɵcmp: i0.ɵɵComponentDeclaration<BackgroundComponent, "vjs-background", never, { "options": { "alias": "options"; "required": false; }; }, {}, never, ["*"], false, never>;
13
+ }
@@ -1,5 +1,5 @@
1
1
  import { ChangeDetectorRef, OnDestroy, OnInit } from "@angular/core";
2
- import { ObjectData, Node, Surface, BrowserElement, VisuallyJsModel, SurfaceVertexCloneOptions, Port } from "@visuallyjs/browser-ui";
2
+ import { ObjectData, Node, Surface, BrowserElement, VisuallyJsModel, SurfaceVertexCloneOptions, Port, Edge, Paper, BrowserUI } from "@visuallyjs/browser-ui";
3
3
  import * as i0 from "@angular/core";
4
4
  /**
5
5
  * Superclass for base node and base group components. You wont need to interact directly with this class; other component base classed in VisuallyJs extend from it.
@@ -19,10 +19,20 @@ export declare abstract class BaseVertexComponent<T extends Node> implements OnI
19
19
  */
20
20
  model: VisuallyJsModel;
21
21
  /**
22
- * Underlying Surface. Visually sets this.
22
+ * Underlying Surface. Visually sets this, if the component is rendered by a SurfaceComponent.
23
23
  * @internal
24
24
  */
25
25
  surface: Surface;
26
+ /**
27
+ * Underlying Paper. Visually sets this, if the component is rendered by a PaperComponent.
28
+ * @internal
29
+ */
30
+ paper: Paper;
31
+ /**
32
+ * Underlying UI. Visually sets this, regardless of the component this was rendered by (ie Surface or Paper).
33
+ * @internal
34
+ */
35
+ ui: BrowserUI;
26
36
  /**
27
37
  * Underlying model object. Visually sets this.
28
38
  * @internal
@@ -46,6 +56,22 @@ export declare abstract class BaseVertexComponent<T extends Node> implements OnI
46
56
  * @classMember
47
57
  */
48
58
  zoom: import("@angular/core").WritableSignal<number>;
59
+ /**
60
+ * This signal provides all of the edges for which this vertex is the source. These are edges connected to the vertex, not to its ports.
61
+ */
62
+ sourceEdges: import("@angular/core").WritableSignal<Edge[]>;
63
+ /**
64
+ * This signal provides all of the edges for which this vertex or one of its ports is the source.
65
+ */
66
+ allSourceEdges: import("@angular/core").WritableSignal<Edge[]>;
67
+ /**
68
+ * This signal provides all of the edges for which this vertex is the target. These are edges connected to the vertex, not to its ports.
69
+ */
70
+ targetEdges: import("@angular/core").WritableSignal<Edge[]>;
71
+ /**
72
+ * This signal provides all of the edges for which this vertex or one of its ports is the target.
73
+ */
74
+ allTargetEdges: import("@angular/core").WritableSignal<Edge[]>;
49
75
  /**
50
76
  * @internal
51
77
  * @private
@@ -56,6 +82,7 @@ export declare abstract class BaseVertexComponent<T extends Node> implements OnI
56
82
  * @internal
57
83
  */
58
84
  ngOnInit(): void;
85
+ $updateEdges(): void;
59
86
  /**
60
87
  * Gets the vertex that this component represents. Subclasses have getters that return more specific subclasses of Vertex.
61
88
  * @classMember
@@ -119,7 +146,6 @@ export declare abstract class BaseVertexComponent<T extends Node> implements OnI
119
146
  * Flash this vertex
120
147
  * @param duration Optional; defaults to 1000ms. Duration of the animation in milliseconds.
121
148
  * @param animName Optional; the name of the CSS animation to apply. Defaults to ANIM_SURFACE_ELEMENT_FLASH.
122
- * @internal
123
149
  */
124
150
  flashVertex(duration: number, animName?: string): void;
125
151
  static ɵfac: i0.ɵɵFactoryDeclaration<BaseVertexComponent<any>, never>;
@@ -4,26 +4,32 @@ import * as i2 from "./default-group-component";
4
4
  import * as i3 from "./base.port.component";
5
5
  import * as i4 from "./miniview-component";
6
6
  import * as i5 from "./surface-component";
7
- import * as i6 from "./palette.component";
8
- import * as i7 from "./shape.palette.component";
9
- import * as i8 from "./diagram-palette-component";
10
- import * as i9 from "./shape.component";
11
- import * as i10 from "./controls-component";
12
- import * as i11 from "./edge.type.picker.component";
13
- import * as i12 from "./export-controls-component";
14
- import * as i13 from "./color.tag.component";
15
- import * as i14 from "./diagram-component";
16
- import * as i15 from "./charts/column.chart.component";
17
- import * as i16 from "./charts/bar.chart.component";
18
- import * as i17 from "./charts/xy.chart.component";
19
- import * as i18 from "./charts/line.chart.component";
20
- import * as i19 from "./charts/area.chart.component";
21
- import * as i20 from "./charts/pie.chart.component";
22
- import * as i21 from "./charts/scatter.chart.component";
23
- import * as i22 from "./charts/bubble.chart.component";
24
- import * as i23 from "./charts/sankey.chart.component";
25
- import * as i24 from "./decorator-component";
26
- import * as i25 from "@angular/common";
7
+ import * as i6 from "./paper-component";
8
+ import * as i7 from "./palette.component";
9
+ import * as i8 from "./shape.palette.component";
10
+ import * as i9 from "./diagram-palette-component";
11
+ import * as i10 from "./shape.component";
12
+ import * as i11 from "./controls-component";
13
+ import * as i12 from "./edge.type.picker.component";
14
+ import * as i13 from "./export-controls-component";
15
+ import * as i14 from "./color.tag.component";
16
+ import * as i15 from "./diagram-component";
17
+ import * as i16 from "./charts/column.chart.component";
18
+ import * as i17 from "./charts/bar.chart.component";
19
+ import * as i18 from "./charts/xy.chart.component";
20
+ import * as i19 from "./charts/line.chart.component";
21
+ import * as i20 from "./charts/area.chart.component";
22
+ import * as i21 from "./charts/pie.chart.component";
23
+ import * as i22 from "./charts/scatter.chart.component";
24
+ import * as i23 from "./charts/bubble.chart.component";
25
+ import * as i24 from "./charts/sankey.chart.component";
26
+ import * as i25 from "./decorator-component";
27
+ import * as i26 from "./surface-popup-component";
28
+ import * as i27 from "./background.component";
29
+ import * as i28 from "./image-background.component";
30
+ import * as i29 from "./grid-background.component";
31
+ import * as i30 from "./tiled-image-background.component";
32
+ import * as i31 from "@angular/common";
27
33
  /**
28
34
  * VisuallyJs Angular module.
29
35
  *
@@ -59,6 +65,6 @@ import * as i25 from "@angular/common";
59
65
  */
60
66
  export declare class VisuallyJsModule {
61
67
  static ɵfac: i0.ɵɵFactoryDeclaration<VisuallyJsModule, never>;
62
- static ɵmod: i0.ɵɵNgModuleDeclaration<VisuallyJsModule, [typeof i1.DefaultNodeComponent, typeof i2.DefaultGroupComponent, typeof i3.BasePortComponent, typeof i4.MiniviewComponent, typeof i5.SurfaceComponent, typeof i6.PaletteComponent, typeof i7.ShapePaletteComponent, typeof i8.DiagramPaletteComponent, typeof i9.ShapeComponent, typeof i10.ControlsComponent, typeof i11.EdgeTypePickerComponent, typeof i6.PaletteComponent, typeof i12.ExportControlsComponent, typeof i13.ColorPickerComponent, typeof i14.DiagramComponent, typeof i15.ColumnChartComponent, typeof i16.BarChartComponent, typeof i17.XYChartComponent, typeof i18.LineChartComponent, typeof i19.AreaChartComponent, typeof i20.PieChartComponent, typeof i21.ScatterChartComponent, typeof i22.BubbleChartComponent, typeof i23.SankeyChartComponent, typeof i24.DecoratorComponent], [typeof i25.CommonModule], [typeof i4.MiniviewComponent, typeof i5.SurfaceComponent, typeof i6.PaletteComponent, typeof i8.DiagramPaletteComponent, typeof i9.ShapeComponent, typeof i7.ShapePaletteComponent, typeof i10.ControlsComponent, typeof i12.ExportControlsComponent, typeof i11.EdgeTypePickerComponent, typeof i13.ColorPickerComponent, typeof i14.DiagramComponent, typeof i15.ColumnChartComponent, typeof i16.BarChartComponent, typeof i17.XYChartComponent, typeof i18.LineChartComponent, typeof i19.AreaChartComponent, typeof i20.PieChartComponent, typeof i21.ScatterChartComponent, typeof i22.BubbleChartComponent, typeof i23.SankeyChartComponent, typeof i24.DecoratorComponent]>;
68
+ static ɵmod: i0.ɵɵNgModuleDeclaration<VisuallyJsModule, [typeof i1.DefaultNodeComponent, typeof i2.DefaultGroupComponent, typeof i3.BasePortComponent, typeof i4.MiniviewComponent, typeof i5.SurfaceComponent, typeof i6.PaperComponent, typeof i7.PaletteComponent, typeof i8.ShapePaletteComponent, typeof i9.DiagramPaletteComponent, typeof i10.ShapeComponent, typeof i11.ControlsComponent, typeof i12.EdgeTypePickerComponent, typeof i7.PaletteComponent, typeof i13.ExportControlsComponent, typeof i14.ColorPickerComponent, typeof i15.DiagramComponent, typeof i16.ColumnChartComponent, typeof i17.BarChartComponent, typeof i18.XYChartComponent, typeof i19.LineChartComponent, typeof i20.AreaChartComponent, typeof i21.PieChartComponent, typeof i22.ScatterChartComponent, typeof i23.BubbleChartComponent, typeof i24.SankeyChartComponent, typeof i25.DecoratorComponent, typeof i26.SurfacePopupComponent, typeof i27.BackgroundComponent, typeof i28.ImageBackgroundComponent, typeof i29.GridBackgroundComponent, typeof i30.TiledImageBackgroundComponent], [typeof i31.CommonModule], [typeof i4.MiniviewComponent, typeof i5.SurfaceComponent, typeof i6.PaperComponent, typeof i7.PaletteComponent, typeof i9.DiagramPaletteComponent, typeof i10.ShapeComponent, typeof i8.ShapePaletteComponent, typeof i11.ControlsComponent, typeof i13.ExportControlsComponent, typeof i12.EdgeTypePickerComponent, typeof i14.ColorPickerComponent, typeof i15.DiagramComponent, typeof i16.ColumnChartComponent, typeof i17.BarChartComponent, typeof i18.XYChartComponent, typeof i19.LineChartComponent, typeof i20.AreaChartComponent, typeof i21.PieChartComponent, typeof i22.ScatterChartComponent, typeof i23.BubbleChartComponent, typeof i24.SankeyChartComponent, typeof i25.DecoratorComponent, typeof i26.SurfacePopupComponent, typeof i27.BackgroundComponent, typeof i28.ImageBackgroundComponent, typeof i29.GridBackgroundComponent, typeof i30.TiledImageBackgroundComponent]>;
63
69
  static ɵinj: i0.ɵɵInjectorDeclaration<VisuallyJsModule>;
64
70
  }
@@ -13,15 +13,15 @@ export declare class DiagramComponent implements AfterViewInit, OnDestroy {
13
13
  */
14
14
  options?: DiagramOptions;
15
15
  /**
16
- * Optional data to load after creation
16
+ * Optional data to load after the view has been initialised. This input is a signal, and will reload the dataset if changed.
17
17
  * @input
18
18
  */
19
- data?: any;
19
+ data: import("@angular/core").InputSignal<Record<string, any>>;
20
20
  /**
21
- * Optional URL from which to load data after creation
21
+ * Optional url from which to load data after the view has been initialised. This input is a signal, and will reload the dataset if changed.
22
22
  * @input
23
23
  */
24
- url?: string;
24
+ url: import("@angular/core").InputSignal<string>;
25
25
  /**
26
26
  * Options for the underlying model
27
27
  * @input
@@ -35,6 +35,8 @@ export declare class DiagramComponent implements AfterViewInit, OnDestroy {
35
35
  $ngZone: NgZone;
36
36
  $el: ElementRef<any>;
37
37
  $vjs: VisuallyJsService;
38
+ private _dataEffect;
39
+ private _urlEffect;
38
40
  ngAfterViewInit(): void;
39
41
  ngOnDestroy(): void;
40
42
  /**
@@ -48,5 +50,5 @@ export declare class DiagramComponent implements AfterViewInit, OnDestroy {
48
50
  */
49
51
  saveToUrl(options: SaveOptions): void;
50
52
  static ɵfac: i0.ɵɵFactoryDeclaration<DiagramComponent, never>;
51
- static ɵcmp: i0.ɵɵComponentDeclaration<DiagramComponent, "vjs-diagram", never, { "options": { "alias": "options"; "required": false; }; "data": { "alias": "data"; "required": false; }; "url": { "alias": "url"; "required": false; }; "modelOptions": { "alias": "modelOptions"; "required": false; }; }, {}, never, ["*"], false, never>;
53
+ static ɵcmp: i0.ɵɵComponentDeclaration<DiagramComponent, "vjs-diagram", never, { "options": { "alias": "options"; "required": false; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; "url": { "alias": "url"; "required": false; "isSignal": true; }; "modelOptions": { "alias": "modelOptions"; "required": false; }; }, {}, never, ["*"], false, never>;
52
54
  }
@@ -0,0 +1,81 @@
1
+ import { AfterViewInit } from "@angular/core";
2
+ import { Grid, GridType } from "@visuallyjs/browser-ui";
3
+ import { VisuallyJsService } from "./vjs-service";
4
+ import * as i0 from "@angular/core";
5
+ /**
6
+ * Renders a grid background on a surface or paper.
7
+ * @group Components
8
+ */
9
+ export declare class GridBackgroundComponent implements AfterViewInit {
10
+ /**
11
+ * The grid to use. This is optional; if you do not supply one the background will attempt to read the grid definition from the Surface. If that is also not set then a default grid of 50x50 pixels will be used.
12
+ * @input
13
+ */
14
+ grid?: Grid;
15
+ /**
16
+ * Whether or not to show a thick border around the entire background. Defaults to false.
17
+ * @input
18
+ */
19
+ showBorder?: boolean;
20
+ /**
21
+ * The minimum width for the grid. The value you provided is divided by 2 and then the grid is guaranteed to always at least span the range of (-minWidth / 2) - (minWidth / 2). Defaults to 20 000.
22
+ * @input
23
+ */
24
+ minWidth?: number;
25
+ /**
26
+ * The minimum height for the grid. The value you provided is divided by 2 and then the grid is guaranteed to always at least span the range of (-minHeight / 2) - (minHeight / 2). Defaults to 20 000.
27
+ * @input
28
+ */
29
+ minHeight?: number;
30
+ /**
31
+ * Defaults to false. If true, the grid will also draw tick marks between the grid lines.
32
+ * @input
33
+ */
34
+ showTickMarks?: boolean;
35
+ /**
36
+ * Number of tick marks to draw per cell. Defaults to 2.
37
+ * @input
38
+ */
39
+ tickMarksPerCell?: number;
40
+ /**
41
+ * The maximum width for the grid. The value you provided is divided by 2 and then the grid is guaranteed to never exceed the range of (-maxWidth / 2) - (maxWidth / 2). maxWidth takes precedence over minWidth.
42
+ * @input
43
+ */
44
+ maxWidth?: number;
45
+ /**
46
+ * The maximum height for the grid. The value you provided is divided by 2 and then the grid is guaranteed to never exceed the range of (-maxHeight / 2) - (maxHeight / 2). maxHeight takes precedence over minHeight.
47
+ * @input
48
+ */
49
+ maxHeight?: number;
50
+ /**
51
+ * Defaults to true, and instructs the grid that if the grid has grown beyond any minimum value set in either axis, if the content bounds subsequently shrink in that axis below the minimum, the grid should shrink back to the minimum. If you set this to false the grid will never shrink back to its minimum values once they have been exceeded.
52
+ * @input
53
+ */
54
+ autoShrink?: boolean;
55
+ /**
56
+ * Type of grid - lines or dots. Defaults to lines.
57
+ * @input
58
+ */
59
+ gridType?: GridType;
60
+ /**
61
+ * The radius for dots representing grid positions (when gridType id GridTypes.dotted). Defaults to 2.
62
+ * @input
63
+ */
64
+ dotRadius?: number;
65
+ /**
66
+ * The radius for dots representing grid tick marks (when gridType id GridTypes.dotted). Defaults to 1.
67
+ * @input
68
+ */
69
+ tickDotRadius?: number;
70
+ /**
71
+ * Whether or not the background is initially visible. Defaults to true.
72
+ * @input
73
+ */
74
+ visible?: boolean;
75
+ $vjs: VisuallyJsService;
76
+ private _bg;
77
+ private _getOptions;
78
+ ngAfterViewInit(): void;
79
+ static ɵfac: i0.ɵɵFactoryDeclaration<GridBackgroundComponent, never>;
80
+ static ɵcmp: i0.ɵɵComponentDeclaration<GridBackgroundComponent, "vjs-grid-background", never, { "grid": { "alias": "grid"; "required": false; }; "showBorder": { "alias": "showBorder"; "required": false; }; "minWidth": { "alias": "minWidth"; "required": false; }; "minHeight": { "alias": "minHeight"; "required": false; }; "showTickMarks": { "alias": "showTickMarks"; "required": false; }; "tickMarksPerCell": { "alias": "tickMarksPerCell"; "required": false; }; "maxWidth": { "alias": "maxWidth"; "required": false; }; "maxHeight": { "alias": "maxHeight"; "required": false; }; "autoShrink": { "alias": "autoShrink"; "required": false; }; "gridType": { "alias": "gridType"; "required": false; }; "dotRadius": { "alias": "dotRadius"; "required": false; }; "tickDotRadius": { "alias": "tickDotRadius"; "required": false; }; "visible": { "alias": "visible"; "required": false; }; }, {}, never, ["*"], false, never>;
81
+ }
@@ -0,0 +1,18 @@
1
+ import { AfterViewInit } from "@angular/core";
2
+ import { VisuallyJsService } from "./vjs-service";
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * Renders an image background on a surface or paper.
6
+ * @group Components
7
+ */
8
+ export declare class ImageBackgroundComponent implements AfterViewInit {
9
+ /**
10
+ * The url to load
11
+ * @input
12
+ */
13
+ url: string;
14
+ $vjs: VisuallyJsService;
15
+ ngAfterViewInit(): void;
16
+ static ɵfac: i0.ɵɵFactoryDeclaration<ImageBackgroundComponent, never>;
17
+ static ɵcmp: i0.ɵɵComponentDeclaration<ImageBackgroundComponent, "vjs-image-background", never, { "url": { "alias": "url"; "required": false; }; }, {}, never, ["*"], false, never>;
18
+ }
@@ -1,7 +1,7 @@
1
- import { Edge, ObjectData, Surface } from "@visuallyjs/browser-ui";
2
- import { ChangeDetectorRef } from "@angular/core";
3
- import { VisuallyJsModel } from "@visuallyjs/browser-ui";
1
+ import { BrowserUI, Edge, ObjectData, VisuallyJsModel } from "@visuallyjs/browser-ui";
2
+ import { ChangeDetectorRef, OnDestroy, OnInit } from "@angular/core";
4
3
  import { VisuallyJsAngularComponent } from "./surface-component";
4
+ import * as i0 from "@angular/core";
5
5
  /**
6
6
  * Defines the type for an overlay that is represented by an angular component. Use this value in your views instead of "Arrow", "Label" etc.
7
7
  * @group Components
@@ -10,27 +10,32 @@ export declare const AngularComponentOverlayType = "AngularComponent";
10
10
  /**
11
11
  * Definition of an angular component that will act as an overlay. This interface exists largely for convenience; the code will write the members of this interface onto any component it creates.
12
12
  */
13
- export interface AngularOverlayComponent extends VisuallyJsAngularComponent {
13
+ export interface AngularOverlayComponent<T extends BrowserUI = BrowserUI> extends VisuallyJsAngularComponent<T> {
14
14
  /**
15
15
  * The edge that this overlay is drawn on.
16
16
  */
17
17
  edge: Edge;
18
18
  }
19
19
  /**
20
- * A component that you can use as a base for your own overlay component if its convenient for you. This class offers an `updateEdge` and a `removeEdge` method, as helpers.
20
+ * A component that you can use as a base for your own overlay component if its convenient for you. This class offers an `updateEdge` and a `removeEdge` method, as helpers, and three signals:
21
+ *
22
+ * $edgeData() - The current backing data for the edge, updated when an edge or its source/target is updated
23
+ * $sourceData() - The current backing data for the edge's source, updated when that vertex is updated
24
+ * $targetData() - The current backing data for the edge's target, updated when that vertex is updated
25
+ *
21
26
  * @group Components
22
27
  */
23
- export declare abstract class BaseAngularOverlayComponent implements AngularOverlayComponent {
28
+ export declare abstract class BaseAngularOverlayComponent<T extends BrowserUI = BrowserUI> implements OnInit, OnDestroy, AngularOverlayComponent<T> {
24
29
  /**
25
30
  * The underlying model
26
31
  * @classMember
27
32
  */
28
33
  model: VisuallyJsModel;
29
34
  /**
30
- * The surface that this overlay is rendered by
35
+ * The UI that this overlay is rendered by
31
36
  * @classMember
32
37
  */
33
- surface: Surface;
38
+ ui: T;
34
39
  /**
35
40
  * Backing data for the edge this overlay is attached to
36
41
  * @classMember
@@ -45,6 +50,23 @@ export declare abstract class BaseAngularOverlayComponent implements AngularOver
45
50
  * @internal
46
51
  */
47
52
  changeDetectorRef: ChangeDetectorRef;
53
+ /**
54
+ * @signal
55
+ */
56
+ $edgeData: import("@angular/core").WritableSignal<ObjectData>;
57
+ /**
58
+ * @signal
59
+ */
60
+ $sourceData: import("@angular/core").WritableSignal<ObjectData>;
61
+ /**
62
+ * @signal
63
+ */
64
+ $targetData: import("@angular/core").WritableSignal<ObjectData>;
65
+ _edgeUpdate: (payload: any, event: any) => any;
66
+ _vertexUpdate: (payload: any, event: any) => any;
67
+ _portUpdate: (payload: any, event: any) => any;
68
+ ngOnInit(): void;
69
+ ngOnDestroy(): void;
48
70
  /**
49
71
  * Update the underlying edge with the given data.
50
72
  * @param updates Data to update the edge with
@@ -56,4 +78,6 @@ export declare abstract class BaseAngularOverlayComponent implements AngularOver
56
78
  * @classMember
57
79
  */
58
80
  removeEdge(): void;
81
+ static ɵfac: i0.ɵɵFactoryDeclaration<BaseAngularOverlayComponent<any>, never>;
82
+ static ɵprov: i0.ɵɵInjectableDeclaration<BaseAngularOverlayComponent<any>>;
59
83
  }
@@ -0,0 +1,162 @@
1
+ import { AfterViewInit, ComponentRef, ElementRef, EventEmitter, NgZone, OnDestroy, ViewContainerRef } from "@angular/core";
2
+ import { PortUpdatedParams, Vertex, VertexUpdatedParams, Paper, ModelOptions, SurfaceSaveData, ExportOptions, SaveOptions, BrowserUIModel } from "@visuallyjs/browser-ui";
3
+ import { AngularRenderOptions, AngularViewOptions } from "./common";
4
+ import { VisuallyJsService } from "./vjs-service";
5
+ import { VisuallyJsAngularDOMElement } from "./surface-component";
6
+ import * as i0 from "@angular/core";
7
+ /**
8
+ * Provides a component that manages a Paper. You can configure three sets of options on this component:
9
+ *
10
+ * 1. renderOptions - these are options that control the behaviour of the Paper canvas
11
+ * 2. viewOptions - these are mappings of node/group types to behaviour and components, and edge types to behaviour
12
+ * 3. modelOptions - Options that govern how the underlying data model operates. If you don't provide these, the Paper component uses defaults (which is fine for the majority of applications)
13
+ *
14
+ * ```typescript
15
+ * @Component({
16
+ * selector:"app-my-canvas",
17
+ * template:`<vjs-Paper [renderOptions]="renderOptions"
18
+ * [viewOptions]="viewOptions"
19
+ * [modelOptions]="modelOptions"/>`
20
+ * })
21
+ * export class MyCanvas {
22
+ *
23
+ * renderOptions = { ... }
24
+ * viewOptions = { ... }
25
+ * modelOptions = { ... }
26
+ * }
27
+ * ```
28
+ *
29
+ * @group Components
30
+ */
31
+ export declare class PaperComponent<RO extends AngularRenderOptions = AngularRenderOptions> implements AfterViewInit, OnDestroy {
32
+ /**
33
+ * Optional preconfigured model to use for this Paper. You don't normally need to provide this; the component will create a model from the options you pass in (or with blank options by default) otherwise.
34
+ */
35
+ inputModel?: BrowserUIModel;
36
+ /**
37
+ * Options for the view - mappings of components and behaviour to model object types.
38
+ * @input
39
+ */
40
+ viewOptions?: AngularViewOptions;
41
+ /**
42
+ * Options for the underlying Paper widget.
43
+ * @input
44
+ */
45
+ renderOptions?: AngularRenderOptions;
46
+ /**
47
+ * Optional parameters for the underlying model instance. These will be used only if the model instance with the given ID has not yet been created somewhere else in the app.
48
+ * @input
49
+ */
50
+ modelOptions?: ModelOptions;
51
+ /**
52
+ * Optional data to load after the view has been initialised. This input is a signal, and will reload the dataset if changed.
53
+ * @input
54
+ */
55
+ data: import("@angular/core").InputSignal<Record<string, any>>;
56
+ /**
57
+ * Optional url from which to load data after the view has been initialised. This input is a signal, and will reload the dataset if changed.
58
+ * @input
59
+ */
60
+ url: import("@angular/core").InputSignal<string>;
61
+ /**
62
+ * Output event emitter, for proxying events from vertex components.
63
+ * @output
64
+ */
65
+ vertexEvent: EventEmitter<{
66
+ /**
67
+ * The vertex emitting the event
68
+ */
69
+ vertex: Vertex;
70
+ /**
71
+ * Event name
72
+ */
73
+ event: string;
74
+ /**
75
+ * Payload for the event
76
+ */
77
+ payload: any;
78
+ /**
79
+ * The Angular component that fired the event
80
+ */
81
+ component: ComponentRef<any>;
82
+ }>;
83
+ /**
84
+ * The underlying model.
85
+ * @classMember
86
+ */
87
+ model: BrowserUIModel;
88
+ /**
89
+ * The Paper from the UI core package that this component manages.
90
+ * @classMember
91
+ */
92
+ paper: Paper;
93
+ nodeUpdateFn: (a: any, e?: any) => any;
94
+ groupUpdateFn: (a: any, e?: any) => any;
95
+ portAddedFn: (a: any, e?: any) => any;
96
+ portUpdateFn: (a: any, e?: any) => any;
97
+ dataLoadEndFn: () => any;
98
+ edgeUpdateFn: (a: any, e?: any) => any;
99
+ edgeAddFn: (a: any, e?: any) => any;
100
+ edgeRemoveFn: (a: any, e?: any) => any;
101
+ $el: ElementRef<any>;
102
+ $viewContainerRef: ViewContainerRef;
103
+ $ngZone: NgZone;
104
+ $vjs: VisuallyJsService;
105
+ private _dataEffect;
106
+ private _urlEffect;
107
+ /**
108
+ * @internal
109
+ */
110
+ getNativeElement(component: any): VisuallyJsAngularDOMElement;
111
+ private _getComponent;
112
+ private _getComponentThen;
113
+ /**
114
+ * on node/group update, store the new data in the view
115
+ * @internal
116
+ */
117
+ nodeOrGroupUpdated(params: VertexUpdatedParams): void;
118
+ portUpdated(params: PortUpdatedParams): void;
119
+ private _maybeUpdateEdgeOverlays;
120
+ /**
121
+ * When an edge updated event is received, check for angular overlays, and if they have a change detector, invoke it. Used with OnPush change detection.
122
+ * @internal
123
+ */
124
+ private _handleEdgeUpdate;
125
+ /**
126
+ * When an edge updated event is received, check for angular overlays, and if they have a change detector, invoke it. Used with OnPush change detection.
127
+ * @internal
128
+ */
129
+ private edgeUpdated;
130
+ private edgeAddedRemoved;
131
+ /**
132
+ * @internal
133
+ */
134
+ private _processAngularOverlays;
135
+ /**
136
+ * Save the dataset and the Paper's current pan/zoom, as well as any inspector context, via POST to a URL.
137
+ * @param options Options for the save operation
138
+ * @classMember
139
+ */
140
+ save(options: SaveOptions): void;
141
+ /**
142
+ * Export the dataset only
143
+ * @classMember
144
+ */
145
+ exportData(options: ExportOptions): SurfaceSaveData;
146
+ /**
147
+ * On data load end, repaint everything on next tick.
148
+ * @internal
149
+ */
150
+ dataLoadEnd(): void;
151
+ private $removeNgElement;
152
+ /**
153
+ * @internal
154
+ */
155
+ ngAfterViewInit(): void;
156
+ /**
157
+ * @internal
158
+ */
159
+ ngOnDestroy(): void;
160
+ static ɵfac: i0.ɵɵFactoryDeclaration<PaperComponent<any>, never>;
161
+ static ɵcmp: i0.ɵɵComponentDeclaration<PaperComponent<any>, "vjs-paper", never, { "inputModel": { "alias": "model"; "required": false; }; "viewOptions": { "alias": "viewOptions"; "required": false; }; "renderOptions": { "alias": "renderOptions"; "required": false; }; "modelOptions": { "alias": "modelOptions"; "required": false; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; "url": { "alias": "url"; "required": false; "isSignal": true; }; }, { "vertexEvent": "vertexEvent"; }, never, ["*"], false, never>;
162
+ }
@@ -1,18 +1,21 @@
1
1
  import { AfterViewInit, ComponentRef, ElementRef, EventEmitter, NgZone, OnDestroy, ViewContainerRef, ChangeDetectorRef, WritableSignal } from "@angular/core";
2
- import { ObjectData, PortUpdatedParams, Vertex, VertexUpdatedParams, Surface, BrowserElement, VisuallyJsModel, ModelOptions, SurfaceSaveData, ExportOptions, SaveOptions, BrowserUIModel } from "@visuallyjs/browser-ui";
2
+ import { ObjectData, PortUpdatedParams, Vertex, VertexUpdatedParams, Surface, BrowserElement, VisuallyJsModel, ModelOptions, SurfaceSaveData, ExportOptions, SaveOptions, BrowserUIModel, BrowserUI, Paper } from "@visuallyjs/browser-ui";
3
3
  import { AngularRenderOptions, AngularViewOptions } from "./common";
4
4
  import { VisuallyJsService } from "./vjs-service";
5
5
  import * as i0 from "@angular/core";
6
- type VisuallyJsAngularDOMElement = BrowserElement & {
6
+ /**
7
+ * @internal
8
+ */
9
+ export type VisuallyJsAngularDOMElement = BrowserElement & {
7
10
  _visuallyJsNgComponent: any;
8
11
  _ref: ComponentRef<any>;
9
12
  };
10
13
  /**
11
14
  * @internal
12
15
  */
13
- export interface VisuallyJsAngularComponent {
16
+ export interface VisuallyJsAngularComponent<T extends BrowserUI> {
14
17
  model: VisuallyJsModel;
15
- surface: Surface;
18
+ ui: T;
16
19
  data: ObjectData;
17
20
  $data?: WritableSignal<ObjectData>;
18
21
  changeDetectorRef?: ChangeDetectorRef;
@@ -20,9 +23,11 @@ export interface VisuallyJsAngularComponent {
20
23
  /**
21
24
  * @internal
22
25
  */
23
- export interface VisuallyJsAngularVertexComponent extends VisuallyJsAngularComponent {
26
+ export interface VisuallyJsAngularVertexComponent<T extends BrowserUI> extends VisuallyJsAngularComponent<T> {
24
27
  modelObject: Vertex;
25
28
  _el: VisuallyJsAngularDOMElement;
29
+ surface?: Surface;
30
+ paper?: Paper;
26
31
  }
27
32
  /**
28
33
  * Provides a component that manages a Surface. You can configure three sets of options on this component:
@@ -69,15 +74,15 @@ export declare class SurfaceComponent<RO extends AngularRenderOptions = AngularR
69
74
  */
70
75
  modelOptions?: ModelOptions;
71
76
  /**
72
- * Optional data to load after the view has been initialised.
77
+ * Optional data to load after the view has been initialised. This input is a signal, and will reload the dataset if changed.
73
78
  * @input
74
79
  */
75
- data?: Record<string, any>;
80
+ data: import("@angular/core").InputSignal<Record<string, any>>;
76
81
  /**
77
- * Optional url from which to load data after the view has been initialised.
82
+ * Optional url from which to load data after the view has been initialised. This input is a signal, and will reload the dataset if changed.
78
83
  * @input
79
84
  */
80
- url?: string;
85
+ url: import("@angular/core").InputSignal<string>;
81
86
  /**
82
87
  * Output event emitter, for proxying events from vertex components.
83
88
  * @output
@@ -117,10 +122,13 @@ export declare class SurfaceComponent<RO extends AngularRenderOptions = AngularR
117
122
  dataLoadEndFn: () => any;
118
123
  edgeUpdateFn: (a: any, e?: any) => any;
119
124
  edgeAddFn: (a: any, e?: any) => any;
125
+ edgeRemoveFn: (a: any, e?: any) => any;
120
126
  $el: ElementRef<any>;
121
127
  $viewContainerRef: ViewContainerRef;
122
128
  $ngZone: NgZone;
123
129
  $vjs: VisuallyJsService;
130
+ private _dataEffect;
131
+ private _urlEffect;
124
132
  /**
125
133
  * @internal
126
134
  */
@@ -133,11 +141,18 @@ export declare class SurfaceComponent<RO extends AngularRenderOptions = AngularR
133
141
  */
134
142
  nodeOrGroupUpdated(params: VertexUpdatedParams): void;
135
143
  portUpdated(params: PortUpdatedParams): void;
144
+ private _maybeUpdateEdgeOverlays;
145
+ /**
146
+ * When an edge updated event is received, check for angular overlays, and if they have a change detector, invoke it. Used with OnPush change detection.
147
+ * @internal
148
+ */
149
+ private _handleEdgeUpdate;
136
150
  /**
137
151
  * When an edge updated event is received, check for angular overlays, and if they have a change detector, invoke it. Used with OnPush change detection.
138
152
  * @internal
139
153
  */
140
154
  private edgeUpdated;
155
+ private edgeAddedRemoved;
141
156
  /**
142
157
  * @internal
143
158
  */
@@ -168,6 +183,5 @@ export declare class SurfaceComponent<RO extends AngularRenderOptions = AngularR
168
183
  */
169
184
  ngOnDestroy(): void;
170
185
  static ɵfac: i0.ɵɵFactoryDeclaration<SurfaceComponent<any>, never>;
171
- static ɵcmp: i0.ɵɵComponentDeclaration<SurfaceComponent<any>, "vjs-surface", never, { "inputModel": { "alias": "model"; "required": false; }; "viewOptions": { "alias": "viewOptions"; "required": false; }; "renderOptions": { "alias": "renderOptions"; "required": false; }; "modelOptions": { "alias": "modelOptions"; "required": false; }; "data": { "alias": "data"; "required": false; }; "url": { "alias": "url"; "required": false; }; }, { "vertexEvent": "vertexEvent"; }, never, ["*"], false, never>;
186
+ static ɵcmp: i0.ɵɵComponentDeclaration<SurfaceComponent<any>, "vjs-surface", never, { "inputModel": { "alias": "model"; "required": false; }; "viewOptions": { "alias": "viewOptions"; "required": false; }; "renderOptions": { "alias": "renderOptions"; "required": false; }; "modelOptions": { "alias": "modelOptions"; "required": false; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; "url": { "alias": "url"; "required": false; "isSignal": true; }; }, { "vertexEvent": "vertexEvent"; }, never, ["*"], false, never>;
172
187
  }
173
- export {};