@superdoc-dev/mcp 0.11.0-next.6 → 0.11.0-next.7

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 +264 -97
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -43580,7 +43580,7 @@ var init_uuid_qzgm05fK_es = __esm(() => {
43580
43580
  v5_default = v35("v5", 80, sha1);
43581
43581
  });
43582
43582
 
43583
- // ../../packages/superdoc/dist/chunks/constants-D-X7xF4s.es.js
43583
+ // ../../packages/superdoc/dist/chunks/constants-D9qj59G2.es.js
43584
43584
  function toProtocolSet(values) {
43585
43585
  const result = /* @__PURE__ */ new Set;
43586
43586
  if (!values)
@@ -44166,7 +44166,7 @@ var DEFAULT_ALLOWED_PROTOCOLS, OPTIONAL_PROTOCOLS, BLOCKED_PROTOCOLS, DEFAULT_MA
44166
44166
  return a.length === 1 ? "0" + a : a;
44167
44167
  }, rgbToHex = (rgb) => {
44168
44168
  return "#" + rgb.match(/\d+/g).map(componentToHex).join("");
44169
- }, DEFAULT_SHADING_FOREGROUND_COLOR = "#000000", hexToRgb = (hex3) => {
44169
+ }, DEFAULT_SHADING_FOREGROUND_COLOR = "#000000", DEFAULT_SHADING_FILL_COLOR = "#FFFFFF", hexToRgb = (hex3) => {
44170
44170
  const normalized = normalizeHexColor(hex3);
44171
44171
  if (!normalized)
44172
44172
  return null;
@@ -44193,16 +44193,19 @@ var DEFAULT_ALLOWED_PROTOCOLS, OPTIONAL_PROTOCOLS, BLOCKED_PROTOCOLS, DEFAULT_MA
44193
44193
  }, resolveShadingFillColor = (shading) => {
44194
44194
  if (!shading || typeof shading !== "object")
44195
44195
  return null;
44196
- const fill = normalizeHexColor(shading.fill);
44197
- if (!fill)
44196
+ const val = typeof shading.val === "string" ? shading.val.trim().toLowerCase() : "";
44197
+ if (val === "nil" || val === "none")
44198
44198
  return null;
44199
- const pctMatch = (typeof shading.val === "string" ? shading.val.trim().toLowerCase() : "").match(/^pct(\d{1,3})$/);
44200
- if (!pctMatch)
44201
- return fill;
44202
- const pct = Number.parseInt(pctMatch[1], 10);
44199
+ const fillHex = typeof shading.fill === "string" && shading.fill.trim().toLowerCase() === "auto" ? null : normalizeHexColor(shading.fill);
44200
+ const pctMatch = val.match(/^pct(\d{1,3})$/);
44201
+ if (!(Boolean(pctMatch) || val === "solid"))
44202
+ return fillHex;
44203
+ const baseHex = fillHex ?? DEFAULT_SHADING_FILL_COLOR;
44204
+ const foregroundHex = typeof shading.color !== "string" || shading.color.trim() === "" || shading.color.trim().toLowerCase() === "auto" ? DEFAULT_SHADING_FOREGROUND_COLOR : normalizeHexColor(shading.color) ?? DEFAULT_SHADING_FOREGROUND_COLOR;
44205
+ const pct = pctMatch ? Number.parseInt(pctMatch[1], 10) : 100;
44203
44206
  if (!Number.isFinite(pct) || pct < 0 || pct > 100)
44204
- return fill;
44205
- return blendHexColors(fill, normalizeHexColor(shading.color) ?? DEFAULT_SHADING_FOREGROUND_COLOR, pct / 100) ?? fill;
44207
+ return fillHex;
44208
+ return blendHexColors(baseHex, foregroundHex, pct / 100) ?? fillHex;
44206
44209
  }, deobfuscateFont = (arrayBuffer, guidHex) => {
44207
44210
  const dta = new Uint8Array(arrayBuffer);
44208
44211
  const guidStr = guidHex.replace(/[-{}]/g, "");
@@ -44248,7 +44251,7 @@ var DEFAULT_ALLOWED_PROTOCOLS, OPTIONAL_PROTOCOLS, BLOCKED_PROTOCOLS, DEFAULT_MA
44248
44251
  return "webp";
44249
44252
  return null;
44250
44253
  }, COMMENT_FILE_BASENAMES, DEFAULT_XML_DECLARATION, COMMENT_RELATIONSHIP_TYPES;
44251
- var init_constants_D_X7xF4s_es = __esm(() => {
44254
+ var init_constants_D9qj59G2_es = __esm(() => {
44252
44255
  init_jszip_C49i9kUs_es();
44253
44256
  init_xml_js_CqGKpaft_es();
44254
44257
  init_dist();
@@ -52208,7 +52211,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
52208
52211
  emptyOptions2 = {};
52209
52212
  });
52210
52213
 
52211
- // ../../packages/superdoc/dist/chunks/SuperConverter-BSMYiYJm.es.js
52214
+ // ../../packages/superdoc/dist/chunks/SuperConverter-7JlFliK8.es.js
52212
52215
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
52213
52216
  const fieldValue = extension$1.config[field];
52214
52217
  if (typeof fieldValue === "function")
@@ -114962,15 +114965,17 @@ var isRegExp = (value) => {
114962
114965
  }
114963
114966
  }
114964
114967
  if (!cellBackgroundColor && resolvedTcProps?.shading) {
114965
- const { fill, themeFill, themeFillTint, themeFillShade } = resolvedTcProps.shading;
114966
- const normalizedFill = normalizeShadingColor(fill);
114967
- if (normalizedFill)
114968
- cellBackgroundColor = normalizedFill;
114969
- else if (themeFill && context.themeColors) {
114970
- const normalizedTheme = normalizeShadingColor(resolveThemeColorValue(themeFill, themeFillTint, themeFillShade, context.themeColors));
114971
- if (normalizedTheme)
114972
- cellBackgroundColor = normalizedTheme;
114973
- }
114968
+ const { fill, color: color2, val, themeFill, themeFillTint, themeFillShade } = resolvedTcProps.shading;
114969
+ let fillBase = normalizeShadingColor(fill);
114970
+ if (!fillBase && themeFill && context.themeColors)
114971
+ fillBase = normalizeShadingColor(resolveThemeColorValue(themeFill, themeFillTint, themeFillShade, context.themeColors));
114972
+ const resolved = resolveShadingFillColor({
114973
+ val,
114974
+ color: color2,
114975
+ fill: fillBase ?? fill
114976
+ });
114977
+ if (resolved)
114978
+ cellBackgroundColor = resolved.startsWith("#") ? resolved : `#${resolved}`;
114974
114979
  }
114975
114980
  const cellConverterContext = tableInfo || cellBackgroundColor ? {
114976
114981
  ...context.converterContext,
@@ -115224,9 +115229,12 @@ var isRegExp = (value) => {
115224
115229
  return null;
115225
115230
  const rowProps = rowNode.attrs?.tableRowProperties;
115226
115231
  const rowHeight = normalizeRowHeight(rowProps);
115232
+ const tblPrExBordersRaw = rowProps?.tblPrExBorders;
115233
+ const rowBorders = tblPrExBordersRaw && typeof tblPrExBordersRaw === "object" ? extractTableBorders(tblPrExBordersRaw, { unit: "eighthPoints" }) : undefined;
115227
115234
  const attrs = rowProps && typeof rowProps === "object" ? {
115228
115235
  tableRowProperties: rowProps,
115229
- ...rowHeight ? { rowHeight } : {}
115236
+ ...rowHeight ? { rowHeight } : {},
115237
+ ...rowBorders ? { borders: rowBorders } : {}
115230
115238
  } : rowHeight ? { rowHeight } : undefined;
115231
115239
  return {
115232
115240
  id: context.nextBlockId(`row-${rowIndex}`),
@@ -115543,12 +115551,12 @@ var isRegExp = (value) => {
115543
115551
  state.kern = kernNode.attributes["w:val"];
115544
115552
  }
115545
115553
  }, SuperConverter;
115546
- var init_SuperConverter_BSMYiYJm_es = __esm(() => {
115554
+ var init_SuperConverter_7JlFliK8_es = __esm(() => {
115547
115555
  init_rolldown_runtime_Bg48TavK_es();
115548
115556
  init_jszip_C49i9kUs_es();
115549
115557
  init_xml_js_CqGKpaft_es();
115550
115558
  init_uuid_qzgm05fK_es();
115551
- init_constants_D_X7xF4s_es();
115559
+ init_constants_D9qj59G2_es();
115552
115560
  init_dist_B8HfvhaK_es();
115553
115561
  init_unified_Dsuw2be5_es();
115554
115562
  init_lib_CYqLdG4z_es();
@@ -154578,7 +154586,7 @@ var init_SuperConverter_BSMYiYJm_es = __esm(() => {
154578
154586
  };
154579
154587
  });
154580
154588
 
154581
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-DeKyOdIi.es.js
154589
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-ByZquSqc.es.js
154582
154590
  function parseSizeUnit(val = "0") {
154583
154591
  const length = val.toString() || "0";
154584
154592
  const value = Number.parseFloat(length);
@@ -164911,10 +164919,10 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, normalizeActorId = (value) => {
164911
164919
  }
164912
164920
  };
164913
164921
  };
164914
- var init_create_headless_toolbar_DeKyOdIi_es = __esm(() => {
164915
- init_SuperConverter_BSMYiYJm_es();
164922
+ var init_create_headless_toolbar_ByZquSqc_es = __esm(() => {
164923
+ init_SuperConverter_7JlFliK8_es();
164916
164924
  init_uuid_qzgm05fK_es();
164917
- init_constants_D_X7xF4s_es();
164925
+ init_constants_D9qj59G2_es();
164918
164926
  init_dist_B8HfvhaK_es();
164919
164927
  CSS_DIMENSION_REGEX = /[\d-.]+(\w+)$/;
164920
164928
  DOM_SIZE_UNITS = [
@@ -166811,7 +166819,7 @@ var init_decrypt_docx_G2a7hkiV_es = __esm(() => {
166811
166819
  ]);
166812
166820
  });
166813
166821
 
166814
- // ../../packages/superdoc/dist/chunks/DocxZipper-VodIk8WL.es.js
166822
+ // ../../packages/superdoc/dist/chunks/DocxZipper-Bu2Fhqkw.es.js
166815
166823
  function sniffEncoding(u8) {
166816
166824
  if (u8.length >= 2) {
166817
166825
  const b0 = u8[0], b1 = u8[1];
@@ -167484,11 +167492,11 @@ var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.docum
167484
167492
  return `image/${MIME_TYPE_FOR_EXT[detectedType] || detectedType}`;
167485
167493
  }
167486
167494
  }, DocxZipper_default;
167487
- var init_DocxZipper_VodIk8WL_es = __esm(() => {
167495
+ var init_DocxZipper_Bu2Fhqkw_es = __esm(() => {
167488
167496
  init_rolldown_runtime_Bg48TavK_es();
167489
167497
  init_jszip_C49i9kUs_es();
167490
167498
  init_xml_js_CqGKpaft_es();
167491
- init_constants_D_X7xF4s_es();
167499
+ init_constants_D9qj59G2_es();
167492
167500
  init_dist_B8HfvhaK_es();
167493
167501
  MANAGED_PACKAGE_PARTS = [
167494
167502
  {
@@ -219596,7 +219604,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
219596
219604
  init_remark_gfm_BhnWr3yf_es();
219597
219605
  });
219598
219606
 
219599
- // ../../packages/superdoc/dist/chunks/src-plIVvSkL.es.js
219607
+ // ../../packages/superdoc/dist/chunks/src-BjC0MGkm.es.js
219600
219608
  function deleteProps(obj, propOrProps) {
219601
219609
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
219602
219610
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -264543,8 +264551,15 @@ function calculateChainHeight(chain, blocks2, measures, state) {
264543
264551
  const firstLineHeight = anchorMeasure.lines[0]?.lineHeight;
264544
264552
  const anchorHeight = typeof firstLineHeight === "number" && Number.isFinite(firstLineHeight) && firstLineHeight > 0 ? firstLineHeight : getMeasureHeight(anchorBlock, anchorMeasure);
264545
264553
  totalHeight += interParagraphSpacing + anchorHeight;
264546
- } else if (!(anchorBlock.kind === "table" && anchorBlock.anchor?.isAnchored === true))
264547
- totalHeight += prevSpacingAfter + getMeasureHeight(anchorBlock, anchorMeasure);
264554
+ } else if (!(anchorBlock.kind === "table" && anchorBlock.anchor?.isAnchored === true)) {
264555
+ let anchorHeight = getMeasureHeight(anchorBlock, anchorMeasure);
264556
+ if (anchorBlock.kind === "table" && anchorMeasure.kind === "table" && anchorMeasure.rows.length > 0) {
264557
+ const firstRowHeight = anchorMeasure.rows[0]?.height;
264558
+ if (typeof firstRowHeight === "number" && Number.isFinite(firstRowHeight) && firstRowHeight > 0)
264559
+ anchorHeight = firstRowHeight;
264560
+ }
264561
+ totalHeight += prevSpacingAfter + anchorHeight;
264562
+ }
264548
264563
  }
264549
264564
  }
264550
264565
  return totalHeight;
@@ -299381,6 +299396,45 @@ menclose::after {
299381
299396
  if (explicitSpec)
299382
299397
  return explicitSpec;
299383
299398
  return borderValueToSpec(fallback);
299399
+ }, BORDER_STYLE_NUMBER, BORDER_STYLE_LINES, isPresentBorder = (b$1) => !!b$1 && b$1.style !== undefined && b$1.style !== "none" && (b$1.width === undefined || b$1.width > 0), isExplicitNoneBorder = (b$1) => {
299400
+ if (!b$1 || typeof b$1 !== "object")
299401
+ return false;
299402
+ const r$1 = b$1;
299403
+ return r$1.style === "none" || r$1.none === true;
299404
+ }, borderWeight = (b$1) => (BORDER_STYLE_LINES[b$1.style] ?? 1) * (BORDER_STYLE_NUMBER[b$1.style] ?? 1), colorBrightness = (color2, formula) => {
299405
+ const hex3 = (color2 ?? "#000000").replace("#", "");
299406
+ if (hex3.length < 6)
299407
+ return 0;
299408
+ return formula(parseInt(hex3.slice(0, 2), 16), parseInt(hex3.slice(2, 4), 16), parseInt(hex3.slice(4, 6), 16));
299409
+ }, resolveBorderConflict = (a2, b$1) => {
299410
+ const pa = isPresentBorder(a2);
299411
+ const pb = isPresentBorder(b$1);
299412
+ if (!pa && !pb)
299413
+ return;
299414
+ if (!pa)
299415
+ return b$1;
299416
+ if (!pb)
299417
+ return a2;
299418
+ const wa = borderWeight(a2);
299419
+ const wb = borderWeight(b$1);
299420
+ if (wa !== wb)
299421
+ return wa > wb ? a2 : b$1;
299422
+ const na = BORDER_STYLE_NUMBER[a2.style] ?? 99;
299423
+ const nb = BORDER_STYLE_NUMBER[b$1.style] ?? 99;
299424
+ if (na !== nb)
299425
+ return na < nb ? a2 : b$1;
299426
+ const formulas = [
299427
+ (r$1, g$1, bl) => r$1 + bl + 2 * g$1,
299428
+ (_r, g$1, bl) => bl + 2 * g$1,
299429
+ (_r, g$1) => g$1
299430
+ ];
299431
+ for (const f2 of formulas) {
299432
+ const ba = colorBrightness(a2.color, f2);
299433
+ const bb = colorBrightness(b$1.color, f2);
299434
+ if (ba !== bb)
299435
+ return ba < bb ? a2 : b$1;
299436
+ }
299437
+ return a2;
299384
299438
  }, hasExplicitCellBorders = (cellBorders) => Boolean(cellBorders && (cellBorders.top !== undefined || cellBorders.right !== undefined || cellBorders.bottom !== undefined || cellBorders.left !== undefined)), resolveTableCellBorders = (tableBorders, cellPosition) => {
299385
299439
  const cellBounds = getTableCellGridBounds(cellPosition);
299386
299440
  return {
@@ -301220,8 +301274,21 @@ menclose::after {
301220
301274
  }
301221
301275
  }
301222
301276
  return { cellElement: cellEl };
301223
- }, hasAnyResolvedBorder = (borders) => Boolean(borders.top || borders.right || borders.bottom || borders.left), resolveRenderedCellBorders = ({ cellBorders, hasBordersAttribute, tableBorders, cellPosition, cellSpacingPx, continuesFromPrev, continuesOnNext }) => {
301277
+ }, hasAnyResolvedBorder = (borders) => Boolean(borders.top || borders.right || borders.bottom || borders.left), resolveRenderedCellBorders = ({ cellBorders, hasBordersAttribute, tableBorders, cellPosition, cellSpacingPx, continuesFromPrev, continuesOnNext, aboveCellBorders, leftCellBorders, rightCellBorders, nextRowLeavesRightGap, deferTopToAboveCell, nextRowSuppressesSharedTop }) => {
301224
301278
  const hasExplicitBorders = hasExplicitCellBorders(cellBorders);
301279
+ const cellBounds = getTableCellGridBounds(cellPosition);
301280
+ const touchesTopBoundary = cellBounds.touchesTopEdge || continuesFromPrev;
301281
+ const touchesBottomBoundary = cellBounds.touchesBottomEdge || continuesOnNext || nextRowLeavesRightGap === true;
301282
+ const hasInteriorNeighborBorder = !touchesTopBoundary && !deferTopToAboveCell && isPresentBorder(aboveCellBorders?.bottom) || !cellBounds.touchesLeftEdge && isPresentBorder(leftCellBorders?.right);
301283
+ if (cellSpacingPx === 0 && (hasExplicitBorders || hasInteriorNeighborBorder)) {
301284
+ const cb = cellBorders ?? {};
301285
+ return {
301286
+ top: touchesTopBoundary ? resolveTableBorderValue(cb.top, tableBorders?.top) : deferTopToAboveCell ? undefined : resolveBorderConflict(cb.top, aboveCellBorders?.bottom) ?? (isExplicitNoneBorder(cb.top) && isExplicitNoneBorder(aboveCellBorders?.bottom) ? undefined : borderValueToSpec(tableBorders?.insideH)),
301287
+ left: cellBounds.touchesLeftEdge ? resolveTableBorderValue(cb.left, tableBorders?.left) : isPresentBorder(cb.left) ? resolveBorderConflict(cb.left, leftCellBorders?.right) ?? borderValueToSpec(tableBorders?.insideV) : isPresentBorder(leftCellBorders?.right) ? undefined : isExplicitNoneBorder(cb.left) && isExplicitNoneBorder(leftCellBorders?.right) ? undefined : borderValueToSpec(tableBorders?.insideV),
301288
+ right: cellBounds.touchesRightEdge ? resolveTableBorderValue(cb.right, tableBorders?.right) : isPresentBorder(cb.right) && !isPresentBorder(rightCellBorders?.left) ? cb.right : undefined,
301289
+ bottom: touchesBottomBoundary ? resolveTableBorderValue(cb.bottom, tableBorders?.bottom) : undefined
301290
+ };
301291
+ }
301225
301292
  if (hasBordersAttribute && !hasExplicitBorders)
301226
301293
  return;
301227
301294
  if (!tableBorders)
@@ -301231,24 +301298,13 @@ menclose::after {
301231
301298
  bottom: cellBorders.bottom,
301232
301299
  left: cellBorders.left
301233
301300
  } : undefined;
301234
- const cellBounds = getTableCellGridBounds(cellPosition);
301235
- const touchesTopBoundary = cellBounds.touchesTopEdge || continuesFromPrev;
301236
- const touchesBottomBoundary = cellBounds.touchesBottomEdge || continuesOnNext;
301237
- if (hasExplicitBorders) {
301238
- if (cellSpacingPx === 0)
301239
- return {
301240
- top: resolveTableBorderValue(cellBorders.top, touchesTopBoundary ? tableBorders.top : tableBorders.insideH),
301241
- right: cellBounds.touchesRightEdge ? resolveTableBorderValue(cellBorders.right, tableBorders.right) : undefined,
301242
- bottom: touchesBottomBoundary ? resolveTableBorderValue(cellBorders.bottom, tableBorders.bottom) : undefined,
301243
- left: resolveTableBorderValue(cellBorders.left, cellBounds.touchesLeftEdge ? tableBorders.left : tableBorders.insideV)
301244
- };
301301
+ if (hasExplicitBorders)
301245
301302
  return {
301246
301303
  top: resolveTableBorderValue(cellBorders.top, touchesTopBoundary ? tableBorders.top : tableBorders.insideH),
301247
301304
  right: resolveTableBorderValue(cellBorders.right, cellBounds.touchesRightEdge ? tableBorders.right : undefined),
301248
301305
  bottom: resolveTableBorderValue(cellBorders.bottom, touchesBottomBoundary ? tableBorders.bottom : undefined),
301249
301306
  left: resolveTableBorderValue(cellBorders.left, cellBounds.touchesLeftEdge ? tableBorders.left : tableBorders.insideV)
301250
301307
  };
301251
- }
301252
301308
  if (cellSpacingPx > 0) {
301253
301309
  const interiorBorders = {
301254
301310
  top: touchesTopBoundary ? undefined : borderValueToSpec(tableBorders.insideH),
@@ -301259,15 +301315,29 @@ menclose::after {
301259
301315
  return hasAnyResolvedBorder(interiorBorders) ? interiorBorders : undefined;
301260
301316
  }
301261
301317
  const baseBorders = resolveTableCellBorders(tableBorders, cellPosition);
301318
+ const insideHSpec = borderValueToSpec(tableBorders.insideH);
301319
+ const interiorBottom = nextRowSuppressesSharedTop && isPresentBorder(insideHSpec) ? insideHSpec : baseBorders.bottom;
301262
301320
  return {
301263
301321
  top: touchesTopBoundary ? borderValueToSpec(tableBorders.top) : baseBorders.top,
301264
301322
  right: baseBorders.right,
301265
- bottom: touchesBottomBoundary ? borderValueToSpec(tableBorders.bottom) : baseBorders.bottom,
301323
+ bottom: touchesBottomBoundary ? borderValueToSpec(tableBorders.bottom) : interiorBottom,
301266
301324
  left: baseBorders.left
301267
301325
  };
301268
301326
  }, renderTableRow = (deps) => {
301269
- const { doc: doc$12, container, rowIndex, y: y$1, rowMeasure, row: row2, totalRows, tableBorders, columnWidths, allRowHeights, tableIndent, isRtl, context, renderLine: renderLine$1, captureLineSnapshot, renderDrawingContent, applySdtDataset: applySdtDataset$1, ancestorContainerKey, ancestorContainerSdt, ancestorContainerKeys, ancestorContainerSdts, onSdtContainerChrome, continuesFromPrev, continuesOnNext, partialRow, cellSpacingPx = 0, chrome: chrome2, resolvePhysical } = deps;
301327
+ const { doc: doc$12, container, rowIndex, y: y$1, rowMeasure, row: row2, prevRow, prevRowMeasure, nextRow, nextRowMeasure, rowOccupiedRightCol, nextRowOccupiedRightCol, totalRows, tableBorders, columnWidths, allRowHeights, tableIndent, isRtl, context, renderLine: renderLine$1, captureLineSnapshot, renderDrawingContent, applySdtDataset: applySdtDataset$1, ancestorContainerKey, ancestorContainerSdt, ancestorContainerKeys, ancestorContainerSdts, onSdtContainerChrome, continuesFromPrev, continuesOnNext, partialRow, cellSpacingPx = 0, chrome: chrome2, resolvePhysical } = deps;
301270
301328
  const totalCols = columnWidths.length;
301329
+ const rowRightEdgeCol = rowOccupiedRightCol != null && rowOccupiedRightCol > 0 ? Math.min(totalCols, rowOccupiedRightCol) : rowMeasure.cells.length ? Math.min(totalCols, Math.max(...rowMeasure.cells.map((c) => (c.gridColumnStart ?? 0) + (c.colSpan ?? 1)))) : totalCols;
301330
+ const rowBorderOverride = row2?.attrs?.borders;
301331
+ const effectiveTableBorders = rowBorderOverride ? {
301332
+ ...tableBorders ?? {},
301333
+ ...rowBorderOverride
301334
+ } : tableBorders;
301335
+ const nextRowBorderOverride = nextRow?.attrs?.borders;
301336
+ const nextRowEffectiveInsideH = nextRowBorderOverride ? {
301337
+ ...tableBorders ?? {},
301338
+ ...nextRowBorderOverride
301339
+ }.insideH : undefined;
301340
+ const nextRowSuppressesSharedTop = nextRowBorderOverride !== undefined && !isPresentBorder(borderValueToSpec(nextRowEffectiveInsideH));
301271
301341
  const calculateXPosition = (gridColumnStart) => {
301272
301342
  let x = cellSpacingPx;
301273
301343
  for (let i4 = 0;i4 < gridColumnStart && i4 < columnWidths.length; i4++)
@@ -301292,6 +301362,27 @@ menclose::after {
301292
301362
  width += columnWidths[i4];
301293
301363
  return width;
301294
301364
  };
301365
+ const findCellBordersAtColumn = (cells, measureCells, gridCol) => {
301366
+ if (!cells || !measureCells)
301367
+ return;
301368
+ for (let i4 = 0;i4 < measureCells.length; i4++) {
301369
+ const start$1 = measureCells[i4].gridColumnStart ?? i4;
301370
+ const span = measureCells[i4].colSpan ?? 1;
301371
+ if (gridCol >= start$1 && gridCol < start$1 + span)
301372
+ return cells[i4]?.attrs?.borders;
301373
+ }
301374
+ };
301375
+ const findCellRightEdgeAtColumn = (measureCells, gridCol) => {
301376
+ if (!measureCells)
301377
+ return;
301378
+ for (let i4 = 0;i4 < measureCells.length; i4++) {
301379
+ const start$1 = measureCells[i4].gridColumnStart ?? i4;
301380
+ const span = measureCells[i4].colSpan ?? 1;
301381
+ if (gridCol >= start$1 && gridCol < start$1 + span)
301382
+ return start$1 + span;
301383
+ }
301384
+ };
301385
+ const nextRowMaxCol = nextRowOccupiedRightCol != null && nextRowOccupiedRightCol > 0 ? nextRowOccupiedRightCol : nextRowMeasure?.cells?.length ? Math.max(...nextRowMeasure.cells.map((c) => (c.gridColumnStart ?? 0) + (c.colSpan ?? 1))) : Infinity;
301295
301386
  for (let cellIndex = 0;cellIndex < rowMeasure.cells.length; cellIndex += 1) {
301296
301387
  const cellMeasure = rowMeasure.cells[cellIndex];
301297
301388
  const cell2 = row2?.cells?.[cellIndex];
@@ -301300,21 +301391,34 @@ menclose::after {
301300
301391
  const colSpan = cellMeasure.colSpan ?? 1;
301301
301392
  let x = calculateXPosition(gridColumnStart);
301302
301393
  const cellBordersAttr = cell2?.attrs?.borders;
301394
+ const hasBordersAttribute = cellBordersAttr !== undefined;
301395
+ const cellPosition = {
301396
+ rowIndex,
301397
+ rowSpan,
301398
+ gridColumnStart,
301399
+ colSpan,
301400
+ totalRows,
301401
+ totalCols: rowRightEdgeCol
301402
+ };
301403
+ const aboveCellBorders = findCellBordersAtColumn(prevRow?.cells, prevRowMeasure?.cells, gridColumnStart);
301404
+ const leftCellBorders = gridColumnStart > 0 ? findCellBordersAtColumn(row2?.cells, rowMeasure.cells, gridColumnStart - 1) : undefined;
301405
+ const rightCellBorders = findCellBordersAtColumn(row2?.cells, rowMeasure.cells, gridColumnStart + colSpan);
301406
+ const nextRowLeavesRightGap = gridColumnStart + colSpan > nextRowMaxCol;
301407
+ const aboveCellRightEdge = findCellRightEdgeAtColumn(prevRowMeasure?.cells, gridColumnStart);
301303
301408
  const resolvedBorders = resolveRenderedCellBorders({
301304
301409
  cellBorders: cellBordersAttr,
301305
- hasBordersAttribute: cellBordersAttr !== undefined,
301306
- tableBorders,
301307
- cellPosition: {
301308
- rowIndex,
301309
- rowSpan,
301310
- gridColumnStart,
301311
- colSpan,
301312
- totalRows,
301313
- totalCols
301314
- },
301410
+ hasBordersAttribute,
301411
+ tableBorders: effectiveTableBorders,
301412
+ cellPosition,
301315
301413
  cellSpacingPx,
301316
301414
  continuesFromPrev: continuesFromPrev === true,
301317
- continuesOnNext: continuesOnNext === true
301415
+ continuesOnNext: continuesOnNext === true,
301416
+ aboveCellBorders,
301417
+ leftCellBorders,
301418
+ rightCellBorders,
301419
+ nextRowLeavesRightGap,
301420
+ deferTopToAboveCell: aboveCellRightEdge !== undefined && aboveCellRightEdge > rowRightEdgeCol,
301421
+ nextRowSuppressesSharedTop
301318
301422
  });
301319
301423
  const finalBorders = isRtl && resolvedBorders ? swapCellBordersLR(resolvedBorders) : resolvedBorders;
301320
301424
  let cellHeight;
@@ -301447,12 +301551,22 @@ menclose::after {
301447
301551
  if (!rowMeasure)
301448
301552
  continue;
301449
301553
  const boundariesInRow = /* @__PURE__ */ new Set;
301554
+ const occupiedCols = /* @__PURE__ */ new Set;
301555
+ for (const cellMeasure of rowMeasure.cells) {
301556
+ const s2 = cellMeasure.gridColumnStart ?? 0;
301557
+ const sp = cellMeasure.colSpan ?? 1;
301558
+ for (let c = s2;c < s2 + sp; c++)
301559
+ occupiedCols.add(c);
301560
+ }
301561
+ const lastColIndex = columnCount - 1;
301562
+ const lastColMeta = fragment.metadata.columnBoundaries[lastColIndex];
301563
+ const skipTrailingSpacerBoundary = lastColIndex > 0 && !occupiedCols.has(lastColIndex) && !!lastColMeta && typeof lastColMeta.width === "number" && typeof lastColMeta.minWidth === "number" && lastColMeta.width < lastColMeta.minWidth;
301450
301564
  for (const cellMeasure of rowMeasure.cells) {
301451
301565
  const startCol = cellMeasure.gridColumnStart ?? 0;
301452
301566
  const endCol = startCol + (cellMeasure.colSpan ?? 1);
301453
301567
  if (startCol > 0)
301454
301568
  boundariesInRow.add(startCol);
301455
- if (endCol < columnCount)
301569
+ if (endCol < columnCount && !(skipTrailingSpacerBoundary && endCol === lastColIndex))
301456
301570
  boundariesInRow.add(endCol);
301457
301571
  }
301458
301572
  for (const boundaryCol of boundariesInRow) {
@@ -301509,6 +301623,16 @@ menclose::after {
301509
301623
  return fragment.partialRow.partialHeight;
301510
301624
  return r$1?.height ?? 0;
301511
301625
  });
301626
+ const rowOccupiedRightCols = new Array(measure.rows.length).fill(0);
301627
+ measure.rows.forEach((rowM, r$1) => {
301628
+ for (const c of rowM?.cells ?? []) {
301629
+ const right$1 = (c.gridColumnStart ?? 0) + (c.colSpan ?? 1);
301630
+ const lastRow = Math.min(measure.rows.length - 1, r$1 + (c.rowSpan ?? 1) - 1);
301631
+ for (let rr = r$1;rr <= lastRow; rr += 1)
301632
+ if (right$1 > rowOccupiedRightCols[rr])
301633
+ rowOccupiedRightCols[rr] = right$1;
301634
+ }
301635
+ });
301512
301636
  let y$1 = cellSpacingPx;
301513
301637
  if (fragment.repeatHeaderCount && fragment.repeatHeaderCount > 0)
301514
301638
  for (let r$1 = 0;r$1 < fragment.repeatHeaderCount; r$1 += 1) {
@@ -301522,6 +301646,12 @@ menclose::after {
301522
301646
  y: y$1,
301523
301647
  rowMeasure,
301524
301648
  row: block.rows[r$1],
301649
+ prevRow: r$1 > 0 ? block.rows[r$1 - 1] : undefined,
301650
+ prevRowMeasure: r$1 > 0 ? measure.rows[r$1 - 1] : undefined,
301651
+ nextRow: r$1 < block.rows.length - 1 ? block.rows[r$1 + 1] : undefined,
301652
+ nextRowMeasure: r$1 < block.rows.length - 1 ? measure.rows[r$1 + 1] : undefined,
301653
+ rowOccupiedRightCol: rowOccupiedRightCols[r$1],
301654
+ nextRowOccupiedRightCol: rowOccupiedRightCols[r$1 + 1],
301525
301655
  totalRows: block.rows.length,
301526
301656
  tableBorders,
301527
301657
  columnWidths: effectiveColumnWidths,
@@ -301640,6 +301770,12 @@ menclose::after {
301640
301770
  y: y$1,
301641
301771
  rowMeasure,
301642
301772
  row: block.rows[r$1],
301773
+ prevRow: r$1 > 0 ? block.rows[r$1 - 1] : undefined,
301774
+ prevRowMeasure: r$1 > 0 ? measure.rows[r$1 - 1] : undefined,
301775
+ nextRow: r$1 < block.rows.length - 1 ? block.rows[r$1 + 1] : undefined,
301776
+ nextRowMeasure: r$1 < block.rows.length - 1 ? measure.rows[r$1 + 1] : undefined,
301777
+ rowOccupiedRightCol: rowOccupiedRightCols[r$1],
301778
+ nextRowOccupiedRightCol: rowOccupiedRightCols[r$1 + 1],
301643
301779
  totalRows: block.rows.length,
301644
301780
  tableBorders,
301645
301781
  columnWidths: effectiveColumnWidths,
@@ -315517,19 +315653,19 @@ menclose::after {
315517
315653
  return;
315518
315654
  console.log(...args$1);
315519
315655
  }, 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;
315520
- var init_src_plIVvSkL_es = __esm(() => {
315656
+ var init_src_BjC0MGkm_es = __esm(() => {
315521
315657
  init_rolldown_runtime_Bg48TavK_es();
315522
- init_SuperConverter_BSMYiYJm_es();
315658
+ init_SuperConverter_7JlFliK8_es();
315523
315659
  init_jszip_C49i9kUs_es();
315524
315660
  init_xml_js_CqGKpaft_es();
315525
315661
  init_uuid_qzgm05fK_es();
315526
- init_create_headless_toolbar_DeKyOdIi_es();
315527
- init_constants_D_X7xF4s_es();
315662
+ init_create_headless_toolbar_ByZquSqc_es();
315663
+ init_constants_D9qj59G2_es();
315528
315664
  init_dist_B8HfvhaK_es();
315529
315665
  init_unified_Dsuw2be5_es();
315530
315666
  init_remark_gfm_BhnWr3yf_es();
315531
315667
  init_remark_stringify_6MMJfY0k_es();
315532
- init_DocxZipper_VodIk8WL_es();
315668
+ init_DocxZipper_Bu2Fhqkw_es();
315533
315669
  init__plugin_vue_export_helper_5t5P5NuM_es();
315534
315670
  init_eventemitter3_BnGqBE_Q_es();
315535
315671
  init_errors_CNaD6vcg_es();
@@ -342392,6 +342528,30 @@ function print() { __p += __j.call(arguments, '') }
342392
342528
  "wave",
342393
342529
  "doubleWave"
342394
342530
  ]);
342531
+ BORDER_STYLE_NUMBER = {
342532
+ single: 1,
342533
+ thick: 2,
342534
+ double: 3,
342535
+ dotted: 4,
342536
+ dashed: 5,
342537
+ dotDash: 6,
342538
+ dotDotDash: 7,
342539
+ triple: 8,
342540
+ wave: 18,
342541
+ doubleWave: 19
342542
+ };
342543
+ BORDER_STYLE_LINES = {
342544
+ single: 1,
342545
+ thick: 1,
342546
+ double: 2,
342547
+ dotted: 1,
342548
+ dashed: 1,
342549
+ dotDash: 1,
342550
+ dotDotDash: 1,
342551
+ triple: 3,
342552
+ wave: 1,
342553
+ doubleWave: 2
342554
+ };
342395
342555
  SETTLED_STATUSES = [
342396
342556
  "loaded",
342397
342557
  "failed",
@@ -350232,11 +350392,11 @@ function print() { __p += __j.call(arguments, '') }
350232
350392
  ]);
350233
350393
  });
350234
350394
 
350235
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-CJMIa98h.es.js
350395
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-CYY3yxUs.es.js
350236
350396
  var MOD_ALIASES, ALT_ALIASES, CTRL_ALIASES, SHIFT_ALIASES, BUILTIN_CONTEXT_MENU_GROUPS, BUILTIN_GROUP_ORDER, RESERVED_PROXY_PROPERTY_NAMES, ALL_TOOLBAR_COMMAND_IDS, EMPTY_ACTIVE_IDS;
350237
- var init_create_super_doc_ui_CJMIa98h_es = __esm(() => {
350238
- init_SuperConverter_BSMYiYJm_es();
350239
- init_create_headless_toolbar_DeKyOdIi_es();
350397
+ var init_create_super_doc_ui_CYY3yxUs_es = __esm(() => {
350398
+ init_SuperConverter_7JlFliK8_es();
350399
+ init_create_headless_toolbar_ByZquSqc_es();
350240
350400
  MOD_ALIASES = new Set([
350241
350401
  "Mod",
350242
350402
  "Meta",
@@ -350278,16 +350438,16 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
350278
350438
 
350279
350439
  // ../../packages/superdoc/dist/super-editor.es.js
350280
350440
  var init_super_editor_es = __esm(() => {
350281
- init_src_plIVvSkL_es();
350282
- init_SuperConverter_BSMYiYJm_es();
350441
+ init_src_BjC0MGkm_es();
350442
+ init_SuperConverter_7JlFliK8_es();
350283
350443
  init_jszip_C49i9kUs_es();
350284
350444
  init_xml_js_CqGKpaft_es();
350285
- init_create_headless_toolbar_DeKyOdIi_es();
350286
- init_constants_D_X7xF4s_es();
350445
+ init_create_headless_toolbar_ByZquSqc_es();
350446
+ init_constants_D9qj59G2_es();
350287
350447
  init_dist_B8HfvhaK_es();
350288
350448
  init_unified_Dsuw2be5_es();
350289
- init_DocxZipper_VodIk8WL_es();
350290
- init_create_super_doc_ui_CJMIa98h_es();
350449
+ init_DocxZipper_Bu2Fhqkw_es();
350450
+ init_create_super_doc_ui_CYY3yxUs_es();
350291
350451
  init_ui_C5PAS9hY_es();
350292
350452
  init_eventemitter3_BnGqBE_Q_es();
350293
350453
  init_errors_CNaD6vcg_es();
@@ -377735,7 +377895,7 @@ var import_xml_js, CRC32_TABLE2, PIXELS_PER_INCH3 = 96, EIGHTHS_PER_POINT2 = 8,
377735
377895
  return a2.length === 1 ? "0" + a2 : a2;
377736
377896
  }, rgbToHex3 = (rgb) => {
377737
377897
  return "#" + rgb.match(/\d+/g).map(componentToHex2).join("");
377738
- }, DEFAULT_SHADING_FOREGROUND_COLOR2 = "#000000", hexToRgb3 = (hex3) => {
377898
+ }, DEFAULT_SHADING_FOREGROUND_COLOR2 = "#000000", DEFAULT_SHADING_FILL_COLOR2 = "#FFFFFF", hexToRgb3 = (hex3) => {
377739
377899
  const normalized = normalizeHexColor4(hex3);
377740
377900
  if (!normalized)
377741
377901
  return null;
@@ -377762,18 +377922,22 @@ var import_xml_js, CRC32_TABLE2, PIXELS_PER_INCH3 = 96, EIGHTHS_PER_POINT2 = 8,
377762
377922
  }, resolveShadingFillColor2 = (shading) => {
377763
377923
  if (!shading || typeof shading !== "object")
377764
377924
  return null;
377765
- const fill = normalizeHexColor4(shading.fill);
377766
- if (!fill)
377767
- return null;
377768
377925
  const val = typeof shading.val === "string" ? shading.val.trim().toLowerCase() : "";
377926
+ if (val === "nil" || val === "none")
377927
+ return null;
377928
+ const fillIsAuto = typeof shading.fill === "string" && shading.fill.trim().toLowerCase() === "auto";
377929
+ const fillHex = fillIsAuto ? null : normalizeHexColor4(shading.fill);
377769
377930
  const pctMatch = val.match(/^pct(\d{1,3})$/);
377770
- if (!pctMatch)
377771
- return fill;
377772
- const pct = Number.parseInt(pctMatch[1], 10);
377931
+ const isPattern = Boolean(pctMatch) || val === "solid";
377932
+ if (!isPattern)
377933
+ return fillHex;
377934
+ const baseHex = fillHex ?? DEFAULT_SHADING_FILL_COLOR2;
377935
+ const colorIsAuto = typeof shading.color !== "string" || shading.color.trim() === "" || shading.color.trim().toLowerCase() === "auto";
377936
+ const foregroundHex = colorIsAuto ? DEFAULT_SHADING_FOREGROUND_COLOR2 : normalizeHexColor4(shading.color) ?? DEFAULT_SHADING_FOREGROUND_COLOR2;
377937
+ const pct = pctMatch ? Number.parseInt(pctMatch[1], 10) : 100;
377773
377938
  if (!Number.isFinite(pct) || pct < 0 || pct > 100)
377774
- return fill;
377775
- const foreground = normalizeHexColor4(shading.color) ?? DEFAULT_SHADING_FOREGROUND_COLOR2;
377776
- return blendHexColors2(fill, foreground, pct / 100) ?? fill;
377939
+ return fillHex;
377940
+ return blendHexColors2(baseHex, foregroundHex, pct / 100) ?? fillHex;
377777
377941
  }, deobfuscateFont2 = (arrayBuffer, guidHex) => {
377778
377942
  const dta = new Uint8Array(arrayBuffer);
377779
377943
  const guidStr = guidHex.replace(/[-{}]/g, "");
@@ -382057,16 +382221,15 @@ var isTableRowNode2 = (node3) => node3.type === "tableRow" || node3.type === "ta
382057
382221
  }
382058
382222
  }
382059
382223
  if (!cellBackgroundColor && resolvedTcProps?.shading) {
382060
- const { fill, themeFill, themeFillTint, themeFillShade } = resolvedTcProps.shading;
382061
- const normalizedFill = normalizeShadingColor2(fill);
382062
- if (normalizedFill) {
382063
- cellBackgroundColor = normalizedFill;
382064
- } else if (themeFill && context.themeColors) {
382065
- const resolved = resolveThemeColorValue2(themeFill, themeFillTint, themeFillShade, context.themeColors);
382066
- const normalizedTheme = normalizeShadingColor2(resolved);
382067
- if (normalizedTheme) {
382068
- cellBackgroundColor = normalizedTheme;
382069
- }
382224
+ const { fill, color: color2, val, themeFill, themeFillTint, themeFillShade } = resolvedTcProps.shading;
382225
+ let fillBase = normalizeShadingColor2(fill);
382226
+ if (!fillBase && themeFill && context.themeColors) {
382227
+ const resolvedTheme = resolveThemeColorValue2(themeFill, themeFillTint, themeFillShade, context.themeColors);
382228
+ fillBase = normalizeShadingColor2(resolvedTheme);
382229
+ }
382230
+ const resolved = resolveShadingFillColor2({ val, color: color2, fill: fillBase ?? fill });
382231
+ if (resolved) {
382232
+ cellBackgroundColor = resolved.startsWith("#") ? resolved : `#${resolved}`;
382070
382233
  }
382071
382234
  }
382072
382235
  const cellConverterContext = tableInfo || cellBackgroundColor ? {
@@ -382328,9 +382491,12 @@ var isTableRowNode2 = (node3) => node3.type === "tableRow" || node3.type === "ta
382328
382491
  return null;
382329
382492
  const rowProps = rowNode.attrs?.tableRowProperties;
382330
382493
  const rowHeight = normalizeRowHeight2(rowProps);
382494
+ const tblPrExBordersRaw = rowProps?.tblPrExBorders;
382495
+ const rowBorders = tblPrExBordersRaw && typeof tblPrExBordersRaw === "object" ? extractTableBorders2(tblPrExBordersRaw, { unit: "eighthPoints" }) : undefined;
382331
382496
  const attrs = rowProps && typeof rowProps === "object" ? {
382332
382497
  tableRowProperties: rowProps,
382333
- ...rowHeight ? { rowHeight } : {}
382498
+ ...rowHeight ? { rowHeight } : {},
382499
+ ...rowBorders ? { borders: rowBorders } : {}
382334
382500
  } : rowHeight ? { rowHeight } : undefined;
382335
382501
  return {
382336
382502
  id: context.nextBlockId(`row-${rowIndex}`),
@@ -382343,6 +382509,7 @@ var init_table = __esm(() => {
382343
382509
  init_attributes();
382344
382510
  init_utilities();
382345
382511
  init_table_styles();
382512
+ init_helpers();
382346
382513
  init_marks();
382347
382514
  init_tracked_changes();
382348
382515
  init_sdt();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/mcp",
3
- "version": "0.11.0-next.6",
3
+ "version": "0.11.0-next.7",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=20"
@@ -19,9 +19,9 @@
19
19
  "@types/bun": "^1.3.8",
20
20
  "@types/node": "22.19.2",
21
21
  "typescript": "^5.9.2",
22
+ "@superdoc/super-editor": "0.0.1",
22
23
  "@superdoc/document-api": "0.0.1",
23
- "superdoc": "1.38.0",
24
- "@superdoc/super-editor": "0.0.1"
24
+ "superdoc": "1.38.0"
25
25
  },
26
26
  "publishConfig": {
27
27
  "access": "public"