@superdoc-dev/mcp 0.3.0-next.92 → 0.3.0-next.93

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 +221 -119
  2. package/package.json +1 -1
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-KEGUvaEC.es.js
51894
+ // ../../packages/superdoc/dist/chunks/SuperConverter-D-cFThyR.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")
@@ -60727,20 +60727,23 @@ function combineProperties(propertiesArray, options = {}) {
60727
60727
  function isObject2(item) {
60728
60728
  return item != null && typeof item === "object" && !Array.isArray(item);
60729
60729
  }
60730
+ function dropConflictingFontSlots(target, source) {
60731
+ const result = { ...target };
60732
+ for (const [concreteKey, themeKey] of FONT_SLOT_THEME_PAIRS)
60733
+ if (source[themeKey] != null) {
60734
+ delete result[concreteKey];
60735
+ delete result[themeKey];
60736
+ } else if (source[concreteKey] != null)
60737
+ delete result[themeKey];
60738
+ return result;
60739
+ }
60730
60740
  function combineRunProperties(propertiesArray) {
60731
60741
  return combineProperties(propertiesArray, {
60732
60742
  fullOverrideProps: ["color"],
60733
60743
  specialHandling: { fontFamily: (target, source) => {
60734
60744
  const fontFamilySource = { ...source.fontFamily };
60735
- const fontFamilyTarget = { ...target.fontFamily };
60736
- if (fontFamilySource.asciiTheme != null) {
60737
- delete fontFamilyTarget.ascii;
60738
- delete fontFamilyTarget.asciiTheme;
60739
- }
60740
- if (fontFamilySource.ascii != null)
60741
- delete fontFamilyTarget.asciiTheme;
60742
60745
  return {
60743
- ...fontFamilyTarget,
60746
+ ...dropConflictingFontSlots(target.fontFamily ?? {}, fontFamilySource),
60744
60747
  ...fontFamilySource
60745
60748
  };
60746
60749
  } }
@@ -70360,6 +70363,27 @@ function resolveHypotheticalParagraphProperties(editor, $pos, inlineProps) {
70360
70363
  translatedLinkedStyles: editor.converter.translatedLinkedStyles
70361
70364
  }, inlineProps, tableStyleId);
70362
70365
  }
70366
+ function mergeFontFamilyPreservingThemeRefs(fromMarks, existing) {
70367
+ const merged = { ...fromMarks || {} };
70368
+ if (!existing || typeof existing !== "object")
70369
+ return merged;
70370
+ for (const [concreteKey, themeKey] of FONT_SLOT_THEME_PAIRS)
70371
+ if (existing[themeKey] != null) {
70372
+ merged[themeKey] = existing[themeKey];
70373
+ delete merged[concreteKey];
70374
+ }
70375
+ return merged;
70376
+ }
70377
+ function marksMatchExistingFontFamily(markFromMarks, existingFontFamily, encode$80, docx) {
70378
+ if (!existingFontFamily || typeof existingFontFamily !== "object")
70379
+ return false;
70380
+ if (!markFromMarks?.attrs)
70381
+ return false;
70382
+ const markFromExisting = encode$80({ fontFamily: existingFontFamily }, docx)?.[0];
70383
+ if (!markFromExisting?.attrs)
70384
+ return false;
70385
+ return markFromMarks.attrs.fontFamily === markFromExisting.attrs.fontFamily;
70386
+ }
70363
70387
  function getRunContext($pos) {
70364
70388
  let paragraphNode = null;
70365
70389
  let paragraphDepth = -1;
@@ -70479,10 +70503,13 @@ function getInlineRunProperties(runPropertiesFromMarks, runPropertiesFromStyles,
70479
70503
  const valueFromStyles = runPropertiesFromStyles[key];
70480
70504
  if (JSON.stringify(valueFromMarks) !== JSON.stringify(valueFromStyles))
70481
70505
  if (key === "fontFamily") {
70482
- const markFromStyles = encodeMarksFromRPr({ [key]: valueFromStyles }, editor.converter?.convertedXml ?? {})[0];
70483
- const markFromMarks = encodeMarksFromRPr({ [key]: valueFromMarks }, editor.converter?.convertedXml ?? {})[0];
70484
- if (JSON.stringify(markFromMarks?.attrs) !== JSON.stringify(markFromStyles?.attrs))
70485
- inlineRunProperties[key] = valueFromMarks;
70506
+ const docx = editor.converter?.convertedXml ?? {};
70507
+ const markFromStyles = encodeMarksFromRPr({ [key]: valueFromStyles }, docx)[0];
70508
+ const markFromMarks = encodeMarksFromRPr({ [key]: valueFromMarks }, docx)[0];
70509
+ if (JSON.stringify(markFromMarks?.attrs) !== JSON.stringify(markFromStyles?.attrs)) {
70510
+ const existingFontFamily = existingRunProperties?.[key];
70511
+ inlineRunProperties[key] = marksMatchExistingFontFamily(markFromMarks, existingFontFamily, encodeMarksFromRPr, docx) ? mergeFontFamilyPreservingThemeRefs(valueFromMarks, existingFontFamily) : valueFromMarks;
70512
+ }
70486
70513
  } else
70487
70514
  inlineRunProperties[key] = valueFromMarks;
70488
70515
  }
@@ -87419,10 +87446,32 @@ function removeSdtPrChild(sdtPr, childName) {
87419
87446
  };
87420
87447
  }
87421
87448
  function applyAttrsUpdate(editor, nodeId, attrsPatch) {
87422
- const updateCmd = editor.commands?.updateStructuredContentById;
87423
- if (typeof updateCmd !== "function")
87449
+ if (!editor?.state)
87424
87450
  return false;
87425
- return Boolean(updateCmd(nodeId, { attrs: attrsPatch }));
87451
+ let foundPos = null;
87452
+ editor.state.doc.descendants((node2, pos) => {
87453
+ if (foundPos !== null)
87454
+ return false;
87455
+ if (SDT_NODE_TYPES.has(node2.type.name) && String(node2.attrs.id) === String(nodeId)) {
87456
+ foundPos = pos;
87457
+ return false;
87458
+ }
87459
+ return true;
87460
+ });
87461
+ if (foundPos === null)
87462
+ return false;
87463
+ const tr = editor.state.tr;
87464
+ for (const [key, value] of Object.entries(attrsPatch))
87465
+ tr.setNodeAttribute(foundPos, key, value);
87466
+ if (tr.steps.length === 0)
87467
+ return true;
87468
+ if (editor.view?.dispatch)
87469
+ editor.view.dispatch(tr);
87470
+ else if (typeof editor.dispatch === "function")
87471
+ editor.dispatch(tr);
87472
+ else
87473
+ return false;
87474
+ return true;
87426
87475
  }
87427
87476
  function updateSdtPrChild(editor, target, childName, updater) {
87428
87477
  const currentSdtPr = resolveSdtByTarget(editor.state.doc, target).node.attrs.sdtPr ?? {
@@ -87656,6 +87705,59 @@ function buildContentControlInfoFromAttrs(attrs, kind) {
87656
87705
  }
87657
87706
  };
87658
87707
  }
87708
+ function assertNotSdtLocked(sdt, operation) {
87709
+ const mode = resolveLockMode(sdt.node.attrs);
87710
+ if (mode === "sdtLocked" || mode === "sdtContentLocked")
87711
+ throw new DocumentApiAdapterError("LOCK_VIOLATION", `Content control "${sdt.node.attrs.id}" has lock mode "${mode}" which prevents ${operation}.`, {
87712
+ lockMode: mode,
87713
+ operation
87714
+ });
87715
+ }
87716
+ function assertNotContentLocked(sdt, operation) {
87717
+ const mode = resolveLockMode(sdt.node.attrs);
87718
+ if (mode === "contentLocked" || mode === "sdtContentLocked")
87719
+ throw new DocumentApiAdapterError("LOCK_VIOLATION", `Content control "${sdt.node.attrs.id}" has lock mode "${mode}" which prevents ${operation}.`, {
87720
+ lockMode: mode,
87721
+ operation
87722
+ });
87723
+ }
87724
+ function assertControlType(sdt, expected, operation) {
87725
+ const actual = resolveControlType(sdt.node.attrs);
87726
+ const allowed = Array.isArray(expected) ? expected : [expected];
87727
+ if (!allowed.includes(actual))
87728
+ throw new DocumentApiAdapterError("TYPE_MISMATCH", `Operation "${operation}" requires control type ${allowed.join(" or ")}, but found "${actual}".`, {
87729
+ expected: allowed,
87730
+ actual,
87731
+ operation
87732
+ });
87733
+ }
87734
+ function buildMutationSuccess(target, updatedRef) {
87735
+ const result = {
87736
+ success: true,
87737
+ contentControl: target
87738
+ };
87739
+ if (updatedRef)
87740
+ result.updatedRef = updatedRef;
87741
+ return result;
87742
+ }
87743
+ function buildMutationFailure(code$1, message) {
87744
+ return {
87745
+ success: false,
87746
+ failure: {
87747
+ code: code$1,
87748
+ message
87749
+ }
87750
+ };
87751
+ }
87752
+ function applyPagination(items, opts) {
87753
+ const total = items.length;
87754
+ const offset = opts?.offset ?? 0;
87755
+ const limit = opts?.limit ?? total;
87756
+ return {
87757
+ items: items.slice(offset, offset + limit),
87758
+ total
87759
+ };
87760
+ }
87659
87761
  function resolveBlock(editor, nodeId) {
87660
87762
  const matches$1 = getBlockIndex(editor).candidates.filter((c$1) => c$1.nodeId === nodeId && (c$1.nodeType === "paragraph" || c$1.nodeType === "listItem"));
87661
87763
  if (matches$1.length === 0)
@@ -90906,7 +91008,7 @@ var isRegExp = (value) => {
90906
91008
  return true;
90907
91009
  }, areAttrsEqual = (attrsA = {}, attrsB = {}) => {
90908
91010
  return objectIncludes(attrsA, attrsB);
90909
- }, TrackInsertMarkName = "trackInsert", TrackDeleteMarkName = "trackDelete", TrackFormatMarkName = "trackFormat", TrackedFormatMarkNames, SUBSCRIPT_SUPERSCRIPT_SCALE = 0.65, BASELINE_SHIFT_EPSILON = 0.000001, TABLE_STYLE_ID_TABLE_GRID = "TableGrid", TABLE_FALLBACK_BORDER, TABLE_FALLBACK_BORDERS, TABLE_FALLBACK_CELL_PADDING, DEFAULT_TBL_LOOK, CNF_STYLE_MAP, TABLE_STYLE_PRECEDENCE, getToCssFontFamily = () => {
91011
+ }, TrackInsertMarkName = "trackInsert", TrackDeleteMarkName = "trackDelete", TrackFormatMarkName = "trackFormat", TrackedFormatMarkNames, SUBSCRIPT_SUPERSCRIPT_SCALE = 0.65, BASELINE_SHIFT_EPSILON = 0.000001, FONT_SLOT_THEME_PAIRS, TABLE_STYLE_ID_TABLE_GRID = "TableGrid", TABLE_FALLBACK_BORDER, TABLE_FALLBACK_BORDERS, TABLE_FALLBACK_CELL_PADDING, DEFAULT_TBL_LOOK, CNF_STYLE_MAP, TABLE_STYLE_PRECEDENCE, getToCssFontFamily = () => {
90910
91012
  return SuperConverter.toCssFontFamily;
90911
91013
  }, getSpacingStyle = (spacing, isListItem$1) => {
90912
91014
  let { before, after, line, lineRule, beforeAutospacing, afterAutospacing } = spacing;
@@ -105358,7 +105460,7 @@ var isRegExp = (value) => {
105358
105460
  if (id)
105359
105461
  return trackedChanges.filter(({ mark }) => mark.attrs.id === id);
105360
105462
  return trackedChanges;
105361
- }, DERIVED_ID_LENGTH = 24, groupedCache, SDT_NODE_NAMES, SDT_BLOCK_NAME = "structuredContentBlock", 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.32.0", collectRunDefaultProperties = (runProps, { allowOverrideTypeface = true, allowOverrideSize = true, themeResolver, state }) => {
105463
+ }, 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.32.0", collectRunDefaultProperties = (runProps, { allowOverrideTypeface = true, allowOverrideSize = true, themeResolver, state }) => {
105362
105464
  if (!runProps?.elements?.length || !state)
105363
105465
  return;
105364
105466
  const fontsNode = runProps.elements.find((el) => el.name === "w:rFonts");
@@ -105392,7 +105494,7 @@ var isRegExp = (value) => {
105392
105494
  state.kern = kernNode.attributes["w:val"];
105393
105495
  }
105394
105496
  }, SuperConverter;
105395
- var init_SuperConverter_KEGUvaEC_es = __esm(() => {
105497
+ var init_SuperConverter_D_cFThyR_es = __esm(() => {
105396
105498
  init_rolldown_runtime_Bg48TavK_es();
105397
105499
  init_jszip_C49i9kUs_es();
105398
105500
  init_xml_js_CqGKpaft_es();
@@ -121058,6 +121160,12 @@ var init_SuperConverter_KEGUvaEC_es = __esm(() => {
121058
121160
  "highlight",
121059
121161
  "link"
121060
121162
  ];
121163
+ FONT_SLOT_THEME_PAIRS = [
121164
+ ["ascii", "asciiTheme"],
121165
+ ["hAnsi", "hAnsiTheme"],
121166
+ ["eastAsia", "eastAsiaTheme"],
121167
+ ["cs", "cstheme"]
121168
+ ];
121061
121169
  TABLE_FALLBACK_BORDER = {
121062
121170
  val: "single",
121063
121171
  size: 4,
@@ -142117,6 +142225,7 @@ var init_SuperConverter_KEGUvaEC_es = __esm(() => {
142117
142225
  };
142118
142226
  groupedCache = /* @__PURE__ */ new WeakMap;
142119
142227
  SDT_NODE_NAMES = ["structuredContent", "structuredContentBlock"];
142228
+ SDT_NODE_TYPES = new Set(SDT_NODE_NAMES);
142120
142229
  VALID_CONTROL_TYPES = [
142121
142230
  "text",
142122
142231
  "richText",
@@ -143259,7 +143368,7 @@ var init_SuperConverter_KEGUvaEC_es = __esm(() => {
143259
143368
  };
143260
143369
  });
143261
143370
 
143262
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-DwiDDjhC.es.js
143371
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-DkFBZ1T1.es.js
143263
143372
  function parseSizeUnit(val = "0") {
143264
143373
  const length = val.toString() || "0";
143265
143374
  const value = Number.parseFloat(length);
@@ -145981,8 +146090,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
145981
146090
  }
145982
146091
  };
145983
146092
  };
145984
- var init_create_headless_toolbar_DwiDDjhC_es = __esm(() => {
145985
- init_SuperConverter_KEGUvaEC_es();
146093
+ var init_create_headless_toolbar_DkFBZ1T1_es = __esm(() => {
146094
+ init_SuperConverter_D_cFThyR_es();
145986
146095
  init_constants_DrU4EASo_es();
145987
146096
  init_dist_B8HfvhaK_es();
145988
146097
  CSS_DIMENSION_REGEX = /[\d-.]+(\w+)$/;
@@ -200201,7 +200310,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
200201
200310
  init_remark_gfm_BhnWr3yf_es();
200202
200311
  });
200203
200312
 
200204
- // ../../packages/superdoc/dist/chunks/src-XCAViTso.es.js
200313
+ // ../../packages/superdoc/dist/chunks/src-CHVby7ed.es.js
200205
200314
  function deleteProps(obj, propOrProps) {
200206
200315
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
200207
200316
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -200989,59 +201098,6 @@ function getSuperdocVersion() {
200989
201098
  return "unknown";
200990
201099
  }
200991
201100
  }
200992
- function assertNotSdtLocked(sdt, operation) {
200993
- const mode = resolveLockMode(sdt.node.attrs);
200994
- if (mode === "sdtLocked" || mode === "sdtContentLocked")
200995
- throw new DocumentApiAdapterError("LOCK_VIOLATION", `Content control "${sdt.node.attrs.id}" has lock mode "${mode}" which prevents ${operation}.`, {
200996
- lockMode: mode,
200997
- operation
200998
- });
200999
- }
201000
- function assertNotContentLocked(sdt, operation) {
201001
- const mode = resolveLockMode(sdt.node.attrs);
201002
- if (mode === "contentLocked" || mode === "sdtContentLocked")
201003
- throw new DocumentApiAdapterError("LOCK_VIOLATION", `Content control "${sdt.node.attrs.id}" has lock mode "${mode}" which prevents ${operation}.`, {
201004
- lockMode: mode,
201005
- operation
201006
- });
201007
- }
201008
- function assertControlType(sdt, expected, operation) {
201009
- const actual = resolveControlType(sdt.node.attrs);
201010
- const allowed = Array.isArray(expected) ? expected : [expected];
201011
- if (!allowed.includes(actual))
201012
- throw new DocumentApiAdapterError("TYPE_MISMATCH", `Operation "${operation}" requires control type ${allowed.join(" or ")}, but found "${actual}".`, {
201013
- expected: allowed,
201014
- actual,
201015
- operation
201016
- });
201017
- }
201018
- function buildMutationSuccess(target, updatedRef) {
201019
- const result = {
201020
- success: true,
201021
- contentControl: target
201022
- };
201023
- if (updatedRef)
201024
- result.updatedRef = updatedRef;
201025
- return result;
201026
- }
201027
- function buildMutationFailure(code7, message) {
201028
- return {
201029
- success: false,
201030
- failure: {
201031
- code: code7,
201032
- message
201033
- }
201034
- };
201035
- }
201036
- function applyPagination(items, opts) {
201037
- const total = items.length;
201038
- const offset$1 = opts?.offset ?? 0;
201039
- const limit = opts?.limit ?? total;
201040
- return {
201041
- items: items.slice(offset$1, offset$1 + limit),
201042
- total
201043
- };
201044
- }
201045
201101
  function getFocusMeta(tr) {
201046
201102
  return tr.getMeta(CustomSelectionPluginKey);
201047
201103
  }
@@ -235724,22 +235780,24 @@ function alreadyMatchesPlainTextReplacement(sdt, expectedText) {
235724
235780
  }
235725
235781
  function replaceSdtTextContent(editor, target, text5) {
235726
235782
  const resolved = resolveSdtByTarget(editor.state.doc, target);
235783
+ const { tr } = editor.state;
235784
+ const innerFrom = resolved.pos + 1;
235785
+ const innerTo = resolved.pos + resolved.node.nodeSize - 1;
235727
235786
  if (resolved.kind === "inline") {
235728
- const updateCmd = editor.commands?.updateStructuredContentById;
235729
- if (text5.length > 0)
235730
- return Boolean(updateCmd?.(target.nodeId, { text: text5 }));
235731
- const updatedNode$1 = resolved.node.type.create({ ...resolved.node.attrs }, null, resolved.node.marks);
235732
- const { tr: tr$1 } = editor.state;
235733
- tr$1.replaceWith(resolved.pos, resolved.pos + resolved.node.nodeSize, updatedNode$1);
235734
- dispatchTransaction(editor, tr$1);
235787
+ if (text5.length > 0) {
235788
+ const textNode = editor.schema.text(text5);
235789
+ tr.replaceWith(innerFrom, innerTo, textNode);
235790
+ } else
235791
+ tr.delete(innerFrom, innerTo);
235792
+ dispatchTransaction(editor, tr);
235735
235793
  return true;
235736
235794
  }
235737
235795
  const paragraph2 = buildEmptyBlockContent(editor, resolved.node);
235796
+ if (!paragraph2)
235797
+ return false;
235738
235798
  const paragraphText = text5.length > 0 ? buildTextWithTabs(editor.schema, text5, undefined) : null;
235739
- const updatedParagraph = paragraph2?.type.create(paragraph2.attrs ?? null, paragraphText, paragraph2.marks) ?? null;
235740
- const updatedNode = resolved.node.type.create({ ...resolved.node.attrs }, updatedParagraph, resolved.node.marks);
235741
- const { tr } = editor.state;
235742
- tr.replaceWith(resolved.pos, resolved.pos + resolved.node.nodeSize, updatedNode);
235799
+ const updatedParagraph = paragraph2.type.create(paragraph2.attrs ?? null, paragraphText, paragraph2.marks);
235800
+ tr.replaceWith(innerFrom, innerTo, updatedParagraph);
235743
235801
  dispatchTransaction(editor, tr);
235744
235802
  return true;
235745
235803
  }
@@ -294075,12 +294133,12 @@ menclose::after {
294075
294133
  return;
294076
294134
  console.log(...args$1);
294077
294135
  }, 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;
294078
- var init_src_XCAViTso_es = __esm(() => {
294136
+ var init_src_CHVby7ed_es = __esm(() => {
294079
294137
  init_rolldown_runtime_Bg48TavK_es();
294080
- init_SuperConverter_KEGUvaEC_es();
294138
+ init_SuperConverter_D_cFThyR_es();
294081
294139
  init_jszip_C49i9kUs_es();
294082
294140
  init_uuid_qzgm05fK_es();
294083
- init_create_headless_toolbar_DwiDDjhC_es();
294141
+ init_create_headless_toolbar_DkFBZ1T1_es();
294084
294142
  init_constants_DrU4EASo_es();
294085
294143
  init_dist_B8HfvhaK_es();
294086
294144
  init_unified_Dsuw2be5_es();
@@ -332123,11 +332181,11 @@ function print() { __p += __j.call(arguments, '') }
332123
332181
  ];
332124
332182
  });
332125
332183
 
332126
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-BEAzL3ry.es.js
332184
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-0ZhHPCRD.es.js
332127
332185
  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;
332128
- var init_create_super_doc_ui_BEAzL3ry_es = __esm(() => {
332129
- init_SuperConverter_KEGUvaEC_es();
332130
- init_create_headless_toolbar_DwiDDjhC_es();
332186
+ var init_create_super_doc_ui_0ZhHPCRD_es = __esm(() => {
332187
+ init_SuperConverter_D_cFThyR_es();
332188
+ init_create_headless_toolbar_DkFBZ1T1_es();
332131
332189
  MOD_ALIASES = new Set([
332132
332190
  "Mod",
332133
332191
  "Meta",
@@ -332169,16 +332227,16 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
332169
332227
 
332170
332228
  // ../../packages/superdoc/dist/super-editor.es.js
332171
332229
  var init_super_editor_es = __esm(() => {
332172
- init_src_XCAViTso_es();
332173
- init_SuperConverter_KEGUvaEC_es();
332230
+ init_src_CHVby7ed_es();
332231
+ init_SuperConverter_D_cFThyR_es();
332174
332232
  init_jszip_C49i9kUs_es();
332175
332233
  init_xml_js_CqGKpaft_es();
332176
- init_create_headless_toolbar_DwiDDjhC_es();
332234
+ init_create_headless_toolbar_DkFBZ1T1_es();
332177
332235
  init_constants_DrU4EASo_es();
332178
332236
  init_dist_B8HfvhaK_es();
332179
332237
  init_unified_Dsuw2be5_es();
332180
332238
  init_DocxZipper_TPSo9G36_es();
332181
- init_create_super_doc_ui_BEAzL3ry_es();
332239
+ init_create_super_doc_ui_0ZhHPCRD_es();
332182
332240
  init_ui_CGB3qmy3_es();
332183
332241
  init_eventemitter3_UwU_CLPU_es();
332184
332242
  init_errors_C_DoKMoN_es();
@@ -371210,10 +371268,34 @@ function removeSdtPrChild2(sdtPr, childName) {
371210
371268
  return { ...sdtPr, elements: sdtPr.elements.filter((el) => el.name !== childName) };
371211
371269
  }
371212
371270
  function applyAttrsUpdate2(editor, nodeId, attrsPatch) {
371213
- const updateCmd = editor.commands?.updateStructuredContentById;
371214
- if (typeof updateCmd !== "function")
371271
+ if (!editor?.state)
371272
+ return false;
371273
+ let foundPos = null;
371274
+ editor.state.doc.descendants((node3, pos) => {
371275
+ if (foundPos !== null)
371276
+ return false;
371277
+ if (SDT_NODE_TYPES2.has(node3.type.name) && String(node3.attrs.id) === String(nodeId)) {
371278
+ foundPos = pos;
371279
+ return false;
371280
+ }
371281
+ return true;
371282
+ });
371283
+ if (foundPos === null)
371284
+ return false;
371285
+ const tr = editor.state.tr;
371286
+ for (const [key2, value] of Object.entries(attrsPatch)) {
371287
+ tr.setNodeAttribute(foundPos, key2, value);
371288
+ }
371289
+ if (tr.steps.length === 0)
371290
+ return true;
371291
+ if (editor.view?.dispatch) {
371292
+ editor.view.dispatch(tr);
371293
+ } else if (typeof editor.dispatch === "function") {
371294
+ editor.dispatch(tr);
371295
+ } else {
371215
371296
  return false;
371216
- return Boolean(updateCmd(nodeId, { attrs: attrsPatch }));
371297
+ }
371298
+ return true;
371217
371299
  }
371218
371300
  function updateSdtPrChild2(editor, target, childName, updater) {
371219
371301
  const resolved = resolveSdtByTarget2(editor.state.doc, target);
@@ -371250,8 +371332,10 @@ function replaceSdtPrSubElements2(editor, target, childName, elements) {
371250
371332
  elements
371251
371333
  }));
371252
371334
  }
371335
+ var SDT_NODE_TYPES2;
371253
371336
  var init_sdt_properties_write = __esm(() => {
371254
371337
  init_target_resolution();
371338
+ SDT_NODE_TYPES2 = new Set(SDT_NODE_NAMES2);
371255
371339
  });
371256
371340
 
371257
371341
  // ../../packages/super-editor/src/editors/v1/document-api-adapters/helpers/content-controls/sdt-info-builder.ts
@@ -372756,20 +372840,25 @@ function combineProperties2(propertiesArray, options = {}) {
372756
372840
  function isObject4(item) {
372757
372841
  return item != null && typeof item === "object" && !Array.isArray(item);
372758
372842
  }
372843
+ function dropConflictingFontSlots2(target, source) {
372844
+ const result = { ...target };
372845
+ for (const [concreteKey, themeKey] of FONT_SLOT_THEME_PAIRS2) {
372846
+ if (source[themeKey] != null) {
372847
+ delete result[concreteKey];
372848
+ delete result[themeKey];
372849
+ } else if (source[concreteKey] != null) {
372850
+ delete result[themeKey];
372851
+ }
372852
+ }
372853
+ return result;
372854
+ }
372759
372855
  function combineRunProperties2(propertiesArray) {
372760
372856
  return combineProperties2(propertiesArray, {
372761
372857
  fullOverrideProps: ["color"],
372762
372858
  specialHandling: {
372763
372859
  fontFamily: (target, source) => {
372764
372860
  const fontFamilySource = { ...source.fontFamily };
372765
- const fontFamilyTarget = { ...target.fontFamily };
372766
- if (fontFamilySource.asciiTheme != null) {
372767
- delete fontFamilyTarget.ascii;
372768
- delete fontFamilyTarget.asciiTheme;
372769
- }
372770
- if (fontFamilySource.ascii != null) {
372771
- delete fontFamilyTarget.asciiTheme;
372772
- }
372861
+ const fontFamilyTarget = dropConflictingFontSlots2(target.fontFamily ?? {}, fontFamilySource);
372773
372862
  return { ...fontFamilyTarget, ...fontFamilySource };
372774
372863
  }
372775
372864
  }
@@ -372794,6 +372883,15 @@ function combineIndentProperties2(indentChain) {
372794
372883
  }
372795
372884
  });
372796
372885
  }
372886
+ var FONT_SLOT_THEME_PAIRS2;
372887
+ var init_cascade = __esm(() => {
372888
+ FONT_SLOT_THEME_PAIRS2 = [
372889
+ ["ascii", "asciiTheme"],
372890
+ ["hAnsi", "hAnsiTheme"],
372891
+ ["eastAsia", "eastAsiaTheme"],
372892
+ ["cs", "cstheme"]
372893
+ ];
372894
+ });
372797
372895
 
372798
372896
  // ../../packages/layout-engine/style-engine/src/ooxml/table-style-selection.ts
372799
372897
  function isKnownTableStyleId2(styleId, translatedLinkedStyles) {
@@ -373170,6 +373268,7 @@ function determineCellStyleTypes2(tblLook, rowIndex, cellIndex, numRows, numCell
373170
373268
  }
373171
373269
  var DEFAULT_TBL_LOOK2, CNF_STYLE_MAP2, TABLE_STYLE_PRECEDENCE2;
373172
373270
  var init_ooxml = __esm(() => {
373271
+ init_cascade();
373173
373272
  init_table_style_selection();
373174
373273
  DEFAULT_TBL_LOOK2 = {
373175
373274
  firstRow: true,
@@ -428554,6 +428653,7 @@ var RUN_PROPERTIES_DERIVED_FROM_MARKS2, TRANSIENT_HYPERLINK_STYLE_IDS2;
428554
428653
  var init_calculateInlineRunPropertiesPlugin = __esm(() => {
428555
428654
  init_dist10();
428556
428655
  init_styles3();
428656
+ init_ooxml();
428557
428657
  init_resolvedPropertiesCache();
428558
428658
  RUN_PROPERTIES_DERIVED_FROM_MARKS2 = new Set([
428559
428659
  "strike",
@@ -458227,23 +458327,25 @@ function alreadyMatchesPlainTextReplacement2(sdt, expectedText) {
458227
458327
  }
458228
458328
  function replaceSdtTextContent2(editor, target, text9) {
458229
458329
  const resolved = resolveSdtByTarget2(editor.state.doc, target);
458330
+ const { tr } = editor.state;
458331
+ const innerFrom = resolved.pos + 1;
458332
+ const innerTo = resolved.pos + resolved.node.nodeSize - 1;
458230
458333
  if (resolved.kind === "inline") {
458231
- const updateCmd = editor.commands?.updateStructuredContentById;
458232
458334
  if (text9.length > 0) {
458233
- return Boolean(updateCmd?.(target.nodeId, { text: text9 }));
458335
+ const textNode = editor.schema.text(text9);
458336
+ tr.replaceWith(innerFrom, innerTo, textNode);
458337
+ } else {
458338
+ tr.delete(innerFrom, innerTo);
458234
458339
  }
458235
- const updatedNode2 = resolved.node.type.create({ ...resolved.node.attrs }, null, resolved.node.marks);
458236
- const { tr: tr2 } = editor.state;
458237
- tr2.replaceWith(resolved.pos, resolved.pos + resolved.node.nodeSize, updatedNode2);
458238
- dispatchTransaction4(editor, tr2);
458340
+ dispatchTransaction4(editor, tr);
458239
458341
  return true;
458240
458342
  }
458241
458343
  const paragraph4 = buildEmptyBlockContent2(editor, resolved.node);
458344
+ if (!paragraph4)
458345
+ return false;
458242
458346
  const paragraphText = text9.length > 0 ? buildTextWithTabs2(editor.schema, text9, undefined) : null;
458243
- const updatedParagraph = paragraph4?.type.create(paragraph4.attrs ?? null, paragraphText, paragraph4.marks) ?? null;
458244
- const updatedNode = resolved.node.type.create({ ...resolved.node.attrs }, updatedParagraph, resolved.node.marks);
458245
- const { tr } = editor.state;
458246
- tr.replaceWith(resolved.pos, resolved.pos + resolved.node.nodeSize, updatedNode);
458347
+ const updatedParagraph = paragraph4.type.create(paragraph4.attrs ?? null, paragraphText, paragraph4.marks);
458348
+ tr.replaceWith(innerFrom, innerTo, updatedParagraph);
458247
458349
  dispatchTransaction4(editor, tr);
458248
458350
  return true;
458249
458351
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/mcp",
3
- "version": "0.3.0-next.92",
3
+ "version": "0.3.0-next.93",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=20"