@visuallyjs/browser-ui-angular 1.2.1 → 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.
package/index.d.ts CHANGED
@@ -43,3 +43,7 @@ export * from './lib/charts/bubble.chart.component';
43
43
  export * from './lib/charts/sankey.chart.component';
44
44
  export * from './lib/hooks/use-zoom';
45
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
+ }
@@ -25,7 +25,11 @@ import * as i23 from "./charts/bubble.chart.component";
25
25
  import * as i24 from "./charts/sankey.chart.component";
26
26
  import * as i25 from "./decorator-component";
27
27
  import * as i26 from "./surface-popup-component";
28
- import * as i27 from "@angular/common";
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";
29
33
  /**
30
34
  * VisuallyJs Angular module.
31
35
  *
@@ -61,6 +65,6 @@ import * as i27 from "@angular/common";
61
65
  */
62
66
  export declare class VisuallyJsModule {
63
67
  static ɵfac: i0.ɵɵFactoryDeclaration<VisuallyJsModule, never>;
64
- 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.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]>;
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]>;
65
69
  static ɵinj: i0.ɵɵInjectorDeclaration<VisuallyJsModule>;
66
70
  }
@@ -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 { BrowserUI, Edge, ObjectData } 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
@@ -17,10 +17,15 @@ export interface AngularOverlayComponent<T extends BrowserUI = BrowserUI> extend
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<T extends BrowserUI = BrowserUI> implements AngularOverlayComponent<T> {
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
@@ -45,6 +50,23 @@ export declare abstract class BaseAngularOverlayComponent<T extends BrowserUI =
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<T extends BrowserUI =
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
  }
@@ -116,6 +116,12 @@ export declare class PaperComponent<RO extends AngularRenderOptions = AngularRen
116
116
  */
117
117
  nodeOrGroupUpdated(params: VertexUpdatedParams): void;
118
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;
119
125
  /**
120
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.
121
127
  * @internal
@@ -141,6 +141,12 @@ export declare class SurfaceComponent<RO extends AngularRenderOptions = AngularR
141
141
  */
142
142
  nodeOrGroupUpdated(params: VertexUpdatedParams): void;
143
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;
144
150
  /**
145
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.
146
152
  * @internal
@@ -50,11 +50,11 @@ export declare class SurfacePopupComponent implements AfterViewInit, OnDestroy {
50
50
  * @internal
51
51
  */
52
52
  popupHandler: PopupHandler;
53
+ _hideFunction: () => any;
53
54
  readonly current: import("@angular/core").WritableSignal<Vertex>;
54
55
  readonly model: import("@angular/core").WritableSignal<import("@visuallyjs/browser-ui").BrowserUIModel>;
55
56
  readonly ui: import("@angular/core").WritableSignal<import("@visuallyjs/browser-ui").BrowserUI<any>>;
56
57
  readonly display: import("@angular/core").Signal<"none" | "block">;
57
- $hide(): void;
58
58
  ngAfterViewInit(): void;
59
59
  ngOnDestroy(): void;
60
60
  static ɵfac: i0.ɵɵFactoryDeclaration<SurfacePopupComponent, never>;
@@ -0,0 +1,72 @@
1
+ import { AfterViewInit } from "@angular/core";
2
+ import { Size, TilingStrategy } from "@visuallyjs/browser-ui";
3
+ import { VisuallyJsService } from "./vjs-service";
4
+ import * as i0 from "@angular/core";
5
+ /**
6
+ * Renders a tiled image background on a surface or paper.
7
+ * @group Components
8
+ */
9
+ export declare class TiledImageBackgroundComponent implements AfterViewInit {
10
+ /**
11
+ * URL for the background. You can supply this, or you can supply a `urlGenerator` function instead. If you supply `url` and no `urlGenerator`, the url you supply is treated as a template for the url for any given tile, and is expected to contain `{z}`, `{x}` and `{y}` placeholders. The form of the URL can be anything you like as long as it has the placeholders for z, x and y. For instance:
12
+ *
13
+ * http://foo.com/{z}/{x}/{y}
14
+ * https://bar.com?zoom={z}&x={x}&y={y}
15
+ *
16
+ * etc
17
+ * @input
18
+ */
19
+ url?: string;
20
+ /**
21
+ * For tiled backgrounds, an optional function you can supply to generate the URL for a given tile. See `url` for
22
+ * an explanation of the default syntax for urls when using a tiled background.
23
+ * @param z zoom level
24
+ * @param x x coordinate of tile
25
+ * @param y y coordinate of tile
26
+ * @input
27
+ */
28
+ urlGenerator?: (z: number, x: number, y: number) => string;
29
+ /**
30
+ * For tiled backgrounds, provides the width and height of tiles. Every tile is assumed to have these dimensions,
31
+ * even if the tile has whitespace in it. Required.
32
+ * @input
33
+ */
34
+ tileSize: Size;
35
+ /**
36
+ * Required. Indicates the width of the full image.
37
+ * @input
38
+ */
39
+ width: number;
40
+ /**
41
+ * Required. Indicates the height of the full image.
42
+ * @input
43
+ */
44
+ height: number;
45
+ /**
46
+ * Required. Indicates the maximum zoom level. Zoom starts at 0 - fully zoomed out - and
47
+ * increases in integer values from there. Each successive zoom level is twice the zoom of the previous level,
48
+ * meaning two times as many tiles in each direction.
49
+ * @input
50
+ */
51
+ maxZoom?: number;
52
+ /**
53
+ * Default is TilingStrategies.logarithmic. See notes for `TilingStrategies` enum.
54
+ * @input
55
+ */
56
+ tiling?: TilingStrategy;
57
+ /**
58
+ * How long to wait after a pan before reloading tiles.
59
+ * @input
60
+ */
61
+ panDebounceTimeout?: number;
62
+ /**
63
+ * How long to wait after a zoom before reloading tiles.
64
+ * @input
65
+ */
66
+ zoomDebounceTimeout?: number;
67
+ $vjs: VisuallyJsService;
68
+ private _bg;
69
+ ngAfterViewInit(): void;
70
+ static ɵfac: i0.ɵɵFactoryDeclaration<TiledImageBackgroundComponent, never>;
71
+ static ɵcmp: i0.ɵɵComponentDeclaration<TiledImageBackgroundComponent, "vjs-tiled-image-background", never, { "url": { "alias": "url"; "required": false; }; "urlGenerator": { "alias": "urlGenerator"; "required": false; }; "tileSize": { "alias": "tileSize"; "required": false; }; "width": { "alias": "width"; "required": false; }; "height": { "alias": "height"; "required": false; }; "maxZoom": { "alias": "maxZoom"; "required": false; }; "tiling": { "alias": "tiling"; "required": false; }; "panDebounceTimeout": { "alias": "panDebounceTimeout"; "required": false; }; "zoomDebounceTimeout": { "alias": "zoomDebounceTimeout"; "required": false; }; }, {}, never, ["*"], false, never>;
72
+ }
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@visuallyjs/browser-ui-angular",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "*",
6
6
  "@angular/core": "*"
7
7
  },
8
8
  "dependencies": {
9
9
  "tslib": "^2.0.0",
10
- "@visuallyjs/browser-ui": "1.2.1"
10
+ "@visuallyjs/browser-ui": "1.2.2"
11
11
  },
12
12
  "exports": {
13
13
  "./css/visuallyjs-angular.css": {
Binary file