@superdoc-dev/cli 0.2.0-next.144 → 0.2.0-next.147

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 +123 -28
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -17831,7 +17831,6 @@ var init_cli_only_operation_definitions = __esm(() => {
17831
17831
  category: "session",
17832
17832
  description: "Open a document and create a persistent editing session. Optionally override the document body with contentOverride + overrideType (markdown, html, or text).",
17833
17833
  requiresDocumentContext: false,
17834
- intentName: "open_document",
17835
17834
  sdkMetadata: { mutates: true, idempotency: "non-idempotent", supportsTrackedMode: false, supportsDryRun: false },
17836
17835
  outputSchema: {
17837
17836
  type: "object",
@@ -17874,7 +17873,6 @@ var init_cli_only_operation_definitions = __esm(() => {
17874
17873
  category: "session",
17875
17874
  description: "Save the current session to the original file or a new path.",
17876
17875
  requiresDocumentContext: false,
17877
- intentName: "save_document",
17878
17876
  sdkMetadata: { mutates: true, idempotency: "conditional", supportsTrackedMode: false, supportsDryRun: false },
17879
17877
  outputSchema: {
17880
17878
  type: "object",
@@ -17913,7 +17911,6 @@ var init_cli_only_operation_definitions = __esm(() => {
17913
17911
  category: "session",
17914
17912
  description: "Close the active editing session and clean up resources.",
17915
17913
  requiresDocumentContext: false,
17916
- intentName: "close_document",
17917
17914
  sdkMetadata: { mutates: true, idempotency: "conditional", supportsTrackedMode: false, supportsDryRun: false },
17918
17915
  outputSchema: {
17919
17916
  type: "object",
@@ -17940,7 +17937,6 @@ var init_cli_only_operation_definitions = __esm(() => {
17940
17937
  category: "session",
17941
17938
  description: "Show the current session status and document metadata.",
17942
17939
  requiresDocumentContext: false,
17943
- intentName: "get_status",
17944
17940
  sdkMetadata: { mutates: false, idempotency: "idempotent", supportsTrackedMode: false, supportsDryRun: false },
17945
17941
  outputSchema: {
17946
17942
  type: "object",
@@ -17980,7 +17976,6 @@ var init_cli_only_operation_definitions = __esm(() => {
17980
17976
  category: "session",
17981
17977
  description: "List all available CLI operations and contract metadata.",
17982
17978
  requiresDocumentContext: false,
17983
- intentName: "describe_commands",
17984
17979
  skipAsATool: true,
17985
17980
  sdkMetadata: { mutates: false, idempotency: "idempotent", supportsTrackedMode: false, supportsDryRun: false },
17986
17981
  outputSchema: {
@@ -18008,7 +18003,6 @@ var init_cli_only_operation_definitions = __esm(() => {
18008
18003
  description: "Show detailed metadata for a single CLI operation.",
18009
18004
  requiresDocumentContext: false,
18010
18005
  tokenOverride: ["describe", "command"],
18011
- intentName: "describe_command",
18012
18006
  skipAsATool: true,
18013
18007
  sdkMetadata: { mutates: false, idempotency: "idempotent", supportsTrackedMode: false, supportsDryRun: false },
18014
18008
  outputSchema: {
@@ -18028,7 +18022,6 @@ var init_cli_only_operation_definitions = __esm(() => {
18028
18022
  category: "session",
18029
18023
  description: "List all active editing sessions.",
18030
18024
  requiresDocumentContext: false,
18031
- intentName: "list_sessions",
18032
18025
  sdkMetadata: { mutates: false, idempotency: "idempotent", supportsTrackedMode: false, supportsDryRun: false },
18033
18026
  outputSchema: {
18034
18027
  type: "object",
@@ -18054,7 +18047,6 @@ var init_cli_only_operation_definitions = __esm(() => {
18054
18047
  category: "session",
18055
18048
  description: "Persist the current session state.",
18056
18049
  requiresDocumentContext: false,
18057
- intentName: "save_session",
18058
18050
  sdkMetadata: { mutates: true, idempotency: "conditional", supportsTrackedMode: false, supportsDryRun: false },
18059
18051
  outputSchema: {
18060
18052
  type: "object",
@@ -18086,7 +18078,6 @@ var init_cli_only_operation_definitions = __esm(() => {
18086
18078
  category: "session",
18087
18079
  description: "Close a specific editing session by ID.",
18088
18080
  requiresDocumentContext: false,
18089
- intentName: "close_session",
18090
18081
  sdkMetadata: { mutates: true, idempotency: "conditional", supportsTrackedMode: false, supportsDryRun: false },
18091
18082
  outputSchema: {
18092
18083
  type: "object",
@@ -18114,7 +18105,6 @@ var init_cli_only_operation_definitions = __esm(() => {
18114
18105
  category: "session",
18115
18106
  description: "Set the default session for subsequent commands.",
18116
18107
  requiresDocumentContext: false,
18117
- intentName: "set_default_session",
18118
18108
  sdkMetadata: { mutates: true, idempotency: "conditional", supportsTrackedMode: false, supportsDryRun: false },
18119
18109
  outputSchema: {
18120
18110
  type: "object",
@@ -136180,7 +136170,7 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
136180
136170
  init_remark_gfm_z_sDF4ss_es();
136181
136171
  });
136182
136172
 
136183
- // ../../packages/superdoc/dist/chunks/src-DUt8-PYY.es.js
136173
+ // ../../packages/superdoc/dist/chunks/src-wsfRydup.es.js
136184
136174
  function deleteProps(obj, propOrProps) {
136185
136175
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
136186
136176
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -186107,6 +186097,28 @@ function isSemanticFootnoteBlockId(blockId) {
186107
186097
  function isFootnoteBlockId(blockId) {
186108
186098
  return typeof blockId === "string" && (blockId.startsWith("footnote-") || isSemanticFootnoteBlockId(blockId));
186109
186099
  }
186100
+ function getCommentHighlightThreadIds(target) {
186101
+ if (!(target instanceof Element))
186102
+ return [];
186103
+ const threadIds = target.closest(COMMENT_HIGHLIGHT_SELECTOR)?.getAttribute("data-comment-ids");
186104
+ if (!threadIds)
186105
+ return [];
186106
+ return threadIds.split(",").map((threadId) => threadId.trim()).filter(Boolean);
186107
+ }
186108
+ function getActiveCommentThreadId(editor) {
186109
+ const activeThreadId = CommentsPluginKey.getState(editor.state)?.activeThreadId;
186110
+ if (typeof activeThreadId !== "string" || activeThreadId.length === 0)
186111
+ return null;
186112
+ return activeThreadId;
186113
+ }
186114
+ function shouldIgnoreRepeatClickOnActiveComment(target, activeThreadId) {
186115
+ if (!activeThreadId)
186116
+ return false;
186117
+ const clickedThreadIds = getCommentHighlightThreadIds(target);
186118
+ if (clickedThreadIds.length !== 1)
186119
+ return false;
186120
+ return clickedThreadIds[0] === activeThreadId;
186121
+ }
186110
186122
  function isInRegisteredSurface(event) {
186111
186123
  const path2 = typeof event.composedPath === "function" ? event.composedPath() : [];
186112
186124
  if (path2.length > 0) {
@@ -201065,6 +201077,16 @@ var Node$13 = class Node$14 {
201065
201077
  }
201066
201078
  containingComments.sort((a2, b$1) => a2.size - b$1.size);
201067
201079
  return containingComments[0].commentId;
201080
+ }, selectionContainsThread = (doc$2, selection, threadId) => {
201081
+ if (!selection || !threadId)
201082
+ return false;
201083
+ const { $from, $to } = selection;
201084
+ if ($from.pos !== $to.pos)
201085
+ return false;
201086
+ const range = findRangeById(doc$2, threadId);
201087
+ if (!range)
201088
+ return false;
201089
+ return $from.pos >= range.from && $from.pos < range.to;
201068
201090
  }, findTrackedMark = ({ doc: doc$2, from: from$1, to, offset: offset$1 = 1 }) => {
201069
201091
  const startPos = Math.max(from$1 - offset$1, 0);
201070
201092
  const endPos = Math.min(to + offset$1, doc$2.content.size);
@@ -213544,7 +213566,7 @@ var Node$13 = class Node$14 {
213544
213566
  this.#onCursorsUpdate = null;
213545
213567
  this.#isSetup = false;
213546
213568
  }
213547
- }, WORD_CHARACTER_REGEX, SEMANTIC_FOOTNOTES_HEADING_BLOCK_ID = "__sd_semantic_footnotes_heading", SEMANTIC_FOOTNOTE_BLOCK_ID_PREFIX = "__sd_semantic_footnote", MULTI_CLICK_TIME_THRESHOLD_MS = 400, MULTI_CLICK_DISTANCE_THRESHOLD_PX = 5, AUTO_SCROLL_EDGE_PX = 32, AUTO_SCROLL_MAX_SPEED_PX = 24, SCROLL_DETECTION_TOLERANCE_PX = 1, clamp = (value, min$2, max$2) => Math.max(min$2, Math.min(max$2, value)), EditorInputManager = class {
213569
+ }, WORD_CHARACTER_REGEX, SEMANTIC_FOOTNOTES_HEADING_BLOCK_ID = "__sd_semantic_footnotes_heading", SEMANTIC_FOOTNOTE_BLOCK_ID_PREFIX = "__sd_semantic_footnote", MULTI_CLICK_TIME_THRESHOLD_MS = 400, MULTI_CLICK_DISTANCE_THRESHOLD_PX = 5, AUTO_SCROLL_EDGE_PX = 32, AUTO_SCROLL_MAX_SPEED_PX = 24, SCROLL_DETECTION_TOLERANCE_PX = 1, COMMENT_HIGHLIGHT_SELECTOR = ".superdoc-comment-highlight", clamp = (value, min$2, max$2) => Math.max(min$2, Math.min(max$2, value)), EditorInputManager = class {
213548
213570
  #deps = null;
213549
213571
  #callbacks = {};
213550
213572
  #isDragging = false;
@@ -214020,6 +214042,9 @@ var Node$13 = class Node$14 {
214020
214042
  this.#handleAnnotationClick(event, annotationEl);
214021
214043
  return;
214022
214044
  }
214045
+ const editor = this.#deps.getEditor();
214046
+ if (this.#handleRepeatClickOnActiveComment(event, target, editor))
214047
+ return;
214023
214048
  const layoutState = this.#deps.getLayoutState();
214024
214049
  if (!layoutState.layout) {
214025
214050
  this.#handleClickWithoutLayout(event, isDraggableAnnotation);
@@ -214055,7 +214080,6 @@ var Node$13 = class Node$14 {
214055
214080
  x,
214056
214081
  y: y$1
214057
214082
  }, viewportHost, event.clientX, event.clientY, pageGeometryHelper ?? undefined);
214058
- const editor = this.#deps.getEditor();
214059
214083
  const doc$2 = editor.state?.doc;
214060
214084
  const epochMapper = this.#deps.getEpochMapper();
214061
214085
  const mapped = rawHit && doc$2 ? epochMapper.mapPosFromLayoutToCurrentDetailed(rawHit.pos, rawHit.layoutEpoch, 1) : null;
@@ -214886,6 +214910,18 @@ var Node$13 = class Node$14 {
214886
214910
  editorDom.focus();
214887
214911
  view?.focus();
214888
214912
  }
214913
+ #handleRepeatClickOnActiveComment(event, target, editor) {
214914
+ const activeThreadId = getActiveCommentThreadId(editor);
214915
+ if (!shouldIgnoreRepeatClickOnActiveComment(target, activeThreadId))
214916
+ return false;
214917
+ event.preventDefault();
214918
+ this.#focusEditor();
214919
+ editor.emit?.("commentsUpdate", {
214920
+ type: comments_module_events.SELECTED,
214921
+ activeCommentId: activeThreadId
214922
+ });
214923
+ return true;
214924
+ }
214889
214925
  }, createDefaultScheduler = () => {
214890
214926
  if (typeof window !== "undefined" && typeof window.requestAnimationFrame === "function")
214891
214927
  return {
@@ -222047,7 +222083,7 @@ var Node$13 = class Node$14 {
222047
222083
  return false;
222048
222084
  return Boolean(checker(attrs));
222049
222085
  }, SuperToolbar, ICONS, TEXTS, tableActionsOptions;
222050
- var init_src_DUt8_PYY_es = __esm(() => {
222086
+ var init_src_wsfRydup_es = __esm(() => {
222051
222087
  init_rolldown_runtime_B2q5OVn9_es();
222052
222088
  init_SuperConverter_DBTvnSJQ_es();
222053
222089
  init_jszip_ChlR43oI_es();
@@ -224618,10 +224654,15 @@ ${err.toString()}`);
224618
224654
  dispatch(tr);
224619
224655
  return true;
224620
224656
  },
224621
- setCursorById: (id2) => ({ state, editor }) => {
224657
+ setCursorById: (id2, options = {}) => ({ state, editor }) => {
224622
224658
  const { from: from$1 } = findRangeById(state.doc, id2) || {};
224623
224659
  if (from$1 != null) {
224624
224660
  state.tr.setSelection(TextSelection2.create(state.doc, from$1));
224661
+ if (options.preferredActiveThreadId)
224662
+ state.tr.setMeta(CommentsPluginKey, {
224663
+ type: "setCursorById",
224664
+ preferredActiveThreadId: options.preferredActiveThreadId
224665
+ });
224625
224666
  if (editor.view && typeof editor.view.focus === "function")
224626
224667
  editor.view.focus();
224627
224668
  return true;
@@ -224689,6 +224730,8 @@ ${err.toString()}`);
224689
224730
  let currentActiveThread = getActiveCommentId(newEditorState.doc, selection);
224690
224731
  if (trChangedActiveComment)
224691
224732
  currentActiveThread = meta2.activeThreadId;
224733
+ if (meta2?.type === "setCursorById" && meta2.preferredActiveThreadId && selectionContainsThread(newEditorState.doc, selection, meta2.preferredActiveThreadId))
224734
+ currentActiveThread = meta2.preferredActiveThreadId;
224692
224735
  if (pluginState.activeThreadId !== currentActiveThread) {
224693
224736
  pluginState.activeThreadId = currentActiveThread;
224694
224737
  const update = {
@@ -241992,6 +242035,39 @@ function print() { __p += __j.call(arguments, '') }
241992
242035
  } else
241993
242036
  return false;
241994
242037
  }
242038
+ scrollThreadAnchorToClientY(threadId, targetClientY, options = {}) {
242039
+ if (!threadId || !Number.isFinite(targetClientY))
242040
+ return false;
242041
+ const threadPosition = this.#collectCommentPositions()[threadId];
242042
+ if (!threadPosition)
242043
+ return false;
242044
+ const currentTop = this.getSelectionBounds(threadPosition.start, threadPosition.end)?.bounds?.top;
242045
+ if (!Number.isFinite(currentTop))
242046
+ return false;
242047
+ const deltaY = currentTop - targetClientY;
242048
+ if (Math.abs(deltaY) < 1)
242049
+ return true;
242050
+ const behavior = options.behavior ?? "auto";
242051
+ const scrollTarget = this.#scrollContainer ?? this.#visibleHost;
242052
+ if (scrollTarget instanceof Window) {
242053
+ const currentScrollY = scrollTarget.scrollY ?? scrollTarget.pageYOffset ?? 0;
242054
+ scrollTarget.scrollTo({
242055
+ top: currentScrollY + deltaY,
242056
+ behavior
242057
+ });
242058
+ return true;
242059
+ }
242060
+ if (scrollTarget instanceof HTMLElement) {
242061
+ const maxScrollTop = Math.max(0, scrollTarget.scrollHeight - scrollTarget.clientHeight);
242062
+ const nextScrollTop = Math.max(0, Math.min(maxScrollTop, scrollTarget.scrollTop + deltaY));
242063
+ scrollTarget.scrollTo({
242064
+ top: nextScrollTop,
242065
+ behavior
242066
+ });
242067
+ return true;
242068
+ }
242069
+ return false;
242070
+ }
241995
242071
  #findElementAtPosition(pageEl, pos) {
241996
242072
  const elements = Array.from(pageEl.querySelectorAll("[data-pm-start][data-pm-end]"));
241997
242073
  let bestMatch = null;
@@ -244017,18 +244093,32 @@ function print() { __p += __j.call(arguments, '') }
244017
244093
  }
244018
244094
  #applyZoom() {
244019
244095
  if (this.#isSemanticFlowMode()) {
244020
- this.#viewportHost.style.width = "100%";
244096
+ const zoom$1 = this.#layoutOptions.zoom ?? 1;
244021
244097
  this.#viewportHost.style.minWidth = "";
244022
244098
  this.#viewportHost.style.minHeight = "";
244023
- this.#viewportHost.style.transform = "";
244024
- this.#painterHost.style.width = "100%";
244025
- this.#painterHost.style.minHeight = "";
244026
- this.#painterHost.style.transformOrigin = "";
244027
- this.#painterHost.style.transform = "";
244028
- this.#selectionOverlay.style.width = "100%";
244029
- this.#selectionOverlay.style.height = "100%";
244030
- this.#selectionOverlay.style.transformOrigin = "";
244031
- this.#selectionOverlay.style.transform = "";
244099
+ if (zoom$1 === 1) {
244100
+ this.#viewportHost.style.width = "100%";
244101
+ this.#viewportHost.style.transform = "";
244102
+ this.#painterHost.style.width = "100%";
244103
+ this.#painterHost.style.minHeight = "";
244104
+ this.#painterHost.style.transformOrigin = "";
244105
+ this.#painterHost.style.transform = "";
244106
+ this.#selectionOverlay.style.width = "100%";
244107
+ this.#selectionOverlay.style.height = "100%";
244108
+ this.#selectionOverlay.style.transformOrigin = "";
244109
+ this.#selectionOverlay.style.transform = "";
244110
+ } else {
244111
+ this.#viewportHost.style.width = `${100 / zoom$1}%`;
244112
+ this.#viewportHost.style.transform = "";
244113
+ this.#painterHost.style.width = "100%";
244114
+ this.#painterHost.style.minHeight = "";
244115
+ this.#painterHost.style.transformOrigin = "top left";
244116
+ this.#painterHost.style.transform = `scale(${zoom$1})`;
244117
+ this.#selectionOverlay.style.width = "100%";
244118
+ this.#selectionOverlay.style.height = "100%";
244119
+ this.#selectionOverlay.style.transformOrigin = "top left";
244120
+ this.#selectionOverlay.style.transform = `scale(${zoom$1})`;
244121
+ }
244032
244122
  return;
244033
244123
  }
244034
244124
  const zoom = this.#layoutOptions.zoom ?? 1;
@@ -254491,7 +254581,12 @@ function print() { __p += __j.call(arguments, '') }
254491
254581
  const isSeparator = (item) => item.type === "separator";
254492
254582
  const isOverflow = (item) => item.type === "overflow";
254493
254583
  const getExpanded = (item) => {
254494
- return Boolean(item?.expand?.value);
254584
+ if (!item)
254585
+ return false;
254586
+ const expand = item.expand;
254587
+ if (typeof expand === "object" && expand !== null && "value" in expand)
254588
+ return Boolean(expand.value);
254589
+ return Boolean(expand);
254495
254590
  };
254496
254591
  const setExpanded = (item, open2) => {
254497
254592
  if (!item?.expand)
@@ -254787,7 +254882,7 @@ function print() { __p += __j.call(arguments, '') }
254787
254882
  }), 128))], 36);
254788
254883
  };
254789
254884
  }
254790
- }, [["__scopeId", "data-v-f7aade55"]]);
254885
+ }, [["__scopeId", "data-v-069cac8b"]]);
254791
254886
  Toolbar_default = /* @__PURE__ */ __plugin_vue_export_helper_default({
254792
254887
  __name: "Toolbar",
254793
254888
  emits: [
@@ -255897,7 +255992,7 @@ var init_zipper_DqXT7uTa_es = __esm(() => {
255897
255992
 
255898
255993
  // ../../packages/superdoc/dist/super-editor.es.js
255899
255994
  var init_super_editor_es = __esm(() => {
255900
- init_src_DUt8_PYY_es();
255995
+ init_src_wsfRydup_es();
255901
255996
  init_SuperConverter_DBTvnSJQ_es();
255902
255997
  init_jszip_ChlR43oI_es();
255903
255998
  init_xml_js_BtmJ6bNs_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.2.0-next.144",
3
+ "version": "0.2.0-next.147",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -22,19 +22,19 @@
22
22
  "typescript": "^5.9.2",
23
23
  "@superdoc/document-api": "0.0.1",
24
24
  "@superdoc/pm-adapter": "0.0.0",
25
- "@superdoc/super-editor": "0.0.1",
26
- "superdoc": "1.18.0"
25
+ "superdoc": "1.18.0",
26
+ "@superdoc/super-editor": "0.0.1"
27
27
  },
28
28
  "module": "src/index.ts",
29
29
  "publishConfig": {
30
30
  "access": "public"
31
31
  },
32
32
  "optionalDependencies": {
33
- "@superdoc-dev/cli-darwin-arm64": "0.2.0-next.144",
34
- "@superdoc-dev/cli-linux-x64": "0.2.0-next.144",
35
- "@superdoc-dev/cli-darwin-x64": "0.2.0-next.144",
36
- "@superdoc-dev/cli-linux-arm64": "0.2.0-next.144",
37
- "@superdoc-dev/cli-windows-x64": "0.2.0-next.144"
33
+ "@superdoc-dev/cli-darwin-arm64": "0.2.0-next.147",
34
+ "@superdoc-dev/cli-darwin-x64": "0.2.0-next.147",
35
+ "@superdoc-dev/cli-linux-x64": "0.2.0-next.147",
36
+ "@superdoc-dev/cli-linux-arm64": "0.2.0-next.147",
37
+ "@superdoc-dev/cli-windows-x64": "0.2.0-next.147"
38
38
  },
39
39
  "scripts": {
40
40
  "dev": "bun run src/index.ts",