@superdoc-dev/cli 0.8.0-next.25 → 0.8.0-next.26

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 +153 -19
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -11238,7 +11238,10 @@ var init_schemas = __esm(() => {
11238
11238
  commentId: { type: "string" },
11239
11239
  text: { type: "string", description: "Updated comment text." },
11240
11240
  target: textAddressSchema,
11241
- status: { enum: ["resolved"], description: "Set comment status. Use 'resolved' to mark as resolved." },
11241
+ status: {
11242
+ enum: ["resolved", "active"],
11243
+ description: "Set comment status. Use 'resolved' to resolve a comment, or 'active' to reopen a previously resolved comment (lifecycle inverse)."
11244
+ },
11242
11245
  isInternal: {
11243
11246
  type: "boolean",
11244
11247
  description: "When true, marks the comment as internal (hidden from external collaborators)."
@@ -13931,8 +13934,8 @@ function validatePatchCommentInput(input) {
13931
13934
  value: text
13932
13935
  });
13933
13936
  }
13934
- if (status !== undefined && status !== "resolved") {
13935
- throw new DocumentApiValidationError("INVALID_INPUT", `status must be "resolved", got "${String(status)}".`, {
13937
+ if (status !== undefined && status !== "resolved" && status !== "active") {
13938
+ throw new DocumentApiValidationError("INVALID_INPUT", `status must be "resolved" or "active", got "${String(status)}".`, {
13936
13939
  field: "status",
13937
13940
  value: status
13938
13941
  });
@@ -13968,6 +13971,9 @@ function executeCommentsPatch(adapter, input, options) {
13968
13971
  if (input.status === "resolved") {
13969
13972
  return adapter.resolve({ commentId: input.commentId }, options);
13970
13973
  }
13974
+ if (input.status === "active") {
13975
+ return adapter.reopen({ commentId: input.commentId }, options);
13976
+ }
13971
13977
  if (input.isInternal !== undefined) {
13972
13978
  return adapter.setInternal({ commentId: input.commentId, isInternal: input.isInternal }, options);
13973
13979
  }
@@ -65857,7 +65863,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
65857
65863
  emptyOptions2 = {};
65858
65864
  });
65859
65865
 
65860
- // ../../packages/superdoc/dist/chunks/SuperConverter-lmyr0gmB.es.js
65866
+ // ../../packages/superdoc/dist/chunks/SuperConverter-CyrStvpz.es.js
65861
65867
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
65862
65868
  const fieldValue = extension$1.config[field];
65863
65869
  if (typeof fieldValue === "function")
@@ -68644,8 +68650,8 @@ function validatePatchCommentInput2(input) {
68644
68650
  field: "text",
68645
68651
  value: text$2
68646
68652
  });
68647
- if (status !== undefined && status !== "resolved")
68648
- throw new DocumentApiValidationError2("INVALID_INPUT", `status must be "resolved", got "${String(status)}".`, {
68653
+ if (status !== undefined && status !== "resolved" && status !== "active")
68654
+ throw new DocumentApiValidationError2("INVALID_INPUT", `status must be "resolved" or "active", got "${String(status)}".`, {
68649
68655
  field: "status",
68650
68656
  value: status
68651
68657
  });
@@ -68683,6 +68689,8 @@ function executeCommentsPatch2(adapter, input, options) {
68683
68689
  }, options);
68684
68690
  if (input.status === "resolved")
68685
68691
  return adapter.resolve({ commentId: input.commentId }, options);
68692
+ if (input.status === "active")
68693
+ return adapter.reopen({ commentId: input.commentId }, options);
68686
68694
  if (input.isInternal !== undefined)
68687
68695
  return adapter.setInternal({
68688
68696
  commentId: input.commentId,
@@ -118262,7 +118270,7 @@ var isRegExp = (value) => {
118262
118270
  state.kern = kernNode.attributes["w:val"];
118263
118271
  }
118264
118272
  }, SuperConverter;
118265
- var init_SuperConverter_lmyr0gmB_es = __esm(() => {
118273
+ var init_SuperConverter_CyrStvpz_es = __esm(() => {
118266
118274
  init_rolldown_runtime_Bg48TavK_es();
118267
118275
  init_jszip_C49i9kUs_es();
118268
118276
  init_xml_js_CqGKpaft_es();
@@ -130712,8 +130720,8 @@ var init_SuperConverter_lmyr0gmB_es = __esm(() => {
130712
130720
  },
130713
130721
  target: textAddressSchema2,
130714
130722
  status: {
130715
- enum: ["resolved"],
130716
- description: "Set comment status. Use 'resolved' to mark as resolved."
130723
+ enum: ["resolved", "active"],
130724
+ description: "Set comment status. Use 'resolved' to resolve a comment, or 'active' to reopen a previously resolved comment (lifecycle inverse)."
130717
130725
  },
130718
130726
  isInternal: {
130719
130727
  type: "boolean",
@@ -155861,7 +155869,7 @@ var init_SuperConverter_lmyr0gmB_es = __esm(() => {
155861
155869
  };
155862
155870
  });
155863
155871
 
155864
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-CVKqElqj.es.js
155872
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-JcG-eLAZ.es.js
155865
155873
  function parseSizeUnit(val = "0") {
155866
155874
  const length3 = val.toString() || "0";
155867
155875
  const value = Number.parseFloat(length3);
@@ -158483,8 +158491,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
158483
158491
  }
158484
158492
  };
158485
158493
  };
158486
- var init_create_headless_toolbar_CVKqElqj_es = __esm(() => {
158487
- init_SuperConverter_lmyr0gmB_es();
158494
+ var init_create_headless_toolbar_JcG_eLAZ_es = __esm(() => {
158495
+ init_SuperConverter_CyrStvpz_es();
158488
158496
  init_constants_DrU4EASo_es();
158489
158497
  init_dist_B8HfvhaK_es();
158490
158498
  CSS_DIMENSION_REGEX = /[\d-.]+(\w+)$/;
@@ -207171,7 +207179,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
207171
207179
  init_remark_gfm_BhnWr3yf_es();
207172
207180
  });
207173
207181
 
207174
- // ../../packages/superdoc/dist/chunks/src-B2eovI4l.es.js
207182
+ // ../../packages/superdoc/dist/chunks/src-4pRutOwm.es.js
207175
207183
  function deleteProps(obj, propOrProps) {
207176
207184
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
207177
207185
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -229551,6 +229559,50 @@ function resolveCommentHandler(editor, input2, options) {
229551
229559
  updated: [toCommentAddress(identity.commentId)]
229552
229560
  };
229553
229561
  }
229562
+ function reopenCommentHandler(editor, input2, options) {
229563
+ const reopenComment = requireEditorCommand(editor.commands?.reopenComment, "comments.patch (reopenComment)");
229564
+ const store = getCommentEntityStore(editor);
229565
+ const identity = resolveCommentIdentity(editor, input2.commentId);
229566
+ const existing = findCommentEntity(store, identity.commentId);
229567
+ const isAnchored = identity.anchors.length > 0;
229568
+ const isResolvedInStore = existing ? isCommentResolved(existing) : false;
229569
+ const isResolvedInDoc = isAnchored && identity.anchors.every((a2) => a2.status === "resolved");
229570
+ if (!isResolvedInStore && !isResolvedInDoc)
229571
+ return {
229572
+ success: false,
229573
+ failure: {
229574
+ code: "NO_OP",
229575
+ message: "Comment is already active."
229576
+ }
229577
+ };
229578
+ const storedInternal = existing?.isInternal;
229579
+ const internalOverride = typeof storedInternal === "boolean" ? storedInternal : undefined;
229580
+ if (executeDomainCommand(editor, () => {
229581
+ const didReopen = reopenComment({
229582
+ commentId: identity.commentId,
229583
+ importedId: identity.importedId,
229584
+ internal: internalOverride
229585
+ });
229586
+ if (didReopen)
229587
+ upsertCommentEntity(store, identity.commentId, {
229588
+ importedId: identity.importedId,
229589
+ isDone: false,
229590
+ resolvedTime: null
229591
+ });
229592
+ return Boolean(didReopen);
229593
+ }, { expectedRevision: options?.expectedRevision }).steps[0]?.effect !== "changed")
229594
+ return {
229595
+ success: false,
229596
+ failure: {
229597
+ code: "NO_OP",
229598
+ message: "Comment reopen produced no change."
229599
+ }
229600
+ };
229601
+ return {
229602
+ success: true,
229603
+ updated: [toCommentAddress(identity.commentId)]
229604
+ };
229605
+ }
229554
229606
  function removeCommentHandler(editor, input2, options) {
229555
229607
  const removeComment = requireEditorCommand(editor.commands?.removeComment, "comments.remove (removeComment)");
229556
229608
  const store = getCommentEntityStore(editor);
@@ -229705,6 +229757,7 @@ function createCommentsWrapper(editor) {
229705
229757
  reply: (input2, options) => replyToCommentHandler(editor, input2, options),
229706
229758
  move: (input2, options) => moveCommentHandler(editor, input2, options),
229707
229759
  resolve: (input2, options) => resolveCommentHandler(editor, input2, options),
229760
+ reopen: (input2, options) => reopenCommentHandler(editor, input2, options),
229708
229761
  remove: (input2, options) => removeCommentHandler(editor, input2, options),
229709
229762
  setInternal: (input2, options) => setCommentInternalHandler(editor, input2, options),
229710
229763
  setActive: (input2, options) => setCommentActiveHandler(editor, input2, options),
@@ -271864,6 +271917,75 @@ var Node$13 = class Node$14 {
271864
271917
  });
271865
271918
  dispatch(tr);
271866
271919
  return true;
271920
+ }, getCommentRangeAnchorsById = (commentId, doc$12, importedId) => {
271921
+ const anchors = [];
271922
+ doc$12.descendants((node3, pos) => {
271923
+ const typeName = node3.type?.name;
271924
+ if (typeName !== "commentRangeStart" && typeName !== "commentRangeEnd")
271925
+ return;
271926
+ const wid = node3.attrs?.["w:id"];
271927
+ if (wid !== commentId && (!importedId || wid !== importedId))
271928
+ return;
271929
+ anchors.push({
271930
+ pos,
271931
+ type: typeName === "commentRangeStart" ? "start" : "end",
271932
+ internal: !!node3.attrs?.internal
271933
+ });
271934
+ });
271935
+ const pairs = [];
271936
+ const stack = [];
271937
+ for (const anchor of anchors) {
271938
+ if (anchor.type === "start") {
271939
+ stack.push({
271940
+ pos: anchor.pos,
271941
+ internal: anchor.internal
271942
+ });
271943
+ continue;
271944
+ }
271945
+ const opener = stack.shift();
271946
+ if (!opener)
271947
+ continue;
271948
+ pairs.push({
271949
+ from: opener.pos,
271950
+ to: anchor.pos,
271951
+ internal: opener.internal
271952
+ });
271953
+ }
271954
+ return {
271955
+ pairs,
271956
+ anchorNodePositions: anchors.map((a2) => a2.pos)
271957
+ };
271958
+ }, reopenCommentById = ({ commentId, importedId, internal, state, tr, dispatch }) => {
271959
+ const { schema } = state;
271960
+ const markType = schema.marks?.[CommentMarkName];
271961
+ if (!markType)
271962
+ return false;
271963
+ const { pairs, anchorNodePositions } = getCommentRangeAnchorsById(commentId, state.doc, importedId);
271964
+ if (!pairs.length)
271965
+ return false;
271966
+ pairs.forEach(({ from: from$1, to, internal: anchorInternal }) => {
271967
+ const mappedFrom = tr.mapping.map(from$1);
271968
+ const mappedTo = tr.mapping.map(to);
271969
+ if (mappedTo <= mappedFrom)
271970
+ return;
271971
+ const attrs = {
271972
+ commentId,
271973
+ importedId,
271974
+ internal: typeof internal === "boolean" ? internal : anchorInternal
271975
+ };
271976
+ tr.addMark(mappedFrom + 1, mappedTo, markType.create(attrs));
271977
+ });
271978
+ anchorNodePositions.map((pos) => tr.mapping.map(pos)).sort((a2, b$1) => b$1 - a2).forEach((pos) => {
271979
+ const node3 = tr.doc.nodeAt(pos);
271980
+ if (!node3)
271981
+ return;
271982
+ const typeName = node3.type?.name;
271983
+ if (typeName !== "commentRangeStart" && typeName !== "commentRangeEnd")
271984
+ return;
271985
+ tr.delete(pos, pos + node3.nodeSize);
271986
+ });
271987
+ dispatch(tr);
271988
+ return true;
271867
271989
  }, prepareCommentsForExport = (doc$12, tr, schema, comments = []) => {
271868
271990
  const commentMap = /* @__PURE__ */ new Map;
271869
271991
  comments.forEach((c) => {
@@ -296136,12 +296258,12 @@ menclose::after {
296136
296258
  return;
296137
296259
  console.log(...args$1);
296138
296260
  }, 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;
296139
- var init_src_B2eovI4l_es = __esm(() => {
296261
+ var init_src_4pRutOwm_es = __esm(() => {
296140
296262
  init_rolldown_runtime_Bg48TavK_es();
296141
- init_SuperConverter_lmyr0gmB_es();
296263
+ init_SuperConverter_CyrStvpz_es();
296142
296264
  init_jszip_C49i9kUs_es();
296143
296265
  init_uuid_qzgm05fK_es();
296144
- init_create_headless_toolbar_CVKqElqj_es();
296266
+ init_create_headless_toolbar_JcG_eLAZ_es();
296145
296267
  init_constants_DrU4EASo_es();
296146
296268
  init_dist_B8HfvhaK_es();
296147
296269
  init_unified_Dsuw2be5_es();
@@ -299485,6 +299607,17 @@ ${err.toString()}`);
299485
299607
  dispatch
299486
299608
  });
299487
299609
  },
299610
+ reopenComment: ({ commentId, importedId, internal }) => ({ tr, dispatch, state }) => {
299611
+ tr.setMeta(CommentsPluginKey, { event: "update" });
299612
+ return reopenCommentById({
299613
+ commentId,
299614
+ importedId,
299615
+ internal,
299616
+ state,
299617
+ tr,
299618
+ dispatch
299619
+ });
299620
+ },
299488
299621
  editComment: ({ commentId, importedId, content: content3, text: text5 }) => ({ editor }) => {
299489
299622
  const nextCommentId = commentId ?? importedId;
299490
299623
  if (!nextCommentId)
@@ -318845,6 +318978,7 @@ function print() { __p += __j.call(arguments, '') }
318845
318978
  "editComment",
318846
318979
  "moveComment",
318847
318980
  "resolveComment",
318981
+ "reopenComment",
318848
318982
  "setCommentInternal"
318849
318983
  ],
318850
318984
  "comments.delete": ["removeComment"],
@@ -333038,11 +333172,11 @@ var init_zipper_DbkgrypV_es = __esm(() => {
333038
333172
 
333039
333173
  // ../../packages/superdoc/dist/super-editor.es.js
333040
333174
  var init_super_editor_es = __esm(() => {
333041
- init_src_B2eovI4l_es();
333042
- init_SuperConverter_lmyr0gmB_es();
333175
+ init_src_4pRutOwm_es();
333176
+ init_SuperConverter_CyrStvpz_es();
333043
333177
  init_jszip_C49i9kUs_es();
333044
333178
  init_xml_js_CqGKpaft_es();
333045
- init_create_headless_toolbar_CVKqElqj_es();
333179
+ init_create_headless_toolbar_JcG_eLAZ_es();
333046
333180
  init_constants_DrU4EASo_es();
333047
333181
  init_dist_B8HfvhaK_es();
333048
333182
  init_unified_Dsuw2be5_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.8.0-next.25",
3
+ "version": "0.8.0-next.26",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -24,21 +24,21 @@
24
24
  "@types/node": "22.19.2",
25
25
  "@types/ws": "^8.5.13",
26
26
  "typescript": "^5.9.2",
27
- "@superdoc/pm-adapter": "0.0.0",
28
27
  "@superdoc/document-api": "0.0.1",
29
28
  "@superdoc/super-editor": "0.0.1",
30
- "superdoc": "1.29.0"
29
+ "superdoc": "1.29.0",
30
+ "@superdoc/pm-adapter": "0.0.0"
31
31
  },
32
32
  "module": "src/index.ts",
33
33
  "publishConfig": {
34
34
  "access": "public"
35
35
  },
36
36
  "optionalDependencies": {
37
- "@superdoc-dev/cli-darwin-arm64": "0.8.0-next.25",
38
- "@superdoc-dev/cli-darwin-x64": "0.8.0-next.25",
39
- "@superdoc-dev/cli-linux-x64": "0.8.0-next.25",
40
- "@superdoc-dev/cli-linux-arm64": "0.8.0-next.25",
41
- "@superdoc-dev/cli-windows-x64": "0.8.0-next.25"
37
+ "@superdoc-dev/cli-darwin-arm64": "0.8.0-next.26",
38
+ "@superdoc-dev/cli-linux-x64": "0.8.0-next.26",
39
+ "@superdoc-dev/cli-darwin-x64": "0.8.0-next.26",
40
+ "@superdoc-dev/cli-linux-arm64": "0.8.0-next.26",
41
+ "@superdoc-dev/cli-windows-x64": "0.8.0-next.26"
42
42
  },
43
43
  "scripts": {
44
44
  "predev": "node scripts/ensure-superdoc-build.js",