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.
- package/README.md +30 -8
- package/dist/cjs/{error-code-NpXlqCEN.js → error-code-BdRU0RQ9.js} +8 -0
- package/dist/cjs/graphwise-reactodia.cjs.entry.js +64 -54
- package/dist/cjs/index.cjs.js +8 -4
- package/dist/collection/components/graphwise-reactodia/graphwise-reactodia.js +14 -12
- package/dist/collection/components/graphwise-reactodia/models/error/error-report.js +1 -4
- package/dist/collection/components/graphwise-reactodia/models/event/event-detail.js +4 -0
- package/dist/collection/components/graphwise-reactodia/models/event/event-type.js +7 -0
- package/dist/collection/components/graphwise-reactodia/services/error/error.service.js +5 -16
- package/dist/collection/components/graphwise-reactodia/services/event/event.service.js +23 -0
- package/dist/collection/index.js +2 -1
- package/dist/collection/pages/graphwise-reactodia/main.js +6 -2
- package/dist/esm/{error-code-7lGYbTwb.js → error-code-DHI2bePh.js} +9 -1
- package/dist/esm/graphwise-reactodia.entry.js +64 -54
- package/dist/esm/index.js +4 -4
- package/dist/graphwise-reactodia/graphwise-reactodia.esm.js +1 -1
- package/dist/graphwise-reactodia/index.esm.js +1 -1
- package/dist/graphwise-reactodia/p-DHI2bePh.js +1 -0
- package/dist/graphwise-reactodia/p-abfb5091.entry.js +1 -0
- package/dist/types/components/graphwise-reactodia/graphwise-reactodia.d.ts +4 -4
- package/dist/types/components/graphwise-reactodia/models/error/error-report.d.ts +0 -4
- package/dist/types/components/graphwise-reactodia/models/event/event-callback.d.ts +5 -0
- package/dist/types/components/graphwise-reactodia/models/event/event-detail.d.ts +48 -0
- package/dist/types/components/graphwise-reactodia/models/event/event-type.d.ts +6 -0
- package/dist/types/components/graphwise-reactodia/services/error/error.service.d.ts +1 -10
- package/dist/types/components/graphwise-reactodia/services/event/event.service.d.ts +16 -0
- package/dist/types/components.d.ts +5 -5
- package/dist/types/index.d.ts +3 -1
- package/package.json +1 -1
- package/dist/graphwise-reactodia/p-7lGYbTwb.js +0 -1
- package/dist/graphwise-reactodia/p-ec30185a.entry.js +0 -1
- package/dist/types/components/graphwise-reactodia/models/error/error-callback.d.ts +0 -5
- /package/dist/collection/components/graphwise-reactodia/models/{error/error-callback.js → event/event-callback.js} +0 -0
|
@@ -2,7 +2,7 @@ import { EventEmitter } from '../../stencil-public-runtime';
|
|
|
2
2
|
import { SparqlDataProviderSettings } from '@reactodia/workspace';
|
|
3
3
|
import { LanguageKey } from './i18n/language-key';
|
|
4
4
|
import { ReactodiaConfig } from './models/reactodia-config';
|
|
5
|
-
import {
|
|
5
|
+
import { EventDetail } from './models/event/event-detail';
|
|
6
6
|
/**
|
|
7
7
|
* A web component that renders a graph with the Reactodia workspace.
|
|
8
8
|
*
|
|
@@ -47,9 +47,9 @@ export declare class GraphwiseReactodia {
|
|
|
47
47
|
*/
|
|
48
48
|
theme?: 'light' | 'dark';
|
|
49
49
|
/**
|
|
50
|
-
* Fires
|
|
50
|
+
* Fires for every event to the host, differentiated by `detail.type`.
|
|
51
51
|
*/
|
|
52
|
-
|
|
52
|
+
eventEmitter: EventEmitter<EventDetail>;
|
|
53
53
|
private reactRoot?;
|
|
54
54
|
/**
|
|
55
55
|
* `connectedCallback` and the watchers can run before all props are set: when the component's
|
|
@@ -66,7 +66,7 @@ export declare class GraphwiseReactodia {
|
|
|
66
66
|
componentDidLoad(): void;
|
|
67
67
|
disconnectedCallback(): void;
|
|
68
68
|
render(): any;
|
|
69
|
-
private
|
|
69
|
+
private subscribeToEvents;
|
|
70
70
|
private renderGraph;
|
|
71
71
|
private reportMissingPropError;
|
|
72
72
|
}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import { ErrorCode } from './error-code';
|
|
2
|
-
/**
|
|
3
|
-
* Name of the DOM event the `graphwise-reactodia` element dispatches for every reported error.
|
|
4
|
-
*/
|
|
5
|
-
export declare const GRAPHWISE_REACTODIA_ERROR_EVENT = "graphwiseReactodiaError";
|
|
6
2
|
/**
|
|
7
3
|
* A failure the wrapper announces to the host.
|
|
8
4
|
*/
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { EventType } from './event-type';
|
|
2
|
+
import { ErrorReport } from '../error/error-report';
|
|
3
|
+
/**
|
|
4
|
+
* Name of the DOM event the `graphwise-reactodia` element dispatches for every event.
|
|
5
|
+
*/
|
|
6
|
+
export declare const GRAPHWISE_REACTODIA_EVENT = "graphwiseReactodiaEvent";
|
|
7
|
+
/**
|
|
8
|
+
* The payload of each {@link EventType}. It is the single place that ties an event type to its payload, so
|
|
9
|
+
* adding an event is one {@link EventType} value and one entry here.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* interface EventPayloadMap {
|
|
14
|
+
* [EventType.ERROR]: ErrorReport;
|
|
15
|
+
* // A new event:
|
|
16
|
+
* [EventType.NEW_TYPE]: NewTypePayload;
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
interface EventPayloadMap {
|
|
21
|
+
[EventType.ERROR]: ErrorReport;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Maps an {@link EventType} to its event detail: `{type, payload}`, with the payload from
|
|
25
|
+
* {@link EventPayloadMap}. If no event type is provided, it is the union of the details of all event types.
|
|
26
|
+
*
|
|
27
|
+
* @template T The event type to map.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* // Any event, narrowed by its type.
|
|
32
|
+
* function onEvent(detail: EventDetail): void {
|
|
33
|
+
* if (detail.type === EventType.ERROR) {
|
|
34
|
+
* const {code, error} = detail.payload; // an ErrorReport
|
|
35
|
+
* }
|
|
36
|
+
* }
|
|
37
|
+
*
|
|
38
|
+
* // One event.
|
|
39
|
+
* const detail: EventDetail<EventType.ERROR> = {type: EventType.ERROR, payload: {code, error}};
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export type EventDetail<T extends EventType = EventType> = {
|
|
43
|
+
[K in T]: {
|
|
44
|
+
type: K;
|
|
45
|
+
payload: EventPayloadMap[K];
|
|
46
|
+
};
|
|
47
|
+
}[T];
|
|
48
|
+
export {};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { Subscription } from '../../models/subscription';
|
|
2
|
-
import { ErrorCallback } from '../../models/error/error-callback';
|
|
3
1
|
import { ErrorCode } from '../../models/error/error-code';
|
|
4
2
|
/**
|
|
5
3
|
* Service that collects the failures of the wrapper and the fork, so they can be announced to the host.
|
|
@@ -7,7 +5,7 @@ import { ErrorCode } from '../../models/error/error-code';
|
|
|
7
5
|
export declare class ErrorService {
|
|
8
6
|
static readonly ID = "ErrorService";
|
|
9
7
|
private static readonly ABORT_ERROR_NAME;
|
|
10
|
-
private
|
|
8
|
+
private readonly eventService;
|
|
11
9
|
private readonly reported;
|
|
12
10
|
/**
|
|
13
11
|
* Reports a failure to the host, unless it's an abort, or this exact error object is already reported
|
|
@@ -32,13 +30,6 @@ export declare class ErrorService {
|
|
|
32
30
|
* @param thrown The thrown value.
|
|
33
31
|
*/
|
|
34
32
|
report(code: ErrorCode, thrown: unknown): void;
|
|
35
|
-
/**
|
|
36
|
-
* Subscribes to the reported errors, replacing the previous subscriber.
|
|
37
|
-
*
|
|
38
|
-
* @param callback Called with every reported error.
|
|
39
|
-
* @returns A {@link Subscription} that, when called, removes the callback, unless it has already been replaced.
|
|
40
|
-
*/
|
|
41
|
-
subscribe(callback: ErrorCallback): Subscription;
|
|
42
33
|
/**
|
|
43
34
|
* Whether any link of the given cause chain is an abort or is already reported.
|
|
44
35
|
*/
|
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
import { Subscription } from '../../models/subscription';
|
|
2
|
+
import { EventCallback } from '../../models/event/event-callback';
|
|
3
|
+
import { EventDetail } from '../../models/event/event-detail';
|
|
2
4
|
/**
|
|
3
5
|
* Service for event based operations
|
|
4
6
|
*/
|
|
5
7
|
export declare class EventService {
|
|
6
8
|
static readonly ID = "EventService";
|
|
9
|
+
private callback?;
|
|
10
|
+
/**
|
|
11
|
+
* Announces an event to the host.
|
|
12
|
+
*
|
|
13
|
+
* @param detail The event detail.
|
|
14
|
+
*/
|
|
15
|
+
emit(detail: EventDetail): void;
|
|
16
|
+
/**
|
|
17
|
+
* Subscribes to the emitted events, replacing the previous subscriber.
|
|
18
|
+
*
|
|
19
|
+
* @param callback Called with every emitted event.
|
|
20
|
+
* @returns A {@link Subscription} that, when called, removes the callback, unless it has already been replaced.
|
|
21
|
+
*/
|
|
22
|
+
subscribe(callback: EventCallback): Subscription;
|
|
7
23
|
/**
|
|
8
24
|
* Subscribes to the host's "clear persisted diagram" command.
|
|
9
25
|
*
|
|
@@ -8,11 +8,11 @@ import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
|
|
|
8
8
|
import { ReactodiaConfig } from "./components/graphwise-reactodia/models/reactodia-config";
|
|
9
9
|
import { LanguageKey } from "./components/graphwise-reactodia/i18n/language-key";
|
|
10
10
|
import { SparqlDataProviderSettings } from "@reactodia/workspace";
|
|
11
|
-
import {
|
|
11
|
+
import { EventDetail } from "./components/graphwise-reactodia/models/event/event-detail";
|
|
12
12
|
export { ReactodiaConfig } from "./components/graphwise-reactodia/models/reactodia-config";
|
|
13
13
|
export { LanguageKey } from "./components/graphwise-reactodia/i18n/language-key";
|
|
14
14
|
export { SparqlDataProviderSettings } from "@reactodia/workspace";
|
|
15
|
-
export {
|
|
15
|
+
export { EventDetail } from "./components/graphwise-reactodia/models/event/event-detail";
|
|
16
16
|
export namespace Components {
|
|
17
17
|
/**
|
|
18
18
|
* A web component that renders a graph with the Reactodia workspace.
|
|
@@ -53,7 +53,7 @@ export interface GraphwiseReactodiaCustomEvent<T> extends CustomEvent<T> {
|
|
|
53
53
|
}
|
|
54
54
|
declare global {
|
|
55
55
|
interface HTMLGraphwiseReactodiaElementEventMap {
|
|
56
|
-
"
|
|
56
|
+
"graphwiseReactodiaEvent": EventDetail;
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
59
|
* A web component that renders a graph with the Reactodia workspace.
|
|
@@ -107,9 +107,9 @@ declare namespace LocalJSX {
|
|
|
107
107
|
*/
|
|
108
108
|
"language"?: LanguageKey;
|
|
109
109
|
/**
|
|
110
|
-
* Fires
|
|
110
|
+
* Fires for every event to the host, differentiated by `detail.type`.
|
|
111
111
|
*/
|
|
112
|
-
"
|
|
112
|
+
"onGraphwiseReactodiaEvent"?: (event: GraphwiseReactodiaCustomEvent<EventDetail>) => void;
|
|
113
113
|
/**
|
|
114
114
|
* Query preset for the SPARQL data provider, owned and configured by the host. A DOM property (an object, not an attribute) passed in from outside the wrapper. Required: the wrapper has no default preset and throws when it is missing. Changing it rebuilds the data provider and reloads the graph with it, keeping the current diagram.
|
|
115
115
|
*/
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { CLEAR_DIAGRAM_STORAGE_EVENT } from './components/graphwise-reactodia/models/clear-diagram-storage-event';
|
|
2
|
-
export {
|
|
2
|
+
export { GRAPHWISE_REACTODIA_EVENT } from './components/graphwise-reactodia/models/event/event-detail';
|
|
3
|
+
export { EventType } from './components/graphwise-reactodia/models/event/event-type';
|
|
4
|
+
export type { EventDetail } from './components/graphwise-reactodia/models/event/event-detail';
|
|
3
5
|
export { ErrorCode } from './components/graphwise-reactodia/models/error/error-code';
|
|
4
6
|
export type { ErrorReport } from './components/graphwise-reactodia/models/error/error-report';
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const a="graphwise-reactodia:clear-diagram-storage";var 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"}(r||(r={}));export{a as C,r as E}
|