@superdoc-dev/mcp 0.3.0-next.86 → 0.3.0-next.87

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 +162 -50
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -200154,7 +200154,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
200154
200154
  init_remark_gfm_BhnWr3yf_es();
200155
200155
  });
200156
200156
 
200157
- // ../../packages/superdoc/dist/chunks/src-VLFj9vqo.es.js
200157
+ // ../../packages/superdoc/dist/chunks/src-OZOxpRA7.es.js
200158
200158
  function deleteProps(obj, propOrProps) {
200159
200159
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
200160
200160
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -204898,6 +204898,9 @@ function getTableContext($head) {
204898
204898
  table: table2
204899
204899
  };
204900
204900
  }
204901
+ function isRtlTable(table2) {
204902
+ return table2?.attrs?.tableProperties?.rightToLeft === true;
204903
+ }
204901
204904
  function getCellRect(context) {
204902
204905
  const map$12 = TableMap.get(context.table);
204903
204906
  return {
@@ -204905,6 +204908,9 @@ function getCellRect(context) {
204905
204908
  rect: map$12.findCell(context.cellStart - context.tableStart)
204906
204909
  };
204907
204910
  }
204911
+ function getEffectiveTableDir(table2, dir) {
204912
+ return isRtlTable(table2) ? -dir : dir;
204913
+ }
204908
204914
  function isLastCellInTable(context) {
204909
204915
  if (!context)
204910
204916
  return false;
@@ -204996,7 +205002,8 @@ function getTableBoundaryExitSelection(state, dir) {
204996
205002
  const context = getTableContext(selection.$head);
204997
205003
  if (!context)
204998
205004
  return null;
204999
- const helpers = getDirectionHelpers(dir);
205005
+ const effectiveDir = getEffectiveTableDir(context.table, dir);
205006
+ const helpers = getDirectionHelpers(effectiveDir);
205000
205007
  if (!helpers.isEdgeParagraphInCell(selection.$head, context.cellDepth))
205001
205008
  return null;
205002
205009
  if (!helpers.isAtParagraphBoundary(selection.$head))
@@ -205007,7 +205014,38 @@ function getTableBoundaryExitSelection(state, dir) {
205007
205014
  const targetPos = helpers.findTextPosAcrossBoundary(state, boundaryPos);
205008
205015
  if (targetPos != null)
205009
205016
  return TextSelection.create(state.doc, targetPos);
205010
- return findSelectionNearBoundary(state, boundaryPos, dir);
205017
+ return findSelectionNearBoundary(state, boundaryPos, effectiveDir);
205018
+ }
205019
+ function getIntraTableArrowSelection(state, dir, expandSelection) {
205020
+ const selection = state.selection;
205021
+ if (!selection.empty)
205022
+ return null;
205023
+ const context = getTableContext(selection.$head);
205024
+ if (!context)
205025
+ return null;
205026
+ if (!isRtlTable(context.table))
205027
+ return null;
205028
+ const effectiveDir = getEffectiveTableDir(context.table, dir);
205029
+ const helpers = getDirectionHelpers(effectiveDir);
205030
+ if (!helpers.isEdgeParagraphInCell(selection.$head, context.cellDepth))
205031
+ return null;
205032
+ if (!helpers.isAtParagraphBoundary(selection.$head))
205033
+ return null;
205034
+ const { map: map$12 } = getCellRect(context);
205035
+ const currentCellRelativePos = context.cellStart - context.tableStart;
205036
+ const nextCellRelativePos = map$12.nextCell(currentCellRelativePos, "horiz", effectiveDir);
205037
+ if (nextCellRelativePos == null)
205038
+ return null;
205039
+ const nextCellAbsolutePos = context.tableStart + nextCellRelativePos;
205040
+ if (expandSelection)
205041
+ return CellSelection.create(state.doc, context.cellStart, nextCellAbsolutePos);
205042
+ const nextCellNode = state.doc.nodeAt(nextCellAbsolutePos);
205043
+ if (!nextCellNode)
205044
+ return null;
205045
+ const targetPos = effectiveDir > 0 ? findFirstTextPosInNode(nextCellNode, nextCellAbsolutePos) : findLastTextPosInNode(nextCellNode, nextCellAbsolutePos);
205046
+ if (targetPos != null)
205047
+ return TextSelection.create(state.doc, targetPos);
205048
+ return findSelectionNearBoundary(state, nextCellAbsolutePos, effectiveDir);
205011
205049
  }
205012
205050
  function getAdjacentTableEntrySelection(state, dir) {
205013
205051
  const selection = state.selection;
@@ -205024,13 +205062,14 @@ function getAdjacentTableEntrySelection(state, dir) {
205024
205062
  const adjacentNode = dir > 0 ? $boundary.nodeAfter : $boundary.nodeBefore;
205025
205063
  if (!adjacentNode || adjacentNode.type.spec.tableRole !== "table")
205026
205064
  return null;
205027
- if (dir > 0) {
205028
- const targetPos$1 = findFirstTextPosInNode(adjacentNode, boundaryPos);
205065
+ const effectiveDir = isRtlTable(adjacentNode) ? -dir : dir;
205066
+ const tablePos = dir > 0 ? boundaryPos : boundaryPos - adjacentNode.nodeSize;
205067
+ if (effectiveDir > 0) {
205068
+ const targetPos$1 = findFirstTextPosInNode(adjacentNode, tablePos);
205029
205069
  if (targetPos$1 != null)
205030
205070
  return TextSelection.create(state.doc, targetPos$1);
205031
- return findSelectionNearBoundary(state, boundaryPos, 1);
205071
+ return findSelectionNearBoundary(state, tablePos, 1);
205032
205072
  }
205033
- const tablePos = boundaryPos - adjacentNode.nodeSize;
205034
205073
  const targetPos = findLastTextPosInNode(adjacentNode, tablePos);
205035
205074
  if (targetPos != null)
205036
205075
  return TextSelection.create(state.doc, targetPos);
@@ -205042,7 +205081,7 @@ function createTableBoundaryNavigationPlugin() {
205042
205081
  props: { handleKeyDown(view, event) {
205043
205082
  if (event.defaultPrevented)
205044
205083
  return false;
205045
- if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey)
205084
+ if (event.altKey || event.ctrlKey || event.metaKey)
205046
205085
  return false;
205047
205086
  if ((event.key === "Backspace" || event.key === "Delete") && isInProtectedTrailingTableParagraph(view.state)) {
205048
205087
  event.preventDefault();
@@ -205051,7 +205090,14 @@ function createTableBoundaryNavigationPlugin() {
205051
205090
  const dir = event.key === "ArrowRight" ? 1 : event.key === "ArrowLeft" ? -1 : 0;
205052
205091
  if (!dir)
205053
205092
  return false;
205054
- const nextSelection = getTableBoundaryExitSelection(view.state, dir) ?? getAdjacentTableEntrySelection(view.state, dir);
205093
+ const context = getTableContext(view.state.selection.$head);
205094
+ const allowShiftInRtlTable = Boolean(event.shiftKey && context && isRtlTable(context.table));
205095
+ if (event.shiftKey && !allowShiftInRtlTable)
205096
+ return false;
205097
+ let nextSelection = getIntraTableArrowSelection(view.state, dir, event.shiftKey);
205098
+ if (!nextSelection && event.shiftKey)
205099
+ return false;
205100
+ nextSelection = nextSelection ?? getTableBoundaryExitSelection(view.state, dir) ?? getAdjacentTableEntrySelection(view.state, dir);
205055
205101
  if (!nextSelection)
205056
205102
  return false;
205057
205103
  view.dispatch(view.state.tr.setSelection(nextSelection).scrollIntoView());
@@ -246613,18 +246659,28 @@ function resolveRenderedTableWidth(columnWidth, measuredWidth, attrs) {
246613
246659
  }
246614
246660
  function resolveTableFrame(baseX, columnWidth, tableWidth, attrs) {
246615
246661
  const width = resolveRenderedTableWidth(columnWidth, tableWidth, attrs);
246616
- const justification = typeof attrs?.justification === "string" ? attrs.justification : undefined;
246617
- if (justification === "center")
246662
+ const explicitJustification = typeof attrs?.justification === "string" ? attrs.justification : undefined;
246663
+ const isRtlTable$1 = attrs?.tableProperties?.rightToLeft === true;
246664
+ const effectiveJustification = explicitJustification ?? (isRtlTable$1 ? "end" : undefined);
246665
+ const tableIndent = getTableIndentWidth(attrs);
246666
+ if (effectiveJustification === "center")
246618
246667
  return {
246619
246668
  x: baseX + (columnWidth - width) / 2,
246620
246669
  width
246621
246670
  };
246622
- if (justification === "right" || justification === "end")
246671
+ if (effectiveJustification === "right" || effectiveJustification === "end") {
246672
+ const rightAlignedX = baseX + (columnWidth - width);
246673
+ if (explicitJustification == null && isRtlTable$1 && tableIndent !== 0)
246674
+ return {
246675
+ x: rightAlignedX - tableIndent,
246676
+ width
246677
+ };
246623
246678
  return {
246624
- x: baseX + (columnWidth - width),
246679
+ x: rightAlignedX,
246625
246680
  width
246626
246681
  };
246627
- return applyTableIndent(baseX, width, getTableIndentWidth(attrs), columnWidth);
246682
+ }
246683
+ return applyTableIndent(baseX, width, tableIndent, columnWidth);
246628
246684
  }
246629
246685
  function calculateColumnMinWidth(measuredWidth) {
246630
246686
  if (!Number.isFinite(measuredWidth) || measuredWidth <= 0)
@@ -254995,30 +255051,61 @@ function isTableBorderValue(value) {
254995
255051
  function extractTableBorders(bordersInput, options) {
254996
255052
  if (!bordersInput || typeof bordersInput !== "object")
254997
255053
  return;
254998
- const sides = [
255054
+ const borders = {};
255055
+ const assignConverted = (side, raw) => {
255056
+ if (raw == null)
255057
+ return;
255058
+ if (isTableBorderValue(raw)) {
255059
+ borders[side] = raw;
255060
+ return;
255061
+ }
255062
+ const converted = convertTableBorderValue(raw, options);
255063
+ if (converted !== undefined)
255064
+ borders[side] = converted;
255065
+ };
255066
+ for (const side of [
254999
255067
  "top",
255000
255068
  "right",
255001
255069
  "bottom",
255002
255070
  "left",
255003
255071
  "insideH",
255004
255072
  "insideV"
255005
- ];
255073
+ ])
255074
+ assignConverted(side, bordersInput[side]);
255075
+ if (borders.left == null)
255076
+ assignConverted("left", bordersInput.start);
255077
+ if (borders.right == null)
255078
+ assignConverted("right", bordersInput.end);
255079
+ return Object.keys(borders).length > 0 ? borders : undefined;
255080
+ }
255081
+ function extractCellBorders(cellAttrs, _options) {
255082
+ if (!cellAttrs?.borders)
255083
+ return;
255084
+ const bordersData = cellAttrs.borders;
255006
255085
  const borders = {};
255007
- for (const side of sides) {
255008
- const raw = bordersInput[side];
255009
- if (raw == null)
255010
- continue;
255011
- if (isTableBorderValue(raw))
255012
- borders[side] = raw;
255013
- else {
255014
- const converted = convertTableBorderValue(raw, options);
255015
- if (converted !== undefined)
255016
- borders[side] = converted;
255017
- }
255086
+ for (const side of [
255087
+ "top",
255088
+ "right",
255089
+ "bottom",
255090
+ "left"
255091
+ ]) {
255092
+ const spec = convertBorderSpec(bordersData[side]);
255093
+ if (spec)
255094
+ borders[side] = spec;
255095
+ }
255096
+ if (borders.left == null) {
255097
+ const spec = convertBorderSpec(bordersData.start);
255098
+ if (spec)
255099
+ borders.left = spec;
255100
+ }
255101
+ if (borders.right == null) {
255102
+ const spec = convertBorderSpec(bordersData.end);
255103
+ if (spec)
255104
+ borders.right = spec;
255018
255105
  }
255019
255106
  return Object.keys(borders).length > 0 ? borders : undefined;
255020
255107
  }
255021
- function extractCellPadding(cellAttrs) {
255108
+ function extractCellPadding(cellAttrs, _options) {
255022
255109
  const cellMargins = cellAttrs?.cellMargins;
255023
255110
  if (!cellMargins || typeof cellMargins !== "object")
255024
255111
  return;
@@ -255032,6 +255119,12 @@ function extractCellPadding(cellAttrs) {
255032
255119
  padding.bottom = margins.bottom;
255033
255120
  if (typeof margins.left === "number")
255034
255121
  padding.left = margins.left;
255122
+ const marginStart = margins.marginStart;
255123
+ const marginEnd = margins.marginEnd;
255124
+ if (typeof marginStart === "number" && padding.left == null)
255125
+ padding.left = marginStart;
255126
+ if (typeof marginEnd === "number" && padding.right == null)
255127
+ padding.right = marginEnd;
255035
255128
  if (Object.keys(padding).length === 0)
255036
255129
  return;
255037
255130
  return normalizeCellPaddingTopBottom(padding);
@@ -256856,7 +256949,11 @@ function tableNodeToBlock(node2, { nextBlockId, positions, storyKey, trackedChan
256856
256949
  };
256857
256950
  };
256858
256951
  const borderSource = getBorderSource();
256859
- const tableBorders = borderSource ? extractTableBorders(borderSource.borders, { unit: borderSource.unit }) : undefined;
256952
+ const isRtlTable$1 = tablePropertiesForCascade?.rightToLeft === true;
256953
+ const tableBorders = borderSource ? extractTableBorders(borderSource.borders, {
256954
+ unit: borderSource.unit,
256955
+ isRtl: isRtlTable$1
256956
+ }) : undefined;
256860
256957
  if (tableBorders)
256861
256958
  tableAttrs.borders = tableBorders;
256862
256959
  if (node2.attrs?.borderCollapse)
@@ -281512,6 +281609,7 @@ menclose::after {
281512
281609
  min: boundary.minWidth,
281513
281610
  r: boundary.resizable ? 1 : 0
281514
281611
  })),
281612
+ rtl: isRtl,
281515
281613
  segments: boundarySegments.map((segs, colIndex) => segs.map((seg) => ({
281516
281614
  c: colIndex,
281517
281615
  y: seg.y + contentTop,
@@ -281530,7 +281628,7 @@ menclose::after {
281530
281628
  }
281531
281629
  if (block.id)
281532
281630
  container.setAttribute("data-sd-block-id", block.id);
281533
- if ((block.attrs?.borderCollapse ?? (block.attrs?.cellSpacing != null ? "separate" : "collapse")) === "separate" && block.attrs?.cellSpacing && tableBorders) {
281631
+ if ((block.attrs?.borderCollapse ?? (block.attrs?.cellSpacing != null ? "separate" : "collapse")) === "separate" && tableBorders) {
281534
281632
  applyBorder(container, "Top", borderValueToSpec(tableBorders.top));
281535
281633
  applyBorder(container, "Right", borderValueToSpec(isRtl ? tableBorders.left : tableBorders.right));
281536
281634
  applyBorder(container, "Bottom", borderValueToSpec(tableBorders.bottom));
@@ -288259,10 +288357,11 @@ menclose::after {
288259
288357
  }, EMPTY_CHART_DATA, hydrateTableStyleAttrs = (tableNode, context, effectiveStyleId) => {
288260
288358
  const hydration = {};
288261
288359
  const tableProps = tableNode.attrs?.tableProperties ?? null;
288360
+ const isRtlTable$1 = tableProps?.rightToLeft === true;
288262
288361
  let inlineBorders;
288263
288362
  let inlinePadding;
288264
288363
  if (tableProps) {
288265
- const padding = convertCellMarginsToPx(tableProps.cellMargins);
288364
+ const padding = convertCellMarginsToPx(tableProps.cellMargins, isRtlTable$1);
288266
288365
  if (padding)
288267
288366
  inlinePadding = normalizeCellPaddingTopBottom(padding);
288268
288367
  if (tableProps.borders && typeof tableProps.borders === "object")
@@ -288293,7 +288392,7 @@ menclose::after {
288293
288392
  } else if (inlineBorders)
288294
288393
  hydration.borders = inlineBorders;
288295
288394
  if (resolved.cellMargins) {
288296
- const stylePadding = convertCellMarginsToPx(resolved.cellMargins);
288395
+ const stylePadding = convertCellMarginsToPx(resolved.cellMargins, isRtlTable$1);
288297
288396
  if (stylePadding) {
288298
288397
  const normalizedStylePadding = normalizeCellPaddingTopBottom(stylePadding);
288299
288398
  hydration.cellPadding = inlinePadding ? {
@@ -288339,7 +288438,9 @@ menclose::after {
288339
288438
  "left",
288340
288439
  "right",
288341
288440
  "insideH",
288342
- "insideV"
288441
+ "insideV",
288442
+ "start",
288443
+ "end"
288343
288444
  ];
288344
288445
  const result = {};
288345
288446
  for (const side of sides) {
@@ -288357,7 +288458,7 @@ menclose::after {
288357
288458
  ...border,
288358
288459
  size: size$1
288359
288460
  } : border;
288360
- }, convertCellMarginsToPx = (margins) => {
288461
+ }, convertCellMarginsToPx = (margins, isRtlTable$1 = false) => {
288361
288462
  if (!margins || typeof margins !== "object")
288362
288463
  return;
288363
288464
  const spacing = {};
@@ -288370,8 +288471,8 @@ menclose::after {
288370
288471
  marginBottom: "bottom",
288371
288472
  marginLeft: "left",
288372
288473
  marginRight: "right",
288373
- marginStart: "left",
288374
- marginEnd: "right"
288474
+ marginStart: isRtlTable$1 ? "right" : "left",
288475
+ marginEnd: isRtlTable$1 ? "left" : "right"
288375
288476
  };
288376
288477
  Object.entries(margins).forEach(([key2, value]) => {
288377
288478
  const side = keyMap[key2];
@@ -288664,6 +288765,7 @@ menclose::after {
288664
288765
  return null;
288665
288766
  const cellAttrs = {};
288666
288767
  if (resolvedTcProps?.borders && typeof resolvedTcProps.borders === "object") {
288768
+ const resolvedBordersData = resolvedTcProps.borders;
288667
288769
  const resolvedBorders = {};
288668
288770
  for (const side of [
288669
288771
  "top",
@@ -288671,36 +288773,46 @@ menclose::after {
288671
288773
  "bottom",
288672
288774
  "left"
288673
288775
  ]) {
288674
- const spec = convertResolvedCellBorder(resolvedTcProps.borders[side]);
288776
+ const spec = convertResolvedCellBorder(resolvedBordersData[side]);
288675
288777
  if (spec)
288676
288778
  resolvedBorders[side] = spec;
288677
288779
  }
288780
+ if (resolvedBorders.left == null) {
288781
+ const spec = convertResolvedCellBorder(resolvedBordersData.start);
288782
+ if (spec)
288783
+ resolvedBorders.left = spec;
288784
+ }
288785
+ if (resolvedBorders.right == null) {
288786
+ const spec = convertResolvedCellBorder(resolvedBordersData.end);
288787
+ if (spec)
288788
+ resolvedBorders.right = spec;
288789
+ }
288678
288790
  if (Object.keys(resolvedBorders).length > 0)
288679
288791
  cellAttrs.borders = resolvedBorders;
288680
288792
  }
288681
288793
  if (!cellAttrs.borders && cellNode.attrs?.borders && typeof cellNode.attrs.borders === "object") {
288682
288794
  const legacy = cellNode.attrs.borders;
288683
- const fallback = {};
288795
+ const filteredLegacyBorders = {};
288684
288796
  for (const side of [
288685
288797
  "top",
288686
288798
  "right",
288687
288799
  "bottom",
288688
- "left"
288800
+ "left",
288801
+ "start",
288802
+ "end"
288689
288803
  ]) {
288690
288804
  const b$1 = legacy[side];
288691
- if (b$1 && b$1.val && typeof b$1.size === "number" && b$1.size > 0) {
288692
- const color2 = b$1.color ? b$1.color.startsWith("#") ? b$1.color : `#${b$1.color}` : "#000000";
288693
- fallback[side] = {
288694
- style: normalizeLegacyBorderStyle(b$1.val),
288695
- width: b$1.size,
288696
- color: color2
288805
+ if (b$1 && b$1.val && typeof b$1.size === "number" && b$1.size > 0)
288806
+ filteredLegacyBorders[side] = {
288807
+ ...b$1,
288808
+ val: normalizeLegacyBorderStyle(b$1.val)
288697
288809
  };
288698
- }
288699
288810
  }
288700
- if (Object.keys(fallback).length > 0)
288811
+ const fallback = extractCellBorders({ borders: filteredLegacyBorders }, { isRtl: tableProperties?.rightToLeft === true });
288812
+ if (fallback)
288701
288813
  cellAttrs.borders = fallback;
288702
288814
  }
288703
- const padding = extractCellPadding(cellNode.attrs ?? {}) ?? (defaultCellPadding ? { ...defaultCellPadding } : undefined);
288815
+ const padding = extractCellPadding(cellNode.attrs ?? {}, { isRtl: tableProperties?.rightToLeft === true }) ?? (defaultCellPadding ? { ...defaultCellPadding } : undefined);
288704
288816
  if (padding)
288705
288817
  cellAttrs.padding = padding;
288706
288818
  const verticalAlign = cellNode.attrs?.verticalAlign;
@@ -293846,7 +293958,7 @@ menclose::after {
293846
293958
  return;
293847
293959
  console.log(...args$1);
293848
293960
  }, 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;
293849
- var init_src_VLFj9vqo_es = __esm(() => {
293961
+ var init_src_OZOxpRA7_es = __esm(() => {
293850
293962
  init_rolldown_runtime_Bg48TavK_es();
293851
293963
  init_SuperConverter_5Idv4fhC_es();
293852
293964
  init_jszip_C49i9kUs_es();
@@ -331938,7 +332050,7 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
331938
332050
 
331939
332051
  // ../../packages/superdoc/dist/super-editor.es.js
331940
332052
  var init_super_editor_es = __esm(() => {
331941
- init_src_VLFj9vqo_es();
332053
+ init_src_OZOxpRA7_es();
331942
332054
  init_SuperConverter_5Idv4fhC_es();
331943
332055
  init_jszip_C49i9kUs_es();
331944
332056
  init_xml_js_CqGKpaft_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/mcp",
3
- "version": "0.3.0-next.86",
3
+ "version": "0.3.0-next.87",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=20"