@3plate/graph-core 0.1.7 → 0.1.9
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/dist/index.cjs +371 -211
- package/dist/index.d.cts +40 -3
- package/dist/index.d.ts +40 -3
- package/dist/index.js +371 -211
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -11,11 +11,24 @@ type Dims = {
|
|
|
11
11
|
|
|
12
12
|
type MarkerType = 'arrow' | 'circle' | 'diamond' | 'bar' | 'none';
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Ingestion source configuration.
|
|
16
|
+
* Used to connect to an external data source for graph updates.
|
|
17
|
+
*/
|
|
18
|
+
type IngestionConfig = {
|
|
19
|
+
type: 'websocket';
|
|
20
|
+
url: string;
|
|
21
|
+
reconnectMs?: number;
|
|
22
|
+
} | {
|
|
23
|
+
type: 'file';
|
|
24
|
+
url: string;
|
|
25
|
+
intervalMs?: number;
|
|
26
|
+
};
|
|
14
27
|
/**
|
|
15
28
|
* Arguments to the API constructor.
|
|
16
29
|
*
|
|
17
|
-
* The caller can specify nodes and edges, or
|
|
18
|
-
* but not
|
|
30
|
+
* The caller can specify nodes and edges, history, or ingestion config,
|
|
31
|
+
* but not multiple.
|
|
19
32
|
*
|
|
20
33
|
* The root element ID is required.
|
|
21
34
|
*/
|
|
@@ -28,6 +41,8 @@ type APIArguments<N, E> = {
|
|
|
28
41
|
edges?: E[];
|
|
29
42
|
/** Initial history */
|
|
30
43
|
history?: Update<N, E>[];
|
|
44
|
+
/** Ingestion source configuration */
|
|
45
|
+
ingestion?: IngestionConfig;
|
|
31
46
|
/** Events */
|
|
32
47
|
events?: EventsOptions<N, E>;
|
|
33
48
|
/** Root element ID */
|
|
@@ -370,11 +385,19 @@ declare class API<N, E> {
|
|
|
370
385
|
private nextNodeId;
|
|
371
386
|
private nextEdgeId;
|
|
372
387
|
private events;
|
|
388
|
+
private ingest?;
|
|
389
|
+
private ingestionSource?;
|
|
390
|
+
private ingestionConfig?;
|
|
391
|
+
private prevProps;
|
|
373
392
|
root: string;
|
|
374
393
|
constructor(args: APIArguments<N, E>);
|
|
375
394
|
reset(): void;
|
|
376
395
|
/** Initialize the API */
|
|
377
396
|
init(): Promise<void>;
|
|
397
|
+
/** Connect to the configured ingestion source */
|
|
398
|
+
private connectIngestion;
|
|
399
|
+
/** Disconnect from the ingestion source */
|
|
400
|
+
private disconnectIngestion;
|
|
378
401
|
private applyHistory;
|
|
379
402
|
/** Current history index (0-based) */
|
|
380
403
|
getHistoryIndex(): number;
|
|
@@ -446,6 +469,20 @@ declare class API<N, E> {
|
|
|
446
469
|
}): void;
|
|
447
470
|
/** Update color mode without recreating the canvas */
|
|
448
471
|
setColorMode(colorMode: 'light' | 'dark' | 'system'): void;
|
|
472
|
+
/**
|
|
473
|
+
* Apply prop changes by diffing against previously applied props.
|
|
474
|
+
* This is a convenience method for framework wrappers that centralizes
|
|
475
|
+
* the logic for detecting and applying changes to nodes, edges, history, and options.
|
|
476
|
+
* The API stores the previous props internally, so you just pass the new props.
|
|
477
|
+
*
|
|
478
|
+
* @param props - The new props to apply
|
|
479
|
+
*/
|
|
480
|
+
applyProps(props: {
|
|
481
|
+
nodes?: N[];
|
|
482
|
+
edges?: E[];
|
|
483
|
+
history?: Update<N, E>[];
|
|
484
|
+
options?: APIOptions<N, E>;
|
|
485
|
+
}): void;
|
|
449
486
|
/** Cleanup resources when the graph is destroyed */
|
|
450
487
|
destroy(): void;
|
|
451
488
|
}
|
|
@@ -648,4 +685,4 @@ declare class Playground {
|
|
|
648
685
|
|
|
649
686
|
declare function graph<N, E>(args?: APIArguments<N, E>): Promise<API<N, E>>;
|
|
650
687
|
|
|
651
|
-
export { API, type APIArguments, type APIOptions, type EventsOptions, type Example, type ExampleEdge, type ExampleNode, type ExampleOptions, FileSource, FileSystemSource, type HistoryMessage, Ingest, type IngestMessage, Playground, type PlaygroundOptions, type SnapshotMessage, type Update, type UpdateMessage, Updater, WebSocketSource, graph as default, graph };
|
|
688
|
+
export { API, type APIArguments, type APIOptions, type EventsOptions, type Example, type ExampleEdge, type ExampleNode, type ExampleOptions, FileSource, FileSystemSource, type HistoryMessage, Ingest, type IngestMessage, type IngestionConfig, Playground, type PlaygroundOptions, type SnapshotMessage, type Update, type UpdateMessage, Updater, WebSocketSource, graph as default, graph };
|
package/dist/index.d.ts
CHANGED
|
@@ -11,11 +11,24 @@ type Dims = {
|
|
|
11
11
|
|
|
12
12
|
type MarkerType = 'arrow' | 'circle' | 'diamond' | 'bar' | 'none';
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Ingestion source configuration.
|
|
16
|
+
* Used to connect to an external data source for graph updates.
|
|
17
|
+
*/
|
|
18
|
+
type IngestionConfig = {
|
|
19
|
+
type: 'websocket';
|
|
20
|
+
url: string;
|
|
21
|
+
reconnectMs?: number;
|
|
22
|
+
} | {
|
|
23
|
+
type: 'file';
|
|
24
|
+
url: string;
|
|
25
|
+
intervalMs?: number;
|
|
26
|
+
};
|
|
14
27
|
/**
|
|
15
28
|
* Arguments to the API constructor.
|
|
16
29
|
*
|
|
17
|
-
* The caller can specify nodes and edges, or
|
|
18
|
-
* but not
|
|
30
|
+
* The caller can specify nodes and edges, history, or ingestion config,
|
|
31
|
+
* but not multiple.
|
|
19
32
|
*
|
|
20
33
|
* The root element ID is required.
|
|
21
34
|
*/
|
|
@@ -28,6 +41,8 @@ type APIArguments<N, E> = {
|
|
|
28
41
|
edges?: E[];
|
|
29
42
|
/** Initial history */
|
|
30
43
|
history?: Update<N, E>[];
|
|
44
|
+
/** Ingestion source configuration */
|
|
45
|
+
ingestion?: IngestionConfig;
|
|
31
46
|
/** Events */
|
|
32
47
|
events?: EventsOptions<N, E>;
|
|
33
48
|
/** Root element ID */
|
|
@@ -370,11 +385,19 @@ declare class API<N, E> {
|
|
|
370
385
|
private nextNodeId;
|
|
371
386
|
private nextEdgeId;
|
|
372
387
|
private events;
|
|
388
|
+
private ingest?;
|
|
389
|
+
private ingestionSource?;
|
|
390
|
+
private ingestionConfig?;
|
|
391
|
+
private prevProps;
|
|
373
392
|
root: string;
|
|
374
393
|
constructor(args: APIArguments<N, E>);
|
|
375
394
|
reset(): void;
|
|
376
395
|
/** Initialize the API */
|
|
377
396
|
init(): Promise<void>;
|
|
397
|
+
/** Connect to the configured ingestion source */
|
|
398
|
+
private connectIngestion;
|
|
399
|
+
/** Disconnect from the ingestion source */
|
|
400
|
+
private disconnectIngestion;
|
|
378
401
|
private applyHistory;
|
|
379
402
|
/** Current history index (0-based) */
|
|
380
403
|
getHistoryIndex(): number;
|
|
@@ -446,6 +469,20 @@ declare class API<N, E> {
|
|
|
446
469
|
}): void;
|
|
447
470
|
/** Update color mode without recreating the canvas */
|
|
448
471
|
setColorMode(colorMode: 'light' | 'dark' | 'system'): void;
|
|
472
|
+
/**
|
|
473
|
+
* Apply prop changes by diffing against previously applied props.
|
|
474
|
+
* This is a convenience method for framework wrappers that centralizes
|
|
475
|
+
* the logic for detecting and applying changes to nodes, edges, history, and options.
|
|
476
|
+
* The API stores the previous props internally, so you just pass the new props.
|
|
477
|
+
*
|
|
478
|
+
* @param props - The new props to apply
|
|
479
|
+
*/
|
|
480
|
+
applyProps(props: {
|
|
481
|
+
nodes?: N[];
|
|
482
|
+
edges?: E[];
|
|
483
|
+
history?: Update<N, E>[];
|
|
484
|
+
options?: APIOptions<N, E>;
|
|
485
|
+
}): void;
|
|
449
486
|
/** Cleanup resources when the graph is destroyed */
|
|
450
487
|
destroy(): void;
|
|
451
488
|
}
|
|
@@ -648,4 +685,4 @@ declare class Playground {
|
|
|
648
685
|
|
|
649
686
|
declare function graph<N, E>(args?: APIArguments<N, E>): Promise<API<N, E>>;
|
|
650
687
|
|
|
651
|
-
export { API, type APIArguments, type APIOptions, type EventsOptions, type Example, type ExampleEdge, type ExampleNode, type ExampleOptions, FileSource, FileSystemSource, type HistoryMessage, Ingest, type IngestMessage, Playground, type PlaygroundOptions, type SnapshotMessage, type Update, type UpdateMessage, Updater, WebSocketSource, graph as default, graph };
|
|
688
|
+
export { API, type APIArguments, type APIOptions, type EventsOptions, type Example, type ExampleEdge, type ExampleNode, type ExampleOptions, FileSource, FileSystemSource, type HistoryMessage, Ingest, type IngestMessage, type IngestionConfig, Playground, type PlaygroundOptions, type SnapshotMessage, type Update, type UpdateMessage, Updater, WebSocketSource, graph as default, graph };
|