@vertexvis/doc-viewer 0.24.5-canary.8
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/LICENSE +21 -0
- package/dist/cjs/doc-viewer.cjs.js +27 -0
- package/dist/cjs/index-DY-_Uhw6.js +1914 -0
- package/dist/cjs/index.cjs.js +5 -0
- package/dist/cjs/loader.cjs.js +15 -0
- package/dist/cjs/vertex-document-viewer.cjs.entry.js +34272 -0
- package/dist/collection/__mocks__/pdfjs-mock.js +33 -0
- package/dist/collection/__setup__/polyfills.js +28 -0
- package/dist/collection/__setup__/resize-observer.js +13 -0
- package/dist/collection/collection-manifest.json +14 -0
- package/dist/collection/components/document-viewer/document-viewer.css +26 -0
- package/dist/collection/components/document-viewer/document-viewer.js +556 -0
- package/dist/collection/index.js +5 -0
- package/dist/collection/lib/config.js +1 -0
- package/dist/collection/lib/document/api.js +97 -0
- package/dist/collection/lib/document/layers/controller.js +41 -0
- package/dist/collection/lib/document/layers/index.js +5 -0
- package/dist/collection/lib/document/layers/types.js +9 -0
- package/dist/collection/lib/document/provider.js +1 -0
- package/dist/collection/lib/document/renderer.js +22 -0
- package/dist/collection/lib/dom.js +6 -0
- package/dist/collection/lib/index.js +4 -0
- package/dist/collection/lib/interactions/pan-interaction-handler.js +67 -0
- package/dist/collection/lib/pdf/pdfjs-api.js +67 -0
- package/dist/collection/lib/pdf/pdfjs-provider.js +12 -0
- package/dist/collection/lib/pdf/pdfjs-renderer.js +77 -0
- package/dist/collection/lib/types/loadableResource.js +18 -0
- package/dist/collection/polyfill/index.js +7 -0
- package/dist/collection/polyfill/resize-observer.js +9 -0
- package/dist/collection/testing/mock-document-api.js +19 -0
- package/dist/components/index.d.ts +35 -0
- package/dist/components/index.js +4 -0
- package/dist/components/p-DRNDkVQa.js +4 -0
- package/dist/components/vertex-document-viewer.d.ts +11 -0
- package/dist/components/vertex-document-viewer.js +39 -0
- package/dist/doc-viewer/doc-viewer.css +1 -0
- package/dist/doc-viewer/doc-viewer.esm.js +4 -0
- package/dist/doc-viewer/index.esm.js +3 -0
- package/dist/doc-viewer/p-Ct6uMP9a.js +5 -0
- package/dist/doc-viewer/p-b8e2846a.entry.js +39 -0
- package/dist/esm/doc-viewer.js +23 -0
- package/dist/esm/index-Ct6uMP9a.js +1886 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/loader.js +13 -0
- package/dist/esm/vertex-document-viewer.entry.js +34251 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/types/__mocks__/pdfjs-mock.d.ts +30 -0
- package/dist/types/__setup__/polyfills.d.ts +1 -0
- package/dist/types/__setup__/resize-observer.d.ts +1 -0
- package/dist/types/components/document-viewer/document-viewer.d.ts +132 -0
- package/dist/types/components.d.ts +176 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/lib/config.d.ts +8 -0
- package/dist/types/lib/document/api.d.ts +51 -0
- package/dist/types/lib/document/layers/controller.d.ts +24 -0
- package/dist/types/lib/document/layers/index.d.ts +2 -0
- package/dist/types/lib/document/layers/types.d.ts +15 -0
- package/dist/types/lib/document/provider.d.ts +16 -0
- package/dist/types/lib/document/renderer.d.ts +16 -0
- package/dist/types/lib/dom.d.ts +1 -0
- package/dist/types/lib/index.d.ts +1 -0
- package/dist/types/lib/interactions/pan-interaction-handler.d.ts +16 -0
- package/dist/types/lib/pdf/pdfjs-api.d.ts +19 -0
- package/dist/types/lib/pdf/pdfjs-provider.d.ts +10 -0
- package/dist/types/lib/pdf/pdfjs-renderer.d.ts +11 -0
- package/dist/types/lib/types/loadableResource.d.ts +11 -0
- package/dist/types/polyfill/index.d.ts +1 -0
- package/dist/types/polyfill/resize-observer.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1860 -0
- package/dist/types/testing/mock-document-api.d.ts +14 -0
- package/package.json +96 -0
- package/readme.md +17 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Vertex Software LLC. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
export class MockOptionalContentConfig extends Map {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
this.setVisibility = jest.fn();
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export const mockGetViewport = jest.fn(() => ({ width: 100, height: 100 }));
|
|
11
|
+
export const mockPageRender = jest.fn(() => ({ promise: Promise.resolve() }));
|
|
12
|
+
export const mockGetPage = jest.fn(() => ({
|
|
13
|
+
getTextContent: jest.fn(() => ({
|
|
14
|
+
items: [],
|
|
15
|
+
})),
|
|
16
|
+
render: mockPageRender,
|
|
17
|
+
getViewport: mockGetViewport,
|
|
18
|
+
}));
|
|
19
|
+
export const mockDestroy = jest.fn();
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
|
+
export const mockGetDocument = jest.fn(() => ({
|
|
22
|
+
promise: Promise.resolve(mockPdfDocument),
|
|
23
|
+
}));
|
|
24
|
+
export const mockPdfDocument = {
|
|
25
|
+
numPages: 10,
|
|
26
|
+
getPage: mockGetPage,
|
|
27
|
+
getOptionalContentConfig: jest.fn(() => Promise.resolve(new MockOptionalContentConfig())),
|
|
28
|
+
destroy: mockDestroy,
|
|
29
|
+
};
|
|
30
|
+
export const GlobalWorkerOptions = {
|
|
31
|
+
workerSrc: '',
|
|
32
|
+
};
|
|
33
|
+
export const getDocument = mockGetDocument;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Vertex Software LLC. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
// This file contains imports for any browser polyfills that are needed by
|
|
5
|
+
// tests.
|
|
6
|
+
import "abortcontroller-polyfill/dist/polyfill-patch-fetch";
|
|
7
|
+
import { ResizeObserver } from "resize-observer";
|
|
8
|
+
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
9
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
10
|
+
global.ResizeObserver = ResizeObserver;
|
|
11
|
+
global.MessageEvent = class extends Event {
|
|
12
|
+
constructor(type, initDict) {
|
|
13
|
+
super(type);
|
|
14
|
+
this.data = initDict === null || initDict === void 0 ? void 0 : initDict.data;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
global.CloseEvent = class extends Event {
|
|
18
|
+
constructor(type, initDict) {
|
|
19
|
+
super(type);
|
|
20
|
+
this.code = initDict === null || initDict === void 0 ? void 0 : initDict.code;
|
|
21
|
+
this.reason = initDict === null || initDict === void 0 ? void 0 : initDict.reason;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
global.MutationObserver = class {
|
|
25
|
+
constructor() { }
|
|
26
|
+
disconnect() { }
|
|
27
|
+
observe() { }
|
|
28
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Vertex Software LLC. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
5
|
+
export const triggerResizeObserver = jest.fn();
|
|
6
|
+
global.ResizeObserver = class {
|
|
7
|
+
constructor(fn) {
|
|
8
|
+
this.disconnect = jest.fn();
|
|
9
|
+
this.observe = jest.fn();
|
|
10
|
+
this.trigger = triggerResizeObserver.mockImplementation((entries) => this.fn(entries));
|
|
11
|
+
this.fn = fn;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"entries": [
|
|
3
|
+
"components/document-viewer/document-viewer.js"
|
|
4
|
+
],
|
|
5
|
+
"mixins": [],
|
|
6
|
+
"compiler": {
|
|
7
|
+
"name": "@stencil/core",
|
|
8
|
+
"version": "4.43.3",
|
|
9
|
+
"typescriptVersion": "5.8.3"
|
|
10
|
+
},
|
|
11
|
+
"collections": [],
|
|
12
|
+
"bundles": [],
|
|
13
|
+
"global": "polyfill/index.js"
|
|
14
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
position: relative;
|
|
4
|
+
width: 300px;
|
|
5
|
+
height: 300px;
|
|
6
|
+
min-width: 1px;
|
|
7
|
+
min-height: 1px;
|
|
8
|
+
|
|
9
|
+
user-select: none;
|
|
10
|
+
-webkit-user-select: none;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.viewer-container {
|
|
14
|
+
width: 100%;
|
|
15
|
+
height: 100%;
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.canvas-container {
|
|
20
|
+
display: flex;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
align-items: center;
|
|
23
|
+
width: 100%;
|
|
24
|
+
height: 100%;
|
|
25
|
+
position: relative;
|
|
26
|
+
}
|
|
@@ -0,0 +1,556 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Vertex Software LLC. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
5
|
+
import { h, Host } from "@stencil/core";
|
|
6
|
+
import { Dimensions } from "@vertexvis/geometry";
|
|
7
|
+
import classNames from "classnames";
|
|
8
|
+
import { DocumentLayersController } from "../../lib/document/layers/controller";
|
|
9
|
+
import { getElementBoundingClientRect } from "../../lib/dom";
|
|
10
|
+
import { PanInteractionHandler } from "../../lib/interactions/pan-interaction-handler";
|
|
11
|
+
import { PdfJsProvider } from "../../lib/pdf/pdfjs-provider";
|
|
12
|
+
export class VertexDocumentViewer {
|
|
13
|
+
constructor() {
|
|
14
|
+
/**
|
|
15
|
+
* The provider used to create the document API and renderer.
|
|
16
|
+
*/
|
|
17
|
+
this.provider = new PdfJsProvider();
|
|
18
|
+
/**
|
|
19
|
+
* The interaction mode for the viewer. When set to `'pan'`, click and drag
|
|
20
|
+
* will pan the document. When set to `'none'`, no pointer interactions
|
|
21
|
+
* are registered.
|
|
22
|
+
*/
|
|
23
|
+
this.interactionMode = 'pan';
|
|
24
|
+
/**
|
|
25
|
+
* An optional value that will debounce image updates when resizing
|
|
26
|
+
* this viewer element.
|
|
27
|
+
*/
|
|
28
|
+
this.resizeDebounce = 100;
|
|
29
|
+
this.dimensions = Dimensions.create(0, 0);
|
|
30
|
+
}
|
|
31
|
+
componentWillLoad() {
|
|
32
|
+
this.handleElementResize = this.handleElementResize.bind(this);
|
|
33
|
+
this.handleDocumentApiStateChanged = this.handleDocumentApiStateChanged.bind(this);
|
|
34
|
+
this.handlePageLoaded = this.handlePageLoaded.bind(this);
|
|
35
|
+
this.handlePageDrawn = this.handlePageDrawn.bind(this);
|
|
36
|
+
this.resizeObserver = new ResizeObserver(this.handleElementResize);
|
|
37
|
+
}
|
|
38
|
+
componentShouldUpdate(newValue, oldValue, propName) {
|
|
39
|
+
// Ignore updates to the documentState property, as it is only intended to reflect the current state
|
|
40
|
+
// of the document and should not trigger a rerender.
|
|
41
|
+
return propName !== 'documentState';
|
|
42
|
+
}
|
|
43
|
+
componentDidLoad() {
|
|
44
|
+
var _a;
|
|
45
|
+
(_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.observe(this.hostEl);
|
|
46
|
+
this.updateComponentDimensions();
|
|
47
|
+
this.handleSrcChange();
|
|
48
|
+
}
|
|
49
|
+
disconnectedCallback() {
|
|
50
|
+
var _a;
|
|
51
|
+
(_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
52
|
+
this.clearCurrentDocument();
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Pans the currently loaded document by the specified delta.
|
|
56
|
+
*
|
|
57
|
+
* This method will be bounded to the visible portion of the document to ensure
|
|
58
|
+
* at least a portion of the document is always visible, and the `canvas` does not
|
|
59
|
+
* appear blank.
|
|
60
|
+
*
|
|
61
|
+
* @param delta The delta to pan the document by.
|
|
62
|
+
*/
|
|
63
|
+
async panByDelta(delta) {
|
|
64
|
+
await this.getDocumentApi().panByDelta(delta);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Zooms the currently loaded document to the specified zoom percentage.
|
|
68
|
+
*
|
|
69
|
+
* This method will automatically adjust existing offsets to maintain the
|
|
70
|
+
* same center point of the document where possible.
|
|
71
|
+
*
|
|
72
|
+
* @param percentage The zoom percentage to set.
|
|
73
|
+
*/
|
|
74
|
+
async zoomTo(percentage) {
|
|
75
|
+
await this.getDocumentApi().zoomTo(percentage);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Loads a specific page of the currently loaded document.
|
|
79
|
+
*
|
|
80
|
+
* Note that any offset applied by panning the document will be reset when loading
|
|
81
|
+
* a new page.
|
|
82
|
+
*
|
|
83
|
+
* @param pageNumber The page number to load.
|
|
84
|
+
*/
|
|
85
|
+
async loadPage(pageNumber) {
|
|
86
|
+
const documentApi = this.getDocumentApi();
|
|
87
|
+
await documentApi.loadPage(pageNumber);
|
|
88
|
+
}
|
|
89
|
+
async handleSrcChange() {
|
|
90
|
+
if (this.src != null && this.canvasEl != null) {
|
|
91
|
+
this.clearCurrentDocument();
|
|
92
|
+
const { api, renderer } = this.provider.create(this.canvasEl, this.config);
|
|
93
|
+
this.documentApi = api;
|
|
94
|
+
this.documentRenderer = renderer;
|
|
95
|
+
this.layers = new DocumentLayersController(api);
|
|
96
|
+
this.updateInteractionHandler();
|
|
97
|
+
this.updateDocumentApiListeners();
|
|
98
|
+
await this.documentApi.updateViewport(this.dimensions);
|
|
99
|
+
await this.documentApi.load(this.src);
|
|
100
|
+
await this.documentApi.loadPage(1);
|
|
101
|
+
this.documentReady.emit();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
handleConfigChange() {
|
|
105
|
+
this.clearCurrentDocument();
|
|
106
|
+
this.handleSrcChange();
|
|
107
|
+
}
|
|
108
|
+
handleInteractionModeChange() {
|
|
109
|
+
this.updateInteractionHandler();
|
|
110
|
+
}
|
|
111
|
+
render() {
|
|
112
|
+
return (h(Host, { key: '9ebb0012f2edde7189b42f35fd2ecefb779b16ef' }, h("div", { key: 'ef52dd8c6367213d173f3847ff65deac1da6620e', ref: ref => (this.viewerContainerElement = ref), class: "viewer-container", onContextMenu: event => event.preventDefault() }, h("div", { key: 'db0bede43e0798c1c8097f8079d1bbf4bea3fe15', ref: ref => (this.canvasContainerElement = ref), class: classNames('canvas-container', {
|
|
113
|
+
'enable-pointer-events ': window.PointerEvent != null,
|
|
114
|
+
}) }, h("canvas", { key: '3a705edd1985b11256e565880298a729a5e7260b', role: "presentation", ref: el => (this.canvasEl = el) })), h("slot", { key: '9ccb82cc0493342c4e4caf7188c23ad8a55ca93b' }))));
|
|
115
|
+
}
|
|
116
|
+
getDocumentApi() {
|
|
117
|
+
if (this.documentApi == null) {
|
|
118
|
+
throw new Error('No document has been loaded. Ensure that the `src` property is set and the resource is accessible.');
|
|
119
|
+
}
|
|
120
|
+
return this.documentApi;
|
|
121
|
+
}
|
|
122
|
+
clearCurrentDocument() {
|
|
123
|
+
var _a, _b, _c, _d, _e, _f;
|
|
124
|
+
(_a = this.documentRenderer) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
125
|
+
(_b = this.documentApi) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
126
|
+
(_c = this.panInteractionHandler) === null || _c === void 0 ? void 0 : _c.dispose();
|
|
127
|
+
(_d = this.documentApiStateChangedDisposable) === null || _d === void 0 ? void 0 : _d.dispose();
|
|
128
|
+
(_e = this.pageLoadedDisposable) === null || _e === void 0 ? void 0 : _e.dispose();
|
|
129
|
+
(_f = this.pageDrawnDisposable) === null || _f === void 0 ? void 0 : _f.dispose();
|
|
130
|
+
this.layers = undefined;
|
|
131
|
+
}
|
|
132
|
+
handleDocumentApiStateChanged(state) {
|
|
133
|
+
this.documentState = state;
|
|
134
|
+
this.documentStateChanged.emit(state);
|
|
135
|
+
}
|
|
136
|
+
handlePageLoaded(state) {
|
|
137
|
+
this.pageLoaded.emit(state);
|
|
138
|
+
}
|
|
139
|
+
handlePageDrawn(state) {
|
|
140
|
+
this.pageDrawn.emit(state);
|
|
141
|
+
}
|
|
142
|
+
updateDocumentApiListeners() {
|
|
143
|
+
var _a, _b, _c;
|
|
144
|
+
this.documentApiStateChangedDisposable = (_a = this.documentApi) === null || _a === void 0 ? void 0 : _a.onStateChanged(this.handleDocumentApiStateChanged);
|
|
145
|
+
this.pageLoadedDisposable = (_b = this.documentRenderer) === null || _b === void 0 ? void 0 : _b.onPageLoaded(this.handlePageLoaded);
|
|
146
|
+
this.pageDrawnDisposable = (_c = this.documentRenderer) === null || _c === void 0 ? void 0 : _c.onPageDrawn(this.handlePageDrawn);
|
|
147
|
+
}
|
|
148
|
+
updateInteractionHandler() {
|
|
149
|
+
var _a;
|
|
150
|
+
(_a = this.panInteractionHandler) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
151
|
+
if (this.interactionMode === 'pan' && this.canvasEl != null && this.documentApi != null) {
|
|
152
|
+
this.panInteractionHandler = new PanInteractionHandler(this.canvasEl, this.documentApi);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
updateComponentDimensions(dimensions) {
|
|
156
|
+
this.dimensions = dimensions !== null && dimensions !== void 0 ? dimensions : getElementBoundingClientRect(this.hostEl);
|
|
157
|
+
if (this.canvasEl != null) {
|
|
158
|
+
this.canvasEl.width = Math.floor(this.dimensions.width * window.devicePixelRatio);
|
|
159
|
+
this.canvasEl.height = Math.floor(this.dimensions.height * window.devicePixelRatio);
|
|
160
|
+
this.canvasEl.style.width = `${this.dimensions.width}px`;
|
|
161
|
+
this.canvasEl.style.height = `${this.dimensions.height}px`;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
async handleElementResize(entries) {
|
|
165
|
+
const dimensionsHaveChanged = entries.length > 0 && this.dimensions != null && !Dimensions.isEqual(entries[0].contentRect, this.dimensions);
|
|
166
|
+
if (dimensionsHaveChanged) {
|
|
167
|
+
this.restartResizeTimer(Dimensions.create(entries[0].contentRect.width, entries[0].contentRect.height));
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
restartResizeTimer(dimensions) {
|
|
171
|
+
if (this.resizeTimer != null) {
|
|
172
|
+
window.clearTimeout(this.resizeTimer);
|
|
173
|
+
}
|
|
174
|
+
this.resizeTimer = window.setTimeout(async () => {
|
|
175
|
+
var _a;
|
|
176
|
+
this.updateComponentDimensions(dimensions);
|
|
177
|
+
await ((_a = this.documentApi) === null || _a === void 0 ? void 0 : _a.updateViewport(this.dimensions));
|
|
178
|
+
}, this.resizeDebounce);
|
|
179
|
+
}
|
|
180
|
+
static get is() { return "vertex-document-viewer"; }
|
|
181
|
+
static get encapsulation() { return "shadow"; }
|
|
182
|
+
static get originalStyleUrls() {
|
|
183
|
+
return {
|
|
184
|
+
"$": ["document-viewer.css"]
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
static get styleUrls() {
|
|
188
|
+
return {
|
|
189
|
+
"$": ["document-viewer.css"]
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
static get properties() {
|
|
193
|
+
return {
|
|
194
|
+
"src": {
|
|
195
|
+
"type": "string",
|
|
196
|
+
"mutable": false,
|
|
197
|
+
"complexType": {
|
|
198
|
+
"original": "string",
|
|
199
|
+
"resolved": "string | undefined",
|
|
200
|
+
"references": {}
|
|
201
|
+
},
|
|
202
|
+
"required": false,
|
|
203
|
+
"optional": true,
|
|
204
|
+
"docs": {
|
|
205
|
+
"tags": [],
|
|
206
|
+
"text": "A URI of the document to load when the component is mounted in the DOM tree.\nCurrently only supports URLs for client-side rendering."
|
|
207
|
+
},
|
|
208
|
+
"getter": false,
|
|
209
|
+
"setter": false,
|
|
210
|
+
"reflect": false,
|
|
211
|
+
"attribute": "src"
|
|
212
|
+
},
|
|
213
|
+
"documentId": {
|
|
214
|
+
"type": "string",
|
|
215
|
+
"mutable": false,
|
|
216
|
+
"complexType": {
|
|
217
|
+
"original": "string",
|
|
218
|
+
"resolved": "string | undefined",
|
|
219
|
+
"references": {}
|
|
220
|
+
},
|
|
221
|
+
"required": false,
|
|
222
|
+
"optional": true,
|
|
223
|
+
"docs": {
|
|
224
|
+
"tags": [],
|
|
225
|
+
"text": "The ID of the loaded `Document`. This ID is required to enable persistence of\nannotations.\n\nNote that this is different than a `File` ID within the Vertex Platform, and must\nbe created separately using the `/documents` endpoints.\nSee https://docs.vertex3d.com/ for more details."
|
|
226
|
+
},
|
|
227
|
+
"getter": false,
|
|
228
|
+
"setter": false,
|
|
229
|
+
"reflect": true,
|
|
230
|
+
"attribute": "document-id"
|
|
231
|
+
},
|
|
232
|
+
"provider": {
|
|
233
|
+
"type": "unknown",
|
|
234
|
+
"mutable": true,
|
|
235
|
+
"complexType": {
|
|
236
|
+
"original": "DocumentProvider",
|
|
237
|
+
"resolved": "DocumentProvider",
|
|
238
|
+
"references": {
|
|
239
|
+
"DocumentProvider": {
|
|
240
|
+
"location": "import",
|
|
241
|
+
"path": "../../lib/document/provider",
|
|
242
|
+
"id": "src/lib/document/provider.ts::DocumentProvider",
|
|
243
|
+
"referenceLocation": "DocumentProvider"
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
"required": false,
|
|
248
|
+
"optional": false,
|
|
249
|
+
"docs": {
|
|
250
|
+
"tags": [],
|
|
251
|
+
"text": "The provider used to create the document API and renderer."
|
|
252
|
+
},
|
|
253
|
+
"getter": false,
|
|
254
|
+
"setter": false,
|
|
255
|
+
"defaultValue": "new PdfJsProvider()"
|
|
256
|
+
},
|
|
257
|
+
"interactionMode": {
|
|
258
|
+
"type": "string",
|
|
259
|
+
"mutable": false,
|
|
260
|
+
"complexType": {
|
|
261
|
+
"original": "InteractionMode",
|
|
262
|
+
"resolved": "\"none\" | \"pan\"",
|
|
263
|
+
"references": {
|
|
264
|
+
"InteractionMode": {
|
|
265
|
+
"location": "local",
|
|
266
|
+
"path": "/home/runner/work/vertex-web-sdk/vertex-web-sdk/packages/doc-viewer/src/components/document-viewer/document-viewer.tsx",
|
|
267
|
+
"id": "src/components/document-viewer/document-viewer.tsx::InteractionMode"
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
"required": false,
|
|
272
|
+
"optional": false,
|
|
273
|
+
"docs": {
|
|
274
|
+
"tags": [],
|
|
275
|
+
"text": "The interaction mode for the viewer. When set to `'pan'`, click and drag\nwill pan the document. When set to `'none'`, no pointer interactions\nare registered."
|
|
276
|
+
},
|
|
277
|
+
"getter": false,
|
|
278
|
+
"setter": false,
|
|
279
|
+
"reflect": false,
|
|
280
|
+
"attribute": "interaction-mode",
|
|
281
|
+
"defaultValue": "'pan'"
|
|
282
|
+
},
|
|
283
|
+
"documentState": {
|
|
284
|
+
"type": "unknown",
|
|
285
|
+
"mutable": true,
|
|
286
|
+
"complexType": {
|
|
287
|
+
"original": "DocumentApiState",
|
|
288
|
+
"resolved": "DocumentApiState | undefined",
|
|
289
|
+
"references": {
|
|
290
|
+
"DocumentApiState": {
|
|
291
|
+
"location": "import",
|
|
292
|
+
"path": "../../lib/document/api",
|
|
293
|
+
"id": "src/lib/document/api.ts::DocumentApiState",
|
|
294
|
+
"referenceLocation": "DocumentApiState"
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
"required": false,
|
|
299
|
+
"optional": true,
|
|
300
|
+
"docs": {
|
|
301
|
+
"tags": [],
|
|
302
|
+
"text": "Common state of the current document. This value includes information common to all\ntypes of documents, including state like zoom percentage, viewport definition, and offsets."
|
|
303
|
+
},
|
|
304
|
+
"getter": false,
|
|
305
|
+
"setter": false
|
|
306
|
+
},
|
|
307
|
+
"layers": {
|
|
308
|
+
"type": "unknown",
|
|
309
|
+
"mutable": true,
|
|
310
|
+
"complexType": {
|
|
311
|
+
"original": "DocumentLayersController",
|
|
312
|
+
"resolved": "DocumentLayersController | undefined",
|
|
313
|
+
"references": {
|
|
314
|
+
"DocumentLayersController": {
|
|
315
|
+
"location": "import",
|
|
316
|
+
"path": "../../lib/document/layers/controller",
|
|
317
|
+
"id": "src/lib/document/layers/controller.ts::DocumentLayersController",
|
|
318
|
+
"referenceLocation": "DocumentLayersController"
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
},
|
|
322
|
+
"required": false,
|
|
323
|
+
"optional": true,
|
|
324
|
+
"docs": {
|
|
325
|
+
"tags": [],
|
|
326
|
+
"text": "Controller for interacting with layers in the currently loaded document.\n\nThis controller will automatically be created along with the loaded document.\nNote that the methods available on this controller will only be supported if\nthe underlying document type supports layers."
|
|
327
|
+
},
|
|
328
|
+
"getter": false,
|
|
329
|
+
"setter": false
|
|
330
|
+
},
|
|
331
|
+
"config": {
|
|
332
|
+
"type": "unknown",
|
|
333
|
+
"mutable": false,
|
|
334
|
+
"complexType": {
|
|
335
|
+
"original": "PartialConfig",
|
|
336
|
+
"resolved": "Config | undefined",
|
|
337
|
+
"references": {
|
|
338
|
+
"PartialConfig": {
|
|
339
|
+
"location": "import",
|
|
340
|
+
"path": "../../lib/config",
|
|
341
|
+
"id": "src/lib/config.ts::PartialConfig",
|
|
342
|
+
"referenceLocation": "PartialConfig"
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
},
|
|
346
|
+
"required": false,
|
|
347
|
+
"optional": true,
|
|
348
|
+
"docs": {
|
|
349
|
+
"tags": [],
|
|
350
|
+
"text": "Configuration values for the document viewer. See {@link Config } for more information\non the available configuration options."
|
|
351
|
+
},
|
|
352
|
+
"getter": false,
|
|
353
|
+
"setter": false
|
|
354
|
+
},
|
|
355
|
+
"resizeDebounce": {
|
|
356
|
+
"type": "number",
|
|
357
|
+
"mutable": false,
|
|
358
|
+
"complexType": {
|
|
359
|
+
"original": "number",
|
|
360
|
+
"resolved": "number",
|
|
361
|
+
"references": {}
|
|
362
|
+
},
|
|
363
|
+
"required": false,
|
|
364
|
+
"optional": false,
|
|
365
|
+
"docs": {
|
|
366
|
+
"tags": [],
|
|
367
|
+
"text": "An optional value that will debounce image updates when resizing\nthis viewer element."
|
|
368
|
+
},
|
|
369
|
+
"getter": false,
|
|
370
|
+
"setter": false,
|
|
371
|
+
"reflect": false,
|
|
372
|
+
"attribute": "resize-debounce",
|
|
373
|
+
"defaultValue": "100"
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
static get events() {
|
|
378
|
+
return [{
|
|
379
|
+
"method": "documentReady",
|
|
380
|
+
"name": "documentReady",
|
|
381
|
+
"bubbles": true,
|
|
382
|
+
"cancelable": true,
|
|
383
|
+
"composed": true,
|
|
384
|
+
"docs": {
|
|
385
|
+
"tags": [],
|
|
386
|
+
"text": "Emits an event when the document is ready to be interacted with."
|
|
387
|
+
},
|
|
388
|
+
"complexType": {
|
|
389
|
+
"original": "void",
|
|
390
|
+
"resolved": "void",
|
|
391
|
+
"references": {}
|
|
392
|
+
}
|
|
393
|
+
}, {
|
|
394
|
+
"method": "documentStateChanged",
|
|
395
|
+
"name": "documentStateChanged",
|
|
396
|
+
"bubbles": true,
|
|
397
|
+
"cancelable": true,
|
|
398
|
+
"composed": true,
|
|
399
|
+
"docs": {
|
|
400
|
+
"tags": [],
|
|
401
|
+
"text": "Emits an event when the document state changes."
|
|
402
|
+
},
|
|
403
|
+
"complexType": {
|
|
404
|
+
"original": "DocumentApiState",
|
|
405
|
+
"resolved": "DocumentApiState",
|
|
406
|
+
"references": {
|
|
407
|
+
"DocumentApiState": {
|
|
408
|
+
"location": "import",
|
|
409
|
+
"path": "../../lib/document/api",
|
|
410
|
+
"id": "src/lib/document/api.ts::DocumentApiState",
|
|
411
|
+
"referenceLocation": "DocumentApiState"
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
}, {
|
|
416
|
+
"method": "pageLoaded",
|
|
417
|
+
"name": "pageLoaded",
|
|
418
|
+
"bubbles": true,
|
|
419
|
+
"cancelable": true,
|
|
420
|
+
"composed": true,
|
|
421
|
+
"docs": {
|
|
422
|
+
"tags": [],
|
|
423
|
+
"text": "Emits an event when a page has been loaded or reloaded prior to being\ndrawn to the canvas."
|
|
424
|
+
},
|
|
425
|
+
"complexType": {
|
|
426
|
+
"original": "DocumentApiState",
|
|
427
|
+
"resolved": "DocumentApiState",
|
|
428
|
+
"references": {
|
|
429
|
+
"DocumentApiState": {
|
|
430
|
+
"location": "import",
|
|
431
|
+
"path": "../../lib/document/api",
|
|
432
|
+
"id": "src/lib/document/api.ts::DocumentApiState",
|
|
433
|
+
"referenceLocation": "DocumentApiState"
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}, {
|
|
438
|
+
"method": "pageDrawn",
|
|
439
|
+
"name": "pageDrawn",
|
|
440
|
+
"bubbles": true,
|
|
441
|
+
"cancelable": true,
|
|
442
|
+
"composed": true,
|
|
443
|
+
"docs": {
|
|
444
|
+
"tags": [],
|
|
445
|
+
"text": "Emits an event when a page has been drawn to the canvas."
|
|
446
|
+
},
|
|
447
|
+
"complexType": {
|
|
448
|
+
"original": "DocumentApiState",
|
|
449
|
+
"resolved": "DocumentApiState",
|
|
450
|
+
"references": {
|
|
451
|
+
"DocumentApiState": {
|
|
452
|
+
"location": "import",
|
|
453
|
+
"path": "../../lib/document/api",
|
|
454
|
+
"id": "src/lib/document/api.ts::DocumentApiState",
|
|
455
|
+
"referenceLocation": "DocumentApiState"
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}];
|
|
460
|
+
}
|
|
461
|
+
static get methods() {
|
|
462
|
+
return {
|
|
463
|
+
"panByDelta": {
|
|
464
|
+
"complexType": {
|
|
465
|
+
"signature": "(delta: Point.Point) => Promise<void>",
|
|
466
|
+
"parameters": [{
|
|
467
|
+
"name": "delta",
|
|
468
|
+
"type": "Point",
|
|
469
|
+
"docs": "The delta to pan the document by."
|
|
470
|
+
}],
|
|
471
|
+
"references": {
|
|
472
|
+
"Promise": {
|
|
473
|
+
"location": "global",
|
|
474
|
+
"id": "global::Promise"
|
|
475
|
+
},
|
|
476
|
+
"Point": {
|
|
477
|
+
"location": "import",
|
|
478
|
+
"path": "@vertexvis/geometry",
|
|
479
|
+
"id": "../geometry/dist/index.d.ts::\"/home/runner/work/vertex-web-sdk/vertex-web-sdk/packages/geometry/dist/point\"",
|
|
480
|
+
"referenceLocation": "Point"
|
|
481
|
+
}
|
|
482
|
+
},
|
|
483
|
+
"return": "Promise<void>"
|
|
484
|
+
},
|
|
485
|
+
"docs": {
|
|
486
|
+
"text": "Pans the currently loaded document by the specified delta.\n\nThis method will be bounded to the visible portion of the document to ensure\nat least a portion of the document is always visible, and the `canvas` does not\nappear blank.",
|
|
487
|
+
"tags": [{
|
|
488
|
+
"name": "param",
|
|
489
|
+
"text": "delta The delta to pan the document by."
|
|
490
|
+
}]
|
|
491
|
+
}
|
|
492
|
+
},
|
|
493
|
+
"zoomTo": {
|
|
494
|
+
"complexType": {
|
|
495
|
+
"signature": "(percentage: number) => Promise<void>",
|
|
496
|
+
"parameters": [{
|
|
497
|
+
"name": "percentage",
|
|
498
|
+
"type": "number",
|
|
499
|
+
"docs": "The zoom percentage to set."
|
|
500
|
+
}],
|
|
501
|
+
"references": {
|
|
502
|
+
"Promise": {
|
|
503
|
+
"location": "global",
|
|
504
|
+
"id": "global::Promise"
|
|
505
|
+
}
|
|
506
|
+
},
|
|
507
|
+
"return": "Promise<void>"
|
|
508
|
+
},
|
|
509
|
+
"docs": {
|
|
510
|
+
"text": "Zooms the currently loaded document to the specified zoom percentage.\n\nThis method will automatically adjust existing offsets to maintain the\nsame center point of the document where possible.",
|
|
511
|
+
"tags": [{
|
|
512
|
+
"name": "param",
|
|
513
|
+
"text": "percentage The zoom percentage to set."
|
|
514
|
+
}]
|
|
515
|
+
}
|
|
516
|
+
},
|
|
517
|
+
"loadPage": {
|
|
518
|
+
"complexType": {
|
|
519
|
+
"signature": "(pageNumber: number) => Promise<void>",
|
|
520
|
+
"parameters": [{
|
|
521
|
+
"name": "pageNumber",
|
|
522
|
+
"type": "number",
|
|
523
|
+
"docs": "The page number to load."
|
|
524
|
+
}],
|
|
525
|
+
"references": {
|
|
526
|
+
"Promise": {
|
|
527
|
+
"location": "global",
|
|
528
|
+
"id": "global::Promise"
|
|
529
|
+
}
|
|
530
|
+
},
|
|
531
|
+
"return": "Promise<void>"
|
|
532
|
+
},
|
|
533
|
+
"docs": {
|
|
534
|
+
"text": "Loads a specific page of the currently loaded document.\n\nNote that any offset applied by panning the document will be reset when loading\na new page.",
|
|
535
|
+
"tags": [{
|
|
536
|
+
"name": "param",
|
|
537
|
+
"text": "pageNumber The page number to load."
|
|
538
|
+
}]
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
static get elementRef() { return "hostEl"; }
|
|
544
|
+
static get watchers() {
|
|
545
|
+
return [{
|
|
546
|
+
"propName": "src",
|
|
547
|
+
"methodName": "handleSrcChange"
|
|
548
|
+
}, {
|
|
549
|
+
"propName": "config",
|
|
550
|
+
"methodName": "handleConfigChange"
|
|
551
|
+
}, {
|
|
552
|
+
"propName": "interactionMode",
|
|
553
|
+
"methodName": "handleInteractionModeChange"
|
|
554
|
+
}];
|
|
555
|
+
}
|
|
556
|
+
}
|