@docx-editor.dev/editor-api 2.19.0 → 2.20.0

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.
@@ -1,4 +1,4 @@
1
- import { AutomationHandle, AutomationSpan, AutomationOperation, AutomationValue, AutomationSpanRef, AutomationHost, AutomationCapabilities, AutomationPaginationOptions } from '@docx-editor.dev/core/automation';
1
+ import { AutomationHandle, AutomationSpan, AutomationOperation, AutomationValue, AutomationSpanRef, RevisionBatchResult, AutomationHost, AutomationCapabilities, AutomationPaginationOptions } from '@docx-editor.dev/core/automation';
2
2
  import { CollaborationModuleContribution } from '@docx-editor.dev/core/collaboration';
3
3
 
4
4
  /** Locations used by Office-shaped insertion calls. Each call validates its allowed subset. @public */
@@ -1025,6 +1025,39 @@ declare class ContentControlCollection extends HandleCollection<ContentControl>
1025
1025
  protected promised(label: string, nullable: boolean): ContentControl & PromisedItem;
1026
1026
  }
1027
1027
 
1028
+ /**
1029
+ * A value a queued method promised to produce, readable after the next `sync()`.
1030
+ *
1031
+ * Deliberately not a `Promise`. A method call inside a batch has not been sent yet, so there is
1032
+ * no pending work to await and nothing that could resolve on its own — awaiting one would
1033
+ * deadlock a consumer who then never calls `sync()`. A result is a box that stays EMPTY until the
1034
+ * sync fills it, and reading it early is `ValueNotLoaded` rather than `undefined` flowing onwards
1035
+ * into something that misinterprets it.
1036
+ *
1037
+ * RevisionCollection.resolve returns a ClientResult with the resolved and skipped decisions.
1038
+ *
1039
+ * @public
1040
+ */
1041
+ declare class ClientResult<T> {
1042
+ #private;
1043
+ /** @internal Use `clientResult()`; only the creator gets the filling half. */
1044
+ private constructor();
1045
+ /**
1046
+ * The value, once a `sync()` has filled it in.
1047
+ *
1048
+ * Reading before then is `ValueNotLoaded` rather than `undefined`, so a mistake surfaces at the
1049
+ * read instead of flowing onwards into something that misinterprets it.
1050
+ */
1051
+ get value(): T;
1052
+ /** Whether the sync that fills this has happened. */
1053
+ get isLoaded(): boolean;
1054
+ /** @internal The box and the way to fill it, so only the creator can settle it. */
1055
+ static create<T>(target: string): {
1056
+ result: ClientResult<T>;
1057
+ fill: (value: T) => void;
1058
+ };
1059
+ }
1060
+
1028
1061
  /**
1029
1062
  * Word's own names for a kind of change.
1030
1063
  *
@@ -1202,6 +1235,8 @@ declare class Revision extends ModelObject implements PromisedItem {
1202
1235
  reject(): void;
1203
1236
  /** @internal Plan the read this object's `load(...)` asked for. */
1204
1237
  protected onLoad(request: ResolvedLoadOptions): void;
1238
+ /** @internal Capture a batch target without exposing engine identity. */
1239
+ static batchHandle(revision: Revision, context: RequestContext): AutomationHandle;
1205
1240
  }
1206
1241
  /**
1207
1242
  * The tracked changes on a document, story or range, as of the batch that loaded them.
@@ -1228,6 +1263,22 @@ declare class RevisionCollection extends HandleCollection<Revision> {
1228
1263
  acceptAll(): void;
1229
1264
  /** Undo every change, likewise as one decision. */
1230
1265
  rejectAll(): void;
1266
+ /**
1267
+ * Resolve eligible revisions in this story and report skipped decisions after sync.
1268
+ * Omit revisions to include unsupported and structural decisions absent from items.
1269
+ * Pass an empty array to select nothing. Duplicate objects resolve once; stale targets
1270
+ * are reported as unknown-revision. This must be the only write in its sync batch.
1271
+ * Unlike acceptAll/rejectAll, unsupported decisions do not block independent changes.
1272
+ *
1273
+ * @example
1274
+ * ```ts
1275
+ * const result = context.document.revisions.resolve('accept');
1276
+ * await context.sync();
1277
+ * console.log(result.value.resolved.length, result.value.remaining);
1278
+ * for (const skipped of result.value.skipped) console.log(skipped.reason);
1279
+ * ```
1280
+ */
1281
+ resolve(action: 'accept' | 'reject', revisions?: readonly Revision[]): ClientResult<RevisionBatchResult>;
1231
1282
  /** @internal The read that answers this collection's members. */
1232
1283
  protected listing(): AutomationOperation;
1233
1284
  /** @internal Build one member from an address the listing answered. */
@@ -2208,40 +2259,6 @@ declare abstract class ClientObject implements RuntimeManagedObject {
2208
2259
  [REBIND](context: RequestContext): void;
2209
2260
  }
2210
2261
 
2211
- /**
2212
- * A value a queued method promised to produce, readable after the next `sync()`.
2213
- *
2214
- * Deliberately not a `Promise`. A method call inside a batch has not been sent yet, so there is
2215
- * no pending work to await and nothing that could resolve on its own — awaiting one would
2216
- * deadlock a consumer who then never calls `sync()`. A result is a box that stays EMPTY until the
2217
- * sync fills it, and reading it early is `ValueNotLoaded` rather than `undefined` flowing onwards
2218
- * into something that misinterprets it.
2219
- *
2220
- * This is a support type. No current public document method produces a ClientResult.
2221
- * Document collections expose loaded `items`; read their length after `load('items')` and `sync()`.
2222
- *
2223
- * @public
2224
- */
2225
- declare class ClientResult<T> {
2226
- #private;
2227
- /** @internal Use `clientResult()`; only the creator gets the filling half. */
2228
- private constructor();
2229
- /**
2230
- * The value, once a `sync()` has filled it in.
2231
- *
2232
- * Reading before then is `ValueNotLoaded` rather than `undefined`, so a mistake surfaces at the
2233
- * read instead of flowing onwards into something that misinterprets it.
2234
- */
2235
- get value(): T;
2236
- /** Whether the sync that fills this has happened. */
2237
- get isLoaded(): boolean;
2238
- /** @internal The box and the way to fill it, so only the creator can settle it. */
2239
- static create<T>(target: string): {
2240
- result: ClientResult<T>;
2241
- fill: (value: T) => void;
2242
- };
2243
- }
2244
-
2245
2262
  /** What went wrong, as a value a consumer may branch on. */
2246
2263
  type DocxEditorErrorCode =
2247
2264
  /** A property was read before a `load(...)` for it completed in a `sync()`. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docx-editor.dev/editor-api",
3
- "version": "2.19.0",
3
+ "version": "2.20.0",
4
4
  "description": "Document automation for DOCX: a batching object model that drives a document from a server or from an editor already open in a page",
5
5
  "sideEffects": false,
6
6
  "engines": {
@@ -82,6 +82,6 @@
82
82
  "access": "public"
83
83
  },
84
84
  "peerDependencies": {
85
- "@docx-editor.dev/core": "~2.19.0"
85
+ "@docx-editor.dev/core": "~2.20.0"
86
86
  }
87
87
  }