visio-svelte-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
@@ -45,22 +45,34 @@ npm install visio-svelte-viewer
45
45
 
46
46
  The shared properties are `document` (a parsed `VisioDocument`, or `null` to clear),
47
47
  `pageIndex` (zero-based), `zoom` (`1` means 100%), `showToolbar`, `ribbonAddIns` (tabs the host adds
48
- after Help) and `events`.
49
- The callback map uses `document-load`, `document-change`, `document-error`,
50
- `page-change`, `zoom-change` and `shape-select`. File loading uses the imperative
48
+ after Help), `canEdit` (editing permission; the viewer is editable unless you pass `false`),
49
+ `collaboration` (shares the open drawing in a room while set; `null` leaves it) and `events`.
50
+ The callback map uses `document-load`, `document-change` (`{ document, dirty, kind }` with kind
51
+ `edit`, `undo`, `redo`, `remote` or `save`), `document-error`, `page-change`, `zoom-change`,
52
+ `shape-select`, `selection-change`, `office-ribbon-add-in` and `collaboration-change`. File loading uses the imperative
51
53
  `load(File | Blob | Uint8Array | ArrayBuffer)` handle; `document` is not a file URL.
52
54
  Provide a height for the viewer host. Mount and load files in the browser.
53
55
 
54
56
  The handle supports `fit()`, `replacePlainText(pageId, shapeId, text)`,
55
57
  `applyEdits(edits)`, `undo()`, `redo()` and `exportVsdx()`.
56
58
  `exportVsdx()` returns `{ bytes, dirty, diagnostics }`; saving or downloading those
57
- bytes is the application's responsibility. Load original bytes through `load()`
59
+ bytes is the application's responsibility, and `handle.controller.markClean()` declares them saved.
60
+ Sharing state is on the handle's element: `collaborationState`, `reconnectCollaboration()` and
61
+ `stopCollaboration()`. Load original bytes through `load()`
58
62
  to enable source-backed editing and export. Handles are usable after mount.
59
63
 
60
64
  Every viewer package includes the same browser UI and re-exports the
61
65
  `visio-core` document API. Parsing and editing belong to `ooxml-core/visio`;
62
66
  framework bindings only manage lifecycle, properties and events.
63
67
 
68
+ ## Compose your own UI
69
+
70
+ 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 readable stores
71
+ for the flat `toolbarProps` (page, zoom, selection, search, enabled flags and callbacks), `mode`,
72
+ `loading`/`error` and `markClean()`. Hosts pass `canEdit` (read-only until `true`) and optional
73
+ `onOpenSettings`/`onOpenShareDialog`/`onOpenPageSetup`/`onOpenFile` callbacks for dialogs they own.
74
+ See [composable building blocks](https://github.com/ChristopherVR/ooxml/blob/main/viewers/visio/docs/building-blocks.md).
75
+
64
76
  ## Limitations
65
77
 
66
78
  Rendering and editing are beta features. Supported text and geometry edits are
@@ -70,7 +82,7 @@ Files stay in the browser unless your application sends them elsewhere.
70
82
 
71
83
  ## Documentation
72
84
 
73
- [Viewer guide](https://christophervr.github.io/ooxml/visio/docs/) |
85
+ [Viewer guide](https://christophervr.github.io/ooxml/visio/) |
74
86
  [Demo](https://christophervr.github.io/ooxml/visio/demo/) |
75
87
  [Source](https://github.com/ChristopherVR/ooxml/tree/main/viewers/visio)
76
88
 
@@ -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;
@@ -7,7 +7,7 @@ export declare function createViewerBuildingBlocks(options?: BuildingBlockOption
7
7
  subscribe: (this: void, run: import("svelte/store").Subscriber<import("ooxml-ui/visio").ViewerState>, invalidate?: () => void) => import("svelte/store").Unsubscriber;
8
8
  };
9
9
  toolbarProps: Readable<{
10
- 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>>;
10
+ 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>>;
11
11
  mode: import("ooxml-ui/visio").DiagramMode;
12
12
  canEdit: boolean;
13
13
  pageIndex: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "visio-svelte-viewer",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Local-first Visio viewer for svelte",
5
5
  "homepage": "https://christophervr.github.io/ooxml/visio/",
6
6
  "bugs": {
@@ -38,9 +38,9 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "emf-converter": "4.21.0",
41
- "ooxml-core": "^1.22.0",
42
- "ooxml-ui": "^1.21.0",
43
- "visio-core": "^1.0.0"
41
+ "ooxml-core": "^1.23.0",
42
+ "ooxml-ui": "^1.22.0",
43
+ "visio-core": "^1.0.1"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "svelte": "^5.0.0"