superdoc 2.20.1-next.11 → 2.20.1-next.12

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.20.1-next.11",
22
+ superdocVersion: "2.20.1-next.12",
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.20.1-next.11",
21
+ superdocVersion: "2.20.1-next.12",
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
@@ -1,5 +1,6 @@
1
1
  import { TextAddress } from './address.js';
2
2
  import { BlockNodeAddress } from './base.js';
3
+ import { ResolvedHandle } from './discovery.js';
3
4
  import { ReceiptFailure, ReceiptInsert } from './receipt.js';
4
5
  import { StoryLocator } from './story.types.js';
5
6
  export type ParagraphCreateLocation = {
@@ -18,13 +19,57 @@ export interface CreateParagraphInput {
18
19
  in?: StoryLocator;
19
20
  at?: ParagraphCreateLocation;
20
21
  text?: string;
22
+ /**
23
+ * Explicit paragraph style id (e.g. `'BodyText'`) to apply instead of the
24
+ * document's default paragraph style. Neighboring styles and direct
25
+ * formatting are not inherited. An unknown style id fails
26
+ * with `INVALID_INPUT` and does not mutate the document.
27
+ */
28
+ styleId?: string;
21
29
  }
22
30
  export interface CreateParagraphSuccessResult {
23
31
  success: true;
24
32
  paragraph: BlockNodeAddress;
25
33
  insertionPoint: TextAddress;
26
34
  trackedChangeRefs?: ReceiptInsert[];
27
- /** Stable ref handle for the created block. Pass directly to superdoc_format or superdoc_edit without searching. */
35
+ /**
36
+ * Mutation-ready handle for the created paragraph. `handle.ref` is an
37
+ * opaque, self-contained ref (the same shape `ranges.resolve` produces) —
38
+ * pass it directly to `format.apply`'s `ref` without needing to also pass
39
+ * `in`/story context, even for a header/footer paragraph. It is pinned to
40
+ * `evaluatedRevision` (`refStability: 'ephemeral'`), so it is valid for
41
+ * the immediate next mutation call only; chaining a second one after that
42
+ * needs a fresh ref from a discovery read (e.g. `blocks.list`,
43
+ * `query.match`). `paragraph.nodeId` remains stable across revisions for
44
+ * non-ref addressing (e.g. `{ target: { kind: 'block', nodeType, nodeId } }`).
45
+ *
46
+ * With `options.dryRun: true`, nothing was committed, so there is no real
47
+ * block to reference: `handle.ref` is the literal placeholder `'(dry-run)'`
48
+ * and `paragraph.nodeId`/`insertionPoint.blockId` are too. Do not pass a
49
+ * dry-run `handle.ref` to `format.apply` or any other mutation — it does
50
+ * not resolve and the call fails with `INVALID_TARGET`.
51
+ *
52
+ * With no `text` (an empty paragraph), `handle.ref` spans a zero-length
53
+ * range. This is not specific to create — `format.apply`'s "inline" action
54
+ * cannot format zero-length text in general (there are no characters to
55
+ * carry run properties), so chaining `handle.ref` into it fails with
56
+ * `INVALID_TARGET` for an empty create the same way it would for any other
57
+ * zero-length selection. Use paragraph-level actions with `paragraph` (its
58
+ * `nodeId`) instead, e.g. `styles.paragraph.setStyle` or
59
+ * `format.paragraph.setIndentation`, which target the whole block and do
60
+ * not need a non-empty text range.
61
+ */
62
+ handle: ResolvedHandle;
63
+ /**
64
+ * Document revision immediately after this create committed. Pass as
65
+ * `expectedRevision` on the immediate next mutation call to chain without
66
+ * a `REVISION_MISMATCH` (SD-4886).
67
+ */
68
+ evaluatedRevision: string;
69
+ /**
70
+ * @deprecated Use `handle.ref` instead. Kept as an alias of `handle.ref`
71
+ * for backward compatibility with existing callers of this field.
72
+ */
28
73
  ref?: string;
29
74
  }
30
75
  export interface CreateParagraphFailureResult {
@@ -40,13 +85,57 @@ export interface CreateHeadingInput {
40
85
  level: HeadingLevel;
41
86
  at?: HeadingCreateLocation;
42
87
  text?: string;
88
+ /**
89
+ * Explicit paragraph style id to apply instead of the `Heading{level}`
90
+ * style normally derived from `level`. `level` still controls numbering
91
+ * suppression regardless of this override. An unknown style id fails with
92
+ * `INVALID_INPUT` and does not mutate the document.
93
+ */
94
+ styleId?: string;
43
95
  }
44
96
  export interface CreateHeadingSuccessResult {
45
97
  success: true;
46
98
  heading: BlockNodeAddress;
47
99
  insertionPoint: TextAddress;
48
100
  trackedChangeRefs?: ReceiptInsert[];
49
- /** Stable ref handle for the created block. Pass directly to superdoc_format or superdoc_edit without searching. */
101
+ /**
102
+ * Mutation-ready handle for the created heading. `handle.ref` is an
103
+ * opaque, self-contained ref (the same shape `ranges.resolve` produces) —
104
+ * pass it directly to `format.apply`'s `ref` without needing to also pass
105
+ * `in`/story context, even for a header/footer heading. It is pinned to
106
+ * `evaluatedRevision` (`refStability: 'ephemeral'`), so it is valid for
107
+ * the immediate next mutation call only; chaining a second one after that
108
+ * needs a fresh ref from a discovery read (e.g. `blocks.list`,
109
+ * `query.match`). `heading.nodeId` remains stable across revisions for
110
+ * non-ref addressing (e.g. `{ target: { kind: 'block', nodeType, nodeId } }`).
111
+ *
112
+ * With `options.dryRun: true`, nothing was committed, so there is no real
113
+ * block to reference: `handle.ref` is the literal placeholder `'(dry-run)'`
114
+ * and `heading.nodeId`/`insertionPoint.blockId` are too. Do not pass a
115
+ * dry-run `handle.ref` to `format.apply` or any other mutation — it does
116
+ * not resolve and the call fails with `INVALID_TARGET`.
117
+ *
118
+ * With no `text` (an empty heading), `handle.ref` spans a zero-length
119
+ * range. This is not specific to create — `format.apply`'s "inline" action
120
+ * cannot format zero-length text in general (there are no characters to
121
+ * carry run properties), so chaining `handle.ref` into it fails with
122
+ * `INVALID_TARGET` for an empty create the same way it would for any other
123
+ * zero-length selection. Use paragraph-level actions with `heading` (its
124
+ * `nodeId`) instead, e.g. `styles.paragraph.setStyle` or
125
+ * `format.paragraph.setIndentation`, which target the whole block and do
126
+ * not need a non-empty text range.
127
+ */
128
+ handle: ResolvedHandle;
129
+ /**
130
+ * Document revision immediately after this create committed. Pass as
131
+ * `expectedRevision` on the immediate next mutation call to chain without
132
+ * a `REVISION_MISMATCH` (SD-4886).
133
+ */
134
+ evaluatedRevision: string;
135
+ /**
136
+ * @deprecated Use `handle.ref` instead. Kept as an alias of `handle.ref`
137
+ * for backward compatibility with existing callers of this field.
138
+ */
50
139
  ref?: string;
51
140
  }
52
141
  export interface CreateHeadingFailureResult {
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.20.1-next.11";
319
+ return "2.20.1-next.12";
320
320
  } catch {
321
321
  return "unknown";
322
322
  }
@@ -46358,7 +46358,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
46358
46358
  this.config.colors = shuffleArray(this.config.colors);
46359
46359
  this.userColorMap = /* @__PURE__ */ new Map();
46360
46360
  this.colorIndex = 0;
46361
- this.version = "2.20.1-next.11";
46361
+ this.version = "2.20.1-next.12";
46362
46362
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
46363
46363
  this.superdocId = config.superdocId || require_uuid.v4();
46364
46364
  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.20.1-next.11";
317
+ return "2.20.1-next.12";
318
318
  } catch {
319
319
  return "unknown";
320
320
  }
@@ -46287,7 +46287,7 @@ var SuperDoc = class extends import_eventemitter3.default {
46287
46287
  this.config.colors = shuffleArray(this.config.colors);
46288
46288
  this.userColorMap = /* @__PURE__ */ new Map();
46289
46289
  this.colorIndex = 0;
46290
- this.version = "2.20.1-next.11";
46290
+ this.version = "2.20.1-next.12";
46291
46291
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
46292
46292
  this.superdocId = config.superdocId || v4();
46293
46293
  this.colors = this.config.colors ?? [];