graphwise-reactodia 0.0.1-TR14 → 0.0.1-TR15
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/dist/cjs/graphwise-reactodia.cjs.entry.js +17 -4
- package/dist/collection/components/graphwise-reactodia/graphwise-reactodia.js +17 -4
- package/dist/collection/pages/graphwise-reactodia/main.js +34 -0
- package/dist/esm/graphwise-reactodia.entry.js +17 -4
- package/dist/graphwise-reactodia/graphwise-reactodia.esm.js +1 -1
- package/dist/graphwise-reactodia/{p-0cb06f14.entry.js → p-a2c710e4.entry.js} +1 -1
- package/dist/types/components/graphwise-reactodia/graphwise-reactodia.d.ts +9 -0
- package/package.json +1 -1
|
@@ -31894,6 +31894,14 @@ const GraphwiseReactodia = class {
|
|
|
31894
31894
|
* UI language code (e.g. `en`, `fr`) for the Reactodia interface. Defaults to English.
|
|
31895
31895
|
*/
|
|
31896
31896
|
this.language = LanguageKey.EN;
|
|
31897
|
+
/**
|
|
31898
|
+
* `connectedCallback` and the watchers can run before all props are set: when the component's
|
|
31899
|
+
* code is already loaded, the instance is created as soon as the
|
|
31900
|
+
* element is attached, and every prop set after that triggers its watcher. Rendering at that
|
|
31901
|
+
* point would initialise the graph without all props. `componentDidLoad` runs once the initial
|
|
31902
|
+
* props are set, so we use it to determine when it's safe to render.
|
|
31903
|
+
*/
|
|
31904
|
+
this.isComponentLoaded = false;
|
|
31897
31905
|
}
|
|
31898
31906
|
onCurrentRepositoryChange() {
|
|
31899
31907
|
this.renderGraph();
|
|
@@ -31909,9 +31917,11 @@ const GraphwiseReactodia = class {
|
|
|
31909
31917
|
this.renderGraph(true);
|
|
31910
31918
|
}
|
|
31911
31919
|
connectedCallback() {
|
|
31912
|
-
|
|
31913
|
-
|
|
31914
|
-
|
|
31920
|
+
this.renderGraph();
|
|
31921
|
+
}
|
|
31922
|
+
componentDidLoad() {
|
|
31923
|
+
this.isComponentLoaded = true;
|
|
31924
|
+
this.renderGraph();
|
|
31915
31925
|
}
|
|
31916
31926
|
disconnectedCallback() {
|
|
31917
31927
|
if (this.reactRoot) {
|
|
@@ -31920,10 +31930,13 @@ const GraphwiseReactodia = class {
|
|
|
31920
31930
|
}
|
|
31921
31931
|
}
|
|
31922
31932
|
render() {
|
|
31923
|
-
return (index$1.h(index$1.Host, { key: '
|
|
31933
|
+
return (index$1.h(index$1.Host, { key: 'a03aad892cb1947ab2426d77b3229e1324776c2c' }));
|
|
31924
31934
|
}
|
|
31925
31935
|
renderGraph(isReloading) {
|
|
31926
31936
|
var _a;
|
|
31937
|
+
if (!this.isComponentLoaded) {
|
|
31938
|
+
return;
|
|
31939
|
+
}
|
|
31927
31940
|
if (!this.currentRepository) {
|
|
31928
31941
|
throw new Error('currentRepository is required');
|
|
31929
31942
|
}
|
|
@@ -19,6 +19,14 @@ export class GraphwiseReactodia {
|
|
|
19
19
|
* UI language code (e.g. `en`, `fr`) for the Reactodia interface. Defaults to English.
|
|
20
20
|
*/
|
|
21
21
|
this.language = LanguageKey.EN;
|
|
22
|
+
/**
|
|
23
|
+
* `connectedCallback` and the watchers can run before all props are set: when the component's
|
|
24
|
+
* code is already loaded, the instance is created as soon as the
|
|
25
|
+
* element is attached, and every prop set after that triggers its watcher. Rendering at that
|
|
26
|
+
* point would initialise the graph without all props. `componentDidLoad` runs once the initial
|
|
27
|
+
* props are set, so we use it to determine when it's safe to render.
|
|
28
|
+
*/
|
|
29
|
+
this.isComponentLoaded = false;
|
|
22
30
|
}
|
|
23
31
|
onCurrentRepositoryChange() {
|
|
24
32
|
this.renderGraph();
|
|
@@ -34,9 +42,11 @@ export class GraphwiseReactodia {
|
|
|
34
42
|
this.renderGraph(true);
|
|
35
43
|
}
|
|
36
44
|
connectedCallback() {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
45
|
+
this.renderGraph();
|
|
46
|
+
}
|
|
47
|
+
componentDidLoad() {
|
|
48
|
+
this.isComponentLoaded = true;
|
|
49
|
+
this.renderGraph();
|
|
40
50
|
}
|
|
41
51
|
disconnectedCallback() {
|
|
42
52
|
if (this.reactRoot) {
|
|
@@ -45,10 +55,13 @@ export class GraphwiseReactodia {
|
|
|
45
55
|
}
|
|
46
56
|
}
|
|
47
57
|
render() {
|
|
48
|
-
return (h(Host, { key: '
|
|
58
|
+
return (h(Host, { key: 'a03aad892cb1947ab2426d77b3229e1324776c2c' }));
|
|
49
59
|
}
|
|
50
60
|
renderGraph(isReloading) {
|
|
51
61
|
var _a;
|
|
62
|
+
if (!this.isComponentLoaded) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
52
65
|
if (!this.currentRepository) {
|
|
53
66
|
throw new Error('currentRepository is required');
|
|
54
67
|
}
|
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
// result. The shape has to match what the provider asks for: SELECT/ASK queries are parsed with
|
|
3
3
|
// `response.json()` and would blow up on an empty body, CONSTRUCT/DESCRIBE queries are parsed as
|
|
4
4
|
// turtle, where an empty body is a valid (empty) graph.
|
|
5
|
+
//
|
|
6
|
+
// The queries are recorded, so the tests can tell which provider settings built them.
|
|
7
|
+
const sparqlQueries = [];
|
|
8
|
+
window.sparqlQueries = sparqlQueries;
|
|
9
|
+
|
|
5
10
|
async function stubQueryFunction(params) {
|
|
11
|
+
sparqlQueries.push(params.body);
|
|
6
12
|
const accept = params.headers?.['Accept'] ?? '';
|
|
7
13
|
if (accept.includes('sparql-results+json')) {
|
|
8
14
|
const body = JSON.stringify({head: {vars: []}, results: {bindings: []}, boolean: false});
|
|
@@ -33,6 +39,34 @@ function setProviderSettings() {
|
|
|
33
39
|
reactodia.providerSettings = OWL_RDFS_SETTINGS;
|
|
34
40
|
}
|
|
35
41
|
|
|
42
|
+
// A runtime change goes through the `providerSettings` prop. The extra prefix marks the queries built
|
|
43
|
+
// with the changed settings.
|
|
44
|
+
function changeProviderSettings() {
|
|
45
|
+
reactodia.providerSettings = {
|
|
46
|
+
...OWL_RDFS_SETTINGS,
|
|
47
|
+
defaultPrefix: `${OWL_RDFS_SETTINGS.defaultPrefix}\nPREFIX changed: <http://example.com/changed#>\n`,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Replaces the element with a new one the way a framework such as Angular renders it: attached first, then
|
|
52
|
+
// the props set one by one. The component code is already loaded by then, so the component is initialized
|
|
53
|
+
// before it has any of its props.
|
|
54
|
+
function attachThenSetProps(order) {
|
|
55
|
+
const props = {
|
|
56
|
+
config: {queryFunction: stubQueryFunction, seedIris: SEED_NODES},
|
|
57
|
+
currentRepository: 'repo-a',
|
|
58
|
+
providerSettings: OWL_RDFS_SETTINGS,
|
|
59
|
+
language: 'fr',
|
|
60
|
+
theme: 'light',
|
|
61
|
+
};
|
|
62
|
+
const element = document.createElement('graphwise-reactodia');
|
|
63
|
+
element.dataset.test = 'reactodia';
|
|
64
|
+
document.querySelector('graphwise-reactodia').replaceWith(element);
|
|
65
|
+
order.forEach((prop) => {
|
|
66
|
+
element[prop] = props[prop];
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
36
70
|
function setSeed() {
|
|
37
71
|
reactodia.config = {...reactodia.config, seedIris: SEED_NODES};
|
|
38
72
|
}
|
|
@@ -31892,6 +31892,14 @@ const GraphwiseReactodia = class {
|
|
|
31892
31892
|
* UI language code (e.g. `en`, `fr`) for the Reactodia interface. Defaults to English.
|
|
31893
31893
|
*/
|
|
31894
31894
|
this.language = LanguageKey.EN;
|
|
31895
|
+
/**
|
|
31896
|
+
* `connectedCallback` and the watchers can run before all props are set: when the component's
|
|
31897
|
+
* code is already loaded, the instance is created as soon as the
|
|
31898
|
+
* element is attached, and every prop set after that triggers its watcher. Rendering at that
|
|
31899
|
+
* point would initialise the graph without all props. `componentDidLoad` runs once the initial
|
|
31900
|
+
* props are set, so we use it to determine when it's safe to render.
|
|
31901
|
+
*/
|
|
31902
|
+
this.isComponentLoaded = false;
|
|
31895
31903
|
}
|
|
31896
31904
|
onCurrentRepositoryChange() {
|
|
31897
31905
|
this.renderGraph();
|
|
@@ -31907,9 +31915,11 @@ const GraphwiseReactodia = class {
|
|
|
31907
31915
|
this.renderGraph(true);
|
|
31908
31916
|
}
|
|
31909
31917
|
connectedCallback() {
|
|
31910
|
-
|
|
31911
|
-
|
|
31912
|
-
|
|
31918
|
+
this.renderGraph();
|
|
31919
|
+
}
|
|
31920
|
+
componentDidLoad() {
|
|
31921
|
+
this.isComponentLoaded = true;
|
|
31922
|
+
this.renderGraph();
|
|
31913
31923
|
}
|
|
31914
31924
|
disconnectedCallback() {
|
|
31915
31925
|
if (this.reactRoot) {
|
|
@@ -31918,10 +31928,13 @@ const GraphwiseReactodia = class {
|
|
|
31918
31928
|
}
|
|
31919
31929
|
}
|
|
31920
31930
|
render() {
|
|
31921
|
-
return (h(Host, { key: '
|
|
31931
|
+
return (h(Host, { key: 'a03aad892cb1947ab2426d77b3229e1324776c2c' }));
|
|
31922
31932
|
}
|
|
31923
31933
|
renderGraph(isReloading) {
|
|
31924
31934
|
var _a;
|
|
31935
|
+
if (!this.isComponentLoaded) {
|
|
31936
|
+
return;
|
|
31937
|
+
}
|
|
31925
31938
|
if (!this.currentRepository) {
|
|
31926
31939
|
throw new Error('currentRepository is required');
|
|
31927
31940
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as r}from"./p-Cypw7ydc.js";export{s as setNonce}from"./p-Cypw7ydc.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-
|
|
1
|
+
import{p as e,b as r}from"./p-Cypw7ydc.js";export{s as setNonce}from"./p-Cypw7ydc.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-a2c710e4",[[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))));
|