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
@@ -1,32 +1,37 @@
1
- import { SparqlDataProviderSettings, SparqlQueryFunction } from '@reactodia/workspace';
1
+ import { SparqlDataProviderSettings } from '@reactodia/workspace';
2
+ import { LanguageKey } from './i18n/language-key';
3
+ import { ReactodiaConfig } from './models/reactodia-config';
2
4
  /**
3
5
  * A web component that renders a graph with the Reactodia workspace.
4
6
  *
5
7
  * The component is backed by a SPARQL endpoint but is endpoint-agnostic: the host passes
6
- * the active repository's endpoint via `current-repository` and a `queryFunction` that
7
- * performs the actual HTTP request. Reactodia fetches all node, link and type data lazily
8
- * through them; the canvas starts empty and the user populates it via the search bar.
8
+ * the active repository's endpoint via `current-repository` and a `config.queryFunction`
9
+ * that performs the actual HTTP request. Reactodia fetches all node, link and type data
10
+ * lazily through them; the canvas starts empty and the user populates it via the search bar.
9
11
  *
10
12
  * The component is a thin wrapper around Reactodia: query configuration lives outside the
11
13
  * wrapper and is supplied through the `providerSettings` prop.
12
14
  */
13
15
  export declare class GraphwiseReactodia {
14
- private readonly hostElement;
16
+ private readonly hostElement?;
15
17
  /**
16
18
  * The active repository id. Appended to {@link queryFunction} as the request `url`;
17
19
  * changing it re-points the graph at the new repository (and resets the canvas),
18
20
  * which is how runtime repository changes are handled.
19
21
  */
20
- currentRepository: string;
22
+ currentRepository?: string;
21
23
  /**
22
- * HTTP transport for the SPARQL requests. Set by the host so requests go through the host's HTTP layer (auth,
23
- * interceptors) instead of a built-in `fetch`.
24
+ * Host-supplied configuration: the SPARQL `queryFunction` transport and an optional `seed`
25
+ * set of entities to pre-populate the canvas with. A DOM property (an object, not an
26
+ * attribute) passed in from outside the wrapper.
27
+ *
28
+ * Read once on mount; not watched, as it only sets up the data source and initial canvas.
24
29
  */
25
- queryFunction: SparqlQueryFunction;
30
+ config?: ReactodiaConfig;
26
31
  /**
27
32
  * UI language code (e.g. `en`, `fr`) for the Reactodia interface. Defaults to English.
28
33
  */
29
- language: string;
34
+ language: LanguageKey;
30
35
  /**
31
36
  * Query preset for the SPARQL data provider, owned and configured by the host. A DOM
32
37
  * property (an object, not an attribute) passed in from outside the wrapper. When omitted,
@@ -34,10 +39,18 @@ export declare class GraphwiseReactodia {
34
39
  * the data provider and resets the canvas.
35
40
  */
36
41
  providerSettings?: SparqlDataProviderSettings;
37
- private reactRoot;
42
+ /**
43
+ * The theme currently applied by the host (e.g. `light`, `dark`). The value itself is never read -
44
+ * the node colors are taken from the host's CSS custom properties - it only signals that those
45
+ * values have changed. The host owns the theme, including whether it follows the OS color scheme,
46
+ * so the change is passed in instead of being detected here.
47
+ */
48
+ theme?: string;
49
+ private reactRoot?;
38
50
  onProviderSettingsChange(): void;
39
51
  onLanguageChange(): void;
40
- componentDidLoad(): void;
52
+ onThemeChange(): void;
53
+ connectedCallback(): void;
41
54
  disconnectedCallback(): void;
42
55
  render(): any;
43
56
  private renderGraph;
@@ -0,0 +1,4 @@
1
+ export declare enum LanguageKey {
2
+ EN = "en",
3
+ FR = "fr"
4
+ }
@@ -1,343 +1,2 @@
1
- export declare const TRANSLATIONS: {
2
- fr: {
3
- authoring_state: {
4
- "entity_action_delete.label": string;
5
- "entity_action_delete.title": string;
6
- "entity_action_delete.title_disabled": string;
7
- "entity_action_discard.label": string;
8
- "entity_action_discard.title": string;
9
- "entity_action_edit.label": string;
10
- "entity_action_edit.title": string;
11
- "entity_action_edit.title_disabled": string;
12
- "entity_add.label": string;
13
- "entity_change.label": string;
14
- "entity_delete.label": string;
15
- "relation_action_discard.label": string;
16
- "relation_action_discard.title": string;
17
- "relation_add.label": string;
18
- "relation_change.label": string;
19
- "relation_delete.label": string;
20
- };
21
- classic_workspace: {
22
- "canvas.label": string;
23
- "class_tree.heading": string;
24
- "connections.heading": string;
25
- "instances.heading": string;
26
- };
27
- commands: {
28
- "change_entity.title": string;
29
- "change_link_type_visibility.title": string;
30
- "change_relation.title": string;
31
- "collapse_element.title": string;
32
- "expand_element.title": string;
33
- "place_elements_around.title": string;
34
- "restore_geometry.title": string;
35
- "restore_link_vertices.title": string;
36
- "restore_viewport.title": string;
37
- "set_element_state.title": string;
38
- "set_entity_data.title": string;
39
- "set_entity_group_items.title": string;
40
- "set_link_state.title": string;
41
- "set_relation_data.title": string;
42
- "set_relation_group_items.title": string;
43
- "transform_elements.title": string;
44
- };
45
- connections_menu: {
46
- "all_link.label": string;
47
- "breadcrumbs_root.label": string;
48
- "dialog.caption": string;
49
- "entities.add_all": string;
50
- "entities.add_group": string;
51
- "entities.add_selected": string;
52
- "entities.counter_label": string;
53
- "entities.extra_label": string;
54
- "entities.extra_title": string;
55
- "entities.missing_label": string;
56
- "entities.missing_title": string;
57
- "entities.no_results": string;
58
- "entities.truncated_results": string;
59
- "entities.truncated_results_expand": string;
60
- "input.placeholder": any;
61
- "link.both_navigate_title": string;
62
- "link.both_title": string;
63
- "link.source_navigate_title": string;
64
- "link.source_title": string;
65
- "link.target_navigate_title": string;
66
- "link.target_title": string;
67
- "link.move_to_filter.title": string;
68
- "links.no_results": string;
69
- "links.suggest_similar": string;
70
- "place_elements.command": string;
71
- "select_all.label": string;
72
- "select_all.title": string;
73
- "sort_alphabetically.title": string;
74
- "sort_smart.title": string;
75
- };
76
- data_diagram_model: {
77
- "add_element.command": string;
78
- "add_link.command": string;
79
- "create_links.command": string;
80
- "group_entities.command": string;
81
- "import_layout.command": string;
82
- "regroup_relations.command": string;
83
- "request_entities.command": string;
84
- "request_relations.command": string;
85
- "remove_element.command": string;
86
- "remove_link.command": string;
87
- "ungroup_entities.command": string;
88
- };
89
- default_data_locale: {
90
- iri: string;
91
- iri_blank: string;
92
- };
93
- default_workspace: {
94
- "search_section_entities.label": string;
95
- "search_section_entities.title": string;
96
- "search_section_entity_types.label": string;
97
- "search_section_entity_types.title": string;
98
- "search_section_link_types.label": string;
99
- "search_section_link_types.title": string;
100
- };
101
- drop_on_canvas: {
102
- "drop.command": string;
103
- };
104
- editor_controller: {
105
- "apply_authored_changes.command": string;
106
- "discard_change.command": string;
107
- "entity_add.command": string;
108
- "entity_change.command": string;
109
- "entity_delete.command": string;
110
- "relation_add.command": string;
111
- "relation_change.command": string;
112
- "relation_delete.command": string;
113
- "relation_move_source.command": string;
114
- "relation_move_target.command": string;
115
- "remove_items.command": string;
116
- "set_authoring_state.command": string;
117
- "validate_entity_failed.message": string;
118
- };
119
- forms: {
120
- "input_file.drag_hint": string;
121
- "input_file.remove_value.title": string;
122
- "input_file.select_files.label": string;
123
- "input_list.add_value.title": string;
124
- "input_list.remove_value.title": string;
125
- };
126
- group_paginator: {
127
- "current_page.label": string;
128
- "go_next.title": string;
129
- "go_previous.title": string;
130
- "page_size.title": string;
131
- };
132
- inline_entity: {
133
- title: string;
134
- title_extra: string;
135
- };
136
- link_action: {
137
- "delete_annotation.title": string;
138
- "delete_relation.title": string;
139
- "delete_relation.title_disabled": string;
140
- "edit_relation.title": string;
141
- "edit_relation.title_disabled": string;
142
- "rename_link.title": string;
143
- "move_relation.move_source_title": string;
144
- "move_relation.move_target_title": string;
145
- "vertex.remove_title": string;
146
- };
147
- navigator: {
148
- "toggle_collapse.title": string;
149
- "toggle_expand.title": string;
150
- };
151
- note_annotation: {
152
- "change_text.command": string;
153
- "style_align_center.title": string;
154
- "style_align_left.title": string;
155
- "style_align_right.title": string;
156
- "style_bold.title": string;
157
- "style_color_variant.title": string;
158
- "style_italic.title": string;
159
- "style_strikethrough.title": string;
160
- "style_underline.title": string;
161
- };
162
- overlay_controller: {
163
- multiple_tasks_in_progress: string;
164
- unknown_error: string;
165
- };
166
- search_defaults: {
167
- empty_input_term: string;
168
- "input.placeholder": string;
169
- "input_clear.title": string;
170
- "input_submit.title": string;
171
- input_term_too_short: string;
172
- no_results: string;
173
- };
174
- search_element_types: {
175
- "drag_create.title": string;
176
- "input.placeholder": any;
177
- no_results: string;
178
- "refresh_progress.title": string;
179
- show_only_creatable: string;
180
- };
181
- search_entities: {
182
- "add_group.label": string;
183
- "add_group.title": string;
184
- "add_selected.label": string;
185
- "add_selected.title": string;
186
- criteria_has_type: string;
187
- criteria_connected: string;
188
- criteria_connected_via: string;
189
- criteria_connected_to_source: string;
190
- criteria_connected_to_target: string;
191
- "input.placeholder": any;
192
- "place_elements.command": string;
193
- "query_progress.title": string;
194
- "show_more_results.label": string;
195
- "show_more_results.title": string;
196
- };
197
- search_link_types: {
198
- "add_to_filter.title": string;
199
- heading_connected: string;
200
- heading_connected_single: string;
201
- heading_other: string;
202
- "input.placeholder": any;
203
- no_results: string;
204
- "switch.command": string;
205
- "switch_all.label": string;
206
- "switch_hidden.title": string;
207
- "switch_visible.title": string;
208
- "switch_without_label.title": string;
209
- };
210
- selection_action: {
211
- "add_to_filter.title": string;
212
- "anchor.title": string;
213
- "annotate.defaultContent": string;
214
- "annotate.title": string;
215
- "connections.title": string;
216
- "expand.collapse_command": string;
217
- "expand.expand_command": string;
218
- "expand.title": string;
219
- "expand.title_single": string;
220
- "establish_relation.title": string;
221
- "establish_relation.title_disabled": string;
222
- "group.title": string;
223
- "group.title_ungroup": string;
224
- "layout.title": string;
225
- "remove.title": string;
226
- "remove.title_new": string;
227
- "remove.title_single": string;
228
- "zoom_to_fit.title": string;
229
- };
230
- standard_element: {
231
- blank_node: string;
232
- default_type: string;
233
- "delete.label": string;
234
- "delete.title": string;
235
- "delete.title_disabled": string;
236
- "edit.label": string;
237
- "edit.title": string;
238
- "edit.title_disabled": string;
239
- "group_item.title": string;
240
- "iri.label": string;
241
- "iri.label_modified": string;
242
- no_properties: string;
243
- "property.title": string;
244
- "ungroup.title": string;
245
- };
246
- standard_link: {
247
- "group_source.title": string;
248
- "group_source.value": string;
249
- "group_target.title": string;
250
- "group_target.value": string;
251
- "label.title": string;
252
- "property.title": string;
253
- };
254
- toolbar: {
255
- "menu_toggle.title": string;
256
- };
257
- toolbar_action: {
258
- "clear_all.command": string;
259
- "clear_all.title": string;
260
- "clear_all.label": string;
261
- "export_print.label": string;
262
- "export_print.title": string;
263
- "export_raster.label": string;
264
- "export_raster.title": string;
265
- "export_svg.label": string;
266
- "export_svg.title": string;
267
- "redo.label": string;
268
- "redo.title": string;
269
- "redo.title_named": string;
270
- "save_authoring.title": string;
271
- "save_layout.title": string;
272
- "language_selector.title": string;
273
- "layout.label": string;
274
- "layout.title": string;
275
- "undo.label": string;
276
- "undo.title": string;
277
- "undo.title_named": string;
278
- };
279
- unified_search: {
280
- "input.placeholder": any;
281
- "input_clear.title": string;
282
- "input_collapse.title": string;
283
- };
284
- visual_authoring: {
285
- "dialog.apply.label": string;
286
- "dialog.apply.title": string;
287
- "dialog.cancel.label": string;
288
- "dialog.cancel.title": string;
289
- "edit_entity.dialog.apply.label": any;
290
- "edit_entity.dialog.apply.title": any;
291
- "edit_entity.dialog.caption": string;
292
- "edit_entity.iri.label": string;
293
- "edit_entity.iri.placeholder": string;
294
- "edit_relation.dialog.apply.label": any;
295
- "edit_relation.dialog.apply.title": any;
296
- "edit_relation.dialog.caption": string;
297
- "edit_relation.dialog.caption_new": string;
298
- "edit_relation.validation_progress.title": string;
299
- "find_or_create.connect_command": string;
300
- "find_or_create.create_command": string;
301
- "find_or_create.dialog.apply.label": any;
302
- "find_or_create.dialog.apply.title": any;
303
- "find_or_create.dialog.caption": string;
304
- "find_or_create.loading.label": string;
305
- "find_or_create.validation_progress.title": string;
306
- "property.label": string;
307
- "property.text_value.placeholder": string;
308
- "property.title": string;
309
- "rename_link.dialog.apply.label": any;
310
- "rename_link.dialog.apply.title": any;
311
- "rename_link.dialog.caption": string;
312
- "rename_link.label.label": string;
313
- "select_entity.entity_type.label": string;
314
- "select_entity.input.placeholder": any;
315
- "select_entity.type.label": string;
316
- "select_entity.type.placeholder": string;
317
- "select_entity.results.aria_label": string;
318
- "select_entity.separator.label": string;
319
- "select_entity.validation.error_required": string;
320
- "select_relation.relation_type.label": string;
321
- "select_relation.type.label": string;
322
- "select_relation.type.placeholder": string;
323
- "select_relation.validation.error_duplicate": string;
324
- "select_relation.validation.error_required": string;
325
- };
326
- workspace: {
327
- "group_entities.command": string;
328
- "perform_layout.task": string;
329
- "perform_layout.command": string;
330
- "ungroup_entities.command": string;
331
- };
332
- workspace_layout: {
333
- "toggle_collapse.title": string;
334
- "toggle_expand.title": string;
335
- };
336
- zoom_control: {
337
- "pointer_mode.title": string;
338
- "zoom_in.title": string;
339
- "zoom_out.title": string;
340
- "zoom_to_fit.title": string;
341
- };
342
- };
343
- };
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,34 +1,35 @@
1
- import { SerializedDiagram, SparqlDataProviderSettings, SparqlQueryFunction } from '@reactodia/workspace';
1
+ import { SparqlDataProviderSettings } from '@reactodia/workspace';
2
+ import { LanguageKey } from '../i18n/language-key';
3
+ import { ReactodiaConfig } from './reactodia-config';
2
4
  /**
3
5
  * Props for the internal Reactodia React application.
4
6
  */
5
7
  export interface ReactodiaAppProps {
6
8
  /**
7
9
  * The active repository id. Passed to the SPARQL data provider as its `endpointUrl` and
8
- * surfaced to {@link queryFunction} as the request `url`, which the host transport uses to
9
- * target the repository. Changing it re-points the diagram at a different repository.
10
+ * surfaced to the {@link ReactodiaConfig.queryFunction} as the request `url`, which the host
11
+ * transport uses to target the repository. Changing it re-points the diagram at a different
12
+ * repository.
10
13
  */
11
14
  currentRepository: string;
12
15
  /**
13
- * Transport for the SPARQL requests. The host owns the connection (auth, interceptors,
14
- * base URL) inside this function; Reactodia delegates every SPARQL call to it instead
15
- * of using the built-in `fetch`.
16
+ * Host-supplied configuration read once on mount: the SPARQL transport and the optional
17
+ * set of entities to pre-populate the canvas with.
16
18
  */
17
- queryFunction: SparqlQueryFunction;
19
+ config: ReactodiaConfig;
18
20
  /**
19
21
  * UI language code (e.g. `en`, `fr`); selects the Reactodia translation bundle
20
22
  * and is also used as the initial graph-data language.
21
23
  */
22
- language: string;
23
- /**
24
- * A previously exported diagram to restore on mount. Used to carry the user's current
25
- * canvas across a remount (e.g. forced by a language change). When omitted, the canvas
26
- * starts empty.
27
- */
28
- initialDiagram?: SerializedDiagram;
24
+ language: LanguageKey;
29
25
  /**
30
26
  * Query preset for the SPARQL data provider, owned and configured by the host. Falls back
31
27
  * to Reactodia's generic `OwlRdfsSettings` OWL/RDFS preset when omitted.
32
28
  */
33
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;
34
35
  }
@@ -0,0 +1,31 @@
1
+ import { SparqlQueryFunction } from '@reactodia/workspace';
2
+ import { Triple } from './triple';
3
+ /**
4
+ * Host-supplied configuration read once when the workspace mounts (not reactive).
5
+ *
6
+ * Groups the inputs the host wires up before the graph is created: the SPARQL transport
7
+ * and the optional set of entities to pre-populate the canvas with. Passed to the
8
+ * `graphwise-reactodia` component as a single DOM property (an object, not an attribute).
9
+ */
10
+ export interface ReactodiaConfig {
11
+ /**
12
+ * HTTP transport for the SPARQL requests. Set by the host so requests go through the host's
13
+ * HTTP layer (auth, interceptors) instead of a built-in `fetch`.
14
+ */
15
+ queryFunction: SparqlQueryFunction;
16
+ /**
17
+ * IRIs of the elements(nodes) to place on the canvas on startup. When provided, each IRI is added
18
+ * as an element and its data (labels, types, properties) and links are resolved from the
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 for both elements and links, so if the resources are not in the DB, then this approach will not work.
21
+ * (e.g. in the case of a construct query)
22
+ */
23
+ seedIris?: string[];
24
+ /**
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
29
+ */
30
+ seedGraph?: Triple[];
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
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * A subscription: calling it unsubscribes (removes the underlying listener).
3
+ */
4
+ export type Subscription = () => void;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * A pre-resolved edge to place on the canvas on startup, mirroring GraphDB's
3
+ * `rest/explore-graph` link shape. Used to visualize the result of a CONSTRUCT query, whose
4
+ * relationships are computed and therefore not persisted in the repository, so they cannot be
5
+ * fetched lazily through the SPARQL provider and must be supplied directly.
6
+ *
7
+ * The host adapts its source data into this neutral shape (e.g. the workbench maps the
8
+ * `rest/explore-graph/graph` response onto {@link rawPredicates}).
9
+ */
10
+ export interface Triple {
11
+ /** Source element IRI. */
12
+ source: string;
13
+ /** Target element IRI. */
14
+ target: string;
15
+ /**
16
+ * Full (absolute) predicate IRIs.
17
+ */
18
+ rawPredicates: string[];
19
+ }
@@ -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>(serviceClass: Service<T>): T;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Interface for injectable services by the service provider. Each service needs to have a static unique ID, which
3
+ * is used by the {@link ServiceProvider} to cache and retrieve the singleton instance of the service. Unique IDs ensure
4
+ * correct working of the service provider, when the services are minified
5
+ *
6
+ * @template T the type of the service
7
+ */
8
+ export interface Service<T> {
9
+ readonly ID: string;
10
+ new (): T;
11
+ }
12
+ /**
13
+ * Decorator for a service class.
14
+ * It receives the class and simply type checks it with the {@link Service} interface.
15
+ * Works as a contract, which enforces the service class to have a static ID member.
16
+ * We can't simply implement the interface, since this will enforce the ID to be an instance member, which is not what we want.
17
+ *
18
+ * @param _serviceClass The decorated service class, checked for its ID and discarded.
19
+ * @template T The type of the service instance.
20
+ * @example
21
+ * ```TypeScript
22
+ * @Service
23
+ * export class WindowService {
24
+ * static readonly ID = 'WindowService';
25
+ * }
26
+ * ```
27
+ */
28
+ export declare function Service<T>(_serviceClass: Service<T>): void;
@@ -0,0 +1,16 @@
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 serviceClass 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>(serviceClass: Service<T>): T;
16
+ }
@@ -0,0 +1,26 @@
1
+ import type { DataDiagramModel, SerializedDiagram } from '@reactodia/workspace';
2
+ import { Subscription } from '../../models/subscription';
3
+ /**
4
+ * Callback invoked with the current diagram layout whenever it changes.
5
+ */
6
+ export type DiagramChangeCallback = (diagram: SerializedDiagram) => void;
7
+ /**
8
+ * Service for diagram related operations and subscriptions
9
+ */
10
+ export declare class DiagramService {
11
+ static readonly ID = "DiagramService";
12
+ private static readonly NOTIFY_DEBOUNCE_MS;
13
+ private static readonly HISTORY_CHANGED_EVENT;
14
+ /**
15
+ * Subscribes to diagram changes. On every debounced change the current layout is
16
+ * exported and passed to the callback.
17
+ * Debounce time for the callback trigger is needed, because certain events (like moving a node) can trigger
18
+ * multiple `historyChanged` events in a short time.
19
+ *
20
+ * @param model The diagram model to observe.
21
+ * @param onChangeCallback Called with the exported layout when the diagram changes.
22
+ * @returns A {@link Subscription} that, when called, removes the listener and drops any
23
+ * pending notification.
24
+ */
25
+ subscribeToDiagramChange(model: DataDiagramModel, onChangeCallback: DiagramChangeCallback): Subscription;
26
+ }