@zerohive/hive-viewer 2.0.4 → 2.0.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/index.d.cts CHANGED
@@ -151,6 +151,7 @@ interface DocumentViewerProps {
151
151
  blob?: Blob;
152
152
  fileName?: string;
153
153
  fileType?: SupportedFileType;
154
+ loading?: boolean;
154
155
  pdfWorkerSrc?: string;
155
156
  mode?: DocumentMode;
156
157
  allowSigning?: boolean;
package/dist/index.d.ts CHANGED
@@ -151,6 +151,7 @@ interface DocumentViewerProps {
151
151
  blob?: Blob;
152
152
  fileName?: string;
153
153
  fileType?: SupportedFileType;
154
+ loading?: boolean;
154
155
  pdfWorkerSrc?: string;
155
156
  mode?: DocumentMode;
156
157
  allowSigning?: boolean;
package/dist/index.mjs CHANGED
@@ -519,12 +519,14 @@ function getDefaultPlacementSize(kind, aspectRatio = DEFAULT_SIGNATURE_ASPECT_RA
519
519
  clampAspectRatio(aspectRatio)
520
520
  );
521
521
  const effectiveSurfaceAspectRatio = clamp(surfaceAspectRatio, 0.45, 2.8);
522
+ const isScrollableDocumentSurface = kind === "document" && surfaceAspectRatio < 0.6;
522
523
  const heightTarget = kind === "sheet" ? 0.11 : kind === "slide" ? 0.135 : kind === "image" ? 0.14 : 0.115;
523
524
  const widthMin = kind === "sheet" ? 0.2 : kind === "slide" ? 0.22 : kind === "image" ? 0.24 : 0.22;
524
- const widthMax = kind === "sheet" ? 0.38 : kind === "slide" ? 0.44 : kind === "image" ? 0.48 : 0.4;
525
+ const widthMax = kind === "sheet" ? 0.38 : kind === "slide" ? 0.44 : kind === "image" ? 0.48 : isScrollableDocumentSurface ? 0.3 : 0.4;
525
526
  const heightMax = kind === "sheet" ? 0.18 : kind === "slide" ? 0.2 : kind === "image" ? 0.22 : 0.19;
527
+ const widthTarget = isScrollableDocumentSurface ? 0.24 : null;
526
528
  const width = clamp(
527
- heightTarget * effectiveAspectRatio / effectiveSurfaceAspectRatio,
529
+ widthTarget ?? heightTarget * effectiveAspectRatio / effectiveSurfaceAspectRatio,
528
530
  widthMin,
529
531
  widthMax
530
532
  );
@@ -9091,6 +9093,7 @@ function getFileNameHint(fileUrl, fileName) {
9091
9093
  function DocumentViewer(props) {
9092
9094
  const mode = props.mode ?? "view";
9093
9095
  const theme = props.theme ?? "light";
9096
+ const externalLoading = props.loading ?? false;
9094
9097
  const locale = useMemo9(
9095
9098
  () => ({ ...defaultLocale, ...props.locale }),
9096
9099
  [props.locale]
@@ -9240,6 +9243,12 @@ function DocumentViewer(props) {
9240
9243
  let active = true;
9241
9244
  let cleanupSource;
9242
9245
  const loadFile = async () => {
9246
+ if (externalLoading) {
9247
+ setLoading(true);
9248
+ setError("");
9249
+ setResolved(null);
9250
+ return;
9251
+ }
9243
9252
  setLoading(true);
9244
9253
  setError("");
9245
9254
  setResolved(null);
@@ -9285,6 +9294,7 @@ function DocumentViewer(props) {
9285
9294
  cleanupSource?.();
9286
9295
  };
9287
9296
  }, [
9297
+ externalLoading,
9288
9298
  hasIncomingSource,
9289
9299
  isRequestedCreateUnsupported,
9290
9300
  mode,