@prose-reader/core 1.160.0 → 1.162.0

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.js CHANGED
@@ -5553,22 +5553,32 @@ class DocumentRenderer extends DestroyableClass {
5553
5553
  return defer(() => this.onLayout(params)).pipe(
5554
5554
  map$1((dims) => {
5555
5555
  var _a, _b;
5556
- const isPrepaginated = this.item.renditionLayout === `pre-paginated` || !((_a = this.context.manifest) == null ? void 0 : _a.renditionLayout) && ((_b = this.context.manifest) == null ? void 0 : _b.renditionLayout) === `pre-paginated`;
5556
+ const { height: defaultHeight, width: defaultWidth } = this.context.getPageSize();
5557
5557
  if (dims) {
5558
5558
  const { height, width } = dims;
5559
+ if (height < defaultHeight || width < defaultWidth) {
5560
+ Report.warn(
5561
+ `Your height or width is smaller than the page size. Please check your rendering.`
5562
+ );
5563
+ }
5559
5564
  this.lastLayoutDims = { height, width };
5560
5565
  return this.lastLayoutDims;
5561
5566
  }
5562
- if (isPrepaginated) {
5567
+ if (this.renditionLayout === `pre-paginated`) {
5563
5568
  this.lastLayoutDims = {
5564
5569
  height: this.context.getPageSize().height,
5565
5570
  width: this.context.getPageSize().width
5566
5571
  };
5567
5572
  } else {
5568
5573
  this.lastLayoutDims = {
5569
- height: this.context.getPageSize().height,
5570
- width: this.context.getPageSize().width,
5571
- ...this.lastLayoutDims
5574
+ height: Math.max(
5575
+ defaultHeight,
5576
+ ((_a = this.lastLayoutDims) == null ? void 0 : _a.height) ?? defaultHeight
5577
+ ),
5578
+ width: Math.max(
5579
+ defaultWidth,
5580
+ ((_b = this.lastLayoutDims) == null ? void 0 : _b.width) ?? defaultWidth
5581
+ )
5572
5582
  };
5573
5583
  }
5574
5584
  return this.lastLayoutDims;
@@ -5585,6 +5595,17 @@ class DocumentRenderer extends DestroyableClass {
5585
5595
  get readingDirection() {
5586
5596
  return void 0;
5587
5597
  }
5598
+ get renditionLayout() {
5599
+ var _a;
5600
+ const itemRenditionLayout = this.item.renditionLayout;
5601
+ if (itemRenditionLayout) return itemRenditionLayout;
5602
+ const iframe = this.getDocumentFrame();
5603
+ if (iframe) {
5604
+ const { hasViewport } = getFrameViewportInfo(iframe);
5605
+ if (hasViewport) return "pre-paginated";
5606
+ }
5607
+ return ((_a = this.context.manifest) == null ? void 0 : _a.renditionLayout) ?? "reflowable";
5608
+ }
5588
5609
  }
5589
5610
  class DefaultRenderer extends DocumentRenderer {
5590
5611
  onUnload() {
@@ -5787,10 +5808,7 @@ class SpineItem extends DestroyableClass {
5787
5808
  );
5788
5809
  }
5789
5810
  get renditionLayout() {
5790
- var _a;
5791
- const itemRenditionLayout = this.item.renditionLayout;
5792
- if (itemRenditionLayout) return itemRenditionLayout;
5793
- return ((_a = this.context.manifest) == null ? void 0 : _a.renditionLayout) ?? "reflowable";
5811
+ return this.renderer.renditionLayout;
5794
5812
  }
5795
5813
  }
5796
5814
  const createContainerElement = (containerElement, item, hookManager) => {