superdoc 2.4.0-next.8 → 2.4.0-next.9

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.
@@ -8229,10 +8229,14 @@ function createSuperDocUI(options) {
8229
8229
  const op = commentsApi?.create;
8230
8230
  if (typeof op !== "function") return failedReceipt("comments.create is unavailable.");
8231
8231
  const fallback = failedReceipt("comments.create failed.");
8232
- return safeCall(() => settleWorkflowReceipt(op.call(commentsApi, {
8233
- target: capture.target ?? capture.selectionTarget,
8234
- text: input.text
8235
- }), fallback), fallback);
8232
+ return safeCall(() => {
8233
+ const target = capture && typeof capture === "object" ? capture.target ?? capture.selectionTarget : null;
8234
+ if (target == null) return failedReceipt("A range selection is required to comment.", "NO_SELECTION");
8235
+ return settleWorkflowReceipt(op.call(commentsApi, {
8236
+ target,
8237
+ text: input.text
8238
+ }), fallback);
8239
+ }, fallback);
8236
8240
  },
8237
8241
  createFromSelection: (input) => {
8238
8242
  const refusal = commentWriteRefusal();
@@ -8264,6 +8268,18 @@ function createSuperDocUI(options) {
8264
8268
  text: input.text
8265
8269
  }), fallback), fallback);
8266
8270
  },
8271
+ edit: (commentId, input) => {
8272
+ const refusal = commentWriteRefusal();
8273
+ if (refusal) return refusal;
8274
+ const commentsApi = getDoc()?.comments;
8275
+ const op = commentsApi?.patch;
8276
+ if (typeof op !== "function") return failedReceipt("comments.patch is unavailable.");
8277
+ const fallback = failedReceipt("comments.patch failed.");
8278
+ return safeCall(() => settleWorkflowReceipt(op.call(commentsApi, {
8279
+ commentId,
8280
+ text: input.text
8281
+ }), fallback), fallback);
8282
+ },
8267
8283
  resolve: (commentId) => patchCommentStatus(commentId, "resolved"),
8268
8284
  reopen: (commentId) => patchCommentStatus(commentId, "active"),
8269
8285
  delete: (commentId) => {
@@ -8007,10 +8007,14 @@ function createSuperDocUI(options) {
8007
8007
  const op = commentsApi?.create;
8008
8008
  if (typeof op !== "function") return failedReceipt("comments.create is unavailable.");
8009
8009
  const fallback = failedReceipt("comments.create failed.");
8010
- return safeCall(() => settleWorkflowReceipt(op.call(commentsApi, {
8011
- target: capture.target ?? capture.selectionTarget,
8012
- text: input.text
8013
- }), fallback), fallback);
8010
+ return safeCall(() => {
8011
+ const target = capture && typeof capture === "object" ? capture.target ?? capture.selectionTarget : null;
8012
+ if (target == null) return failedReceipt("A range selection is required to comment.", "NO_SELECTION");
8013
+ return settleWorkflowReceipt(op.call(commentsApi, {
8014
+ target,
8015
+ text: input.text
8016
+ }), fallback);
8017
+ }, fallback);
8014
8018
  },
8015
8019
  createFromSelection: (input) => {
8016
8020
  const refusal = commentWriteRefusal();
@@ -8042,6 +8046,18 @@ function createSuperDocUI(options) {
8042
8046
  text: input.text
8043
8047
  }), fallback), fallback);
8044
8048
  },
8049
+ edit: (commentId, input) => {
8050
+ const refusal = commentWriteRefusal();
8051
+ if (refusal) return refusal;
8052
+ const commentsApi = getDoc()?.comments;
8053
+ const op = commentsApi?.patch;
8054
+ if (typeof op !== "function") return failedReceipt("comments.patch is unavailable.");
8055
+ const fallback = failedReceipt("comments.patch failed.");
8056
+ return safeCall(() => settleWorkflowReceipt(op.call(commentsApi, {
8057
+ commentId,
8058
+ text: input.text
8059
+ }), fallback), fallback);
8060
+ },
8045
8061
  resolve: (commentId) => patchCommentStatus(commentId, "resolved"),
8046
8062
  reopen: (commentId) => patchCommentStatus(commentId, "active"),
8047
8063
  delete: (commentId) => {
@@ -7,7 +7,7 @@ const COLLABORATION_UPGRADE_ENGINE_MINIMUM_NODE_MAJOR = 20;
7
7
  var PRIVATE_ENGINE_INFO = (0, __superdoc_docx_engine_collaboration_upgrade_engine.getCollaborationUpgradeEngineInfo)();
8
8
  var ENGINE_INFO = Object.freeze({
9
9
  ...PRIVATE_ENGINE_INFO,
10
- superdocVersion: "2.4.0-next.8",
10
+ superdocVersion: "2.4.0-next.9",
11
11
  roomSchemaVersion: Object.freeze({ ...PRIVATE_ENGINE_INFO.roomSchemaVersion }),
12
12
  supportedBundleVersions: SUPPORTED_COLLABORATION_UPGRADE_BUNDLE_VERSIONS,
13
13
  supportedV1ReaderContractVersions: SUPPORTED_V1_READER_CONTRACT_VERSIONS
@@ -6,7 +6,7 @@ const COLLABORATION_UPGRADE_ENGINE_MINIMUM_NODE_MAJOR = 20;
6
6
  var PRIVATE_ENGINE_INFO = getCollaborationUpgradeEngineInfo$1();
7
7
  var ENGINE_INFO = Object.freeze({
8
8
  ...PRIVATE_ENGINE_INFO,
9
- superdocVersion: "2.4.0-next.8",
9
+ superdocVersion: "2.4.0-next.9",
10
10
  roomSchemaVersion: Object.freeze({ ...PRIVATE_ENGINE_INFO.roomSchemaVersion }),
11
11
  supportedBundleVersions: SUPPORTED_COLLABORATION_UPGRADE_BUNDLE_VERSIONS,
12
12
  supportedV1ReaderContractVersions: SUPPORTED_V1_READER_CONTRACT_VERSIONS
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_rolldown_runtime = require("../chunks/rolldown-runtime-1Y-nnZJ3.cjs");
3
- const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-sMXbYzhs.cjs");
3
+ const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-ByvmsAAG.cjs");
4
4
  let react = require("react");
5
5
  var SuperDocUIContext = (0, react.createContext)(null);
6
6
  function disposeOwnedUi(ref) {
@@ -1,4 +1,4 @@
1
- import { t as createSuperDocUI } from "../chunks/create-super-doc-ui-BquF8bnZ.es.js";
1
+ import { t as createSuperDocUI } from "../chunks/create-super-doc-ui-DBXOhHdW.es.js";
2
2
  import { createContext, createElement, useCallback, useContext, useEffect, useRef, useState } from "react";
3
3
  var SuperDocUIContext = createContext(null);
4
4
  function disposeOwnedUi(ref) {
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-sMXbYzhs.cjs");
2
+ const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-ByvmsAAG.cjs");
3
3
  exports.BUILT_IN_COMMAND_IDS = require_create_super_doc_ui.BUILT_IN_COMMAND_IDS;
4
4
  exports.createSuperDocUI = require_create_super_doc_ui.createSuperDocUI;
5
5
  exports.shallowEqual = require_create_super_doc_ui.shallowEqual;
@@ -1,2 +1,2 @@
1
- import { n as shallowEqual, r as BUILT_IN_COMMAND_IDS, t as createSuperDocUI } from "../chunks/create-super-doc-ui-BquF8bnZ.es.js";
1
+ import { n as shallowEqual, r as BUILT_IN_COMMAND_IDS, t as createSuperDocUI } from "../chunks/create-super-doc-ui-DBXOhHdW.es.js";
2
2
  export { BUILT_IN_COMMAND_IDS, createSuperDocUI, shallowEqual };
@@ -837,7 +837,19 @@ export interface CommentsHandle extends SnapshotSubscribable<CommentsSlice> {
837
837
  list(query?: CommentsListQuery): readonly CommentInfo[];
838
838
  /** Resolve a single comment by id from the best-known loaded state. */
839
839
  getById(commentId: string): CommentInfo | null;
840
- /** Create a comment from a frozen selection capture. */
840
+ /**
841
+ * Create a comment from a frozen selection capture.
842
+ *
843
+ * A capture carrying neither `target` nor `selectionTarget` fails closed with
844
+ * the same `NO_SELECTION` receipt {@link createFromSelection} mints for an
845
+ * empty selection, because both describe the same user-visible mistake:
846
+ * commenting with nothing selected. A capture that *has* a target which no
847
+ * longer resolves is a different failure, and keeps the Document API's own
848
+ * receipt so the reason stays specific.
849
+ *
850
+ * `capturedAt` is provenance for the consumer, not an expiry. A capture stays
851
+ * usable while its target resolves; elapsed time alone never invalidates it.
852
+ */
841
853
  createFromCapture(capture: CommentAnchorCapture, input: {
842
854
  text: string;
843
855
  }): WorkflowReceipt;
@@ -853,6 +865,18 @@ export interface CommentsHandle extends SnapshotSubscribable<CommentsSlice> {
853
865
  reply(commentId: string, input: {
854
866
  text: string;
855
867
  }): WorkflowReceipt;
868
+ /**
869
+ * Replace a comment's body text through the Document API
870
+ * (`comments.patch({ commentId, text })`).
871
+ *
872
+ * Gated by the comments `readOnly` policy like every other comment write.
873
+ * `allowResolve` is deliberately NOT consulted: that policy forbids only the
874
+ * resolve/reopen transition, and an application that may not resolve threads
875
+ * can still let an author correct their own wording.
876
+ */
877
+ edit(commentId: string, input: {
878
+ text: string;
879
+ }): WorkflowReceipt;
856
880
  /** Mark a comment resolved. */
857
881
  resolve(commentId: string): WorkflowReceipt;
858
882
  /** Reopen a resolved comment. */
package/dist/superdoc.cjs CHANGED
@@ -4,7 +4,7 @@ const require_blank_docx = require("./chunks/blank-docx-DP8RUPW-.cjs");
4
4
  const require_eventemitter3 = require("./chunks/eventemitter3-DqY4aSMf.cjs");
5
5
  const require_uuid = require("./chunks/uuid-CFp0WGVU.cjs");
6
6
  const require_jszip = require("./chunks/jszip-Cs9JBLlJ.cjs");
7
- const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-sMXbYzhs.cjs");
7
+ const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-ByvmsAAG.cjs");
8
8
  const require__plugin_vue_export_helper = require("./chunks/_plugin-vue_export-helper-CZ1Nl59K.cjs");
9
9
  const require_constants = require("./chunks/constants-D7TNtyJd.cjs");
10
10
  let vue = require("vue");
@@ -39357,7 +39357,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
39357
39357
  this.config.colors = shuffleArray(this.config.colors);
39358
39358
  this.userColorMap = /* @__PURE__ */ new Map();
39359
39359
  this.colorIndex = 0;
39360
- this.version = "2.4.0-next.8";
39360
+ this.version = "2.4.0-next.9";
39361
39361
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
39362
39362
  this.superdocId = config.superdocId || require_uuid.v4_default();
39363
39363
  this.colors = this.config.colors ?? [];
@@ -3,7 +3,7 @@ import { t as blank_default } from "./chunks/blank-docx-XRX6Ker2.es.js";
3
3
  import { t as import_eventemitter3 } from "./chunks/eventemitter3-Bt2s0X0a.es.js";
4
4
  import { t as v4_default } from "./chunks/uuid-B2Sqk-3p.es.js";
5
5
  import { a as init_dist$1, i as global, n as init_dist$2, o as Buffer, r as process$1, s as init_dist, t as require_jszip_min } from "./chunks/jszip-C8srOKAO.es.js";
6
- import { a as createV2ReviewMutationReconciler, c as DOM_CLASS_NAMES, i as isV2EditableTextMutationEvent, o as getV2TrackedChangeMutationImpact, s as composeAuthorColorResolver, t as createSuperDocUI } from "./chunks/create-super-doc-ui-BquF8bnZ.es.js";
6
+ import { a as createV2ReviewMutationReconciler, c as DOM_CLASS_NAMES, i as isV2EditableTextMutationEvent, o as getV2TrackedChangeMutationImpact, s as composeAuthorColorResolver, t as createSuperDocUI } from "./chunks/create-super-doc-ui-DBXOhHdW.es.js";
7
7
  import { t as __plugin_vue_export_helper_default } from "./chunks/_plugin-vue_export-helper-DSMAhhwD.es.js";
8
8
  import { n as PDF_TO_CSS_UNITS } from "./chunks/constants-BfH0br5u.es.js";
9
9
  import * as Vue from "vue";
@@ -39290,7 +39290,7 @@ var SuperDoc = class extends import_eventemitter3.default {
39290
39290
  this.config.colors = shuffleArray(this.config.colors);
39291
39291
  this.userColorMap = /* @__PURE__ */ new Map();
39292
39292
  this.colorIndex = 0;
39293
- this.version = "2.4.0-next.8";
39293
+ this.version = "2.4.0-next.9";
39294
39294
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
39295
39295
  this.superdocId = config.superdocId || v4_default();
39296
39296
  this.colors = this.config.colors ?? [];