visio-svelte-viewer 0.6.2 → 0.7.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
@@ -44,7 +44,8 @@ npm install visio-svelte-viewer
44
44
  ## API
45
45
 
46
46
  The shared properties are `document` (a parsed `VisioDocument`, or `null` to clear),
47
- `pageIndex` (zero-based), `zoom` (`1` means 100%), `showToolbar` and `events`.
47
+ `pageIndex` (zero-based), `zoom` (`1` means 100%), `showToolbar`, `ribbonAddIns` (tabs the host adds
48
+ after Help) and `events`.
48
49
  The callback map uses `document-load`, `document-change`, `document-error`,
49
50
  `page-change`, `zoom-change` and `shape-select`. File loading uses the imperative
50
51
  `load(File | Blob | Uint8Array | ArrayBuffer)` handle; `document` is not a file URL.
@@ -3,8 +3,8 @@
3
3
  import { readonly, writable } from 'svelte/store';
4
4
  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
5
  type Props = ViewerProps & { class?: string; style?: string; 'aria-label'?: string };
6
- let { document, pageIndex, zoom, showToolbar, events, class: className, style, 'aria-label': ariaLabel }: Props = $props();
7
- const options = $derived({ document, pageIndex, zoom, showToolbar, events } satisfies Required<ViewerProps>);
6
+ let { document, pageIndex, zoom, showToolbar, ribbonAddIns, events, class: className, style, 'aria-label': ariaLabel }: Props = $props();
7
+ const options = $derived({ document, pageIndex, zoom, showToolbar, ribbonAddIns, events } satisfies Required<ViewerProps>);
8
8
  let binding: MountedViewer | undefined;
9
9
  const handle = viewerHandle(() => binding);
10
10
  // The component owns its state store, so subscribers made before mount still see updates.
@@ -24,7 +24,7 @@
24
24
  export function getState() { return readonly(state); }
25
25
  export function getHandle() { return handle; }
26
26
  export function load(source: VsdxSource) { return handle.load(source); }
27
- export function createBlankDrawing(options?: CreateVsdxOptions) { return handle.createBlankDrawing(options); }
27
+ export function createBlankDrawing(blankOptions?: CreateVsdxOptions) { return handle.createBlankDrawing(blankOptions); }
28
28
  export function applyEdits(edits: readonly VisioEdit[]) { return handle.applyEdits(edits); }
29
29
  export function selectShapes(shapes: readonly VisioShapeSelection[]) { handle.selectShapes(shapes); }
30
30
  export function selectAll() { handle.selectAll(); }
@@ -41,7 +41,7 @@
41
41
  export function fit() { handle.fit(); }
42
42
  export function setLayerVisibility(pageId: string, layerId: string, visible: boolean | null) { handle.setLayerVisibility(pageId, layerId, visible); }
43
43
  export function resetLayerVisibility(pageId?: string) { handle.resetLayerVisibility(pageId); }
44
- export function exportSvg(options?: SvgExportOptions) { return handle.exportSvg(options); }
45
- export function createPrintSnapshot(options?: CurrentPagePrintSnapshotOptions) { return handle.createPrintSnapshot(options); }
44
+ export function exportSvg(svgOptions?: SvgExportOptions) { return handle.exportSvg(svgOptions); }
45
+ export function createPrintSnapshot(printOptions?: CurrentPagePrintSnapshotOptions) { return handle.createPrintSnapshot(printOptions); }
46
46
  </script>
47
47
  <div class={className} {style} aria-label={ariaLabel} use:attach={options}></div>
package/dist/index.js CHANGED
@@ -154,6 +154,7 @@ function VisioViewer($$anchor, $$props) {
154
154
  pageIndex: $$props.pageIndex,
155
155
  zoom: $$props.zoom,
156
156
  showToolbar: $$props.showToolbar,
157
+ ribbonAddIns: $$props.ribbonAddIns,
157
158
  events: $$props.events
158
159
  }));
159
160
  let binding;
@@ -187,8 +188,8 @@ function VisioViewer($$anchor, $$props) {
187
188
  function load(source) {
188
189
  return handle.load(source);
189
190
  }
190
- function createBlankDrawing(options) {
191
- return handle.createBlankDrawing(options);
191
+ function createBlankDrawing(blankOptions) {
192
+ return handle.createBlankDrawing(blankOptions);
192
193
  }
193
194
  function applyEdits(edits) {
194
195
  return handle.applyEdits(edits);
@@ -238,11 +239,11 @@ function VisioViewer($$anchor, $$props) {
238
239
  function resetLayerVisibility(pageId) {
239
240
  handle.resetLayerVisibility(pageId);
240
241
  }
241
- function exportSvg(options) {
242
- return handle.exportSvg(options);
242
+ function exportSvg(svgOptions) {
243
+ return handle.exportSvg(svgOptions);
243
244
  }
244
- function createPrintSnapshot(options) {
245
- return handle.createPrintSnapshot(options);
245
+ function createPrintSnapshot(printOptions) {
246
+ return handle.createPrintSnapshot(printOptions);
246
247
  }
247
248
  var $$exports = {
248
249
  getState,
@@ -84,12 +84,13 @@ function viewerHandle(current) {
84
84
  //#region packages/bindings/src/VisioViewer.svelte
85
85
  function VisioViewer($$renderer, $$props) {
86
86
  $$renderer.component(($$renderer) => {
87
- let { document, pageIndex, zoom, showToolbar, events, class: className, style, "aria-label": ariaLabel } = $$props;
87
+ let { document, pageIndex, zoom, showToolbar, ribbonAddIns, events, class: className, style, "aria-label": ariaLabel } = $$props;
88
88
  $.derived(() => ({
89
89
  document,
90
90
  pageIndex,
91
91
  zoom,
92
92
  showToolbar,
93
+ ribbonAddIns,
93
94
  events
94
95
  }));
95
96
  let binding;
@@ -105,8 +106,8 @@ function VisioViewer($$renderer, $$props) {
105
106
  function load(source) {
106
107
  return handle.load(source);
107
108
  }
108
- function createBlankDrawing(options) {
109
- return handle.createBlankDrawing(options);
109
+ function createBlankDrawing(blankOptions) {
110
+ return handle.createBlankDrawing(blankOptions);
110
111
  }
111
112
  function applyEdits(edits) {
112
113
  return handle.applyEdits(edits);
@@ -156,11 +157,11 @@ function VisioViewer($$renderer, $$props) {
156
157
  function resetLayerVisibility(pageId) {
157
158
  handle.resetLayerVisibility(pageId);
158
159
  }
159
- function exportSvg(options) {
160
- return handle.exportSvg(options);
160
+ function exportSvg(svgOptions) {
161
+ return handle.exportSvg(svgOptions);
161
162
  }
162
- function createPrintSnapshot(options) {
163
- return handle.createPrintSnapshot(options);
163
+ function createPrintSnapshot(printOptions) {
164
+ return handle.createPrintSnapshot(printOptions);
164
165
  }
165
166
  $$renderer.push(`<div${$.attr_class($.clsx(className))}${$.attr_style(style)}${$.attr("aria-label", ariaLabel)}></div>`);
166
167
  $.bind_props($$props, {
@@ -38,4 +38,5 @@ export { ViewerController, type ViewerState } from 'ooxml-ui/visio';
38
38
  export type { SvgExportOptions, SvgExportResult } from 'ooxml-ui/visio';
39
39
  export type { CurrentPagePrintSnapshotOptions, PrintSnapshot, PrintSnapshotPage, PrintSnapshotOptions, PrintSnapshotLimits, PrintSnapshotUsage, } from 'ooxml-ui/visio';
40
40
  export type { ViewerEditState, VsdxExportResult } from 'ooxml-ui/visio';
41
+ export type { OfficeRibbonAddInEvent, RibbonAddInCommand, RibbonAddInGroup, RibbonAddInTab, } from 'ooxml-ui/visio';
41
42
  export type { VisioEdit, VisioGeometryEdit, CreateVsdxOptions } from 'ooxml-core/visio';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "visio-svelte-viewer",
3
- "version": "0.6.2",
3
+ "version": "0.7.1",
4
4
  "description": "Local-first Visio viewer for svelte",
5
5
  "homepage": "https://christophervr.github.io/ooxml/visio/",
6
6
  "bugs": {
@@ -38,8 +38,8 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "emf-converter": "4.11.2",
41
- "ooxml-core": "^1.6.2",
42
- "ooxml-ui": "^1.6.2",
41
+ "ooxml-core": "^1.8.2",
42
+ "ooxml-ui": "^1.8.3",
43
43
  "visio-core": "^0.4.1"
44
44
  },
45
45
  "peerDependencies": {