@superdoc-dev/mcp 0.5.1 → 0.6.0-next.2

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 +312 -55
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -14569,7 +14569,7 @@ function finalize(ctx, schema) {
14569
14569
  result.$schema = "http://json-schema.org/draft-07/schema#";
14570
14570
  } else if (ctx.target === "draft-04") {
14571
14571
  result.$schema = "http://json-schema.org/draft-04/schema#";
14572
- } else if (ctx.target === "openapi-3.0") {} else {}
14572
+ } else if (ctx.target === "openapi-3.0") {}
14573
14573
  if (ctx.external?.uri) {
14574
14574
  const id = ctx.external.registry.get(schema)?.id;
14575
14575
  if (!id)
@@ -14834,7 +14834,7 @@ var formatMap, stringProcessor = (schema, ctx, _json, _params) => {
14834
14834
  if (val === undefined) {
14835
14835
  if (ctx.unrepresentable === "throw") {
14836
14836
  throw new Error("Literal `undefined` cannot be represented in JSON Schema");
14837
- } else {}
14837
+ }
14838
14838
  } else if (typeof val === "bigint") {
14839
14839
  if (ctx.unrepresentable === "throw") {
14840
14840
  throw new Error("BigInt literals cannot be represented in JSON Schema");
@@ -51891,7 +51891,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
51891
51891
  emptyOptions2 = {};
51892
51892
  });
51893
51893
 
51894
- // ../../packages/superdoc/dist/chunks/SuperConverter-CMMmelrE.es.js
51894
+ // ../../packages/superdoc/dist/chunks/SuperConverter-CnwfJPj6.es.js
51895
51895
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
51896
51896
  const fieldValue = extension$1.config[field];
51897
51897
  if (typeof fieldValue === "function")
@@ -105653,7 +105653,7 @@ var isRegExp = (value) => {
105653
105653
  if (id)
105654
105654
  return trackedChanges.filter(({ mark }) => mark.attrs.id === id);
105655
105655
  return trackedChanges;
105656
- }, DERIVED_ID_LENGTH = 24, groupedCache, SDT_NODE_NAMES, SDT_BLOCK_NAME = "structuredContentBlock", SDT_NODE_TYPES, VALID_CONTROL_TYPES, VALID_LOCK_MODES, VALID_APPEARANCES, FIELD_LIKE_SDT_TYPES, liveDocumentCountsCache, BIBLIOGRAPHY_NAMESPACE_URI = "http://schemas.openxmlformats.org/officeDocument/2006/bibliography", CUSTOM_XML_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", CUSTOM_XML_PROPS_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps", DEFAULT_SELECTED_STYLE = "/APA.XSL", DEFAULT_STYLE_NAME = "APA", DEFAULT_VERSION = "6", API_TO_OOXML_SOURCE_TYPE, OOXML_TO_API_SOURCE_TYPE, SIMPLE_FIELD_TO_XML_TAG, XML_TAG_TO_SIMPLE_FIELD, import_lib2, FONT_FAMILY_FALLBACKS, DEFAULT_GENERIC_FALLBACK = "sans-serif", DEFAULT_FONT_SIZE_PT = 10, CURRENT_APP_VERSION = "1.33.0", collectRunDefaultProperties = (runProps, { allowOverrideTypeface = true, allowOverrideSize = true, themeResolver, state }) => {
105656
+ }, DERIVED_ID_LENGTH = 24, groupedCache, SDT_NODE_NAMES, SDT_BLOCK_NAME = "structuredContentBlock", SDT_NODE_TYPES, VALID_CONTROL_TYPES, VALID_LOCK_MODES, VALID_APPEARANCES, FIELD_LIKE_SDT_TYPES, liveDocumentCountsCache, BIBLIOGRAPHY_NAMESPACE_URI = "http://schemas.openxmlformats.org/officeDocument/2006/bibliography", CUSTOM_XML_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", CUSTOM_XML_PROPS_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps", DEFAULT_SELECTED_STYLE = "/APA.XSL", DEFAULT_STYLE_NAME = "APA", DEFAULT_VERSION = "6", API_TO_OOXML_SOURCE_TYPE, OOXML_TO_API_SOURCE_TYPE, SIMPLE_FIELD_TO_XML_TAG, XML_TAG_TO_SIMPLE_FIELD, import_lib2, FONT_FAMILY_FALLBACKS, DEFAULT_GENERIC_FALLBACK = "sans-serif", DEFAULT_FONT_SIZE_PT = 10, CURRENT_APP_VERSION = "1.33.1", collectRunDefaultProperties = (runProps, { allowOverrideTypeface = true, allowOverrideSize = true, themeResolver, state }) => {
105657
105657
  if (!runProps?.elements?.length || !state)
105658
105658
  return;
105659
105659
  const fontsNode = runProps.elements.find((el) => el.name === "w:rFonts");
@@ -105687,7 +105687,7 @@ var isRegExp = (value) => {
105687
105687
  state.kern = kernNode.attributes["w:val"];
105688
105688
  }
105689
105689
  }, SuperConverter;
105690
- var init_SuperConverter_CMMmelrE_es = __esm(() => {
105690
+ var init_SuperConverter_CnwfJPj6_es = __esm(() => {
105691
105691
  init_rolldown_runtime_Bg48TavK_es();
105692
105692
  init_jszip_C49i9kUs_es();
105693
105693
  init_xml_js_CqGKpaft_es();
@@ -143721,7 +143721,7 @@ var init_SuperConverter_CMMmelrE_es = __esm(() => {
143721
143721
  };
143722
143722
  });
143723
143723
 
143724
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-BE8Nb0oO.es.js
143724
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-Btizo_Im.es.js
143725
143725
  function parseSizeUnit(val = "0") {
143726
143726
  const length = val.toString() || "0";
143727
143727
  const value = Number.parseFloat(length);
@@ -146443,8 +146443,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
146443
146443
  }
146444
146444
  };
146445
146445
  };
146446
- var init_create_headless_toolbar_BE8Nb0oO_es = __esm(() => {
146447
- init_SuperConverter_CMMmelrE_es();
146446
+ var init_create_headless_toolbar_Btizo_Im_es = __esm(() => {
146447
+ init_SuperConverter_CnwfJPj6_es();
146448
146448
  init_constants_DrU4EASo_es();
146449
146449
  init_dist_B8HfvhaK_es();
146450
146450
  CSS_DIMENSION_REGEX = /[\d-.]+(\w+)$/;
@@ -175400,8 +175400,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
175400
175400
  patchFlag |= 2048;
175401
175401
  }
175402
175402
  root2.codegenNode = createVNodeCall(context, helper(FRAGMENT), undefined, root2.children, patchFlag, undefined, undefined, true, undefined, false);
175403
- } else
175404
- ;
175403
+ }
175405
175404
  }
175406
175405
  function traverseChildren(parent, context) {
175407
175406
  let i4 = 0;
@@ -200677,7 +200676,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
200677
200676
  init_remark_gfm_BhnWr3yf_es();
200678
200677
  });
200679
200678
 
200680
- // ../../packages/superdoc/dist/chunks/src-BDnlS-6f.es.js
200679
+ // ../../packages/superdoc/dist/chunks/src-DTrWuNvy.es.js
200681
200680
  function deleteProps(obj, propOrProps) {
200682
200681
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
200683
200682
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -201460,7 +201459,7 @@ function prosemirrorToYXmlFragment(doc$12, xmlFragment) {
201460
201459
  }
201461
201460
  function getSuperdocVersion() {
201462
201461
  try {
201463
- return "1.33.0";
201462
+ return "1.33.1";
201464
201463
  } catch {
201465
201464
  return "unknown";
201466
201465
  }
@@ -260110,6 +260109,7 @@ function lineHeightBeforeIndex(lines, fromLine, targetIndex) {
260110
260109
  function computeCaretLayoutRectGeometry({ layout, blocks: blocks2, measures, painterHost, viewportHost, visibleHost, zoom }, pos, includeDomFallback = true) {
260111
260110
  if (!layout)
260112
260111
  return null;
260112
+ const originalPos = pos;
260113
260113
  let effectivePos = pos;
260114
260114
  let hit = getFragmentAtPosition(layout, blocks2, measures, pos);
260115
260115
  if (!hit) {
@@ -260181,28 +260181,105 @@ function computeCaretLayoutRectGeometry({ layout, blocks: blocks2, measures, pai
260181
260181
  };
260182
260182
  const pageEl = getPageElementByIndex(painterHost ?? null, hit.pageIndex);
260183
260183
  const pageRect = pageEl?.getBoundingClientRect();
260184
+ if (includeDomFallback && pageRect) {
260185
+ const selection = pageEl?.ownerDocument?.getSelection();
260186
+ if (selection?.rangeCount && selection.isCollapsed) {
260187
+ const nativeRange = selection.getRangeAt(0);
260188
+ if (typeof nativeRange.getBoundingClientRect === "function") {
260189
+ const nativeRect = nativeRange.getBoundingClientRect();
260190
+ const inPageBounds = Number.isFinite(nativeRect.left) && Number.isFinite(nativeRect.top) && Number.isFinite(nativeRect.height) && nativeRect.height > 0 && nativeRect.left >= pageRect.left - 2 && nativeRect.left <= pageRect.right + 2 && nativeRect.top >= pageRect.top - 2 && nativeRect.top <= pageRect.bottom + 2;
260191
+ const nativeX = (nativeRect.left - pageRect.left) / zoom;
260192
+ const nativeY = (nativeRect.top - pageRect.top) / zoom;
260193
+ const withinGeometrySanity = Math.abs(nativeX - result.x) <= 80;
260194
+ if (inPageBounds && withinGeometrySanity)
260195
+ return {
260196
+ pageIndex: hit.pageIndex,
260197
+ x: nativeX,
260198
+ y: nativeY,
260199
+ height: line.lineHeight
260200
+ };
260201
+ }
260202
+ }
260203
+ }
260184
260204
  let domCaretX = null;
260185
260205
  let domCaretY = null;
260186
- const spanEls = pageEl?.querySelectorAll("span[data-pm-start][data-pm-end]");
260187
- for (const spanEl of Array.from(spanEls ?? [])) {
260188
- const pmStart = Number(spanEl.dataset.pmStart);
260189
- const pmEnd = Number(spanEl.dataset.pmEnd);
260190
- if (effectivePos >= pmStart && effectivePos <= pmEnd && spanEl.firstChild?.nodeType === Node.TEXT_NODE) {
260191
- const textNode = spanEl.firstChild;
260192
- const charIndex = Math.min(effectivePos - pmStart, textNode.length);
260193
- const rangeObj = document.createRange();
260194
- rangeObj.setStart(textNode, charIndex);
260195
- rangeObj.setEnd(textNode, charIndex);
260196
- if (typeof rangeObj.getBoundingClientRect !== "function")
260197
- break;
260198
- const rangeRect = rangeObj.getBoundingClientRect();
260199
- if (pageRect) {
260200
- domCaretX = (rangeRect.left - pageRect.left) / zoom;
260201
- domCaretY = (rangeRect.top - pageRect.top) / zoom;
260202
- }
260206
+ const spanCandidates = [];
260207
+ const pushUnique = (el) => {
260208
+ if (!spanCandidates.includes(el))
260209
+ spanCandidates.push(el);
260210
+ };
260211
+ const collectSpans = (root3) => {
260212
+ if (!root3)
260213
+ return;
260214
+ const spans = root3.querySelectorAll("span[data-pm-start][data-pm-end]");
260215
+ for (const span of Array.from(spans))
260216
+ if (span instanceof HTMLElement)
260217
+ pushUnique(span);
260218
+ };
260219
+ const lineEls = pageEl?.querySelectorAll(".superdoc-line[data-pm-start][data-pm-end]");
260220
+ let localLineEl = null;
260221
+ for (const lineEl of Array.from(lineEls ?? [])) {
260222
+ if (!(lineEl instanceof HTMLElement))
260223
+ continue;
260224
+ const lineStart = Number(lineEl.dataset.pmStart);
260225
+ const lineEnd = Number(lineEl.dataset.pmEnd);
260226
+ if (!Number.isFinite(lineStart) || !Number.isFinite(lineEnd))
260227
+ continue;
260228
+ if (effectivePos >= lineStart && effectivePos <= lineEnd) {
260229
+ localLineEl = lineEl;
260203
260230
  break;
260204
260231
  }
260205
260232
  }
260233
+ collectSpans(localLineEl);
260234
+ if (spanCandidates.length === 0) {
260235
+ const MAX_PM_DISTANCE = 8;
260236
+ const pageSpans = pageEl?.querySelectorAll("span[data-pm-start][data-pm-end]");
260237
+ for (const span of Array.from(pageSpans ?? [])) {
260238
+ if (!(span instanceof HTMLElement))
260239
+ continue;
260240
+ const pmStart = Number(span.dataset.pmStart);
260241
+ const pmEnd = Number(span.dataset.pmEnd);
260242
+ if (!Number.isFinite(pmStart) || !Number.isFinite(pmEnd))
260243
+ continue;
260244
+ if (effectivePos >= pmStart && effectivePos <= pmEnd) {
260245
+ pushUnique(span);
260246
+ continue;
260247
+ }
260248
+ if (Math.abs(pmStart - effectivePos) <= MAX_PM_DISTANCE || Math.abs(pmEnd - effectivePos) <= MAX_PM_DISTANCE)
260249
+ pushUnique(span);
260250
+ }
260251
+ }
260252
+ const domProbePositions = Array.from(new Set([
260253
+ originalPos,
260254
+ effectivePos,
260255
+ originalPos - 1,
260256
+ originalPos + 1
260257
+ ])).filter((candidate) => candidate >= 0);
260258
+ let resolved = false;
260259
+ for (const probePos of domProbePositions) {
260260
+ for (const spanEl of spanCandidates) {
260261
+ const pmStart = Number(spanEl.dataset.pmStart);
260262
+ const pmEnd = Number(spanEl.dataset.pmEnd);
260263
+ if (probePos >= pmStart && probePos <= pmEnd && spanEl.firstChild?.nodeType === Node.TEXT_NODE) {
260264
+ const textNode = spanEl.firstChild;
260265
+ const charIndex = Math.min(probePos - pmStart, textNode.length);
260266
+ const rangeObj = document.createRange();
260267
+ rangeObj.setStart(textNode, charIndex);
260268
+ rangeObj.setEnd(textNode, charIndex);
260269
+ if (typeof rangeObj.getBoundingClientRect !== "function")
260270
+ continue;
260271
+ const rangeRect = rangeObj.getBoundingClientRect();
260272
+ if (pageRect) {
260273
+ domCaretX = (rangeRect.left - pageRect.left) / zoom;
260274
+ domCaretY = (rangeRect.top - pageRect.top) / zoom;
260275
+ resolved = true;
260276
+ break;
260277
+ }
260278
+ }
260279
+ }
260280
+ if (resolved)
260281
+ break;
260282
+ }
260206
260283
  if (includeDomFallback && domCaretX != null && domCaretY != null)
260207
260284
  return {
260208
260285
  pageIndex: hit.pageIndex,
@@ -275761,7 +275838,148 @@ var Node$13 = class Node$14 {
275761
275838
  if (!allowedRanges?.length)
275762
275839
  return false;
275763
275840
  return allowedRanges.some((allowed) => range.from >= allowed.from && range.to <= allowed.to);
275764
- }, PermissionRanges, Protection, DOM_CLASS_NAMES, DATA_ATTRS, DATASET_KEYS, DRAGGABLE_SELECTOR, VerticalNavigationPluginKey, createDefaultState = () => ({ goalX: null }), VerticalNavigation, createPermissionBlockMarkerNode = ({ name, attributes }) => Node$13.create({
275841
+ }, PermissionRanges, Protection, DOM_CLASS_NAMES, DATA_ATTRS, DATASET_KEYS, DRAGGABLE_SELECTOR, VerticalNavigationPluginKey, createDefaultState = () => ({ goalX: null }), VerticalNavigation, STRONG_RTL_CHAR_RE$1, STRONG_LTR_CHAR_RE, isStrongRtl = (char) => STRONG_RTL_CHAR_RE$1.test(char), isStrongLtr = (char) => STRONG_LTR_CHAR_RE.test(char), hasMixedDirectionBoundary = (leftChar, rightChar) => isStrongRtl(leftChar) && isStrongLtr(rightChar) || isStrongLtr(leftChar) && isStrongRtl(rightChar), resolveCaretPoint = (doc$12, range) => {
275842
+ const rect = range.getBoundingClientRect();
275843
+ if (rect && Number.isFinite(rect.left) && Number.isFinite(rect.top)) {
275844
+ if (rect.width === 0 && rect.height === 0)
275845
+ return null;
275846
+ const midY = rect.height > 0 ? rect.top + rect.height / 2 : rect.top;
275847
+ return {
275848
+ x: rect.left,
275849
+ y: midY
275850
+ };
275851
+ }
275852
+ const node2 = range.startContainer?.nodeType === Node.TEXT_NODE ? range.startContainer.parentElement : range.startContainer;
275853
+ if (!node2 || !(node2 instanceof HTMLElement))
275854
+ return null;
275855
+ const fallbackRect = node2.getBoundingClientRect();
275856
+ if (!fallbackRect)
275857
+ return null;
275858
+ return {
275859
+ x: fallbackRect.left,
275860
+ y: fallbackRect.top + fallbackRect.height / 2
275861
+ };
275862
+ }, resolveLineElement = (doc$12, point5) => {
275863
+ return doc$12.elementsFromPoint(point5.x, point5.y).find((el) => el instanceof HTMLElement ? el.classList.contains("superdoc-line") : false);
275864
+ }, collectVisualChars = (lineEl, view, targetX = null) => {
275865
+ const doc$12 = lineEl.ownerDocument;
275866
+ const nodeFilter = doc$12.defaultView?.NodeFilter;
275867
+ if (!nodeFilter)
275868
+ return [];
275869
+ const chars = [];
275870
+ const walker = doc$12.createTreeWalker(lineEl, nodeFilter.SHOW_TEXT);
275871
+ const RANGE_WINDOW_PX = 96;
275872
+ const hasTargetX = Number.isFinite(targetX);
275873
+ let node2 = walker.nextNode();
275874
+ while (node2) {
275875
+ const textNode = node2;
275876
+ const text5 = textNode.textContent ?? "";
275877
+ for (let i4 = 0;i4 < text5.length; i4 += 1) {
275878
+ const char = text5[i4];
275879
+ if (!char || /\s/.test(char))
275880
+ continue;
275881
+ let pmStart;
275882
+ let pmEnd;
275883
+ try {
275884
+ pmStart = view.posAtDOM(textNode, i4);
275885
+ pmEnd = view.posAtDOM(textNode, i4 + 1);
275886
+ } catch {
275887
+ continue;
275888
+ }
275889
+ if (!Number.isFinite(pmStart) || !Number.isFinite(pmEnd) || pmEnd <= pmStart)
275890
+ continue;
275891
+ const range = doc$12.createRange();
275892
+ range.setStart(textNode, i4);
275893
+ range.setEnd(textNode, i4 + 1);
275894
+ const rect = range.getBoundingClientRect();
275895
+ if (rect.width <= 0 || rect.height <= 0)
275896
+ continue;
275897
+ if (hasTargetX && rect.right < targetX - RANGE_WINDOW_PX)
275898
+ continue;
275899
+ if (hasTargetX && rect.left > targetX + RANGE_WINDOW_PX)
275900
+ continue;
275901
+ chars.push({
275902
+ char,
275903
+ pmStart,
275904
+ pmEnd,
275905
+ centerX: rect.left + rect.width / 2,
275906
+ centerY: rect.top + rect.height / 2
275907
+ });
275908
+ }
275909
+ node2 = walker.nextNode();
275910
+ }
275911
+ return chars;
275912
+ }, resolveBoundaryChars = (chars, caretPoint) => {
275913
+ if (chars.length === 0)
275914
+ return null;
275915
+ const sameBand = chars.filter((c) => Math.abs(c.centerY - caretPoint.y) <= 8);
275916
+ const band = sameBand.length > 0 ? sameBand : chars;
275917
+ band.sort((a2, b$1) => a2.centerX - b$1.centerX);
275918
+ let left$1 = null;
275919
+ let right$1 = null;
275920
+ for (const c of band) {
275921
+ if (c.centerX < caretPoint.x) {
275922
+ left$1 = c;
275923
+ continue;
275924
+ }
275925
+ right$1 = c;
275926
+ break;
275927
+ }
275928
+ if (!left$1 || !right$1)
275929
+ return null;
275930
+ return {
275931
+ left: left$1,
275932
+ right: right$1
275933
+ };
275934
+ }, resolveMixedBidiBackspaceRange = ({ state, view }) => {
275935
+ const { selection } = state;
275936
+ if (!selection?.empty)
275937
+ return null;
275938
+ const doc$12 = view?.dom?.ownerDocument;
275939
+ const nativeSelection = doc$12?.getSelection?.();
275940
+ if (!nativeSelection || nativeSelection.rangeCount === 0)
275941
+ return null;
275942
+ const range = nativeSelection.getRangeAt(0);
275943
+ if (!range.collapsed)
275944
+ return null;
275945
+ const caretPoint = resolveCaretPoint(doc$12, range);
275946
+ if (!caretPoint)
275947
+ return null;
275948
+ const lineEl = resolveLineElement(doc$12, caretPoint);
275949
+ if (!lineEl)
275950
+ return null;
275951
+ const lineText = lineEl.textContent ?? "";
275952
+ const hasRtl = STRONG_RTL_CHAR_RE$1.test(lineText);
275953
+ const hasLtr = STRONG_LTR_CHAR_RE.test(lineText);
275954
+ if (!hasRtl || !hasLtr)
275955
+ return null;
275956
+ let chars = collectVisualChars(lineEl, view, caretPoint.x);
275957
+ if (chars.length < 2)
275958
+ chars = collectVisualChars(lineEl, view, null);
275959
+ const boundary = resolveBoundaryChars(chars, caretPoint);
275960
+ if (!boundary)
275961
+ return null;
275962
+ if (!hasMixedDirectionBoundary(boundary.left.char, boundary.right.char))
275963
+ return null;
275964
+ if (selection.from !== boundary.right.pmStart && selection.from !== boundary.left.pmEnd)
275965
+ return null;
275966
+ return {
275967
+ from: boundary.left.pmStart,
275968
+ to: boundary.left.pmEnd
275969
+ };
275970
+ }, mixedBidiBackspace = () => ({ state, view, tr, dispatch }) => {
275971
+ const range = resolveMixedBidiBackspaceRange({
275972
+ state,
275973
+ view
275974
+ });
275975
+ if (!range)
275976
+ return false;
275977
+ if (dispatch) {
275978
+ tr.delete(range.from, range.to);
275979
+ tr.scrollIntoView();
275980
+ }
275981
+ return true;
275982
+ }, MixedBidiBackspace, createPermissionBlockMarkerNode = ({ name, attributes }) => Node$13.create({
275765
275983
  name,
275766
275984
  group: "block",
275767
275985
  inline: false,
@@ -275957,6 +276175,7 @@ var Node$13 = class Node$14 {
275957
276175
  Image,
275958
276176
  NodeResizer,
275959
276177
  CustomSelection,
276178
+ MixedBidiBackspace,
275960
276179
  MathInline,
275961
276180
  MathBlock,
275962
276181
  PassthroughInline,
@@ -276056,6 +276275,7 @@ var Node$13 = class Node$14 {
276056
276275
  PermissionRanges,
276057
276276
  Protection,
276058
276277
  VerticalNavigation,
276278
+ MixedBidiBackspace,
276059
276279
  MathInline,
276060
276280
  MathBlock,
276061
276281
  PassthroughInline,
@@ -277582,6 +277802,7 @@ var Node$13 = class Node$14 {
277582
277802
  () => commands$1.backspaceAtomBefore(),
277583
277803
  () => commands$1.backspaceNextToRun(),
277584
277804
  () => commands$1.backspaceAcrossRuns(),
277805
+ () => commands$1.mixedBidiBackspace?.() ?? false,
277585
277806
  () => commands$1.deleteSelection(),
277586
277807
  () => commands$1.removeNumberingProperties(),
277587
277808
  () => commands$1.joinBackward(),
@@ -278254,7 +278475,7 @@ var Node$13 = class Node$14 {
278254
278475
  domAvailabilityCache = false;
278255
278476
  return false;
278256
278477
  }
278257
- }, summaryVersion = "1.33.0", nodeKeys, markKeys, transformListsInCopiedContent = (html3) => {
278478
+ }, summaryVersion = "1.33.1", nodeKeys, markKeys, transformListsInCopiedContent = (html3) => {
278258
278479
  const container = document.createElement("div");
278259
278480
  container.innerHTML = html3;
278260
278481
  const result = [];
@@ -279429,7 +279650,7 @@ var Node$13 = class Node$14 {
279429
279650
  return () => {};
279430
279651
  const handle3 = setInterval(callback, intervalMs);
279431
279652
  return () => clearInterval(handle3);
279432
- }, HISTORY_UNSAFE_OPS, CANONICAL_COMMENT_IGNORED_KEYS, INITIAL_HASH, ROUND_CONSTANTS, V1_COVERAGE, V2_COVERAGE, SNAPSHOT_VERSION_V2 = "sd-diff-snapshot/v2", PAYLOAD_VERSION_V1 = "sd-diff-payload/v1", PAYLOAD_VERSION_V2 = "sd-diff-payload/v2", ENGINE_ID = "super-editor", STAGED_CONVERTER_KEYS, DiffServiceError, DEFAULT_LEVEL = 1, SWITCH_PATTERN, TOC_BOOKMARK_PREFIX = "_Toc", ALLOWED_SOURCE_MARK_TYPES, TEXT_STYLE_ALLOWED_ATTRS, DEFAULT_RIGHT_TAB_POS = 9350, TAB_LEADER_MAP, NO_ENTRIES_PLACEHOLDER, TOC_ENTRY_STYLE_RE, TC_LEVEL_MIN = 1, TC_LEVEL_MAX = 9, ALLOWED_WRAP_ATTRS, WRAP_TYPES_SUPPORTING_SIDE, WRAP_TYPES_SUPPORTING_DISTANCES, RELATIVE_HEIGHT_MIN = 0, RELATIVE_HEIGHT_MAX = 4294967295, FORBIDDEN_RAW_PATCH_NAMES, CONTROL_TYPE_SDT_PR_ELEMENTS, DEFAULT_CHECKBOX_SYMBOL_FONT2 = "MS Gothic", DEFAULT_CHECKBOX_CHECKED_HEX2 = "2612", DEFAULT_CHECKBOX_UNCHECKED_HEX2 = "2610", VARIANT_ORDER, KIND_ORDER, HEADER_RELATIONSHIP_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", DOCUMENT_RELS_PATH2 = "word/_rels/document.xml.rels", HEADER_FILE_PATTERN2, FOOTER_FILE_PATTERN2, SPECIAL_NOTE_TYPES, BOOKMARK_SCAN_REVISION_PREFIX = "bookmark-scan:", import_lib4, CUSTOM_XML_DATA_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", CUSTOM_XML_PROPS_RELATIONSHIP_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps", CUSTOM_XML_DATASTORE_NAMESPACE = "http://schemas.openxmlformats.org/officeDocument/2006/customXml", SETTINGS_PART, RESTART_POLICY_TO_OOXML, VALID_DISPLAYS, REFERENCE_BLOCK_PREFIX, CAPTION_STYLE_NAMES, CAPTION_PARAGRAPH_STYLE_ID = "Caption", CAPTION_FORMAT_TO_OOXML, DOCUMENT_STAT_FIELD_TYPES, TOA_LEADER_REVERSE_MAP, EDGE_NODE_TYPES, CONTENT_TYPES_PART_ID = "[Content_Types].xml", CONTENT_TYPES_NS = "http://schemas.openxmlformats.org/package/2006/content-types", contentTypesPartDescriptor, empty_exports, init_empty, CURRENT_APP_VERSION2 = "1.33.0", PIXELS_PER_INCH2 = 96, MAX_HEIGHT_BUFFER_PX = 50, MAX_WIDTH_BUFFER_PX = 20, cloneExtensionInstance = (extension2) => {
279653
+ }, HISTORY_UNSAFE_OPS, CANONICAL_COMMENT_IGNORED_KEYS, INITIAL_HASH, ROUND_CONSTANTS, V1_COVERAGE, V2_COVERAGE, SNAPSHOT_VERSION_V2 = "sd-diff-snapshot/v2", PAYLOAD_VERSION_V1 = "sd-diff-payload/v1", PAYLOAD_VERSION_V2 = "sd-diff-payload/v2", ENGINE_ID = "super-editor", STAGED_CONVERTER_KEYS, DiffServiceError, DEFAULT_LEVEL = 1, SWITCH_PATTERN, TOC_BOOKMARK_PREFIX = "_Toc", ALLOWED_SOURCE_MARK_TYPES, TEXT_STYLE_ALLOWED_ATTRS, DEFAULT_RIGHT_TAB_POS = 9350, TAB_LEADER_MAP, NO_ENTRIES_PLACEHOLDER, TOC_ENTRY_STYLE_RE, TC_LEVEL_MIN = 1, TC_LEVEL_MAX = 9, ALLOWED_WRAP_ATTRS, WRAP_TYPES_SUPPORTING_SIDE, WRAP_TYPES_SUPPORTING_DISTANCES, RELATIVE_HEIGHT_MIN = 0, RELATIVE_HEIGHT_MAX = 4294967295, FORBIDDEN_RAW_PATCH_NAMES, CONTROL_TYPE_SDT_PR_ELEMENTS, DEFAULT_CHECKBOX_SYMBOL_FONT2 = "MS Gothic", DEFAULT_CHECKBOX_CHECKED_HEX2 = "2612", DEFAULT_CHECKBOX_UNCHECKED_HEX2 = "2610", VARIANT_ORDER, KIND_ORDER, HEADER_RELATIONSHIP_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", DOCUMENT_RELS_PATH2 = "word/_rels/document.xml.rels", HEADER_FILE_PATTERN2, FOOTER_FILE_PATTERN2, SPECIAL_NOTE_TYPES, BOOKMARK_SCAN_REVISION_PREFIX = "bookmark-scan:", import_lib4, CUSTOM_XML_DATA_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", CUSTOM_XML_PROPS_RELATIONSHIP_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps", CUSTOM_XML_DATASTORE_NAMESPACE = "http://schemas.openxmlformats.org/officeDocument/2006/customXml", SETTINGS_PART, RESTART_POLICY_TO_OOXML, VALID_DISPLAYS, REFERENCE_BLOCK_PREFIX, CAPTION_STYLE_NAMES, CAPTION_PARAGRAPH_STYLE_ID = "Caption", CAPTION_FORMAT_TO_OOXML, DOCUMENT_STAT_FIELD_TYPES, TOA_LEADER_REVERSE_MAP, EDGE_NODE_TYPES, CONTENT_TYPES_PART_ID = "[Content_Types].xml", CONTENT_TYPES_NS = "http://schemas.openxmlformats.org/package/2006/content-types", contentTypesPartDescriptor, empty_exports, init_empty, CURRENT_APP_VERSION2 = "1.33.1", PIXELS_PER_INCH2 = 96, MAX_HEIGHT_BUFFER_PX = 50, MAX_WIDTH_BUFFER_PX = 20, cloneExtensionInstance = (extension2) => {
279433
279654
  const extensionLike = extension2;
279434
279655
  const config3 = extensionLike?.config;
279435
279656
  const ExtensionCtor = extensionLike?.constructor;
@@ -283050,7 +283271,27 @@ menclose::after {
283050
283271
  }
283051
283272
  element3.style.textAlign = resolveTextAlign(attrs?.alignment, rtl);
283052
283273
  return rtl;
283053
- }, shouldUseSegmentPositioning = (hasExplicitPositioning, hasSegments, isRtl) => hasExplicitPositioning && hasSegments && !isRtl, MATHML_NS$19 = "http://www.w3.org/1998/Math/MathML", OPERATOR_CHARS, STY_TO_VARIANT, SCR_TO_VARIANT, convertMathRun = (node2, doc$12) => {
283274
+ }, shouldUseSegmentPositioning = (hasExplicitPositioning, hasSegments, isRtl) => hasExplicitPositioning && hasSegments && !isRtl, RTL_DATE_LIKE_TOKEN_RE, STRONG_RTL_CHAR_RE, LATIN_DIGIT_NEUTRAL_ONLY_RE, RLM = "‏", normalizeRtlDateTokenForWordParity = (text5) => {
283275
+ if (!RTL_DATE_LIKE_TOKEN_RE.test(text5))
283276
+ return text5;
283277
+ return text5.replace(/[./-]/g, (separator) => `${RLM}${separator}${RLM}`);
283278
+ }, resolveRunDirectionAttribute = (opts) => {
283279
+ if (opts.isRtlTagged) {
283280
+ const sample = (opts.runText ?? opts.effectiveText).trim();
283281
+ if (!sample)
283282
+ return "rtl";
283283
+ if (RTL_DATE_LIKE_TOKEN_RE.test(sample))
283284
+ return "rtl";
283285
+ if (STRONG_RTL_CHAR_RE.test(sample))
283286
+ return "rtl";
283287
+ if (LATIN_DIGIT_NEUTRAL_ONLY_RE.test(sample))
283288
+ return null;
283289
+ return "rtl";
283290
+ }
283291
+ if (typeof opts.runText === "string" && RTL_DATE_LIKE_TOKEN_RE.test(opts.runText))
283292
+ return "ltr";
283293
+ return null;
283294
+ }, MATHML_NS$19 = "http://www.w3.org/1998/Math/MathML", OPERATOR_CHARS, STY_TO_VARIANT, SCR_TO_VARIANT, convertMathRun = (node2, doc$12) => {
283054
283295
  const text5 = extractText(node2);
283055
283296
  if (!text5)
283056
283297
  return null;
@@ -283840,10 +284081,6 @@ menclose::after {
283840
284081
  if (runToken === "totalPageCount")
283841
284082
  return context.totalPages ? String(context.totalPages) : run2.text ?? "";
283842
284083
  return run2.text ?? "";
283843
- }, RTL_DATE_LIKE_TOKEN_RE, RLM = "‏", normalizeRtlDateTokenForWordParity = (text5) => {
283844
- if (!RTL_DATE_LIKE_TOKEN_RE.test(text5))
283845
- return text5;
283846
- return text5.replace(/[./-]/g, (separator) => `${RLM}${separator}${RLM}`);
283847
284084
  }, createDomPainter = (options) => {
283848
284085
  const painter = new DomPainter(options);
283849
284086
  return {
@@ -292662,7 +292899,13 @@ menclose::after {
292662
292899
  #isCompositionKeyboardEvent(event) {
292663
292900
  return event.isComposing || event.keyCode === 229 || event.key === "Dead" || event.key === "Compose";
292664
292901
  }
292665
- }, isObject3 = (value) => typeof value === "object" && value !== null, INTERNAL_OBJECT_MIME_TYPE = "application/x-superdoc-internal-object", INTERNAL_MIME_TYPE = "application/x-field-annotation", FIELD_ANNOTATION_DATA_TYPE = "fieldAnnotation", IMAGE_EXTENSIONS, DragDropManager = class {
292902
+ }, isObject3 = (value) => typeof value === "object" && value !== null, shouldUseNativeCaretFallback = (selection, pos) => {
292903
+ if (!selection)
292904
+ return false;
292905
+ if (!selection.empty)
292906
+ return false;
292907
+ return selection.head === pos;
292908
+ }, INTERNAL_OBJECT_MIME_TYPE = "application/x-superdoc-internal-object", INTERNAL_MIME_TYPE = "application/x-field-annotation", FIELD_ANNOTATION_DATA_TYPE = "fieldAnnotation", IMAGE_EXTENSIONS, DragDropManager = class {
292666
292909
  #deps = null;
292667
292910
  #dragOverRaf = null;
292668
292911
  #pendingDragOver = null;
@@ -295202,13 +295445,13 @@ menclose::after {
295202
295445
  return;
295203
295446
  console.log(...args$1);
295204
295447
  }, 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;
295205
- var init_src_BDnlS_6f_es = __esm(() => {
295448
+ var init_src_DTrWuNvy_es = __esm(() => {
295206
295449
  init_rolldown_runtime_Bg48TavK_es();
295207
- init_SuperConverter_CMMmelrE_es();
295450
+ init_SuperConverter_CnwfJPj6_es();
295208
295451
  init_jszip_C49i9kUs_es();
295209
295452
  init_xml_js_CqGKpaft_es();
295210
295453
  init_uuid_qzgm05fK_es();
295211
- init_create_headless_toolbar_BE8Nb0oO_es();
295454
+ init_create_headless_toolbar_Btizo_Im_es();
295212
295455
  init_constants_DrU4EASo_es();
295213
295456
  init_dist_B8HfvhaK_es();
295214
295457
  init_unified_Dsuw2be5_es();
@@ -313768,6 +314011,14 @@ function print() { __p += __j.call(arguments, '') }
313768
314011
  })];
313769
314012
  }
313770
314013
  });
314014
+ STRONG_RTL_CHAR_RE$1 = /[\u0590-\u08FF]/;
314015
+ STRONG_LTR_CHAR_RE = /[A-Za-z\u00C0-\u024F]/;
314016
+ MixedBidiBackspace = Extension.create({
314017
+ name: "mixedBidiBackspace",
314018
+ addCommands() {
314019
+ return { mixedBidiBackspace };
314020
+ }
314021
+ });
313771
314022
  PermStart = Node$13.create({
313772
314023
  name: "permStart",
313773
314024
  group: "inline",
@@ -321872,6 +322123,9 @@ function print() { __p += __j.call(arguments, '') }
321872
322123
  "wave",
321873
322124
  "doubleWave"
321874
322125
  ]);
322126
+ RTL_DATE_LIKE_TOKEN_RE = /^-?\d+(?:[./-]\d+)+$/;
322127
+ STRONG_RTL_CHAR_RE = /[\u0590-\u08FF]/;
322128
+ LATIN_DIGIT_NEUTRAL_ONLY_RE = /^[\s0-9A-Za-z./\-_:,+()]+$/;
321875
322129
  OPERATOR_CHARS = new Set([
321876
322130
  "+",
321877
322131
  "-",
@@ -324890,10 +325144,13 @@ function print() { __p += __j.call(arguments, '') }
324890
325144
  this.pendingTooltips.set(elem, linkData.tooltip);
324891
325145
  }
324892
325146
  applyRunStyles(elem, run2, isActiveLink);
324893
- if (textRun.bidi?.rtl === true)
324894
- elem.setAttribute("dir", "rtl");
324895
- else if (typeof textRun.text === "string" && RTL_DATE_LIKE_TOKEN_RE.test(textRun.text))
324896
- elem.setAttribute("dir", "ltr");
325147
+ const dirAttr = resolveRunDirectionAttribute({
325148
+ runText: textRun.text,
325149
+ effectiveText,
325150
+ isRtlTagged: textRun.bidi?.rtl === true
325151
+ });
325152
+ if (dirAttr)
325153
+ elem.setAttribute("dir", dirAttr);
324897
325154
  const commentAnnotations = textRun.comments;
324898
325155
  if (!!commentAnnotations?.length) {
324899
325156
  elem.dataset.commentIds = commentAnnotations.map((c) => c.commentId).join(",");
@@ -326009,7 +326266,6 @@ function print() { __p += __j.call(arguments, '') }
326009
326266
  "path(",
326010
326267
  "rect("
326011
326268
  ];
326012
- RTL_DATE_LIKE_TOKEN_RE = /^-?\d+(?:[./-]\d+)+$/;
326013
326269
  CLIP_PATH_PREFIXES = [
326014
326270
  "inset(",
326015
326271
  "polygon(",
@@ -332935,7 +333191,8 @@ function print() { __p += __j.call(arguments, '') }
332935
333191
  }, pos, includeDomFallback);
332936
333192
  }
332937
333193
  #computeCaretLayoutRect(pos) {
332938
- const geometry = this.#computeCaretLayoutRectGeometry(pos, true);
333194
+ const useNativeFallback = shouldUseNativeCaretFallback(this.editor?.state?.selection, pos);
333195
+ const geometry = this.#computeCaretLayoutRectGeometry(pos, useNativeFallback);
332939
333196
  let dom = null;
332940
333197
  try {
332941
333198
  dom = this.#computeDomCaretPageLocal(pos);
@@ -333361,11 +333618,11 @@ function print() { __p += __j.call(arguments, '') }
333361
333618
  ];
333362
333619
  });
333363
333620
 
333364
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-63j-4MGz.es.js
333621
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-CkaOaJa5.es.js
333365
333622
  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;
333366
- var init_create_super_doc_ui_63j_4MGz_es = __esm(() => {
333367
- init_SuperConverter_CMMmelrE_es();
333368
- init_create_headless_toolbar_BE8Nb0oO_es();
333623
+ var init_create_super_doc_ui_CkaOaJa5_es = __esm(() => {
333624
+ init_SuperConverter_CnwfJPj6_es();
333625
+ init_create_headless_toolbar_Btizo_Im_es();
333369
333626
  MOD_ALIASES = new Set([
333370
333627
  "Mod",
333371
333628
  "Meta",
@@ -333407,16 +333664,16 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
333407
333664
 
333408
333665
  // ../../packages/superdoc/dist/super-editor.es.js
333409
333666
  var init_super_editor_es = __esm(() => {
333410
- init_src_BDnlS_6f_es();
333411
- init_SuperConverter_CMMmelrE_es();
333667
+ init_src_DTrWuNvy_es();
333668
+ init_SuperConverter_CnwfJPj6_es();
333412
333669
  init_jszip_C49i9kUs_es();
333413
333670
  init_xml_js_CqGKpaft_es();
333414
- init_create_headless_toolbar_BE8Nb0oO_es();
333671
+ init_create_headless_toolbar_Btizo_Im_es();
333415
333672
  init_constants_DrU4EASo_es();
333416
333673
  init_dist_B8HfvhaK_es();
333417
333674
  init_unified_Dsuw2be5_es();
333418
333675
  init_DocxZipper_Bphhij1P_es();
333419
- init_create_super_doc_ui_63j_4MGz_es();
333676
+ init_create_super_doc_ui_CkaOaJa5_es();
333420
333677
  init_ui_CGB3qmy3_es();
333421
333678
  init_eventemitter3_UwU_CLPU_es();
333422
333679
  init_errors_C_DoKMoN_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/mcp",
3
- "version": "0.5.1",
3
+ "version": "0.6.0-next.2",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=20"
@@ -20,8 +20,8 @@
20
20
  "@types/node": "22.19.2",
21
21
  "typescript": "^5.9.2",
22
22
  "@superdoc/document-api": "0.0.1",
23
- "superdoc": "1.33.0",
24
- "@superdoc/super-editor": "0.0.1"
23
+ "@superdoc/super-editor": "0.0.1",
24
+ "superdoc": "1.33.1"
25
25
  },
26
26
  "publishConfig": {
27
27
  "access": "public"