graphwise-reactodia 0.0.1-TR2 → 0.0.1-TR20

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 (117) hide show
  1. package/COPYING +674 -0
  2. package/COPYING.LESSER +165 -0
  3. package/NOTICE +41 -0
  4. package/README.md +225 -1
  5. package/dist/cjs/graphwise-reactodia.cjs.entry.js +28519 -41232
  6. package/dist/cjs/graphwise-reactodia.cjs.js +2 -2
  7. package/dist/cjs/{index-CII9aUQC.js → index-DtzCybH4.js} +16 -0
  8. package/dist/cjs/index.cjs.js +29 -0
  9. package/dist/cjs/loader.cjs.js +2 -2
  10. package/dist/cjs/node-action-DkJ5ct17.js +96 -0
  11. package/dist/collection/components/graphwise-reactodia/graphwise-reactodia.css +57 -1
  12. package/dist/collection/components/graphwise-reactodia/graphwise-reactodia.js +135 -40
  13. package/dist/collection/components/graphwise-reactodia/i18n/language-key.js +5 -0
  14. package/dist/collection/components/graphwise-reactodia/i18n/translations.js +6 -1
  15. package/dist/collection/components/graphwise-reactodia/menu/export-diagram-action.js +19 -0
  16. package/dist/collection/components/graphwise-reactodia/menu/graphwise-menu.js +24 -0
  17. package/dist/collection/components/graphwise-reactodia/menu/import-diagram-action.js +31 -0
  18. package/dist/collection/components/graphwise-reactodia/models/clear-diagram-storage-event.js +5 -0
  19. package/dist/collection/components/graphwise-reactodia/models/error/error-cause.js +1 -0
  20. package/dist/collection/components/graphwise-reactodia/models/error/error-code.js +20 -0
  21. package/dist/collection/components/graphwise-reactodia/models/error/error-report.js +1 -0
  22. package/dist/collection/components/graphwise-reactodia/models/event/event-callback.js +1 -0
  23. package/dist/collection/components/graphwise-reactodia/models/event/event-detail.js +4 -0
  24. package/dist/collection/components/graphwise-reactodia/models/event/event-type.js +8 -0
  25. package/dist/collection/components/graphwise-reactodia/models/reactodia-config.js +1 -0
  26. package/dist/collection/components/graphwise-reactodia/models/sparql/sparql-query-function.js +1 -0
  27. package/dist/collection/components/graphwise-reactodia/models/sparql/sparql-query-params.js +1 -0
  28. package/dist/collection/components/graphwise-reactodia/models/subscription-list.js +35 -0
  29. package/dist/collection/components/graphwise-reactodia/models/subscription.js +1 -0
  30. package/dist/collection/components/graphwise-reactodia/models/triple.js +1 -0
  31. package/dist/collection/components/graphwise-reactodia/models/ui/menu-config.js +1 -0
  32. package/dist/collection/components/graphwise-reactodia/models/ui/menu-item.js +18 -0
  33. package/dist/collection/components/graphwise-reactodia/models/ui/node-action.js +22 -0
  34. package/dist/collection/components/graphwise-reactodia/models/ui/resolved-toolbar-position.js +1 -0
  35. package/dist/collection/components/graphwise-reactodia/models/ui/resolved-ui-config.js +1 -0
  36. package/dist/collection/components/graphwise-reactodia/models/ui/toolbar-dock.js +14 -0
  37. package/dist/collection/components/graphwise-reactodia/models/ui/toolbar-position.js +1 -0
  38. package/dist/collection/components/graphwise-reactodia/models/ui/ui-config.js +1 -0
  39. package/dist/collection/components/graphwise-reactodia/node-action/node-actions.js +22 -0
  40. package/dist/collection/components/graphwise-reactodia/providers/service/service-inject.js +15 -0
  41. package/dist/collection/components/graphwise-reactodia/providers/service/service.js +19 -0
  42. package/dist/collection/components/graphwise-reactodia/providers/service/service.provider.js +20 -0
  43. package/dist/collection/components/graphwise-reactodia/reactodia-app.js +188 -26
  44. package/dist/collection/components/graphwise-reactodia/services/diagram/diagram.service.js +71 -0
  45. package/dist/collection/components/graphwise-reactodia/services/diagram-file/diagram-file.service.js +68 -0
  46. package/dist/collection/components/graphwise-reactodia/services/diagram-storage/diagram-storage.service.js +71 -0
  47. package/dist/collection/components/graphwise-reactodia/services/error/error.service.js +78 -0
  48. package/dist/collection/components/graphwise-reactodia/services/event/event.service.js +58 -0
  49. package/dist/collection/components/graphwise-reactodia/services/window/window.service.js +24 -0
  50. package/dist/collection/components/graphwise-reactodia/styles/type-style.resolver.js +52 -0
  51. package/dist/collection/components/graphwise-reactodia/testing/storage.mock.js +35 -0
  52. package/dist/collection/components/graphwise-reactodia/ui-config/default-ui-config.js +30 -0
  53. package/dist/collection/components/graphwise-reactodia/ui-config/ui-config-mapper.js +51 -0
  54. package/dist/collection/components/graphwise-reactodia/utils/object-util.js +30 -0
  55. package/dist/collection/index.js +7 -1
  56. package/dist/collection/pages/graphwise-reactodia/main.js +157 -0
  57. package/dist/collection/pages/graphwise-reactodia/owl-rdfs-settings.js +195 -0
  58. package/dist/esm/graphwise-reactodia.entry.js +28519 -41232
  59. package/dist/esm/graphwise-reactodia.js +3 -3
  60. package/dist/esm/{index-Cypw7ydc.js → index-DpCR6zMg.js} +16 -1
  61. package/dist/esm/index.js +7 -0
  62. package/dist/esm/loader.js +3 -3
  63. package/dist/esm/node-action-fwJ3Zupw.js +94 -0
  64. package/dist/graphwise-reactodia/graphwise-reactodia.esm.js +1 -1
  65. package/dist/graphwise-reactodia/index.esm.js +1 -0
  66. package/dist/graphwise-reactodia/p-DpCR6zMg.js +2 -0
  67. package/dist/graphwise-reactodia/p-c3d8a69a.entry.js +1 -0
  68. package/dist/graphwise-reactodia/p-fwJ3Zupw.js +1 -0
  69. package/dist/types/components/graphwise-reactodia/graphwise-reactodia.d.ts +44 -16
  70. package/dist/types/components/graphwise-reactodia/i18n/language-key.d.ts +4 -0
  71. package/dist/types/components/graphwise-reactodia/i18n/translations.d.ts +2 -343
  72. package/dist/types/components/graphwise-reactodia/menu/export-diagram-action.d.ts +4 -0
  73. package/dist/types/components/graphwise-reactodia/menu/graphwise-menu.d.ts +6 -0
  74. package/dist/types/components/graphwise-reactodia/menu/import-diagram-action.d.ts +4 -0
  75. package/dist/types/components/graphwise-reactodia/models/clear-diagram-storage-event.d.ts +5 -0
  76. package/dist/types/components/graphwise-reactodia/models/error/error-cause.d.ts +10 -0
  77. package/dist/types/components/graphwise-reactodia/models/error/error-code.d.ts +19 -0
  78. package/dist/types/components/graphwise-reactodia/models/error/error-report.d.ts +13 -0
  79. package/dist/types/components/graphwise-reactodia/models/event/event-callback.d.ts +5 -0
  80. package/dist/types/components/graphwise-reactodia/models/event/event-detail.d.ts +55 -0
  81. package/dist/types/components/graphwise-reactodia/models/event/event-type.d.ts +7 -0
  82. package/dist/types/components/graphwise-reactodia/models/reactodia-app-props.d.ts +20 -15
  83. package/dist/types/components/graphwise-reactodia/models/reactodia-config.d.ts +36 -0
  84. package/dist/types/components/graphwise-reactodia/models/sparql/sparql-query-function.d.ts +6 -0
  85. package/dist/types/components/graphwise-reactodia/models/sparql/sparql-query-params.d.ts +12 -0
  86. package/dist/types/components/graphwise-reactodia/models/subscription-list.d.ts +26 -0
  87. package/dist/types/components/graphwise-reactodia/models/subscription.d.ts +4 -0
  88. package/dist/types/components/graphwise-reactodia/models/triple.d.ts +19 -0
  89. package/dist/types/components/graphwise-reactodia/models/ui/menu-config.d.ts +8 -0
  90. package/dist/types/components/graphwise-reactodia/models/ui/menu-item.d.ts +17 -0
  91. package/dist/types/components/graphwise-reactodia/models/ui/node-action.d.ts +21 -0
  92. package/dist/types/components/graphwise-reactodia/models/ui/resolved-toolbar-position.d.ts +8 -0
  93. package/dist/types/components/graphwise-reactodia/models/ui/resolved-ui-config.d.ts +12 -0
  94. package/dist/types/components/graphwise-reactodia/models/ui/toolbar-dock.d.ts +13 -0
  95. package/dist/types/components/graphwise-reactodia/models/ui/toolbar-position.d.ts +11 -0
  96. package/dist/types/components/graphwise-reactodia/models/ui/ui-config.d.ts +17 -0
  97. package/dist/types/components/graphwise-reactodia/node-action/node-actions.d.ts +6 -0
  98. package/dist/types/components/graphwise-reactodia/providers/service/service-inject.d.ts +13 -0
  99. package/dist/types/components/graphwise-reactodia/providers/service/service.d.ts +28 -0
  100. package/dist/types/components/graphwise-reactodia/providers/service/service.provider.d.ts +16 -0
  101. package/dist/types/components/graphwise-reactodia/reactodia-app.d.ts +3 -2
  102. package/dist/types/components/graphwise-reactodia/services/diagram/diagram.service.d.ts +36 -0
  103. package/dist/types/components/graphwise-reactodia/services/diagram-file/diagram-file.service.d.ts +24 -0
  104. package/dist/types/components/graphwise-reactodia/services/diagram-storage/diagram-storage.service.d.ts +27 -0
  105. package/dist/types/components/graphwise-reactodia/services/error/error.service.d.ts +41 -0
  106. package/dist/types/components/graphwise-reactodia/services/event/event.service.d.ts +30 -0
  107. package/dist/types/components/graphwise-reactodia/services/window/window.service.d.ts +7 -0
  108. package/dist/types/components/graphwise-reactodia/styles/type-style.resolver.d.ts +11 -0
  109. package/dist/types/components/graphwise-reactodia/testing/storage.mock.d.ts +18 -0
  110. package/dist/types/components/graphwise-reactodia/ui-config/default-ui-config.d.ts +5 -0
  111. package/dist/types/components/graphwise-reactodia/ui-config/ui-config-mapper.d.ts +14 -0
  112. package/dist/types/components/graphwise-reactodia/utils/object-util.d.ts +15 -0
  113. package/dist/types/components.d.ts +60 -27
  114. package/dist/types/index.d.ts +15 -1
  115. package/package.json +39 -10
  116. package/dist/graphwise-reactodia/p-Cypw7ydc.js +0 -2
  117. package/dist/graphwise-reactodia/p-bafd6be5.entry.js +0 -1
@@ -0,0 +1 @@
1
+ const a="graphwise-reactodia:clear-diagram-storage";var n,o,r,e,i;!function(a){a.ERROR="error",a.TEXT_SEARCH="text-search"}(n||(n={})),function(a){a.MISSING_REQUIRED_PROP="missing-required-prop",a.DATA_FETCH="data-fetch",a.DIAGRAM_LOAD="diagram-load",a.DIAGRAM_IMPORT="diagram-import",a.LOCAL_DIAGRAM_READ="local-diagram-read",a.LOCAL_DIAGRAM_SAVE="local-diagram-save",a.UNKNOWN_UI_CONFIG="unknown-ui-config"}(o||(o={})),function(a){a.NW="nw",a.N="n",a.NE="ne",a.E="e",a.SE="se",a.S="s",a.SW="sw",a.W="w"}(r||(r={})),function(a){a.CLEAR_ALL="clear-all",a.EXPORT_PNG="export-png",a.EXPORT_SVG="export-svg",a.PRINT="print",a.EXPORT_JSON="export-json",a.IMPORT_JSON="import-json"}(e||(e={})),function(a){a.GROUP="group",a.REMOVE="remove",a.EXPAND="expand",a.OPEN_LINK="open-link",a.CONNECTIONS="connections",a.ADD_TO_FILTER="add-to-filter",a.ANNOTATE="annotate",a.ESTABLISH_LINK="establish-link"}(i||(i={}));export{a as C,n as E,e as M,i as N,r as T,o as a}
@@ -1,44 +1,72 @@
1
- import { SparqlDataProviderSettings, SparqlQueryFunction } from '@reactodia/workspace';
1
+ import { EventEmitter } from '../../stencil-public-runtime';
2
+ import { SparqlDataProviderSettings } from '@reactodia/workspace';
3
+ import { LanguageKey } from './i18n/language-key';
4
+ import { ReactodiaConfig } from './models/reactodia-config';
5
+ import { EventDetail } from './models/event/event-detail';
2
6
  /**
3
7
  * A web component that renders a graph with the Reactodia workspace.
4
8
  *
5
9
  * 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.
10
+ * the active repository's endpoint via `current-repository` and a `config.queryFunction`
11
+ * that performs the actual HTTP request. Reactodia fetches all node, link and type data
12
+ * lazily through them; the canvas starts empty and the user populates it via the search bar.
9
13
  *
10
14
  * The component is a thin wrapper around Reactodia: query configuration lives outside the
11
15
  * wrapper and is supplied through the `providerSettings` prop.
12
16
  */
13
17
  export declare class GraphwiseReactodia {
14
- private readonly hostElement;
18
+ private readonly hostElement?;
19
+ private readonly subscriptions;
15
20
  /**
16
21
  * The active repository id. Appended to {@link queryFunction} as the request `url`;
17
22
  * changing it re-points the graph at the new repository (and resets the canvas),
18
23
  * which is how runtime repository changes are handled.
19
24
  */
20
- currentRepository: string;
25
+ currentRepository?: string;
21
26
  /**
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`.
27
+ * Host-supplied configuration: the SPARQL `queryFunction` transport, an optional `seed`
28
+ * set of entities to pre-populate the canvas with and an optional `ui` configuration.
29
+ * A DOM property (an object, not an attribute) passed in from outside the wrapper.
30
+ *
31
+ * Read once on mount; not watched, as it only sets up the data source and initial canvas.
24
32
  */
25
- queryFunction: SparqlQueryFunction;
33
+ config?: ReactodiaConfig;
26
34
  /**
27
35
  * UI language code (e.g. `en`, `fr`) for the Reactodia interface. Defaults to English.
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
32
- * property (an object, not an attribute) passed in from outside the wrapper. When omitted,
33
- * the data provider falls back to Reactodia's generic OWL/RDFS preset. Changing it rebuilds
34
- * the data provider and resets the canvas.
40
+ * property (an object, not an attribute) passed in from outside the wrapper. Required: the
41
+ * wrapper has no default preset and throws when it is missing. Changing it rebuilds the data
42
+ * provider and reloads the graph with it, keeping the current diagram.
35
43
  */
36
44
  providerSettings?: SparqlDataProviderSettings;
37
- private reactRoot;
38
- onProviderSettingsChange(): void;
39
- onLanguageChange(): void;
45
+ /**
46
+ * The reactodia theme to use
47
+ */
48
+ theme?: 'light' | 'dark';
49
+ /**
50
+ * Fires for every event to the host, differentiated by `detail.type`.
51
+ */
52
+ eventEmitter: EventEmitter<EventDetail>;
53
+ private reactRoot?;
54
+ /**
55
+ * `connectedCallback` and the watchers can run before all props are set: when the component's
56
+ * code is already loaded, the instance is created as soon as the
57
+ * element is attached, and every prop set after that triggers its watcher. Rendering at that
58
+ * point would initialise the graph without all props. `componentDidLoad` runs once the initial
59
+ * props are set, so we use it to determine when it's safe to render.
60
+ */
61
+ private isComponentLoaded;
62
+ onCurrentRepositoryChange(): void;
63
+ onLanguageOrSettingsChange(): void;
64
+ onThemeChange(): void;
65
+ connectedCallback(): void;
40
66
  componentDidLoad(): void;
41
67
  disconnectedCallback(): void;
42
68
  render(): any;
69
+ private subscribeToEvents;
43
70
  private renderGraph;
71
+ private reportMissingPropError;
44
72
  }
@@ -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,4 @@
1
+ /**
2
+ * Exports the diagram as a JSON file.
3
+ */
4
+ export declare function ExportDiagramAction(): import("react").FunctionComponentElement<import("@reactodia/workspace").ToolbarActionProps>;
@@ -0,0 +1,6 @@
1
+ import { ReactElement } from 'react';
2
+ import { MenuItem } from '../models/ui/menu-item';
3
+ /**
4
+ * The menu entries for the given menu items.
5
+ */
6
+ export declare function createMenuItems(items: MenuItem[]): ReactElement[];
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Imports a diagram from a JSON file into the workspace.
3
+ */
4
+ export declare function ImportDiagramAction(): import("react").FunctionComponentElement<import("@reactodia/workspace").ToolbarActionOpenProps>;
@@ -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";
@@ -0,0 +1,10 @@
1
+ /**
2
+ * A link in the `cause` chain of a thrown value: the value itself, its `cause`, the cause of that, and so on.
3
+ * Anything can be thrown, so a link is not necessarily an `Error` and neither field is guaranteed.
4
+ */
5
+ export interface ErrorCause {
6
+ /** The error name, e.g. `AbortError`. */
7
+ name?: unknown;
8
+ /** The next link in the chain. */
9
+ cause?: unknown;
10
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The stable category of a reported error. The host uses it to choose its own message.
3
+ */
4
+ export declare enum ErrorCode {
5
+ /** A required prop is missing. */
6
+ MISSING_REQUIRED_PROP = "missing-required-prop",
7
+ /** A SPARQL data provider call failed. */
8
+ DATA_FETCH = "data-fetch",
9
+ /** The startup load, a reload or a repository switch failed. */
10
+ DIAGRAM_LOAD = "diagram-load",
11
+ /** The uploaded file was rejected or its import failed. */
12
+ DIAGRAM_IMPORT = "diagram-import",
13
+ /** Reading the diagram from local storage failed. */
14
+ LOCAL_DIAGRAM_READ = "local-diagram-read",
15
+ /** Saving the diagram in local storage failed. */
16
+ LOCAL_DIAGRAM_SAVE = "local-diagram-save",
17
+ /** The host's UI configuration has an unknown value, which is skipped. */
18
+ UNKNOWN_UI_CONFIG = "unknown-ui-config"
19
+ }
@@ -0,0 +1,13 @@
1
+ import { ErrorCode } from './error-code';
2
+ /**
3
+ * A failure the wrapper announces to the host.
4
+ */
5
+ export interface ErrorReport {
6
+ code: ErrorCode;
7
+ /**
8
+ * The thrown value, passed on unchanged. The wrapper and the fork throw `Error`s with an untranslated `message`, but
9
+ * a failure of the host's `config.queryFunction` arrives as whatever it rejected with (e.g. an HTTP error response),
10
+ * so narrow it before use.
11
+ */
12
+ error: unknown;
13
+ }
@@ -0,0 +1,5 @@
1
+ import { EventDetail } from './event-detail';
2
+ /**
3
+ * Callback invoked with every emitted event.
4
+ */
5
+ export type EventCallback = (detail: EventDetail) => void;
@@ -0,0 +1,55 @@
1
+ import { EventType } from './event-type';
2
+ import { ErrorReport } from '../error/error-report';
3
+ /**
4
+ * Name of the DOM event the `graphwise-reactodia` element dispatches for every event.
5
+ */
6
+ export declare const GRAPHWISE_REACTODIA_EVENT = "graphwiseReactodiaEvent";
7
+ /**
8
+ * The payload of each {@link EventType}. It is the single place that ties an event type to its payload, so
9
+ * adding an event is one {@link EventType} value and one entry here. An event without a payload maps to `void`
10
+ * and is emitted without `payload`.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * interface EventPayloadMap {
15
+ * [EventType.ERROR]: ErrorReport;
16
+ * // A new event:
17
+ * [EventType.NEW_TYPE]: NewTypePayload;
18
+ * // A new event without a payload:
19
+ * [EventType.NEW_SIGNAL]: void;
20
+ * }
21
+ * ```
22
+ */
23
+ interface EventPayloadMap {
24
+ [EventType.ERROR]: ErrorReport;
25
+ [EventType.TEXT_SEARCH]: void;
26
+ }
27
+ /**
28
+ * Maps an {@link EventType} to its event detail: `{type, payload}`, with the payload from
29
+ * {@link EventPayloadMap}. If no event type is provided, it is the union of the details of all event types.
30
+ *
31
+ * @template T The event type to map.
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * // Any event, narrowed by its type.
36
+ * function onEvent(detail: EventDetail): void {
37
+ * if (detail.type === EventType.ERROR) {
38
+ * const {code, error} = detail.payload; // an ErrorReport
39
+ * }
40
+ * }
41
+ *
42
+ * // One event.
43
+ * const detail: EventDetail<EventType.ERROR> = {type: EventType.ERROR, payload: {code, error}};
44
+ * ```
45
+ */
46
+ export type EventDetail<T extends EventType = EventType> = {
47
+ [K in T]: EventPayloadMap[K] extends void ? {
48
+ type: K;
49
+ payload?: undefined;
50
+ } : {
51
+ type: K;
52
+ payload: EventPayloadMap[K];
53
+ };
54
+ }[T];
55
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The kind of event the wrapper announces to the host. It selects the payload of an {@link EventDetail}.
3
+ */
4
+ export declare enum EventType {
5
+ ERROR = "error",
6
+ TEXT_SEARCH = "text-search"
7
+ }
@@ -1,34 +1,39 @@
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;
24
+ language: LanguageKey;
23
25
  /**
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.
26
+ * Query preset for the SPARQL data provider, owned and configured by the host.
27
27
  */
28
- initialDiagram?: SerializedDiagram;
28
+ providerSettings: SparqlDataProviderSettings;
29
29
  /**
30
- * Query preset for the SPARQL data provider, owned and configured by the host. Falls back
31
- * to Reactodia's generic `OwlRdfsSettings` OWL/RDFS preset when omitted.
30
+ * Color scheme of the Reactodia UI. When omitted, Reactodia follows the OS color scheme.
32
31
  */
33
- providerSettings?: SparqlDataProviderSettings;
32
+ theme?: 'light' | 'dark';
33
+ /**
34
+ * When true, the host is remounting the component to switch languages or to apply new provider
35
+ * settings, so the workspace should not be seeded, if a seed is present.
36
+ * Rather, the current state should simply be reloaded.
37
+ */
38
+ isReload?: boolean;
34
39
  }