graphwise-reactodia 0.0.1-TR18 → 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.
package/README.md CHANGED
@@ -73,9 +73,10 @@ only informs the host and it bubbles. Its name is exported as `GRAPHWISE_REACTOD
73
73
 
74
74
  `detail` is an `EventDetail`: `{type, payload}`. `type` is an `EventType`; `payload` depends on it:
75
75
 
76
- | `type` | `payload` |
77
- |---------|-----------------|
78
- | `error` | `ErrorReport` |
76
+ | `type` | `payload` | Dispatched when |
77
+ |---------------|---------------|-------------------------------------|
78
+ | `error` | `ErrorReport` | An error is reported. |
79
+ | `text-search` | none | The user searches entities by text. |
79
80
 
80
81
  Checking `type` narrows `payload`:
81
82
 
@@ -12,6 +12,7 @@ const CLEAR_DIAGRAM_STORAGE_EVENT = 'graphwise-reactodia:clear-diagram-storage';
12
12
  exports.EventType = void 0;
13
13
  (function (EventType) {
14
14
  EventType["ERROR"] = "error";
15
+ EventType["TEXT_SEARCH"] = "text-search";
15
16
  })(exports.EventType || (exports.EventType = {}));
16
17
 
17
18
  /**
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-DtzCybH4.js');
4
- var errorCode = require('./error-code-BdRU0RQ9.js');
4
+ var errorCode = require('./error-code-BjU_V9e8.js');
5
5
 
6
6
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
7
7
 
@@ -31863,6 +31863,14 @@ const diagramService = service(DiagramService);
31863
31863
  const diagramStorageService = service(DiagramStorageService);
31864
31864
  const eventService$1 = service(EventService);
31865
31865
  const errorService$1 = service(ErrorService);
31866
+ /**
31867
+ * Emits a {@link EventType.TEXT_SEARCH} event for each text lookup.
31868
+ */
31869
+ function emitTextSearch(method, params) {
31870
+ if (method === 'lookup' && params.text) {
31871
+ eventService$1.emit({ type: errorCode.EventType.TEXT_SEARCH });
31872
+ }
31873
+ }
31866
31874
  /**
31867
31875
  * Reports every failed data provider call, unless the call was aborted, and passes the failure on to the caller.
31868
31876
  */
@@ -31881,7 +31889,7 @@ const reportDataFetchError = async (_method, params, body) => {
31881
31889
  /**
31882
31890
  * Builds a Reactodia {@link SparqlDataProvider} for the given endpoint using the supplied
31883
31891
  * query preset. The host owns the query configuration and always passes it in via props.
31884
- * The provider is decorated, so its failed calls are reported.
31892
+ * The provider is decorated, so its failed calls are reported and its text lookups emit an event.
31885
31893
  */
31886
31894
  function createDataProvider(props) {
31887
31895
  const { currentRepository, config, providerSettings } = props;
@@ -31890,7 +31898,13 @@ function createDataProvider(props) {
31890
31898
  queryMethod: 'POST',
31891
31899
  queryFunction: config.queryFunction
31892
31900
  }, providerSettings);
31893
- return new DecoratedDataProvider({ baseProvider, decorator: reportDataFetchError });
31901
+ return new DecoratedDataProvider({
31902
+ baseProvider,
31903
+ decorator: (method, params, body) => {
31904
+ emitTextSearch(method, params);
31905
+ return reportDataFetchError(method, params, body);
31906
+ }
31907
+ });
31894
31908
  }
31895
31909
  /**
31896
31910
  * Places the seed entities on the canvas. Each IRI is added as a placeholder element, and data is then loaded for the
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var errorCode = require('./error-code-BdRU0RQ9.js');
3
+ var errorCode = require('./error-code-BjU_V9e8.js');
4
4
 
5
5
  /**
6
6
  * Name of the DOM event the `graphwise-reactodia` element dispatches for every event.
@@ -247,7 +247,7 @@ export class GraphwiseReactodia {
247
247
  },
248
248
  "complexType": {
249
249
  "original": "EventDetail",
250
- "resolved": "{ type: EventType; payload: ErrorReport; }",
250
+ "resolved": "{ type: EventType.ERROR; payload: ErrorReport; } | { type: EventType.TEXT_SEARCH; payload?: undefined; }",
251
251
  "references": {
252
252
  "EventDetail": {
253
253
  "location": "import",
@@ -4,4 +4,5 @@
4
4
  export var EventType;
5
5
  (function (EventType) {
6
6
  EventType["ERROR"] = "error";
7
+ EventType["TEXT_SEARCH"] = "text-search";
7
8
  })(EventType || (EventType = {}));
@@ -9,6 +9,7 @@ import { DiagramStorageService } from "./services/diagram-storage/diagram-storag
9
9
  import { EventService } from "./services/event/event.service";
10
10
  import { ErrorService } from "./services/error/error.service";
11
11
  import { ErrorCode } from "./models/error/error-code";
12
+ import { EventType } from "./models/event/event-type";
12
13
  import { SubscriptionList } from "./models/subscription-list";
13
14
  import { resolveTypeStyle } from "./styles/type-style.resolver";
14
15
  import { GraphwiseMenu } from "./menu/graphwise-menu";
@@ -40,6 +41,14 @@ const diagramService = service(DiagramService);
40
41
  const diagramStorageService = service(DiagramStorageService);
41
42
  const eventService = service(EventService);
42
43
  const errorService = service(ErrorService);
44
+ /**
45
+ * Emits a {@link EventType.TEXT_SEARCH} event for each text lookup.
46
+ */
47
+ function emitTextSearch(method, params) {
48
+ if (method === 'lookup' && params.text) {
49
+ eventService.emit({ type: EventType.TEXT_SEARCH });
50
+ }
51
+ }
43
52
  /**
44
53
  * Reports every failed data provider call, unless the call was aborted, and passes the failure on to the caller.
45
54
  */
@@ -58,7 +67,7 @@ const reportDataFetchError = async (_method, params, body) => {
58
67
  /**
59
68
  * Builds a Reactodia {@link SparqlDataProvider} for the given endpoint using the supplied
60
69
  * query preset. The host owns the query configuration and always passes it in via props.
61
- * The provider is decorated, so its failed calls are reported.
70
+ * The provider is decorated, so its failed calls are reported and its text lookups emit an event.
62
71
  */
63
72
  function createDataProvider(props) {
64
73
  const { currentRepository, config, providerSettings } = props;
@@ -67,7 +76,13 @@ function createDataProvider(props) {
67
76
  queryMethod: 'POST',
68
77
  queryFunction: config.queryFunction
69
78
  }, providerSettings);
70
- return new DecoratedDataProvider({ baseProvider, decorator: reportDataFetchError });
79
+ return new DecoratedDataProvider({
80
+ baseProvider,
81
+ decorator: (method, params, body) => {
82
+ emitTextSearch(method, params);
83
+ return reportDataFetchError(method, params, body);
84
+ }
85
+ });
71
86
  }
72
87
  /**
73
88
  * Places the seed entities on the canvas. Each IRI is added as a placeholder element, and data is then loaded for the
@@ -50,6 +50,14 @@ document.addEventListener('graphwiseReactodiaEvent', (event) => {
50
50
  reportedErrors.push({code, message: error.message});
51
51
  });
52
52
 
53
+ // The text search events are counted.
54
+ window.textSearches = 0;
55
+ document.addEventListener('graphwiseReactodiaEvent', (event) => {
56
+ if (event.detail.type === 'text-search') {
57
+ window.textSearches++;
58
+ }
59
+ });
60
+
53
61
  const SEED_NODES = ['http://example.com/alice', 'http://example.com/bob'];
54
62
 
55
63
  const SEED_GRAPH = [
@@ -10,6 +10,7 @@ const CLEAR_DIAGRAM_STORAGE_EVENT = 'graphwise-reactodia:clear-diagram-storage';
10
10
  var EventType;
11
11
  (function (EventType) {
12
12
  EventType["ERROR"] = "error";
13
+ EventType["TEXT_SEARCH"] = "text-search";
13
14
  })(EventType || (EventType = {}));
14
15
 
15
16
  /**
@@ -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 { C as CLEAR_DIAGRAM_STORAGE_EVENT, E as EventType, a as ErrorCode } from './error-code-DHI2bePh.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
 
@@ -31861,6 +31861,14 @@ const diagramService = service(DiagramService);
31861
31861
  const diagramStorageService = service(DiagramStorageService);
31862
31862
  const eventService$1 = service(EventService);
31863
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
+ }
31864
31872
  /**
31865
31873
  * Reports every failed data provider call, unless the call was aborted, and passes the failure on to the caller.
31866
31874
  */
@@ -31879,7 +31887,7 @@ const reportDataFetchError = async (_method, params, body) => {
31879
31887
  /**
31880
31888
  * Builds a Reactodia {@link SparqlDataProvider} for the given endpoint using the supplied
31881
31889
  * query preset. The host owns the query configuration and always passes it in via props.
31882
- * 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.
31883
31891
  */
31884
31892
  function createDataProvider(props) {
31885
31893
  const { currentRepository, config, providerSettings } = props;
@@ -31888,7 +31896,13 @@ function createDataProvider(props) {
31888
31896
  queryMethod: 'POST',
31889
31897
  queryFunction: config.queryFunction
31890
31898
  }, providerSettings);
31891
- 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
+ });
31892
31906
  }
31893
31907
  /**
31894
31908
  * Places the seed entities on the canvas. Each IRI is added as a placeholder element, and data is then loaded for the
package/dist/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { C as CLEAR_DIAGRAM_STORAGE_EVENT, a as ErrorCode, E as EventType } from './error-code-DHI2bePh.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
4
  * Name of the DOM event the `graphwise-reactodia` element dispatches for every 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-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
+ 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,a as ErrorCode,E as EventType}from"./p-DHI2bePh.js";const e="graphwiseReactodiaEvent";export{e as GRAPHWISE_REACTODIA_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}