@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.cjs CHANGED
@@ -585,12 +585,14 @@ function getDefaultPlacementSize(kind, aspectRatio = DEFAULT_SIGNATURE_ASPECT_RA
585
585
  clampAspectRatio(aspectRatio)
586
586
  );
587
587
  const effectiveSurfaceAspectRatio = clamp(surfaceAspectRatio, 0.45, 2.8);
588
+ const isScrollableDocumentSurface = kind === "document" && surfaceAspectRatio < 0.6;
588
589
  const heightTarget = kind === "sheet" ? 0.11 : kind === "slide" ? 0.135 : kind === "image" ? 0.14 : 0.115;
589
590
  const widthMin = kind === "sheet" ? 0.2 : kind === "slide" ? 0.22 : kind === "image" ? 0.24 : 0.22;
590
- const widthMax = kind === "sheet" ? 0.38 : kind === "slide" ? 0.44 : kind === "image" ? 0.48 : 0.4;
591
+ const widthMax = kind === "sheet" ? 0.38 : kind === "slide" ? 0.44 : kind === "image" ? 0.48 : isScrollableDocumentSurface ? 0.3 : 0.4;
591
592
  const heightMax = kind === "sheet" ? 0.18 : kind === "slide" ? 0.2 : kind === "image" ? 0.22 : 0.19;
593
+ const widthTarget = isScrollableDocumentSurface ? 0.24 : null;
592
594
  const width = clamp(
593
- heightTarget * effectiveAspectRatio / effectiveSurfaceAspectRatio,
595
+ widthTarget ?? heightTarget * effectiveAspectRatio / effectiveSurfaceAspectRatio,
594
596
  widthMin,
595
597
  widthMax
596
598
  );
@@ -9141,6 +9143,7 @@ function getFileNameHint(fileUrl, fileName) {
9141
9143
  function DocumentViewer(props) {
9142
9144
  const mode = props.mode ?? "view";
9143
9145
  const theme = props.theme ?? "light";
9146
+ const externalLoading = props.loading ?? false;
9144
9147
  const locale = (0, import_react10.useMemo)(
9145
9148
  () => ({ ...defaultLocale, ...props.locale }),
9146
9149
  [props.locale]
@@ -9290,6 +9293,12 @@ function DocumentViewer(props) {
9290
9293
  let active = true;
9291
9294
  let cleanupSource;
9292
9295
  const loadFile = async () => {
9296
+ if (externalLoading) {
9297
+ setLoading(true);
9298
+ setError("");
9299
+ setResolved(null);
9300
+ return;
9301
+ }
9293
9302
  setLoading(true);
9294
9303
  setError("");
9295
9304
  setResolved(null);
@@ -9335,6 +9344,7 @@ function DocumentViewer(props) {
9335
9344
  cleanupSource?.();
9336
9345
  };
9337
9346
  }, [
9347
+ externalLoading,
9338
9348
  hasIncomingSource,
9339
9349
  isRequestedCreateUnsupported,
9340
9350
  mode,