superdoc 2.22.1-next.1 → 2.23.0-next.1

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.
@@ -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.22.1-next.1",
22
+ superdocVersion: "2.23.0-next.1",
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.22.1-next.1",
21
+ superdocVersion: "2.23.0-next.1",
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
@@ -31,6 +31,7 @@ import { BlocksAdapter, BlocksApi } from './blocks/blocks.js';
31
31
  import { TableLocator, TableMutationResult, TablesConvertFromTextInput, TablesMoveInput, TablesSplitInput, TablesConvertToTextInput, TablesSetLayoutInput, TablesInsertRowInput, TablesDeleteRowInput, TablesMoveRowInput, TablesSetRowHeightInput, TablesDistributeRowsInput, TablesSetRowOptionsInput, TablesInsertColumnInput, TablesDeleteColumnInput, TablesMoveColumnInput, TablesSetColumnWidthInput, TablesDistributeColumnsInput, TablesInsertCellInput, TablesDeleteCellInput, TablesMergeCellsInput, TablesUnmergeCellsInput, TablesSplitCellInput, TablesSetCellPropertiesInput, TablesSetCellTextInput, TablesSortInput, TablesSetAltTextInput, TablesSetStyleInput, TablesClearStyleInput, TablesSetStyleOptionInput, TablesSetBorderInput, TablesClearBorderInput, TablesApplyBorderPresetInput, TablesSetShadingInput, TablesClearShadingInput, TablesSetTablePaddingInput, TablesSetCellPaddingInput, TablesSetCellSpacingInput, TablesClearCellSpacingInput, TablesApplyStyleInput, TablesSetBordersInput, TablesSetTableOptionsInput, TablesApplyPresetInput, TablesGetInput, TablesGetOutput, TablesGetCellsInput, TablesGetCellsOutput, TablesGetPropertiesInput, TablesGetPropertiesOutput, TablesGetStylesInput, TablesGetStylesOutput, TablesSetDefaultStyleInput, TablesClearDefaultStyleInput } from './types/table-operations.types.js';
32
32
  import { TrackChangesAdapter, TrackChangesApi } from './track-changes/track-changes.js';
33
33
  import { MutationOptions, RichContentMutationOptions, WriteAdapter } from './write/write.js';
34
+ import { OperationCancellation } from './write/operation-cancellation.js';
34
35
  import { SelectionMutationAdapter } from './selection-mutation.js';
35
36
  import { CapabilitiesAdapter, DocumentApiCapabilities, OperationCapabilityResolveInput, OperationCapabilityResolveResult } from './capabilities/capabilities.js';
36
37
  import { SDHtmlMarkdownSupportCheckInput, SDHtmlMarkdownSupportCheckResult } from './capabilities/html-markdown-support.js';
@@ -105,6 +106,8 @@ export type { GetHtmlAdapter, GetHtmlInput } from './get-html/get-html.js';
105
106
  export type { InfoAdapter, InfoInput } from './info/info.js';
106
107
  export type { ExtractAdapter, ExtractInput } from './extract/extract.js';
107
108
  export type { WriteAdapter, WriteRequest, RichContentMutationOptions } from './write/write.js';
109
+ export type { OperationCancellation, OperationCancellationCode } from './write/operation-cancellation.js';
110
+ export { OperationCancellationError, assertOperationCanStart, indeterminateOperation, splitOperationCancellation, } from './write/operation-cancellation.js';
108
111
  export type { FormatInlineAliasApi, FormatInlineAliasInput, FormatBoldInput, FormatItalicInput, FormatRangeInput, FormatUnderlineInput, FormatStrikethroughInput, StyleApplyInput, StyleApplyOptions, } from './format/format.js';
109
112
  export type { InlineRunPatch, InlineRunPatchKey, InlinePropertyStorage, InlinePropertyType, InlinePropertyCarrier, InlinePropertyRegistryEntry, UnderlinePatch, ShadingPatch, BorderPatch, FitTextPatch, LangPatch, RFontsPatch, EastAsianLayoutPatch, StylisticSetPatch, } from './format/inline-run-patch.js';
110
113
  export { INLINE_PROPERTY_REGISTRY, INLINE_PROPERTY_KEY_SET, INLINE_PROPERTY_BY_KEY, INLINE_PROPERTY_KEYS_BY_STORAGE, validateInlineRunPatch, buildInlineRunPatchSchema, } from './format/inline-run-patch.js';
@@ -251,7 +254,11 @@ export interface QueryApi {
251
254
  }
252
255
  export interface MutationsApi {
253
256
  preview(input: MutationsPreviewInput): Promise<MutationsPreviewOutput>;
254
- apply(input: MutationsApplyInput): Promise<PlanReceipt>;
257
+ /**
258
+ * Apply an atomic plan. `options` is host-side cancellation and is not part
259
+ * of the plan payload.
260
+ */
261
+ apply(input: MutationsApplyInput, options?: OperationCancellation): Promise<PlanReceipt>;
255
262
  }
256
263
  export interface RangesApi {
257
264
  resolve(input: ResolveRangeInput): ResolveRangeOutput;
@@ -323,8 +330,9 @@ export interface DocumentApiSurface {
323
330
  /**
324
331
  * Extract all document content with stable IDs for RAG pipelines.
325
332
  * Returns blocks with full text, comments, and tracked changes.
333
+ * `options` cancels or deadlines the browser call. It is not an extract filter.
326
334
  */
327
- extract(input: ExtractInput): ExtractResult;
335
+ extract(input: ExtractInput, options?: OperationCancellation): ExtractResult;
328
336
  /**
329
337
  * Clear all document body content, leaving a single empty paragraph.
330
338
  */
@@ -337,7 +345,7 @@ export interface DocumentApiSurface {
337
345
  * Insert content at a target location.
338
346
  * If target is omitted, inserts at the end of the document.
339
347
  */
340
- insert(input: InsertInput, options?: RichContentMutationOptions): SDMutationReceipt;
348
+ insert(input: InsertInput, options?: RichContentMutationOptions & OperationCancellation): SDMutationReceipt;
341
349
  /**
342
350
  * Replace text at a target range.
343
351
  */
@@ -4,6 +4,7 @@ import { SDInsertInput } from '../types/structural-input.js';
4
4
  import { StoryLocator } from '../types/story.types.js';
5
5
  import { BlockNodeAddress } from '../types/base.js';
6
6
  import { Placement } from '../types/placement.js';
7
+ import { OperationCancellation } from '../write/operation-cancellation.js';
7
8
  import { SelectionMutationAdapter } from '../selection-mutation.js';
8
9
  /** Content format for the text insert operation payload. */
9
10
  export type InsertContentType = 'text' | 'markdown' | 'html';
@@ -70,5 +71,5 @@ export declare function validateInsertInput(input: unknown): asserts input is In
70
71
  * @param options - Optional mutation options (changeMode, dryRun, expectedRevision).
71
72
  * @returns Receipt indicating success/failure and mutation metadata.
72
73
  */
73
- export declare function executeInsert(selectionAdapter: SelectionMutationAdapter, writeAdapter: WriteAdapter, input: InsertInput, options?: RichContentMutationOptions): SDMutationReceipt;
74
+ export declare function executeInsert(selectionAdapter: SelectionMutationAdapter, writeAdapter: WriteAdapter, input: InsertInput, options?: RichContentMutationOptions & OperationCancellation): SDMutationReceipt;
74
75
  export {};
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Host-side cancellation for browser `insert`, `mutations.apply`, and `extract`.
3
+ *
4
+ * `signal` and `timeoutMs` stay on the caller side. They are not serialized
5
+ * into the worker. An already-aborted signal or a `timeoutMs` of 0 finishes
6
+ * as {@link OperationCancellationError} `CANCELLED` before dispatch and does
7
+ * not change the document. Aborting after the worker has started the command
8
+ * does not roll it back: the call rejects as `INDETERMINATE` so the caller
9
+ * stops waiting, and must read the document before deciding whether to retry.
10
+ * Replacing the document or closing the editor also settles as `INDETERMINATE`.
11
+ */
12
+ export interface OperationCancellation {
13
+ /** Abort before dispatch, or ask the host to cancel a command that has not started. */
14
+ signal?: AbortSignal;
15
+ /**
16
+ * Milliseconds from the call. `0` is already expired and does not dispatch.
17
+ * A positive deadline uses the same outcome rules as `signal`.
18
+ */
19
+ timeoutMs?: number;
20
+ }
21
+ export type OperationCancellationCode = 'CANCELLED' | 'INDETERMINATE';
22
+ /**
23
+ * Machine-readable outcome for a cancellation that did not return the
24
+ * operation's normal receipt.
25
+ *
26
+ * `CANCELLED` means the command did not start and the document is unchanged.
27
+ * Retrying that same call is safe. `INDETERMINATE` means the call cannot
28
+ * prove whether a mutation committed. Read the current document before
29
+ * retrying. A resolved receipt means the work committed; do not retry it.
30
+ */
31
+ export declare class OperationCancellationError extends Error {
32
+ readonly code: OperationCancellationCode;
33
+ readonly details?: {
34
+ cause?: string;
35
+ };
36
+ constructor(code: OperationCancellationCode, message: string, details?: {
37
+ cause?: string;
38
+ });
39
+ }
40
+ export declare function cancelledBeforeDispatch(): OperationCancellationError;
41
+ export declare function indeterminateOperation(cause: 'replaced' | 'disposed' | 'in-flight'): OperationCancellationError;
42
+ /**
43
+ * Reject a call that is already cancelled or whose deadline has already
44
+ * expired. Returns without effect when the caller did not ask for control.
45
+ */
46
+ export declare function assertOperationCanStart(options?: OperationCancellation): void;
47
+ /**
48
+ * Separate host-only cancellation fields from a value that will be
49
+ * structured-cloned into the worker. `AbortSignal` cannot cross that boundary.
50
+ */
51
+ export declare function splitOperationCancellation(value: unknown): {
52
+ cancellation?: OperationCancellation;
53
+ rest: unknown;
54
+ };
@@ -142,6 +142,8 @@ export type DocPartMetadata = {
142
142
  */
143
143
  export type SdtMetadata = FieldAnnotationMetadata | StructuredContentMetadata | DocumentSectionMetadata | DocPartMetadata;
144
144
  export declare const CONTRACTS_VERSION = "1.2.0";
145
+ /** Match the cell painter's alignment footprint, including out-of-flow drawings. */
146
+ export declare function tableCellAlignmentOffset(verticalAlign: string | undefined, contentHeight: number, flowHeight: number, measuredContentHeight: number): number;
145
147
  /** Unique identifier for a block in the document. Format: `${pos}-${type}`. */
146
148
  export type BlockId = string;
147
149
  /**
@@ -568,6 +568,8 @@ declare function incrementalLayoutComplete(previousBlocks: FlowBlock[], _previou
568
568
  fontCapabilities?: FontMeasureCapabilities;
569
569
  }, warmStart?: {
570
570
  footnoteReserveSeed?: FootnoteReserveSeed | null;
571
+ /** Per-open-document diagnostic lifetime, including cold relayouts. */
572
+ footnoteWarningOwner?: object;
571
573
  /** Host proved the authoritative note projection bundle was retained exactly. */
572
574
  noteMeasurePlaneRetainedExact?: true;
573
575
  /** Host proved this seed is an exact, geometry-equivalent subset of the current note plane. */
package/dist/superdoc.cjs CHANGED
@@ -316,7 +316,7 @@ var shuffleArray = (array) => {
316
316
  var DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
317
317
  function getSuperdocVersion() {
318
318
  try {
319
- return "2.22.1-next.1";
319
+ return "2.23.0-next.1";
320
320
  } catch {
321
321
  return "unknown";
322
322
  }
@@ -46387,7 +46387,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
46387
46387
  this.config.colors = shuffleArray(this.config.colors);
46388
46388
  this.userColorMap = /* @__PURE__ */ new Map();
46389
46389
  this.colorIndex = 0;
46390
- this.version = "2.22.1-next.1";
46390
+ this.version = "2.23.0-next.1";
46391
46391
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
46392
46392
  this.superdocId = config.superdocId || require_uuid.v4();
46393
46393
  this.colors = this.config.colors ?? [];
@@ -314,7 +314,7 @@ var shuffleArray = (array) => {
314
314
  var DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
315
315
  function getSuperdocVersion() {
316
316
  try {
317
- return "2.22.1-next.1";
317
+ return "2.23.0-next.1";
318
318
  } catch {
319
319
  return "unknown";
320
320
  }
@@ -46316,7 +46316,7 @@ var SuperDoc = class extends import_eventemitter3.default {
46316
46316
  this.config.colors = shuffleArray(this.config.colors);
46317
46317
  this.userColorMap = /* @__PURE__ */ new Map();
46318
46318
  this.colorIndex = 0;
46319
- this.version = "2.22.1-next.1";
46319
+ this.version = "2.23.0-next.1";
46320
46320
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
46321
46321
  this.superdocId = config.superdocId || v4();
46322
46322
  this.colors = this.config.colors ?? [];