superdoc 2.27.0-next.3 → 2.27.0-next.5

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 (38) hide show
  1. package/dist/chunks/{create-super-doc-ui-DK14sCrT.cjs → create-super-doc-ui-CqpZP17K.cjs} +34 -8
  2. package/dist/chunks/{create-super-doc-ui-BCQ5RHxy.es.js → create-super-doc-ui-mIZuVMA6.es.js} +29 -9
  3. package/dist/collaboration-upgrade-engine.cjs +1 -1
  4. package/dist/collaboration-upgrade-engine.es.js +1 -1
  5. package/dist/document-api/src/history/history.types.d.ts +0 -6
  6. package/dist/document-api/src/index.d.ts +1 -1
  7. package/dist/document-api/src/types/receipt.d.ts +2 -1
  8. package/dist/document-api/src/types/temporary-mutation.d.ts +16 -2
  9. package/dist/public/ui-react.cjs +1 -1
  10. package/dist/public/ui-react.es.js +1 -1
  11. package/dist/public/ui-vue.cjs +1 -1
  12. package/dist/public/ui-vue.es.js +1 -1
  13. package/dist/public/ui.cjs +1 -1
  14. package/dist/public/ui.es.js +1 -1
  15. package/dist/style.css +1 -1
  16. package/dist/style.layered.css +1 -1
  17. package/dist/superdoc/src/core/types/index.d.ts +3 -60
  18. package/dist/superdoc/src/core/v2-integration/v2-integration.d.ts +2 -5
  19. package/dist/superdoc/src/helpers/tracked-change-comment-lane.d.ts +1 -0
  20. package/dist/superdoc/src/helpers/v2-review-mutation-impact.d.ts +0 -6
  21. package/dist/superdoc/src/public/ui/types.d.ts +1 -1
  22. package/dist/superdoc/src/public/ui-react.d.ts +0 -5
  23. package/dist/superdoc/src/public/ui-vue.d.ts +0 -5
  24. package/dist/superdoc/src/public/ui.d.cts +2 -0
  25. package/dist/superdoc/src/public/ui.d.ts +1 -10
  26. package/dist/superdoc.cjs +10 -28
  27. package/dist/superdoc.es.js +6 -24
  28. package/dist-cdn/style.layered.css +1 -1
  29. package/dist-cdn/superdoc.min.css +1 -1
  30. package/dist-cdn/superdoc.min.js +38 -38
  31. package/package.json +2 -5
  32. package/dist/superdoc/src/components/CommentsLayer/comment-schemas.d.ts +0 -18
  33. package/dist/superdoc/src/components/CommentsLayer/types.d.ts +0 -3
  34. package/dist/superdoc/src/components/CommentsLayer/use-conversation.d.ts +0 -22
  35. package/dist/superdoc/src/components/CommentsLayer/use-floating-comment.d.ts +0 -11
  36. package/dist/superdoc/src/core/collaboration/room-overwrite.d.ts +0 -22
  37. package/dist/superdoc/src/core/index.d.ts +0 -1
  38. package/dist/superdoc/src/stores/hrbr-fields-store.d.ts +0 -43
@@ -1078,6 +1078,15 @@ var decodeLayoutStoryDataset = (raw) => {
1078
1078
  `${DOM_CLASS_NAMES.BLOCK_SDT}${DATA_ATTRS.SDT_ID}`;
1079
1079
  `${DATA_ATTRS.DRAGGABLE}`;
1080
1080
  //#endregion
1081
+ //#region src/helpers/tracked-change-comment-lane.ts
1082
+ var TRACKED_CHANGE_COMMENT_LANE_ID_PREFIX = "tc-comment:";
1083
+ function isSyntheticTrackedChangeCommentLaneItem(item) {
1084
+ if (!item || typeof item !== "object") return false;
1085
+ const { id, commentId } = item;
1086
+ const itemId = id ?? commentId;
1087
+ return typeof itemId === "string" && itemId.startsWith(TRACKED_CHANGE_COMMENT_LANE_ID_PREFIX);
1088
+ }
1089
+ //#endregion
1081
1090
  //#region src/public/ui/viewport-batch.ts
1082
1091
  /** No rendering or scrolling: read only geometry already acknowledged by the host. */
1083
1092
  async function readViewportBatch(input, read, generation, disposed) {
@@ -2635,12 +2644,6 @@ function getV2TrackedChangeMutationImpact(event) {
2635
2644
  }
2636
2645
  /**
2637
2646
  * Comment ids retired by a committed v2 mutation.
2638
- *
2639
- * AIDEV-NOTE: History commits put invalidated comment ids on `result`; cut and
2640
- * other command receipts use `receipt`. Same origin split as
2641
- * getV2TrackedChangeMutationImpact. Reading the wrong field, or treating a
2642
- * tracked-change entity as a comment, leaves a sidebar card after cut or
2643
- * undo/redo.
2644
2647
  */
2645
2648
  function collectV2InvalidatedCommentIds(event) {
2646
2649
  const removedIds = /* @__PURE__ */ new Set();
@@ -7607,9 +7610,26 @@ function createSuperDocUI(options) {
7607
7610
  recompute();
7608
7611
  return selection;
7609
7612
  };
7613
+ const realComments = (items) => items.filter((item) => !isSyntheticTrackedChangeCommentLaneItem(item));
7614
+ let lastWindowComments = null;
7615
+ const realCommentsOfWindow = (window) => {
7616
+ const items = window?.commentItems;
7617
+ if (!Array.isArray(items)) return null;
7618
+ const last = lastWindowComments;
7619
+ if (last?.source === items && shallowEqual(last.rows, items)) return last.real;
7620
+ lastWindowComments = {
7621
+ source: items,
7622
+ rows: [...items],
7623
+ real: realComments(items)
7624
+ };
7625
+ return lastWindowComments.real;
7626
+ };
7610
7627
  const readCommentsDirectory = () => {
7611
7628
  const listComments = hostMethod(getDoc()?.comments, "list");
7612
- return readAsync("comments", contentToken(), () => listComments ? listComments() : void 0, (raw) => raw && Array.isArray(raw.items) ? raw.items : []);
7629
+ return readAsync("comments", contentToken(), () => listComments ? listComments() : void 0, (raw) => {
7630
+ const items = isPlainObject(raw) ? raw.items : void 0;
7631
+ return Array.isArray(items) ? realComments(items) : [];
7632
+ });
7613
7633
  };
7614
7634
  const readTrackChangesDirectory = (key = "trackChanges") => {
7615
7635
  const token = contentToken();
@@ -7642,7 +7662,7 @@ function createSuperDocUI(options) {
7642
7662
  const reviewWindow = getV2ReviewWindowSnapshot();
7643
7663
  const hasWindowFeed = hasV2ReviewWindowFeed();
7644
7664
  const catalog = !hasWindowFeed ? readCommentsDirectory() : null;
7645
- const windowItems = hasWindowFeed && Array.isArray(reviewWindow?.commentItems) ? reviewWindow.commentItems : null;
7665
+ const windowItems = hasWindowFeed ? realCommentsOfWindow(reviewWindow) : null;
7646
7666
  const value = hasWindowFeed ? windowItems : catalog.value;
7647
7667
  const listStatus = hasWindowFeed ? reviewWindowSliceStatus(reviewWindow) : catalog.status;
7648
7668
  const items = value ?? [];
@@ -15124,6 +15144,12 @@ Object.defineProperty(exports, "isPlainObject", {
15124
15144
  return isPlainObject;
15125
15145
  }
15126
15146
  });
15147
+ Object.defineProperty(exports, "isSyntheticTrackedChangeCommentLaneItem", {
15148
+ enumerable: true,
15149
+ get: function() {
15150
+ return isSyntheticTrackedChangeCommentLaneItem;
15151
+ }
15152
+ });
15127
15153
  Object.defineProperty(exports, "isWorkflowRecordingEnabled", {
15128
15154
  enumerable: true,
15129
15155
  get: function() {
@@ -1078,6 +1078,15 @@ var decodeLayoutStoryDataset = (raw) => {
1078
1078
  `${DOM_CLASS_NAMES.BLOCK_SDT}${DATA_ATTRS.SDT_ID}`;
1079
1079
  `${DATA_ATTRS.DRAGGABLE}`;
1080
1080
  //#endregion
1081
+ //#region src/helpers/tracked-change-comment-lane.ts
1082
+ var TRACKED_CHANGE_COMMENT_LANE_ID_PREFIX = "tc-comment:";
1083
+ function isSyntheticTrackedChangeCommentLaneItem(item) {
1084
+ if (!item || typeof item !== "object") return false;
1085
+ const { id, commentId } = item;
1086
+ const itemId = id ?? commentId;
1087
+ return typeof itemId === "string" && itemId.startsWith(TRACKED_CHANGE_COMMENT_LANE_ID_PREFIX);
1088
+ }
1089
+ //#endregion
1081
1090
  //#region src/public/ui/viewport-batch.ts
1082
1091
  /** No rendering or scrolling: read only geometry already acknowledged by the host. */
1083
1092
  async function readViewportBatch(input, read, generation, disposed) {
@@ -2634,12 +2643,6 @@ function getV2TrackedChangeMutationImpact(event) {
2634
2643
  }
2635
2644
  /**
2636
2645
  * Comment ids retired by a committed v2 mutation.
2637
- *
2638
- * AIDEV-NOTE: History commits put invalidated comment ids on `result`; cut and
2639
- * other command receipts use `receipt`. Same origin split as
2640
- * getV2TrackedChangeMutationImpact. Reading the wrong field, or treating a
2641
- * tracked-change entity as a comment, leaves a sidebar card after cut or
2642
- * undo/redo.
2643
2646
  */
2644
2647
  function collectV2InvalidatedCommentIds(event) {
2645
2648
  const removedIds = /* @__PURE__ */ new Set();
@@ -7606,9 +7609,26 @@ function createSuperDocUI(options) {
7606
7609
  recompute();
7607
7610
  return selection;
7608
7611
  };
7612
+ const realComments = (items) => items.filter((item) => !isSyntheticTrackedChangeCommentLaneItem(item));
7613
+ let lastWindowComments = null;
7614
+ const realCommentsOfWindow = (window) => {
7615
+ const items = window?.commentItems;
7616
+ if (!Array.isArray(items)) return null;
7617
+ const last = lastWindowComments;
7618
+ if (last?.source === items && shallowEqual(last.rows, items)) return last.real;
7619
+ lastWindowComments = {
7620
+ source: items,
7621
+ rows: [...items],
7622
+ real: realComments(items)
7623
+ };
7624
+ return lastWindowComments.real;
7625
+ };
7609
7626
  const readCommentsDirectory = () => {
7610
7627
  const listComments = hostMethod(getDoc()?.comments, "list");
7611
- return readAsync("comments", contentToken(), () => listComments ? listComments() : void 0, (raw) => raw && Array.isArray(raw.items) ? raw.items : []);
7628
+ return readAsync("comments", contentToken(), () => listComments ? listComments() : void 0, (raw) => {
7629
+ const items = isPlainObject(raw) ? raw.items : void 0;
7630
+ return Array.isArray(items) ? realComments(items) : [];
7631
+ });
7612
7632
  };
7613
7633
  const readTrackChangesDirectory = (key = "trackChanges") => {
7614
7634
  const token = contentToken();
@@ -7641,7 +7661,7 @@ function createSuperDocUI(options) {
7641
7661
  const reviewWindow = getV2ReviewWindowSnapshot();
7642
7662
  const hasWindowFeed = hasV2ReviewWindowFeed();
7643
7663
  const catalog = !hasWindowFeed ? readCommentsDirectory() : null;
7644
- const windowItems = hasWindowFeed && Array.isArray(reviewWindow?.commentItems) ? reviewWindow.commentItems : null;
7664
+ const windowItems = hasWindowFeed ? realCommentsOfWindow(reviewWindow) : null;
7645
7665
  const value = hasWindowFeed ? windowItems : catalog.value;
7646
7666
  const listStatus = hasWindowFeed ? reviewWindowSliceStatus(reviewWindow) : catalog.status;
7647
7667
  const items = value ?? [];
@@ -15051,4 +15071,4 @@ function commandIsActive(descriptor, selection) {
15051
15071
  return descriptor.activeMark ? selection.activeMarks.includes(descriptor.activeMark) : false;
15052
15072
  }
15053
15073
  //#endregion
15054
- export { isWorkflowRecordingEnabled as _, registerFirstPartyCommandMutation as a, getV2TrackedChangeMutationImpact as c, resolveImageSrc as d, shallowEqual as f, getWorkflowRecording as g, createInteractionHistory as h, readFirstPartyPageNumbers as i, isPlainObject as l, closeInteractionHistory as m, executeFirstPartyCommandAsync as n, BUILT_IN_COMMAND_IDS as o, DOM_CLASS_NAMES as p, executeFirstPartyShortcutAsync as r, applyV2CommentInvalidationFromMutation as s, createSuperDocUI as t, createImageFilePicker as u, recordInteraction as v };
15074
+ export { getWorkflowRecording as _, registerFirstPartyCommandMutation as a, getV2TrackedChangeMutationImpact as c, resolveImageSrc as d, shallowEqual as f, createInteractionHistory as g, closeInteractionHistory as h, readFirstPartyPageNumbers as i, isPlainObject as l, DOM_CLASS_NAMES as m, executeFirstPartyCommandAsync as n, BUILT_IN_COMMAND_IDS as o, isSyntheticTrackedChangeCommentLaneItem as p, executeFirstPartyShortcutAsync as r, applyV2CommentInvalidationFromMutation as s, createSuperDocUI as t, createImageFilePicker as u, isWorkflowRecordingEnabled as v, recordInteraction as y };
@@ -19,7 +19,7 @@ var COLLABORATION_UPGRADE_ENGINE_MINIMUM_NODE_MAJOR = 20;
19
19
  var PRIVATE_ENGINE_INFO = (0, _superdoc_docx_engine_collaboration_upgrade_engine.getCollaborationUpgradeEngineInfo)();
20
20
  var ENGINE_INFO = Object.freeze({
21
21
  ...PRIVATE_ENGINE_INFO,
22
- superdocVersion: "2.27.0-next.3",
22
+ superdocVersion: "2.27.0-next.5",
23
23
  roomSchemaVersion: Object.freeze({ ...PRIVATE_ENGINE_INFO.roomSchemaVersion }),
24
24
  supportedBundleVersions: SUPPORTED_COLLABORATION_UPGRADE_BUNDLE_VERSIONS,
25
25
  supportedV1ReaderContractVersions: SUPPORTED_V1_READER_CONTRACT_VERSIONS
@@ -18,7 +18,7 @@ var COLLABORATION_UPGRADE_ENGINE_MINIMUM_NODE_MAJOR = 20;
18
18
  var PRIVATE_ENGINE_INFO = getCollaborationUpgradeEngineInfo$1();
19
19
  var ENGINE_INFO = Object.freeze({
20
20
  ...PRIVATE_ENGINE_INFO,
21
- superdocVersion: "2.27.0-next.3",
21
+ superdocVersion: "2.27.0-next.5",
22
22
  roomSchemaVersion: Object.freeze({ ...PRIVATE_ENGINE_INFO.roomSchemaVersion }),
23
23
  supportedBundleVersions: SUPPORTED_COLLABORATION_UPGRADE_BUNDLE_VERSIONS,
24
24
  supportedV1ReaderContractVersions: SUPPORTED_V1_READER_CONTRACT_VERSIONS
@@ -43,12 +43,6 @@ export interface SDHistoryCollaborationMeta {
43
43
  * Result of a history.undo or history.redo action.
44
44
  * Mirrors PlanReceipt's revision shape for consistency.
45
45
  *
46
- * AIDEV-NOTE: this shape carries optional ref-effect
47
- * fields. v1 callers leave them undefined; v2 (`V2HistoryAdapter`) populates
48
- * them from the stored semantic delta of the undone/redone transaction so
49
- * callers' held refs stay accurate across history actions. Never make any
50
- * of the new fields required — v1 adapters MUST keep compiling unchanged.
51
- *
52
46
  * The shape also carries three optional collaboration fields:
53
47
  * `status`, `diagnosticCode`, and `collaboration`. v1 leaves them
54
48
  * undefined; collaborative v2 sessions populate them so callers can react
@@ -64,7 +64,7 @@ import { CaptionsApi, CaptionsAdapter } from './captions/captions.js';
64
64
  import { FieldsApi, FieldsAdapter } from './fields/fields.js';
65
65
  import { CitationsApi, CitationsAdapter } from './citations/citations.js';
66
66
  import { AuthoritiesApi, AuthoritiesAdapter } from './authorities/authorities.js';
67
- export type { TemporaryMutationInput, TemporaryMutationHandleInput, TemporaryMutationCommitInput, TemporaryMutationReplaceInput, TemporaryMutationReceipt, TemporaryMutationMetadata, TemporaryMutationOperation, } from './types/temporary-mutation.js';
67
+ export type { TemporaryMutationInput, TemporaryMutationHandleInput, TemporaryMutationCommitInput, TemporaryMutationReplaceInput, TemporaryMutationReceipt, TemporaryMutationMetadata, TemporaryMutationOperation, TemporaryOperationResultTarget, } from './types/temporary-mutation.js';
68
68
  export * from './types/index.js';
69
69
  export * from './contract/index.js';
70
70
  export * from './capabilities/capabilities.js';
@@ -1,4 +1,4 @@
1
- import { BlockNavigationAddress, EntityAddress, SelectionTarget, TextAddress, TrackedChangeAddress } from './address.js';
1
+ import { BlockNavigationAddress, EntityAddress, SelectionTarget, TextAddress, TextTarget, TrackedChangeAddress } from './address.js';
2
2
  import { BlockNodeAddress } from './base.js';
3
3
  import { BookmarkAddress } from '../bookmarks/bookmarks.types.js';
4
4
  import { StoryLocator } from './story.types.js';
@@ -131,6 +131,7 @@ export interface ReceiptEffects {
131
131
  insertedText?: TextMutationEffect[];
132
132
  /** Blocks created by the mutation, in document order. */
133
133
  insertedBlocks?: BlockMutationEffect[];
134
+ resultText?: TextTarget;
134
135
  }
135
136
  export type ReceiptSuccess = {
136
137
  /** Caller correlation for this commit. Never replayed as the original edit on Undo/Redo. */
@@ -22,12 +22,26 @@ type TemporaryText<Name extends 'insert' | 'replace', Input> = {
22
22
  }>;
23
23
  options: TrackedTextMutationOptions;
24
24
  };
25
+ export interface TemporaryOperationResultTarget {
26
+ kind: 'operationResult';
27
+ operationId: string;
28
+ }
29
+ type CommentsCreate = DocumentApiSurface['comments']['create'];
30
+ type TemporaryCommentInput = Omit<Parameters<CommentsCreate>[0], 'target'> & {
31
+ target?: Parameters<CommentsCreate>[0]['target'] | TemporaryOperationResultTarget;
32
+ };
25
33
  /** Operations run in order against the temporary document, as one atomic update. */
26
- export type TemporaryMutationOperation = TemporaryText<'insert', PlainTextInsertInput> | TemporaryText<'replace', TextReplaceInput> | {
34
+ export type TemporaryMutationOperation = {
35
+ id?: string;
36
+ } & (TemporaryText<'insert', PlainTextInsertInput> | TemporaryText<'replace', TextReplaceInput> | {
27
37
  operation: 'replace';
28
38
  input: ParagraphTextReplaceInput;
29
39
  options?: ReplaceMutationOptions;
30
- } | TemporaryCall<'delete', DocumentApiSurface['delete']> | TemporaryCall<'blocks.delete', DocumentApiSurface['blocks']['delete']> | TemporaryCall<'trackChanges.decide', DocumentApiSurface['trackChanges']['decide']> | TemporaryCall<'comments.create', DocumentApiSurface['comments']['create']>;
40
+ } | TemporaryCall<'delete', DocumentApiSurface['delete']> | TemporaryCall<'blocks.delete', DocumentApiSurface['blocks']['delete']> | TemporaryCall<'trackChanges.decide', DocumentApiSurface['trackChanges']['decide']> | {
41
+ operation: 'comments.create';
42
+ input: TemporaryCommentInput;
43
+ options?: Parameters<CommentsCreate>[1];
44
+ });
31
45
  export interface TemporaryMutationInput {
32
46
  /** Host tag echoed on every temporary mutation and its rollback/commit receipt. */
33
47
  tag: string;
@@ -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-DK14sCrT.cjs");
2
+ const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-CqpZP17K.cjs");
3
3
  const require_slice_source = require("../chunks/slice-source-CFaqq0Vo.cjs");
4
4
  let react = require("react");
5
5
  let use_sync_external_store_shim = require("use-sync-external-store/shim");
@@ -1,4 +1,4 @@
1
- import { t as createSuperDocUI } from "../chunks/create-super-doc-ui-BCQ5RHxy.es.js";
1
+ import { t as createSuperDocUI } from "../chunks/create-super-doc-ui-mIZuVMA6.es.js";
2
2
  import { t as toSliceSource } from "../chunks/slice-source-gfOhG2MW.es.js";
3
3
  import { createContext, createElement, useCallback, useContext, useEffect, useRef, useState } from "react";
4
4
  import { useSyncExternalStore } from "use-sync-external-store/shim";
@@ -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-DK14sCrT.cjs");
2
+ const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-CqpZP17K.cjs");
3
3
  const require_slice_source = require("../chunks/slice-source-CFaqq0Vo.cjs");
4
4
  let superdoc_entry_vue = require("vue");
5
5
  //#region src/public/ui/vue.ts
@@ -1,4 +1,4 @@
1
- import { t as createSuperDocUI } from "../chunks/create-super-doc-ui-BCQ5RHxy.es.js";
1
+ import { t as createSuperDocUI } from "../chunks/create-super-doc-ui-mIZuVMA6.es.js";
2
2
  import { t as toSliceSource } from "../chunks/slice-source-gfOhG2MW.es.js";
3
3
  import { computed, inject, onScopeDispose, provide, shallowRef, toRaw, toValue, watch } from "vue";
4
4
  //#region src/public/ui/vue.ts
@@ -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-DK14sCrT.cjs");
2
+ const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-CqpZP17K.cjs");
3
3
  //#region ../document-api/src/types/receipt.ts
4
4
  /** Read a known failure.details.reason without assuming every failure has one. */
5
5
  function getDocumentApiRejectionReason(details) {
@@ -1,4 +1,4 @@
1
- import { f as shallowEqual, o as BUILT_IN_COMMAND_IDS, t as createSuperDocUI } from "../chunks/create-super-doc-ui-BCQ5RHxy.es.js";
1
+ import { f as shallowEqual, o as BUILT_IN_COMMAND_IDS, t as createSuperDocUI } from "../chunks/create-super-doc-ui-mIZuVMA6.es.js";
2
2
  //#region ../document-api/src/types/receipt.ts
3
3
  /** Read a known failure.details.reason without assuming every failure has one. */
4
4
  function getDocumentApiRejectionReason(details) {