graphwise-reactodia 0.0.1-TR17 → 0.0.1-TR18

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 (33) hide show
  1. package/README.md +30 -8
  2. package/dist/cjs/{error-code-NpXlqCEN.js → error-code-BdRU0RQ9.js} +8 -0
  3. package/dist/cjs/graphwise-reactodia.cjs.entry.js +64 -54
  4. package/dist/cjs/index.cjs.js +8 -4
  5. package/dist/collection/components/graphwise-reactodia/graphwise-reactodia.js +14 -12
  6. package/dist/collection/components/graphwise-reactodia/models/error/error-report.js +1 -4
  7. package/dist/collection/components/graphwise-reactodia/models/event/event-detail.js +4 -0
  8. package/dist/collection/components/graphwise-reactodia/models/event/event-type.js +7 -0
  9. package/dist/collection/components/graphwise-reactodia/services/error/error.service.js +5 -16
  10. package/dist/collection/components/graphwise-reactodia/services/event/event.service.js +23 -0
  11. package/dist/collection/index.js +2 -1
  12. package/dist/collection/pages/graphwise-reactodia/main.js +6 -2
  13. package/dist/esm/{error-code-7lGYbTwb.js → error-code-DHI2bePh.js} +9 -1
  14. package/dist/esm/graphwise-reactodia.entry.js +64 -54
  15. package/dist/esm/index.js +4 -4
  16. package/dist/graphwise-reactodia/graphwise-reactodia.esm.js +1 -1
  17. package/dist/graphwise-reactodia/index.esm.js +1 -1
  18. package/dist/graphwise-reactodia/p-DHI2bePh.js +1 -0
  19. package/dist/graphwise-reactodia/p-abfb5091.entry.js +1 -0
  20. package/dist/types/components/graphwise-reactodia/graphwise-reactodia.d.ts +4 -4
  21. package/dist/types/components/graphwise-reactodia/models/error/error-report.d.ts +0 -4
  22. package/dist/types/components/graphwise-reactodia/models/event/event-callback.d.ts +5 -0
  23. package/dist/types/components/graphwise-reactodia/models/event/event-detail.d.ts +48 -0
  24. package/dist/types/components/graphwise-reactodia/models/event/event-type.d.ts +6 -0
  25. package/dist/types/components/graphwise-reactodia/services/error/error.service.d.ts +1 -10
  26. package/dist/types/components/graphwise-reactodia/services/event/event.service.d.ts +16 -0
  27. package/dist/types/components.d.ts +5 -5
  28. package/dist/types/index.d.ts +3 -1
  29. package/package.json +1 -1
  30. package/dist/graphwise-reactodia/p-7lGYbTwb.js +0 -1
  31. package/dist/graphwise-reactodia/p-ec30185a.entry.js +0 -1
  32. package/dist/types/components/graphwise-reactodia/models/error/error-callback.d.ts +0 -5
  33. /package/dist/collection/components/graphwise-reactodia/models/{error/error-callback.js → event/event-callback.js} +0 -0
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-DpCR6zMg.js';
2
- import { E as ErrorCode, C as CLEAR_DIAGRAM_STORAGE_EVENT } from './error-code-7lGYbTwb.js';
2
+ import { C as CLEAR_DIAGRAM_STORAGE_EVENT, E as EventType, a as ErrorCode } from './error-code-DHI2bePh.js';
3
3
 
4
4
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
5
5
 
@@ -31473,12 +31473,63 @@ var __decorate$3 = (undefined && undefined.__decorate) || function (decorators,
31473
31473
  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;
31474
31474
  return c > 3 && r && Object.defineProperty(target, key, r), r;
31475
31475
  };
31476
+ /**
31477
+ * Service for event based operations
31478
+ */
31479
+ let EventService = class EventService {
31480
+ /**
31481
+ * Announces an event to the host.
31482
+ *
31483
+ * @param detail The event detail.
31484
+ */
31485
+ emit(detail) {
31486
+ var _a;
31487
+ (_a = this.callback) === null || _a === void 0 ? void 0 : _a.call(this, detail);
31488
+ }
31489
+ /**
31490
+ * Subscribes to the emitted events, replacing the previous subscriber.
31491
+ *
31492
+ * @param callback Called with every emitted event.
31493
+ * @returns A {@link Subscription} that, when called, removes the callback, unless it has already been replaced.
31494
+ */
31495
+ subscribe(callback) {
31496
+ this.callback = callback;
31497
+ return () => {
31498
+ if (this.callback === callback) {
31499
+ this.callback = undefined;
31500
+ }
31501
+ };
31502
+ }
31503
+ /**
31504
+ * Subscribes to the host's "clear persisted diagram" command.
31505
+ *
31506
+ * @param onClear Called whenever the event fires.
31507
+ * @returns A {@link Subscription} that, when called, removes the listener.
31508
+ */
31509
+ subscribeToClearDiagramStorage(onClear) {
31510
+ const target = service(WindowService).getWindow();
31511
+ target.addEventListener(CLEAR_DIAGRAM_STORAGE_EVENT, onClear);
31512
+ return () => target.removeEventListener(CLEAR_DIAGRAM_STORAGE_EVENT, onClear);
31513
+ }
31514
+ };
31515
+ EventService.ID = 'EventService';
31516
+ EventService = __decorate$3([
31517
+ Service
31518
+ ], EventService);
31519
+
31520
+ var __decorate$2 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
31521
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
31522
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
31523
+ 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;
31524
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
31525
+ };
31476
31526
  var ErrorService_1;
31477
31527
  /**
31478
31528
  * Service that collects the failures of the wrapper and the fork, so they can be announced to the host.
31479
31529
  */
31480
31530
  let ErrorService = ErrorService_1 = class ErrorService {
31481
31531
  constructor() {
31532
+ this.eventService = service(EventService);
31482
31533
  this.reported = new WeakSet();
31483
31534
  }
31484
31535
  /**
@@ -31504,27 +31555,12 @@ let ErrorService = ErrorService_1 = class ErrorService {
31504
31555
  * @param thrown The thrown value.
31505
31556
  */
31506
31557
  report(code, thrown) {
31507
- var _a;
31508
31558
  const causes = this.causeChain(thrown);
31509
31559
  if (this.isAbortedOrAlreadyReported(causes)) {
31510
31560
  return;
31511
31561
  }
31512
31562
  causes.forEach((cause) => this.reported.add(cause));
31513
- (_a = this.callback) === null || _a === void 0 ? void 0 : _a.call(this, { code, error: thrown });
31514
- }
31515
- /**
31516
- * Subscribes to the reported errors, replacing the previous subscriber.
31517
- *
31518
- * @param callback Called with every reported error.
31519
- * @returns A {@link Subscription} that, when called, removes the callback, unless it has already been replaced.
31520
- */
31521
- subscribe(callback) {
31522
- this.callback = callback;
31523
- return () => {
31524
- if (this.callback === callback) {
31525
- this.callback = undefined;
31526
- }
31527
- };
31563
+ this.eventService.emit({ type: EventType.ERROR, payload: { code, error: thrown } });
31528
31564
  }
31529
31565
  /**
31530
31566
  * Whether any link of the given cause chain is an abort or is already reported.
@@ -31547,11 +31583,11 @@ let ErrorService = ErrorService_1 = class ErrorService {
31547
31583
  };
31548
31584
  ErrorService.ID = 'ErrorService';
31549
31585
  ErrorService.ABORT_ERROR_NAME = 'AbortError';
31550
- ErrorService = ErrorService_1 = __decorate$3([
31586
+ ErrorService = ErrorService_1 = __decorate$2([
31551
31587
  Service
31552
31588
  ], ErrorService);
31553
31589
 
31554
- var __decorate$2 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
31590
+ var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
31555
31591
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
31556
31592
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
31557
31593
  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;
@@ -31609,37 +31645,10 @@ let DiagramStorageService = DiagramStorageService_1 = class DiagramStorageServic
31609
31645
  };
31610
31646
  DiagramStorageService.ID = 'DiagramStorageService';
31611
31647
  DiagramStorageService.STORAGE_KEY = 'diagram.state';
31612
- DiagramStorageService = DiagramStorageService_1 = __decorate$2([
31648
+ DiagramStorageService = DiagramStorageService_1 = __decorate$1([
31613
31649
  Service
31614
31650
  ], DiagramStorageService);
31615
31651
 
31616
- var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
31617
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
31618
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
31619
- 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;
31620
- return c > 3 && r && Object.defineProperty(target, key, r), r;
31621
- };
31622
- /**
31623
- * Service for event based operations
31624
- */
31625
- let EventService = class EventService {
31626
- /**
31627
- * Subscribes to the host's "clear persisted diagram" command.
31628
- *
31629
- * @param onClear Called whenever the event fires.
31630
- * @returns A {@link Subscription} that, when called, removes the listener.
31631
- */
31632
- subscribeToClearDiagramStorage(onClear) {
31633
- const target = service(WindowService).getWindow();
31634
- target.addEventListener(CLEAR_DIAGRAM_STORAGE_EVENT, onClear);
31635
- return () => target.removeEventListener(CLEAR_DIAGRAM_STORAGE_EVENT, onClear);
31636
- }
31637
- };
31638
- EventService.ID = 'EventService';
31639
- EventService = __decorate$1([
31640
- Service
31641
- ], EventService);
31642
-
31643
31652
  /**
31644
31653
  * A collection of {@link Subscription}s that can be released together. Components collect the
31645
31654
  * subscriptions they open and call {@link unsubscribeAll} on teardown so nothing is left
@@ -31850,7 +31859,7 @@ const subscriptions = new SubscriptionList();
31850
31859
  let diagramStorageSubscription;
31851
31860
  const diagramService = service(DiagramService);
31852
31861
  const diagramStorageService = service(DiagramStorageService);
31853
- const eventService = service(EventService);
31862
+ const eventService$1 = service(EventService);
31854
31863
  const errorService$1 = service(ErrorService);
31855
31864
  /**
31856
31865
  * Reports every failed data provider call, unless the call was aborted, and passes the failure on to the caller.
@@ -31947,7 +31956,7 @@ function subscribeToDiagramChange(model) {
31947
31956
  * @param model The diagram model whose edits are persisted
31948
31957
  */
31949
31958
  function onClearDiagramStorage(model) {
31950
- subscriptions.add(eventService.subscribeToClearDiagramStorage(() => {
31959
+ subscriptions.add(eventService$1.subscribeToClearDiagramStorage(() => {
31951
31960
  // re-subscribe, to avoid any pending debounced saves, which may write over the cleared diagram
31952
31961
  subscribeToDiagramChange(model);
31953
31962
  diagramStorageService.clear();
@@ -32068,10 +32077,11 @@ function unmountReactodia(root) {
32068
32077
  const graphwiseReactodiaCss = "graphwise-reactodia{--_graphwise-reactodia-type-color-01:var(--graphwise-reactodia-type-color-01);--_graphwise-reactodia-type-color-02:var(--graphwise-reactodia-type-color-02);--_graphwise-reactodia-type-color-03:var(--graphwise-reactodia-type-color-03);--_graphwise-reactodia-type-color-04:var(--graphwise-reactodia-type-color-04);--_graphwise-reactodia-type-color-05:var(--graphwise-reactodia-type-color-05);--_graphwise-reactodia-type-color-06:var(--graphwise-reactodia-type-color-06);--_graphwise-reactodia-type-color-07:var(--graphwise-reactodia-type-color-07);--_graphwise-reactodia-type-color-08:var(--graphwise-reactodia-type-color-08);--_graphwise-reactodia-type-color-09:var(--graphwise-reactodia-type-color-09);--_graphwise-reactodia-type-color-10:var(--graphwise-reactodia-type-color-10);--_graphwise-reactodia-type-color-11:var(--graphwise-reactodia-type-color-11);--_graphwise-reactodia-type-color-12:var(--graphwise-reactodia-type-color-12);--_graphwise-reactodia-type-color-13:var(--graphwise-reactodia-type-color-13);--_graphwise-reactodia-type-color-14:var(--graphwise-reactodia-type-color-14);--_graphwise-reactodia-type-color-15:var(--graphwise-reactodia-type-color-15);--_graphwise-reactodia-type-color-16:var(--graphwise-reactodia-type-color-16);--_graphwise-reactodia-type-color-17:var(--graphwise-reactodia-type-color-17);--_graphwise-reactodia-type-color-18:var(--graphwise-reactodia-type-color-18);--_graphwise-reactodia-type-color-19:var(--graphwise-reactodia-type-color-19);--_graphwise-reactodia-type-color-20:var(--graphwise-reactodia-type-color-20);--_graphwise-reactodia-type-color-contrast:var(--graphwise-reactodia-type-color-contrast, #fff)}graphwise-reactodia{display:block;width:100%;height:100%}graphwise-reactodia .reactodia-container{position:relative;width:100%;height:100%}graphwise-reactodia .reactodia-selection-action__link{display:none}graphwise-reactodia .reactodia-standard-element__thumbnail:not(:has(img)){background:var(--reactodia-element-style-color);border-radius:50%;color:var(--_graphwise-reactodia-type-color-contrast)}";
32069
32078
 
32070
32079
  const errorService = service(ErrorService);
32080
+ const eventService = service(EventService);
32071
32081
  const GraphwiseReactodia = class {
32072
32082
  constructor(hostRef) {
32073
32083
  registerInstance(this, hostRef);
32074
- this.errorEmitter = createEvent(this, "graphwiseReactodiaError");
32084
+ this.eventEmitter = createEvent(this, "graphwiseReactodiaEvent");
32075
32085
  this.subscriptions = new SubscriptionList();
32076
32086
  /**
32077
32087
  * UI language code (e.g. `en`, `fr`) for the Reactodia interface. Defaults to English.
@@ -32100,7 +32110,7 @@ const GraphwiseReactodia = class {
32100
32110
  this.renderGraph(true);
32101
32111
  }
32102
32112
  connectedCallback() {
32103
- this.subscribeToErrors();
32113
+ this.subscribeToEvents();
32104
32114
  this.renderGraph();
32105
32115
  }
32106
32116
  componentDidLoad() {
@@ -32115,10 +32125,10 @@ const GraphwiseReactodia = class {
32115
32125
  }
32116
32126
  }
32117
32127
  render() {
32118
- return (h(Host, { key: 'a96eea05561061bbed34b5134abc44f07402211f' }));
32128
+ return (h(Host, { key: '2e8541c791f478484c4bad64ad758df99aba2059' }));
32119
32129
  }
32120
- subscribeToErrors() {
32121
- this.subscriptions.add(errorService.subscribe((error) => this.errorEmitter.emit(error)));
32130
+ subscribeToEvents() {
32131
+ this.subscriptions.add(eventService.subscribe((detail) => this.eventEmitter.emit(detail)));
32122
32132
  }
32123
32133
  renderGraph(isReloading) {
32124
32134
  var _a;
package/dist/esm/index.js CHANGED
@@ -1,8 +1,8 @@
1
- export { C as CLEAR_DIAGRAM_STORAGE_EVENT, E as ErrorCode } from './error-code-7lGYbTwb.js';
1
+ export { C as CLEAR_DIAGRAM_STORAGE_EVENT, a as ErrorCode, E as EventType } from './error-code-DHI2bePh.js';
2
2
 
3
3
  /**
4
- * Name of the DOM event the `graphwise-reactodia` element dispatches for every reported error.
4
+ * Name of the DOM event the `graphwise-reactodia` element dispatches for every event.
5
5
  */
6
- const GRAPHWISE_REACTODIA_ERROR_EVENT = 'graphwiseReactodiaError';
6
+ const GRAPHWISE_REACTODIA_EVENT = 'graphwiseReactodiaEvent';
7
7
 
8
- export { GRAPHWISE_REACTODIA_ERROR_EVENT };
8
+ export { GRAPHWISE_REACTODIA_EVENT };
@@ -1 +1 @@
1
- import{p as e,b as r}from"./p-DpCR6zMg.js";export{s as setNonce}from"./p-DpCR6zMg.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-ec30185a",[[0,"graphwise-reactodia",{currentRepository:[1,"current-repository"],config:[16],language:[1],providerSettings:[16,"provider-settings"],theme:[1]},null,{currentRepository:["onCurrentRepositoryChange"],language:["onLanguageOrSettingsChange"],providerSettings:["onLanguageOrSettingsChange"],theme:["onThemeChange"]}]]]],e))));
1
+ import{p as e,b as r}from"./p-DpCR6zMg.js";export{s as setNonce}from"./p-DpCR6zMg.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-abfb5091",[[0,"graphwise-reactodia",{currentRepository:[1,"current-repository"],config:[16],language:[1],providerSettings:[16,"provider-settings"],theme:[1]},null,{currentRepository:["onCurrentRepositoryChange"],language:["onLanguageOrSettingsChange"],providerSettings:["onLanguageOrSettingsChange"],theme:["onThemeChange"]}]]]],e))));
@@ -1 +1 @@
1
- export{C as CLEAR_DIAGRAM_STORAGE_EVENT,E as ErrorCode}from"./p-7lGYbTwb.js";const r="graphwiseReactodiaError";export{r as GRAPHWISE_REACTODIA_ERROR_EVENT}
1
+ export{C as CLEAR_DIAGRAM_STORAGE_EVENT,a as ErrorCode,E as EventType}from"./p-DHI2bePh.js";const e="graphwiseReactodiaEvent";export{e as GRAPHWISE_REACTODIA_EVENT}
@@ -0,0 +1 @@
1
+ const a="graphwise-reactodia:clear-diagram-storage";var r,i;!function(a){a.ERROR="error"}(r||(r={})),function(a){a.MISSING_REQUIRED_PROP="missing-required-prop",a.DATA_FETCH="data-fetch",a.DIAGRAM_LOAD="diagram-load",a.DIAGRAM_IMPORT="diagram-import",a.LOCAL_DIAGRAM_READ="local-diagram-read",a.LOCAL_DIAGRAM_SAVE="local-diagram-save"}(i||(i={}));export{a as C,r as E,i as a}