visio-svelte-viewer 1.2.0 → 1.3.0

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.
@@ -1,10 +1,11 @@
1
1
  <script lang="ts">
2
+ import type { CloudOpenedFile } from 'ooxml-core/embedding';
2
3
  import type { CreateVsdxOptions } from './runtime.js';
3
4
  import { readonly, writable } from 'svelte/store';
4
5
  import { mountFrameworkViewer, viewerHandle, viewerOptions, viewerStateSource, type ViewerState, type MountedViewer, type ViewerProps, type VsdxSource, type VisioEdit, type VisioShapeSelection, type SvgExportOptions, type CurrentPagePrintSnapshotOptions } from './runtime.js';
5
6
  type Props = ViewerProps & { class?: string; style?: string; 'aria-label'?: string };
6
- let { document, pageIndex, zoom, showToolbar, canEdit, readOnly, ribbonAddIns, collaboration, customization, storage, events, class: className, style, 'aria-label': ariaLabel }: Props = $props();
7
- const options = $derived({ document, pageIndex, zoom, showToolbar, canEdit, readOnly, ribbonAddIns, collaboration, customization, storage, events } satisfies Required<ViewerProps>);
7
+ let { document, pageIndex, zoom, showToolbar, canEdit, readOnly, ribbonAddIns, collaboration, customization, storage, fileProviders, events, class: className, style, 'aria-label': ariaLabel }: Props = $props();
8
+ const options = $derived({ document, pageIndex, zoom, showToolbar, canEdit, readOnly, ribbonAddIns, collaboration, customization, storage, fileProviders, events } satisfies Required<ViewerProps>);
8
9
  let binding: MountedViewer | undefined;
9
10
  const handle = viewerHandle(() => binding);
10
11
  // The component owns its state store, so subscribers made before mount still see updates.
@@ -25,6 +26,7 @@
25
26
  export function getHandle() { return handle; }
26
27
  export function load(source: VsdxSource) { return handle.load(source); }
27
28
  export function createBlankDrawing(blankOptions?: CreateVsdxOptions) { return handle.createBlankDrawing(blankOptions); }
29
+ export function openCloudFile(file: CloudOpenedFile) { return handle.openCloudFile(file); }
28
30
  export function applyEdits(edits: readonly VisioEdit[]) { return handle.applyEdits(edits); }
29
31
  export function selectShapes(shapes: readonly VisioShapeSelection[]) { handle.selectShapes(shapes); }
30
32
  export function selectAll() { handle.selectAll(); }
package/dist/index.js CHANGED
@@ -22,6 +22,7 @@ var VIEWER_CONTRACT = {
22
22
  controller: "get",
23
23
  load: "async",
24
24
  createBlankDrawing: "async",
25
+ openCloudFile: "async",
25
26
  applyEdits: "async",
26
27
  selectShapes: "call",
27
28
  selectAll: "call",
@@ -126,6 +127,7 @@ function VisioViewer($$anchor, $$props) {
126
127
  collaboration: $$props.collaboration,
127
128
  customization: $$props.customization,
128
129
  storage: $$props.storage,
130
+ fileProviders: $$props.fileProviders,
129
131
  events: $$props.events
130
132
  }));
131
133
  let binding;
@@ -162,6 +164,9 @@ function VisioViewer($$anchor, $$props) {
162
164
  function createBlankDrawing(blankOptions) {
163
165
  return handle.createBlankDrawing(blankOptions);
164
166
  }
167
+ function openCloudFile(file) {
168
+ return handle.openCloudFile(file);
169
+ }
165
170
  function applyEdits(edits) {
166
171
  return handle.applyEdits(edits);
167
172
  }
@@ -221,6 +226,7 @@ function VisioViewer($$anchor, $$props) {
221
226
  getHandle,
222
227
  load,
223
228
  createBlankDrawing,
229
+ openCloudFile,
224
230
  applyEdits,
225
231
  selectShapes,
226
232
  selectAll,
@@ -21,6 +21,7 @@ var VIEWER_CONTRACT = {
21
21
  controller: "get",
22
22
  load: "async",
23
23
  createBlankDrawing: "async",
24
+ openCloudFile: "async",
24
25
  applyEdits: "async",
25
26
  selectShapes: "call",
26
27
  selectAll: "call",
@@ -51,7 +52,7 @@ function viewerHandle(current) {
51
52
  //#region packages/bindings/src/VisioViewer.svelte
52
53
  function VisioViewer($$renderer, $$props) {
53
54
  $$renderer.component(($$renderer) => {
54
- let { document, pageIndex, zoom, showToolbar, canEdit, readOnly, ribbonAddIns, collaboration, customization, storage, events, class: className, style, "aria-label": ariaLabel } = $$props;
55
+ let { document, pageIndex, zoom, showToolbar, canEdit, readOnly, ribbonAddIns, collaboration, customization, storage, fileProviders, events, class: className, style, "aria-label": ariaLabel } = $$props;
55
56
  $.derived(() => ({
56
57
  document,
57
58
  pageIndex,
@@ -63,6 +64,7 @@ function VisioViewer($$renderer, $$props) {
63
64
  collaboration,
64
65
  customization,
65
66
  storage,
67
+ fileProviders,
66
68
  events
67
69
  }));
68
70
  let binding;
@@ -81,6 +83,9 @@ function VisioViewer($$renderer, $$props) {
81
83
  function createBlankDrawing(blankOptions) {
82
84
  return handle.createBlankDrawing(blankOptions);
83
85
  }
86
+ function openCloudFile(file) {
87
+ return handle.openCloudFile(file);
88
+ }
84
89
  function applyEdits(edits) {
85
90
  return handle.applyEdits(edits);
86
91
  }
@@ -141,6 +146,7 @@ function VisioViewer($$renderer, $$props) {
141
146
  getHandle,
142
147
  load,
143
148
  createBlankDrawing,
149
+ openCloudFile,
144
150
  applyEdits,
145
151
  selectShapes,
146
152
  selectAll,
package/dist/runtime.js CHANGED
@@ -20,6 +20,7 @@ var VIEWER_CONTRACT = {
20
20
  controller: "get",
21
21
  load: "async",
22
22
  createBlankDrawing: "async",
23
+ openCloudFile: "async",
23
24
  applyEdits: "async",
24
25
  selectShapes: "call",
25
26
  selectAll: "call",
@@ -8,7 +8,7 @@ export type ViewerProps = {
8
8
  } & {
9
9
  events?: ViewerCallbacks | undefined;
10
10
  };
11
- export type ViewerHandle = Pick<MountedViewer, 'element' | 'controller' | 'load' | 'createBlankDrawing' | 'applyEdits' | 'selectShapes' | 'selectAll' | 'clearSelection' | 'duplicateSelection' | 'copySelection' | 'cutSelection' | 'pasteSelection' | 'replacePlainText' | 'undo' | 'redo' | 'cancelEdit' | 'exportVsdx' | 'fit' | 'setLayerVisibility' | 'resetLayerVisibility' | 'exportSvg' | 'createPrintSnapshot'>;
11
+ export type ViewerHandle = Pick<MountedViewer, 'element' | 'controller' | 'load' | 'createBlankDrawing' | 'openCloudFile' | 'applyEdits' | 'selectShapes' | 'selectAll' | 'clearSelection' | 'duplicateSelection' | 'copySelection' | 'cutSelection' | 'pasteSelection' | 'replacePlainText' | 'undo' | 'redo' | 'cancelEdit' | 'exportVsdx' | 'fit' | 'setLayerVisibility' | 'resetLayerVisibility' | 'exportSvg' | 'createPrintSnapshot'>;
12
12
  /**
13
13
  * The Visio binding contract. `mountViewer` (ooxml-ui/visio) forwards properties and events itself,
14
14
  * so every property is `manual` here: `mountFrameworkViewer` sends them as revision-aware patches.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "visio-svelte-viewer",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Local-first Visio viewer for svelte",
5
5
  "homepage": "https://christophervr.github.io/ooxml/visio/",
6
6
  "bugs": {
@@ -37,9 +37,9 @@
37
37
  "access": "public"
38
38
  },
39
39
  "dependencies": {
40
- "emf-converter": "4.24.0",
41
- "ooxml-core": "^1.38.0",
42
- "ooxml-ui": "^1.40.0",
40
+ "emf-converter": "4.25.3",
41
+ "ooxml-core": "^1.39.0",
42
+ "ooxml-ui": "^1.41.0",
43
43
  "visio-core": "^1.1.0"
44
44
  },
45
45
  "peerDependencies": {