@superdoc-dev/mcp 0.8.0-next.5 → 0.8.0-next.6

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 +210 -34
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -51891,7 +51891,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
51891
51891
  emptyOptions2 = {};
51892
51892
  });
51893
51893
 
51894
- // ../../packages/superdoc/dist/chunks/SuperConverter-yBMSqEiB.es.js
51894
+ // ../../packages/superdoc/dist/chunks/SuperConverter-k7GHkV-c.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")
@@ -80560,6 +80560,33 @@ function _getReferencedTableStyles(tableStyleReference, params) {
80560
80560
  ...styleProps
80561
80561
  };
80562
80562
  }
80563
+ function buildFieldResultRuns(params, outputMarks) {
80564
+ const { node: node2 } = params;
80565
+ const contentNodes = (node2.content ?? []).flatMap((child) => exportSchemaToJson({
80566
+ ...params,
80567
+ node: child
80568
+ }));
80569
+ if (contentNodes.length > 0)
80570
+ return contentNodes;
80571
+ const resolvedText = node2.attrs?.resolvedText;
80572
+ if (typeof resolvedText !== "string" || resolvedText.length === 0)
80573
+ return [];
80574
+ const textAttributes = /^\s|\s$/.test(resolvedText) ? { "xml:space": "preserve" } : undefined;
80575
+ return [{
80576
+ name: "w:r",
80577
+ elements: [{
80578
+ name: "w:rPr",
80579
+ elements: outputMarks
80580
+ }, {
80581
+ name: "w:t",
80582
+ attributes: textAttributes,
80583
+ elements: [{
80584
+ text: resolvedText,
80585
+ type: "text"
80586
+ }]
80587
+ }]
80588
+ }];
80589
+ }
80563
80590
  function parseTarget(instruction) {
80564
80591
  if (!instruction)
80565
80592
  return "";
@@ -80613,7 +80640,19 @@ function parseCitationSourceIds(instruction) {
80613
80640
  function extractResolvedText$1(content$2) {
80614
80641
  if (!Array.isArray(content$2))
80615
80642
  return "";
80616
- return content$2.filter((n) => n.type === "text").map((n) => n.text || "").join("");
80643
+ let out = "";
80644
+ const walk = (nodes) => {
80645
+ for (const node2 of nodes) {
80646
+ if (!node2)
80647
+ continue;
80648
+ if (node2.type === "text")
80649
+ out += node2.text || "";
80650
+ else if (Array.isArray(node2.content))
80651
+ walk(node2.content);
80652
+ }
80653
+ };
80654
+ walk(content$2);
80655
+ return out;
80617
80656
  }
80618
80657
  function parseTaInstruction(instruction) {
80619
80658
  let longCitation = "";
@@ -102766,10 +102805,7 @@ var isRegExp = (value) => {
102766
102805
  }, decode$20 = (params) => {
102767
102806
  const { node: node2 } = params;
102768
102807
  const outputMarks = processOutputMarks(node2.attrs?.marksAsAttrs || []);
102769
- const contentNodes = (node2.content ?? []).flatMap((n) => exportSchemaToJson({
102770
- ...params,
102771
- node: n
102772
- }));
102808
+ const contentNodes = buildFieldResultRuns(params, outputMarks);
102773
102809
  const instructionElements = buildInstructionElements(node2.attrs?.instruction, node2.attrs?.instructionTokens);
102774
102810
  return [
102775
102811
  {
@@ -102834,10 +102870,7 @@ var isRegExp = (value) => {
102834
102870
  }, decode$19 = (params) => {
102835
102871
  const { node: node2 } = params;
102836
102872
  const outputMarks = processOutputMarks(node2.attrs?.marksAsAttrs || []);
102837
- const contentNodes = (node2.content ?? []).flatMap((n) => exportSchemaToJson({
102838
- ...params,
102839
- node: n
102840
- }));
102873
+ const contentNodes = buildFieldResultRuns(params, outputMarks);
102841
102874
  const instructionElements = buildInstructionElements(node2.attrs?.instruction, node2.attrs?.instructionTokens);
102842
102875
  return [
102843
102876
  {
@@ -105977,7 +106010,7 @@ var isRegExp = (value) => {
105977
106010
  state.kern = kernNode.attributes["w:val"];
105978
106011
  }
105979
106012
  }, SuperConverter;
105980
- var init_SuperConverter_yBMSqEiB_es = __esm(() => {
106013
+ var init_SuperConverter_k7GHkV_c_es = __esm(() => {
105981
106014
  init_rolldown_runtime_Bg48TavK_es();
105982
106015
  init_jszip_C49i9kUs_es();
105983
106016
  init_xml_js_CqGKpaft_es();
@@ -144157,7 +144190,7 @@ var init_SuperConverter_yBMSqEiB_es = __esm(() => {
144157
144190
  };
144158
144191
  });
144159
144192
 
144160
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-DOHBUV3P.es.js
144193
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-dycevpY9.es.js
144161
144194
  function parseSizeUnit(val = "0") {
144162
144195
  const length = val.toString() || "0";
144163
144196
  const value = Number.parseFloat(length);
@@ -154182,8 +154215,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
154182
154215
  }
154183
154216
  };
154184
154217
  };
154185
- var init_create_headless_toolbar_DOHBUV3P_es = __esm(() => {
154186
- init_SuperConverter_yBMSqEiB_es();
154218
+ var init_create_headless_toolbar_dycevpY9_es = __esm(() => {
154219
+ init_SuperConverter_k7GHkV_c_es();
154187
154220
  init_uuid_qzgm05fK_es();
154188
154221
  init_constants_DrU4EASo_es();
154189
154222
  init_dist_B8HfvhaK_es();
@@ -208909,7 +208942,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
208909
208942
  init_remark_gfm_BhnWr3yf_es();
208910
208943
  });
208911
208944
 
208912
- // ../../packages/superdoc/dist/chunks/src-Cccxf1lk.es.js
208945
+ // ../../packages/superdoc/dist/chunks/src-AnmYYbEU.es.js
208913
208946
  function deleteProps(obj, propOrProps) {
208914
208947
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
208915
208948
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -210796,6 +210829,86 @@ function backfillCapability(metaMap, ydoc) {
210796
210829
  function createReplacer(data) {
210797
210830
  return ({ part }) => replacePartData(part, data);
210798
210831
  }
210832
+ function normalizeYjsFragmentForSchema(fragment) {
210833
+ if (!isTraversableYjsXml(fragment))
210834
+ return false;
210835
+ let changed = false;
210836
+ const normalize4 = () => {
210837
+ changed = stripSchemaAtomChildren(fragment) || changed;
210838
+ };
210839
+ if (fragment.doc)
210840
+ fragment.doc.transact(normalize4, NORMALIZE_YJS_FRAGMENT_ORIGIN);
210841
+ else
210842
+ normalize4();
210843
+ return changed;
210844
+ }
210845
+ function normalizeYjsFragmentEventsForSchema(events, fallbackFragment) {
210846
+ if (!Array.isArray(events) || events.length === 0)
210847
+ return normalizeYjsFragmentForSchema(fallbackFragment);
210848
+ if (events.some((event) => event?.transaction?.origin === NORMALIZE_YJS_FRAGMENT_ORIGIN))
210849
+ return false;
210850
+ let changed = false;
210851
+ const normalize4 = () => {
210852
+ const visited = /* @__PURE__ */ new Set;
210853
+ for (const event of events) {
210854
+ const target = findNormalizableEventTarget(event?.target);
210855
+ if (!isTraversableYjsXml(target) || visited.has(target))
210856
+ continue;
210857
+ visited.add(target);
210858
+ changed = stripSchemaAtomChildren(target) || changed;
210859
+ }
210860
+ };
210861
+ const doc$12 = fallbackFragment?.doc || findEventDoc(events);
210862
+ if (doc$12)
210863
+ doc$12.transact(normalize4, NORMALIZE_YJS_FRAGMENT_ORIGIN);
210864
+ else
210865
+ normalize4();
210866
+ return changed;
210867
+ }
210868
+ function stripSchemaAtomChildren(parent) {
210869
+ if (!isTraversableYjsXml(parent))
210870
+ return false;
210871
+ if (parent instanceof YXmlElement && SCHEMA_ATOM_NODE_NAMES.has(parent.nodeName)) {
210872
+ if (parent.length === 0)
210873
+ return false;
210874
+ parent.delete(0, parent.length);
210875
+ return true;
210876
+ }
210877
+ let changed = false;
210878
+ for (const child of parent.toArray()) {
210879
+ if (!(child instanceof YXmlElement))
210880
+ continue;
210881
+ if (SCHEMA_ATOM_NODE_NAMES.has(child.nodeName)) {
210882
+ if (child.length > 0) {
210883
+ child.delete(0, child.length);
210884
+ changed = true;
210885
+ }
210886
+ continue;
210887
+ }
210888
+ changed = stripSchemaAtomChildren(child) || changed;
210889
+ }
210890
+ return changed;
210891
+ }
210892
+ function findNormalizableEventTarget(target) {
210893
+ let current = target;
210894
+ while (current) {
210895
+ if (current instanceof YXmlElement && SCHEMA_ATOM_NODE_NAMES.has(current.nodeName))
210896
+ return current;
210897
+ current = current.parent;
210898
+ }
210899
+ return target;
210900
+ }
210901
+ function findEventDoc(events) {
210902
+ for (const event of events) {
210903
+ const doc$12 = event?.target?.doc;
210904
+ if (doc$12)
210905
+ return doc$12;
210906
+ }
210907
+ return null;
210908
+ }
210909
+ function isTraversableYjsXml(value) {
210910
+ return Boolean(value && typeof value.toArray === "function");
210911
+ }
210799
210912
  function getEditorSurfaceElement(editor) {
210800
210913
  if (!editor)
210801
210914
  return null;
@@ -268725,7 +268838,7 @@ var Node$13 = class Node$14 {
268725
268838
  let $pos = doc$12.resolve(this.pos);
268726
268839
  return GapCursor.valid($pos) ? new GapCursor($pos) : Selection.near($pos);
268727
268840
  }
268728
- }, handleKeyDown2, Gapcursor, PARTS_MAP_KEY = "parts", META_MAP_KEY = "meta", META_PARTS_SCHEMA_VERSION_KEY = "partsSchemaVersion", META_PARTS_MIGRATION_KEY = "partsMigration", META_PARTS_LAST_HYDRATED_AT_KEY = "partsLastHydratedAt", META_PARTS_FALLBACK_MODE_KEY = "partsFallbackMode", META_PARTS_CAPABILITY_KEY = "partsCapability", SOURCE_COLLAB_REMOTE_PARTS = "collab:remote:parts", SOURCE_COLLAB_REMOTE_PREFIX = "collab:remote:", EXCLUDED_PART_IDS, CRITICAL_PART_IDS, isApplyingRemoteParts = false, headlessBindingStateByEditor, headlessCleanupRegisteredEditors, META_BODY_SECT_PR_KEY = "bodySectPr", BODY_SECT_PR_SYNC_META_KEY = "bodySectPrSync", collaborationCleanupByEditor, registerHeadlessBindingCleanup = (editor, cleanup) => {
268841
+ }, handleKeyDown2, Gapcursor, PARTS_MAP_KEY = "parts", META_MAP_KEY = "meta", META_PARTS_SCHEMA_VERSION_KEY = "partsSchemaVersion", META_PARTS_MIGRATION_KEY = "partsMigration", META_PARTS_LAST_HYDRATED_AT_KEY = "partsLastHydratedAt", META_PARTS_FALLBACK_MODE_KEY = "partsFallbackMode", META_PARTS_CAPABILITY_KEY = "partsCapability", SOURCE_COLLAB_REMOTE_PARTS = "collab:remote:parts", SOURCE_COLLAB_REMOTE_PREFIX = "collab:remote:", EXCLUDED_PART_IDS, CRITICAL_PART_IDS, isApplyingRemoteParts = false, SCHEMA_ATOM_NODE_NAMES, NORMALIZE_YJS_FRAGMENT_ORIGIN, headlessBindingStateByEditor, headlessCleanupRegisteredEditors, META_BODY_SECT_PR_KEY = "bodySectPr", BODY_SECT_PR_SYNC_META_KEY = "bodySectPrSync", collaborationCleanupByEditor, registerHeadlessBindingCleanup = (editor, cleanup) => {
268729
268842
  if (!cleanup || headlessCleanupRegisteredEditors.has(editor))
268730
268843
  return;
268731
268844
  headlessCleanupRegisteredEditors.add(editor);
@@ -268809,6 +268922,7 @@ var Node$13 = class Node$14 {
268809
268922
  if (!cleanup)
268810
268923
  return;
268811
268924
  cleanup.syncListenerCleanup?.();
268925
+ cleanup.fragmentNormalizeCleanup?.();
268812
268926
  cleanup.mediaMap?.unobserve?.(cleanup.mediaMapObserver);
268813
268927
  cleanup.metaMap?.unobserve?.(cleanup.metaMapObserver);
268814
268928
  cleanup.partSyncHandle?.destroy();
@@ -268819,12 +268933,23 @@ var Node$13 = class Node$14 {
268819
268933
  collaborationCleanupByEditor.delete(editor);
268820
268934
  }, createSyncPlugin = (ydoc, editor) => {
268821
268935
  const fragment = ydoc.getXmlFragment("supereditor");
268936
+ normalizeYjsFragmentForSchema(fragment);
268822
268937
  const onFirstRender = () => {
268823
268938
  if (!editor.options.isNewFile)
268824
268939
  return;
268825
268940
  initializeMetaMap(ydoc, editor);
268826
268941
  };
268827
268942
  return [ySyncPlugin(fragment, { onFirstRender }), fragment];
268943
+ }, registerYjsFragmentNormalizer = (fragment) => {
268944
+ if (!fragment || typeof fragment.observeDeep !== "function" || typeof fragment.unobserveDeep !== "function")
268945
+ return () => {};
268946
+ const normalize4 = (events) => {
268947
+ normalizeYjsFragmentEventsForSchema(events, fragment);
268948
+ };
268949
+ fragment.observeDeep(normalize4);
268950
+ return () => {
268951
+ fragment.unobserveDeep(normalize4);
268952
+ };
268828
268953
  }, initializeMetaMap = (ydoc, editor) => {
268829
268954
  seedPartsFromEditor(editor, ydoc);
268830
268955
  const mediaMap = ydoc.getMap("media");
@@ -297376,13 +297501,13 @@ menclose::after {
297376
297501
  return;
297377
297502
  console.log(...args$1);
297378
297503
  }, 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;
297379
- var init_src_Cccxf1lk_es = __esm(() => {
297504
+ var init_src_AnmYYbEU_es = __esm(() => {
297380
297505
  init_rolldown_runtime_Bg48TavK_es();
297381
- init_SuperConverter_yBMSqEiB_es();
297506
+ init_SuperConverter_k7GHkV_c_es();
297382
297507
  init_jszip_C49i9kUs_es();
297383
297508
  init_xml_js_CqGKpaft_es();
297384
297509
  init_uuid_qzgm05fK_es();
297385
- init_create_headless_toolbar_DOHBUV3P_es();
297510
+ init_create_headless_toolbar_dycevpY9_es();
297386
297511
  init_constants_DrU4EASo_es();
297387
297512
  init_dist_B8HfvhaK_es();
297388
297513
  init_unified_Dsuw2be5_es();
@@ -298604,6 +298729,8 @@ ${err.toString()}`);
298604
298729
  "word/_rels/document.xml.rels",
298605
298730
  "[Content_Types].xml"
298606
298731
  ]);
298732
+ SCHEMA_ATOM_NODE_NAMES = new Set(["crossReference", "citation"]);
298733
+ NORMALIZE_YJS_FRAGMENT_ORIGIN = Symbol.for("superdoc/yjs-fragment-normalize");
298607
298734
  new PluginKey("collaboration");
298608
298735
  headlessBindingStateByEditor = /* @__PURE__ */ new WeakMap;
298609
298736
  headlessCleanupRegisteredEditors = /* @__PURE__ */ new WeakSet;
@@ -298631,6 +298758,7 @@ ${err.toString()}`);
298631
298758
  const syncListenerCleanup = initSyncListener(this.options.ydoc, this.editor, this);
298632
298759
  const [syncPlugin, fragment] = createSyncPlugin(this.options.ydoc, this.editor);
298633
298760
  this.options.fragment = fragment;
298761
+ const fragmentNormalizeCleanup = registerYjsFragmentNormalizer(fragment);
298634
298762
  const mediaMap = this.options.ydoc.getMap("media");
298635
298763
  const mediaMapObserver = (event) => {
298636
298764
  event.changes.keys.forEach((_$1, key2) => {
@@ -298645,6 +298773,7 @@ ${err.toString()}`);
298645
298773
  syncListenerCleanup,
298646
298774
  mediaMap,
298647
298775
  mediaMapObserver,
298776
+ fragmentNormalizeCleanup,
298648
298777
  metaMap: null,
298649
298778
  metaMapObserver: null,
298650
298779
  partSyncHandle: null,
@@ -321421,6 +321550,7 @@ function print() { __p += __j.call(arguments, '') }
321421
321550
  }
321422
321551
  #telemetry = null;
321423
321552
  #documentOpenTracked = false;
321553
+ #constructorFragment = null;
321424
321554
  constructor(options) {
321425
321555
  super();
321426
321556
  this.extensionStorage = {};
@@ -321526,6 +321656,7 @@ function print() { __p += __j.call(arguments, '') }
321526
321656
  resolvedOptions.element = null;
321527
321657
  resolvedOptions.selector = null;
321528
321658
  }
321659
+ this.#constructorFragment = resolvedOptions.fragment ?? null;
321529
321660
  this.#checkHeadless(resolvedOptions);
321530
321661
  this.setOptions(resolvedOptions);
321531
321662
  this.#renderer = resolvedOptions.renderer ?? (domAvailable ? new ProseMirrorRenderer : null);
@@ -321647,6 +321778,7 @@ function print() { __p += __j.call(arguments, '') }
321647
321778
  try {
321648
321779
  const resolvedMode = options?.mode ?? this.options.mode ?? "docx";
321649
321780
  const explicitIsNewFile = options?.isNewFile;
321781
+ const hasOpenFragment = Object.prototype.hasOwnProperty.call(options ?? {}, "fragment");
321650
321782
  const resolvedOptions = {
321651
321783
  ...this.options,
321652
321784
  mode: resolvedMode,
@@ -321655,7 +321787,8 @@ function print() { __p += __j.call(arguments, '') }
321655
321787
  documentMode: options?.documentMode ?? this.options.documentMode ?? "editing",
321656
321788
  html: options?.html,
321657
321789
  markdown: options?.markdown,
321658
- jsonOverride: options?.json ?? null
321790
+ jsonOverride: options?.json ?? null,
321791
+ fragment: hasOpenFragment ? options?.fragment ?? null : this.options.fragment ?? this.#constructorFragment
321659
321792
  };
321660
321793
  const loadOptions = options?.password ? { password: options.password } : undefined;
321661
321794
  if (typeof source === "string")
@@ -321789,6 +321922,7 @@ function print() { __p += __j.call(arguments, '') }
321789
321922
  this.options.initialState = null;
321790
321923
  this.options.content = "";
321791
321924
  this.options.fileSource = null;
321925
+ this.options.fragment = null;
321792
321926
  this._state = undefined;
321793
321927
  }
321794
321928
  #initProtectionState() {
@@ -322493,8 +322627,10 @@ function print() { __p += __j.call(arguments, '') }
322493
322627
  });
322494
322628
  else if (this.options.jsonOverride)
322495
322629
  doc$12 = this.schema.nodeFromJSON(this.options.jsonOverride);
322496
- if (fragment)
322630
+ if (fragment) {
322631
+ normalizeYjsFragmentForSchema(fragment);
322497
322632
  doc$12 = yXmlFragmentToProseMirrorRootNode(fragment, this.schema);
322633
+ }
322498
322634
  }
322499
322635
  else if (mode === "text" || mode === "html")
322500
322636
  if (loadFromSchema && hasJsonContent(content3))
@@ -323060,12 +323196,13 @@ function print() { __p += __j.call(arguments, '') }
323060
323196
  isHeadless: !(config3?.element != null || config3?.selector != null),
323061
323197
  ...config3
323062
323198
  };
323063
- const { html: html3, markdown, json: json2, isCommentsEnabled, suppressDefaultDocxStyles, documentMode, content: content3, mediaFiles, fonts, isNewFile, password, ...editorConfig } = resolvedConfig;
323199
+ const { html: html3, markdown, json: json2, fragment, isCommentsEnabled, suppressDefaultDocxStyles, documentMode, content: content3, mediaFiles, fonts, isNewFile, password, ...editorConfig } = resolvedConfig;
323064
323200
  const openOptions = {
323065
323201
  mode: resolvedConfig.mode,
323066
323202
  html: html3,
323067
323203
  markdown,
323068
323204
  json: json2,
323205
+ fragment,
323069
323206
  isCommentsEnabled,
323070
323207
  suppressDefaultDocxStyles,
323071
323208
  documentMode,
@@ -335179,11 +335316,11 @@ function print() { __p += __j.call(arguments, '') }
335179
335316
  ];
335180
335317
  });
335181
335318
 
335182
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-Dv5eUJtx.es.js
335319
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-BLDU9pTd.es.js
335183
335320
  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;
335184
- var init_create_super_doc_ui_Dv5eUJtx_es = __esm(() => {
335185
- init_SuperConverter_yBMSqEiB_es();
335186
- init_create_headless_toolbar_DOHBUV3P_es();
335321
+ var init_create_super_doc_ui_BLDU9pTd_es = __esm(() => {
335322
+ init_SuperConverter_k7GHkV_c_es();
335323
+ init_create_headless_toolbar_dycevpY9_es();
335187
335324
  MOD_ALIASES = new Set([
335188
335325
  "Mod",
335189
335326
  "Meta",
@@ -335225,16 +335362,16 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
335225
335362
 
335226
335363
  // ../../packages/superdoc/dist/super-editor.es.js
335227
335364
  var init_super_editor_es = __esm(() => {
335228
- init_src_Cccxf1lk_es();
335229
- init_SuperConverter_yBMSqEiB_es();
335365
+ init_src_AnmYYbEU_es();
335366
+ init_SuperConverter_k7GHkV_c_es();
335230
335367
  init_jszip_C49i9kUs_es();
335231
335368
  init_xml_js_CqGKpaft_es();
335232
- init_create_headless_toolbar_DOHBUV3P_es();
335369
+ init_create_headless_toolbar_dycevpY9_es();
335233
335370
  init_constants_DrU4EASo_es();
335234
335371
  init_dist_B8HfvhaK_es();
335235
335372
  init_unified_Dsuw2be5_es();
335236
335373
  init_DocxZipper_CZMPWpOp_es();
335237
- init_create_super_doc_ui_Dv5eUJtx_es();
335374
+ init_create_super_doc_ui_BLDU9pTd_es();
335238
335375
  init_ui_C5PAS9hY_es();
335239
335376
  init_eventemitter3_BnGqBE_Q_es();
335240
335377
  init_errors_CNaD6vcg_es();
@@ -421796,8 +421933,34 @@ var buildInstructionElements2 = (instruction, instructionTokens) => {
421796
421933
  ];
421797
421934
  };
421798
421935
 
421936
+ // ../../packages/super-editor/src/editors/v1/core/super-converter/v3/handlers/sd/shared/build-field-result-runs.js
421937
+ function buildFieldResultRuns2(params3, outputMarks) {
421938
+ const { node: node4 } = params3;
421939
+ const contentNodes = (node4.content ?? []).flatMap((child) => exportSchemaToJson2({ ...params3, node: child }));
421940
+ if (contentNodes.length > 0)
421941
+ return contentNodes;
421942
+ const resolvedText = node4.attrs?.resolvedText;
421943
+ if (typeof resolvedText !== "string" || resolvedText.length === 0)
421944
+ return [];
421945
+ const textAttributes = /^\s|\s$/.test(resolvedText) ? { "xml:space": "preserve" } : undefined;
421946
+ return [
421947
+ {
421948
+ name: "w:r",
421949
+ elements: [
421950
+ { name: "w:rPr", elements: outputMarks },
421951
+ { name: "w:t", attributes: textAttributes, elements: [{ text: resolvedText, type: "text" }] }
421952
+ ]
421953
+ }
421954
+ ];
421955
+ }
421956
+ var init_build_field_result_runs = __esm(() => {
421957
+ init_exporter();
421958
+ });
421959
+
421799
421960
  // ../../packages/super-editor/src/editors/v1/core/super-converter/v3/handlers/sd/shared/index.js
421800
- var init_shared = () => {};
421961
+ var init_shared = __esm(() => {
421962
+ init_build_field_result_runs();
421963
+ });
421801
421964
 
421802
421965
  // ../../packages/super-editor/src/editors/v1/core/super-converter/v3/handlers/sd/crossReference/crossReference-translator.js
421803
421966
  function parseTarget3(instruction) {
@@ -421862,7 +422025,7 @@ var XML_NODE_NAME27 = "sd:crossReference", SD_NODE_NAME21 = "crossReference", en
421862
422025
  }, decode68 = (params3) => {
421863
422026
  const { node: node4 } = params3;
421864
422027
  const outputMarks = processOutputMarks2(node4.attrs?.marksAsAttrs || []);
421865
- const contentNodes = (node4.content ?? []).flatMap((n) => exportSchemaToJson2({ ...params3, node: n }));
422028
+ const contentNodes = buildFieldResultRuns2(params3, outputMarks);
421866
422029
  const instructionElements = buildInstructionElements2(node4.attrs?.instruction, node4.attrs?.instructionTokens);
421867
422030
  return [
421868
422031
  {
@@ -421925,7 +422088,20 @@ function parseCitationSourceIds2(instruction) {
421925
422088
  function extractResolvedText3(content4) {
421926
422089
  if (!Array.isArray(content4))
421927
422090
  return "";
421928
- return content4.filter((n) => n.type === "text").map((n) => n.text || "").join("");
422091
+ let out = "";
422092
+ const walk = (nodes) => {
422093
+ for (const node4 of nodes) {
422094
+ if (!node4)
422095
+ continue;
422096
+ if (node4.type === "text") {
422097
+ out += node4.text || "";
422098
+ } else if (Array.isArray(node4.content)) {
422099
+ walk(node4.content);
422100
+ }
422101
+ }
422102
+ };
422103
+ walk(content4);
422104
+ return out;
421929
422105
  }
421930
422106
  var XML_NODE_NAME28 = "sd:citation", SD_NODE_NAME22 = "citation", encode65 = (params3) => {
421931
422107
  const { nodes = [], nodeListHandler } = params3 || {};
@@ -421950,7 +422126,7 @@ var XML_NODE_NAME28 = "sd:citation", SD_NODE_NAME22 = "citation", encode65 = (pa
421950
422126
  }, decode69 = (params3) => {
421951
422127
  const { node: node4 } = params3;
421952
422128
  const outputMarks = processOutputMarks2(node4.attrs?.marksAsAttrs || []);
421953
- const contentNodes = (node4.content ?? []).flatMap((n) => exportSchemaToJson2({ ...params3, node: n }));
422129
+ const contentNodes = buildFieldResultRuns2(params3, outputMarks);
421954
422130
  const instructionElements = buildInstructionElements2(node4.attrs?.instruction, node4.attrs?.instructionTokens);
421955
422131
  return [
421956
422132
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/mcp",
3
- "version": "0.8.0-next.5",
3
+ "version": "0.8.0-next.6",
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": "1.35.0",
22
+ "@superdoc/document-api": "0.0.1",
23
23
  "@superdoc/super-editor": "0.0.1",
24
- "@superdoc/document-api": "0.0.1"
24
+ "superdoc": "1.35.0"
25
25
  },
26
26
  "publishConfig": {
27
27
  "access": "public"