graphwise-reactodia 0.0.1-TR6 → 0.0.1-TR7

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.
@@ -30684,6 +30684,41 @@ async function seedCanvas(context, seed, signal) {
30684
30684
  await model.requestData();
30685
30685
  await performLayout({ signal });
30686
30686
  }
30687
+ /**
30688
+ * Places a pre-resolved graph (e.g. a CONSTRUCT query result) on the canvas. The relationships
30689
+ * are computed and not persisted in the repository, so the edges are drawn directly from the
30690
+ * supplied data instead of being fetched. The node IRIs do exist in the repository, so only
30691
+ * their display data is hydrated via {@link DataDiagramModel.requestElementData}.
30692
+ *
30693
+ * Note we use `requestElementData` rather than `requestData`: the latter would also query the
30694
+ * provider for *all* persisted links between the seeded nodes, over-fetching beyond the
30695
+ * CONSTRUCT's selection. Hydrating elements alone keeps the canvas to exactly the supplied
30696
+ * edges, while further expansion continues lazily against the SPARQL provider.
30697
+ */
30698
+ async function seedGraphCanvas(context, links, signal) {
30699
+ const { model, performLayout } = context;
30700
+ const uniqueIris = new Set();
30701
+ links.forEach((link) => {
30702
+ var _a;
30703
+ uniqueIris.add(link.source);
30704
+ uniqueIris.add(link.target);
30705
+ // this is a createOrGet, regardless of the name, so we don't need to worry about duplicates.
30706
+ model.createElement(link.source);
30707
+ model.createElement(link.target);
30708
+ (_a = link.rawPredicates) === null || _a === void 0 ? void 0 : _a.forEach((predicate) => {
30709
+ model.createLinks({
30710
+ linkTypeId: predicate,
30711
+ sourceId: link.source,
30712
+ targetId: link.target,
30713
+ properties: {}
30714
+ });
30715
+ });
30716
+ });
30717
+ // Request data only for elements.
30718
+ // Link data is not available in the DB, since we are displaying construct/describe queries
30719
+ await model.requestElementData(Array.from(uniqueIris));
30720
+ await performLayout({ signal });
30721
+ }
30687
30722
  /**
30688
30723
  * The Reactodia workspace React component.
30689
30724
  *
@@ -30696,6 +30731,7 @@ async function seedCanvas(context, seed, signal) {
30696
30731
  function ReactodiaApp(props) {
30697
30732
  const { language, initialDiagram, config } = props;
30698
30733
  const { onMount } = useLoadedWorkspace(async ({ context, signal }) => {
30734
+ var _a, _b;
30699
30735
  workspaceContext = context;
30700
30736
  const { model } = context;
30701
30737
  const dataProvider = createDataProvider(props);
@@ -30707,7 +30743,10 @@ function ReactodiaApp(props) {
30707
30743
  }
30708
30744
  else {
30709
30745
  await model.createNewDiagram({ dataProvider, signal });
30710
- if (config.seedIris) {
30746
+ if ((_a = config.seedGraph) === null || _a === void 0 ? void 0 : _a.length) {
30747
+ await seedGraphCanvas(context, config.seedGraph, signal);
30748
+ }
30749
+ else if ((_b = config.seedIris) === null || _b === void 0 ? void 0 : _b.length) {
30711
30750
  await seedCanvas(context, config.seedIris, signal);
30712
30751
  }
30713
30752
  }
@@ -30783,7 +30822,7 @@ const GraphwiseReactodia = class {
30783
30822
  const diagram = exportReactodiaLayout();
30784
30823
  this.renderGraph(diagram);
30785
30824
  }
30786
- componentDidLoad() {
30825
+ connectedCallback() {
30787
30826
  this.renderGraph();
30788
30827
  }
30789
30828
  disconnectedCallback() {
@@ -30793,7 +30832,7 @@ const GraphwiseReactodia = class {
30793
30832
  }
30794
30833
  }
30795
30834
  render() {
30796
- return (index.h(index.Host, { key: '8ef8d44db9d8e5eae72474c71c3c586f1f267d9b' }));
30835
+ return (index.h(index.Host, { key: '63c58ee1d28c4866aa66d3dcf4893879de4d09f6' }));
30797
30836
  }
30798
30837
  renderGraph(initialDiagram) {
30799
30838
  var _a;
@@ -29,7 +29,7 @@ export class GraphwiseReactodia {
29
29
  const diagram = exportReactodiaLayout();
30
30
  this.renderGraph(diagram);
31
31
  }
32
- componentDidLoad() {
32
+ connectedCallback() {
33
33
  this.renderGraph();
34
34
  }
35
35
  disconnectedCallback() {
@@ -39,7 +39,7 @@ export class GraphwiseReactodia {
39
39
  }
40
40
  }
41
41
  render() {
42
- return (h(Host, { key: '8ef8d44db9d8e5eae72474c71c3c586f1f267d9b' }));
42
+ return (h(Host, { key: '63c58ee1d28c4866aa66d3dcf4893879de4d09f6' }));
43
43
  }
44
44
  renderGraph(initialDiagram) {
45
45
  var _a;
@@ -45,6 +45,41 @@ async function seedCanvas(context, seed, signal) {
45
45
  await model.requestData();
46
46
  await performLayout({ signal });
47
47
  }
48
+ /**
49
+ * Places a pre-resolved graph (e.g. a CONSTRUCT query result) on the canvas. The relationships
50
+ * are computed and not persisted in the repository, so the edges are drawn directly from the
51
+ * supplied data instead of being fetched. The node IRIs do exist in the repository, so only
52
+ * their display data is hydrated via {@link DataDiagramModel.requestElementData}.
53
+ *
54
+ * Note we use `requestElementData` rather than `requestData`: the latter would also query the
55
+ * provider for *all* persisted links between the seeded nodes, over-fetching beyond the
56
+ * CONSTRUCT's selection. Hydrating elements alone keeps the canvas to exactly the supplied
57
+ * edges, while further expansion continues lazily against the SPARQL provider.
58
+ */
59
+ async function seedGraphCanvas(context, links, signal) {
60
+ const { model, performLayout } = context;
61
+ const uniqueIris = new Set();
62
+ links.forEach((link) => {
63
+ var _a;
64
+ uniqueIris.add(link.source);
65
+ uniqueIris.add(link.target);
66
+ // this is a createOrGet, regardless of the name, so we don't need to worry about duplicates.
67
+ model.createElement(link.source);
68
+ model.createElement(link.target);
69
+ (_a = link.rawPredicates) === null || _a === void 0 ? void 0 : _a.forEach((predicate) => {
70
+ model.createLinks({
71
+ linkTypeId: predicate,
72
+ sourceId: link.source,
73
+ targetId: link.target,
74
+ properties: {}
75
+ });
76
+ });
77
+ });
78
+ // Request data only for elements.
79
+ // Link data is not available in the DB, since we are displaying construct/describe queries
80
+ await model.requestElementData(Array.from(uniqueIris));
81
+ await performLayout({ signal });
82
+ }
48
83
  /**
49
84
  * The Reactodia workspace React component.
50
85
  *
@@ -57,6 +92,7 @@ async function seedCanvas(context, seed, signal) {
57
92
  function ReactodiaApp(props) {
58
93
  const { language, initialDiagram, config } = props;
59
94
  const { onMount } = useLoadedWorkspace(async ({ context, signal }) => {
95
+ var _a, _b;
60
96
  workspaceContext = context;
61
97
  const { model } = context;
62
98
  const dataProvider = createDataProvider(props);
@@ -68,7 +104,10 @@ function ReactodiaApp(props) {
68
104
  }
69
105
  else {
70
106
  await model.createNewDiagram({ dataProvider, signal });
71
- if (config.seedIris) {
107
+ if ((_a = config.seedGraph) === null || _a === void 0 ? void 0 : _a.length) {
108
+ await seedGraphCanvas(context, config.seedGraph, signal);
109
+ }
110
+ else if ((_b = config.seedIris) === null || _b === void 0 ? void 0 : _b.length) {
72
111
  await seedCanvas(context, config.seedIris, signal);
73
112
  }
74
113
  }
@@ -6,6 +6,17 @@ async function stubQueryFunction(_params) {
6
6
  // IRIs of the entities the host asks to pre-populate the canvas with on startup.
7
7
  const SEED_NODES = ['http://example.com/alice', 'http://example.com/bob'];
8
8
 
9
+ // Pre-resolved edges (e.g. a CONSTRUCT result) the host asks to draw directly on the canvas,
10
+ // without querying the SPARQL endpoint for link data.
11
+ const SEED_GRAPH = [
12
+ {
13
+ source: 'http://example.com/alice',
14
+ target: 'http://example.com/bob',
15
+ predicates: ['knows'],
16
+ rawPredicates: ['http://example.com/knows'],
17
+ },
18
+ ];
19
+
9
20
  const reactodia = document.querySelector('graphwise-reactodia');
10
21
 
11
22
  function setQueryFunction() {
@@ -16,6 +27,10 @@ function setSeed() {
16
27
  reactodia.config = {...reactodia.config, seedIris: SEED_NODES};
17
28
  }
18
29
 
30
+ function setSeedGraph() {
31
+ reactodia.config = {...reactodia.config, seedGraph: SEED_GRAPH};
32
+ }
33
+
19
34
  function setRepository(repository) {
20
35
  reactodia.currentRepository = repository;
21
36
  }
@@ -30682,6 +30682,41 @@ async function seedCanvas(context, seed, signal) {
30682
30682
  await model.requestData();
30683
30683
  await performLayout({ signal });
30684
30684
  }
30685
+ /**
30686
+ * Places a pre-resolved graph (e.g. a CONSTRUCT query result) on the canvas. The relationships
30687
+ * are computed and not persisted in the repository, so the edges are drawn directly from the
30688
+ * supplied data instead of being fetched. The node IRIs do exist in the repository, so only
30689
+ * their display data is hydrated via {@link DataDiagramModel.requestElementData}.
30690
+ *
30691
+ * Note we use `requestElementData` rather than `requestData`: the latter would also query the
30692
+ * provider for *all* persisted links between the seeded nodes, over-fetching beyond the
30693
+ * CONSTRUCT's selection. Hydrating elements alone keeps the canvas to exactly the supplied
30694
+ * edges, while further expansion continues lazily against the SPARQL provider.
30695
+ */
30696
+ async function seedGraphCanvas(context, links, signal) {
30697
+ const { model, performLayout } = context;
30698
+ const uniqueIris = new Set();
30699
+ links.forEach((link) => {
30700
+ var _a;
30701
+ uniqueIris.add(link.source);
30702
+ uniqueIris.add(link.target);
30703
+ // this is a createOrGet, regardless of the name, so we don't need to worry about duplicates.
30704
+ model.createElement(link.source);
30705
+ model.createElement(link.target);
30706
+ (_a = link.rawPredicates) === null || _a === void 0 ? void 0 : _a.forEach((predicate) => {
30707
+ model.createLinks({
30708
+ linkTypeId: predicate,
30709
+ sourceId: link.source,
30710
+ targetId: link.target,
30711
+ properties: {}
30712
+ });
30713
+ });
30714
+ });
30715
+ // Request data only for elements.
30716
+ // Link data is not available in the DB, since we are displaying construct/describe queries
30717
+ await model.requestElementData(Array.from(uniqueIris));
30718
+ await performLayout({ signal });
30719
+ }
30685
30720
  /**
30686
30721
  * The Reactodia workspace React component.
30687
30722
  *
@@ -30694,6 +30729,7 @@ async function seedCanvas(context, seed, signal) {
30694
30729
  function ReactodiaApp(props) {
30695
30730
  const { language, initialDiagram, config } = props;
30696
30731
  const { onMount } = useLoadedWorkspace(async ({ context, signal }) => {
30732
+ var _a, _b;
30697
30733
  workspaceContext = context;
30698
30734
  const { model } = context;
30699
30735
  const dataProvider = createDataProvider(props);
@@ -30705,7 +30741,10 @@ function ReactodiaApp(props) {
30705
30741
  }
30706
30742
  else {
30707
30743
  await model.createNewDiagram({ dataProvider, signal });
30708
- if (config.seedIris) {
30744
+ if ((_a = config.seedGraph) === null || _a === void 0 ? void 0 : _a.length) {
30745
+ await seedGraphCanvas(context, config.seedGraph, signal);
30746
+ }
30747
+ else if ((_b = config.seedIris) === null || _b === void 0 ? void 0 : _b.length) {
30709
30748
  await seedCanvas(context, config.seedIris, signal);
30710
30749
  }
30711
30750
  }
@@ -30781,7 +30820,7 @@ const GraphwiseReactodia = class {
30781
30820
  const diagram = exportReactodiaLayout();
30782
30821
  this.renderGraph(diagram);
30783
30822
  }
30784
- componentDidLoad() {
30823
+ connectedCallback() {
30785
30824
  this.renderGraph();
30786
30825
  }
30787
30826
  disconnectedCallback() {
@@ -30791,7 +30830,7 @@ const GraphwiseReactodia = class {
30791
30830
  }
30792
30831
  }
30793
30832
  render() {
30794
- return (h(Host, { key: '8ef8d44db9d8e5eae72474c71c3c586f1f267d9b' }));
30833
+ return (h(Host, { key: '63c58ee1d28c4866aa66d3dcf4893879de4d09f6' }));
30795
30834
  }
30796
30835
  renderGraph(initialDiagram) {
30797
30836
  var _a;
@@ -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-5a330bae",[[0,"graphwise-reactodia",{currentRepository:[1,"current-repository"],config:[16],language:[1],providerSettings:[16,"provider-settings"]},null,{currentRepository:["onProviderSettingsChange"],providerSettings:["onProviderSettingsChange"],language:["onLanguageChange"]}]]]],e))));
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-eb362faa",[[0,"graphwise-reactodia",{currentRepository:[1,"current-repository"],config:[16],language:[1],providerSettings:[16,"provider-settings"]},null,{currentRepository:["onProviderSettingsChange"],providerSettings:["onProviderSettingsChange"],language:["onLanguageChange"]}]]]],e))));