@superdoc-dev/cli 0.8.0-next.83 → 0.8.0-next.84

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.
Files changed (2) hide show
  1. package/dist/index.js +44 -9
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -207843,7 +207843,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
207843
207843
  init_remark_gfm_BhnWr3yf_es();
207844
207844
  });
207845
207845
 
207846
- // ../../packages/superdoc/dist/chunks/src-DWSadDfS.es.js
207846
+ // ../../packages/superdoc/dist/chunks/src-BBPU9hdN.es.js
207847
207847
  function deleteProps(obj, propOrProps) {
207848
207848
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
207849
207849
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -255533,16 +255533,43 @@ function layoutDocument(blocks2, measures, options = {}) {
255533
255533
  return Math.max(baseBottomMargin, currentFooterDistance + footerContentHeight);
255534
255534
  return baseBottomMargin;
255535
255535
  };
255536
+ const MIN_BODY_CONTENT_HEIGHT = 1;
255537
+ const clampHeaderFooterInflatedMargins = (topMargin, bottomMargin, baseTopMargin, baseBottomMargin, currentPageHeight) => {
255538
+ const maxMarginTotal = currentPageHeight - MIN_BODY_CONTENT_HEIGHT;
255539
+ if (topMargin + bottomMargin <= maxMarginTotal)
255540
+ return {
255541
+ top: topMargin,
255542
+ bottom: bottomMargin
255543
+ };
255544
+ const baseMarginTotal = baseTopMargin + baseBottomMargin;
255545
+ if (baseMarginTotal >= maxMarginTotal)
255546
+ return {
255547
+ top: topMargin,
255548
+ bottom: bottomMargin
255549
+ };
255550
+ const topInflation = Math.max(0, topMargin - baseTopMargin);
255551
+ const bottomInflation = Math.max(0, bottomMargin - baseBottomMargin);
255552
+ const totalInflation = topInflation + bottomInflation;
255553
+ if (totalInflation <= 0)
255554
+ return {
255555
+ top: topMargin,
255556
+ bottom: bottomMargin
255557
+ };
255558
+ const availableInflation = maxMarginTotal - baseMarginTotal;
255559
+ return {
255560
+ top: baseTopMargin + availableInflation * (topInflation / totalInflation),
255561
+ bottom: baseBottomMargin + availableInflation * (bottomInflation / totalInflation)
255562
+ };
255563
+ };
255536
255564
  const maxHeaderContentHeight = headerContentHeights ? Math.max(0, validateContentHeight(headerContentHeights.default), validateContentHeight(headerContentHeights.first), validateContentHeight(headerContentHeights.even), validateContentHeight(headerContentHeights.odd)) : 0;
255537
255565
  const maxFooterContentHeight = footerContentHeights ? Math.max(0, validateContentHeight(footerContentHeights.default), validateContentHeight(footerContentHeights.first), validateContentHeight(footerContentHeights.even), validateContentHeight(footerContentHeights.odd)) : 0;
255538
255566
  const headerDistance = margins.header ?? margins.top;
255539
255567
  const footerDistance = margins.footer ?? margins.bottom;
255540
255568
  const defaultHeaderHeight = getHeaderHeightForPage("default", undefined, 0);
255541
255569
  const defaultFooterHeight = getFooterHeightForPage("default", undefined, 0);
255542
- const effectiveTopMargin = calculateEffectiveTopMargin(defaultHeaderHeight, headerDistance, margins.top);
255543
- const effectiveBottomMargin = calculateEffectiveBottomMargin(defaultFooterHeight, footerDistance, margins.bottom);
255544
- let activeTopMargin = effectiveTopMargin;
255545
- let activeBottomMargin = effectiveBottomMargin;
255570
+ const effectiveMargins = clampHeaderFooterInflatedMargins(calculateEffectiveTopMargin(defaultHeaderHeight, headerDistance, margins.top), calculateEffectiveBottomMargin(defaultFooterHeight, footerDistance, margins.bottom), margins.top, margins.bottom, pageSize.h);
255571
+ let activeTopMargin = effectiveMargins.top;
255572
+ let activeBottomMargin = effectiveMargins.bottom;
255546
255573
  let activeLeftMargin = margins.left;
255547
255574
  let activeRightMargin = margins.right;
255548
255575
  let pendingTopMargin = null;
@@ -255974,8 +256001,9 @@ function layoutDocument(blocks2, measures, options = {}) {
255974
256001
  footerRef = defaultFooterRef;
255975
256002
  const headerHeight = getHeaderHeightForPage(effectiveVariantType, headerRef, activeSectionIndex);
255976
256003
  const footerHeight = getFooterHeightForPage(variantType !== "default" && !activeSectionRefs?.footerRefs?.[variantType] ? "default" : variantType, footerRef, activeSectionIndex);
255977
- activeTopMargin = calculateEffectiveTopMargin(headerHeight, activeHeaderDistance, activeSectionBaseTopMargin);
255978
- activeBottomMargin = calculateEffectiveBottomMargin(footerHeight, activeFooterDistance, activeSectionBaseBottomMargin);
256004
+ const adjustedMargins = clampHeaderFooterInflatedMargins(calculateEffectiveTopMargin(headerHeight, activeHeaderDistance, activeSectionBaseTopMargin), calculateEffectiveBottomMargin(footerHeight, activeFooterDistance, activeSectionBaseBottomMargin), activeSectionBaseTopMargin, activeSectionBaseBottomMargin, activePageSize.h);
256005
+ activeTopMargin = adjustedMargins.top;
256006
+ activeBottomMargin = adjustedMargins.bottom;
255979
256007
  layoutLog(`[Layout] Page ${newPageNumber}: Using variant '${variantType}' - headerHeight: ${headerHeight}, footerHeight: ${footerHeight}`);
255980
256008
  layoutLog(`[Layout] Page ${newPageNumber}: Adjusted margins - top: ${activeTopMargin}, bottom: ${activeBottomMargin} (base: ${activeSectionBaseTopMargin}, ${activeSectionBaseBottomMargin})`);
255981
256009
  return;
@@ -256879,6 +256907,13 @@ function shouldExcludeFromMeasurement(fragment2, block, fragmentBottom, canvasHe
256879
256907
  if (measurementBand && !rangesIntersect(fragment2.y, fragmentBottom, measurementBand.start, measurementBand.end))
256880
256908
  return true;
256881
256909
  }
256910
+ const fragmentHeight = typeof fragment2.height === "number" ? fragment2.height : fragmentBottom - fragment2.y;
256911
+ const fragmentWidth = typeof fragment2.width === "number" ? fragment2.width : 0;
256912
+ const heightCoversCanvas = Number.isFinite(fragmentHeight) && fragmentHeight >= canvasHeight;
256913
+ const widthCoversCanvas = Number.isFinite(constraints.width) && constraints.width > 0 && fragmentWidth >= constraints.width;
256914
+ const isOverlayWrap = anchoredBlock.wrap?.type === "None";
256915
+ if (kind && heightCoversCanvas && widthCoversCanvas && isOverlayWrap)
256916
+ return true;
256882
256917
  return false;
256883
256918
  }
256884
256919
  function layoutHeaderFooter(blocks2, measures, constraints, kind) {
@@ -300594,7 +300629,7 @@ menclose::after {
300594
300629
  return;
300595
300630
  console.log(...args$1);
300596
300631
  }, HEADER_FOOTER_INIT_BUDGET_MS = 200, MAX_ZOOM_WARNING_THRESHOLD = 10, MAX_SELECTION_RECTS_PER_USER = 100, SEMANTIC_RESIZE_DEBOUNCE_MS = 120, MIN_SEMANTIC_CONTENT_WIDTH_PX = 1, GLOBAL_PERFORMANCE, PresentationEditor, ICONS, TEXTS, tableActionsOptions;
300597
- var init_src_DWSadDfS_es = __esm(() => {
300632
+ var init_src_BBPU9hdN_es = __esm(() => {
300598
300633
  init_rolldown_runtime_Bg48TavK_es();
300599
300634
  init_SuperConverter_CzqEoFT1_es();
300600
300635
  init_jszip_C49i9kUs_es();
@@ -338283,7 +338318,7 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
338283
338318
 
338284
338319
  // ../../packages/superdoc/dist/super-editor.es.js
338285
338320
  var init_super_editor_es = __esm(() => {
338286
- init_src_DWSadDfS_es();
338321
+ init_src_BBPU9hdN_es();
338287
338322
  init_SuperConverter_CzqEoFT1_es();
338288
338323
  init_jszip_C49i9kUs_es();
338289
338324
  init_xml_js_CqGKpaft_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.8.0-next.83",
3
+ "version": "0.8.0-next.84",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -25,20 +25,20 @@
25
25
  "@types/ws": "^8.5.13",
26
26
  "typescript": "^5.9.2",
27
27
  "@superdoc/document-api": "0.0.1",
28
- "@superdoc/super-editor": "0.0.1",
29
28
  "@superdoc/pm-adapter": "0.0.0",
30
- "superdoc": "1.31.0"
29
+ "superdoc": "1.31.0",
30
+ "@superdoc/super-editor": "0.0.1"
31
31
  },
32
32
  "module": "src/index.ts",
33
33
  "publishConfig": {
34
34
  "access": "public"
35
35
  },
36
36
  "optionalDependencies": {
37
- "@superdoc-dev/cli-darwin-arm64": "0.8.0-next.83",
38
- "@superdoc-dev/cli-darwin-x64": "0.8.0-next.83",
39
- "@superdoc-dev/cli-linux-x64": "0.8.0-next.83",
40
- "@superdoc-dev/cli-windows-x64": "0.8.0-next.83",
41
- "@superdoc-dev/cli-linux-arm64": "0.8.0-next.83"
37
+ "@superdoc-dev/cli-darwin-arm64": "0.8.0-next.84",
38
+ "@superdoc-dev/cli-linux-x64": "0.8.0-next.84",
39
+ "@superdoc-dev/cli-darwin-x64": "0.8.0-next.84",
40
+ "@superdoc-dev/cli-linux-arm64": "0.8.0-next.84",
41
+ "@superdoc-dev/cli-windows-x64": "0.8.0-next.84"
42
42
  },
43
43
  "scripts": {
44
44
  "predev": "node scripts/ensure-superdoc-build.js",