visio-angular-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/index.js CHANGED
@@ -66,12 +66,36 @@ function viewerHandle(current) {
66
66
  async load(source) {
67
67
  await requireViewer().load(source);
68
68
  },
69
+ async createBlankDrawing(options) {
70
+ await requireViewer().createBlankDrawing(options);
71
+ },
69
72
  async applyEdits(edits) {
70
73
  await requireViewer().applyEdits(edits);
71
74
  },
75
+ selectShapes(shapes) {
76
+ requireViewer().selectShapes(shapes);
77
+ },
78
+ selectAll() {
79
+ requireViewer().selectAll();
80
+ },
81
+ clearSelection() {
82
+ requireViewer().clearSelection();
83
+ },
72
84
  async replacePlainText(pageId, shapeId, text) {
73
85
  await requireViewer().replacePlainText(pageId, shapeId, text);
74
86
  },
87
+ async duplicateSelection() {
88
+ await requireViewer().duplicateSelection();
89
+ },
90
+ async copySelection() {
91
+ await requireViewer().copySelection();
92
+ },
93
+ async cutSelection() {
94
+ await requireViewer().cutSelection();
95
+ },
96
+ async pasteSelection() {
97
+ await requireViewer().pasteSelection();
98
+ },
75
99
  async undo() {
76
100
  await requireViewer().undo();
77
101
  },
@@ -152,6 +176,7 @@ var VisioViewerComponent = class VisioViewerComponent {
152
176
  this.pageChange = new EventEmitter();
153
177
  this.zoomChange = new EventEmitter();
154
178
  this.shapeSelect = new EventEmitter();
179
+ this.selectionChange = new EventEmitter();
155
180
  this.host = inject(ElementRef);
156
181
  this.handle = viewerHandle(() => this.binding);
157
182
  this.stopState = () => {};
@@ -163,7 +188,8 @@ var VisioViewerComponent = class VisioViewerComponent {
163
188
  "document-error": this.documentError,
164
189
  "page-change": this.pageChange,
165
190
  "zoom-change": this.zoomChange,
166
- "shape-select": this.shapeSelect
191
+ "shape-select": this.shapeSelect,
192
+ "selection-change": this.selectionChange
167
193
  };
168
194
  }
169
195
  options() {
@@ -197,9 +223,33 @@ var VisioViewerComponent = class VisioViewerComponent {
197
223
  load(source) {
198
224
  return this.handle.load(source);
199
225
  }
226
+ createBlankDrawing(options) {
227
+ return this.handle.createBlankDrawing(options);
228
+ }
200
229
  applyEdits(edits) {
201
230
  return this.handle.applyEdits(edits);
202
231
  }
232
+ selectShapes(shapes) {
233
+ this.handle.selectShapes(shapes);
234
+ }
235
+ selectAll() {
236
+ this.handle.selectAll();
237
+ }
238
+ clearSelection() {
239
+ this.handle.clearSelection();
240
+ }
241
+ duplicateSelection() {
242
+ return this.handle.duplicateSelection();
243
+ }
244
+ copySelection() {
245
+ return this.handle.copySelection();
246
+ }
247
+ cutSelection() {
248
+ return this.handle.cutSelection();
249
+ }
250
+ pasteSelection() {
251
+ return this.handle.pasteSelection();
252
+ }
203
253
  replacePlainText(pageId, shapeId, text) {
204
254
  return this.handle.replacePlainText(pageId, shapeId, text);
205
255
  }
@@ -242,6 +292,7 @@ __decorate([Output()], VisioViewerComponent.prototype, "documentError", void 0);
242
292
  __decorate([Output()], VisioViewerComponent.prototype, "pageChange", void 0);
243
293
  __decorate([Output()], VisioViewerComponent.prototype, "zoomChange", void 0);
244
294
  __decorate([Output()], VisioViewerComponent.prototype, "shapeSelect", void 0);
295
+ __decorate([Output()], VisioViewerComponent.prototype, "selectionChange", void 0);
245
296
  VisioViewerComponent = __decorate([Component({
246
297
  selector: "visio-viewer-host",
247
298
  standalone: true,
@@ -1,5 +1,5 @@
1
1
  import { EventEmitter, type AfterViewInit, type OnChanges, type OnDestroy } from '@angular/core';
2
- import { type ViewerCallbacks, type ViewerProperties, type ViewerState, type VsdxSource, type VisioEdit, type SvgExportOptions, type CurrentPagePrintSnapshotOptions } from './common.js';
2
+ import { type ViewerCallbacks, type ViewerProperties, type ViewerState, type VsdxSource, type VisioEdit, type CreateVsdxOptions, type VisioShapeSelection, type SvgExportOptions, type CurrentPagePrintSnapshotOptions } from './common.js';
3
3
  /** Angular input/output and lifecycle wiring over the one shared browser binding. */
4
4
  export declare class VisioViewerComponent implements AfterViewInit, OnChanges, OnDestroy {
5
5
  document?: ViewerProperties['document'];
@@ -16,11 +16,8 @@ export declare class VisioViewerComponent implements AfterViewInit, OnChanges, O
16
16
  documentError: EventEmitter<Error>;
17
17
  pageChange: EventEmitter<number>;
18
18
  zoomChange: EventEmitter<number>;
19
- shapeSelect: EventEmitter<{
20
- id: string;
21
- name: string;
22
- pageId?: string;
23
- } | null>;
19
+ shapeSelect: EventEmitter<VisioShapeSelection | null>;
20
+ selectionChange: EventEmitter<readonly VisioShapeSelection[]>;
24
21
  private readonly host;
25
22
  private binding;
26
23
  private readonly handle;
@@ -36,7 +33,15 @@ export declare class VisioViewerComponent implements AfterViewInit, OnChanges, O
36
33
  get element(): import("ooxml-ui/visio").VisioViewerElement;
37
34
  get controller(): import("ooxml-ui/visio").ViewerController;
38
35
  load(source: VsdxSource): Promise<void>;
36
+ createBlankDrawing(options?: CreateVsdxOptions): Promise<void>;
39
37
  applyEdits(edits: readonly VisioEdit[]): Promise<void>;
38
+ selectShapes(shapes: readonly VisioShapeSelection[]): void;
39
+ selectAll(): void;
40
+ clearSelection(): void;
41
+ duplicateSelection(): Promise<void>;
42
+ copySelection(): Promise<void>;
43
+ cutSelection(): Promise<void>;
44
+ pasteSelection(): Promise<void>;
40
45
  replacePlainText(pageId: string, shapeId: string, text: string): Promise<void>;
41
46
  undo(): Promise<void>;
42
47
  redo(): Promise<void>;
@@ -48,4 +53,4 @@ export declare class VisioViewerComponent implements AfterViewInit, OnChanges, O
48
53
  exportSvg(options?: SvgExportOptions): import("ooxml-ui/visio").SvgExportResult;
49
54
  createPrintSnapshot(options?: CurrentPagePrintSnapshotOptions): import("ooxml-ui/visio").PrintSnapshot;
50
55
  }
51
- export type { ViewerState, ViewerHandle, ViewerCallbacks, ViewerOptions, ViewerEvents, ViewerEditState, VsdxExportResult, } from './common.js';
56
+ export type { ViewerState, ViewerHandle, ViewerCallbacks, ViewerOptions, ViewerEvents, VisioShapeSelection, CreateVsdxOptions, ViewerEditState, VsdxExportResult, } from './common.js';
@@ -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-angular-viewer",
3
- "version": "0.5.7",
3
+ "version": "0.6.0",
4
4
  "description": "Local-first Visio viewer for angular",
5
5
  "homepage": "https://christophervr.github.io/ooxml/visio/",
6
6
  "bugs": {
@@ -31,9 +31,9 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "emf-converter": "4.8.21",
34
- "ooxml-core": "^0.24.0",
35
- "ooxml-ui": "^0.31.0",
36
- "visio-core": "^0.3.5"
34
+ "ooxml-core": "^1.3.0",
35
+ "ooxml-ui": "^1.4.0",
36
+ "visio-core": "^0.4.0"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "@angular/core": "^21.0.0"