@superdoc-dev/mcp 0.7.0-next.9 → 0.7.0

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 +166 -54
  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") {}
14572
+ } else if (ctx.target === "openapi-3.0") {} else {}
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
- }
14837
+ } else {}
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");
@@ -29420,7 +29420,7 @@ superdoc_search({select: {type: "text", pattern: "target phrase"}, require: "fir
29420
29420
  superdoc_comment({
29421
29421
  action: "create",
29422
29422
  text: "Please review this section.",
29423
- target: {kind: "text", blockId: "<blocks[0].blockId>", range: {start: <highlightRange.start>, end: <highlightRange.end>}}
29423
+ target: {kind: "text", blockId: "<items[0].blocks[0].blockId>", range: {start: <items[0].blocks[0].range.start>, end: <items[0].blocks[0].range.end>}}
29424
29424
  })
29425
29425
  \`\`\`
29426
29426
 
@@ -51891,7 +51891,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
51891
51891
  emptyOptions2 = {};
51892
51892
  });
51893
51893
 
51894
- // ../../packages/superdoc/dist/chunks/SuperConverter-UqLu6KQU.es.js
51894
+ // ../../packages/superdoc/dist/chunks/SuperConverter-BptSHzcb.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")
@@ -72409,7 +72409,7 @@ function generateNewListDefinition(numbering, options) {
72409
72409
  }
72410
72410
  if (level != null && start != null && text$2 != null && fmt != null) {
72411
72411
  if (numbering.definitions[numId]) {
72412
- const abstractId = numbering.definitions[numId]?.elements[0]?.attributes["w:val"];
72412
+ const abstractId = numbering.definitions[numId]?.elements?.[0]?.attributes?.["w:val"];
72413
72413
  newAbstractId = abstractId;
72414
72414
  newAbstractDef = { ...numbering.abstracts[abstractId] };
72415
72415
  skipAddingNewAbstract = true;
@@ -105867,7 +105867,7 @@ var isRegExp = (value) => {
105867
105867
  state.kern = kernNode.attributes["w:val"];
105868
105868
  }
105869
105869
  }, SuperConverter;
105870
- var init_SuperConverter_UqLu6KQU_es = __esm(() => {
105870
+ var init_SuperConverter_BptSHzcb_es = __esm(() => {
105871
105871
  init_rolldown_runtime_Bg48TavK_es();
105872
105872
  init_jszip_C49i9kUs_es();
105873
105873
  init_xml_js_CqGKpaft_es();
@@ -144047,7 +144047,7 @@ var init_SuperConverter_UqLu6KQU_es = __esm(() => {
144047
144047
  };
144048
144048
  });
144049
144049
 
144050
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-QcQvy-nD.es.js
144050
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-nX0t772H.es.js
144051
144051
  function parseSizeUnit(val = "0") {
144052
144052
  const length = val.toString() || "0";
144053
144053
  const value = Number.parseFloat(length);
@@ -153241,6 +153241,10 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
153241
153241
  if (typeof checker !== "function")
153242
153242
  return false;
153243
153243
  return Boolean(checker(attrs));
153244
+ }, hasFormattingAttrs = (entry) => {
153245
+ return typeof entry.attrs === "object" && entry.attrs !== null;
153246
+ }, getFormattingAttr = (entries, name, attr) => {
153247
+ return entries.filter((entry) => entry.name === name && hasFormattingAttrs(entry)).map((entry) => entry.attrs[attr]).filter((value) => value != null);
153244
153248
  }, normalizeFontSizeValue = (value) => {
153245
153249
  if (typeof value === "number")
153246
153250
  return `${value}pt`;
@@ -153269,7 +153273,9 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
153269
153273
  return Boolean(linkedStyle?.definition?.styles && styleKey in linkedStyle.definition.styles);
153270
153274
  }, hasNegatedFormattingMark = (formatting, markName) => {
153271
153275
  const rawActiveMark = formatting.find((mark) => mark.name === markName);
153272
- return rawActiveMark ? isNegatedMark(rawActiveMark.name, rawActiveMark.attrs) : false;
153276
+ if (!rawActiveMark || !hasFormattingAttrs(rawActiveMark))
153277
+ return false;
153278
+ return isNegatedMark(rawActiveMark.name, rawActiveMark.attrs);
153273
153279
  }, isFormatCommandsStorage = (value) => {
153274
153280
  return typeof value === "object" && value !== null && "storedStyle" in value;
153275
153281
  }, hasStoredCopyFormat = (context) => {
@@ -153340,7 +153346,7 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
153340
153346
  disabled: true,
153341
153347
  value: null
153342
153348
  };
153343
- const normalizedValues = formatting.filter((mark) => mark.name === "fontSize").map((mark) => mark.attrs?.fontSize).filter((value$1) => value$1 != null).map((value$1) => normalizeFontSizeValue(value$1));
153349
+ const normalizedValues = getFormattingAttr(formatting, "fontSize", "fontSize").map((value$1) => normalizeFontSizeValue(value$1));
153344
153350
  const uniqueValues = [...new Set(normalizedValues)];
153345
153351
  const hasDirectValue = uniqueValues.length > 0;
153346
153352
  const canUseLinkedStyle = !hasDirectValue && isFormattingActivatedFromLinkedStyle(context, "font-size");
@@ -153362,7 +153368,7 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
153362
153368
  disabled: true,
153363
153369
  value: null
153364
153370
  };
153365
- const normalizedValues = formatting.filter((mark) => mark.name === "fontFamily").map((mark) => mark.attrs?.fontFamily).filter((value$1) => value$1 != null).map((value$1) => normalizeFontFamilyValue(value$1));
153371
+ const normalizedValues = getFormattingAttr(formatting, "fontFamily", "fontFamily").map((value$1) => normalizeFontFamilyValue(value$1));
153366
153372
  const uniqueValues = [...new Set(normalizedValues)];
153367
153373
  const canUseLinkedStyle = !(uniqueValues.length > 0) && isFormattingActivatedFromLinkedStyle(context, "font-family");
153368
153374
  const paragraphProps = canUseLinkedStyle ? getCurrentResolvedParagraphProperties(context) : null;
@@ -153383,7 +153389,7 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
153383
153389
  disabled: true,
153384
153390
  value: null
153385
153391
  };
153386
- const values = formatting.filter((mark) => mark.name === "color").map((mark) => mark.attrs?.color).filter((value$1) => value$1 != null);
153392
+ const values = getFormattingAttr(formatting, "color", "color");
153387
153393
  const markNegated = hasNegatedFormattingMark(formatting, "color");
153388
153394
  const normalizedValues = values.map((value$1) => normalizeColorValue(value$1));
153389
153395
  const uniqueValues = [...new Set(normalizedValues)];
@@ -153402,7 +153408,7 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
153402
153408
  disabled: true,
153403
153409
  value: null
153404
153410
  };
153405
- const values = formatting.filter((mark) => mark.name === "highlight").map((mark) => mark.attrs?.color).filter((value$1) => value$1 != null);
153411
+ const values = getFormattingAttr(formatting, "highlight", "color");
153406
153412
  const markNegated = hasNegatedFormattingMark(formatting, "highlight");
153407
153413
  const normalizedValues = values.map((value$1) => normalizeColorValue(value$1));
153408
153414
  const uniqueValues = [...new Set(normalizedValues)];
@@ -153421,7 +153427,7 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
153421
153427
  disabled: true,
153422
153428
  value: null
153423
153429
  };
153424
- const normalizedValues = formatting.filter((mark) => mark.name === "link").map((mark) => mark.attrs?.href).filter((value$1) => value$1 != null).map((value$1) => normalizeLinkHrefValue(value$1));
153430
+ const normalizedValues = getFormattingAttr(formatting, "link", "href").map((value$1) => normalizeLinkHrefValue(value$1));
153425
153431
  const uniqueValues = [...new Set(normalizedValues)];
153426
153432
  const value = uniqueValues.length === 1 ? uniqueValues[0] : null;
153427
153433
  return {
@@ -154064,8 +154070,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
154064
154070
  }
154065
154071
  };
154066
154072
  };
154067
- var init_create_headless_toolbar_QcQvy_nD_es = __esm(() => {
154068
- init_SuperConverter_UqLu6KQU_es();
154073
+ var init_create_headless_toolbar_nX0t772H_es = __esm(() => {
154074
+ init_SuperConverter_BptSHzcb_es();
154069
154075
  init_uuid_qzgm05fK_es();
154070
154076
  init_constants_DrU4EASo_es();
154071
154077
  init_dist_B8HfvhaK_es();
@@ -183515,7 +183521,8 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
183515
183521
  patchFlag |= 2048;
183516
183522
  }
183517
183523
  root2.codegenNode = createVNodeCall(context, helper(FRAGMENT), undefined, root2.children, patchFlag, undefined, undefined, true, undefined, false);
183518
- }
183524
+ } else
183525
+ ;
183519
183526
  }
183520
183527
  function traverseChildren(parent, context) {
183521
183528
  let i4 = 0;
@@ -208791,7 +208798,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
208791
208798
  init_remark_gfm_BhnWr3yf_es();
208792
208799
  });
208793
208800
 
208794
- // ../../packages/superdoc/dist/chunks/src-DXlYP0an.es.js
208801
+ // ../../packages/superdoc/dist/chunks/src-Tq4gtGIV.es.js
208795
208802
  function deleteProps(obj, propOrProps) {
208796
208803
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
208797
208804
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -225149,6 +225156,15 @@ function listCommentAnchorsSafe(editor) {
225149
225156
  return [];
225150
225157
  }
225151
225158
  }
225159
+ function emitCommentLifecycleUpdate(editor, type, comment2) {
225160
+ const emitter = editor.emit;
225161
+ if (typeof emitter !== "function")
225162
+ return;
225163
+ emitter.call(editor, "commentsUpdate", {
225164
+ type,
225165
+ comment: comment2
225166
+ });
225167
+ }
225152
225168
  function applyTextSelection(editor, from$1, to) {
225153
225169
  const setTextSelection$1 = editor.commands?.setTextSelection;
225154
225170
  if (typeof setTextSelection$1 === "function") {
@@ -225637,17 +225653,20 @@ function resolveCommentHandler(editor, input2, options) {
225637
225653
  message: "Comment is already resolved."
225638
225654
  }
225639
225655
  };
225656
+ let resolvedTimestamp = null;
225640
225657
  if (executeDomainCommand(editor, () => {
225641
225658
  const didResolve = resolveComment({
225642
225659
  commentId: identity.commentId,
225643
225660
  importedId: identity.importedId
225644
225661
  });
225645
- if (didResolve)
225662
+ if (didResolve) {
225663
+ resolvedTimestamp = Date.now();
225646
225664
  upsertCommentEntity(store, identity.commentId, {
225647
225665
  importedId: identity.importedId,
225648
225666
  isDone: true,
225649
- resolvedTime: Date.now()
225667
+ resolvedTime: resolvedTimestamp
225650
225668
  });
225669
+ }
225651
225670
  return Boolean(didResolve);
225652
225671
  }, { expectedRevision: options?.expectedRevision }).steps[0]?.effect !== "changed")
225653
225672
  return {
@@ -225657,6 +225676,12 @@ function resolveCommentHandler(editor, input2, options) {
225657
225676
  message: "Comment resolve produced no change."
225658
225677
  }
225659
225678
  };
225679
+ emitCommentLifecycleUpdate(editor, "resolved", {
225680
+ commentId: identity.commentId,
225681
+ importedId: identity.importedId,
225682
+ isDone: true,
225683
+ resolvedTime: resolvedTimestamp
225684
+ });
225660
225685
  return {
225661
225686
  success: true,
225662
225687
  updated: [toCommentAddress(identity.commentId)]
@@ -225701,6 +225726,12 @@ function reopenCommentHandler(editor, input2, options) {
225701
225726
  message: "Comment reopen produced no change."
225702
225727
  }
225703
225728
  };
225729
+ emitCommentLifecycleUpdate(editor, "update", {
225730
+ commentId: identity.commentId,
225731
+ importedId: identity.importedId,
225732
+ isDone: false,
225733
+ resolvedTime: null
225734
+ });
225704
225735
  return {
225705
225736
  success: true,
225706
225737
  updated: [toCommentAddress(identity.commentId)]
@@ -225735,6 +225766,11 @@ function removeCommentHandler(editor, input2, options) {
225735
225766
  }
225736
225767
  if (!removedIds.size && didRemove)
225737
225768
  removedIds.add(identity.commentId);
225769
+ for (const removedId of removedIds)
225770
+ emitCommentLifecycleUpdate(editor, "deleted", {
225771
+ commentId: removedId,
225772
+ importedId: removedId === identity.commentId ? identity.importedId : undefined
225773
+ });
225738
225774
  return {
225739
225775
  success: true,
225740
225776
  removed: Array.from(removedIds).map((id2) => toCommentAddress(id2))
@@ -235482,15 +235518,16 @@ function getPayloadVersionForCoverage(coverage) {
235482
235518
  return coverage.headerFooters ? PAYLOAD_VERSION_V2 : PAYLOAD_VERSION_V1;
235483
235519
  }
235484
235520
  function createDiffAdapter(editor) {
235521
+ const diffEditor = editor;
235485
235522
  return {
235486
235523
  capture() {
235487
- return wrapServiceCall(() => captureSnapshot(editor));
235524
+ return wrapServiceCall(() => captureSnapshot(diffEditor));
235488
235525
  },
235489
235526
  compare(input2) {
235490
- return wrapServiceCall(() => compareToSnapshot(editor, input2.targetSnapshot));
235527
+ return wrapServiceCall(() => compareToSnapshot(diffEditor, input2.targetSnapshot));
235491
235528
  },
235492
235529
  apply(input2, options) {
235493
- const { result, tr } = wrapServiceCall(() => applyDiffPayload(editor, input2.diff, options));
235530
+ const { result, tr } = wrapServiceCall(() => applyDiffPayload(diffEditor, input2.diff, options));
235494
235531
  if (tr.docChanged || result.appliedOperations > 0)
235495
235532
  editor.dispatch(tr);
235496
235533
  editor.emit("commentsUpdate", { type: "replayCompleted" });
@@ -297180,13 +297217,13 @@ menclose::after {
297180
297217
  return;
297181
297218
  console.log(...args$1);
297182
297219
  }, 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;
297183
- var init_src_DXlYP0an_es = __esm(() => {
297220
+ var init_src_Tq4gtGIV_es = __esm(() => {
297184
297221
  init_rolldown_runtime_Bg48TavK_es();
297185
- init_SuperConverter_UqLu6KQU_es();
297222
+ init_SuperConverter_BptSHzcb_es();
297186
297223
  init_jszip_C49i9kUs_es();
297187
297224
  init_xml_js_CqGKpaft_es();
297188
297225
  init_uuid_qzgm05fK_es();
297189
- init_create_headless_toolbar_QcQvy_nD_es();
297226
+ init_create_headless_toolbar_nX0t772H_es();
297190
297227
  init_constants_DrU4EASo_es();
297191
297228
  init_dist_B8HfvhaK_es();
297192
297229
  init_unified_Dsuw2be5_es();
@@ -308551,20 +308588,31 @@ ${err.toString()}`);
308551
308588
  tr = tr.removeMark(from$1, to, linkMarkType);
308552
308589
  if (underlineMarkType) {
308553
308590
  const rangesMissingUnderline = [];
308591
+ const negationMarksToRemove = [];
308554
308592
  tr.doc.nodesBetween(from$1, to, (node2, pos) => {
308555
308593
  if (!node2.isText || node2.nodeSize <= 0)
308556
308594
  return;
308557
- if (node2.marks.some((mark2) => mark2.type === underlineMarkType))
308595
+ const existing = node2.marks.find((mark2) => mark2.type === underlineMarkType);
308596
+ if (existing && existing.attrs?.underlineType !== "none")
308558
308597
  return;
308559
308598
  const rangeFrom = Math.max(pos, from$1);
308560
308599
  const rangeTo = Math.min(pos + node2.nodeSize, to);
308561
308600
  if (rangeFrom >= rangeTo)
308562
308601
  return;
308602
+ if (existing && existing.attrs?.underlineType === "none")
308603
+ negationMarksToRemove.push({
308604
+ from: rangeFrom,
308605
+ to: rangeTo,
308606
+ mark: existing
308607
+ });
308563
308608
  rangesMissingUnderline.push({
308564
308609
  from: rangeFrom,
308565
308610
  to: rangeTo
308566
308611
  });
308567
308612
  });
308613
+ negationMarksToRemove.forEach((range) => {
308614
+ tr = tr.removeMark(range.from, range.to, range.mark);
308615
+ });
308568
308616
  rangesMissingUnderline.forEach((range) => {
308569
308617
  tr = tr.addMark(range.from, range.to, underlineMarkType.create({ autoAdded: true }));
308570
308618
  });
@@ -308595,13 +308643,35 @@ ${err.toString()}`);
308595
308643
  const underlineMarkType = editor.schema.marks.underline;
308596
308644
  let { from: from$1, to } = selection;
308597
308645
  if (selection.empty && linkMarkType) {
308598
- const range = getMarkRange(selection.$from, linkMarkType);
308599
- if (range) {
308600
- from$1 = range.from;
308601
- to = range.to;
308646
+ const initialRange = getMarkRange(selection.$from, linkMarkType);
308647
+ if (initialRange) {
308648
+ from$1 = initialRange.from;
308649
+ to = initialRange.to;
308650
+ } else {
308651
+ const doc$12 = state.doc;
308652
+ const docSize = doc$12.content.size;
308653
+ const probePositions = [
308654
+ selection.from - 1,
308655
+ selection.from,
308656
+ selection.from + 1
308657
+ ].filter((pos) => pos >= 0 && pos <= docSize);
308658
+ for (const pos of probePositions) {
308659
+ const range = getMarkRange(doc$12.resolve(pos), linkMarkType);
308660
+ if (range) {
308661
+ from$1 = range.from;
308662
+ to = range.to;
308663
+ break;
308664
+ }
308665
+ }
308602
308666
  }
308603
308667
  }
308604
- return chain().unsetColor().unsetMark("link", { extendEmptyMarkRange: true }).command(({ tr }) => {
308668
+ const commandChain = chain();
308669
+ if (selection.empty && linkMarkType && from$1 !== to)
308670
+ commandChain.command(({ tr }) => {
308671
+ tr.setSelection(TextSelection.create(tr.doc, from$1, to));
308672
+ return true;
308673
+ });
308674
+ return commandChain.unsetColor().unsetMark("link", { extendEmptyMarkRange: true }).command(({ tr }) => {
308605
308675
  if (underlineMarkType)
308606
308676
  tr.doc.nodesBetween(from$1, to, (node2, pos) => {
308607
308677
  if (!node2.isText)
@@ -308653,6 +308723,23 @@ ${err.toString()}`);
308653
308723
  }
308654
308724
  }, node2.marks);
308655
308725
  });
308726
+ if (linkMarkType) {
308727
+ const runNodeMarkRemovals = [];
308728
+ tr.doc.nodesBetween(from$1, to, (node2, pos) => {
308729
+ if (node2.type.name !== "run")
308730
+ return;
308731
+ if (!node2.marks.some((mark2) => mark2.type === linkMarkType))
308732
+ return;
308733
+ runNodeMarkRemovals.push(pos);
308734
+ });
308735
+ runNodeMarkRemovals.reverse().forEach((pos) => {
308736
+ const mappedPos = tr.mapping.map(pos);
308737
+ const runNode = tr.doc.nodeAt(mappedPos);
308738
+ if (!runNode)
308739
+ return;
308740
+ tr.setNodeMarkup(mappedPos, runNode.type, runNode.attrs, runNode.marks.filter((mark2) => mark2.type !== linkMarkType));
308741
+ });
308742
+ }
308656
308743
  return true;
308657
308744
  }).run();
308658
308745
  },
@@ -319075,6 +319162,7 @@ function print() { __p += __j.call(arguments, '') }
319075
319162
  role = "editor";
319076
319163
  superdoc;
319077
319164
  toolbarContainer = null;
319165
+ toolbar = null;
319078
319166
  constructor(config3) {
319079
319167
  super();
319080
319168
  this.config = {
@@ -321337,7 +321425,7 @@ function print() { __p += __j.call(arguments, '') }
321337
321425
  if (!this.#telemetry || this.#documentOpenTracked)
321338
321426
  return;
321339
321427
  try {
321340
- const documentCreatedAt = this.converter?.getDocumentCreatedTimestamp?.() || null;
321428
+ const documentCreatedAt = this.converter?.getDocumentCreatedTimestamp?.() ?? null;
321341
321429
  this.#telemetry.trackDocumentOpen(documentId, documentCreatedAt);
321342
321430
  this.#documentOpenTracked = true;
321343
321431
  } catch {}
@@ -334908,11 +334996,11 @@ function print() { __p += __j.call(arguments, '') }
334908
334996
  ];
334909
334997
  });
334910
334998
 
334911
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-BuJIur0F.es.js
334999
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-DgOJ39d-.es.js
334912
335000
  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;
334913
- var init_create_super_doc_ui_BuJIur0F_es = __esm(() => {
334914
- init_SuperConverter_UqLu6KQU_es();
334915
- init_create_headless_toolbar_QcQvy_nD_es();
335001
+ var init_create_super_doc_ui_DgOJ39d_es = __esm(() => {
335002
+ init_SuperConverter_BptSHzcb_es();
335003
+ init_create_headless_toolbar_nX0t772H_es();
334916
335004
  MOD_ALIASES = new Set([
334917
335005
  "Mod",
334918
335006
  "Meta",
@@ -334954,16 +335042,16 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
334954
335042
 
334955
335043
  // ../../packages/superdoc/dist/super-editor.es.js
334956
335044
  var init_super_editor_es = __esm(() => {
334957
- init_src_DXlYP0an_es();
334958
- init_SuperConverter_UqLu6KQU_es();
335045
+ init_src_Tq4gtGIV_es();
335046
+ init_SuperConverter_BptSHzcb_es();
334959
335047
  init_jszip_C49i9kUs_es();
334960
335048
  init_xml_js_CqGKpaft_es();
334961
- init_create_headless_toolbar_QcQvy_nD_es();
335049
+ init_create_headless_toolbar_nX0t772H_es();
334962
335050
  init_constants_DrU4EASo_es();
334963
335051
  init_dist_B8HfvhaK_es();
334964
335052
  init_unified_Dsuw2be5_es();
334965
335053
  init_DocxZipper_CZMPWpOp_es();
334966
- init_create_super_doc_ui_BuJIur0F_es();
335054
+ init_create_super_doc_ui_DgOJ39d_es();
334967
335055
  init_ui_C5PAS9hY_es();
334968
335056
  init_eventemitter3_BnGqBE_Q_es();
334969
335057
  init_errors_CNaD6vcg_es();
@@ -336682,7 +336770,7 @@ More content with **bold** and *italic*.`
336682
336770
  },
336683
336771
  comment: {
336684
336772
  toolName: "superdoc_comment",
336685
- description: "Manage document comment threads: create, read, update, and delete. " + 'To create a comment, first use superdoc_search to find the target text, then pass action "create" with the comment text and a target: {kind:"text", blockId:"<blockId>", range:{start:<N>, end:<N>}} using the blockId and highlightRange from the search result. ' + 'For threaded replies, pass "parentId" with the parent comment ID. ' + 'Action "list" returns all comments with optional pagination (limit, offset) and filtering (includeResolved:true to include resolved). ' + 'Action "get" retrieves a single comment by ID. Action "update" changes status to "resolved" or marks as internal. Action "delete" removes a comment or reply by ID. ' + 'Do NOT pass "ref", "id", or "parentId" when creating a new top-level comment; only "action", "text", and "target" are needed.',
336773
+ description: "Manage document comment threads: create, read, update, and delete. " + 'To create a comment, first use superdoc_search to find the target text, then pass action "create" with the comment text and a target built from items[0].blocks. For a single-block match use {kind:"text", blockId: items[0].blocks[0].blockId, range: items[0].blocks[0].range}. For a cross-block match use {kind:"text", segments: items[0].blocks.map(b => ({blockId: b.blockId, range: b.range}))}. Do NOT use items[0].highlightRange (snippet-relative, not block-relative) or items[0].target (a SelectionTarget, not accepted by comments.create). ' + 'For threaded replies, pass "parentId" with the parent comment ID. ' + 'Action "list" returns all comments with optional pagination (limit, offset) and filtering (includeResolved:true to include resolved). ' + 'Action "get" retrieves a single comment by ID. Action "update" changes status to "resolved" or marks as internal. Action "delete" removes a comment or reply by ID. ' + 'Do NOT pass "ref", "id", or "parentId" when creating a new top-level comment; only "action", "text", and "target" are needed.',
336686
336774
  inputExamples: [
336687
336775
  {
336688
336776
  action: "create",
@@ -418153,7 +418241,10 @@ class CommandService3 {
418153
418241
  can: () => this.createCan(tr),
418154
418242
  get commands() {
418155
418243
  return Object.fromEntries(Object.entries(rawCommands).map(([name, command2]) => {
418156
- return [name, (...args3) => command2(...args3)(props)];
418244
+ return [
418245
+ name,
418246
+ (...args3) => command2(...args3)(props)
418247
+ ];
418157
418248
  }));
418158
418249
  }
418159
418250
  };
@@ -435641,7 +435732,7 @@ function generateNewListDefinition2(numbering, options) {
435641
435732
  }
435642
435733
  if (level != null && start2 != null && text9 != null && fmt != null) {
435643
435734
  if (numbering.definitions[numId]) {
435644
- const abstractId = numbering.definitions[numId]?.elements[0]?.attributes["w:val"];
435735
+ const abstractId = numbering.definitions[numId]?.elements?.[0]?.attributes?.["w:val"];
435645
435736
  newAbstractId = abstractId;
435646
435737
  const abstract = numbering.abstracts[abstractId];
435647
435738
  newAbstractDef = { ...abstract };
@@ -442720,6 +442811,12 @@ function listCommentAnchorsSafe2(editor) {
442720
442811
  return [];
442721
442812
  }
442722
442813
  }
442814
+ function emitCommentLifecycleUpdate2(editor, type, comment2) {
442815
+ const emitter = editor.emit;
442816
+ if (typeof emitter !== "function")
442817
+ return;
442818
+ emitter.call(editor, "commentsUpdate", { type, comment: comment2 });
442819
+ }
442723
442820
  function applyTextSelection2(editor, from4, to) {
442724
442821
  const setTextSelection2 = editor.commands?.setTextSelection;
442725
442822
  if (typeof setTextSelection2 === "function") {
@@ -443173,16 +443270,18 @@ function resolveCommentHandler2(editor, input2, options) {
443173
443270
  failure: { code: "NO_OP", message: "Comment is already resolved." }
443174
443271
  };
443175
443272
  }
443273
+ let resolvedTimestamp = null;
443176
443274
  const receipt2 = executeDomainCommand2(editor, () => {
443177
443275
  const didResolve = resolveComment({
443178
443276
  commentId: identity.commentId,
443179
443277
  importedId: identity.importedId
443180
443278
  });
443181
443279
  if (didResolve) {
443280
+ resolvedTimestamp = Date.now();
443182
443281
  upsertCommentEntity2(store, identity.commentId, {
443183
443282
  importedId: identity.importedId,
443184
443283
  isDone: true,
443185
- resolvedTime: Date.now()
443284
+ resolvedTime: resolvedTimestamp
443186
443285
  });
443187
443286
  }
443188
443287
  return Boolean(didResolve);
@@ -443193,6 +443292,12 @@ function resolveCommentHandler2(editor, input2, options) {
443193
443292
  failure: { code: "NO_OP", message: "Comment resolve produced no change." }
443194
443293
  };
443195
443294
  }
443295
+ emitCommentLifecycleUpdate2(editor, "resolved", {
443296
+ commentId: identity.commentId,
443297
+ importedId: identity.importedId,
443298
+ isDone: true,
443299
+ resolvedTime: resolvedTimestamp
443300
+ });
443196
443301
  return { success: true, updated: [toCommentAddress2(identity.commentId)] };
443197
443302
  }
443198
443303
  function reopenCommentHandler2(editor, input2, options) {
@@ -443232,6 +443337,12 @@ function reopenCommentHandler2(editor, input2, options) {
443232
443337
  failure: { code: "NO_OP", message: "Comment reopen produced no change." }
443233
443338
  };
443234
443339
  }
443340
+ emitCommentLifecycleUpdate2(editor, "update", {
443341
+ commentId: identity.commentId,
443342
+ importedId: identity.importedId,
443343
+ isDone: false,
443344
+ resolvedTime: null
443345
+ });
443235
443346
  return { success: true, updated: [toCommentAddress2(identity.commentId)] };
443236
443347
  }
443237
443348
  function removeCommentHandler2(editor, input2, options) {
@@ -443261,6 +443372,12 @@ function removeCommentHandler2(editor, input2, options) {
443261
443372
  if (!removedIds.size && didRemove) {
443262
443373
  removedIds.add(identity.commentId);
443263
443374
  }
443375
+ for (const removedId of removedIds) {
443376
+ emitCommentLifecycleUpdate2(editor, "deleted", {
443377
+ commentId: removedId,
443378
+ importedId: removedId === identity.commentId ? identity.importedId : undefined
443379
+ });
443380
+ }
443264
443381
  return {
443265
443382
  success: true,
443266
443383
  removed: Array.from(removedIds).map((id2) => toCommentAddress2(id2))
@@ -458789,15 +458906,16 @@ var init_service = __esm(() => {
458789
458906
 
458790
458907
  // ../../packages/super-editor/src/editors/v1/document-api-adapters/diff-adapter.ts
458791
458908
  function createDiffAdapter2(editor) {
458909
+ const diffEditor = editor;
458792
458910
  return {
458793
458911
  capture() {
458794
- return wrapServiceCall2(() => captureSnapshot2(editor));
458912
+ return wrapServiceCall2(() => captureSnapshot2(diffEditor));
458795
458913
  },
458796
458914
  compare(input2) {
458797
- return wrapServiceCall2(() => compareToSnapshot2(editor, input2.targetSnapshot));
458915
+ return wrapServiceCall2(() => compareToSnapshot2(diffEditor, input2.targetSnapshot));
458798
458916
  },
458799
458917
  apply(input2, options) {
458800
- const { result, tr } = wrapServiceCall2(() => applyDiffPayload2(editor, input2.diff, options));
458918
+ const { result, tr } = wrapServiceCall2(() => applyDiffPayload2(diffEditor, input2.diff, options));
458801
458919
  if (tr.docChanged || result.appliedOperations > 0) {
458802
458920
  editor.dispatch(tr);
458803
458921
  }
@@ -471783,13 +471901,7 @@ EXAMPLES:
471783
471901
  },
471784
471902
  {
471785
471903
  toolName: "superdoc_comment",
471786
- description: `Manage document comment threads: create, read, update, and delete. To create a comment, first use superdoc_search to find the target text, then pass action "create" with the comment text and a target: {kind:"text", blockId:"<blockId>", range:{start:<N>, end:<N>}} using the blockId and highlightRange from the search result. For threaded replies, pass "parentId" with the parent comment ID. Action "list" returns all comments with optional pagination (limit, offset) and filtering (includeResolved:true to include resolved). Action "get" retrieves a single comment by ID. Action "update" changes status to "resolved" or marks as internal. Action "delete" removes a comment or reply by ID. Do NOT pass "ref", "id", or "parentId" when creating a new top-level comment; only "action", "text", and "target" are needed.
471787
-
471788
- EXAMPLES:
471789
- 1. {"action":"create","text":"Please review this section.","target":{"kind":"text","blockId":"<blockId>","range":{"start":5,"end":25}}}
471790
- 2. {"action":"list","limit":20,"offset":0}
471791
- 3. {"action":"update","id":"<commentId>","status":"resolved"}
471792
- 4. {"action":"delete","id":"<commentId>"}`,
471904
+ description: 'Manage document comment threads: create, read, update, and delete. To create a comment, first use superdoc_search to find the target text, then pass action "create" with the comment text and a target built from items[0].blocks. For a single-block match use {kind:"text", blockId: items[0].blocks[0].blockId, range: items[0].blocks[0].range}. For a cross-block match use {kind:"text", segments: items[0].blocks.map(b => ({blockId: b.blockId, range: b.range}))}. Do NOT use items[0].highlightRange (snippet-relative, not block-relative) or items[0].target (a SelectionTarget, not accepted by comments.create). For threaded replies, pass "parentId" with the parent comment ID. Action "list" returns all comments with optional pagination (limit, offset) and filtering (includeResolved:true to include resolved). Action "get" retrieves a single comment by ID. Action "update" changes status to "resolved" or marks as internal. Action "delete" removes a comment or reply by ID. Do NOT pass "ref", "id", or "parentId" when creating a new top-level comment; only "action", "text", and "target" are needed.\n\nEXAMPLES:\n 1. {"action":"create","text":"Please review this section.","target":{"kind":"text","blockId":"<blockId>","range":{"start":5,"end":25}}}\n 2. {"action":"list","limit":20,"offset":0}\n 3. {"action":"update","id":"<commentId>","status":"resolved"}\n 4. {"action":"delete","id":"<commentId>"}',
471793
471905
  inputSchema: {
471794
471906
  type: "object",
471795
471907
  properties: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/mcp",
3
- "version": "0.7.0-next.9",
3
+ "version": "0.7.0",
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/document-api": "0.0.1",
22
23
  "@superdoc/super-editor": "0.0.1",
23
- "superdoc": "1.34.0",
24
- "@superdoc/document-api": "0.0.1"
24
+ "superdoc": "1.34.0"
25
25
  },
26
26
  "publishConfig": {
27
27
  "access": "public"