graphwise-reactodia 0.0.1-TR7 → 0.0.1-TR8
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 +32 -0
- package/dist/cjs/graphwise-reactodia.cjs.entry.js +256 -41
- package/dist/cjs/index.cjs.js +7 -0
- package/dist/collection/components/graphwise-reactodia/graphwise-reactodia.js +10 -10
- package/dist/collection/components/graphwise-reactodia/models/clear-diagram-storage-event.js +5 -0
- package/dist/collection/components/graphwise-reactodia/models/subscription-list.js +35 -0
- package/dist/collection/components/graphwise-reactodia/models/triple.js +1 -0
- package/dist/collection/components/graphwise-reactodia/providers/service/service-inject.js +15 -0
- package/dist/collection/components/graphwise-reactodia/providers/service/service.js +1 -0
- package/dist/collection/components/graphwise-reactodia/providers/service/service.provider.js +20 -0
- package/dist/collection/components/graphwise-reactodia/reactodia-app.js +61 -28
- package/dist/collection/components/graphwise-reactodia/services/diagram/diagram.service.js +39 -0
- package/dist/collection/components/graphwise-reactodia/services/diagram-storage/diagram-storage.service.js +42 -0
- package/dist/collection/components/graphwise-reactodia/services/event/event.service.js +22 -0
- package/dist/collection/components/graphwise-reactodia/services/window/window.service.js +8 -0
- package/dist/collection/components/graphwise-reactodia/testing/storage.mock.js +35 -0
- package/dist/collection/index.js +1 -1
- package/dist/collection/pages/graphwise-reactodia/main.js +17 -7
- package/dist/esm/graphwise-reactodia.entry.js +253 -38
- package/dist/esm/index.js +6 -0
- package/dist/graphwise-reactodia/graphwise-reactodia.esm.js +1 -1
- package/dist/graphwise-reactodia/index.esm.js +1 -0
- package/dist/graphwise-reactodia/p-80cb6eef.entry.js +1 -0
- package/dist/types/components/graphwise-reactodia/i18n/translations.d.ts +2 -6
- package/dist/types/components/graphwise-reactodia/models/clear-diagram-storage-event.d.ts +5 -0
- package/dist/types/components/graphwise-reactodia/models/reactodia-app-props.d.ts +6 -7
- package/dist/types/components/graphwise-reactodia/models/reactodia-config.d.ts +8 -6
- package/dist/types/components/graphwise-reactodia/models/subscription-list.d.ts +26 -0
- package/dist/types/components/graphwise-reactodia/models/subscription.d.ts +4 -0
- package/dist/types/components/graphwise-reactodia/models/{reactodia-seed-link.d.ts → triple.d.ts} +2 -6
- package/dist/types/components/graphwise-reactodia/providers/service/service-inject.d.ts +13 -0
- package/dist/types/components/graphwise-reactodia/providers/service/service.d.ts +6 -0
- package/dist/types/components/graphwise-reactodia/providers/service/service.provider.d.ts +18 -0
- package/dist/types/components/graphwise-reactodia/services/diagram/diagram.service.d.ts +28 -0
- package/dist/types/components/graphwise-reactodia/services/diagram-storage/diagram-storage.service.d.ts +26 -0
- package/dist/types/components/graphwise-reactodia/services/event/event.service.d.ts +14 -0
- package/dist/types/components/graphwise-reactodia/services/window/window.service.d.ts +7 -0
- package/dist/types/components/graphwise-reactodia/testing/storage.mock.d.ts +18 -0
- package/dist/types/index.d.ts +1 -1
- package/package.json +9 -3
- package/dist/graphwise-reactodia/p-eb362faa.entry.js +0 -1
- /package/dist/collection/components/graphwise-reactodia/models/{reactodia-seed-link.js → subscription.js} +0 -0
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
[language: string]: Record<string, TranslationBundle | string | null>;
|
|
4
|
-
};
|
|
5
|
-
export declare const TRANSLATIONS: Partial<Record<LanguageKey, TranslationBundle>>;
|
|
6
|
-
export {};
|
|
1
|
+
export type TranslationBundle = Record<string, Record<string, string | null> | string>;
|
|
2
|
+
export declare const TRANSLATIONS: Partial<Record<string, TranslationBundle>>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event name for clearing the local store state of the diagram. There is an event listener listening for it, which
|
|
3
|
+
* will clear the local store state, whenever this event is fired.
|
|
4
|
+
*/
|
|
5
|
+
export declare const CLEAR_DIAGRAM_STORAGE_EVENT = "graphwise-reactodia:clear-diagram-storage";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SparqlDataProviderSettings } from '@reactodia/workspace';
|
|
2
2
|
import { LanguageKey } from '../i18n/language-key';
|
|
3
3
|
import { ReactodiaConfig } from './reactodia-config';
|
|
4
4
|
/**
|
|
@@ -22,15 +22,14 @@ export interface ReactodiaAppProps {
|
|
|
22
22
|
* and is also used as the initial graph-data language.
|
|
23
23
|
*/
|
|
24
24
|
language: LanguageKey;
|
|
25
|
-
/**
|
|
26
|
-
* A previously exported diagram to restore on mount. Used to carry the user's current
|
|
27
|
-
* canvas across a remount (e.g. forced by a language change). When omitted, the canvas
|
|
28
|
-
* starts empty.
|
|
29
|
-
*/
|
|
30
|
-
initialDiagram?: SerializedDiagram;
|
|
31
25
|
/**
|
|
32
26
|
* Query preset for the SPARQL data provider, owned and configured by the host. Falls back
|
|
33
27
|
* to Reactodia's generic `OwlRdfsSettings` OWL/RDFS preset when omitted.
|
|
34
28
|
*/
|
|
35
29
|
providerSettings?: SparqlDataProviderSettings;
|
|
30
|
+
/**
|
|
31
|
+
* When true, the host is remounting the component switch languages, so the workspace should not be seeded, if a seed is present.
|
|
32
|
+
* Rather, the current state should simply be reloaded.
|
|
33
|
+
*/
|
|
34
|
+
isReload?: boolean;
|
|
36
35
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SparqlQueryFunction } from '@reactodia/workspace';
|
|
2
|
-
import {
|
|
2
|
+
import { Triple } from './triple';
|
|
3
3
|
/**
|
|
4
4
|
* Host-supplied configuration read once when the workspace mounts (not reactive).
|
|
5
5
|
*
|
|
@@ -14,16 +14,18 @@ export interface ReactodiaConfig {
|
|
|
14
14
|
*/
|
|
15
15
|
queryFunction: SparqlQueryFunction;
|
|
16
16
|
/**
|
|
17
|
-
* IRIs of the
|
|
17
|
+
* IRIs of the elements(nodes) to place on the canvas on startup. When provided, each IRI is added
|
|
18
18
|
* as an element and its data (labels, types, properties) and links are resolved from the
|
|
19
19
|
* SPARQL provider, then the workspace lays them out. Note that when using this seed method reactodia will request data
|
|
20
|
-
* from the connected sparql endpoint, so if the resources are not in the DB, then this approach will not work.
|
|
20
|
+
* from the connected sparql endpoint for both elements and links, so if the resources are not in the DB, then this approach will not work.
|
|
21
21
|
* (e.g. in the case of a construct query)
|
|
22
22
|
*/
|
|
23
23
|
seedIris?: string[];
|
|
24
24
|
/**
|
|
25
|
-
* Pre-resolved
|
|
26
|
-
* request data
|
|
25
|
+
* Pre-resolved triples (source, rawPredicate, target) to place on the canvas on startup. Date for the links is provided
|
|
26
|
+
* here, so reactodia will not request data for them. Data for nodes will be requested based on the IRIs of the source
|
|
27
|
+
* and target of the links. This is useful for visualizing the result of a CONSTRUCT query, whose relationships are
|
|
28
|
+
* computed and not persisted in the repository
|
|
27
29
|
*/
|
|
28
|
-
seedGraph?:
|
|
30
|
+
seedGraph?: Triple[];
|
|
29
31
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Subscription } from './subscription';
|
|
2
|
+
/**
|
|
3
|
+
* A collection of {@link Subscription}s that can be released together. Components collect the
|
|
4
|
+
* subscriptions they open and call {@link unsubscribeAll} on teardown so nothing is left
|
|
5
|
+
* listening.
|
|
6
|
+
*/
|
|
7
|
+
export declare class SubscriptionList {
|
|
8
|
+
private items;
|
|
9
|
+
constructor(subscriptions?: Subscription[]);
|
|
10
|
+
/**
|
|
11
|
+
* Adds a subscription to the list.
|
|
12
|
+
*/
|
|
13
|
+
add(subscription: Subscription): void;
|
|
14
|
+
/**
|
|
15
|
+
* Adds multiple subscriptions to the list.
|
|
16
|
+
*/
|
|
17
|
+
addAll(subscriptions: Subscription[]): void;
|
|
18
|
+
/**
|
|
19
|
+
* Removes a subscription from the list without unsubscribing it.
|
|
20
|
+
*/
|
|
21
|
+
remove(subscription: Subscription): void;
|
|
22
|
+
/**
|
|
23
|
+
* Calls every subscription (unsubscribing it) and clears the list.
|
|
24
|
+
*/
|
|
25
|
+
unsubscribeAll(): void;
|
|
26
|
+
}
|
package/dist/types/components/graphwise-reactodia/models/{reactodia-seed-link.d.ts → triple.d.ts}
RENAMED
|
@@ -5,17 +5,13 @@
|
|
|
5
5
|
* fetched lazily through the SPARQL provider and must be supplied directly.
|
|
6
6
|
*
|
|
7
7
|
* The host adapts its source data into this neutral shape (e.g. the workbench maps the
|
|
8
|
-
* `rest/explore-graph/graph` response
|
|
8
|
+
* `rest/explore-graph/graph` response onto {@link rawPredicates}).
|
|
9
9
|
*/
|
|
10
|
-
export interface
|
|
10
|
+
export interface Triple {
|
|
11
11
|
/** Source element IRI. */
|
|
12
12
|
source: string;
|
|
13
13
|
/** Target element IRI. */
|
|
14
14
|
target: string;
|
|
15
|
-
/**
|
|
16
|
-
* Short display friendly predicate
|
|
17
|
-
*/
|
|
18
|
-
predicates: string[];
|
|
19
15
|
/**
|
|
20
16
|
* Full (absolute) predicate IRIs.
|
|
21
17
|
*/
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Service } from './service';
|
|
2
|
+
/**
|
|
3
|
+
* Injects the singleton instance of the given service class from the {@link ServiceProvider}.
|
|
4
|
+
*
|
|
5
|
+
* @param serviceClass The class of the service to inject.
|
|
6
|
+
* @returns The shared instance of the specified service class.
|
|
7
|
+
* @template T The type of the service to inject.
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const diagramStateService = service(DiagramStateService);
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export declare function service<T extends Service>(serviceClass: new (...args: never[]) => T): T;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Service } from './service';
|
|
2
|
+
/**
|
|
3
|
+
* Provider for all {@link Service} instances. Services are singletons: there is only one
|
|
4
|
+
* instance of each service, created on demand and cached here so every consumer shares it.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ServiceProvider {
|
|
7
|
+
private static readonly SERVICE_INSTANCES;
|
|
8
|
+
/**
|
|
9
|
+
* Returns the instance of the given service type, creating and caching it on first request.
|
|
10
|
+
*
|
|
11
|
+
* @param type The service type to retrieve.
|
|
12
|
+
* @returns The shared instance of the service.
|
|
13
|
+
* @template T The type of the service to retrieve.
|
|
14
|
+
*/
|
|
15
|
+
static get<T extends Service>(type: {
|
|
16
|
+
new (): T;
|
|
17
|
+
}): T;
|
|
18
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { DataDiagramModel, SerializedDiagram } from '@reactodia/workspace';
|
|
2
|
+
import { Service } from '../../providers/service/service';
|
|
3
|
+
import { Subscription } from '../../models/subscription';
|
|
4
|
+
/**
|
|
5
|
+
* Callback invoked with the current diagram layout whenever it changes.
|
|
6
|
+
*/
|
|
7
|
+
export type DiagramChangeCallback = (diagram: SerializedDiagram) => void;
|
|
8
|
+
/**
|
|
9
|
+
* Service for diagram related operations and subscriptions
|
|
10
|
+
*/
|
|
11
|
+
export declare class DiagramService implements Service {
|
|
12
|
+
/**
|
|
13
|
+
* Debounce time for the callback trigger. This is needed, because certain events (like moving a node) can trigger
|
|
14
|
+
* multiple `historyChanged` events in a short time.
|
|
15
|
+
*/
|
|
16
|
+
private static readonly NOTIFY_DEBOUNCE_MS;
|
|
17
|
+
private static readonly HISTORY_CHANGED_EVENT;
|
|
18
|
+
/**
|
|
19
|
+
* Subscribes to diagram changes. On every debounced change the current layout is
|
|
20
|
+
* exported and passed to the callback
|
|
21
|
+
*
|
|
22
|
+
* @param model The diagram model to observe.
|
|
23
|
+
* @param onChangeCallback Called with the exported layout when the diagram changes.
|
|
24
|
+
* @returns A {@link Subscription} that, when called, removes the listener and drops any
|
|
25
|
+
* pending notification.
|
|
26
|
+
*/
|
|
27
|
+
subscribeToDiagramChange(model: DataDiagramModel, onChangeCallback: DiagramChangeCallback): Subscription;
|
|
28
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { SerializedDiagram } from '@reactodia/workspace';
|
|
2
|
+
import { Service } from '../../providers/service/service';
|
|
3
|
+
/**
|
|
4
|
+
* Service for local store-related diagram operations
|
|
5
|
+
*/
|
|
6
|
+
export declare class DiagramStorageService implements Service {
|
|
7
|
+
private static readonly STORAGE_KEY;
|
|
8
|
+
/**
|
|
9
|
+
* Load the persisted diagram from the local store, or `undefined` when nothing is stored (or the stored value
|
|
10
|
+
* is unreadable).
|
|
11
|
+
*/
|
|
12
|
+
load(): SerializedDiagram | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Persists the given diagram serialization.
|
|
15
|
+
*/
|
|
16
|
+
save(diagram: SerializedDiagram): void;
|
|
17
|
+
/**
|
|
18
|
+
* Removes the persisted diagram. Used when a new view (a seed) should take precedence over
|
|
19
|
+
* previously saved edits.
|
|
20
|
+
*/
|
|
21
|
+
clear(): void;
|
|
22
|
+
/**
|
|
23
|
+
* Local storage getter
|
|
24
|
+
*/
|
|
25
|
+
private get storage();
|
|
26
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Service } from '../../providers/service/service';
|
|
2
|
+
import { Subscription } from '../../models/subscription';
|
|
3
|
+
/**
|
|
4
|
+
* Service for event based operations
|
|
5
|
+
*/
|
|
6
|
+
export declare class EventService implements Service {
|
|
7
|
+
/**
|
|
8
|
+
* Subscribes to the host's "clear persisted diagram" command.
|
|
9
|
+
*
|
|
10
|
+
* @param onClear Called whenever the event fires.
|
|
11
|
+
* @returns A {@link Subscription} that, when called, removes the listener.
|
|
12
|
+
*/
|
|
13
|
+
subscribeToClearDiagramStorage(onClear: () => void): Subscription;
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal in-memory {@link Storage}, so services that read `localStorage` can be exercised
|
|
3
|
+
* without a real browser store and asserted against directly. Shared across test suites.
|
|
4
|
+
*/
|
|
5
|
+
export declare class StorageMock implements Storage {
|
|
6
|
+
private readonly store;
|
|
7
|
+
get length(): number;
|
|
8
|
+
clear(): void;
|
|
9
|
+
getItem(key: string): string | null;
|
|
10
|
+
key(index: number): string | null;
|
|
11
|
+
removeItem(key: string): void;
|
|
12
|
+
setItem(key: string, value: string): void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Creates a fresh {@link StorageMock}. Suites install the returned instance as the global
|
|
16
|
+
* `localStorage` themselves.
|
|
17
|
+
*/
|
|
18
|
+
export declare function createStorageMock(): StorageMock;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export { CLEAR_DIAGRAM_STORAGE_EVENT } from './components/graphwise-reactodia/models/clear-diagram-storage-event';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graphwise-reactodia",
|
|
3
|
-
"version": "0.0.1-
|
|
3
|
+
"version": "0.0.1-TR8",
|
|
4
4
|
"description": "Graphwise wrapper around the Reactodia graph explorer.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Ontotext AD",
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
"collection": "dist/collection/collection-manifest.json",
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
|
-
"
|
|
12
|
+
"types": "./dist/types/index.d.ts",
|
|
13
|
+
"import": "./dist/esm/index.js",
|
|
13
14
|
"require": "./dist/index.cjs.js"
|
|
14
15
|
},
|
|
15
16
|
"./loader": {
|
|
@@ -30,16 +31,21 @@
|
|
|
30
31
|
"start": "npm run reactodia:build && stencil build --dev --watch --serve",
|
|
31
32
|
"cy:open": "cypress open",
|
|
32
33
|
"cy:run": "cypress run",
|
|
33
|
-
"cy:run:ci": "docker compose --ansi never up --exit-code-from cypress"
|
|
34
|
+
"cy:run:ci": "docker compose --ansi never up --exit-code-from cypress",
|
|
35
|
+
"test": "stencil test --spec",
|
|
36
|
+
"test.watch": "stencil test --spec --watchAll"
|
|
34
37
|
},
|
|
35
38
|
"devDependencies": {
|
|
36
39
|
"@rdfjs/types": "^2.0.1",
|
|
37
40
|
"@reactodia/workspace": "file:./reactodia-workspace",
|
|
38
41
|
"@stencil/core": "4.35.1",
|
|
39
42
|
"@stencil/sass": "^3.2.3",
|
|
43
|
+
"@types/jest": "^29.5.14",
|
|
40
44
|
"@types/react": "^18.3.12",
|
|
41
45
|
"@types/react-dom": "^18.3.1",
|
|
42
46
|
"cypress": "^15.17.0",
|
|
47
|
+
"jest": "^29.7.0",
|
|
48
|
+
"jest-cli": "^29.7.0",
|
|
43
49
|
"react": "^18.3.1",
|
|
44
50
|
"react-dom": "^18.3.1",
|
|
45
51
|
"rollup-plugin-node-polyfills": "^0.2.1"
|