@vertexvis/doc-viewer 1.0.2-canary.8 → 1.0.2-testing.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.
@@ -604,22 +604,10 @@ function apiSupportsLayers(api) {
604
604
  class DocumentLayersController {
605
605
  constructor(api) {
606
606
  this.apiSupportsLayers = false;
607
- if (api != null) {
608
- this.setApi(api);
609
- }
610
- }
611
- setApi(api) {
612
607
  if (apiSupportsLayers(api)) {
613
608
  this.apiSupportsLayers = true;
614
609
  this.api = api;
615
610
  }
616
- else {
617
- this.clear();
618
- }
619
- }
620
- clear() {
621
- this.apiSupportsLayers = false;
622
- this.api = undefined;
623
611
  }
624
612
  /**
625
613
  * Returns a boolean indicating whether the document supports layers.
@@ -34654,7 +34642,6 @@ const VertexDocumentViewer = class {
34654
34642
  this.handleDocumentApiStateChanged = this.handleDocumentApiStateChanged.bind(this);
34655
34643
  this.handlePageLoaded = this.handlePageLoaded.bind(this);
34656
34644
  this.handlePageDrawn = this.handlePageDrawn.bind(this);
34657
- this.layers = new DocumentLayersController();
34658
34645
  this.resizeObserver = new ResizeObserver(this.handleElementResize);
34659
34646
  this.registerSlotChangeListeners();
34660
34647
  }
@@ -34667,7 +34654,7 @@ const VertexDocumentViewer = class {
34667
34654
  var _a;
34668
34655
  (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.observe(this.hostEl);
34669
34656
  this.updateComponentDimensions();
34670
- this.loadInitialSrc();
34657
+ this.handleSrcChange();
34671
34658
  this.injectViewerApi();
34672
34659
  }
34673
34660
  disconnectedCallback() {
@@ -34734,13 +34721,12 @@ const VertexDocumentViewer = class {
34734
34721
  await documentApi.loadPage(pageNumber);
34735
34722
  }
34736
34723
  async handleSrcChange() {
34737
- var _a;
34738
34724
  if (this.src != null && this.canvasEl != null) {
34739
34725
  this.clearCurrentDocument();
34740
34726
  const { api, renderer } = this.provider.create(this.canvasEl, this.config);
34741
34727
  this.documentApi = api;
34742
34728
  this.documentRenderer = renderer;
34743
- (_a = this.layers) === null || _a === void 0 ? void 0 : _a.setApi(api);
34729
+ this.layers = new DocumentLayersController(api);
34744
34730
  this.updateInteractionHandler();
34745
34731
  this.updateDocumentApiListeners();
34746
34732
  await this.documentApi.updateViewport(this.dimensions);
@@ -34757,9 +34743,9 @@ const VertexDocumentViewer = class {
34757
34743
  this.updateInteractionHandler();
34758
34744
  }
34759
34745
  render() {
34760
- return (h(Host, { key: 'a990831d5f2328f2cf21be0b82d4018b05decd51' }, h("div", { key: '349abae36254da570e640417fab459680c576465', ref: ref => (this.viewerContainerElement = ref), class: "viewer-container", onContextMenu: event => event.preventDefault() }, h("div", { key: '6fca3f1d5a2c31bdcc0c8dbbd468e306db981740', ref: ref => (this.canvasContainerElement = ref), class: classNames('canvas-container', {
34746
+ return (h(Host, { key: 'f1ddf0b4e321bc244a5d757e48f6d71c23caca3c' }, h("div", { key: '174c64c537f4b0f1c45fc6543e5b7f54515e4063', ref: ref => (this.viewerContainerElement = ref), class: "viewer-container", onContextMenu: event => event.preventDefault() }, h("div", { key: '4c47dadba03b32bde017252a9a8ea7f6e6d323f3', ref: ref => (this.canvasContainerElement = ref), class: classNames('canvas-container', {
34761
34747
  'enable-pointer-events ': window.PointerEvent != null,
34762
- }) }, h("canvas", { key: 'deb1c58d8d20000053cd829401163bf1e68ca88e', id: "document-viewer-canvas", role: "presentation", ref: el => (this.canvasEl = el) })), h("slot", { key: '6b87846ef17b330b0fae5d03103765bad6fdafa6' }))));
34748
+ }) }, h("canvas", { key: 'ae645889dd5cb93084f820f9f3d14a56de0213f7', id: "document-viewer-canvas", role: "presentation", ref: el => (this.canvasEl = el) })), h("slot", { key: '7762c493306bf5d21cd16218f1abd3c6d0300ace' }))));
34763
34749
  }
34764
34750
  getDocumentApi() {
34765
34751
  if (this.documentApi == null) {
@@ -34767,25 +34753,15 @@ const VertexDocumentViewer = class {
34767
34753
  }
34768
34754
  return this.documentApi;
34769
34755
  }
34770
- async loadInitialSrc() {
34771
- await Promise.resolve();
34772
- await this.handleSrcChange();
34773
- }
34774
34756
  clearCurrentDocument() {
34775
- var _a, _b, _c, _d, _e, _f, _g;
34757
+ var _a, _b, _c, _d, _e, _f;
34776
34758
  (_a = this.documentRenderer) === null || _a === void 0 ? void 0 : _a.dispose();
34777
34759
  (_b = this.documentApi) === null || _b === void 0 ? void 0 : _b.dispose();
34778
34760
  (_c = this.panInteractionHandler) === null || _c === void 0 ? void 0 : _c.dispose();
34779
34761
  (_d = this.documentApiStateChangedDisposable) === null || _d === void 0 ? void 0 : _d.dispose();
34780
34762
  (_e = this.pageLoadedDisposable) === null || _e === void 0 ? void 0 : _e.dispose();
34781
34763
  (_f = this.pageDrawnDisposable) === null || _f === void 0 ? void 0 : _f.dispose();
34782
- this.documentRenderer = undefined;
34783
- this.documentApi = undefined;
34784
- this.panInteractionHandler = undefined;
34785
- this.documentApiStateChangedDisposable = undefined;
34786
- this.pageLoadedDisposable = undefined;
34787
- this.pageDrawnDisposable = undefined;
34788
- (_g = this.layers) === null || _g === void 0 ? void 0 : _g.clear();
34764
+ this.layers = undefined;
34789
34765
  }
34790
34766
  handleDocumentApiStateChanged(state) {
34791
34767
  this.documentState = state;
@@ -134,7 +134,6 @@ export declare class VertexDocumentViewer implements BasicViewer {
134
134
  protected handleInteractionModeChange(): void;
135
135
  render(): void;
136
136
  private getDocumentApi;
137
- private loadInitialSrc;
138
137
  private clearCurrentDocument;
139
138
  private handleDocumentApiStateChanged;
140
139
  private handlePageLoaded;
@@ -3,9 +3,7 @@ import { DocumentLayer } from './types';
3
3
  export declare class DocumentLayersController {
4
4
  private apiSupportsLayers;
5
5
  private api?;
6
- constructor(api?: DocumentApi);
7
- setApi(api: DocumentApi): void;
8
- clear(): void;
6
+ constructor(api: DocumentApi);
9
7
  /**
10
8
  * Returns a boolean indicating whether the document supports layers.
11
9
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vertexvis/doc-viewer",
3
- "version": "1.0.2-canary.8",
3
+ "version": "1.0.2-testing.1",
4
4
  "description": "The Vertex SDK for viewing documents.",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -95,11 +95,11 @@
95
95
  "typescript": "~5.9.3"
96
96
  },
97
97
  "dependencies": {
98
- "@vertexvis/geometry": "1.0.2-canary.8",
99
- "@vertexvis/utils": "1.0.2-canary.8",
98
+ "@vertexvis/geometry": "1.0.2-testing.1",
99
+ "@vertexvis/utils": "1.0.2-testing.1",
100
100
  "classnames": "^2.5.1",
101
101
  "pdfjs-dist": "^5.5.207",
102
102
  "resize-observer": "^1.0.4"
103
103
  },
104
- "gitHead": "27a533afa0975cf1c4834079220685881066b9a4"
104
+ "gitHead": "d28706dda29e84edaec7c7f2a5781bf619e2f112"
105
105
  }