graphwise-reactodia 0.0.1-TR8 → 0.0.1-TR9
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/cjs/graphwise-reactodia.cjs.entry.js +86 -33
- package/dist/collection/components/graphwise-reactodia/providers/service/service.js +19 -1
- package/dist/collection/components/graphwise-reactodia/providers/service/service.provider.js +3 -3
- package/dist/collection/components/graphwise-reactodia/services/diagram/diagram.service.js +25 -10
- package/dist/collection/components/graphwise-reactodia/services/diagram-storage/diagram-storage.service.js +23 -10
- package/dist/collection/components/graphwise-reactodia/services/event/event.service.js +18 -5
- package/dist/collection/components/graphwise-reactodia/services/window/window.service.js +18 -2
- package/dist/esm/graphwise-reactodia.entry.js +86 -33
- package/dist/graphwise-reactodia/graphwise-reactodia.esm.js +1 -1
- package/dist/graphwise-reactodia/{p-80cb6eef.entry.js → p-5b907998.entry.js} +1 -1
- package/dist/types/components/graphwise-reactodia/providers/service/service-inject.d.ts +1 -1
- package/dist/types/components/graphwise-reactodia/providers/service/service.d.ts +25 -3
- package/dist/types/components/graphwise-reactodia/providers/service/service.provider.d.ts +1 -3
- package/dist/types/components/graphwise-reactodia/services/diagram/diagram.service.d.ts +5 -7
- package/dist/types/components/graphwise-reactodia/services/diagram-storage/diagram-storage.service.d.ts +2 -2
- package/dist/types/components/graphwise-reactodia/services/event/event.service.d.ts +2 -2
- package/dist/types/components/graphwise-reactodia/services/window/window.service.d.ts +3 -3
- package/package.json +1 -1
|
@@ -10,4 +10,4 @@ import { Service } from './service';
|
|
|
10
10
|
* const diagramStateService = service(DiagramStateService);
|
|
11
11
|
* ```
|
|
12
12
|
*/
|
|
13
|
-
export declare function service<T
|
|
13
|
+
export declare function service<T>(serviceClass: Service<T>): T;
|
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Interface for injectable services by the service provider. Each service needs to have a static unique ID, which
|
|
3
|
+
* is used by the {@link ServiceProvider} to cache and retrieve the singleton instance of the service. Unique IDs ensure
|
|
4
|
+
* correct working of the service provider, when the services are minified
|
|
5
|
+
*
|
|
6
|
+
* @template T the type of the service
|
|
4
7
|
*/
|
|
5
|
-
export interface Service {
|
|
8
|
+
export interface Service<T> {
|
|
9
|
+
readonly ID: string;
|
|
10
|
+
new (): T;
|
|
6
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Decorator for a service class.
|
|
14
|
+
* It receives the class and simply type checks it with the {@link Service} interface.
|
|
15
|
+
* Works as a contract, which enforces the service class to have a static ID member.
|
|
16
|
+
* We can't simply implement the interface, since this will enforce the ID to be an instance member, which is not what we want.
|
|
17
|
+
*
|
|
18
|
+
* @param _serviceClass The decorated service class, checked for its ID and discarded.
|
|
19
|
+
* @template T The type of the service instance.
|
|
20
|
+
* @example
|
|
21
|
+
* ```TypeScript
|
|
22
|
+
* @Service
|
|
23
|
+
* export class WindowService {
|
|
24
|
+
* static readonly ID = 'WindowService';
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function Service<T>(_serviceClass: Service<T>): void;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { DataDiagramModel, SerializedDiagram } from '@reactodia/workspace';
|
|
2
|
-
import { Service } from '../../providers/service/service';
|
|
3
2
|
import { Subscription } from '../../models/subscription';
|
|
4
3
|
/**
|
|
5
4
|
* Callback invoked with the current diagram layout whenever it changes.
|
|
@@ -8,16 +7,15 @@ export type DiagramChangeCallback = (diagram: SerializedDiagram) => void;
|
|
|
8
7
|
/**
|
|
9
8
|
* Service for diagram related operations and subscriptions
|
|
10
9
|
*/
|
|
11
|
-
export declare class DiagramService
|
|
12
|
-
|
|
13
|
-
* Debounce time for the callback trigger. This is needed, because certain events (like moving a node) can trigger
|
|
14
|
-
* multiple `historyChanged` events in a short time.
|
|
15
|
-
*/
|
|
10
|
+
export declare class DiagramService {
|
|
11
|
+
static readonly ID = "DiagramService";
|
|
16
12
|
private static readonly NOTIFY_DEBOUNCE_MS;
|
|
17
13
|
private static readonly HISTORY_CHANGED_EVENT;
|
|
18
14
|
/**
|
|
19
15
|
* Subscribes to diagram changes. On every debounced change the current layout is
|
|
20
|
-
* exported and passed to the callback
|
|
16
|
+
* exported and passed to the callback.
|
|
17
|
+
* Debounce time for the callback trigger is needed, because certain events (like moving a node) can trigger
|
|
18
|
+
* multiple `historyChanged` events in a short time.
|
|
21
19
|
*
|
|
22
20
|
* @param model The diagram model to observe.
|
|
23
21
|
* @param onChangeCallback Called with the exported layout when the diagram changes.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { SerializedDiagram } from '@reactodia/workspace';
|
|
2
|
-
import { Service } from '../../providers/service/service';
|
|
3
2
|
/**
|
|
4
3
|
* Service for local store-related diagram operations
|
|
5
4
|
*/
|
|
6
|
-
export declare class DiagramStorageService
|
|
5
|
+
export declare class DiagramStorageService {
|
|
6
|
+
static readonly ID = "DiagramStorageService";
|
|
7
7
|
private static readonly STORAGE_KEY;
|
|
8
8
|
/**
|
|
9
9
|
* Load the persisted diagram from the local store, or `undefined` when nothing is stored (or the stored value
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Service } from '../../providers/service/service';
|
|
2
1
|
import { Subscription } from '../../models/subscription';
|
|
3
2
|
/**
|
|
4
3
|
* Service for event based operations
|
|
5
4
|
*/
|
|
6
|
-
export declare class EventService
|
|
5
|
+
export declare class EventService {
|
|
6
|
+
static readonly ID = "EventService";
|
|
7
7
|
/**
|
|
8
8
|
* Subscribes to the host's "clear persisted diagram" command.
|
|
9
9
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Service } from '../../providers/service/service';
|
|
2
1
|
/**
|
|
3
2
|
* Service that provides access to browser window-related functionality.
|
|
4
3
|
*/
|
|
5
|
-
export declare class WindowService
|
|
6
|
-
|
|
4
|
+
export declare class WindowService {
|
|
5
|
+
static readonly ID = "WindowService";
|
|
6
|
+
getWindow(): Window;
|
|
7
7
|
}
|