@superdoc-dev/mcp 0.12.0-next.4 → 0.12.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 +1 -1
package/dist/index.js CHANGED
@@ -222864,7 +222864,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
222864
222864
  init_remark_gfm_BhnWr3yf_es();
222865
222865
  });
222866
222866
 
222867
- // ../../packages/superdoc/dist/chunks/src-BU1mfNkI.es.js
222867
+ // ../../packages/superdoc/dist/chunks/src-Btvk6jT1.es.js
222868
222868
  function deleteProps(obj, propOrProps) {
222869
222869
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
222870
222870
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -267878,7 +267878,10 @@ function calculateBalancedColumnHeight(ctx$1, config3 = DEFAULT_BALANCING_CONFIG
267878
267878
  iterations: 0
267879
267879
  };
267880
267880
  const totalHeight = ctx$1.contentBlocks.reduce((sum, b$1) => sum + b$1.measuredHeight, 0);
267881
- const maxBlockHeight = ctx$1.contentBlocks.reduce((m$1, b$1) => Math.max(m$1, b$1.measuredHeight), 0);
267881
+ const maxBlockHeight = ctx$1.contentBlocks.reduce((m$1, b$1) => {
267882
+ const indivisible = b$1.canBreak && b$1.lineHeights && b$1.lineHeights.length > 1 ? Math.max(...b$1.lineHeights) : b$1.measuredHeight;
267883
+ return Math.max(m$1, indivisible);
267884
+ }, 0);
267882
267885
  if (totalHeight < config3.minColumnHeight * ctx$1.columnCount)
267883
267886
  return createSingleColumnResult(ctx$1);
267884
267887
  let lo = Math.max(maxBlockHeight, config3.minColumnHeight);
@@ -268048,6 +268051,8 @@ function shouldSkipBalancing(ctx$1, config3 = DEFAULT_BALANCING_CONFIG) {
268048
268051
  }
268049
268052
  function getFragmentHeight(fragment, measureMap) {
268050
268053
  if (fragment.kind === "para") {
268054
+ if (fragment.lines && fragment.lines.length > 0)
268055
+ return fragment.lines.reduce((sum$1, l) => sum$1 + (l.lineHeight ?? 0), 0);
268051
268056
  const measure = measureMap.get(fragment.blockId);
268052
268057
  if (!measure || measure.kind !== "paragraph" || !measure.lines)
268053
268058
  return 0;
@@ -268128,13 +268133,38 @@ function balanceSectionOnPage(args$1) {
268128
268133
  return a2.x - b$1.x;
268129
268134
  return a2.y - b$1.y;
268130
268135
  });
268131
- const contentBlocks = ordered.map((f2, i4) => ({
268132
- blockId: `${f2.blockId}#${i4}`,
268133
- measuredHeight: getBalancingHeight(f2, args$1.measureMap, args$1.sectPrMarkerBlockIds),
268134
- canBreak: false,
268135
- keepWithNext: false,
268136
- keepTogether: true
268137
- }));
268136
+ const lineHeightsFor = (f2) => {
268137
+ if (f2.kind !== "para")
268138
+ return;
268139
+ if (args$1.sectPrMarkerBlockIds?.has(f2.blockId))
268140
+ return;
268141
+ if (args$1.keepLinesBlockIds?.has(f2.blockId))
268142
+ return;
268143
+ if (f2.lines && f2.lines.length > 0) {
268144
+ if (f2.lines.length <= 1)
268145
+ return;
268146
+ return f2.lines.map((l) => l.lineHeight);
268147
+ }
268148
+ const measure = args$1.measureMap.get(f2.blockId);
268149
+ if (!measure || measure.kind !== "paragraph" || !Array.isArray(measure.lines))
268150
+ return;
268151
+ const fromLine = f2.fromLine ?? 0;
268152
+ const toLine = f2.toLine ?? measure.lines.length;
268153
+ if (toLine - fromLine <= 1)
268154
+ return;
268155
+ return measure.lines.slice(fromLine, toLine).map((l) => l.lineHeight);
268156
+ };
268157
+ const contentBlocks = ordered.map((f2, i4) => {
268158
+ const lineHeights = lineHeightsFor(f2);
268159
+ return {
268160
+ blockId: `${f2.blockId}#${i4}`,
268161
+ measuredHeight: getBalancingHeight(f2, args$1.measureMap, args$1.sectPrMarkerBlockIds),
268162
+ canBreak: lineHeights !== undefined,
268163
+ keepWithNext: false,
268164
+ keepTogether: lineHeights === undefined,
268165
+ lineHeights
268166
+ };
268167
+ });
268138
268168
  if (shouldSkipBalancing({
268139
268169
  columnCount,
268140
268170
  columnWidth,
@@ -268169,6 +268199,39 @@ function balanceSectionOnPage(args$1) {
268169
268199
  f2.x = columnX(col);
268170
268200
  f2.y = colCursors[col];
268171
268201
  f2.width = columnWidth;
268202
+ const bp = result.blockBreakPoints?.get(block.blockId);
268203
+ if (bp && bp.heightAfterBreak > 0 && col < columnCount - 1) {
268204
+ const splitLine = (f2.fromLine ?? 0) + bp.breakAfterLine + 1;
268205
+ const measureLineCount = args$1.measureMap.get(f2.blockId)?.lines?.length ?? splitLine;
268206
+ const originalToLine = f2.toLine ?? measureLineCount;
268207
+ const originalContinuesOnNext = f2.continuesOnNext ?? false;
268208
+ const secondHalf = {
268209
+ ...f2,
268210
+ fromLine: splitLine,
268211
+ toLine: originalToLine,
268212
+ x: columnX(col + 1),
268213
+ y: colCursors[col + 1],
268214
+ width: columnWidth,
268215
+ continuesFromPrev: true,
268216
+ continuesOnNext: originalContinuesOnNext
268217
+ };
268218
+ if (f2.lines && f2.lines.length > 0) {
268219
+ secondHalf.lines = f2.lines.slice(bp.breakAfterLine + 1);
268220
+ f2.lines = f2.lines.slice(0, bp.breakAfterLine + 1);
268221
+ }
268222
+ f2.toLine = splitLine;
268223
+ f2.continuesOnNext = true;
268224
+ colCursors[col] += bp.heightBeforeBreak;
268225
+ colCursors[col + 1] += bp.heightAfterBreak;
268226
+ const fragIdx = fragments.indexOf(f2);
268227
+ if (fragIdx >= 0)
268228
+ fragments.splice(fragIdx + 1, 0, secondHalf);
268229
+ if (colCursors[col] > maxY)
268230
+ maxY = colCursors[col];
268231
+ if (colCursors[col + 1] > maxY)
268232
+ maxY = colCursors[col + 1];
268233
+ continue;
268234
+ }
268172
268235
  colCursors[col] += block.measuredHeight;
268173
268236
  if (colCursors[col] > maxY)
268174
268237
  maxY = colCursors[col];
@@ -269320,6 +269383,7 @@ function layoutDocument(blocks2, measures, options = {}) {
269320
269383
  const sectionTypeIsExplicit = /* @__PURE__ */ new Map;
269321
269384
  let lastSectionIdx = null;
269322
269385
  const sectPrMarkerBlockIds = /* @__PURE__ */ new Set;
269386
+ const keepLinesBlockIds = /* @__PURE__ */ new Set;
269323
269387
  let documentHasExplicitColumnBreak = false;
269324
269388
  let documentHasAnySectionBreak = false;
269325
269389
  const alreadyBalancedSections = /* @__PURE__ */ new Set;
@@ -269353,6 +269417,8 @@ function layoutDocument(blocks2, measures, options = {}) {
269353
269417
  documentHasExplicitColumnBreak = true;
269354
269418
  if (block.kind === "paragraph" && blockWithAttrs.attrs?.sectPrMarker === true)
269355
269419
  sectPrMarkerBlockIds.add(block.id);
269420
+ if (block.kind === "paragraph" && blockWithAttrs.attrs?.keepLines === true)
269421
+ keepLinesBlockIds.add(block.id);
269356
269422
  });
269357
269423
  const anchoredByParagraph = collectAnchoredDrawings(blocks2, measures);
269358
269424
  const anchoredTables = collectAnchoredTables(blocks2, measures);
@@ -269571,7 +269637,8 @@ function layoutDocument(blocks2, measures, options = {}) {
269571
269637
  columnWidth: normalized.width,
269572
269638
  availableHeight,
269573
269639
  measureMap: balancingMeasureMap,
269574
- sectPrMarkerBlockIds
269640
+ sectPrMarkerBlockIds,
269641
+ keepLinesBlockIds
269575
269642
  });
269576
269643
  if (balanceResult) {
269577
269644
  state.cursorY = balanceResult.maxY;
@@ -269970,7 +270037,9 @@ function layoutDocument(blocks2, measures, options = {}) {
269970
270037
  const isMultiPage = sectionPagesCount > 1;
269971
270038
  if (isMultiPage && !isLast)
269972
270039
  continue;
269973
- const allowedByMidDocContinuous = endBreakType === "continuous" && !isLast;
270040
+ const nextSectionBeginType = sectionEndBreakType.get(sectionIdx + 1);
270041
+ const nextIsBody = lastSectionIdx !== null && sectionIdx + 1 === lastSectionIdx;
270042
+ const allowedByMidDocContinuous = !isLast && !nextIsBody && nextSectionBeginType === "continuous";
269974
270043
  const allowedByBodyExplicitContinuous = bodyExplicitContinuousIdx !== null && sectionIdx === bodyExplicitContinuousIdx - 1 && !isExplicitNonContinuous;
269975
270044
  if (!allowedByMidDocContinuous && !allowedByBodyExplicitContinuous && !isMultiPage)
269976
270045
  continue;
@@ -270001,7 +270070,8 @@ function layoutDocument(blocks2, measures, options = {}) {
270001
270070
  columnWidth: normalized.width,
270002
270071
  availableHeight: sectionAvailableHeight,
270003
270072
  measureMap: balancingMeasureMap,
270004
- sectPrMarkerBlockIds
270073
+ sectPrMarkerBlockIds,
270074
+ keepLinesBlockIds
270005
270075
  });
270006
270076
  }
270007
270077
  for (const state of states) {
@@ -320103,7 +320173,7 @@ menclose::after {
320103
320173
  return;
320104
320174
  console.log(...args$1);
320105
320175
  }, 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;
320106
- var init_src_BU1mfNkI_es = __esm(() => {
320176
+ var init_src_Btvk6jT1_es = __esm(() => {
320107
320177
  init_rolldown_runtime_Bg48TavK_es();
320108
320178
  init_SuperConverter_BaKhr4cp_es();
320109
320179
  init_jszip_C49i9kUs_es();
@@ -355356,7 +355426,7 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
355356
355426
 
355357
355427
  // ../../packages/superdoc/dist/super-editor.es.js
355358
355428
  var init_super_editor_es = __esm(() => {
355359
- init_src_BU1mfNkI_es();
355429
+ init_src_Btvk6jT1_es();
355360
355430
  init_SuperConverter_BaKhr4cp_es();
355361
355431
  init_jszip_C49i9kUs_es();
355362
355432
  init_xml_js_CqGKpaft_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/mcp",
3
- "version": "0.12.0-next.4",
3
+ "version": "0.12.0-next.5",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=20"