@neo4j-nvl/base 0.3.1-c678d7aa → 0.3.1-ebba99bf

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.
@@ -18,7 +18,9 @@ interface NvlMouseEvent extends MouseEvent {
18
18
  * Class for a NVL instance.
19
19
  * @example
20
20
  * This is a basic setup for a NVL instance.
21
- * ```js
21
+ * ```ts
22
+ * import { NVL } from '@neo4j-nvl/base'
23
+ *
22
24
  * const nodes = [
23
25
  * { id: '1', label: 'Node 1', color: '#e04141' },
24
26
  * { id: '2', label: 'Node 2', color: '#e09c41' }
@@ -27,7 +29,6 @@ interface NvlMouseEvent extends MouseEvent {
27
29
  * { id: '12', from: '1', to: '2' }
28
30
  * ]
29
31
  * const options = {
30
- * layout: 'hierarchical',
31
32
  * initialZoom: 0.5
32
33
  * }
33
34
  * const callbacks = {
@@ -69,7 +70,11 @@ declare class NVL {
69
70
  * If an existing property is not provided, it will not be changed.
70
71
  * @example
71
72
  * Adding and updating nodes and relationships
72
- * ```js
73
+ * ```ts
74
+ * import { NVL } from '@neo4j-nvl/base'
75
+ *
76
+ * const nvl = new NVL(document.getElementById('frame'), [{ id: '0' }], [])
77
+ *
73
78
  * const nodes = [
74
79
  * { id: '1', label: 'Node 1', color: '#e04141' },
75
80
  * { id: '2', label: 'Node 2', color: '#e09c41' }
@@ -105,15 +110,17 @@ declare class NVL {
105
110
  * If an existing property is not provided, it will not be changed.
106
111
  * @example
107
112
  * Updating nodes and relationships
108
- * ```js
113
+ * ```ts
114
+ * import { NVL } from '@neo4j-nvl/base'
115
+ *
109
116
  * const nodes = [
110
- * { id: '1', label: 'Node 1', color: '#e04141' },
111
- * { id: '2', label: 'Node 2', color: '#e09c41' }
117
+ * { id: '1', label: 'Node 1', color: '#e04141' },
118
+ * { id: '2', label: 'Node 2', color: '#e09c41' }
112
119
  * ]
113
120
  * const relationships = [
114
- * { id: '12', from: '1', to: '2' }
121
+ * { id: '12', from: '1', to: '2' }
115
122
  * ]
116
- * const nvl = new NVL(container, nodes, relationships)
123
+ * const nvl = new NVL(document.getElementById('frame'), nodes, relationships)
117
124
  * // Updates an existing node and relationship
118
125
  * nvl.updateElementsInGraph([{ id: '1', selected: true }], [{ id: '12', color: '#e0df41' }])
119
126
  * ```
@@ -278,9 +285,6 @@ declare class NVL {
278
285
  * @param {string} options.backgroundColor - The background color of the png file.
279
286
  * @note The size of the png file will be as large as the entire graph at the default zoom level.
280
287
  * Can result in a very large file.
281
- * @example
282
- * // Save the entire graph visualization canvas as a png to the client.
283
- * graphVisualization.saveFullGraphToFile({ filename: 'graph.png', backgroundColor: '#fff' })
284
288
  */
285
289
  saveFullGraphToLargeFile(options: {
286
290
  filename?: string;
@@ -342,10 +346,10 @@ declare class NVL {
342
346
  * @example
343
347
  * ```js
344
348
  * const container = document.getElementById('frame')
345
- * const nvl = new NVL(container, nodes, relationships)
349
+ * const nvl = new NVL(container, [{ id: '0' }], [])
346
350
  *
347
351
  * // Get the nodes and relationships that have been hit by a pointer event.
348
- * container.addEventListener('click', (evt) => {
352
+ * container?.addEventListener('click', (evt) => {
349
353
  * const { nvlTargets } = nvl.getHits(evt)
350
354
  * console.log('clicked elements:', nvlTargets)
351
355
  * })
@@ -4,15 +4,15 @@ type CallbackFunction = ExternalCallbacks['onError'] | ExternalCallbacks['onLayo
4
4
  * A class for registering and calling callbacks
5
5
  * @example
6
6
  * ```
7
+ * import { CallbackHelper } from './CallbackHelper'
8
+ *
7
9
  * const callbackHelper = new CallbackHelper()
8
- * callbackHelper.register('myEvent', (data) => {
9
- * console.log(data)
10
+ * callbackHelper.register('onError', (e) => {
11
+ * console.error(e)
10
12
  * })
11
- * callbackHelper.callIfRegistered('myEvent', 'Hello World')
12
- * // Logs 'Hello World'
13
13
  * ```
14
14
  */
15
- export default class CallbackHelper {
15
+ export declare class CallbackHelper {
16
16
  private readonly callbacks;
17
17
  constructor();
18
18
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neo4j-nvl/base",
3
- "version": "0.3.1-c678d7aa",
3
+ "version": "0.3.1-ebba99bf",
4
4
  "license": "SEE LICENSE IN 'LICENSE.txt'",
5
5
  "homepage": "https://neo4j.com/docs/nvl/current/",
6
6
  "description": "Base library for the Neo4j Visualization Library",
@@ -33,7 +33,7 @@
33
33
  "tsconfig": "./tsconfig.json"
34
34
  },
35
35
  "dependencies": {
36
- "@neo4j-nvl/layout-workers": "^0.3.1-c678d7aa",
36
+ "@neo4j-nvl/layout-workers": "^0.3.1-ebba99bf",
37
37
  "color-string": "^1.9.1",
38
38
  "contrast": "1.0.1",
39
39
  "d3-force": "^3.0.0",