visio-solid-viewer 1.0.0 → 1.0.1
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/README.md
CHANGED
|
@@ -58,22 +58,34 @@ export function Diagram() {
|
|
|
58
58
|
|
|
59
59
|
The shared properties are `document` (a parsed `VisioDocument`, or `null` to clear),
|
|
60
60
|
`pageIndex` (zero-based), `zoom` (`1` means 100%), `showToolbar`, `ribbonAddIns` (tabs the host adds
|
|
61
|
-
after Help)
|
|
62
|
-
|
|
63
|
-
`
|
|
61
|
+
after Help), `canEdit` (editing permission; the viewer is editable unless you pass `false`),
|
|
62
|
+
`collaboration` (shares the open drawing in a room while set; `null` leaves it) and `events`.
|
|
63
|
+
The callback map uses `document-load`, `document-change` (`{ document, dirty, kind }` with kind
|
|
64
|
+
`edit`, `undo`, `redo`, `remote` or `save`), `document-error`, `page-change`, `zoom-change`,
|
|
65
|
+
`shape-select`, `selection-change`, `office-ribbon-add-in` and `collaboration-change`. File loading uses the imperative
|
|
64
66
|
`load(File | Blob | Uint8Array | ArrayBuffer)` handle; `document` is not a file URL.
|
|
65
67
|
Provide a height for the viewer host. Mount and load files in the browser.
|
|
66
68
|
|
|
67
69
|
The handle supports `fit()`, `replacePlainText(pageId, shapeId, text)`,
|
|
68
70
|
`applyEdits(edits)`, `undo()`, `redo()` and `exportVsdx()`.
|
|
69
71
|
`exportVsdx()` returns `{ bytes, dirty, diagnostics }`; saving or downloading those
|
|
70
|
-
bytes is the application's responsibility
|
|
72
|
+
bytes is the application's responsibility, and `handle.controller.markClean()` declares them saved.
|
|
73
|
+
Sharing state is on the handle's element: `collaborationState`, `reconnectCollaboration()` and
|
|
74
|
+
`stopCollaboration()`. Load original bytes through `load()`
|
|
71
75
|
to enable source-backed editing and export. Handles are usable after mount.
|
|
72
76
|
|
|
73
77
|
Every viewer package includes the same browser UI and re-exports the
|
|
74
78
|
`visio-core` document API. Parsing and editing belong to `ooxml-core/visio`;
|
|
75
79
|
framework bindings only manage lifecycle, properties and events.
|
|
76
80
|
|
|
81
|
+
## Compose your own UI
|
|
82
|
+
|
|
83
|
+
To build a custom diagram UI instead of mounting the whole viewer, use the building blocks: `createViewerBuildingBlocks`, `DiagramCanvas`, `Toolbar`, `PageNavigation`, `Inspector` and `ShapesPane`. The factory returns accessors
|
|
84
|
+
for the flat `toolbarProps` (page, zoom, selection, search, enabled flags and callbacks), `mode`,
|
|
85
|
+
`loading`/`error` and `markClean()`. Hosts pass `canEdit` (read-only until `true`) and optional
|
|
86
|
+
`onOpenSettings`/`onOpenShareDialog`/`onOpenPageSetup`/`onOpenFile` callbacks for dialogs they own.
|
|
87
|
+
See [composable building blocks](https://github.com/ChristopherVR/ooxml/blob/main/viewers/visio/docs/building-blocks.md).
|
|
88
|
+
|
|
77
89
|
## Limitations
|
|
78
90
|
|
|
79
91
|
Rendering and editing are beta features. Supported text and geometry edits are
|
|
@@ -83,7 +95,7 @@ Files stay in the browser unless your application sends them elsewhere.
|
|
|
83
95
|
|
|
84
96
|
## Documentation
|
|
85
97
|
|
|
86
|
-
[Viewer guide](https://christophervr.github.io/ooxml/visio/
|
|
98
|
+
[Viewer guide](https://christophervr.github.io/ooxml/visio/) |
|
|
87
99
|
[Demo](https://christophervr.github.io/ooxml/visio/demo/) |
|
|
88
100
|
[Source](https://github.com/ChristopherVR/ooxml/tree/main/viewers/visio)
|
|
89
101
|
|
|
@@ -26,7 +26,7 @@ export declare function createBuildingBlockSession(initial?: BuildingBlockOption
|
|
|
26
26
|
mount(node: HTMLElement | null): void;
|
|
27
27
|
/** Flat control props; pass the framework's latest options so callbacks stay current. */
|
|
28
28
|
toolbar(latest?: BuildingBlockOptions): {
|
|
29
|
-
labels: Readonly<Record<"Arc" | "Copy" | "Cut" | "Delete" | "Duplicate" | "Ellipse" | "Find" | "Fit to Window" | "Freeform" | "Group" | "Line" | "Next Result" | "Open" | "Options" | "Page" | "Page Setup" | "Paste" | "Pencil" | "Pointer Tool" | "Previous Result" | "Rectangle" | "Redo" | "Shapes" | "Share" | "Undo" | "Ungroup" | "Zoom In" | "Zoom Out", string>>;
|
|
29
|
+
labels: Readonly<Record<"Arc" | "Connector" | "Copy" | "Cut" | "Delete" | "Duplicate" | "Ellipse" | "Find" | "Fit to Window" | "Freeform" | "Group" | "Line" | "Next Result" | "Open" | "Options" | "Page" | "Page Setup" | "Paste" | "Pencil" | "Pointer Tool" | "Previous Result" | "Rectangle" | "Redo" | "Shapes" | "Share" | "Text" | "Undo" | "Ungroup" | "Zoom In" | "Zoom Out", string>>;
|
|
30
30
|
mode: ui.DiagramMode;
|
|
31
31
|
canEdit: boolean;
|
|
32
32
|
pageIndex: number;
|
|
@@ -8,7 +8,7 @@ export declare function createViewerBuildingBlocks(options?: Accessor<BuildingBl
|
|
|
8
8
|
mount: (node: HTMLElement | null) => void;
|
|
9
9
|
};
|
|
10
10
|
toolbarProps: Accessor<{
|
|
11
|
-
labels: Readonly<Record<"Arc" | "Copy" | "Cut" | "Delete" | "Duplicate" | "Ellipse" | "Find" | "Fit to Window" | "Freeform" | "Group" | "Line" | "Next Result" | "Open" | "Options" | "Page" | "Page Setup" | "Paste" | "Pencil" | "Pointer Tool" | "Previous Result" | "Rectangle" | "Redo" | "Shapes" | "Share" | "Undo" | "Ungroup" | "Zoom In" | "Zoom Out", string>>;
|
|
11
|
+
labels: Readonly<Record<"Arc" | "Connector" | "Copy" | "Cut" | "Delete" | "Duplicate" | "Ellipse" | "Find" | "Fit to Window" | "Freeform" | "Group" | "Line" | "Next Result" | "Open" | "Options" | "Page" | "Page Setup" | "Paste" | "Pencil" | "Pointer Tool" | "Previous Result" | "Rectangle" | "Redo" | "Shapes" | "Share" | "Text" | "Undo" | "Ungroup" | "Zoom In" | "Zoom Out", string>>;
|
|
12
12
|
mode: import("ooxml-ui/visio").DiagramMode;
|
|
13
13
|
canEdit: boolean;
|
|
14
14
|
pageIndex: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "visio-solid-viewer",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Local-first Visio viewer for solid",
|
|
5
5
|
"homepage": "https://christophervr.github.io/ooxml/visio/",
|
|
6
6
|
"bugs": {
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"emf-converter": "4.21.0",
|
|
35
|
-
"ooxml-core": "^1.
|
|
36
|
-
"ooxml-ui": "^1.
|
|
37
|
-
"visio-core": "^1.0.
|
|
35
|
+
"ooxml-core": "^1.23.0",
|
|
36
|
+
"ooxml-ui": "^1.22.0",
|
|
37
|
+
"visio-core": "^1.0.1"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"solid-js": "^1.9.0"
|