graphwise-reactodia 0.0.1-TR1 → 0.0.1-TR10

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 (54) hide show
  1. package/README.md +115 -1
  2. package/dist/cjs/graphwise-reactodia.cjs.entry.js +27276 -41135
  3. package/dist/cjs/graphwise-reactodia.cjs.js +1 -1
  4. package/dist/cjs/index.cjs.js +7 -0
  5. package/dist/cjs/loader.cjs.js +1 -1
  6. package/dist/collection/components/graphwise-reactodia/graphwise-reactodia.js +69 -34
  7. package/dist/collection/components/graphwise-reactodia/i18n/language-key.js +5 -0
  8. package/dist/collection/components/graphwise-reactodia/i18n/translations.js +3 -1
  9. package/dist/collection/components/graphwise-reactodia/models/clear-diagram-storage-event.js +5 -0
  10. package/dist/collection/components/graphwise-reactodia/models/reactodia-config.js +1 -0
  11. package/dist/collection/components/graphwise-reactodia/models/subscription-list.js +35 -0
  12. package/dist/collection/components/graphwise-reactodia/models/subscription.js +1 -0
  13. package/dist/collection/components/graphwise-reactodia/models/triple.js +1 -0
  14. package/dist/collection/components/graphwise-reactodia/providers/service/service-inject.js +15 -0
  15. package/dist/collection/components/graphwise-reactodia/providers/service/service.js +19 -0
  16. package/dist/collection/components/graphwise-reactodia/providers/service/service.provider.js +20 -0
  17. package/dist/collection/components/graphwise-reactodia/reactodia-app.js +107 -17
  18. package/dist/collection/components/graphwise-reactodia/services/diagram/diagram.service.js +54 -0
  19. package/dist/collection/components/graphwise-reactodia/services/diagram-storage/diagram-storage.service.js +55 -0
  20. package/dist/collection/components/graphwise-reactodia/services/event/event.service.js +35 -0
  21. package/dist/collection/components/graphwise-reactodia/services/window/window.service.js +24 -0
  22. package/dist/collection/components/graphwise-reactodia/styles/type-style.resolver.js +53 -0
  23. package/dist/collection/components/graphwise-reactodia/testing/storage.mock.js +35 -0
  24. package/dist/collection/index.js +1 -1
  25. package/dist/collection/pages/graphwise-reactodia/main.js +50 -0
  26. package/dist/esm/graphwise-reactodia.entry.js +27273 -41132
  27. package/dist/esm/graphwise-reactodia.js +1 -1
  28. package/dist/esm/index.js +6 -0
  29. package/dist/esm/loader.js +1 -1
  30. package/dist/graphwise-reactodia/graphwise-reactodia.esm.js +1 -1
  31. package/dist/graphwise-reactodia/index.esm.js +1 -0
  32. package/dist/graphwise-reactodia/p-b56c58a0.entry.js +1 -0
  33. package/dist/types/components/graphwise-reactodia/graphwise-reactodia.d.ts +25 -12
  34. package/dist/types/components/graphwise-reactodia/i18n/language-key.d.ts +4 -0
  35. package/dist/types/components/graphwise-reactodia/i18n/translations.d.ts +2 -343
  36. package/dist/types/components/graphwise-reactodia/models/clear-diagram-storage-event.d.ts +5 -0
  37. package/dist/types/components/graphwise-reactodia/models/reactodia-app-props.d.ts +15 -14
  38. package/dist/types/components/graphwise-reactodia/models/reactodia-config.d.ts +31 -0
  39. package/dist/types/components/graphwise-reactodia/models/subscription-list.d.ts +26 -0
  40. package/dist/types/components/graphwise-reactodia/models/subscription.d.ts +4 -0
  41. package/dist/types/components/graphwise-reactodia/models/triple.d.ts +19 -0
  42. package/dist/types/components/graphwise-reactodia/providers/service/service-inject.d.ts +13 -0
  43. package/dist/types/components/graphwise-reactodia/providers/service/service.d.ts +28 -0
  44. package/dist/types/components/graphwise-reactodia/providers/service/service.provider.d.ts +16 -0
  45. package/dist/types/components/graphwise-reactodia/services/diagram/diagram.service.d.ts +26 -0
  46. package/dist/types/components/graphwise-reactodia/services/diagram-storage/diagram-storage.service.d.ts +26 -0
  47. package/dist/types/components/graphwise-reactodia/services/event/event.service.d.ts +14 -0
  48. package/dist/types/components/graphwise-reactodia/services/window/window.service.d.ts +7 -0
  49. package/dist/types/components/graphwise-reactodia/styles/type-style.resolver.d.ts +11 -0
  50. package/dist/types/components/graphwise-reactodia/testing/storage.mock.d.ts +18 -0
  51. package/dist/types/components.d.ts +37 -25
  52. package/dist/types/index.d.ts +1 -1
  53. package/package.json +31 -8
  54. package/dist/graphwise-reactodia/p-bafd6be5.entry.js +0 -1
@@ -0,0 +1,26 @@
1
+ import type { SerializedDiagram } from '@reactodia/workspace';
2
+ /**
3
+ * Service for local store-related diagram operations
4
+ */
5
+ export declare class DiagramStorageService {
6
+ static readonly ID = "DiagramStorageService";
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 { Subscription } from '../../models/subscription';
2
+ /**
3
+ * Service for event based operations
4
+ */
5
+ export declare class EventService {
6
+ static readonly ID = "EventService";
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,7 @@
1
+ /**
2
+ * Service that provides access to browser window-related functionality.
3
+ */
4
+ export declare class WindowService {
5
+ static readonly ID = "WindowService";
6
+ getWindow(): Window;
7
+ }
@@ -0,0 +1,11 @@
1
+ import { TypeStyleResolver } from '@reactodia/workspace';
2
+ /**
3
+ * Colors an element by its type: each type takes the next color from the palette, which wraps
4
+ * around once it runs out
5
+ *
6
+ * Returns `undefined` for elements without a type (placeholders and other non-entity elements) and
7
+ * when the host does not define the palette, leaving Reactodia to fall back to its own hash-based
8
+ * colors.
9
+ */
10
+ export declare const resolveTypeStyle: TypeStyleResolver;
11
+ export declare const resetColors: () => void;
@@ -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;
@@ -5,45 +5,53 @@
5
5
  * It contains typing information for all components that exist in this project.
6
6
  */
7
7
  import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
8
- import { SparqlDataProviderSettings, SparqlQueryFunction } from "@reactodia/workspace";
9
- export { SparqlDataProviderSettings, SparqlQueryFunction } from "@reactodia/workspace";
8
+ import { ReactodiaConfig } from "./components/graphwise-reactodia/models/reactodia-config";
9
+ import { LanguageKey } from "./components/graphwise-reactodia/i18n/language-key";
10
+ import { SparqlDataProviderSettings } from "@reactodia/workspace";
11
+ export { ReactodiaConfig } from "./components/graphwise-reactodia/models/reactodia-config";
12
+ export { LanguageKey } from "./components/graphwise-reactodia/i18n/language-key";
13
+ export { SparqlDataProviderSettings } from "@reactodia/workspace";
10
14
  export namespace Components {
11
15
  /**
12
16
  * A web component that renders a graph with the Reactodia workspace.
13
17
  * The component is backed by a SPARQL endpoint but is endpoint-agnostic: the host passes
14
- * the active repository's endpoint via `current-repository` and a `queryFunction` that
15
- * performs the actual HTTP request. Reactodia fetches all node, link and type data lazily
16
- * through them; the canvas starts empty and the user populates it via the search bar.
18
+ * the active repository's endpoint via `current-repository` and a `config.queryFunction`
19
+ * that performs the actual HTTP request. Reactodia fetches all node, link and type data
20
+ * lazily through them; the canvas starts empty and the user populates it via the search bar.
17
21
  * The component is a thin wrapper around Reactodia: query configuration lives outside the
18
22
  * wrapper and is supplied through the `providerSettings` prop.
19
23
  */
20
24
  interface GraphwiseReactodia {
21
25
  /**
22
- * The active repository id. Appended to {@link queryFunction} as the request `url`; changing it re-points the graph at the new repository (and resets the canvas), which is how runtime repository changes are handled.
26
+ * Host-supplied configuration: the SPARQL `queryFunction` transport and an optional `seed` set of entities to pre-populate the canvas with. A DOM property (an object, not an attribute) passed in from outside the wrapper. Read once on mount; not watched, as it only sets up the data source and initial canvas.
23
27
  */
24
- "currentRepository": string;
28
+ "config"?: ReactodiaConfig;
29
+ /**
30
+ * The active repository id. Appended to {@link queryFunction } as the request `url`; changing it re-points the graph at the new repository (and resets the canvas), which is how runtime repository changes are handled.
31
+ */
32
+ "currentRepository"?: string;
25
33
  /**
26
34
  * UI language code (e.g. `en`, `fr`) for the Reactodia interface. Defaults to English.
27
- * @default 'en'
35
+ * @default LanguageKey.EN
28
36
  */
29
- "language": string;
37
+ "language": LanguageKey;
30
38
  /**
31
39
  * 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. When omitted, the data provider falls back to Reactodia's generic OWL/RDFS preset. Changing it rebuilds the data provider and resets the canvas.
32
40
  */
33
41
  "providerSettings"?: SparqlDataProviderSettings;
34
42
  /**
35
- * HTTP transport for the SPARQL requests. Set by the host so requests go through the host's HTTP layer (auth, interceptors) instead of a built-in `fetch`.
43
+ * The theme currently applied by the host (e.g. `light`, `dark`). The value itself is never read - the node colors are taken from the host's CSS custom properties - it only signals that those values have changed. The host owns the theme, including whether it follows the OS color scheme, so the change is passed in instead of being detected here.
36
44
  */
37
- "queryFunction": SparqlQueryFunction;
45
+ "theme"?: string;
38
46
  }
39
47
  }
40
48
  declare global {
41
49
  /**
42
50
  * A web component that renders a graph with the Reactodia workspace.
43
51
  * The component is backed by a SPARQL endpoint but is endpoint-agnostic: the host passes
44
- * the active repository's endpoint via `current-repository` and a `queryFunction` that
45
- * performs the actual HTTP request. Reactodia fetches all node, link and type data lazily
46
- * through them; the canvas starts empty and the user populates it via the search bar.
52
+ * the active repository's endpoint via `current-repository` and a `config.queryFunction`
53
+ * that performs the actual HTTP request. Reactodia fetches all node, link and type data
54
+ * lazily through them; the canvas starts empty and the user populates it via the search bar.
47
55
  * The component is a thin wrapper around Reactodia: query configuration lives outside the
48
56
  * wrapper and is supplied through the `providerSettings` prop.
49
57
  */
@@ -61,30 +69,34 @@ declare namespace LocalJSX {
61
69
  /**
62
70
  * A web component that renders a graph with the Reactodia workspace.
63
71
  * The component is backed by a SPARQL endpoint but is endpoint-agnostic: the host passes
64
- * the active repository's endpoint via `current-repository` and a `queryFunction` that
65
- * performs the actual HTTP request. Reactodia fetches all node, link and type data lazily
66
- * through them; the canvas starts empty and the user populates it via the search bar.
72
+ * the active repository's endpoint via `current-repository` and a `config.queryFunction`
73
+ * that performs the actual HTTP request. Reactodia fetches all node, link and type data
74
+ * lazily through them; the canvas starts empty and the user populates it via the search bar.
67
75
  * The component is a thin wrapper around Reactodia: query configuration lives outside the
68
76
  * wrapper and is supplied through the `providerSettings` prop.
69
77
  */
70
78
  interface GraphwiseReactodia {
71
79
  /**
72
- * The active repository id. Appended to {@link queryFunction} as the request `url`; changing it re-points the graph at the new repository (and resets the canvas), which is how runtime repository changes are handled.
80
+ * Host-supplied configuration: the SPARQL `queryFunction` transport and an optional `seed` set of entities to pre-populate the canvas with. A DOM property (an object, not an attribute) passed in from outside the wrapper. Read once on mount; not watched, as it only sets up the data source and initial canvas.
81
+ */
82
+ "config"?: ReactodiaConfig;
83
+ /**
84
+ * The active repository id. Appended to {@link queryFunction } as the request `url`; changing it re-points the graph at the new repository (and resets the canvas), which is how runtime repository changes are handled.
73
85
  */
74
86
  "currentRepository"?: string;
75
87
  /**
76
88
  * UI language code (e.g. `en`, `fr`) for the Reactodia interface. Defaults to English.
77
- * @default 'en'
89
+ * @default LanguageKey.EN
78
90
  */
79
- "language"?: string;
91
+ "language"?: LanguageKey;
80
92
  /**
81
93
  * 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. When omitted, the data provider falls back to Reactodia's generic OWL/RDFS preset. Changing it rebuilds the data provider and resets the canvas.
82
94
  */
83
95
  "providerSettings"?: SparqlDataProviderSettings;
84
96
  /**
85
- * HTTP transport for the SPARQL requests. Set by the host so requests go through the host's HTTP layer (auth, interceptors) instead of a built-in `fetch`.
97
+ * The theme currently applied by the host (e.g. `light`, `dark`). The value itself is never read - the node colors are taken from the host's CSS custom properties - it only signals that those values have changed. The host owns the theme, including whether it follows the OS color scheme, so the change is passed in instead of being detected here.
86
98
  */
87
- "queryFunction"?: SparqlQueryFunction;
99
+ "theme"?: string;
88
100
  }
89
101
  interface IntrinsicElements {
90
102
  "graphwise-reactodia": GraphwiseReactodia;
@@ -97,9 +109,9 @@ declare module "@stencil/core" {
97
109
  /**
98
110
  * A web component that renders a graph with the Reactodia workspace.
99
111
  * The component is backed by a SPARQL endpoint but is endpoint-agnostic: the host passes
100
- * the active repository's endpoint via `current-repository` and a `queryFunction` that
101
- * performs the actual HTTP request. Reactodia fetches all node, link and type data lazily
102
- * through them; the canvas starts empty and the user populates it via the search bar.
112
+ * the active repository's endpoint via `current-repository` and a `config.queryFunction`
113
+ * that performs the actual HTTP request. Reactodia fetches all node, link and type data
114
+ * lazily through them; the canvas starts empty and the user populates it via the search bar.
103
115
  * The component is a thin wrapper around Reactodia: query configuration lives outside the
104
116
  * wrapper and is supplied through the `providerSettings` prop.
105
117
  */
@@ -1 +1 @@
1
- export {};
1
+ export { CLEAR_DIAGRAM_STORAGE_EVENT } from './components/graphwise-reactodia/models/clear-diagram-storage-event';
package/package.json CHANGED
@@ -1,30 +1,53 @@
1
1
  {
2
2
  "name": "graphwise-reactodia",
3
- "version": "0.0.1-TR1",
3
+ "version": "0.0.1-TR10",
4
4
  "description": "Graphwise wrapper around the Reactodia graph explorer.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Ontotext AD",
7
7
  "main": "dist/index.cjs.js",
8
+ "module": "dist/esm/index.js",
8
9
  "collection": "dist/collection/collection-manifest.json",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/types/index.d.ts",
13
+ "import": "./dist/esm/index.js",
14
+ "require": "./dist/index.cjs.js"
15
+ },
16
+ "./loader": {
17
+ "import": "./loader/index.js",
18
+ "require": "./loader/index.cjs.js",
19
+ "types": "./loader/index.d.ts"
20
+ }
21
+ },
9
22
  "files": [
10
23
  "dist/",
11
24
  "loader/"
12
25
  ],
13
26
  "scripts": {
14
- "build": "stencil build",
15
- "start": "stencil build --dev --watch --serve"
16
- },
17
- "dependencies": {
18
- "@reactodia/workspace": "^0.34.1",
19
- "react": "^18.3.1",
20
- "react-dom": "^18.3.1"
27
+ "reactodia:install": "cd reactodia-workspace && npm ci",
28
+ "reactodia:compile": "cd reactodia-workspace && npm run build && npm run typings",
29
+ "reactodia:build": "npm run reactodia:install && npm run reactodia:compile",
30
+ "build": "npm run reactodia:build && stencil build",
31
+ "start": "npm run reactodia:build && stencil build --dev --watch --serve",
32
+ "cy:open": "cypress open",
33
+ "cy:run": "cypress run",
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"
21
37
  },
22
38
  "devDependencies": {
23
39
  "@rdfjs/types": "^2.0.1",
40
+ "@reactodia/workspace": "file:./reactodia-workspace",
24
41
  "@stencil/core": "4.35.1",
25
42
  "@stencil/sass": "^3.2.3",
43
+ "@types/jest": "^29.5.14",
26
44
  "@types/react": "^18.3.12",
27
45
  "@types/react-dom": "^18.3.1",
46
+ "cypress": "^15.17.0",
47
+ "jest": "^29.7.0",
48
+ "jest-cli": "^29.7.0",
49
+ "react": "^18.3.1",
50
+ "react-dom": "^18.3.1",
28
51
  "rollup-plugin-node-polyfills": "^0.2.1"
29
52
  }
30
53
  }