@vertexvis/doc-viewer 1.0.0-canary.5 → 1.0.0-canary.6
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/cjs/doc-viewer.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/vertex-document-viewer.cjs.entry.js +32 -2
- package/dist/collection/components/document-viewer/document-viewer.js +71 -2
- package/dist/components/vertex-document-viewer.js +2 -2
- package/dist/doc-viewer/doc-viewer.esm.js +1 -1
- package/dist/doc-viewer/{p-e5411da0.entry.js → p-796f1fa7.entry.js} +1 -1
- package/dist/esm/doc-viewer.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/loader.mjs +1 -1
- package/dist/esm/vertex-document-viewer.entry.js +32 -2
- package/dist/types/components/document-viewer/document-viewer.d.ts +16 -2
- package/dist/types/components.d.ts +8 -0
- package/package.json +4 -4
|
@@ -21,7 +21,7 @@ var patchBrowser = () => {
|
|
|
21
21
|
|
|
22
22
|
patchBrowser().then(async (options) => {
|
|
23
23
|
await index.globalScripts();
|
|
24
|
-
return index.bootstrapLazy([["vertex-document-viewer.cjs",[[257,"vertex-document-viewer",{"src":[1],"documentId":[513,"document-id"],"provider":[1040],"interactionMode":[1,"interaction-mode"],"documentState":[1040],"layers":[1040],"config":[16],"resizeDebounce":[2,"resize-debounce"],"panByDelta":[64],"zoomTo":[64],"loadPage":[64]},null,{"src":[{"handleSrcChange":0}],"config":[{"handleConfigChange":0}],"interactionMode":[{"handleInteractionModeChange":0}]}]]]], options);
|
|
24
|
+
return index.bootstrapLazy([["vertex-document-viewer.cjs",[[257,"vertex-document-viewer",{"src":[1],"documentId":[513,"document-id"],"provider":[1040],"interactionMode":[1,"interaction-mode"],"documentState":[1040],"layers":[1040],"config":[16],"resizeDebounce":[2,"resize-debounce"],"registerBasicInteractionHandler":[64],"panByDelta":[64],"zoomTo":[64],"loadPage":[64]},null,{"src":[{"handleSrcChange":0}],"config":[{"handleConfigChange":0}],"interactionMode":[{"handleInteractionModeChange":0}]}]]]], options);
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
exports.setNonce = index.setNonce;
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -8,7 +8,7 @@ var index = require('./index-UmtQ5Ckn.js');
|
|
|
8
8
|
const defineCustomElements = async (win, options) => {
|
|
9
9
|
if (typeof window === 'undefined') return undefined;
|
|
10
10
|
await index.globalScripts();
|
|
11
|
-
return index.bootstrapLazy([["vertex-document-viewer.cjs",[[257,"vertex-document-viewer",{"src":[1],"documentId":[513,"document-id"],"provider":[1040],"interactionMode":[1,"interaction-mode"],"documentState":[1040],"layers":[1040],"config":[16],"resizeDebounce":[2,"resize-debounce"],"panByDelta":[64],"zoomTo":[64],"loadPage":[64]},null,{"src":[{"handleSrcChange":0}],"config":[{"handleConfigChange":0}],"interactionMode":[{"handleInteractionModeChange":0}]}]]]], options);
|
|
11
|
+
return index.bootstrapLazy([["vertex-document-viewer.cjs",[[257,"vertex-document-viewer",{"src":[1],"documentId":[513,"document-id"],"provider":[1040],"interactionMode":[1,"interaction-mode"],"documentState":[1040],"layers":[1040],"config":[16],"resizeDebounce":[2,"resize-debounce"],"registerBasicInteractionHandler":[64],"panByDelta":[64],"zoomTo":[64],"loadPage":[64]},null,{"src":[{"handleSrcChange":0}],"config":[{"handleConfigChange":0}],"interactionMode":[{"handleInteractionModeChange":0}]}]]]], options);
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
exports.setNonce = index.setNonce;
|
|
@@ -34636,6 +34636,7 @@ const VertexDocumentViewer = class {
|
|
|
34636
34636
|
*/
|
|
34637
34637
|
this.resizeDebounce = 100;
|
|
34638
34638
|
this.dimensions = dimensions.create(0, 0);
|
|
34639
|
+
this.interactionHandlers = [];
|
|
34639
34640
|
}
|
|
34640
34641
|
componentWillLoad() {
|
|
34641
34642
|
this.handleElementResize = this.handleElementResize.bind(this);
|
|
@@ -34660,6 +34661,29 @@ const VertexDocumentViewer = class {
|
|
|
34660
34661
|
(_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
34661
34662
|
this.clearCurrentDocument();
|
|
34662
34663
|
}
|
|
34664
|
+
/**
|
|
34665
|
+
* Registers and initializes an interaction handler with the document viewer. Returns a
|
|
34666
|
+
* `Disposable` that should be used to deregister the interaction handler.
|
|
34667
|
+
*
|
|
34668
|
+
* `InteractionHandler`s are used to build custom mouse and touch interactions.
|
|
34669
|
+
*
|
|
34670
|
+
* @param interactionHandler The interaction handler to register.
|
|
34671
|
+
* @returns {Promise<void>} A promise containing the disposable to use to
|
|
34672
|
+
* deregister the handler.
|
|
34673
|
+
*/
|
|
34674
|
+
async registerBasicInteractionHandler(interactionHandler) {
|
|
34675
|
+
this.interactionHandlers.push(interactionHandler);
|
|
34676
|
+
this.initializeInteractionHandler(interactionHandler);
|
|
34677
|
+
return {
|
|
34678
|
+
dispose: () => {
|
|
34679
|
+
const index = this.interactionHandlers.indexOf(interactionHandler);
|
|
34680
|
+
if (index !== -1) {
|
|
34681
|
+
this.interactionHandlers[index].dispose();
|
|
34682
|
+
this.interactionHandlers.splice(index, 1);
|
|
34683
|
+
}
|
|
34684
|
+
},
|
|
34685
|
+
};
|
|
34686
|
+
}
|
|
34663
34687
|
/**
|
|
34664
34688
|
* Pans the currently loaded document by the specified delta.
|
|
34665
34689
|
*
|
|
@@ -34718,9 +34742,9 @@ const VertexDocumentViewer = class {
|
|
|
34718
34742
|
this.updateInteractionHandler();
|
|
34719
34743
|
}
|
|
34720
34744
|
render() {
|
|
34721
|
-
return (index.h(index.Host, { key: '
|
|
34745
|
+
return (index.h(index.Host, { key: '45d2a2dceb6008a12702493edc50337f5d3568f7' }, index.h("div", { key: '862161f98d61fdf01996202e3e9be6281eea62ae', ref: ref => (this.viewerContainerElement = ref), class: "viewer-container", onContextMenu: event => event.preventDefault() }, index.h("div", { key: '05936dfbd06a9b0a05f21d7ada870a40109e93d0', ref: ref => (this.canvasContainerElement = ref), class: classNames('canvas-container', {
|
|
34722
34746
|
'enable-pointer-events ': window.PointerEvent != null,
|
|
34723
|
-
}) }, index.h("canvas", { key: '
|
|
34747
|
+
}) }, index.h("canvas", { key: '230fc4741a7eb3c621d93056ab959d3cfd3d9a20', role: "presentation", ref: el => (this.canvasEl = el) })), index.h("slot", { key: '6720a16f6e5ee1bfd605dc8adb6413a4f6d44e24' }))));
|
|
34724
34748
|
}
|
|
34725
34749
|
getDocumentApi() {
|
|
34726
34750
|
if (this.documentApi == null) {
|
|
@@ -34786,6 +34810,12 @@ const VertexDocumentViewer = class {
|
|
|
34786
34810
|
await ((_a = this.documentApi) === null || _a === void 0 ? void 0 : _a.updateViewport(this.dimensions));
|
|
34787
34811
|
}, this.resizeDebounce);
|
|
34788
34812
|
}
|
|
34813
|
+
initializeInteractionHandler(handler) {
|
|
34814
|
+
if (this.canvasEl == null) {
|
|
34815
|
+
throw new Error('Cannot initialize interaction handler');
|
|
34816
|
+
}
|
|
34817
|
+
handler.initialize(this.canvasEl);
|
|
34818
|
+
}
|
|
34789
34819
|
get hostEl() { return index.getElement(this); }
|
|
34790
34820
|
static get watchers() { return {
|
|
34791
34821
|
"src": [{
|
|
@@ -27,6 +27,7 @@ export class VertexDocumentViewer {
|
|
|
27
27
|
*/
|
|
28
28
|
this.resizeDebounce = 100;
|
|
29
29
|
this.dimensions = Dimensions.create(0, 0);
|
|
30
|
+
this.interactionHandlers = [];
|
|
30
31
|
}
|
|
31
32
|
componentWillLoad() {
|
|
32
33
|
this.handleElementResize = this.handleElementResize.bind(this);
|
|
@@ -51,6 +52,29 @@ export class VertexDocumentViewer {
|
|
|
51
52
|
(_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
52
53
|
this.clearCurrentDocument();
|
|
53
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Registers and initializes an interaction handler with the document viewer. Returns a
|
|
57
|
+
* `Disposable` that should be used to deregister the interaction handler.
|
|
58
|
+
*
|
|
59
|
+
* `InteractionHandler`s are used to build custom mouse and touch interactions.
|
|
60
|
+
*
|
|
61
|
+
* @param interactionHandler The interaction handler to register.
|
|
62
|
+
* @returns {Promise<void>} A promise containing the disposable to use to
|
|
63
|
+
* deregister the handler.
|
|
64
|
+
*/
|
|
65
|
+
async registerBasicInteractionHandler(interactionHandler) {
|
|
66
|
+
this.interactionHandlers.push(interactionHandler);
|
|
67
|
+
this.initializeInteractionHandler(interactionHandler);
|
|
68
|
+
return {
|
|
69
|
+
dispose: () => {
|
|
70
|
+
const index = this.interactionHandlers.indexOf(interactionHandler);
|
|
71
|
+
if (index !== -1) {
|
|
72
|
+
this.interactionHandlers[index].dispose();
|
|
73
|
+
this.interactionHandlers.splice(index, 1);
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
}
|
|
54
78
|
/**
|
|
55
79
|
* Pans the currently loaded document by the specified delta.
|
|
56
80
|
*
|
|
@@ -109,9 +133,9 @@ export class VertexDocumentViewer {
|
|
|
109
133
|
this.updateInteractionHandler();
|
|
110
134
|
}
|
|
111
135
|
render() {
|
|
112
|
-
return (h(Host, { key: '
|
|
136
|
+
return (h(Host, { key: '45d2a2dceb6008a12702493edc50337f5d3568f7' }, h("div", { key: '862161f98d61fdf01996202e3e9be6281eea62ae', ref: ref => (this.viewerContainerElement = ref), class: "viewer-container", onContextMenu: event => event.preventDefault() }, h("div", { key: '05936dfbd06a9b0a05f21d7ada870a40109e93d0', ref: ref => (this.canvasContainerElement = ref), class: classNames('canvas-container', {
|
|
113
137
|
'enable-pointer-events ': window.PointerEvent != null,
|
|
114
|
-
}) }, h("canvas", { key: '
|
|
138
|
+
}) }, h("canvas", { key: '230fc4741a7eb3c621d93056ab959d3cfd3d9a20', role: "presentation", ref: el => (this.canvasEl = el) })), h("slot", { key: '6720a16f6e5ee1bfd605dc8adb6413a4f6d44e24' }))));
|
|
115
139
|
}
|
|
116
140
|
getDocumentApi() {
|
|
117
141
|
if (this.documentApi == null) {
|
|
@@ -177,6 +201,12 @@ export class VertexDocumentViewer {
|
|
|
177
201
|
await ((_a = this.documentApi) === null || _a === void 0 ? void 0 : _a.updateViewport(this.dimensions));
|
|
178
202
|
}, this.resizeDebounce);
|
|
179
203
|
}
|
|
204
|
+
initializeInteractionHandler(handler) {
|
|
205
|
+
if (this.canvasEl == null) {
|
|
206
|
+
throw new Error('Cannot initialize interaction handler');
|
|
207
|
+
}
|
|
208
|
+
handler.initialize(this.canvasEl);
|
|
209
|
+
}
|
|
180
210
|
static get is() { return "vertex-document-viewer"; }
|
|
181
211
|
static get encapsulation() { return "shadow"; }
|
|
182
212
|
static get originalStyleUrls() {
|
|
@@ -460,6 +490,45 @@ export class VertexDocumentViewer {
|
|
|
460
490
|
}
|
|
461
491
|
static get methods() {
|
|
462
492
|
return {
|
|
493
|
+
"registerBasicInteractionHandler": {
|
|
494
|
+
"complexType": {
|
|
495
|
+
"signature": "(interactionHandler: BasicInteractionHandler) => Promise<Disposable>",
|
|
496
|
+
"parameters": [{
|
|
497
|
+
"name": "interactionHandler",
|
|
498
|
+
"type": "BasicInteractionHandler",
|
|
499
|
+
"docs": "The interaction handler to register."
|
|
500
|
+
}],
|
|
501
|
+
"references": {
|
|
502
|
+
"Promise": {
|
|
503
|
+
"location": "global",
|
|
504
|
+
"id": "global::Promise"
|
|
505
|
+
},
|
|
506
|
+
"Disposable": {
|
|
507
|
+
"location": "import",
|
|
508
|
+
"path": "@vertexvis/utils",
|
|
509
|
+
"id": "../utils/dist/index.d.ts::Disposable",
|
|
510
|
+
"referenceLocation": "Disposable"
|
|
511
|
+
},
|
|
512
|
+
"BasicInteractionHandler": {
|
|
513
|
+
"location": "import",
|
|
514
|
+
"path": "@vertexvis/utils",
|
|
515
|
+
"id": "../utils/dist/index.d.ts::BasicInteractionHandler",
|
|
516
|
+
"referenceLocation": "BasicInteractionHandler"
|
|
517
|
+
}
|
|
518
|
+
},
|
|
519
|
+
"return": "Promise<Disposable>"
|
|
520
|
+
},
|
|
521
|
+
"docs": {
|
|
522
|
+
"text": "Registers and initializes an interaction handler with the document viewer. Returns a\n`Disposable` that should be used to deregister the interaction handler.\n\n`InteractionHandler`s are used to build custom mouse and touch interactions.",
|
|
523
|
+
"tags": [{
|
|
524
|
+
"name": "param",
|
|
525
|
+
"text": "interactionHandler The interaction handler to register."
|
|
526
|
+
}, {
|
|
527
|
+
"name": "returns",
|
|
528
|
+
"text": "A promise containing the disposable to use to\nderegister the handler."
|
|
529
|
+
}]
|
|
530
|
+
}
|
|
531
|
+
},
|
|
463
532
|
"panByDelta": {
|
|
464
533
|
"complexType": {
|
|
465
534
|
"signature": "(delta: Point.Point) => Promise<void>",
|