superdoc 2.28.0-next.16 → 2.28.0-next.17

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.
@@ -2650,6 +2650,16 @@ function isPlainObject(value) {
2650
2650
  }
2651
2651
  //#endregion
2652
2652
  //#region src/helpers/v2-review-mutation-impact.ts
2653
+ function mutationCommittedEventChangedVisibleContent(event) {
2654
+ if (event.dryRun === true) return false;
2655
+ if (isPlainObject(event.result) && event.result.noop === true) return false;
2656
+ const receipt = isPlainObject(event.receipt) ? event.receipt : null;
2657
+ if (receipt?.changed === false || receipt?.noop === true || receipt?.status === "NO_OP") return false;
2658
+ return true;
2659
+ }
2660
+ function mutationCommittedEventChangedDocument(event) {
2661
+ return event.cause !== "preview" && mutationCommittedEventChangedVisibleContent(event);
2662
+ }
2653
2663
  /**
2654
2664
  * Classify the tracked-change identities carried by a v2 mutation event.
2655
2665
  *
@@ -5762,18 +5772,6 @@ function commandResultFromOperationResult(result) {
5762
5772
  function isSuccessfulReceipt(result) {
5763
5773
  return Boolean(result) && typeof result === "object" && result.success === true;
5764
5774
  }
5765
- /**
5766
- * The host also emits `mutation:committed` for previews and no-op receipts;
5767
- * those events must not mark the document as having unsaved edits.
5768
- */
5769
- function mutationCommittedEventChangedDocument(event) {
5770
- if (event.dryRun === true) return false;
5771
- const receipt = event.receipt;
5772
- if (receipt && typeof receipt === "object" && receipt.changed === false) return false;
5773
- if (receipt && typeof receipt === "object" && receipt.noop === true) return false;
5774
- if (receipt && typeof receipt === "object" && receipt.status === "NO_OP") return false;
5775
- return true;
5776
- }
5777
5775
  function readTxId(value) {
5778
5776
  return typeof value === "string" && value.length > 0 ? value : null;
5779
5777
  }
@@ -10287,10 +10285,10 @@ function createSuperDocUI(options) {
10287
10285
  const type = event?.type;
10288
10286
  if (host) publishDocumentChange(host, event);
10289
10287
  const isStandaloneDocumentMutation = type === "document:mutated" && event.hasCommitEvent !== true;
10290
- if (type === "collaboration:document-replaced" || isStandaloneDocumentMutation || type === "mutation:committed" && mutationCommittedEventChangedDocument(event) || type === "collaboration:remote-changed") {
10288
+ if (type === "collaboration:document-replaced" || isStandaloneDocumentMutation || type === "mutation:committed" && mutationCommittedEventChangedVisibleContent(event) || type === "collaboration:remote-changed") {
10291
10289
  for (const [commandId, optimistic] of optimisticInlineToggles) if (optimistic.settled || type === "collaboration:document-replaced") optimisticInlineToggles.delete(commandId);
10292
10290
  }
10293
- if (isStandaloneDocumentMutation || type === "mutation:committed" && mutationCommittedEventChangedDocument(event) || type === "collaboration:remote-changed" && Array.isArray(event.changedStoryIds) && event.changedStoryIds.length > 0) scheduleActiveSearchRefresh();
10291
+ if (isStandaloneDocumentMutation || type === "mutation:committed" && mutationCommittedEventChangedVisibleContent(event) || type === "collaboration:remote-changed" && Array.isArray(event.changedStoryIds) && event.changedStoryIds.length > 0) scheduleActiveSearchRefresh();
10294
10292
  if ((type === "document:mutated" || type === "mutation:committed" && mutationCommittedEventChangedDocument(event)) && host && !dirtyHosts.has(host)) {
10295
10293
  dirtyHosts.add(host);
10296
10294
  recompute("document-dirty");
@@ -10326,6 +10324,7 @@ function createSuperDocUI(options) {
10326
10324
  if (impact?.allResolved) {
10327
10325
  replaceTrackedChangeItemsInCache([]);
10328
10326
  publishAllTrackedChangesResolved(event.receipt);
10327
+ if (event.cause === "preview") invalidateDocumentContent();
10329
10328
  return;
10330
10329
  }
10331
10330
  if (impact?.removedIds.size) markPostDecisionTrackChanges(new Set(impact.removedIds), event.receipt);
@@ -10335,7 +10334,10 @@ function createSuperDocUI(options) {
10335
10334
  scheduleTypingDocumentContentInvalidation();
10336
10335
  return;
10337
10336
  }
10338
- if (impact?.removedIds.size && impact.upsertIds.size === 0) return;
10337
+ if (impact?.removedIds.size && impact.upsertIds.size === 0) {
10338
+ if (event.cause === "preview") invalidateDocumentContent();
10339
+ return;
10340
+ }
10339
10341
  if (isStandaloneDocumentMutation || type === "collaboration:remote-changed" || type === "mutation:committed" && !isTypingBurst) schedulePostPaintContentRefresh();
10340
10342
  const remoteCommentsPartChanged = type === "collaboration:remote-changed" && Array.isArray(event.changedPartUris) && event.changedPartUris.some((partUri) => typeof partUri === "string" && COMMENTS_CATALOG_PART_URIS.has(partUri));
10341
10343
  const loadedCommentAnchorsMayHaveChanged = type === "collaboration:remote-changed" && Array.isArray(event.changedStoryIds) && event.changedStoryIds.length > 0 && commentsCatalogMayHaveRows();
@@ -15654,4 +15656,4 @@ function commandIsActive(descriptor, selection) {
15654
15656
  return descriptor.activeMark ? selection.activeMarks.includes(descriptor.activeMark) : false;
15655
15657
  }
15656
15658
  //#endregion
15657
- export { createInteractionHistory as _, registerFirstPartyCommandMutation as a, recordInteraction as b, applyV2CommentInvalidationFromMutation as c, createImageFilePicker as d, resolveImageSrc as f, closeInteractionHistory as g, DOM_CLASS_NAMES as h, readFirstPartyPageNumbers as i, getV2TrackedChangeMutationImpact as l, isSyntheticTrackedChangeCommentLaneItem as m, executeFirstPartyCommandAsync as n, isRecord as o, shallowEqual as p, executeFirstPartyShortcutAsync as r, BUILT_IN_COMMAND_IDS as s, createSuperDocUI as t, isPlainObject as u, getWorkflowRecording as v, isWorkflowRecordingEnabled as y };
15659
+ export { closeInteractionHistory as _, registerFirstPartyCommandMutation as a, isWorkflowRecordingEnabled as b, applyV2CommentInvalidationFromMutation as c, isPlainObject as d, createImageFilePicker as f, DOM_CLASS_NAMES as g, isSyntheticTrackedChangeCommentLaneItem as h, readFirstPartyPageNumbers as i, getV2TrackedChangeMutationImpact as l, shallowEqual as m, executeFirstPartyCommandAsync as n, isRecord as o, resolveImageSrc as p, executeFirstPartyShortcutAsync as r, BUILT_IN_COMMAND_IDS as s, createSuperDocUI as t, mutationCommittedEventChangedDocument as u, createInteractionHistory as v, recordInteraction as x, getWorkflowRecording as y };
@@ -2651,6 +2651,16 @@ function isPlainObject(value) {
2651
2651
  }
2652
2652
  //#endregion
2653
2653
  //#region src/helpers/v2-review-mutation-impact.ts
2654
+ function mutationCommittedEventChangedVisibleContent(event) {
2655
+ if (event.dryRun === true) return false;
2656
+ if (isPlainObject(event.result) && event.result.noop === true) return false;
2657
+ const receipt = isPlainObject(event.receipt) ? event.receipt : null;
2658
+ if (receipt?.changed === false || receipt?.noop === true || receipt?.status === "NO_OP") return false;
2659
+ return true;
2660
+ }
2661
+ function mutationCommittedEventChangedDocument(event) {
2662
+ return event.cause !== "preview" && mutationCommittedEventChangedVisibleContent(event);
2663
+ }
2654
2664
  /**
2655
2665
  * Classify the tracked-change identities carried by a v2 mutation event.
2656
2666
  *
@@ -5763,18 +5773,6 @@ function commandResultFromOperationResult(result) {
5763
5773
  function isSuccessfulReceipt(result) {
5764
5774
  return Boolean(result) && typeof result === "object" && result.success === true;
5765
5775
  }
5766
- /**
5767
- * The host also emits `mutation:committed` for previews and no-op receipts;
5768
- * those events must not mark the document as having unsaved edits.
5769
- */
5770
- function mutationCommittedEventChangedDocument(event) {
5771
- if (event.dryRun === true) return false;
5772
- const receipt = event.receipt;
5773
- if (receipt && typeof receipt === "object" && receipt.changed === false) return false;
5774
- if (receipt && typeof receipt === "object" && receipt.noop === true) return false;
5775
- if (receipt && typeof receipt === "object" && receipt.status === "NO_OP") return false;
5776
- return true;
5777
- }
5778
5776
  function readTxId(value) {
5779
5777
  return typeof value === "string" && value.length > 0 ? value : null;
5780
5778
  }
@@ -10288,10 +10286,10 @@ function createSuperDocUI(options) {
10288
10286
  const type = event?.type;
10289
10287
  if (host) publishDocumentChange(host, event);
10290
10288
  const isStandaloneDocumentMutation = type === "document:mutated" && event.hasCommitEvent !== true;
10291
- if (type === "collaboration:document-replaced" || isStandaloneDocumentMutation || type === "mutation:committed" && mutationCommittedEventChangedDocument(event) || type === "collaboration:remote-changed") {
10289
+ if (type === "collaboration:document-replaced" || isStandaloneDocumentMutation || type === "mutation:committed" && mutationCommittedEventChangedVisibleContent(event) || type === "collaboration:remote-changed") {
10292
10290
  for (const [commandId, optimistic] of optimisticInlineToggles) if (optimistic.settled || type === "collaboration:document-replaced") optimisticInlineToggles.delete(commandId);
10293
10291
  }
10294
- if (isStandaloneDocumentMutation || type === "mutation:committed" && mutationCommittedEventChangedDocument(event) || type === "collaboration:remote-changed" && Array.isArray(event.changedStoryIds) && event.changedStoryIds.length > 0) scheduleActiveSearchRefresh();
10292
+ if (isStandaloneDocumentMutation || type === "mutation:committed" && mutationCommittedEventChangedVisibleContent(event) || type === "collaboration:remote-changed" && Array.isArray(event.changedStoryIds) && event.changedStoryIds.length > 0) scheduleActiveSearchRefresh();
10295
10293
  if ((type === "document:mutated" || type === "mutation:committed" && mutationCommittedEventChangedDocument(event)) && host && !dirtyHosts.has(host)) {
10296
10294
  dirtyHosts.add(host);
10297
10295
  recompute("document-dirty");
@@ -10327,6 +10325,7 @@ function createSuperDocUI(options) {
10327
10325
  if (impact?.allResolved) {
10328
10326
  replaceTrackedChangeItemsInCache([]);
10329
10327
  publishAllTrackedChangesResolved(event.receipt);
10328
+ if (event.cause === "preview") invalidateDocumentContent();
10330
10329
  return;
10331
10330
  }
10332
10331
  if (impact?.removedIds.size) markPostDecisionTrackChanges(new Set(impact.removedIds), event.receipt);
@@ -10336,7 +10335,10 @@ function createSuperDocUI(options) {
10336
10335
  scheduleTypingDocumentContentInvalidation();
10337
10336
  return;
10338
10337
  }
10339
- if (impact?.removedIds.size && impact.upsertIds.size === 0) return;
10338
+ if (impact?.removedIds.size && impact.upsertIds.size === 0) {
10339
+ if (event.cause === "preview") invalidateDocumentContent();
10340
+ return;
10341
+ }
10340
10342
  if (isStandaloneDocumentMutation || type === "collaboration:remote-changed" || type === "mutation:committed" && !isTypingBurst) schedulePostPaintContentRefresh();
10341
10343
  const remoteCommentsPartChanged = type === "collaboration:remote-changed" && Array.isArray(event.changedPartUris) && event.changedPartUris.some((partUri) => typeof partUri === "string" && COMMENTS_CATALOG_PART_URIS.has(partUri));
10342
10344
  const loadedCommentAnchorsMayHaveChanged = type === "collaboration:remote-changed" && Array.isArray(event.changedStoryIds) && event.changedStoryIds.length > 0 && commentsCatalogMayHaveRows();
@@ -15745,6 +15747,12 @@ Object.defineProperty(exports, "isWorkflowRecordingEnabled", {
15745
15747
  return isWorkflowRecordingEnabled;
15746
15748
  }
15747
15749
  });
15750
+ Object.defineProperty(exports, "mutationCommittedEventChangedDocument", {
15751
+ enumerable: true,
15752
+ get: function() {
15753
+ return mutationCommittedEventChangedDocument;
15754
+ }
15755
+ });
15748
15756
  Object.defineProperty(exports, "readFirstPartyPageNumbers", {
15749
15757
  enumerable: true,
15750
15758
  get: function() {
@@ -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.28.0-next.16",
22
+ superdocVersion: "2.28.0-next.17",
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.28.0-next.16",
21
+ superdocVersion: "2.28.0-next.17",
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
@@ -3726,7 +3726,7 @@ export declare const OPERATION_DEFINITIONS: {
3726
3726
  readonly find: {
3727
3727
  readonly memberPath: "find";
3728
3728
  readonly description: "Search the document for text or node matches using SDM/1 selectors. Returns discovery-grade results: for mutation targeting, use query.match instead.";
3729
- readonly expectedResult: "Returns an SDFindResult envelope ({ total, limit, offset, items }). Each item is an SDNodeResult ({ node, address }). Text hits contain only the matched text; use getNode or getNodeById for the full containing node. Node selectors return full node projections.";
3729
+ readonly expectedResult: "Returns an SDFindResult envelope ({ total, limit, offset, items }). Each item is an SDNodeResult ({ node, address }). Text hits contain only the matched text; use getNode or getNodeById for the full containing node. Node selectors return full node projections. Bookmark selectors return the bookmarks of the searched story in document order: each address is an inline bookmark address whose anchor spans the bookmark range, and each node is an ext.bookmark node whose bookmark.address resolves through bookmarks.get.";
3730
3730
  readonly requiresDocumentContext: true;
3731
3731
  readonly metadata: CommandStaticMetadata;
3732
3732
  readonly referenceDocPath: "find.mdx";
@@ -15,7 +15,7 @@ export type ReceiptFailureCode = 'NO_OP' | 'INVALID_TARGET' | 'TARGET_NOT_FOUND'
15
15
  export type TextRangeRejectionReason = 'text-range-in-sdt' | 'text-range-in-field' | 'text-range-in-unsupported-tracked-wrapper';
16
16
  /** Content-control creation keeps its existing top-level failure code. */
17
17
  export type ContentControlCreationRejectionReason = 'content-control-unsupported-inline-structure' | 'content-control-shared-run-boundary';
18
- export type DocumentApiRejectionReason = TextRangeRejectionReason | ContentControlCreationRejectionReason;
18
+ export type DocumentApiRejectionReason = TextRangeRejectionReason | ContentControlCreationRejectionReason | 'paragraph-mark-already-deleted';
19
19
  export interface DocumentApiRejectionDetails extends Record<string, unknown> {
20
20
  reason: DocumentApiRejectionReason;
21
21
  }
@@ -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-DfSPIhxs.cjs");
2
+ const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-CXdsObDZ.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-J7aMU_wd.es.js";
1
+ import { t as createSuperDocUI } from "../chunks/create-super-doc-ui-CAfcpwSS.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-DfSPIhxs.cjs");
2
+ const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-CXdsObDZ.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-J7aMU_wd.es.js";
1
+ import { t as createSuperDocUI } from "../chunks/create-super-doc-ui-CAfcpwSS.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-DfSPIhxs.cjs");
2
+ const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-CXdsObDZ.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) {
@@ -9,7 +9,8 @@ function getDocumentApiRejectionReason(details) {
9
9
  case "text-range-in-field":
10
10
  case "text-range-in-unsupported-tracked-wrapper":
11
11
  case "content-control-unsupported-inline-structure":
12
- case "content-control-shared-run-boundary": return details.reason;
12
+ case "content-control-shared-run-boundary":
13
+ case "paragraph-mark-already-deleted": return details.reason;
13
14
  default: return;
14
15
  }
15
16
  }
@@ -1,4 +1,4 @@
1
- import { p as shallowEqual, s as BUILT_IN_COMMAND_IDS, t as createSuperDocUI } from "../chunks/create-super-doc-ui-J7aMU_wd.es.js";
1
+ import { m as shallowEqual, s as BUILT_IN_COMMAND_IDS, t as createSuperDocUI } from "../chunks/create-super-doc-ui-CAfcpwSS.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) {
@@ -8,7 +8,8 @@ function getDocumentApiRejectionReason(details) {
8
8
  case "text-range-in-field":
9
9
  case "text-range-in-unsupported-tracked-wrapper":
10
10
  case "content-control-unsupported-inline-structure":
11
- case "content-control-shared-run-boundary": return details.reason;
11
+ case "content-control-shared-run-boundary":
12
+ case "paragraph-mark-already-deleted": return details.reason;
12
13
  default: return;
13
14
  }
14
15
  }
@@ -146,7 +146,7 @@ export declare class FontResolver {
146
146
  /**
147
147
  * Resolve a CSS font-family value for MEASURE and PAINT: swap the primary family to its
148
148
  * physical substitute and keep the original fallbacks. "Calibri, sans-serif" ->
149
- * "Carlito, sans-serif"; "Calibri" -> "Carlito". An unmapped value is returned unchanged.
149
+ * "Carlito, sans-serif"; "Calibri" -> "Carlito". Quotes primary names when required by CSS syntax.
150
150
  */
151
151
  resolvePhysicalFamily(cssFontFamily: string): string;
152
152
  /**
@@ -160,8 +160,8 @@ export declare class FontResolver {
160
160
  /**
161
161
  * Face-aware CSS-stack variant for MEASURE and PAINT - the face-scoped counterpart of
162
162
  * {@link resolvePhysicalFamily}. Swaps the primary family to its substitute when this exact face is
163
- * real or docfonts authorizes a synthetic source face. Otherwise returns the value unchanged
164
- * (logical family + its fallbacks), so a missing face is never faux-styled by accident. Measure and
163
+ * real or docfonts authorizes a synthetic source face. Otherwise keeps the logical family and its
164
+ * fallbacks, quoting primary names when required by CSS syntax. Measure and
165
165
  * paint MUST call this with the same face key, or text is measured in one face and painted in another.
166
166
  */
167
167
  resolvePhysicalFamilyForFace(cssFontFamily: string, face: FaceKey, hasFace: HasFace): string;