visio-svelte-viewer 0.5.7 → 0.6.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.
package/dist/VisioViewer.svelte
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import type { CreateVsdxOptions } from './runtime.js';
|
|
2
3
|
import { readonly, writable } from 'svelte/store';
|
|
3
|
-
import { mountFrameworkViewer, viewerHandle, viewerOptions, viewerStateSource, type ViewerState, type MountedViewer, type ViewerProps, type VsdxSource, type VisioEdit, type SvgExportOptions, type CurrentPagePrintSnapshotOptions } from './runtime.js';
|
|
4
|
-
type Props = ViewerProps & { class?: string; style?: string };
|
|
5
|
-
let { document, pageIndex, zoom, showToolbar, events, class: className, style }: Props = $props();
|
|
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
|
+
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();
|
|
6
7
|
const options = $derived({ document, pageIndex, zoom, showToolbar, events } satisfies Required<ViewerProps>);
|
|
7
8
|
let binding: MountedViewer | undefined;
|
|
8
9
|
const handle = viewerHandle(() => binding);
|
|
@@ -23,7 +24,15 @@
|
|
|
23
24
|
export function getState() { return readonly(state); }
|
|
24
25
|
export function getHandle() { return handle; }
|
|
25
26
|
export function load(source: VsdxSource) { return handle.load(source); }
|
|
27
|
+
export function createBlankDrawing(options?: CreateVsdxOptions) { return handle.createBlankDrawing(options); }
|
|
26
28
|
export function applyEdits(edits: readonly VisioEdit[]) { return handle.applyEdits(edits); }
|
|
29
|
+
export function selectShapes(shapes: readonly VisioShapeSelection[]) { handle.selectShapes(shapes); }
|
|
30
|
+
export function selectAll() { handle.selectAll(); }
|
|
31
|
+
export function clearSelection() { handle.clearSelection(); }
|
|
32
|
+
export function duplicateSelection() { return handle.duplicateSelection(); }
|
|
33
|
+
export function copySelection() { return handle.copySelection(); }
|
|
34
|
+
export function cutSelection() { return handle.cutSelection(); }
|
|
35
|
+
export function pasteSelection() { return handle.pasteSelection(); }
|
|
27
36
|
export function replacePlainText(pageId: string, shapeId: string, text: string) { return handle.replacePlainText(pageId, shapeId, text); }
|
|
28
37
|
export function undo() { return handle.undo(); }
|
|
29
38
|
export function redo() { return handle.redo(); }
|
|
@@ -35,4 +44,4 @@
|
|
|
35
44
|
export function exportSvg(options?: SvgExportOptions) { return handle.exportSvg(options); }
|
|
36
45
|
export function createPrintSnapshot(options?: CurrentPagePrintSnapshotOptions) { return handle.createPrintSnapshot(options); }
|
|
37
46
|
</script>
|
|
38
|
-
<div class={className} {style} use:attach={options}></div>
|
|
47
|
+
<div class={className} {style} aria-label={ariaLabel} use:attach={options}></div>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Component } from 'svelte';
|
|
2
2
|
import type { Readable } from 'svelte/store';
|
|
3
3
|
import type { ViewerProps, ViewerHandle, ViewerState } from './types/packages/bindings/src/common.js';
|
|
4
|
-
declare const VisioViewer: Component<ViewerProps & { class?: string; style?: string },
|
|
4
|
+
declare const VisioViewer: Component<ViewerProps & { class?: string; style?: string }, Omit<ViewerHandle, 'element' | 'controller'> & { getHandle(): ViewerHandle; getState(): Readable<ViewerState | null> }>;
|
|
5
5
|
export default VisioViewer;
|
package/dist/index.js
CHANGED
|
@@ -68,12 +68,36 @@ function viewerHandle(current) {
|
|
|
68
68
|
async load(source) {
|
|
69
69
|
await requireViewer().load(source);
|
|
70
70
|
},
|
|
71
|
+
async createBlankDrawing(options) {
|
|
72
|
+
await requireViewer().createBlankDrawing(options);
|
|
73
|
+
},
|
|
71
74
|
async applyEdits(edits) {
|
|
72
75
|
await requireViewer().applyEdits(edits);
|
|
73
76
|
},
|
|
77
|
+
selectShapes(shapes) {
|
|
78
|
+
requireViewer().selectShapes(shapes);
|
|
79
|
+
},
|
|
80
|
+
selectAll() {
|
|
81
|
+
requireViewer().selectAll();
|
|
82
|
+
},
|
|
83
|
+
clearSelection() {
|
|
84
|
+
requireViewer().clearSelection();
|
|
85
|
+
},
|
|
74
86
|
async replacePlainText(pageId, shapeId, text) {
|
|
75
87
|
await requireViewer().replacePlainText(pageId, shapeId, text);
|
|
76
88
|
},
|
|
89
|
+
async duplicateSelection() {
|
|
90
|
+
await requireViewer().duplicateSelection();
|
|
91
|
+
},
|
|
92
|
+
async copySelection() {
|
|
93
|
+
await requireViewer().copySelection();
|
|
94
|
+
},
|
|
95
|
+
async cutSelection() {
|
|
96
|
+
await requireViewer().cutSelection();
|
|
97
|
+
},
|
|
98
|
+
async pasteSelection() {
|
|
99
|
+
await requireViewer().pasteSelection();
|
|
100
|
+
},
|
|
77
101
|
async undo() {
|
|
78
102
|
await requireViewer().undo();
|
|
79
103
|
},
|
|
@@ -163,9 +187,33 @@ function VisioViewer($$anchor, $$props) {
|
|
|
163
187
|
function load(source) {
|
|
164
188
|
return handle.load(source);
|
|
165
189
|
}
|
|
190
|
+
function createBlankDrawing(options) {
|
|
191
|
+
return handle.createBlankDrawing(options);
|
|
192
|
+
}
|
|
166
193
|
function applyEdits(edits) {
|
|
167
194
|
return handle.applyEdits(edits);
|
|
168
195
|
}
|
|
196
|
+
function selectShapes(shapes) {
|
|
197
|
+
handle.selectShapes(shapes);
|
|
198
|
+
}
|
|
199
|
+
function selectAll() {
|
|
200
|
+
handle.selectAll();
|
|
201
|
+
}
|
|
202
|
+
function clearSelection() {
|
|
203
|
+
handle.clearSelection();
|
|
204
|
+
}
|
|
205
|
+
function duplicateSelection() {
|
|
206
|
+
return handle.duplicateSelection();
|
|
207
|
+
}
|
|
208
|
+
function copySelection() {
|
|
209
|
+
return handle.copySelection();
|
|
210
|
+
}
|
|
211
|
+
function cutSelection() {
|
|
212
|
+
return handle.cutSelection();
|
|
213
|
+
}
|
|
214
|
+
function pasteSelection() {
|
|
215
|
+
return handle.pasteSelection();
|
|
216
|
+
}
|
|
169
217
|
function replacePlainText(pageId, shapeId, text) {
|
|
170
218
|
return handle.replacePlainText(pageId, shapeId, text);
|
|
171
219
|
}
|
|
@@ -200,7 +248,15 @@ function VisioViewer($$anchor, $$props) {
|
|
|
200
248
|
getState,
|
|
201
249
|
getHandle,
|
|
202
250
|
load,
|
|
251
|
+
createBlankDrawing,
|
|
203
252
|
applyEdits,
|
|
253
|
+
selectShapes,
|
|
254
|
+
selectAll,
|
|
255
|
+
clearSelection,
|
|
256
|
+
duplicateSelection,
|
|
257
|
+
copySelection,
|
|
258
|
+
cutSelection,
|
|
259
|
+
pasteSelection,
|
|
204
260
|
replacePlainText,
|
|
205
261
|
undo,
|
|
206
262
|
redo,
|
|
@@ -217,6 +273,7 @@ function VisioViewer($$anchor, $$props) {
|
|
|
217
273
|
$.template_effect(() => {
|
|
218
274
|
$.set_class(div, 1, $.clsx($$props.class));
|
|
219
275
|
$.set_style(div, $$props.style);
|
|
276
|
+
$.set_attribute(div, "aria-label", $$props["aria-label"]);
|
|
220
277
|
});
|
|
221
278
|
$.append($$anchor, div);
|
|
222
279
|
return $.pop($$exports);
|
package/dist/index.server.js
CHANGED
|
@@ -21,12 +21,36 @@ function viewerHandle(current) {
|
|
|
21
21
|
async load(source) {
|
|
22
22
|
await requireViewer().load(source);
|
|
23
23
|
},
|
|
24
|
+
async createBlankDrawing(options) {
|
|
25
|
+
await requireViewer().createBlankDrawing(options);
|
|
26
|
+
},
|
|
24
27
|
async applyEdits(edits) {
|
|
25
28
|
await requireViewer().applyEdits(edits);
|
|
26
29
|
},
|
|
30
|
+
selectShapes(shapes) {
|
|
31
|
+
requireViewer().selectShapes(shapes);
|
|
32
|
+
},
|
|
33
|
+
selectAll() {
|
|
34
|
+
requireViewer().selectAll();
|
|
35
|
+
},
|
|
36
|
+
clearSelection() {
|
|
37
|
+
requireViewer().clearSelection();
|
|
38
|
+
},
|
|
27
39
|
async replacePlainText(pageId, shapeId, text) {
|
|
28
40
|
await requireViewer().replacePlainText(pageId, shapeId, text);
|
|
29
41
|
},
|
|
42
|
+
async duplicateSelection() {
|
|
43
|
+
await requireViewer().duplicateSelection();
|
|
44
|
+
},
|
|
45
|
+
async copySelection() {
|
|
46
|
+
await requireViewer().copySelection();
|
|
47
|
+
},
|
|
48
|
+
async cutSelection() {
|
|
49
|
+
await requireViewer().cutSelection();
|
|
50
|
+
},
|
|
51
|
+
async pasteSelection() {
|
|
52
|
+
await requireViewer().pasteSelection();
|
|
53
|
+
},
|
|
30
54
|
async undo() {
|
|
31
55
|
await requireViewer().undo();
|
|
32
56
|
},
|
|
@@ -60,7 +84,7 @@ function viewerHandle(current) {
|
|
|
60
84
|
//#region packages/bindings/src/VisioViewer.svelte
|
|
61
85
|
function VisioViewer($$renderer, $$props) {
|
|
62
86
|
$$renderer.component(($$renderer) => {
|
|
63
|
-
let { document, pageIndex, zoom, showToolbar, events, class: className, style } = $$props;
|
|
87
|
+
let { document, pageIndex, zoom, showToolbar, events, class: className, style, "aria-label": ariaLabel } = $$props;
|
|
64
88
|
$.derived(() => ({
|
|
65
89
|
document,
|
|
66
90
|
pageIndex,
|
|
@@ -81,9 +105,33 @@ function VisioViewer($$renderer, $$props) {
|
|
|
81
105
|
function load(source) {
|
|
82
106
|
return handle.load(source);
|
|
83
107
|
}
|
|
108
|
+
function createBlankDrawing(options) {
|
|
109
|
+
return handle.createBlankDrawing(options);
|
|
110
|
+
}
|
|
84
111
|
function applyEdits(edits) {
|
|
85
112
|
return handle.applyEdits(edits);
|
|
86
113
|
}
|
|
114
|
+
function selectShapes(shapes) {
|
|
115
|
+
handle.selectShapes(shapes);
|
|
116
|
+
}
|
|
117
|
+
function selectAll() {
|
|
118
|
+
handle.selectAll();
|
|
119
|
+
}
|
|
120
|
+
function clearSelection() {
|
|
121
|
+
handle.clearSelection();
|
|
122
|
+
}
|
|
123
|
+
function duplicateSelection() {
|
|
124
|
+
return handle.duplicateSelection();
|
|
125
|
+
}
|
|
126
|
+
function copySelection() {
|
|
127
|
+
return handle.copySelection();
|
|
128
|
+
}
|
|
129
|
+
function cutSelection() {
|
|
130
|
+
return handle.cutSelection();
|
|
131
|
+
}
|
|
132
|
+
function pasteSelection() {
|
|
133
|
+
return handle.pasteSelection();
|
|
134
|
+
}
|
|
87
135
|
function replacePlainText(pageId, shapeId, text) {
|
|
88
136
|
return handle.replacePlainText(pageId, shapeId, text);
|
|
89
137
|
}
|
|
@@ -114,12 +162,20 @@ function VisioViewer($$renderer, $$props) {
|
|
|
114
162
|
function createPrintSnapshot(options) {
|
|
115
163
|
return handle.createPrintSnapshot(options);
|
|
116
164
|
}
|
|
117
|
-
$$renderer.push(`<div${$.attr_class($.clsx(className))}${$.attr_style(style)}></div>`);
|
|
165
|
+
$$renderer.push(`<div${$.attr_class($.clsx(className))}${$.attr_style(style)}${$.attr("aria-label", ariaLabel)}></div>`);
|
|
118
166
|
$.bind_props($$props, {
|
|
119
167
|
getState,
|
|
120
168
|
getHandle,
|
|
121
169
|
load,
|
|
170
|
+
createBlankDrawing,
|
|
122
171
|
applyEdits,
|
|
172
|
+
selectShapes,
|
|
173
|
+
selectAll,
|
|
174
|
+
clearSelection,
|
|
175
|
+
duplicateSelection,
|
|
176
|
+
copySelection,
|
|
177
|
+
cutSelection,
|
|
178
|
+
pasteSelection,
|
|
123
179
|
replacePlainText,
|
|
124
180
|
undo,
|
|
125
181
|
redo,
|
package/dist/runtime.js
CHANGED
|
@@ -65,12 +65,36 @@ function viewerHandle(current) {
|
|
|
65
65
|
async load(source) {
|
|
66
66
|
await requireViewer().load(source);
|
|
67
67
|
},
|
|
68
|
+
async createBlankDrawing(options) {
|
|
69
|
+
await requireViewer().createBlankDrawing(options);
|
|
70
|
+
},
|
|
68
71
|
async applyEdits(edits) {
|
|
69
72
|
await requireViewer().applyEdits(edits);
|
|
70
73
|
},
|
|
74
|
+
selectShapes(shapes) {
|
|
75
|
+
requireViewer().selectShapes(shapes);
|
|
76
|
+
},
|
|
77
|
+
selectAll() {
|
|
78
|
+
requireViewer().selectAll();
|
|
79
|
+
},
|
|
80
|
+
clearSelection() {
|
|
81
|
+
requireViewer().clearSelection();
|
|
82
|
+
},
|
|
71
83
|
async replacePlainText(pageId, shapeId, text) {
|
|
72
84
|
await requireViewer().replacePlainText(pageId, shapeId, text);
|
|
73
85
|
},
|
|
86
|
+
async duplicateSelection() {
|
|
87
|
+
await requireViewer().duplicateSelection();
|
|
88
|
+
},
|
|
89
|
+
async copySelection() {
|
|
90
|
+
await requireViewer().copySelection();
|
|
91
|
+
},
|
|
92
|
+
async cutSelection() {
|
|
93
|
+
await requireViewer().cutSelection();
|
|
94
|
+
},
|
|
95
|
+
async pasteSelection() {
|
|
96
|
+
await requireViewer().pasteSelection();
|
|
97
|
+
},
|
|
74
98
|
async undo() {
|
|
75
99
|
await requireViewer().undo();
|
|
76
100
|
},
|
|
@@ -7,7 +7,7 @@ export type ViewerProps = {
|
|
|
7
7
|
} & {
|
|
8
8
|
events?: ViewerCallbacks | undefined;
|
|
9
9
|
};
|
|
10
|
-
export type ViewerHandle = Pick<MountedViewer, 'element' | 'controller' | 'load' | 'applyEdits' | 'replacePlainText' | 'undo' | 'redo' | 'cancelEdit' | 'exportVsdx' | 'fit' | 'setLayerVisibility' | 'resetLayerVisibility' | 'exportSvg' | 'createPrintSnapshot'>;
|
|
10
|
+
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
11
|
/** One mapping for every property and event, shared by every framework adapter. */
|
|
12
12
|
export declare function viewerOptions(props: ViewerProps): ViewerOptions;
|
|
13
13
|
/**
|
|
@@ -33,8 +33,9 @@ export { mountViewer };
|
|
|
33
33
|
export type { MountedViewer, ViewerCallbacks, ViewerOptions, ViewerProperties };
|
|
34
34
|
export { eventKeys, propertyKeys };
|
|
35
35
|
export type { ViewerEvents, VsdxSource } from 'ooxml-ui/visio';
|
|
36
|
+
export type { VisioShapeSelection } from 'ooxml-ui/visio';
|
|
36
37
|
export { ViewerController, type ViewerState } from 'ooxml-ui/visio';
|
|
37
38
|
export type { SvgExportOptions, SvgExportResult } from 'ooxml-ui/visio';
|
|
38
39
|
export type { CurrentPagePrintSnapshotOptions, PrintSnapshot, PrintSnapshotPage, PrintSnapshotOptions, PrintSnapshotLimits, PrintSnapshotUsage, } from 'ooxml-ui/visio';
|
|
39
40
|
export type { ViewerEditState, VsdxExportResult } from 'ooxml-ui/visio';
|
|
40
|
-
export type { VisioEdit, VisioGeometryEdit } from 'ooxml-core/visio';
|
|
41
|
+
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.
|
|
3
|
+
"version": "0.6.0",
|
|
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.8.21",
|
|
41
|
-
"ooxml-core": "^
|
|
42
|
-
"ooxml-ui": "^
|
|
43
|
-
"visio-core": "^0.
|
|
41
|
+
"ooxml-core": "^1.3.0",
|
|
42
|
+
"ooxml-ui": "^1.4.0",
|
|
43
|
+
"visio-core": "^0.4.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"svelte": "^5.0.0"
|