@superdoc-dev/cli 0.17.0-next.4 → 0.17.0-next.5

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 +84 -14
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -233498,7 +233498,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
233498
233498
  init_remark_gfm_BhnWr3yf_es();
233499
233499
  });
233500
233500
 
233501
- // ../../packages/superdoc/dist/chunks/src-BU1mfNkI.es.js
233501
+ // ../../packages/superdoc/dist/chunks/src-Btvk6jT1.es.js
233502
233502
  function deleteProps(obj, propOrProps) {
233503
233503
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
233504
233504
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -278645,7 +278645,10 @@ function calculateBalancedColumnHeight(ctx$1, config2 = DEFAULT_BALANCING_CONFIG
278645
278645
  iterations: 0
278646
278646
  };
278647
278647
  const totalHeight = ctx$1.contentBlocks.reduce((sum, b$1) => sum + b$1.measuredHeight, 0);
278648
- const maxBlockHeight = ctx$1.contentBlocks.reduce((m$1, b$1) => Math.max(m$1, b$1.measuredHeight), 0);
278648
+ const maxBlockHeight = ctx$1.contentBlocks.reduce((m$1, b$1) => {
278649
+ const indivisible = b$1.canBreak && b$1.lineHeights && b$1.lineHeights.length > 1 ? Math.max(...b$1.lineHeights) : b$1.measuredHeight;
278650
+ return Math.max(m$1, indivisible);
278651
+ }, 0);
278649
278652
  if (totalHeight < config2.minColumnHeight * ctx$1.columnCount)
278650
278653
  return createSingleColumnResult(ctx$1);
278651
278654
  let lo = Math.max(maxBlockHeight, config2.minColumnHeight);
@@ -278815,6 +278818,8 @@ function shouldSkipBalancing(ctx$1, config2 = DEFAULT_BALANCING_CONFIG) {
278815
278818
  }
278816
278819
  function getFragmentHeight(fragment2, measureMap) {
278817
278820
  if (fragment2.kind === "para") {
278821
+ if (fragment2.lines && fragment2.lines.length > 0)
278822
+ return fragment2.lines.reduce((sum$1, l) => sum$1 + (l.lineHeight ?? 0), 0);
278818
278823
  const measure = measureMap.get(fragment2.blockId);
278819
278824
  if (!measure || measure.kind !== "paragraph" || !measure.lines)
278820
278825
  return 0;
@@ -278895,13 +278900,38 @@ function balanceSectionOnPage(args$1) {
278895
278900
  return a2.x - b$1.x;
278896
278901
  return a2.y - b$1.y;
278897
278902
  });
278898
- const contentBlocks = ordered.map((f2, i4) => ({
278899
- blockId: `${f2.blockId}#${i4}`,
278900
- measuredHeight: getBalancingHeight(f2, args$1.measureMap, args$1.sectPrMarkerBlockIds),
278901
- canBreak: false,
278902
- keepWithNext: false,
278903
- keepTogether: true
278904
- }));
278903
+ const lineHeightsFor = (f2) => {
278904
+ if (f2.kind !== "para")
278905
+ return;
278906
+ if (args$1.sectPrMarkerBlockIds?.has(f2.blockId))
278907
+ return;
278908
+ if (args$1.keepLinesBlockIds?.has(f2.blockId))
278909
+ return;
278910
+ if (f2.lines && f2.lines.length > 0) {
278911
+ if (f2.lines.length <= 1)
278912
+ return;
278913
+ return f2.lines.map((l) => l.lineHeight);
278914
+ }
278915
+ const measure = args$1.measureMap.get(f2.blockId);
278916
+ if (!measure || measure.kind !== "paragraph" || !Array.isArray(measure.lines))
278917
+ return;
278918
+ const fromLine = f2.fromLine ?? 0;
278919
+ const toLine = f2.toLine ?? measure.lines.length;
278920
+ if (toLine - fromLine <= 1)
278921
+ return;
278922
+ return measure.lines.slice(fromLine, toLine).map((l) => l.lineHeight);
278923
+ };
278924
+ const contentBlocks = ordered.map((f2, i4) => {
278925
+ const lineHeights = lineHeightsFor(f2);
278926
+ return {
278927
+ blockId: `${f2.blockId}#${i4}`,
278928
+ measuredHeight: getBalancingHeight(f2, args$1.measureMap, args$1.sectPrMarkerBlockIds),
278929
+ canBreak: lineHeights !== undefined,
278930
+ keepWithNext: false,
278931
+ keepTogether: lineHeights === undefined,
278932
+ lineHeights
278933
+ };
278934
+ });
278905
278935
  if (shouldSkipBalancing({
278906
278936
  columnCount,
278907
278937
  columnWidth,
@@ -278936,6 +278966,39 @@ function balanceSectionOnPage(args$1) {
278936
278966
  f2.x = columnX(col);
278937
278967
  f2.y = colCursors[col];
278938
278968
  f2.width = columnWidth;
278969
+ const bp = result.blockBreakPoints?.get(block.blockId);
278970
+ if (bp && bp.heightAfterBreak > 0 && col < columnCount - 1) {
278971
+ const splitLine = (f2.fromLine ?? 0) + bp.breakAfterLine + 1;
278972
+ const measureLineCount = args$1.measureMap.get(f2.blockId)?.lines?.length ?? splitLine;
278973
+ const originalToLine = f2.toLine ?? measureLineCount;
278974
+ const originalContinuesOnNext = f2.continuesOnNext ?? false;
278975
+ const secondHalf = {
278976
+ ...f2,
278977
+ fromLine: splitLine,
278978
+ toLine: originalToLine,
278979
+ x: columnX(col + 1),
278980
+ y: colCursors[col + 1],
278981
+ width: columnWidth,
278982
+ continuesFromPrev: true,
278983
+ continuesOnNext: originalContinuesOnNext
278984
+ };
278985
+ if (f2.lines && f2.lines.length > 0) {
278986
+ secondHalf.lines = f2.lines.slice(bp.breakAfterLine + 1);
278987
+ f2.lines = f2.lines.slice(0, bp.breakAfterLine + 1);
278988
+ }
278989
+ f2.toLine = splitLine;
278990
+ f2.continuesOnNext = true;
278991
+ colCursors[col] += bp.heightBeforeBreak;
278992
+ colCursors[col + 1] += bp.heightAfterBreak;
278993
+ const fragIdx = fragments.indexOf(f2);
278994
+ if (fragIdx >= 0)
278995
+ fragments.splice(fragIdx + 1, 0, secondHalf);
278996
+ if (colCursors[col] > maxY)
278997
+ maxY = colCursors[col];
278998
+ if (colCursors[col + 1] > maxY)
278999
+ maxY = colCursors[col + 1];
279000
+ continue;
279001
+ }
278939
279002
  colCursors[col] += block.measuredHeight;
278940
279003
  if (colCursors[col] > maxY)
278941
279004
  maxY = colCursors[col];
@@ -280087,6 +280150,7 @@ function layoutDocument(blocks2, measures, options = {}) {
280087
280150
  const sectionTypeIsExplicit = /* @__PURE__ */ new Map;
280088
280151
  let lastSectionIdx = null;
280089
280152
  const sectPrMarkerBlockIds = /* @__PURE__ */ new Set;
280153
+ const keepLinesBlockIds = /* @__PURE__ */ new Set;
280090
280154
  let documentHasExplicitColumnBreak = false;
280091
280155
  let documentHasAnySectionBreak = false;
280092
280156
  const alreadyBalancedSections = /* @__PURE__ */ new Set;
@@ -280120,6 +280184,8 @@ function layoutDocument(blocks2, measures, options = {}) {
280120
280184
  documentHasExplicitColumnBreak = true;
280121
280185
  if (block.kind === "paragraph" && blockWithAttrs.attrs?.sectPrMarker === true)
280122
280186
  sectPrMarkerBlockIds.add(block.id);
280187
+ if (block.kind === "paragraph" && blockWithAttrs.attrs?.keepLines === true)
280188
+ keepLinesBlockIds.add(block.id);
280123
280189
  });
280124
280190
  const anchoredByParagraph = collectAnchoredDrawings(blocks2, measures);
280125
280191
  const anchoredTables = collectAnchoredTables(blocks2, measures);
@@ -280338,7 +280404,8 @@ function layoutDocument(blocks2, measures, options = {}) {
280338
280404
  columnWidth: normalized.width,
280339
280405
  availableHeight,
280340
280406
  measureMap: balancingMeasureMap,
280341
- sectPrMarkerBlockIds
280407
+ sectPrMarkerBlockIds,
280408
+ keepLinesBlockIds
280342
280409
  });
280343
280410
  if (balanceResult) {
280344
280411
  state.cursorY = balanceResult.maxY;
@@ -280737,7 +280804,9 @@ function layoutDocument(blocks2, measures, options = {}) {
280737
280804
  const isMultiPage = sectionPagesCount > 1;
280738
280805
  if (isMultiPage && !isLast)
280739
280806
  continue;
280740
- const allowedByMidDocContinuous = endBreakType === "continuous" && !isLast;
280807
+ const nextSectionBeginType = sectionEndBreakType.get(sectionIdx + 1);
280808
+ const nextIsBody = lastSectionIdx !== null && sectionIdx + 1 === lastSectionIdx;
280809
+ const allowedByMidDocContinuous = !isLast && !nextIsBody && nextSectionBeginType === "continuous";
280741
280810
  const allowedByBodyExplicitContinuous = bodyExplicitContinuousIdx !== null && sectionIdx === bodyExplicitContinuousIdx - 1 && !isExplicitNonContinuous;
280742
280811
  if (!allowedByMidDocContinuous && !allowedByBodyExplicitContinuous && !isMultiPage)
280743
280812
  continue;
@@ -280768,7 +280837,8 @@ function layoutDocument(blocks2, measures, options = {}) {
280768
280837
  columnWidth: normalized.width,
280769
280838
  availableHeight: sectionAvailableHeight,
280770
280839
  measureMap: balancingMeasureMap,
280771
- sectPrMarkerBlockIds
280840
+ sectPrMarkerBlockIds,
280841
+ keepLinesBlockIds
280772
280842
  });
280773
280843
  }
280774
280844
  for (const state of states) {
@@ -330870,7 +330940,7 @@ menclose::after {
330870
330940
  return;
330871
330941
  console.log(...args$1);
330872
330942
  }, 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, TRACKED_MARK_NAMES;
330873
- var init_src_BU1mfNkI_es = __esm(() => {
330943
+ var init_src_Btvk6jT1_es = __esm(() => {
330874
330944
  init_rolldown_runtime_Bg48TavK_es();
330875
330945
  init_SuperConverter_BaKhr4cp_es();
330876
330946
  init_jszip_C49i9kUs_es();
@@ -366123,7 +366193,7 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
366123
366193
 
366124
366194
  // ../../packages/superdoc/dist/super-editor.es.js
366125
366195
  var init_super_editor_es = __esm(() => {
366126
- init_src_BU1mfNkI_es();
366196
+ init_src_Btvk6jT1_es();
366127
366197
  init_SuperConverter_BaKhr4cp_es();
366128
366198
  init_jszip_C49i9kUs_es();
366129
366199
  init_xml_js_CqGKpaft_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.17.0-next.4",
3
+ "version": "0.17.0-next.5",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -33,11 +33,11 @@
33
33
  "access": "public"
34
34
  },
35
35
  "optionalDependencies": {
36
- "@superdoc-dev/cli-darwin-arm64": "0.17.0-next.4",
37
- "@superdoc-dev/cli-darwin-x64": "0.17.0-next.4",
38
- "@superdoc-dev/cli-linux-x64": "0.17.0-next.4",
39
- "@superdoc-dev/cli-linux-arm64": "0.17.0-next.4",
40
- "@superdoc-dev/cli-windows-x64": "0.17.0-next.4"
36
+ "@superdoc-dev/cli-darwin-arm64": "0.17.0-next.5",
37
+ "@superdoc-dev/cli-darwin-x64": "0.17.0-next.5",
38
+ "@superdoc-dev/cli-linux-x64": "0.17.0-next.5",
39
+ "@superdoc-dev/cli-linux-arm64": "0.17.0-next.5",
40
+ "@superdoc-dev/cli-windows-x64": "0.17.0-next.5"
41
41
  },
42
42
  "scripts": {
43
43
  "predev": "node scripts/ensure-superdoc-build.js",