graphwise-reactodia 0.0.1-TR11 → 0.0.1-TR12

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.
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The workspace main menu: Reactodia's default actions, followed by the diagram download and upload.
3
+ *
4
+ * Passing a `menu` to the `DefaultWorkspace` replaces its default actions, so they are listed here again.
5
+ * Rendered inside the workspace, so the actions can use the workspace hooks.
6
+ */
7
+ export declare function GraphwiseMenu(): import("react").FunctionComponentElement<{
8
+ children?: import("react").ReactNode | undefined;
9
+ }>;
@@ -1,4 +1,4 @@
1
- import type { DataDiagramModel, SerializedDiagram } from '@reactodia/workspace';
1
+ import type { DataDiagramModel, DataProvider, SerializedDiagram } from '@reactodia/workspace';
2
2
  import { Subscription } from '../../models/subscription';
3
3
  /**
4
4
  * Callback invoked with the current diagram layout whenever it changes.
@@ -11,6 +11,16 @@ export declare class DiagramService {
11
11
  static readonly ID = "DiagramService";
12
12
  private static readonly NOTIFY_DEBOUNCE_MS;
13
13
  private static readonly HISTORY_CHANGED_EVENT;
14
+ /**
15
+ * Replaces the diagram content with the given serialization. Element data is requested from the data provider and
16
+ * the links between the imported elements are validated against it.
17
+ *
18
+ * @param model The diagram model to import into.
19
+ * @param dataProvider The data provider to bind to the diagram.
20
+ * @param diagram The serialization to import. When `undefined`, the diagram is cleared.
21
+ * @param signal Optional signal to abort the import.
22
+ */
23
+ importDiagram(model: DataDiagramModel, dataProvider: DataProvider, diagram: SerializedDiagram | undefined, signal?: AbortSignal): Promise<void>;
14
24
  /**
15
25
  * Subscribes to diagram changes. On every debounced change the current layout is
16
26
  * exported and passed to the callback.
@@ -0,0 +1,24 @@
1
+ import type { SerializedDiagram } from '@reactodia/workspace';
2
+ /**
3
+ * Service for downloading and uploading the diagram as a file. The file content is the same
4
+ * {@link SerializedDiagram} that is persisted to the local store.
5
+ */
6
+ export declare class DiagramFileService {
7
+ static readonly ID = "DiagramFileService";
8
+ static readonly FILE_EXTENSION = ".json";
9
+ private static readonly MIME_TYPE;
10
+ /**
11
+ * Downloads the given diagram serialization as a file with the given name.
12
+ */
13
+ download(diagram: SerializedDiagram, fileName: string): void;
14
+ /**
15
+ * Reads a diagram serialization from the given file.
16
+ *
17
+ * @throws Error when the file is not valid JSON or is not a serialized diagram.
18
+ */
19
+ read(file: File): Promise<SerializedDiagram>;
20
+ /**
21
+ * Checks if the provided value is a serialized diagram
22
+ */
23
+ private isSerializedDiagram;
24
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphwise-reactodia",
3
- "version": "0.0.1-TR11",
3
+ "version": "0.0.1-TR12",
4
4
  "description": "Graphwise wrapper around the Reactodia graph explorer.",
5
5
  "license": "LGPL-3.0-or-later",
6
6
  "author": "Ontotext AD",