@visuallyjs/browser-ui-angular 1.1.3 → 1.2.0

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/esm2022/index.mjs +3 -0
  2. package/esm2022/lib/charts/area.chart.component.mjs +8 -36
  3. package/esm2022/lib/charts/bar.chart.component.mjs +8 -36
  4. package/esm2022/lib/charts/bubble.chart.component.mjs +8 -36
  5. package/esm2022/lib/charts/column.chart.component.mjs +8 -36
  6. package/esm2022/lib/charts/line.chart.component.mjs +8 -36
  7. package/esm2022/lib/charts/pie.chart.component.mjs +8 -36
  8. package/esm2022/lib/charts/sankey.chart.component.mjs +12 -8
  9. package/esm2022/lib/charts/scatter.chart.component.mjs +8 -36
  10. package/esm2022/lib/charts/series.based.chart.component.mjs +54 -0
  11. package/esm2022/lib/charts/xy.chart.component.mjs +10 -22
  12. package/esm2022/lib/color.tag.component.mjs +33 -27
  13. package/esm2022/lib/controls-component.mjs +48 -44
  14. package/esm2022/lib/diagram-palette-component.mjs +37 -32
  15. package/esm2022/lib/edge.type.picker.component.mjs +23 -18
  16. package/esm2022/lib/export-controls-component.mjs +7 -9
  17. package/esm2022/lib/hooks/use-visuallyjs-update.mjs +21 -0
  18. package/esm2022/lib/hooks/use-zoom.mjs +24 -0
  19. package/esm2022/lib/inspector.component.mjs +29 -27
  20. package/esm2022/lib/miniview-component.mjs +33 -25
  21. package/esm2022/lib/palette.component.mjs +42 -37
  22. package/esm2022/lib/shape.component.mjs +20 -18
  23. package/esm2022/lib/shape.palette.component.mjs +25 -21
  24. package/esm2022/lib/surface-component.mjs +7 -5
  25. package/esm2022/lib/vjs-service.mjs +35 -1
  26. package/fesm2022/visuallyjs-browser-ui-angular.mjs +466 -503
  27. package/fesm2022/visuallyjs-browser-ui-angular.mjs.map +1 -1
  28. package/index.d.ts +3 -0
  29. package/lib/charts/area.chart.component.d.ts +10 -15
  30. package/lib/charts/bar.chart.component.d.ts +9 -15
  31. package/lib/charts/bubble.chart.component.d.ts +12 -15
  32. package/lib/charts/column.chart.component.d.ts +12 -15
  33. package/lib/charts/line.chart.component.d.ts +16 -17
  34. package/lib/charts/pie.chart.component.d.ts +9 -15
  35. package/lib/charts/sankey.chart.component.d.ts +5 -0
  36. package/lib/charts/scatter.chart.component.d.ts +9 -15
  37. package/lib/charts/series.based.chart.component.d.ts +44 -0
  38. package/lib/charts/xy.chart.component.d.ts +13 -11
  39. package/lib/color.tag.component.d.ts +5 -5
  40. package/lib/controls-component.d.ts +6 -4
  41. package/lib/diagram-palette-component.d.ts +8 -2
  42. package/lib/edge.type.picker.component.d.ts +5 -5
  43. package/lib/export-controls-component.d.ts +6 -6
  44. package/lib/hooks/use-visuallyjs-update.d.ts +21 -0
  45. package/lib/hooks/use-zoom.d.ts +6 -0
  46. package/lib/inspector.component.d.ts +6 -7
  47. package/lib/miniview-component.d.ts +17 -9
  48. package/lib/palette.component.d.ts +5 -6
  49. package/lib/shape.component.d.ts +5 -5
  50. package/lib/shape.palette.component.d.ts +5 -3
  51. package/lib/surface-component.d.ts +5 -1
  52. package/lib/vjs-service.d.ts +41 -0
  53. package/package.json +2 -2
  54. package/visuallyjs-browser-ui-angular.tgz +0 -0
@@ -1,4 +1,4 @@
1
- import { ChangeDetectorRef, ElementRef, AfterViewInit } from "@angular/core";
1
+ import { ChangeDetectorRef, ElementRef } from "@angular/core";
2
2
  import { Inspector, Base, BrowserUI } from "@visuallyjs/browser-ui";
3
3
  import { VisuallyJsService } from "./vjs-service";
4
4
  import * as i0 from "@angular/core";
@@ -6,7 +6,7 @@ import * as i0 from "@angular/core";
6
6
  * Base inspector component. You can extend this class and just use the `currentObj` and/or `currentType` members in your template for a simple setup, or your subclass can manage its own more complicated state. This class will invoke `reset()` when there is no selected object, and `refresh` when an object is selected.
7
7
  * @group Components
8
8
  */
9
- export declare class InspectorComponent<T extends Base = Base> implements AfterViewInit {
9
+ export declare class InspectorComponent<T extends Base = Base> {
10
10
  /**
11
11
  * The object that is currently being inspected.
12
12
  * @classMember
@@ -70,12 +70,11 @@ export declare class InspectorComponent<T extends Base = Base> implements AfterV
70
70
  * @internal
71
71
  */
72
72
  el: ElementRef<any>;
73
- ui: BrowserUI;
74
73
  $vjs: VisuallyJsService;
75
- /**
76
- * @internal
77
- */
78
- ngAfterViewInit(): void;
74
+ ui: import("@angular/core").WritableSignal<BrowserUI<any>>;
75
+ model: import("@angular/core").Signal<import("@visuallyjs/browser-ui").VisuallyJsModel>;
76
+ initialized: boolean;
77
+ constructor();
79
78
  /**
80
79
  * The base implementation of this method sets the current object type from `objectType`, and it also sets the current type to be the `type` of obj. You can override this method to implement more sophisticated scenarios.
81
80
  * @param obj New object in inspector
@@ -1,18 +1,18 @@
1
- import { AfterViewInit, ElementRef, NgZone } from "@angular/core";
2
- import { MiniviewPlugin, Group, Node } from "@visuallyjs/browser-ui";
1
+ import { ElementRef, NgZone } from "@angular/core";
2
+ import { MiniviewPlugin, Group, Node, Vertex } from "@visuallyjs/browser-ui";
3
3
  import { VisuallyJsService } from "./vjs-service";
4
4
  import * as i0 from "@angular/core";
5
5
  /**
6
6
  * A component that provides a miniview.
7
7
  * @group Components
8
8
  */
9
- export declare class MiniviewComponent implements AfterViewInit {
9
+ export declare class MiniviewComponent {
10
10
  private ngZone;
11
11
  /**
12
12
  * Optional filter to determine whether or not include a given vertex in the miniview
13
13
  * @input
14
14
  */
15
- elementFilter?: (obj: Node | Group) => boolean;
15
+ elementFilter?: (obj: Vertex) => boolean;
16
16
  /**
17
17
  * Optional function to determine a `type` for each vertex, which is then written as an attribute onto the DOM element representing the vertex in the miniview.
18
18
  * @input
@@ -28,18 +28,26 @@ export declare class MiniviewComponent implements AfterViewInit {
28
28
  * @input
29
29
  */
30
30
  clickToCenter?: boolean;
31
+ /**
32
+ * Defaults to true - the miniview will display a lasso as the user is using the lasso in the canvas
33
+ * @input
34
+ */
35
+ showLasso?: boolean;
36
+ /**
37
+ * Defaults to true - the miniview will add a CSS class to elements whose model object is in the current selection.
38
+ * @input
39
+ */
40
+ trackSelection?: boolean;
31
41
  $el: ElementRef<any>;
32
42
  $vjs: VisuallyJsService;
43
+ $ui: import("@angular/core").WritableSignal<import("@visuallyjs/browser-ui").BrowserUI<any>>;
44
+ initialized: boolean;
33
45
  $miniview: MiniviewPlugin;
34
46
  constructor(ngZone: NgZone);
35
- /**
36
- * @internal
37
- */
38
- ngAfterViewInit(): void;
39
47
  /**
40
48
  * @internal
41
49
  */
42
50
  redraw(): void;
43
51
  static ɵfac: i0.ɵɵFactoryDeclaration<MiniviewComponent, never>;
44
- static ɵcmp: i0.ɵɵComponentDeclaration<MiniviewComponent, "vjs-miniview", never, { "elementFilter": { "alias": "elementFilter"; "required": false; }; "typeFunction": { "alias": "typeFunction"; "required": false; }; "activeTracking": { "alias": "activeTracking"; "required": false; }; "clickToCenter": { "alias": "clickToCenter"; "required": false; }; }, {}, never, never, false, never>;
52
+ static ɵcmp: i0.ɵɵComponentDeclaration<MiniviewComponent, "vjs-miniview", never, { "elementFilter": { "alias": "elementFilter"; "required": false; }; "typeFunction": { "alias": "typeFunction"; "required": false; }; "activeTracking": { "alias": "activeTracking"; "required": false; }; "clickToCenter": { "alias": "clickToCenter"; "required": false; }; "showLasso": { "alias": "showLasso"; "required": false; }; "trackSelection": { "alias": "trackSelection"; "required": false; }; }, {}, never, never, false, never>;
45
53
  }
@@ -1,13 +1,15 @@
1
- import { AfterViewInit, ElementRef } from "@angular/core";
1
+ import { ElementRef } from "@angular/core";
2
2
  import { DataGeneratorFunction, GroupIdentifierFunction, OnVertexAddedCallback, Palette, Size, TypeGeneratorFunction, CanvasDropFilter, PaletteMode } from "@visuallyjs/browser-ui";
3
3
  import { VisuallyJsService } from "./vjs-service";
4
4
  import * as i0 from "@angular/core";
5
5
  /**
6
6
  * @group Components
7
7
  */
8
- export declare class PaletteComponent<T> implements AfterViewInit {
8
+ export declare class PaletteComponent<T> {
9
9
  $vjs: VisuallyJsService;
10
10
  $el: ElementRef<any>;
11
+ $surface: import("@angular/core").WritableSignal<import("@visuallyjs/browser-ui").Surface>;
12
+ initialized: boolean;
11
13
  /**
12
14
  * CSS3 selector identifying the child elements of the the element on which this directive was declared that act as drag sources. Optional; if omitted Visually JS will use `[data-vjs-type]`.
13
15
  * @input
@@ -85,10 +87,7 @@ export declare class PaletteComponent<T> implements AfterViewInit {
85
87
  * This flag relates to "draw" mode, and defaults to false. When true, the palette only supports click to draw new vertices, not drag. This flag is forced to true if the associated UI does not have `useModelForSizes` set, since there is no point in allowing a user to drag a vertex to some size if its not going to be honoured. When you set this flag and associated UI does have `useModelForSizes` set, the palette will use default sizes for new nodes/groups.
86
88
  */
87
89
  clickToAddOnly?: boolean;
88
- /**
89
- * @internal
90
- */
91
- ngAfterViewInit(): void;
90
+ constructor();
92
91
  static ɵfac: i0.ɵɵFactoryDeclaration<PaletteComponent<any>, never>;
93
92
  static ɵdir: i0.ɵɵDirectiveDeclaration<PaletteComponent<any>, "[vjs-palette]", never, { "selector": { "alias": "selector"; "required": false; }; "dataGenerator": { "alias": "dataGenerator"; "required": false; }; "typeGenerator": { "alias": "typeGenerator"; "required": false; }; "groupIdentifier": { "alias": "groupIdentifier"; "required": false; }; "allowDropOnEdge": { "alias": "allowDropOnEdge"; "required": false; }; "allowDropOnGroup": { "alias": "allowDropOnGroup"; "required": false; }; "allowDropOnCanvas": { "alias": "allowDropOnCanvas"; "required": false; }; "allowDropOnNode": { "alias": "allowDropOnNode"; "required": false; }; "onVertexAdded": { "alias": "onVertexAdded"; "required": false; }; "dragSize": { "alias": "dragSize"; "required": false; }; "canvasDropFilter": { "alias": "canvasDropFilter"; "required": false; }; "mode": { "alias": "mode"; "required": false; }; "selectAfterAdd": { "alias": "selectAfterAdd"; "required": false; }; "allowClickToAdd": { "alias": "allowClickToAdd"; "required": false; }; "clickToAddOnly": { "alias": "clickToAddOnly"; "required": false; }; }, {}, never, never, false, never>;
94
93
  }
@@ -1,4 +1,4 @@
1
- import { AfterViewInit, ElementRef, OnChanges, SimpleChanges } from "@angular/core";
1
+ import { ElementRef, OnChanges, SimpleChanges } from "@angular/core";
2
2
  import { ObjectData, FontSpec } from "@visuallyjs/browser-ui";
3
3
  import { VisuallyJsService } from "./vjs-service";
4
4
  import * as i0 from "@angular/core";
@@ -6,15 +6,14 @@ import * as i0 from "@angular/core";
6
6
  * Provides a means to render an SVG shape into a component.
7
7
  * @group Components
8
8
  */
9
- export declare class ShapeComponent implements AfterViewInit, OnChanges {
9
+ export declare class ShapeComponent implements OnChanges {
10
10
  /**
11
11
  * The data for the vertex to render. Required.
12
12
  * @input
13
13
  */
14
14
  obj: ObjectData;
15
15
  /**
16
- * Current width for the shape. Although it may seem counterintuitive, this is required - you'll need to set it to `[width]="obj.width"`.
17
- * Angular's change detection will not pick up changes to this otherwise.
16
+ * Current width for the shape. Although it may seem counterintuitive, this is required - you'll need to set it to `[width]="obj.width"`. Angular's change detection will not pick up changes to this otherwise.
18
17
  * @input
19
18
  */
20
19
  width: number;
@@ -62,8 +61,9 @@ export declare class ShapeComponent implements AfterViewInit, OnChanges {
62
61
  private shapeLibrary;
63
62
  $el: ElementRef<any>;
64
63
  $vjs: VisuallyJsService;
64
+ ui: import("@angular/core").WritableSignal<import("@visuallyjs/browser-ui").BrowserUI<any>>;
65
65
  private _render;
66
- ngAfterViewInit(): void;
66
+ constructor();
67
67
  ngOnChanges(changes: SimpleChanges): void;
68
68
  static ɵfac: i0.ɵɵFactoryDeclaration<ShapeComponent, never>;
69
69
  static ɵcmp: i0.ɵɵComponentDeclaration<ShapeComponent, "vjs-shape", never, { "obj": { "alias": "obj"; "required": false; }; "width": { "alias": "width"; "required": false; }; "height": { "alias": "height"; "required": false; }; "showLabels": { "alias": "showLabels"; "required": false; }; "labelProperty": { "alias": "labelProperty"; "required": false; }; "labelStrokeWidth": { "alias": "labelStrokeWidth"; "required": false; }; "label": { "alias": "label"; "required": false; }; "multilineLabels": { "alias": "multilineLabels"; "required": false; }; "labelFillRatio": { "alias": "labelFillRatio"; "required": false; }; "font": { "alias": "font"; "required": false; }; }, {}, never, never, false, never>;
@@ -1,4 +1,4 @@
1
- import { AfterViewInit, ElementRef } from "@angular/core";
1
+ import { ElementRef } from "@angular/core";
2
2
  import { ObjectData, Size, DataGeneratorFunction, OnVertexAddedCallback, PreparedShape } from "@visuallyjs/browser-ui";
3
3
  import { VisuallyJsService } from "./vjs-service";
4
4
  import * as i0 from "@angular/core";
@@ -6,7 +6,7 @@ import * as i0 from "@angular/core";
6
6
  * Provides a palette that renders a shape library, from which new vertices can be dragged onto a surface.
7
7
  * @group Components
8
8
  */
9
- export declare class ShapePaletteComponent implements AfterViewInit {
9
+ export declare class ShapePaletteComponent {
10
10
  /**
11
11
  * When the shape library contains multiple sets, use this to instruct the palette that you want it to initially load just displaying this set. Optional.
12
12
  * @input
@@ -64,7 +64,9 @@ export declare class ShapePaletteComponent implements AfterViewInit {
64
64
  preparedShapes?: Array<PreparedShape>;
65
65
  $el: ElementRef<any>;
66
66
  $vjs: VisuallyJsService;
67
- ngAfterViewInit(): void;
67
+ ui: import("@angular/core").WritableSignal<import("@visuallyjs/browser-ui").BrowserUI<any>>;
68
+ initialized: boolean;
69
+ constructor();
68
70
  static ɵfac: i0.ɵɵFactoryDeclaration<ShapePaletteComponent, never>;
69
71
  static ɵcmp: i0.ɵɵComponentDeclaration<ShapePaletteComponent, "vjs-shape-palette", never, { "initialSet": { "alias": "initialSet"; "required": false; }; "dragSize": { "alias": "dragSize"; "required": false; }; "iconSize": { "alias": "iconSize"; "required": false; }; "fill": { "alias": "fill"; "required": false; }; "outline": { "alias": "outline"; "required": false; }; "showAllMessage": { "alias": "showAllMessage"; "required": false; }; "selectAfterDrop": { "alias": "selectAfterDrop"; "required": false; }; "paletteStrokeWidth": { "alias": "paletteStrokeWidth"; "required": false; }; "onVertexAdded": { "alias": "onVertexAdded"; "required": false; }; "dataGenerator": { "alias": "dataGenerator"; "required": false; }; "preparedShapes": { "alias": "preparedShapes"; "required": false; }; }, {}, never, never, false, never>;
70
72
  }
@@ -49,6 +49,10 @@ export interface VisuallyJsAngularVertexComponent extends VisuallyJsAngularCompo
49
49
  * @group Components
50
50
  */
51
51
  export declare class SurfaceComponent<RO extends AngularRenderOptions = AngularRenderOptions> implements AfterViewInit, OnDestroy {
52
+ /**
53
+ * Optional preconfigured model to use for this Surface. 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.
54
+ */
55
+ inputModel?: BrowserUIModel;
52
56
  /**
53
57
  * Options for the view - mappings of components and behaviour to model object types.
54
58
  * @input
@@ -164,6 +168,6 @@ export declare class SurfaceComponent<RO extends AngularRenderOptions = AngularR
164
168
  */
165
169
  ngOnDestroy(): void;
166
170
  static ɵfac: i0.ɵɵFactoryDeclaration<SurfaceComponent<any>, never>;
167
- static ɵcmp: i0.ɵɵComponentDeclaration<SurfaceComponent<any>, "vjs-surface", never, { "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>;
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>;
168
172
  }
169
173
  export {};
@@ -23,6 +23,12 @@ import * as i0 from "@angular/core";
23
23
  * @group Services
24
24
  */
25
25
  export declare class VisuallyJsService {
26
+ readonly model: import("@angular/core").WritableSignal<BrowserUIModel>;
27
+ readonly surface: import("@angular/core").WritableSignal<Surface>;
28
+ readonly paper: import("@angular/core").WritableSignal<Paper>;
29
+ readonly diagram: import("@angular/core").WritableSignal<Diagram>;
30
+ readonly inspector: import("@angular/core").WritableSignal<Inspector>;
31
+ readonly ui: import("@angular/core").WritableSignal<BrowserUI<any>>;
26
32
  private $model;
27
33
  private $surface;
28
34
  private $paper;
@@ -34,54 +40,89 @@ export declare class VisuallyJsService {
34
40
  private modelListeners;
35
41
  private diagramListeners;
36
42
  private uiListeners;
43
+ /**
44
+ * @internal
45
+ * @param i
46
+ */
37
47
  $setInspector(i: Inspector): void;
38
48
  private $notifyInspector;
39
49
  $setSurface(s: Surface): void;
50
+ /**
51
+ * @deprecated
52
+ * @private
53
+ */
40
54
  private $notifySurface;
41
55
  /**
42
56
  * Retrieves the surface and executes the provided callback function with the surface as its argument. If the surface is not available, the callback is stored and will be invoked once the surface is ready.
43
57
  *
44
58
  * @param cb - A callback function that takes a `Surface` object as its parameter.
59
+ * @deprecated Use the `surface` signal instead.
45
60
  */
46
61
  getSurface(cb: (s: Surface) => any): void;
47
62
  /**
48
63
  * Retrieves the inspector instance. If the inspector is already available, the provided callback function is invoked with the inspector as an argument. If the inspector is not yet ready, the callback is stored in a queue to be executed once the inspector becomes available.
49
64
  *
50
65
  * @param cb - A callback function that receives the inspector instance as an argument when it becomes available.
66
+ * @deprecated Use the `inspector` signal instead.
51
67
  */
52
68
  getInspector(cb: (s: Inspector) => any): void;
53
69
  $setPaper(p: Paper): void;
70
+ /**
71
+ * @deprecated
72
+ * @private
73
+ */
54
74
  private $notifyPaper;
55
75
  /**
56
76
  * Retrieves the paper object and executes the provided callback function with the paper as an argument. If the paper is not yet available, the callback is stored for execution once the paper becomes available.
57
77
  *
58
78
  * @param cb - A callback function that is called with the retrieved paper object as an argument.
79
+ * @deprecated Use the `paper` signal instead.
59
80
  */
60
81
  getPaper(cb: (p: Paper) => any): void;
82
+ /**
83
+ * @internal
84
+ * @param d
85
+ */
61
86
  $setDiagram(d: Diagram): void;
87
+ /**
88
+ * @deprecated
89
+ * @private
90
+ */
62
91
  private $notifyDiagram;
63
92
  /**
64
93
  * Retrieves the current diagram. If the diagram is not available, the callback will be stored and executed when the diagram becomes available.
65
94
  *
66
95
  * @param cb - A callback function that takes a `Diagram` object as its parameter.
96
+ * @deprecated Use the `diagram` signal instead
67
97
  */
68
98
  getDiagram(cb: (p: Diagram) => any): void;
69
99
  /**
70
100
  * Retrieves the model and executes the provided callback function with it. If the model is already available, the callback is executed immediately. Otherwise, the callback is stored to be executed when the model becomes available.
71
101
  *
72
102
  * @param cb - The callback function to execute with the model.
103
+ * @deprecated Use the `model` signal instead
73
104
  */
74
105
  getModel(cb: (p: BrowserUIModel) => any): void;
75
106
  /**
76
107
  * @internal
77
108
  */
78
109
  $setModel(m: BrowserUIModel): void;
110
+ /**
111
+ * @deprecated
112
+ * @private
113
+ */
79
114
  private $notifyModel;
115
+ /**
116
+ * @deprecated
117
+ * @param ui
118
+ * @private
119
+ */
80
120
  private $notifyUI;
81
121
  /**
82
122
  * Retrieves the UI element and provides it to the callback function once available. If the UI element already exists, it is immediately passed to the callback. Otherwise, the callback is stored to be executed when the UI becomes available.
83
123
  *
84
124
  * @param cb - A callback function that receives the UI element `b` of type `BrowserUI` as its argument.
125
+ * @deprecated Use the `ui` signal instead
85
126
  */
86
127
  getUI(cb: (b: BrowserUI) => any): void;
87
128
  static ɵfac: i0.ɵɵFactoryDeclaration<VisuallyJsService, never>;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@visuallyjs/browser-ui-angular",
3
- "version": "1.1.3",
3
+ "version": "1.2.0",
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.1.3"
10
+ "@visuallyjs/browser-ui": "1.2.0"
11
11
  },
12
12
  "exports": {
13
13
  "./css/visuallyjs-angular.css": {
Binary file