graphwise-reactodia 0.0.1-TR8 → 0.0.1-blank-nodes-TR1
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 +203 -50
- package/dist/cjs/graphwise-reactodia.cjs.js +2 -2
- package/dist/cjs/{index-CII9aUQC.js → index-D1-Nmh_N.js} +111 -9
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/components/graphwise-reactodia/graphwise-reactodia.css +10 -2
- package/dist/collection/components/graphwise-reactodia/graphwise-reactodia.js +57 -8
- package/dist/collection/components/graphwise-reactodia/providers/service/service.js +19 -1
- package/dist/collection/components/graphwise-reactodia/providers/service/service.provider.js +5 -5
- package/dist/collection/components/graphwise-reactodia/reactodia-app.js +23 -7
- package/dist/collection/components/graphwise-reactodia/services/diagram/diagram.service.js +25 -10
- package/dist/collection/components/graphwise-reactodia/services/diagram-storage/diagram-storage.service.js +23 -10
- package/dist/collection/components/graphwise-reactodia/services/event/event.service.js +18 -5
- package/dist/collection/components/graphwise-reactodia/services/window/window.service.js +18 -2
- package/dist/collection/components/graphwise-reactodia/styles/type-style.resolver.js +53 -0
- package/dist/esm/graphwise-reactodia.entry.js +203 -50
- package/dist/esm/graphwise-reactodia.js +3 -3
- package/dist/esm/{index-Cypw7ydc.js → index-CKnLINf8.js} +112 -9
- package/dist/esm/loader.js +3 -3
- package/dist/graphwise-reactodia/graphwise-reactodia.esm.js +1 -1
- package/dist/graphwise-reactodia/p-3c085b73.entry.js +1 -0
- package/dist/graphwise-reactodia/p-CKnLINf8.js +2 -0
- package/dist/types/components/graphwise-reactodia/graphwise-reactodia.d.ts +14 -2
- package/dist/types/components/graphwise-reactodia/models/reactodia-app-props.d.ts +1 -1
- package/dist/types/components/graphwise-reactodia/providers/service/service-inject.d.ts +1 -1
- package/dist/types/components/graphwise-reactodia/providers/service/service.d.ts +25 -3
- package/dist/types/components/graphwise-reactodia/providers/service/service.provider.d.ts +2 -4
- package/dist/types/components/graphwise-reactodia/reactodia-app.d.ts +6 -0
- package/dist/types/components/graphwise-reactodia/services/diagram/diagram.service.d.ts +5 -7
- package/dist/types/components/graphwise-reactodia/services/diagram-storage/diagram-storage.service.d.ts +2 -2
- package/dist/types/components/graphwise-reactodia/services/event/event.service.d.ts +2 -2
- package/dist/types/components/graphwise-reactodia/services/window/window.service.d.ts +3 -3
- package/dist/types/components/graphwise-reactodia/styles/type-style.resolver.d.ts +11 -0
- package/dist/types/components.d.ts +10 -2
- package/package.json +1 -1
- package/dist/graphwise-reactodia/p-80cb6eef.entry.js +0 -1
- package/dist/graphwise-reactodia/p-Cypw7ydc.js +0 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index$1 = require('./index-
|
|
3
|
+
var index$1 = require('./index-D1-Nmh_N.js');
|
|
4
4
|
var index = require('./index.cjs.js');
|
|
5
5
|
|
|
6
6
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
@@ -6833,6 +6833,7 @@ var RdfSettings = {
|
|
|
6833
6833
|
openWorldLinks: false,
|
|
6834
6834
|
propertyConfigurations: [],
|
|
6835
6835
|
openWorldProperties: false,
|
|
6836
|
+
acceptBlankNodes: false,
|
|
6836
6837
|
linksInfoQuery: `SELECT ?source ?type ?target
|
|
6837
6838
|
WHERE {
|
|
6838
6839
|
\${linkConfigurations}
|
|
@@ -7036,7 +7037,7 @@ var SparqlDataProvider = class {
|
|
|
7036
7037
|
options;
|
|
7037
7038
|
settings;
|
|
7038
7039
|
queryFunction;
|
|
7039
|
-
acceptBlankNodes
|
|
7040
|
+
acceptBlankNodes;
|
|
7040
7041
|
chunkMeasure;
|
|
7041
7042
|
linkByPredicate = /* @__PURE__ */ new Map();
|
|
7042
7043
|
linkById = /* @__PURE__ */ new Map();
|
|
@@ -7052,6 +7053,7 @@ var SparqlDataProvider = class {
|
|
|
7052
7053
|
this.settings = settings;
|
|
7053
7054
|
this.queryFunction = queryFunction;
|
|
7054
7055
|
const { chunk, queryMethod = "GET", prepareLabelPredicate, prepareImagePredicate } = this.options;
|
|
7056
|
+
this.acceptBlankNodes = Boolean(settings.acceptBlankNodes);
|
|
7055
7057
|
if (chunk) {
|
|
7056
7058
|
if (!Number.isSafeInteger(chunk.maxSize)) throw new Error("SparqlDataProviderOptions.chunk.maxSize should be a non-negative number");
|
|
7057
7059
|
}
|
|
@@ -7081,6 +7083,17 @@ var SparqlDataProvider = class {
|
|
|
7081
7083
|
this.labelPredicate = prepareLabelPredicate ?? rdfs.label;
|
|
7082
7084
|
this.imagePredicate = prepareImagePredicate ?? schema.thumbnailUrl;
|
|
7083
7085
|
}
|
|
7086
|
+
/**
|
|
7087
|
+
* Sets whether blank nodes are allowed to appear as entities in the query results.
|
|
7088
|
+
*
|
|
7089
|
+
* The flag is read while a query is being built, so the change applies to every
|
|
7090
|
+
* subsequent request without recreating the provider.
|
|
7091
|
+
*
|
|
7092
|
+
* @see {@link SparqlDataProviderSettings.acceptBlankNodes}
|
|
7093
|
+
*/
|
|
7094
|
+
setAcceptBlankNodes(accept) {
|
|
7095
|
+
this.acceptBlankNodes = accept;
|
|
7096
|
+
}
|
|
7084
7097
|
async queryChunked(items, callback) {
|
|
7085
7098
|
const { maxSize, measure } = this.chunkMeasure;
|
|
7086
7099
|
const tasks = [];
|
|
@@ -30655,15 +30668,15 @@ class ServiceProvider {
|
|
|
30655
30668
|
/**
|
|
30656
30669
|
* Returns the instance of the given service type, creating and caching it on first request.
|
|
30657
30670
|
*
|
|
30658
|
-
* @param
|
|
30671
|
+
* @param serviceClass The service type to retrieve.
|
|
30659
30672
|
* @returns The shared instance of the service.
|
|
30660
30673
|
* @template T The type of the service to retrieve.
|
|
30661
30674
|
*/
|
|
30662
|
-
static get(
|
|
30663
|
-
if (!ServiceProvider.SERVICE_INSTANCES.has(
|
|
30664
|
-
ServiceProvider.SERVICE_INSTANCES.set(
|
|
30675
|
+
static get(serviceClass) {
|
|
30676
|
+
if (!ServiceProvider.SERVICE_INSTANCES.has(serviceClass.ID)) {
|
|
30677
|
+
ServiceProvider.SERVICE_INSTANCES.set(serviceClass.ID, new serviceClass());
|
|
30665
30678
|
}
|
|
30666
|
-
return ServiceProvider.SERVICE_INSTANCES.get(
|
|
30679
|
+
return ServiceProvider.SERVICE_INSTANCES.get(serviceClass.ID);
|
|
30667
30680
|
}
|
|
30668
30681
|
}
|
|
30669
30682
|
ServiceProvider.SERVICE_INSTANCES = new Map();
|
|
@@ -30683,13 +30696,42 @@ function service(serviceClass) {
|
|
|
30683
30696
|
return ServiceProvider.get(serviceClass);
|
|
30684
30697
|
}
|
|
30685
30698
|
|
|
30699
|
+
/**
|
|
30700
|
+
* Decorator for a service class.
|
|
30701
|
+
* It receives the class and simply type checks it with the {@link Service} interface.
|
|
30702
|
+
* Works as a contract, which enforces the service class to have a static ID member.
|
|
30703
|
+
* We can't simply implement the interface, since this will enforce the ID to be an instance member, which is not what we want.
|
|
30704
|
+
*
|
|
30705
|
+
* @param _serviceClass The decorated service class, checked for its ID and discarded.
|
|
30706
|
+
* @template T The type of the service instance.
|
|
30707
|
+
* @example
|
|
30708
|
+
* ```TypeScript
|
|
30709
|
+
* @Service
|
|
30710
|
+
* export class WindowService {
|
|
30711
|
+
* static readonly ID = 'WindowService';
|
|
30712
|
+
* }
|
|
30713
|
+
* ```
|
|
30714
|
+
*/
|
|
30715
|
+
function Service(_serviceClass) {
|
|
30716
|
+
// no implementation needed. We only use the type checking of the parameter
|
|
30717
|
+
}
|
|
30718
|
+
|
|
30719
|
+
var __decorate$3 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
30720
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
30721
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
30722
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
30723
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
30724
|
+
};
|
|
30725
|
+
var DiagramService_1;
|
|
30686
30726
|
/**
|
|
30687
30727
|
* Service for diagram related operations and subscriptions
|
|
30688
30728
|
*/
|
|
30689
|
-
class DiagramService {
|
|
30729
|
+
let DiagramService = DiagramService_1 = class DiagramService {
|
|
30690
30730
|
/**
|
|
30691
30731
|
* Subscribes to diagram changes. On every debounced change the current layout is
|
|
30692
|
-
* exported and passed to the callback
|
|
30732
|
+
* exported and passed to the callback.
|
|
30733
|
+
* Debounce time for the callback trigger is needed, because certain events (like moving a node) can trigger
|
|
30734
|
+
* multiple `historyChanged` events in a short time.
|
|
30693
30735
|
*
|
|
30694
30736
|
* @param model The diagram model to observe.
|
|
30695
30737
|
* @param onChangeCallback Called with the exported layout when the diagram changes.
|
|
@@ -30705,44 +30747,60 @@ class DiagramService {
|
|
|
30705
30747
|
notifyTimer = setTimeout(() => {
|
|
30706
30748
|
notifyTimer = undefined;
|
|
30707
30749
|
onChangeCallback(model.exportLayout());
|
|
30708
|
-
},
|
|
30750
|
+
}, DiagramService_1.NOTIFY_DEBOUNCE_MS);
|
|
30709
30751
|
};
|
|
30710
|
-
model.history.events.on(
|
|
30752
|
+
model.history.events.on(DiagramService_1.HISTORY_CHANGED_EVENT, onHistoryChange);
|
|
30711
30753
|
return () => {
|
|
30712
|
-
model.history.events.off(
|
|
30754
|
+
model.history.events.off(DiagramService_1.HISTORY_CHANGED_EVENT, onHistoryChange);
|
|
30713
30755
|
if (notifyTimer) {
|
|
30714
30756
|
clearTimeout(notifyTimer);
|
|
30715
30757
|
}
|
|
30716
30758
|
};
|
|
30717
30759
|
}
|
|
30718
|
-
}
|
|
30719
|
-
|
|
30720
|
-
* Debounce time for the callback trigger. This is needed, because certain events (like moving a node) can trigger
|
|
30721
|
-
* multiple `historyChanged` events in a short time.
|
|
30722
|
-
*/
|
|
30760
|
+
};
|
|
30761
|
+
DiagramService.ID = 'DiagramService';
|
|
30723
30762
|
DiagramService.NOTIFY_DEBOUNCE_MS = 300;
|
|
30724
30763
|
DiagramService.HISTORY_CHANGED_EVENT = 'historyChanged';
|
|
30725
|
-
|
|
30764
|
+
DiagramService = DiagramService_1 = __decorate$3([
|
|
30765
|
+
Service
|
|
30766
|
+
], DiagramService);
|
|
30767
|
+
|
|
30768
|
+
var __decorate$2 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
30769
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
30770
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
30771
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
30772
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
30773
|
+
};
|
|
30726
30774
|
/**
|
|
30727
30775
|
* Service that provides access to browser window-related functionality.
|
|
30728
30776
|
*/
|
|
30729
|
-
class WindowService {
|
|
30777
|
+
let WindowService = class WindowService {
|
|
30730
30778
|
getWindow() {
|
|
30731
30779
|
return window;
|
|
30732
30780
|
}
|
|
30733
|
-
}
|
|
30734
|
-
|
|
30781
|
+
};
|
|
30782
|
+
WindowService.ID = 'WindowService';
|
|
30783
|
+
WindowService = __decorate$2([
|
|
30784
|
+
Service
|
|
30785
|
+
], WindowService);
|
|
30786
|
+
|
|
30787
|
+
var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
30788
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
30789
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
30790
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
30791
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
30792
|
+
};
|
|
30793
|
+
var DiagramStorageService_1;
|
|
30735
30794
|
/**
|
|
30736
30795
|
* Service for local store-related diagram operations
|
|
30737
30796
|
*/
|
|
30738
|
-
class DiagramStorageService {
|
|
30797
|
+
let DiagramStorageService = DiagramStorageService_1 = class DiagramStorageService {
|
|
30739
30798
|
/**
|
|
30740
30799
|
* Load the persisted diagram from the local store, or `undefined` when nothing is stored (or the stored value
|
|
30741
30800
|
* is unreadable).
|
|
30742
30801
|
*/
|
|
30743
30802
|
load() {
|
|
30744
|
-
|
|
30745
|
-
const raw = (_a = this.storage) === null || _a === void 0 ? void 0 : _a.getItem(DiagramStorageService.STORAGE_KEY);
|
|
30803
|
+
const raw = this.storage.getItem(DiagramStorageService_1.STORAGE_KEY);
|
|
30746
30804
|
if (!raw) {
|
|
30747
30805
|
return undefined;
|
|
30748
30806
|
}
|
|
@@ -30752,31 +30810,38 @@ class DiagramStorageService {
|
|
|
30752
30810
|
* Persists the given diagram serialization.
|
|
30753
30811
|
*/
|
|
30754
30812
|
save(diagram) {
|
|
30755
|
-
|
|
30756
|
-
(_a = this.storage) === null || _a === void 0 ? void 0 : _a.setItem(DiagramStorageService.STORAGE_KEY, JSON.stringify(diagram));
|
|
30813
|
+
this.storage.setItem(DiagramStorageService_1.STORAGE_KEY, JSON.stringify(diagram));
|
|
30757
30814
|
}
|
|
30758
30815
|
/**
|
|
30759
30816
|
* Removes the persisted diagram. Used when a new view (a seed) should take precedence over
|
|
30760
30817
|
* previously saved edits.
|
|
30761
30818
|
*/
|
|
30762
30819
|
clear() {
|
|
30763
|
-
|
|
30764
|
-
(_a = this.storage) === null || _a === void 0 ? void 0 : _a.removeItem(DiagramStorageService.STORAGE_KEY);
|
|
30820
|
+
this.storage.removeItem(DiagramStorageService_1.STORAGE_KEY);
|
|
30765
30821
|
}
|
|
30766
30822
|
/**
|
|
30767
30823
|
* Local storage getter
|
|
30768
30824
|
*/
|
|
30769
30825
|
get storage() {
|
|
30770
|
-
|
|
30771
|
-
return (_a = service(WindowService).getWindow()) === null || _a === void 0 ? void 0 : _a.localStorage;
|
|
30826
|
+
return service(WindowService).getWindow().localStorage;
|
|
30772
30827
|
}
|
|
30773
|
-
}
|
|
30828
|
+
};
|
|
30829
|
+
DiagramStorageService.ID = 'DiagramStorageService';
|
|
30774
30830
|
DiagramStorageService.STORAGE_KEY = 'diagram.state';
|
|
30775
|
-
|
|
30831
|
+
DiagramStorageService = DiagramStorageService_1 = __decorate$1([
|
|
30832
|
+
Service
|
|
30833
|
+
], DiagramStorageService);
|
|
30834
|
+
|
|
30835
|
+
var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
30836
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
30837
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
30838
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
30839
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
30840
|
+
};
|
|
30776
30841
|
/**
|
|
30777
30842
|
* Service for event based operations
|
|
30778
30843
|
*/
|
|
30779
|
-
class EventService {
|
|
30844
|
+
let EventService = class EventService {
|
|
30780
30845
|
/**
|
|
30781
30846
|
* Subscribes to the host's "clear persisted diagram" command.
|
|
30782
30847
|
*
|
|
@@ -30785,13 +30850,14 @@ class EventService {
|
|
|
30785
30850
|
*/
|
|
30786
30851
|
subscribeToClearDiagramStorage(onClear) {
|
|
30787
30852
|
const target = service(WindowService).getWindow();
|
|
30788
|
-
if (!target) {
|
|
30789
|
-
return () => undefined;
|
|
30790
|
-
}
|
|
30791
30853
|
target.addEventListener(index.CLEAR_DIAGRAM_STORAGE_EVENT, onClear);
|
|
30792
30854
|
return () => target.removeEventListener(index.CLEAR_DIAGRAM_STORAGE_EVENT, onClear);
|
|
30793
30855
|
}
|
|
30794
|
-
}
|
|
30856
|
+
};
|
|
30857
|
+
EventService.ID = 'EventService';
|
|
30858
|
+
EventService = __decorate([
|
|
30859
|
+
Service
|
|
30860
|
+
], EventService);
|
|
30795
30861
|
|
|
30796
30862
|
/**
|
|
30797
30863
|
* A collection of {@link Subscription}s that can be released together. Components collect the
|
|
@@ -30829,6 +30895,60 @@ class SubscriptionList {
|
|
|
30829
30895
|
}
|
|
30830
30896
|
}
|
|
30831
30897
|
|
|
30898
|
+
const NODE_COLOR_VARIABLES = [
|
|
30899
|
+
'--gw-foreground-visual-diagram-categorical-01',
|
|
30900
|
+
'--gw-foreground-visual-diagram-categorical-02',
|
|
30901
|
+
'--gw-foreground-visual-diagram-categorical-03',
|
|
30902
|
+
'--gw-foreground-visual-diagram-categorical-04',
|
|
30903
|
+
'--gw-foreground-visual-diagram-categorical-05',
|
|
30904
|
+
'--gw-foreground-visual-diagram-categorical-06',
|
|
30905
|
+
'--gw-foreground-visual-diagram-categorical-07',
|
|
30906
|
+
'--gw-foreground-visual-diagram-categorical-08',
|
|
30907
|
+
'--gw-foreground-visual-diagram-categorical-09',
|
|
30908
|
+
'--gw-foreground-visual-diagram-categorical-10',
|
|
30909
|
+
'--gw-foreground-visual-diagram-categorical-11',
|
|
30910
|
+
'--gw-foreground-visual-diagram-categorical-12',
|
|
30911
|
+
'--gw-foreground-visual-diagram-categorical-13',
|
|
30912
|
+
'--gw-foreground-visual-diagram-categorical-14',
|
|
30913
|
+
'--gw-foreground-visual-diagram-categorical-15',
|
|
30914
|
+
'--gw-foreground-visual-diagram-categorical-16',
|
|
30915
|
+
'--gw-foreground-visual-diagram-categorical-17',
|
|
30916
|
+
'--gw-foreground-visual-diagram-categorical-18',
|
|
30917
|
+
'--gw-foreground-visual-diagram-categorical-19',
|
|
30918
|
+
'--gw-foreground-visual-diagram-categorical-20'
|
|
30919
|
+
];
|
|
30920
|
+
/**
|
|
30921
|
+
* Color slot assigned to each type, in the order the types are first seen.
|
|
30922
|
+
*/
|
|
30923
|
+
const typeToIndex = new Map();
|
|
30924
|
+
function getColor(variable) {
|
|
30925
|
+
return getComputedStyle(document.documentElement).getPropertyValue(variable).trim();
|
|
30926
|
+
}
|
|
30927
|
+
/**
|
|
30928
|
+
* Colors an element by its type: each type takes the next color from the palette, which wraps
|
|
30929
|
+
* around once it runs out
|
|
30930
|
+
*
|
|
30931
|
+
* Returns `undefined` for elements without a type (placeholders and other non-entity elements) and
|
|
30932
|
+
* when the host does not define the palette, leaving Reactodia to fall back to its own hash-based
|
|
30933
|
+
* colors.
|
|
30934
|
+
*/
|
|
30935
|
+
const resolveTypeStyle = (types) => {
|
|
30936
|
+
const type = types[0];
|
|
30937
|
+
if (!type) {
|
|
30938
|
+
return undefined;
|
|
30939
|
+
}
|
|
30940
|
+
let index = typeToIndex.get(type);
|
|
30941
|
+
if (index === undefined) {
|
|
30942
|
+
index = typeToIndex.size;
|
|
30943
|
+
typeToIndex.set(type, index);
|
|
30944
|
+
}
|
|
30945
|
+
const color = getColor(NODE_COLOR_VARIABLES[index % NODE_COLOR_VARIABLES.length]);
|
|
30946
|
+
return color ? { color } : undefined;
|
|
30947
|
+
};
|
|
30948
|
+
const resetColors = () => {
|
|
30949
|
+
typeToIndex.clear();
|
|
30950
|
+
};
|
|
30951
|
+
|
|
30832
30952
|
/**
|
|
30833
30953
|
* Reactodia ships English as its built-in default bundle, so English needs no override.
|
|
30834
30954
|
* Other languages are layered on top as partial bundles; unknown codes fall back to English.
|
|
@@ -30846,6 +30966,11 @@ function translationsForLanguage(language) {
|
|
|
30846
30966
|
* runs outside React and therefore cannot call the `useWorkspace` hook.
|
|
30847
30967
|
*/
|
|
30848
30968
|
let workspaceContext = null;
|
|
30969
|
+
/**
|
|
30970
|
+
* The data provider backing the current diagram, kept so runtime flags can be flipped on it
|
|
30971
|
+
* in place. Replaced whenever the provider is rebuilt.
|
|
30972
|
+
*/
|
|
30973
|
+
let activeDataProvider = null;
|
|
30849
30974
|
/**
|
|
30850
30975
|
* Active listeners that persist diagram edits to local storage. Populated when the workspace
|
|
30851
30976
|
* mounts and released in {@link unmountReactodia}, so persistence follows the same lifecycle as
|
|
@@ -30855,15 +30980,24 @@ const subscriptions = new SubscriptionList();
|
|
|
30855
30980
|
/**
|
|
30856
30981
|
* Builds a Reactodia {@link SparqlDataProvider} for the given endpoint using the supplied
|
|
30857
30982
|
* query preset. The host owns the query configuration and passes it in via props; when none
|
|
30858
|
-
* is provided we fall back to Reactodia's generic {@link
|
|
30983
|
+
* is provided we fall back to Reactodia's generic {@link OwlStatsSettings} OWL/RDFS preset.
|
|
30859
30984
|
*/
|
|
30860
30985
|
function createDataProvider(props) {
|
|
30861
30986
|
const { currentRepository, config, providerSettings } = props;
|
|
30862
|
-
|
|
30987
|
+
activeDataProvider = new SparqlDataProvider({
|
|
30863
30988
|
endpointUrl: currentRepository,
|
|
30864
30989
|
queryMethod: 'POST',
|
|
30865
30990
|
queryFunction: config.queryFunction
|
|
30866
|
-
}, providerSettings);
|
|
30991
|
+
}, Object.assign(Object.assign({}, OwlStatsSettings), providerSettings));
|
|
30992
|
+
return activeDataProvider;
|
|
30993
|
+
}
|
|
30994
|
+
/**
|
|
30995
|
+
* Flips the `acceptBlankNodes` flag on the live data provider. The flag is read while a query
|
|
30996
|
+
* is being built, so this applies to every subsequent request without recreating the provider
|
|
30997
|
+
* and without resetting the canvas.
|
|
30998
|
+
*/
|
|
30999
|
+
function setAcceptBlankNodes(accept) {
|
|
31000
|
+
activeDataProvider === null || activeDataProvider === void 0 ? void 0 : activeDataProvider.setAcceptBlankNodes(accept);
|
|
30867
31001
|
}
|
|
30868
31002
|
/**
|
|
30869
31003
|
* Places the seed entities on the canvas. Each IRI is added as a placeholder element, and data is then loaded for the
|
|
@@ -30951,7 +31085,7 @@ function ReactodiaApp(props) {
|
|
|
30951
31085
|
if (isReload) {
|
|
30952
31086
|
// Simply reload without using the current state. This may happen when the user switches the language at runtime.
|
|
30953
31087
|
// since there is no existing mechanism to re-translate the UI at runtime (not for the UI labels at least)
|
|
30954
|
-
await model.importLayout({ dataProvider, diagram: currentDiagram, signal });
|
|
31088
|
+
await model.importLayout({ dataProvider, diagram: currentDiagram, signal, validateLinks: true });
|
|
30955
31089
|
}
|
|
30956
31090
|
else if ((_a = config.seedIris) === null || _a === void 0 ? void 0 : _a.length) {
|
|
30957
31091
|
await seedIrisToCanvas(context, dataProvider, config.seedIris, signal);
|
|
@@ -30962,7 +31096,7 @@ function ReactodiaApp(props) {
|
|
|
30962
31096
|
else {
|
|
30963
31097
|
// Restore the previously saved layout when present, otherwise start empty. Either way this binds the
|
|
30964
31098
|
// data provider (savedDiagram is undefined -> empty diagram), so the unified search/lookup works.
|
|
30965
|
-
await model.importLayout({ dataProvider, diagram: savedDiagram, signal });
|
|
31099
|
+
await model.importLayout({ dataProvider, diagram: savedDiagram, signal, validateLinks: true });
|
|
30966
31100
|
}
|
|
30967
31101
|
}, [language]);
|
|
30968
31102
|
/**
|
|
@@ -30979,7 +31113,8 @@ function ReactodiaApp(props) {
|
|
|
30979
31113
|
ref: onMount,
|
|
30980
31114
|
defaultLayout: blockingDefaultLayout,
|
|
30981
31115
|
defaultLanguage: language,
|
|
30982
|
-
translations: translationsForLanguage(language)
|
|
31116
|
+
translations: translationsForLanguage(language),
|
|
31117
|
+
typeStyleResolver: resolveTypeStyle
|
|
30983
31118
|
}, reactExports.createElement(DefaultWorkspace, {}));
|
|
30984
31119
|
}
|
|
30985
31120
|
/**
|
|
@@ -31017,7 +31152,7 @@ function unmountReactodia(root) {
|
|
|
31017
31152
|
root.unmount();
|
|
31018
31153
|
}
|
|
31019
31154
|
|
|
31020
|
-
const graphwiseReactodiaCss = "graphwise-reactodia{display:
|
|
31155
|
+
const graphwiseReactodiaCss = "graphwise-reactodia{display:flex;flex-direction:column;width:100%;height:75vh}graphwise-reactodia .blank-nodes-toggle{display:flex;align-items:center;gap:4px;padding:4px 8px}graphwise-reactodia .reactodia-container{position:relative;flex:1;min-height:0;width:100%}";
|
|
31021
31156
|
|
|
31022
31157
|
const GraphwiseReactodia = class {
|
|
31023
31158
|
constructor(hostRef) {
|
|
@@ -31026,6 +31161,8 @@ const GraphwiseReactodia = class {
|
|
|
31026
31161
|
* UI language code (e.g. `en`, `fr`) for the Reactodia interface. Defaults to English.
|
|
31027
31162
|
*/
|
|
31028
31163
|
this.language = LanguageKey.EN;
|
|
31164
|
+
/** POC toggle for the provider's `acceptBlankNodes` flag. Internal, not part of the public API. */
|
|
31165
|
+
this.acceptBlankNodes = false;
|
|
31029
31166
|
}
|
|
31030
31167
|
onProviderSettingsChange() {
|
|
31031
31168
|
this.renderGraph();
|
|
@@ -31035,11 +31172,21 @@ const GraphwiseReactodia = class {
|
|
|
31035
31172
|
// to re-translate the UI is to re-create the graph.
|
|
31036
31173
|
this.renderGraph(true);
|
|
31037
31174
|
}
|
|
31175
|
+
onThemeChange() {
|
|
31176
|
+
resetColors();
|
|
31177
|
+
this.renderGraph(true);
|
|
31178
|
+
}
|
|
31038
31179
|
connectedCallback() {
|
|
31039
31180
|
if (this.config) {
|
|
31040
31181
|
this.renderGraph();
|
|
31041
31182
|
}
|
|
31042
31183
|
}
|
|
31184
|
+
// The graph container is only available after the first render, so the initial mount happens here.
|
|
31185
|
+
componentDidLoad() {
|
|
31186
|
+
if (this.config) {
|
|
31187
|
+
this.renderGraph();
|
|
31188
|
+
}
|
|
31189
|
+
}
|
|
31043
31190
|
disconnectedCallback() {
|
|
31044
31191
|
if (this.reactRoot) {
|
|
31045
31192
|
unmountReactodia(this.reactRoot);
|
|
@@ -31047,7 +31194,12 @@ const GraphwiseReactodia = class {
|
|
|
31047
31194
|
}
|
|
31048
31195
|
}
|
|
31049
31196
|
render() {
|
|
31050
|
-
return (index$1.h(index$1.Host, { key: '
|
|
31197
|
+
return (index$1.h(index$1.Host, { key: '65718a059757d2b18fde62002d5b050304830143' }, index$1.h("label", { key: '3b50b626a046366b3b705f8e430c04d88af436ca', class: "blank-nodes-toggle" }, index$1.h("input", { key: 'c81d4d27d8fec14ae1ed9333b4f21eb90e482bc5', type: "checkbox", "data-test": "accept-blank-nodes", checked: this.acceptBlankNodes, onChange: (event) => this.onAcceptBlankNodesChange(event) }), "Accept blank nodes"), index$1.h("div", { key: 'e1313a71ebf215cea2ef23917fb643dc7c74b014', class: "reactodia-container", ref: (element) => this.graphContainer = element })));
|
|
31198
|
+
}
|
|
31199
|
+
// Applied to the live provider, so the next query picks it up without rebuilding the diagram.
|
|
31200
|
+
onAcceptBlankNodesChange(event) {
|
|
31201
|
+
this.acceptBlankNodes = event.target.checked;
|
|
31202
|
+
setAcceptBlankNodes(this.acceptBlankNodes);
|
|
31051
31203
|
}
|
|
31052
31204
|
renderGraph(isReloading) {
|
|
31053
31205
|
var _a;
|
|
@@ -31057,7 +31209,7 @@ const GraphwiseReactodia = class {
|
|
|
31057
31209
|
if (!((_a = this.config) === null || _a === void 0 ? void 0 : _a.queryFunction)) {
|
|
31058
31210
|
throw new Error('config.queryFunction is required');
|
|
31059
31211
|
}
|
|
31060
|
-
if (!this.
|
|
31212
|
+
if (!this.graphContainer) {
|
|
31061
31213
|
return;
|
|
31062
31214
|
}
|
|
31063
31215
|
const props = {
|
|
@@ -31065,20 +31217,21 @@ const GraphwiseReactodia = class {
|
|
|
31065
31217
|
currentRepository: this.currentRepository,
|
|
31066
31218
|
config: this.config,
|
|
31067
31219
|
language: this.language,
|
|
31068
|
-
|
|
31220
|
+
// Carried through so a rebuilt provider keeps whatever the toggle is currently set to.
|
|
31221
|
+
providerSettings: Object.assign(Object.assign({}, this.providerSettings), { acceptBlankNodes: this.acceptBlankNodes }),
|
|
31069
31222
|
};
|
|
31070
31223
|
if (this.reactRoot && !isReloading) {
|
|
31071
31224
|
void updateReactodia(props);
|
|
31072
31225
|
}
|
|
31073
31226
|
else {
|
|
31074
|
-
this.reactRoot = mountReactodia(this.
|
|
31227
|
+
this.reactRoot = mountReactodia(this.graphContainer, props);
|
|
31075
31228
|
}
|
|
31076
31229
|
}
|
|
31077
|
-
get hostElement() { return index$1.getElement(this); }
|
|
31078
31230
|
static get watchers() { return {
|
|
31079
31231
|
"currentRepository": ["onProviderSettingsChange"],
|
|
31080
31232
|
"providerSettings": ["onProviderSettingsChange"],
|
|
31081
|
-
"language": ["onLanguageChange"]
|
|
31233
|
+
"language": ["onLanguageChange"],
|
|
31234
|
+
"theme": ["onThemeChange"]
|
|
31082
31235
|
}; }
|
|
31083
31236
|
};
|
|
31084
31237
|
GraphwiseReactodia.style = graphwiseReactodiaCss;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-D1-Nmh_N.js');
|
|
4
4
|
var appGlobals = require('./app-globals-CcJr5lkF.js');
|
|
5
5
|
|
|
6
6
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
@@ -19,7 +19,7 @@ var patchBrowser = () => {
|
|
|
19
19
|
|
|
20
20
|
patchBrowser().then(async (options) => {
|
|
21
21
|
await appGlobals.globalScripts();
|
|
22
|
-
return index.bootstrapLazy([["graphwise-reactodia.cjs",[[0,"graphwise-reactodia",{"currentRepository":[1,"current-repository"],"config":[16],"language":[1],"providerSettings":[16,"provider-settings"]},null,{"currentRepository":["onProviderSettingsChange"],"providerSettings":["onProviderSettingsChange"],"language":["onLanguageChange"]}]]]], options);
|
|
22
|
+
return index.bootstrapLazy([["graphwise-reactodia.cjs",[[0,"graphwise-reactodia",{"currentRepository":[1,"current-repository"],"config":[16],"language":[1],"providerSettings":[16,"provider-settings"],"theme":[1],"acceptBlankNodes":[32]},null,{"currentRepository":["onProviderSettingsChange"],"providerSettings":["onProviderSettingsChange"],"language":["onLanguageChange"],"theme":["onThemeChange"]}]]]], options);
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
exports.setNonce = index.setNonce;
|