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.
Files changed (18) hide show
  1. package/dist/cjs/graphwise-reactodia.cjs.entry.js +86 -33
  2. package/dist/collection/components/graphwise-reactodia/providers/service/service.js +19 -1
  3. package/dist/collection/components/graphwise-reactodia/providers/service/service.provider.js +3 -3
  4. package/dist/collection/components/graphwise-reactodia/services/diagram/diagram.service.js +25 -10
  5. package/dist/collection/components/graphwise-reactodia/services/diagram-storage/diagram-storage.service.js +23 -10
  6. package/dist/collection/components/graphwise-reactodia/services/event/event.service.js +18 -5
  7. package/dist/collection/components/graphwise-reactodia/services/window/window.service.js +18 -2
  8. package/dist/esm/graphwise-reactodia.entry.js +86 -33
  9. package/dist/graphwise-reactodia/graphwise-reactodia.esm.js +1 -1
  10. package/dist/graphwise-reactodia/{p-80cb6eef.entry.js → p-5b907998.entry.js} +1 -1
  11. package/dist/types/components/graphwise-reactodia/providers/service/service-inject.d.ts +1 -1
  12. package/dist/types/components/graphwise-reactodia/providers/service/service.d.ts +25 -3
  13. package/dist/types/components/graphwise-reactodia/providers/service/service.provider.d.ts +1 -3
  14. package/dist/types/components/graphwise-reactodia/services/diagram/diagram.service.d.ts +5 -7
  15. package/dist/types/components/graphwise-reactodia/services/diagram-storage/diagram-storage.service.d.ts +2 -2
  16. package/dist/types/components/graphwise-reactodia/services/event/event.service.d.ts +2 -2
  17. package/dist/types/components/graphwise-reactodia/services/window/window.service.d.ts +3 -3
  18. package/package.json +1 -1
@@ -30660,10 +30660,10 @@ class ServiceProvider {
30660
30660
  * @template T The type of the service to retrieve.
30661
30661
  */
30662
30662
  static get(type) {
30663
- if (!ServiceProvider.SERVICE_INSTANCES.has(type.name)) {
30664
- ServiceProvider.SERVICE_INSTANCES.set(type.name, new type());
30663
+ if (!ServiceProvider.SERVICE_INSTANCES.has(type.ID)) {
30664
+ ServiceProvider.SERVICE_INSTANCES.set(type.ID, new type());
30665
30665
  }
30666
- return ServiceProvider.SERVICE_INSTANCES.get(type.name);
30666
+ return ServiceProvider.SERVICE_INSTANCES.get(type.ID);
30667
30667
  }
30668
30668
  }
30669
30669
  ServiceProvider.SERVICE_INSTANCES = new Map();
@@ -30683,13 +30683,42 @@ function service(serviceClass) {
30683
30683
  return ServiceProvider.get(serviceClass);
30684
30684
  }
30685
30685
 
30686
+ /**
30687
+ * Decorator for a service class.
30688
+ * It receives the class and simply type checks it with the {@link Service} interface.
30689
+ * Works as a contract, which enforces the service class to have a static ID member.
30690
+ * We can't simply implement the interface, since this will enforce the ID to be an instance member, which is not what we want.
30691
+ *
30692
+ * @param _serviceClass The decorated service class, checked for its ID and discarded.
30693
+ * @template T The type of the service instance.
30694
+ * @example
30695
+ * ```TypeScript
30696
+ * @Service
30697
+ * export class WindowService {
30698
+ * static readonly ID = 'WindowService';
30699
+ * }
30700
+ * ```
30701
+ */
30702
+ function Service(_serviceClass) {
30703
+ // no implementation needed. We only use the type checking of the parameter
30704
+ }
30705
+
30706
+ var __decorate$3 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
30707
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
30708
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
30709
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
30710
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
30711
+ };
30712
+ var DiagramService_1;
30686
30713
  /**
30687
30714
  * Service for diagram related operations and subscriptions
30688
30715
  */
30689
- class DiagramService {
30716
+ let DiagramService = DiagramService_1 = class DiagramService {
30690
30717
  /**
30691
30718
  * Subscribes to diagram changes. On every debounced change the current layout is
30692
- * exported and passed to the callback
30719
+ * exported and passed to the callback.
30720
+ * Debounce time for the callback trigger is needed, because certain events (like moving a node) can trigger
30721
+ * multiple `historyChanged` events in a short time.
30693
30722
  *
30694
30723
  * @param model The diagram model to observe.
30695
30724
  * @param onChangeCallback Called with the exported layout when the diagram changes.
@@ -30705,44 +30734,60 @@ class DiagramService {
30705
30734
  notifyTimer = setTimeout(() => {
30706
30735
  notifyTimer = undefined;
30707
30736
  onChangeCallback(model.exportLayout());
30708
- }, DiagramService.NOTIFY_DEBOUNCE_MS);
30737
+ }, DiagramService_1.NOTIFY_DEBOUNCE_MS);
30709
30738
  };
30710
- model.history.events.on(DiagramService.HISTORY_CHANGED_EVENT, onHistoryChange);
30739
+ model.history.events.on(DiagramService_1.HISTORY_CHANGED_EVENT, onHistoryChange);
30711
30740
  return () => {
30712
- model.history.events.off(DiagramService.HISTORY_CHANGED_EVENT, onHistoryChange);
30741
+ model.history.events.off(DiagramService_1.HISTORY_CHANGED_EVENT, onHistoryChange);
30713
30742
  if (notifyTimer) {
30714
30743
  clearTimeout(notifyTimer);
30715
30744
  }
30716
30745
  };
30717
30746
  }
30718
- }
30719
- /**
30720
- * Debounce time for the callback trigger. This is needed, because certain events (like moving a node) can trigger
30721
- * multiple `historyChanged` events in a short time.
30722
- */
30747
+ };
30748
+ DiagramService.ID = 'DiagramService';
30723
30749
  DiagramService.NOTIFY_DEBOUNCE_MS = 300;
30724
30750
  DiagramService.HISTORY_CHANGED_EVENT = 'historyChanged';
30725
-
30751
+ DiagramService = DiagramService_1 = __decorate$3([
30752
+ Service
30753
+ ], DiagramService);
30754
+
30755
+ var __decorate$2 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
30756
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
30757
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
30758
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
30759
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
30760
+ };
30726
30761
  /**
30727
30762
  * Service that provides access to browser window-related functionality.
30728
30763
  */
30729
- class WindowService {
30764
+ let WindowService = class WindowService {
30730
30765
  getWindow() {
30731
30766
  return window;
30732
30767
  }
30733
- }
30734
-
30768
+ };
30769
+ WindowService.ID = 'WindowService';
30770
+ WindowService = __decorate$2([
30771
+ Service
30772
+ ], WindowService);
30773
+
30774
+ var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
30775
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
30776
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
30777
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
30778
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
30779
+ };
30780
+ var DiagramStorageService_1;
30735
30781
  /**
30736
30782
  * Service for local store-related diagram operations
30737
30783
  */
30738
- class DiagramStorageService {
30784
+ let DiagramStorageService = DiagramStorageService_1 = class DiagramStorageService {
30739
30785
  /**
30740
30786
  * Load the persisted diagram from the local store, or `undefined` when nothing is stored (or the stored value
30741
30787
  * is unreadable).
30742
30788
  */
30743
30789
  load() {
30744
- var _a;
30745
- const raw = (_a = this.storage) === null || _a === void 0 ? void 0 : _a.getItem(DiagramStorageService.STORAGE_KEY);
30790
+ const raw = this.storage.getItem(DiagramStorageService_1.STORAGE_KEY);
30746
30791
  if (!raw) {
30747
30792
  return undefined;
30748
30793
  }
@@ -30752,31 +30797,38 @@ class DiagramStorageService {
30752
30797
  * Persists the given diagram serialization.
30753
30798
  */
30754
30799
  save(diagram) {
30755
- var _a;
30756
- (_a = this.storage) === null || _a === void 0 ? void 0 : _a.setItem(DiagramStorageService.STORAGE_KEY, JSON.stringify(diagram));
30800
+ this.storage.setItem(DiagramStorageService_1.STORAGE_KEY, JSON.stringify(diagram));
30757
30801
  }
30758
30802
  /**
30759
30803
  * Removes the persisted diagram. Used when a new view (a seed) should take precedence over
30760
30804
  * previously saved edits.
30761
30805
  */
30762
30806
  clear() {
30763
- var _a;
30764
- (_a = this.storage) === null || _a === void 0 ? void 0 : _a.removeItem(DiagramStorageService.STORAGE_KEY);
30807
+ this.storage.removeItem(DiagramStorageService_1.STORAGE_KEY);
30765
30808
  }
30766
30809
  /**
30767
30810
  * Local storage getter
30768
30811
  */
30769
30812
  get storage() {
30770
- var _a;
30771
- return (_a = service(WindowService).getWindow()) === null || _a === void 0 ? void 0 : _a.localStorage;
30813
+ return service(WindowService).getWindow().localStorage;
30772
30814
  }
30773
- }
30815
+ };
30816
+ DiagramStorageService.ID = 'DiagramStorageService';
30774
30817
  DiagramStorageService.STORAGE_KEY = 'diagram.state';
30775
-
30818
+ DiagramStorageService = DiagramStorageService_1 = __decorate$1([
30819
+ Service
30820
+ ], DiagramStorageService);
30821
+
30822
+ var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
30823
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
30824
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
30825
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
30826
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
30827
+ };
30776
30828
  /**
30777
30829
  * Service for event based operations
30778
30830
  */
30779
- class EventService {
30831
+ let EventService = class EventService {
30780
30832
  /**
30781
30833
  * Subscribes to the host's "clear persisted diagram" command.
30782
30834
  *
@@ -30785,13 +30837,14 @@ class EventService {
30785
30837
  */
30786
30838
  subscribeToClearDiagramStorage(onClear) {
30787
30839
  const target = service(WindowService).getWindow();
30788
- if (!target) {
30789
- return () => undefined;
30790
- }
30791
30840
  target.addEventListener(index.CLEAR_DIAGRAM_STORAGE_EVENT, onClear);
30792
30841
  return () => target.removeEventListener(index.CLEAR_DIAGRAM_STORAGE_EVENT, onClear);
30793
30842
  }
30794
- }
30843
+ };
30844
+ EventService.ID = 'EventService';
30845
+ EventService = __decorate([
30846
+ Service
30847
+ ], EventService);
30795
30848
 
30796
30849
  /**
30797
30850
  * A collection of {@link Subscription}s that can be released together. Components collect the
@@ -1 +1,19 @@
1
- export {};
1
+ /**
2
+ * Decorator for a service class.
3
+ * It receives the class and simply type checks it with the {@link Service} interface.
4
+ * Works as a contract, which enforces the service class to have a static ID member.
5
+ * We can't simply implement the interface, since this will enforce the ID to be an instance member, which is not what we want.
6
+ *
7
+ * @param _serviceClass The decorated service class, checked for its ID and discarded.
8
+ * @template T The type of the service instance.
9
+ * @example
10
+ * ```TypeScript
11
+ * @Service
12
+ * export class WindowService {
13
+ * static readonly ID = 'WindowService';
14
+ * }
15
+ * ```
16
+ */
17
+ export function Service(_serviceClass) {
18
+ // no implementation needed. We only use the type checking of the parameter
19
+ }
@@ -11,10 +11,10 @@ export class ServiceProvider {
11
11
  * @template T The type of the service to retrieve.
12
12
  */
13
13
  static get(type) {
14
- if (!ServiceProvider.SERVICE_INSTANCES.has(type.name)) {
15
- ServiceProvider.SERVICE_INSTANCES.set(type.name, new type());
14
+ if (!ServiceProvider.SERVICE_INSTANCES.has(type.ID)) {
15
+ ServiceProvider.SERVICE_INSTANCES.set(type.ID, new type());
16
16
  }
17
- return ServiceProvider.SERVICE_INSTANCES.get(type.name);
17
+ return ServiceProvider.SERVICE_INSTANCES.get(type.ID);
18
18
  }
19
19
  }
20
20
  ServiceProvider.SERVICE_INSTANCES = new Map();
@@ -1,10 +1,24 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
4
+ r = Reflect.decorate(decorators, target, key, desc);
5
+ else
6
+ for (var i = decorators.length - 1; i >= 0; i--)
7
+ if (d = decorators[i])
8
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
9
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
10
+ };
11
+ var DiagramService_1;
12
+ import { Service } from "../../providers/service/service";
1
13
  /**
2
14
  * Service for diagram related operations and subscriptions
3
15
  */
4
- export class DiagramService {
16
+ let DiagramService = DiagramService_1 = class DiagramService {
5
17
  /**
6
18
  * Subscribes to diagram changes. On every debounced change the current layout is
7
- * exported and passed to the callback
19
+ * exported and passed to the callback.
20
+ * Debounce time for the callback trigger is needed, because certain events (like moving a node) can trigger
21
+ * multiple `historyChanged` events in a short time.
8
22
  *
9
23
  * @param model The diagram model to observe.
10
24
  * @param onChangeCallback Called with the exported layout when the diagram changes.
@@ -20,20 +34,21 @@ export class DiagramService {
20
34
  notifyTimer = setTimeout(() => {
21
35
  notifyTimer = undefined;
22
36
  onChangeCallback(model.exportLayout());
23
- }, DiagramService.NOTIFY_DEBOUNCE_MS);
37
+ }, DiagramService_1.NOTIFY_DEBOUNCE_MS);
24
38
  };
25
- model.history.events.on(DiagramService.HISTORY_CHANGED_EVENT, onHistoryChange);
39
+ model.history.events.on(DiagramService_1.HISTORY_CHANGED_EVENT, onHistoryChange);
26
40
  return () => {
27
- model.history.events.off(DiagramService.HISTORY_CHANGED_EVENT, onHistoryChange);
41
+ model.history.events.off(DiagramService_1.HISTORY_CHANGED_EVENT, onHistoryChange);
28
42
  if (notifyTimer) {
29
43
  clearTimeout(notifyTimer);
30
44
  }
31
45
  };
32
46
  }
33
- }
34
- /**
35
- * Debounce time for the callback trigger. This is needed, because certain events (like moving a node) can trigger
36
- * multiple `historyChanged` events in a short time.
37
- */
47
+ };
48
+ DiagramService.ID = 'DiagramService';
38
49
  DiagramService.NOTIFY_DEBOUNCE_MS = 300;
39
50
  DiagramService.HISTORY_CHANGED_EVENT = 'historyChanged';
51
+ DiagramService = DiagramService_1 = __decorate([
52
+ Service
53
+ ], DiagramService);
54
+ export { DiagramService };
@@ -1,16 +1,27 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
4
+ r = Reflect.decorate(decorators, target, key, desc);
5
+ else
6
+ for (var i = decorators.length - 1; i >= 0; i--)
7
+ if (d = decorators[i])
8
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
9
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
10
+ };
11
+ var DiagramStorageService_1;
12
+ import { Service } from "../../providers/service/service";
1
13
  import { service } from "../../providers/service/service-inject";
2
14
  import { WindowService } from "../window/window.service";
3
15
  /**
4
16
  * Service for local store-related diagram operations
5
17
  */
6
- export class DiagramStorageService {
18
+ let DiagramStorageService = DiagramStorageService_1 = class DiagramStorageService {
7
19
  /**
8
20
  * Load the persisted diagram from the local store, or `undefined` when nothing is stored (or the stored value
9
21
  * is unreadable).
10
22
  */
11
23
  load() {
12
- var _a;
13
- const raw = (_a = this.storage) === null || _a === void 0 ? void 0 : _a.getItem(DiagramStorageService.STORAGE_KEY);
24
+ const raw = this.storage.getItem(DiagramStorageService_1.STORAGE_KEY);
14
25
  if (!raw) {
15
26
  return undefined;
16
27
  }
@@ -20,23 +31,25 @@ export class DiagramStorageService {
20
31
  * Persists the given diagram serialization.
21
32
  */
22
33
  save(diagram) {
23
- var _a;
24
- (_a = this.storage) === null || _a === void 0 ? void 0 : _a.setItem(DiagramStorageService.STORAGE_KEY, JSON.stringify(diagram));
34
+ this.storage.setItem(DiagramStorageService_1.STORAGE_KEY, JSON.stringify(diagram));
25
35
  }
26
36
  /**
27
37
  * Removes the persisted diagram. Used when a new view (a seed) should take precedence over
28
38
  * previously saved edits.
29
39
  */
30
40
  clear() {
31
- var _a;
32
- (_a = this.storage) === null || _a === void 0 ? void 0 : _a.removeItem(DiagramStorageService.STORAGE_KEY);
41
+ this.storage.removeItem(DiagramStorageService_1.STORAGE_KEY);
33
42
  }
34
43
  /**
35
44
  * Local storage getter
36
45
  */
37
46
  get storage() {
38
- var _a;
39
- return (_a = service(WindowService).getWindow()) === null || _a === void 0 ? void 0 : _a.localStorage;
47
+ return service(WindowService).getWindow().localStorage;
40
48
  }
41
- }
49
+ };
50
+ DiagramStorageService.ID = 'DiagramStorageService';
42
51
  DiagramStorageService.STORAGE_KEY = 'diagram.state';
52
+ DiagramStorageService = DiagramStorageService_1 = __decorate([
53
+ Service
54
+ ], DiagramStorageService);
55
+ export { DiagramStorageService };
@@ -1,10 +1,21 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
4
+ r = Reflect.decorate(decorators, target, key, desc);
5
+ else
6
+ for (var i = decorators.length - 1; i >= 0; i--)
7
+ if (d = decorators[i])
8
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
9
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
10
+ };
11
+ import { Service } from "../../providers/service/service";
1
12
  import { CLEAR_DIAGRAM_STORAGE_EVENT } from "../../models/clear-diagram-storage-event";
2
13
  import { service } from "../../providers/service/service-inject";
3
14
  import { WindowService } from "../window/window.service";
4
15
  /**
5
16
  * Service for event based operations
6
17
  */
7
- export class EventService {
18
+ let EventService = class EventService {
8
19
  /**
9
20
  * Subscribes to the host's "clear persisted diagram" command.
10
21
  *
@@ -13,10 +24,12 @@ export class EventService {
13
24
  */
14
25
  subscribeToClearDiagramStorage(onClear) {
15
26
  const target = service(WindowService).getWindow();
16
- if (!target) {
17
- return () => undefined;
18
- }
19
27
  target.addEventListener(CLEAR_DIAGRAM_STORAGE_EVENT, onClear);
20
28
  return () => target.removeEventListener(CLEAR_DIAGRAM_STORAGE_EVENT, onClear);
21
29
  }
22
- }
30
+ };
31
+ EventService.ID = 'EventService';
32
+ EventService = __decorate([
33
+ Service
34
+ ], EventService);
35
+ export { EventService };
@@ -1,8 +1,24 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
4
+ r = Reflect.decorate(decorators, target, key, desc);
5
+ else
6
+ for (var i = decorators.length - 1; i >= 0; i--)
7
+ if (d = decorators[i])
8
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
9
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
10
+ };
11
+ import { Service } from "../../providers/service/service";
1
12
  /**
2
13
  * Service that provides access to browser window-related functionality.
3
14
  */
4
- export class WindowService {
15
+ let WindowService = class WindowService {
5
16
  getWindow() {
6
17
  return window;
7
18
  }
8
- }
19
+ };
20
+ WindowService.ID = 'WindowService';
21
+ WindowService = __decorate([
22
+ Service
23
+ ], WindowService);
24
+ export { WindowService };
@@ -30658,10 +30658,10 @@ class ServiceProvider {
30658
30658
  * @template T The type of the service to retrieve.
30659
30659
  */
30660
30660
  static get(type) {
30661
- if (!ServiceProvider.SERVICE_INSTANCES.has(type.name)) {
30662
- ServiceProvider.SERVICE_INSTANCES.set(type.name, new type());
30661
+ if (!ServiceProvider.SERVICE_INSTANCES.has(type.ID)) {
30662
+ ServiceProvider.SERVICE_INSTANCES.set(type.ID, new type());
30663
30663
  }
30664
- return ServiceProvider.SERVICE_INSTANCES.get(type.name);
30664
+ return ServiceProvider.SERVICE_INSTANCES.get(type.ID);
30665
30665
  }
30666
30666
  }
30667
30667
  ServiceProvider.SERVICE_INSTANCES = new Map();
@@ -30681,13 +30681,42 @@ function service(serviceClass) {
30681
30681
  return ServiceProvider.get(serviceClass);
30682
30682
  }
30683
30683
 
30684
+ /**
30685
+ * Decorator for a service class.
30686
+ * It receives the class and simply type checks it with the {@link Service} interface.
30687
+ * Works as a contract, which enforces the service class to have a static ID member.
30688
+ * We can't simply implement the interface, since this will enforce the ID to be an instance member, which is not what we want.
30689
+ *
30690
+ * @param _serviceClass The decorated service class, checked for its ID and discarded.
30691
+ * @template T The type of the service instance.
30692
+ * @example
30693
+ * ```TypeScript
30694
+ * @Service
30695
+ * export class WindowService {
30696
+ * static readonly ID = 'WindowService';
30697
+ * }
30698
+ * ```
30699
+ */
30700
+ function Service(_serviceClass) {
30701
+ // no implementation needed. We only use the type checking of the parameter
30702
+ }
30703
+
30704
+ var __decorate$3 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
30705
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
30706
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
30707
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
30708
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
30709
+ };
30710
+ var DiagramService_1;
30684
30711
  /**
30685
30712
  * Service for diagram related operations and subscriptions
30686
30713
  */
30687
- class DiagramService {
30714
+ let DiagramService = DiagramService_1 = class DiagramService {
30688
30715
  /**
30689
30716
  * Subscribes to diagram changes. On every debounced change the current layout is
30690
- * exported and passed to the callback
30717
+ * exported and passed to the callback.
30718
+ * Debounce time for the callback trigger is needed, because certain events (like moving a node) can trigger
30719
+ * multiple `historyChanged` events in a short time.
30691
30720
  *
30692
30721
  * @param model The diagram model to observe.
30693
30722
  * @param onChangeCallback Called with the exported layout when the diagram changes.
@@ -30703,44 +30732,60 @@ class DiagramService {
30703
30732
  notifyTimer = setTimeout(() => {
30704
30733
  notifyTimer = undefined;
30705
30734
  onChangeCallback(model.exportLayout());
30706
- }, DiagramService.NOTIFY_DEBOUNCE_MS);
30735
+ }, DiagramService_1.NOTIFY_DEBOUNCE_MS);
30707
30736
  };
30708
- model.history.events.on(DiagramService.HISTORY_CHANGED_EVENT, onHistoryChange);
30737
+ model.history.events.on(DiagramService_1.HISTORY_CHANGED_EVENT, onHistoryChange);
30709
30738
  return () => {
30710
- model.history.events.off(DiagramService.HISTORY_CHANGED_EVENT, onHistoryChange);
30739
+ model.history.events.off(DiagramService_1.HISTORY_CHANGED_EVENT, onHistoryChange);
30711
30740
  if (notifyTimer) {
30712
30741
  clearTimeout(notifyTimer);
30713
30742
  }
30714
30743
  };
30715
30744
  }
30716
- }
30717
- /**
30718
- * Debounce time for the callback trigger. This is needed, because certain events (like moving a node) can trigger
30719
- * multiple `historyChanged` events in a short time.
30720
- */
30745
+ };
30746
+ DiagramService.ID = 'DiagramService';
30721
30747
  DiagramService.NOTIFY_DEBOUNCE_MS = 300;
30722
30748
  DiagramService.HISTORY_CHANGED_EVENT = 'historyChanged';
30723
-
30749
+ DiagramService = DiagramService_1 = __decorate$3([
30750
+ Service
30751
+ ], DiagramService);
30752
+
30753
+ var __decorate$2 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
30754
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
30755
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
30756
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
30757
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
30758
+ };
30724
30759
  /**
30725
30760
  * Service that provides access to browser window-related functionality.
30726
30761
  */
30727
- class WindowService {
30762
+ let WindowService = class WindowService {
30728
30763
  getWindow() {
30729
30764
  return window;
30730
30765
  }
30731
- }
30732
-
30766
+ };
30767
+ WindowService.ID = 'WindowService';
30768
+ WindowService = __decorate$2([
30769
+ Service
30770
+ ], WindowService);
30771
+
30772
+ var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
30773
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
30774
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
30775
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
30776
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
30777
+ };
30778
+ var DiagramStorageService_1;
30733
30779
  /**
30734
30780
  * Service for local store-related diagram operations
30735
30781
  */
30736
- class DiagramStorageService {
30782
+ let DiagramStorageService = DiagramStorageService_1 = class DiagramStorageService {
30737
30783
  /**
30738
30784
  * Load the persisted diagram from the local store, or `undefined` when nothing is stored (or the stored value
30739
30785
  * is unreadable).
30740
30786
  */
30741
30787
  load() {
30742
- var _a;
30743
- const raw = (_a = this.storage) === null || _a === void 0 ? void 0 : _a.getItem(DiagramStorageService.STORAGE_KEY);
30788
+ const raw = this.storage.getItem(DiagramStorageService_1.STORAGE_KEY);
30744
30789
  if (!raw) {
30745
30790
  return undefined;
30746
30791
  }
@@ -30750,31 +30795,38 @@ class DiagramStorageService {
30750
30795
  * Persists the given diagram serialization.
30751
30796
  */
30752
30797
  save(diagram) {
30753
- var _a;
30754
- (_a = this.storage) === null || _a === void 0 ? void 0 : _a.setItem(DiagramStorageService.STORAGE_KEY, JSON.stringify(diagram));
30798
+ this.storage.setItem(DiagramStorageService_1.STORAGE_KEY, JSON.stringify(diagram));
30755
30799
  }
30756
30800
  /**
30757
30801
  * Removes the persisted diagram. Used when a new view (a seed) should take precedence over
30758
30802
  * previously saved edits.
30759
30803
  */
30760
30804
  clear() {
30761
- var _a;
30762
- (_a = this.storage) === null || _a === void 0 ? void 0 : _a.removeItem(DiagramStorageService.STORAGE_KEY);
30805
+ this.storage.removeItem(DiagramStorageService_1.STORAGE_KEY);
30763
30806
  }
30764
30807
  /**
30765
30808
  * Local storage getter
30766
30809
  */
30767
30810
  get storage() {
30768
- var _a;
30769
- return (_a = service(WindowService).getWindow()) === null || _a === void 0 ? void 0 : _a.localStorage;
30811
+ return service(WindowService).getWindow().localStorage;
30770
30812
  }
30771
- }
30813
+ };
30814
+ DiagramStorageService.ID = 'DiagramStorageService';
30772
30815
  DiagramStorageService.STORAGE_KEY = 'diagram.state';
30773
-
30816
+ DiagramStorageService = DiagramStorageService_1 = __decorate$1([
30817
+ Service
30818
+ ], DiagramStorageService);
30819
+
30820
+ var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
30821
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
30822
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
30823
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
30824
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
30825
+ };
30774
30826
  /**
30775
30827
  * Service for event based operations
30776
30828
  */
30777
- class EventService {
30829
+ let EventService = class EventService {
30778
30830
  /**
30779
30831
  * Subscribes to the host's "clear persisted diagram" command.
30780
30832
  *
@@ -30783,13 +30835,14 @@ class EventService {
30783
30835
  */
30784
30836
  subscribeToClearDiagramStorage(onClear) {
30785
30837
  const target = service(WindowService).getWindow();
30786
- if (!target) {
30787
- return () => undefined;
30788
- }
30789
30838
  target.addEventListener(CLEAR_DIAGRAM_STORAGE_EVENT, onClear);
30790
30839
  return () => target.removeEventListener(CLEAR_DIAGRAM_STORAGE_EVENT, onClear);
30791
30840
  }
30792
- }
30841
+ };
30842
+ EventService.ID = 'EventService';
30843
+ EventService = __decorate([
30844
+ Service
30845
+ ], EventService);
30793
30846
 
30794
30847
  /**
30795
30848
  * A collection of {@link Subscription}s that can be released together. Components collect the
@@ -1 +1 @@
1
- import{p as e,b as r}from"./p-Cypw7ydc.js";export{s as setNonce}from"./p-Cypw7ydc.js";import{g as t}from"./p-CalY52z6.js";(()=>{const r=import.meta.url,t={};return""!==r&&(t.resourcesUrl=new URL(".",r).href),e(t)})().then((async e=>(await t(),r([["p-80cb6eef",[[0,"graphwise-reactodia",{currentRepository:[1,"current-repository"],config:[16],language:[1],providerSettings:[16,"provider-settings"]},null,{currentRepository:["onProviderSettingsChange"],providerSettings:["onProviderSettingsChange"],language:["onLanguageChange"]}]]]],e))));
1
+ import{p as r,b as e}from"./p-Cypw7ydc.js";export{s as setNonce}from"./p-Cypw7ydc.js";import{g as t}from"./p-CalY52z6.js";(()=>{const e=import.meta.url,t={};return""!==e&&(t.resourcesUrl=new URL(".",e).href),r(t)})().then((async r=>(await t(),e([["p-5b907998",[[0,"graphwise-reactodia",{currentRepository:[1,"current-repository"],config:[16],language:[1],providerSettings:[16,"provider-settings"]},null,{currentRepository:["onProviderSettingsChange"],providerSettings:["onProviderSettingsChange"],language:["onLanguageChange"]}]]]],r))));