graphwise-reactodia 0.0.1-TR17 → 0.0.1-TR19

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 (34) hide show
  1. package/README.md +31 -8
  2. package/dist/cjs/{error-code-NpXlqCEN.js → error-code-BjU_V9e8.js} +9 -0
  3. package/dist/cjs/graphwise-reactodia.cjs.entry.js +80 -56
  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 +8 -0
  9. package/dist/collection/components/graphwise-reactodia/reactodia-app.js +17 -2
  10. package/dist/collection/components/graphwise-reactodia/services/error/error.service.js +5 -16
  11. package/dist/collection/components/graphwise-reactodia/services/event/event.service.js +23 -0
  12. package/dist/collection/index.js +2 -1
  13. package/dist/collection/pages/graphwise-reactodia/main.js +14 -2
  14. package/dist/esm/{error-code-7lGYbTwb.js → error-code-HfC639tc.js} +10 -1
  15. package/dist/esm/graphwise-reactodia.entry.js +80 -56
  16. package/dist/esm/index.js +4 -4
  17. package/dist/graphwise-reactodia/graphwise-reactodia.esm.js +1 -1
  18. package/dist/graphwise-reactodia/index.esm.js +1 -1
  19. package/dist/graphwise-reactodia/p-HfC639tc.js +1 -0
  20. package/dist/graphwise-reactodia/p-bf7f09d2.entry.js +1 -0
  21. package/dist/types/components/graphwise-reactodia/graphwise-reactodia.d.ts +4 -4
  22. package/dist/types/components/graphwise-reactodia/models/error/error-report.d.ts +0 -4
  23. package/dist/types/components/graphwise-reactodia/models/event/event-callback.d.ts +5 -0
  24. package/dist/types/components/graphwise-reactodia/models/event/event-detail.d.ts +55 -0
  25. package/dist/types/components/graphwise-reactodia/models/event/event-type.d.ts +7 -0
  26. package/dist/types/components/graphwise-reactodia/services/error/error.service.d.ts +1 -10
  27. package/dist/types/components/graphwise-reactodia/services/event/event.service.d.ts +16 -0
  28. package/dist/types/components.d.ts +5 -5
  29. package/dist/types/index.d.ts +3 -1
  30. package/package.json +1 -1
  31. package/dist/graphwise-reactodia/p-7lGYbTwb.js +0 -1
  32. package/dist/graphwise-reactodia/p-ec30185a.entry.js +0 -1
  33. package/dist/types/components/graphwise-reactodia/models/error/error-callback.d.ts +0 -5
  34. /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-HfC639tc.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,8 +31859,16 @@ 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);
31864
+ /**
31865
+ * Emits a {@link EventType.TEXT_SEARCH} event for each text lookup.
31866
+ */
31867
+ function emitTextSearch(method, params) {
31868
+ if (method === 'lookup' && params.text) {
31869
+ eventService$1.emit({ type: EventType.TEXT_SEARCH });
31870
+ }
31871
+ }
31855
31872
  /**
31856
31873
  * Reports every failed data provider call, unless the call was aborted, and passes the failure on to the caller.
31857
31874
  */
@@ -31870,7 +31887,7 @@ const reportDataFetchError = async (_method, params, body) => {
31870
31887
  /**
31871
31888
  * Builds a Reactodia {@link SparqlDataProvider} for the given endpoint using the supplied
31872
31889
  * query preset. The host owns the query configuration and always passes it in via props.
31873
- * The provider is decorated, so its failed calls are reported.
31890
+ * The provider is decorated, so its failed calls are reported and its text lookups emit an event.
31874
31891
  */
31875
31892
  function createDataProvider(props) {
31876
31893
  const { currentRepository, config, providerSettings } = props;
@@ -31879,7 +31896,13 @@ function createDataProvider(props) {
31879
31896
  queryMethod: 'POST',
31880
31897
  queryFunction: config.queryFunction
31881
31898
  }, providerSettings);
31882
- return new DecoratedDataProvider({ baseProvider, decorator: reportDataFetchError });
31899
+ return new DecoratedDataProvider({
31900
+ baseProvider,
31901
+ decorator: (method, params, body) => {
31902
+ emitTextSearch(method, params);
31903
+ return reportDataFetchError(method, params, body);
31904
+ }
31905
+ });
31883
31906
  }
31884
31907
  /**
31885
31908
  * Places the seed entities on the canvas. Each IRI is added as a placeholder element, and data is then loaded for the
@@ -31947,7 +31970,7 @@ function subscribeToDiagramChange(model) {
31947
31970
  * @param model The diagram model whose edits are persisted
31948
31971
  */
31949
31972
  function onClearDiagramStorage(model) {
31950
- subscriptions.add(eventService.subscribeToClearDiagramStorage(() => {
31973
+ subscriptions.add(eventService$1.subscribeToClearDiagramStorage(() => {
31951
31974
  // re-subscribe, to avoid any pending debounced saves, which may write over the cleared diagram
31952
31975
  subscribeToDiagramChange(model);
31953
31976
  diagramStorageService.clear();
@@ -32068,10 +32091,11 @@ function unmountReactodia(root) {
32068
32091
  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
32092
 
32070
32093
  const errorService = service(ErrorService);
32094
+ const eventService = service(EventService);
32071
32095
  const GraphwiseReactodia = class {
32072
32096
  constructor(hostRef) {
32073
32097
  registerInstance(this, hostRef);
32074
- this.errorEmitter = createEvent(this, "graphwiseReactodiaError");
32098
+ this.eventEmitter = createEvent(this, "graphwiseReactodiaEvent");
32075
32099
  this.subscriptions = new SubscriptionList();
32076
32100
  /**
32077
32101
  * UI language code (e.g. `en`, `fr`) for the Reactodia interface. Defaults to English.
@@ -32100,7 +32124,7 @@ const GraphwiseReactodia = class {
32100
32124
  this.renderGraph(true);
32101
32125
  }
32102
32126
  connectedCallback() {
32103
- this.subscribeToErrors();
32127
+ this.subscribeToEvents();
32104
32128
  this.renderGraph();
32105
32129
  }
32106
32130
  componentDidLoad() {
@@ -32115,10 +32139,10 @@ const GraphwiseReactodia = class {
32115
32139
  }
32116
32140
  }
32117
32141
  render() {
32118
- return (h(Host, { key: 'a96eea05561061bbed34b5134abc44f07402211f' }));
32142
+ return (h(Host, { key: '2e8541c791f478484c4bad64ad758df99aba2059' }));
32119
32143
  }
32120
- subscribeToErrors() {
32121
- this.subscriptions.add(errorService.subscribe((error) => this.errorEmitter.emit(error)));
32144
+ subscribeToEvents() {
32145
+ this.subscriptions.add(eventService.subscribe((detail) => this.eventEmitter.emit(detail)));
32122
32146
  }
32123
32147
  renderGraph(isReloading) {
32124
32148
  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-HfC639tc.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-bf7f09d2",[[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-HfC639tc.js";const e="graphwiseReactodiaEvent";export{e as GRAPHWISE_REACTODIA_EVENT}
@@ -0,0 +1 @@
1
+ const a="graphwise-reactodia:clear-diagram-storage";var r,e;!function(a){a.ERROR="error",a.TEXT_SEARCH="text-search"}(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"}(e||(e={}));export{a as C,r as E,e as a}