@superdoc-dev/mcp 0.10.0-next.6 → 0.10.0-next.8

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 +138 -8
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -211378,7 +211378,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
211378
211378
  init_remark_gfm_BhnWr3yf_es();
211379
211379
  });
211380
211380
 
211381
- // ../../packages/superdoc/dist/chunks/src-D1Zc7Jgj.es.js
211381
+ // ../../packages/superdoc/dist/chunks/src-DQ_lu_9z.es.js
211382
211382
  function deleteProps(obj, propOrProps) {
211383
211383
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
211384
211384
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -287872,7 +287872,7 @@ var Node$13 = class Node$14 {
287872
287872
  return false;
287873
287873
  const docs = tr.docs ?? [];
287874
287874
  return tr.steps.some((step2, index2) => stepTouchesTrackedReviewState(step2, docs[index2] ?? state.doc));
287875
- }, cloneExtensionInstance = (extension2) => {
287875
+ }, CONTENT_CONTROL_POINTER_WINDOW_MS = 800, cloneExtensionInstance = (extension2) => {
287876
287876
  const extensionLike = extension2;
287877
287877
  const config3 = extensionLike?.config;
287878
287878
  const ExtensionCtor = extensionLike?.constructor;
@@ -304453,7 +304453,7 @@ menclose::after {
304453
304453
  nextSelection = TextSelection.create(doc$12, hit.pos);
304454
304454
  if (!nextSelection.$from.parent.inlineContent)
304455
304455
  nextSelection = Selection.near(doc$12.resolve(hit.pos), 1);
304456
- let tr = editor.state.tr.setSelection(nextSelection);
304456
+ let tr = editor.state.tr.setSelection(nextSelection).setMeta("uiEvent", "click");
304457
304457
  if (inlineSdtBoundaryPos != null && inlineSdtBoundaryDirection) {
304458
304458
  tr = applyEditableSlotAtInlineBoundary(tr, inlineSdtBoundaryPos, inlineSdtBoundaryDirection);
304459
304459
  nextSelection = tr.selection;
@@ -308429,7 +308429,7 @@ menclose::after {
308429
308429
  return;
308430
308430
  console.log(...args$1);
308431
308431
  }, 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, TRACKED_MARK_NAMES;
308432
- var init_src_D1Zc7Jgj_es = __esm(() => {
308432
+ var init_src_DQ_lu_9z_es = __esm(() => {
308433
308433
  init_rolldown_runtime_Bg48TavK_es();
308434
308434
  init_SuperConverter_C6hKp29w_es();
308435
308435
  init_jszip_C49i9kUs_es();
@@ -332629,6 +332629,8 @@ function print() { __p += __j.call(arguments, '') }
332629
332629
  }
332630
332630
  #telemetry = null;
332631
332631
  #documentOpenTracked = false;
332632
+ #lastActiveContentControlRef = null;
332633
+ #lastPointerDownAt = 0;
332632
332634
  #constructorFragment = null;
332633
332635
  constructor(options) {
332634
332636
  super();
@@ -332850,9 +332852,15 @@ function print() { __p += __j.call(arguments, '') }
332850
332852
  this.on("fonts-resolved", this.options.onFontsResolved);
332851
332853
  this.on("exception", this.options.onException);
332852
332854
  this.on("pointerDown", this.options.onPointerDown);
332855
+ this.#trackContentControlPointer();
332853
332856
  this.on("pointerUp", this.options.onPointerUp);
332854
332857
  this.on("rightClick", this.options.onRightClick);
332855
332858
  }
332859
+ #trackContentControlPointer() {
332860
+ this.on("pointerDown", () => {
332861
+ this.#lastPointerDownAt = Date.now();
332862
+ });
332863
+ }
332856
332864
  async#loadDocument(source, options) {
332857
332865
  try {
332858
332866
  const resolvedMode = options?.mode ?? this.options.mode ?? "docx";
@@ -333003,6 +333011,8 @@ function print() { __p += __j.call(arguments, '') }
333003
333011
  this.options.fileSource = null;
333004
333012
  this.options.fragment = null;
333005
333013
  this._state = undefined;
333014
+ this.#lastActiveContentControlRef = null;
333015
+ this.#lastPointerDownAt = 0;
333006
333016
  }
333007
333017
  #initProtectionState() {
333008
333018
  const protStorage = getProtectionStorage(this);
@@ -333062,6 +333072,7 @@ function print() { __p += __j.call(arguments, '') }
333062
333072
  this.on("fonts-resolved", this.options.onFontsResolved);
333063
333073
  this.on("exception", this.options.onException);
333064
333074
  this.on("pointerDown", this.options.onPointerDown);
333075
+ this.#trackContentControlPointer();
333065
333076
  this.on("pointerUp", this.options.onPointerUp);
333066
333077
  this.on("rightClick", this.options.onRightClick);
333067
333078
  if (!shouldMountRenderer)
@@ -333110,6 +333121,7 @@ function print() { __p += __j.call(arguments, '') }
333110
333121
  this.on("locked", this.options.onDocumentLocked);
333111
333122
  this.on("list-definitions-change", this.options.onListDefinitionsChange);
333112
333123
  this.on("pointerDown", this.options.onPointerDown);
333124
+ this.#trackContentControlPointer();
333113
333125
  this.on("pointerUp", this.options.onPointerUp);
333114
333126
  this.on("rightClick", this.options.onRightClick);
333115
333127
  if (!shouldMountRenderer)
@@ -333929,6 +333941,11 @@ function print() { __p += __j.call(arguments, '') }
333929
333941
  editor: this,
333930
333942
  transaction: transactionToApply
333931
333943
  });
333944
+ this.#emitContentControlEvents({
333945
+ transaction: transactionToApply,
333946
+ nextState,
333947
+ selectionHasChanged
333948
+ });
333932
333949
  const focus = transactionToApply.getMeta("focus");
333933
333950
  if (focus)
333934
333951
  this.emit("focus", {
@@ -333957,6 +333974,82 @@ function print() { __p += __j.call(arguments, '') }
333957
333974
  });
333958
333975
  }
333959
333976
  }
333977
+ #emitContentControlEvents({ transaction, nextState, selectionHasChanged }) {
333978
+ const uiEvent = transaction.getMeta("uiEvent");
333979
+ const recentPointerDown = Date.now() - this.#lastPointerDownAt <= CONTENT_CONTROL_POINTER_WINDOW_MS;
333980
+ const source = uiEvent === "click" || recentPointerDown ? "pointer" : "keyboard";
333981
+ const activePath = nextState.selection ? this.#collectActiveSdtRefs(nextState.selection) : [];
333982
+ const activeContentControl = activePath[0] ?? null;
333983
+ if (selectionHasChanged) {
333984
+ const previous3 = this.#lastActiveContentControlRef;
333985
+ if (previous3?.id !== activeContentControl?.id) {
333986
+ if (activeContentControl)
333987
+ this.emit("contentControlFocus", {
333988
+ active: activeContentControl,
333989
+ previous: previous3,
333990
+ activePath,
333991
+ source
333992
+ });
333993
+ else if (previous3)
333994
+ this.emit("contentControlBlur", {
333995
+ active: null,
333996
+ previous: previous3,
333997
+ activePath: [],
333998
+ source
333999
+ });
334000
+ this.#lastActiveContentControlRef = activeContentControl;
334001
+ }
334002
+ }
334003
+ if (uiEvent === "click" && activeContentControl)
334004
+ this.emit("contentControlClick", {
334005
+ target: activeContentControl,
334006
+ source: "pointer"
334007
+ });
334008
+ }
334009
+ #collectActiveSdtRefs(selection) {
334010
+ const refs = [];
334011
+ const seenIds = /* @__PURE__ */ new Set;
334012
+ const selectedNode = selection instanceof NodeSelection ? selection.node : null;
334013
+ if (selectedNode && (selectedNode.type?.name === "structuredContent" || selectedNode.type?.name === "structuredContentBlock")) {
334014
+ const ref$1 = this.#toSdtRef(selectedNode);
334015
+ if (ref$1) {
334016
+ refs.push(ref$1);
334017
+ seenIds.add(ref$1.id);
334018
+ }
334019
+ }
334020
+ const anchor = selection.$anchor;
334021
+ if (anchor && typeof anchor.depth === "number" && typeof anchor.node === "function")
334022
+ for (let depth = anchor.depth;depth >= 0; depth -= 1) {
334023
+ const node2 = anchor.node(depth);
334024
+ if (!node2)
334025
+ continue;
334026
+ const typeName = node2?.type?.name;
334027
+ if (typeName !== "structuredContent" && typeName !== "structuredContentBlock")
334028
+ continue;
334029
+ const ref$1 = this.#toSdtRef(node2);
334030
+ if (!ref$1)
334031
+ continue;
334032
+ if (seenIds.has(ref$1.id))
334033
+ continue;
334034
+ refs.push(ref$1);
334035
+ seenIds.add(ref$1.id);
334036
+ }
334037
+ return refs;
334038
+ }
334039
+ #toSdtRef(node2) {
334040
+ const attrs = node2.attrs;
334041
+ const id2 = attrs?.id;
334042
+ if (typeof id2 !== "string" || id2.length === 0)
334043
+ return null;
334044
+ const scope = node2.type.name === "structuredContent" ? "inline" : "block";
334045
+ return {
334046
+ id: id2,
334047
+ tag: typeof attrs.tag === "string" ? attrs.tag : undefined,
334048
+ alias: typeof attrs.alias === "string" ? attrs.alias : undefined,
334049
+ controlType: typeof attrs.controlType === "string" ? attrs.controlType : "unknown",
334050
+ scope
334051
+ };
334052
+ }
333960
334053
  dispatch(tr) {
333961
334054
  this.#dispatchTransaction(tr);
333962
334055
  }
@@ -338324,6 +338417,43 @@ function print() { __p += __j.call(arguments, '') }
338324
338417
  }
338325
338418
  return this.scrollToPosition(pos, options);
338326
338419
  }
338420
+ async scrollContentControlIntoView(entityId, options = {}) {
338421
+ const editor = this.#editor;
338422
+ if (!editor || typeof entityId !== "string" || entityId.length === 0)
338423
+ return false;
338424
+ let found2 = null;
338425
+ editor.state.doc.descendants((node2, pos) => {
338426
+ if (found2)
338427
+ return false;
338428
+ const name = node2.type?.name;
338429
+ if ((name === "structuredContent" || name === "structuredContentBlock") && String(node2.attrs?.id) === entityId) {
338430
+ found2 = {
338431
+ pos,
338432
+ node: node2
338433
+ };
338434
+ return false;
338435
+ }
338436
+ return true;
338437
+ });
338438
+ if (!found2)
338439
+ return false;
338440
+ let contentPos = found2.pos + 1;
338441
+ let textFound = false;
338442
+ found2.node?.descendants((child, rel) => {
338443
+ if (textFound)
338444
+ return false;
338445
+ if (child.isText) {
338446
+ contentPos = found2.pos + 1 + rel;
338447
+ textFound = true;
338448
+ return false;
338449
+ }
338450
+ return true;
338451
+ });
338452
+ return this.scrollToPositionAsync(contentPos, {
338453
+ behavior: options.behavior ?? "smooth",
338454
+ block: options.block ?? "center"
338455
+ });
338456
+ }
338327
338457
  async scrollToPage(pageNumber, scrollBehavior = "smooth") {
338328
338458
  const layout = this.#layoutState.layout;
338329
338459
  if (!layout)
@@ -342638,9 +342768,9 @@ function print() { __p += __j.call(arguments, '') }
342638
342768
  ]);
342639
342769
  });
342640
342770
 
342641
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-Cg4-XoJL.es.js
342771
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-6F7aRTzy.es.js
342642
342772
  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;
342643
- var init_create_super_doc_ui_Cg4_XoJL_es = __esm(() => {
342773
+ var init_create_super_doc_ui_6F7aRTzy_es = __esm(() => {
342644
342774
  init_SuperConverter_C6hKp29w_es();
342645
342775
  init_create_headless_toolbar_ISx0N5AS_es();
342646
342776
  MOD_ALIASES = new Set([
@@ -342684,7 +342814,7 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
342684
342814
 
342685
342815
  // ../../packages/superdoc/dist/super-editor.es.js
342686
342816
  var init_super_editor_es = __esm(() => {
342687
- init_src_D1Zc7Jgj_es();
342817
+ init_src_DQ_lu_9z_es();
342688
342818
  init_SuperConverter_C6hKp29w_es();
342689
342819
  init_jszip_C49i9kUs_es();
342690
342820
  init_xml_js_CqGKpaft_es();
@@ -342693,7 +342823,7 @@ var init_super_editor_es = __esm(() => {
342693
342823
  init_dist_B8HfvhaK_es();
342694
342824
  init_unified_Dsuw2be5_es();
342695
342825
  init_DocxZipper_nv_KfOqb_es();
342696
- init_create_super_doc_ui_Cg4_XoJL_es();
342826
+ init_create_super_doc_ui_6F7aRTzy_es();
342697
342827
  init_ui_C5PAS9hY_es();
342698
342828
  init_eventemitter3_BnGqBE_Q_es();
342699
342829
  init_errors_CNaD6vcg_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/mcp",
3
- "version": "0.10.0-next.6",
3
+ "version": "0.10.0-next.8",
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/super-editor": "0.0.1",
22
23
  "@superdoc/document-api": "0.0.1",
23
- "superdoc": "1.37.0",
24
- "@superdoc/super-editor": "0.0.1"
24
+ "superdoc": "1.37.0"
25
25
  },
26
26
  "publishConfig": {
27
27
  "access": "public"