@paged-media/canvas-wasm 0.65.0 → 0.67.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paged-media/canvas-wasm",
3
- "version": "0.65.0",
3
+ "version": "0.67.0",
4
4
  "type": "module",
5
5
  "main": "paged_canvas_wasm.js",
6
6
  "types": "paged_canvas_wasm.d.ts",
@@ -47,7 +47,7 @@ export type SceneBlendMode = "multiply" | "screen" | "overlay" | "darken" | "lig
47
47
  * `paged-mutate`, and the read-only viewer SDK must not link that.
48
48
  * See the crate docs.
49
49
  */
50
- export type Mutation = { op: "insertText"; args: { storyId: string; offset: number; text: string; cell?: TextCellAddr | null } } | { op: "deleteRange"; args: { storyId: string; start: number; end: number; cell?: TextCellAddr | null } } | { op: "applyStyle"; args: { storyId: string; start: number; end: number; style: string; scope: StyleScope; cell?: TextCellAddr | null; paragraph?: number | null } } | { op: "insertField"; args: { storyId: string; offset: number; field: FieldKind } } | { op: "insertAnchoredFrame"; args: { storyId: string; offset: number; width: number; height: number; imageUri?: string | null; paragraph?: number | null } } | { op: "insertHyperlink"; args: { storyId: string; start: number; end: number; url: string } } | { op: "setFieldValue"; args: { storyId: string; offset: number; value?: string | null } } | { op: "placeImage"; args: { elementId: string; uri: string; fit?: string | null } } | { op: "replaceImageBytes"; args: { elementId: string; bytes?: number[] | null } } | { op: "moveFrame"; args: { frameId: string; transform: [number, number, number, number, number, number] } } | { op: "resizeFrame"; args: { frameId: string; bounds: [number, number, number, number] } } | { op: "linkFrames"; args: { from: string; to: string } } | { op: "unlinkFrames"; args: { frame: string } } | { op: "insertPage"; args: { afterPageId: PageId | null; masterId: string | null } } | { op: "deletePage"; args: { pageId: PageId } } | { op: "resizePage"; args: { pageId: PageId; bounds: [number, number, number, number] } } | { op: "insertFrame"; args: { pageId: PageId; bounds: [number, number, number, number] } } | { op: "insertTextFrame"; args: { pageId: PageId; bounds: [number, number, number, number] } } | { op: "deleteFrame"; args: { frameId: string } } | { op: "insertLine"; args: { pageId: PageId; start: [number, number]; end: [number, number] } } | { op: "insertPath"; args: { pageId: PageId; anchors: PathAnchorSpec[]; open: boolean; smooth?: boolean } } | { op: "setDocumentDefaults"; args: { fillColor: string | null; strokeColor: string | null; strokeWeight: number | null } } | { op: "setColorSettings"; args: { cmykProfileName: string | null; rgbPolicy: string | null; intent: string | null; bpc: boolean | null } } | { op: "setProofSetup"; args: { profileName: string | null; simulatePaperWhite?: boolean; intent: string | null } } | { op: "importSwatchLibrary"; args: { bytes: number[]; groupName?: string | null } } | { op: "setInkSetting"; args: { spotId: string; convertToProcess?: boolean; aliasTo?: string | null } } | { op: "setUseStandardLabForSpots"; args: { enabled: boolean } } | { op: "pathPointInsert"; args: { elementId: ElementId; index: number; anchor: PathAnchorSpec; prevSubpathStarts?: number[] | null } } | { op: "pathPointRemove"; args: { elementId: ElementId; index: number } } | { op: "pathOpenAt"; args: { elementId: ElementId; index: number } } | { op: "outlineStroke"; args: { elementId: ElementId; width: number; cap: string; join: string; miterLimit: number } } | { op: "offsetPath"; args: { elementId: ElementId; delta: number; join: string; miterLimit: number } } | { op: "simplifyPath"; args: { elementId: ElementId; tolerance: number } } | { op: "closePath"; args: { elementId: ElementId; subpath?: number | null } } | { op: "joinPaths"; args: { elementId: ElementId; otherId: ElementId } } | { op: "pasteInto"; args: { containerId: ElementId; childId: ElementId } } | { op: "releaseFrom"; args: { childId: ElementId } } | { op: "reorderElement"; args: { elementId: ElementId; to: ZOrderTarget } } | { op: "applyOpacityMask"; args: { targetId: ElementId; maskId: ElementId; maskType?: string | null; invert?: boolean | null } } | { op: "releaseOpacityMask"; args: { targetId: ElementId } } | { op: "attachTextToPath"; args: { elementId: ElementId; storyId: string; pathTypeAlignment?: string | null; flipPathEffect?: string | null; startBracket?: number | null; endBracket?: number | null } } | { op: "detachTextFromPath"; args: { elementId: ElementId } } | { op: "createGroup"; args: { memberIds: ElementId[] } } | { op: "dissolveGroup"; args: { groupId: string } } | { op: "duplicateElements"; args: { elementIds: ElementId[]; offset: [number, number] } } | { op: "setGroupTransform"; args: { groupId: string; transform?: [number, number, number, number, number, number] | null } } | { op: "setPluginMetadata"; args: { elementId: ElementId; key: string; value?: string | null; caller?: string | null } } | { op: "pathPointCurveType"; args: { elementId: ElementId; index: number; smooth: boolean } } | { op: "pathPointSet"; args: { elementId: ElementId; index: number; role: PathPointRole; position: [number, number] } } | { op: "batch"; args: { ops: Mutation[] } } | { op: "bindCreated"; args: { handle: string } } | { op: "layerSetVisible"; args: { layerId: string; visible: boolean } } | { op: "layerSetLocked"; args: { layerId: string; locked: boolean } } | { op: "layerSetPrintable"; args: { layerId: string; printable: boolean } } | { op: "layerSetName"; args: { layerId: string; name: string } } | { op: "layerMove"; args: { layerId: string; newIndex: number } } | { op: "layerInsert"; args: { position: number; name: string } } | { op: "layerRemove"; args: { layerId: string } } | { op: "setElementProperty"; args: { elementId: ElementId; path: PropertyPath; value: Value } } | { op: "pathfinderBoolean"; args: { kept: ElementId; others: ElementId[]; kind: PathfinderKind } } | { op: "pathfinderDivide"; args: { elementIds: ElementId[] } } | { op: "pathfinderTrim"; args: { elementIds: ElementId[] } } | { op: "pathfinderMerge"; args: { elementIds: ElementId[] } } | { op: "pathfinderCrop"; args: { elementIds: ElementId[] } } | { op: "pathfinderOutline"; args: { elementIds: ElementId[] } } | { op: "pathfinderMinusBack"; args: { elementIds: ElementId[] } } | { op: "pathfinderFaces"; args: { elementIds: ElementId[]; faces: string[]; mode: FaceSelectMode } } | { op: "createSwatch"; args: { spec: SwatchSpec } } | { op: "editSwatch"; args: { swatchId: string; spec: SwatchSpec } } | { op: "deleteSwatch"; args: { swatchId: string } } | { op: "createGradient"; args: { spec: GradientSpec } } | { op: "editGradient"; args: { gradientId: string; spec: GradientSpec } } | { op: "deleteGradient"; args: { gradientId: string } } | { op: "createColorGroup"; args: { spec: ColorGroupSpec } } | { op: "editColorGroup"; args: { groupId: string; spec: ColorGroupSpec } } | { op: "deleteColorGroup"; args: { groupId: string } } | { op: "createNumberingList"; args: { spec: NumberingListSpec } } | { op: "editNumberingList"; args: { listId: string; spec: NumberingListSpec } } | { op: "deleteNumberingList"; args: { listId: string } } | { op: "createParagraphStyle"; args: { selfId?: string | null; name?: string | null; basedOn?: string | null } } | { op: "renameParagraphStyle"; args: { styleId: string; name: string } } | { op: "deleteParagraphStyle"; args: { styleId: string } } | { op: "createCharacterStyle"; args: { selfId?: string | null; name?: string | null; basedOn?: string | null } } | { op: "renameCharacterStyle"; args: { styleId: string; name: string } } | { op: "deleteCharacterStyle"; args: { styleId: string } } | { op: "createObjectStyle"; args: { selfId?: string | null; name?: string | null; basedOn?: string | null } } | { op: "renameObjectStyle"; args: { styleId: string; name: string } } | { op: "deleteObjectStyle"; args: { styleId: string } } | { op: "createCellStyle"; args: { selfId?: string | null; name?: string | null; basedOn?: string | null } } | { op: "renameCellStyle"; args: { styleId: string; name: string } } | { op: "deleteCellStyle"; args: { styleId: string } } | { op: "createTableStyle"; args: { selfId?: string | null; name?: string | null; basedOn?: string | null } } | { op: "renameTableStyle"; args: { styleId: string; name: string } } | { op: "deleteTableStyle"; args: { styleId: string } } | { op: "setStyleProperty"; args: { collection: StyleCollection; styleId: string; path: PropertyPath; value: Value } } | { op: "insertOval"; args: { pageId: PageId; bounds: [number, number, number, number] } } | { op: "insertGuide"; args: { spreadId: string; orientation: GuideOrientationSpec; position: number; pageIndex?: number } } | { op: "moveGuide"; args: { guideId: string; position: number } } | { op: "deleteGuide"; args: { guideId: string } } | { op: "setConditionVisible"; args: { condition: string; visible: boolean } } | { op: "setFlowGrowRule"; args: { storyId: string; grow: boolean; maxPages?: number | null; copyFrameOptions?: boolean | null } } | { op: "activateConditionSet"; args: { set: string } } | { op: "applyMasterToPage"; args: { page: PageId; master?: string | null } } | { op: "duplicatePage"; args: { page: PageId } } | { op: "insertSection"; args: { atPage: PageId; prefix?: string | null; numberingStyle?: string | null; startAt?: number | null } } | { op: "editSection"; args: { sectionId: string; prefix?: string | null | null; numberingStyle?: string | null; startAt?: number | null | null } } | { op: "deleteSection"; args: { sectionId: string } } | { op: "setRowHeight"; args: { storyId: string; tableId: string; row: number; height?: number | null } } | { op: "setColumnWidth"; args: { storyId: string; tableId: string; col: number; width?: number | null } } | { op: "insertTableRow"; args: { storyId: string; tableId: string; at: number } } | { op: "deleteTableRow"; args: { storyId: string; tableId: string; at: number } } | { op: "insertTableColumn"; args: { storyId: string; tableId: string; at: number } } | { op: "deleteTableColumn"; args: { storyId: string; tableId: string; at: number } } | { op: "insertHeaderRow"; args: { storyId: string; tableId: string } } | { op: "removeHeaderRow"; args: { storyId: string; tableId: string } } | { op: "insertFooterRow"; args: { storyId: string; tableId: string } } | { op: "removeFooterRow"; args: { storyId: string; tableId: string } } | { op: "setCellSpan"; args: { storyId: string; tableId: string; row: number; col: number; rowSpan: number; columnSpan: number } } | { op: "insertTable"; args: { storyId: string; rows: number; cols: number; headerRows?: number; footerRows?: number; columnWidths?: number[]; rowHeights?: number[] } };
50
+ export type Mutation = { op: "insertText"; args: { storyId: string; offset: number; text: string; cell?: TextCellAddr | null } } | { op: "deleteRange"; args: { storyId: string; start: number; end: number; cell?: TextCellAddr | null } } | { op: "applyStyle"; args: { storyId: string; start: number; end: number; style: string; scope: StyleScope; cell?: TextCellAddr | null; paragraph?: number | null } } | { op: "insertField"; args: { storyId: string; offset: number; field: FieldKind } } | { op: "insertAnchoredFrame"; args: { storyId: string; offset: number; width: number; height: number; imageUri?: string | null; paragraph?: number | null } } | { op: "insertHyperlink"; args: { storyId: string; start: number; end: number; url: string } } | { op: "setFieldValue"; args: { storyId: string; offset: number; value?: string | null } } | { op: "placeImage"; args: { elementId: string; uri: string; fit?: string | null } } | { op: "replaceImageBytes"; args: { elementId: string; bytes?: number[] | null } } | { op: "moveFrame"; args: { frameId: string; transform: [number, number, number, number, number, number] } } | { op: "resizeFrame"; args: { frameId: string; bounds: [number, number, number, number] } } | { op: "linkFrames"; args: { from: string; to: string } } | { op: "unlinkFrames"; args: { frame: string } } | { op: "insertPage"; args: { afterPageId: PageId | null; masterId: string | null } } | { op: "deletePage"; args: { pageId: PageId } } | { op: "resizePage"; args: { pageId: PageId; bounds: [number, number, number, number] } } | { op: "insertFrame"; args: { pageId: PageId; bounds: [number, number, number, number] } } | { op: "insertTextFrame"; args: { pageId: PageId; bounds: [number, number, number, number] } } | { op: "deleteFrame"; args: { frameId: string } } | { op: "insertLine"; args: { pageId: PageId; start: [number, number]; end: [number, number] } } | { op: "insertPath"; args: { pageId: PageId; anchors: PathAnchorSpec[]; open: boolean; smooth?: boolean } } | { op: "setDocumentDefaults"; args: { fillColor: string | null; strokeColor: string | null; strokeWeight: number | null } } | { op: "setColorSettings"; args: { cmykProfileName: string | null; rgbPolicy: string | null; intent: string | null; bpc: boolean | null } } | { op: "setProofSetup"; args: { profileName: string | null; simulatePaperWhite?: boolean; intent: string | null } } | { op: "importSwatchLibrary"; args: { bytes: number[]; groupName?: string | null } } | { op: "setInkSetting"; args: { spotId: string; convertToProcess?: boolean; aliasTo?: string | null } } | { op: "setUseStandardLabForSpots"; args: { enabled: boolean } } | { op: "pathPointInsert"; args: { elementId: ElementId; index: number; anchor: PathAnchorSpec; prevSubpathStarts?: number[] | null } } | { op: "pathPointRemove"; args: { elementId: ElementId; index: number } } | { op: "pathOpenAt"; args: { elementId: ElementId; index: number } } | { op: "outlineStroke"; args: { elementId: ElementId; width: number; cap: string; join: string; miterLimit: number } } | { op: "offsetPath"; args: { elementId: ElementId; delta: number; join: string; miterLimit: number } } | { op: "simplifyPath"; args: { elementId: ElementId; tolerance: number } } | { op: "closePath"; args: { elementId: ElementId; subpath?: number | null } } | { op: "joinPaths"; args: { elementId: ElementId; otherId: ElementId } } | { op: "pasteInto"; args: { containerId: ElementId; childId: ElementId } } | { op: "releaseFrom"; args: { childId: ElementId } } | { op: "reorderElement"; args: { elementId: ElementId; to: ZOrderTarget } } | { op: "applyOpacityMask"; args: { targetId: ElementId; maskId: ElementId; maskType?: string | null; invert?: boolean | null } } | { op: "releaseOpacityMask"; args: { targetId: ElementId } } | { op: "attachTextToPath"; args: { elementId: ElementId; storyId: string; pathTypeAlignment?: string | null; flipPathEffect?: string | null; startBracket?: number | null; endBracket?: number | null } } | { op: "detachTextFromPath"; args: { elementId: ElementId } } | { op: "createGroup"; args: { memberIds: ElementId[] } } | { op: "dissolveGroup"; args: { groupId: string } } | { op: "duplicateElements"; args: { elementIds: ElementId[]; offset: [number, number] } } | { op: "setGroupTransform"; args: { groupId: string; transform?: [number, number, number, number, number, number] | null } } | { op: "setPluginMetadata"; args: { elementId: ElementId; key: string; value?: string | null; caller?: string | null } } | { op: "pathPointCurveType"; args: { elementId: ElementId; index: number; smooth: boolean } } | { op: "pathPointSet"; args: { elementId: ElementId; index: number; role: PathPointRole; position: [number, number] } } | { op: "batch"; args: { ops: Mutation[] } } | { op: "bindCreated"; args: { handle: string } } | { op: "layerSetVisible"; args: { layerId: string; visible: boolean } } | { op: "layerSetLocked"; args: { layerId: string; locked: boolean } } | { op: "layerSetPrintable"; args: { layerId: string; printable: boolean } } | { op: "layerSetName"; args: { layerId: string; name: string } } | { op: "layerMove"; args: { layerId: string; newIndex: number } } | { op: "layerInsert"; args: { position: number; name: string } } | { op: "layerRemove"; args: { layerId: string } } | { op: "setElementProperty"; args: { elementId: ElementId; path: PropertyPath; value: Value } } | { op: "pathfinderBoolean"; args: { kept: ElementId; others: ElementId[]; kind: PathfinderKind } } | { op: "pathfinderDivide"; args: { elementIds: ElementId[] } } | { op: "pathfinderTrim"; args: { elementIds: ElementId[] } } | { op: "pathfinderMerge"; args: { elementIds: ElementId[] } } | { op: "pathfinderCrop"; args: { elementIds: ElementId[] } } | { op: "pathfinderOutline"; args: { elementIds: ElementId[] } } | { op: "pathfinderMinusBack"; args: { elementIds: ElementId[] } } | { op: "pathfinderFaces"; args: { elementIds: ElementId[]; faces: string[]; mode: FaceSelectMode } } | { op: "createSwatch"; args: { spec: SwatchSpec } } | { op: "editSwatch"; args: { swatchId: string; spec: SwatchSpec } } | { op: "deleteSwatch"; args: { swatchId: string } } | { op: "createGradient"; args: { spec: GradientSpec } } | { op: "editGradient"; args: { gradientId: string; spec: GradientSpec } } | { op: "deleteGradient"; args: { gradientId: string } } | { op: "createColorGroup"; args: { spec: ColorGroupSpec } } | { op: "editColorGroup"; args: { groupId: string; spec: ColorGroupSpec } } | { op: "deleteColorGroup"; args: { groupId: string } } | { op: "createNumberingList"; args: { spec: NumberingListSpec } } | { op: "editNumberingList"; args: { listId: string; spec: NumberingListSpec } } | { op: "deleteNumberingList"; args: { listId: string } } | { op: "createParagraphStyle"; args: { selfId?: string | null; name?: string | null; basedOn?: string | null } } | { op: "renameParagraphStyle"; args: { styleId: string; name: string } } | { op: "deleteParagraphStyle"; args: { styleId: string } } | { op: "createCharacterStyle"; args: { selfId?: string | null; name?: string | null; basedOn?: string | null } } | { op: "renameCharacterStyle"; args: { styleId: string; name: string } } | { op: "deleteCharacterStyle"; args: { styleId: string } } | { op: "createObjectStyle"; args: { selfId?: string | null; name?: string | null; basedOn?: string | null } } | { op: "renameObjectStyle"; args: { styleId: string; name: string } } | { op: "deleteObjectStyle"; args: { styleId: string } } | { op: "createCellStyle"; args: { selfId?: string | null; name?: string | null; basedOn?: string | null } } | { op: "renameCellStyle"; args: { styleId: string; name: string } } | { op: "deleteCellStyle"; args: { styleId: string } } | { op: "createTableStyle"; args: { selfId?: string | null; name?: string | null; basedOn?: string | null } } | { op: "renameTableStyle"; args: { styleId: string; name: string } } | { op: "deleteTableStyle"; args: { styleId: string } } | { op: "setStyleProperty"; args: { collection: StyleCollection; styleId: string; path: PropertyPath; value: Value } } | { op: "insertOval"; args: { pageId: PageId; bounds: [number, number, number, number] } } | { op: "insertGuide"; args: { spreadId: string; orientation: GuideOrientationSpec; position: number; pageIndex?: number } } | { op: "moveGuide"; args: { guideId: string; position: number } } | { op: "deleteGuide"; args: { guideId: string } } | { op: "setConditionVisible"; args: { condition: string; visible: boolean } } | { op: "setFlowGrowRule"; args: { storyId: string; grow: boolean; maxPages?: number | null; copyFrameOptions?: boolean | null } } | { op: "activateConditionSet"; args: { set: string } } | { op: "applyMasterToPage"; args: { page: PageId; master?: string | null } } | { op: "duplicatePage"; args: { page: PageId } } | { op: "insertSection"; args: { atPage: PageId; prefix?: string | null; numberingStyle?: string | null; startAt?: number | null } } | { op: "editSection"; args: { sectionId: string; prefix?: string | null | null; numberingStyle?: string | null; startAt?: number | null | null } } | { op: "deleteSection"; args: { sectionId: string } } | { op: "setRowHeight"; args: { storyId: string; tableId: string; row: number; height?: number | null } } | { op: "setColumnWidth"; args: { storyId: string; tableId: string; col: number; width?: number | null } } | { op: "insertTableRow"; args: { storyId: string; tableId: string; at: number } } | { op: "deleteTableRow"; args: { storyId: string; tableId: string; at: number } } | { op: "insertTableColumn"; args: { storyId: string; tableId: string; at: number } } | { op: "deleteTableColumn"; args: { storyId: string; tableId: string; at: number } } | { op: "insertHeaderRow"; args: { storyId: string; tableId: string } } | { op: "removeHeaderRow"; args: { storyId: string; tableId: string } } | { op: "insertFooterRow"; args: { storyId: string; tableId: string } } | { op: "removeFooterRow"; args: { storyId: string; tableId: string } } | { op: "setCellSpan"; args: { storyId: string; tableId: string; row: number; col: number; rowSpan: number; columnSpan: number } } | { op: "insertTable"; args: { storyId: string; rows: number; cols: number; headerRows?: number; footerRows?: number; columnWidths?: number[]; rowHeights?: number[] } } | { op: "deleteTable"; args: { storyId: string; tableId: string } };
51
51
 
52
52
  /**
53
53
  * A per-run script budget on the wire (v63). Every field is optional
@@ -98,6 +98,19 @@ export interface SceneLayer {
98
98
  items: SceneItem[];
99
99
  }
100
100
 
101
+ /**
102
+ * A point target the query landed on.
103
+ */
104
+ export interface SnapPointHit {
105
+ source: SnapSource;
106
+ at: [number, number];
107
+ element?: ElementId | null;
108
+ /**
109
+ * Flat anchor index when `source` is `anchor` on a path.
110
+ */
111
+ anchorIndex?: number | null;
112
+ }
113
+
101
114
  /**
102
115
  * A single-line text run in frame-content coordinates (C-1.1).
103
116
  */
@@ -155,6 +168,25 @@ export interface WordBounds {
155
168
  end: number;
156
169
  }
157
170
 
171
+ /**
172
+ * An alignment line the query was pulled onto (one per axis).
173
+ */
174
+ export interface SnapAxisHit {
175
+ source: SnapSource;
176
+ /**
177
+ * x for the vertical line, y for the horizontal one (page-local).
178
+ */
179
+ position: number;
180
+ /**
181
+ * The element whose point the line runs through, for smart guides.
182
+ */
183
+ element?: ElementId | null;
184
+ /**
185
+ * That point, so a host can draw the guide from it to the pointer.
186
+ */
187
+ through?: [number, number] | null;
188
+ }
189
+
158
190
  /**
159
191
  * Axis the snap line guides. `X` is a vertical guide (snaps the x
160
192
  * coordinate); `Y` is a horizontal guide (snaps the y coordinate).
@@ -212,23 +244,22 @@ export interface GroupSpec {
212
244
  /**
213
245
  * B-06 — `RequestNearestPathPoint` reply payload. Coordinates are
214
246
  * in the element\'s local space (the `PathAnchors` space).
215
- */
216
- export interface NearestPathPointResult {
217
- /**
218
- * Flat index of the segment\'s START anchor.
219
- */
220
- segStart: number;
221
- /**
222
- * Flat index of the segment\'s END anchor (wraps to the subpath
223
- * start on a closing segment).
224
- */
225
- segEnd: number;
247
+ * v66 (RFI C-69) — `RequestTextOutlines` reply payload: the frame\'s
248
+ * composed glyphs as closed outlines, in PAGE space (the space
249
+ * `insertPath` takes), grouped into one run per fill colour so each
250
+ * becomes one compound path. Outlines are exactly the shapes the
251
+ * renderer fills (the same `FillPath` commands), so what is inserted
252
+ * looks like what was on screen. Stroked text, gradients on text and
253
+ * overset text are not included.
254
+ */
255
+ export interface TextOutlinesResult {
256
+ id: ElementId;
257
+ pageId: PageId;
258
+ runs: TextOutlineRun[];
226
259
  /**
227
- * Curve parameter on that segment, 0..=1.
260
+ * Glyphs left out (stroked, or a non-solid paint).
228
261
  */
229
- t: number;
230
- point: [number, number];
231
- distance: number;
262
+ skippedGlyphs?: number;
232
263
  }
233
264
 
234
265
  /**
@@ -364,6 +395,14 @@ export interface TextPathSpec {
364
395
  endBracket?: number | null;
365
396
  }
366
397
 
398
+ /**
399
+ * C-65 — one plugin-metadata Label entry on a scene-tree node.
400
+ */
401
+ export interface PluginMetadataEntry {
402
+ key: string;
403
+ value: string;
404
+ }
405
+
367
406
  /**
368
407
  * Canonical selection / caret. `start == end` is a caret;
369
408
  * `start < end` is a range. Endpoints are normalised so `start ≤
@@ -556,7 +595,7 @@ export type CaretDirection = "up" | "down";
556
595
  /**
557
596
  * Discriminated payload of a `WorkerToMain` message.
558
597
  */
559
- export type WorkerToMainKind = { kind: "ready"; payload: { protocol: ProtocolVersion } } | { kind: "documentLoaded"; payload: DocumentHandle } | { kind: "loadFailed"; payload: { error: LoadError } } | { kind: "mutationFailed"; payload: { error: WorkerError } } | { kind: "displayListReady"; payload: { pageId: PageId; lod: LodTier; commands: number; layoutGeneration: number; numberingGeneration: number } } | { kind: "hitResult"; payload: HitResult } | { kind: "pagesDirty"; payload: { pageIds: PageId[] } } | { kind: "storyDirty"; payload: { storyId: string } } | { kind: "warning"; payload: { kind: string; details: string } } | { kind: "stats"; payload: DocumentStats } | { kind: "snapshotReady"; payload: SnapshotPng } | { kind: "snapshotFailed"; payload: { error: SnapshotError } } | { kind: "mutationApplied"; payload: { clientSeq: number; appliedSeq: number; pageIds: PageId[]; cacheStats: LayoutCacheStats; createdId?: ElementId | null; minted?: MintedElement[]; pageStructureChanged?: boolean; pageSizesPt?: [number, number][] | null; reflow?: FrameReflowInfo | null } } | { kind: "selectionGeometry"; payload: { rects: SelectionRect[] } } | { kind: "caretGeometry"; payload: { caret: CaretGeometry | null } } | { kind: "caretNavResult"; payload: { offset?: number | null } } | { kind: "lineBoundsResult"; payload: { bounds?: LineBounds | null } } | { kind: "wordBoundsResult"; payload: { bounds?: WordBounds | null } } | { kind: "paragraphBoundsResult"; payload: { bounds?: ParagraphBounds | null } } | { kind: "storyContentResult"; payload: { content?: StoryContent | null } } | { kind: "undoApplied"; payload: { undoneSeq: number; appliedSeq: number; pageIds: PageId[]; cacheStats: LayoutCacheStats; pageStructureChanged?: boolean; pageSizesPt?: [number, number][] | null } } | { kind: "redoApplied"; payload: { redoneSeq: number; appliedSeq: number; pageIds: PageId[]; cacheStats: LayoutCacheStats; pageStructureChanged?: boolean; pageSizesPt?: [number, number][] | null } } | { kind: "fontRegistered"; payload: { family: string; pageIds?: PageId[]; pageStructureChanged?: boolean; pageSizesPt?: [number, number][] | null } } | { kind: "fontRegistryCleared"; payload: { pageIds?: PageId[]; pageStructureChanged?: boolean; pageSizesPt?: [number, number][] | null } } | { kind: "colorProfileRegistered"; payload: { name: string } } | { kind: "elementSelectionApplied"; payload: { ids: ElementId[] } } | { kind: "marqueeHits"; payload: { ids: ElementId[] } } | { kind: "elementGeometry"; payload: { items: ElementGeometryItem[] } } | { kind: "groupLeaves"; payload: { ids: ElementId[] } } | { kind: "pathAnchors"; payload: { result: PathAnchorsResult | null } } | { kind: "planarRegions"; payload: { result: PlanarRegionsResult } } | { kind: "nearestPathPoint"; payload: { result: NearestPathPointResult | null } } | { kind: "layers"; payload: { items: LayerSummary[] } } | { kind: "collectionReply"; payload: { name: CollectionName; items: any } } | { kind: "frameChainResult"; payload: { links: FrameChainLink[] } } | { kind: "documentPlaceholders"; payload: { items: PlaceholderItem[] } } | { kind: "placedAssetBytes"; payload: { elementId: string; found: boolean; uri: string; width: number; height: number; encoded: number[] } } | { kind: "fontFaceBytes"; payload: { found: boolean; family: string; style: string | null; postscriptName: string | null; format: string; bytes: number[] } } | { kind: "measureTextResult"; payload: { advance: number; ascender: number; descender: number } } | { kind: "sceneLayerApplied"; payload: { elementId: string; applied: boolean } } | { kind: "resourceClaimApplied"; payload: { imageId: string; applied: boolean; needed?: ResourceTilesNeededWire[] } } | { kind: "resourceTilesNeeded"; payload: ResourceTilesNeededWire } | { kind: "frameReflow"; payload: { frameId: string; contentBox: [number, number, number, number] } } | { kind: "documentMetaReply"; payload: { meta: DocumentMeta } } | { kind: "colorPreviewReply"; payload: { result: ColorPreview | null } } | { kind: "colorComputeReply"; payload: { rgbHex: string; cmyk: [number, number, number, number] | null; outOfGamut: boolean } } | { kind: "gradientDetailReply"; payload: { result: GradientDetail | null } } | { kind: "swatchLibraryExported"; payload: { aseBytes: number[] } } | { kind: "exportPdfBegun"; payload: { session: number; pageCount: number } } | { kind: "exportPdfProgress"; payload: { session: number; done: number; total: number } } | { kind: "pdfExported"; payload: { pdfBytes: number[]; diagnostics: string[]; findings?: PreflightFinding[] } } | { kind: "exportPdfCancelled"; payload: { session: number } } | { kind: "exportPdfFailed"; payload: { error: string } } | { kind: "idmlExported"; payload: { idmlBytes: number[]; lost?: string[]; links?: ExportedLinkWire[] } } | { kind: "exportIdmlFailed"; payload: { error: string } } | { kind: "pagedPartWritten"; payload: {} } | { kind: "pagedPartRead"; payload: { found: boolean; bytes: number[] } } | { kind: "pagedPartList"; payload: { paths: string[] } } | { kind: "pagedExported"; payload: { bytes: number[] } } | { kind: "pagedPartFailed"; payload: { error: string } } | { kind: "elementProperties"; payload: { result: ElementProperties | null } } | { kind: "styleProperties"; payload: { result: StyleProperties | null } } | { kind: "sceneTree"; payload: { roots: SceneTreeNode[] } } | { kind: "scriptResult"; payload: { output: string[]; error: string | null; budgetKind?: ScriptBudgetKind } } | { kind: "gestureBegun"; payload: { handle: GestureHandle } } | { kind: "gestureUpdated"; payload: { handle: GestureHandle; pageIds: PageId[]; snapLines?: SnapLine[] } } | { kind: "gestureCommitted"; payload: { handle: GestureHandle; appliedSeq: number; pageIds: PageId[]; cacheStats: LayoutCacheStats } } | { kind: "gestureCancelled"; payload: { handle: GestureHandle; pageIds: PageId[] } } | { kind: "gestureFailed"; payload: { error: GestureFailure } } | { kind: "attachReady"; payload: { gpuActive: boolean; sceneCacheBudget: number } } | { kind: "gestureSnapLines"; payload: { snapLines: SnapLine[] } } | { kind: "resolutionDone"; payload: ResolutionResult };
598
+ export type WorkerToMainKind = { kind: "ready"; payload: { protocol: ProtocolVersion } } | { kind: "documentLoaded"; payload: DocumentHandle } | { kind: "loadFailed"; payload: { error: LoadError } } | { kind: "mutationFailed"; payload: { error: WorkerError } } | { kind: "displayListReady"; payload: { pageId: PageId; lod: LodTier; commands: number; layoutGeneration: number; numberingGeneration: number } } | { kind: "hitResult"; payload: HitResult } | { kind: "pagesDirty"; payload: { pageIds: PageId[] } } | { kind: "storyDirty"; payload: { storyId: string } } | { kind: "warning"; payload: { kind: string; details: string } } | { kind: "stats"; payload: DocumentStats } | { kind: "snapshotReady"; payload: SnapshotPng } | { kind: "snapshotFailed"; payload: { error: SnapshotError } } | { kind: "mutationApplied"; payload: { clientSeq: number; appliedSeq: number; pageIds: PageId[]; cacheStats: LayoutCacheStats; createdId?: ElementId | null; minted?: MintedElement[]; pageStructureChanged?: boolean; pageSizesPt?: [number, number][] | null; reflow?: FrameReflowInfo | null } } | { kind: "selectionGeometry"; payload: { rects: SelectionRect[] } } | { kind: "caretGeometry"; payload: { caret: CaretGeometry | null } } | { kind: "caretNavResult"; payload: { offset?: number | null } } | { kind: "lineBoundsResult"; payload: { bounds?: LineBounds | null } } | { kind: "wordBoundsResult"; payload: { bounds?: WordBounds | null } } | { kind: "paragraphBoundsResult"; payload: { bounds?: ParagraphBounds | null } } | { kind: "storyContentResult"; payload: { content?: StoryContent | null } } | { kind: "undoApplied"; payload: { undoneSeq: number; appliedSeq: number; pageIds: PageId[]; cacheStats: LayoutCacheStats; pageStructureChanged?: boolean; pageSizesPt?: [number, number][] | null } } | { kind: "redoApplied"; payload: { redoneSeq: number; appliedSeq: number; pageIds: PageId[]; cacheStats: LayoutCacheStats; pageStructureChanged?: boolean; pageSizesPt?: [number, number][] | null } } | { kind: "fontRegistered"; payload: { family: string; pageIds?: PageId[]; pageStructureChanged?: boolean; pageSizesPt?: [number, number][] | null } } | { kind: "fontRegistryCleared"; payload: { pageIds?: PageId[]; pageStructureChanged?: boolean; pageSizesPt?: [number, number][] | null } } | { kind: "colorProfileRegistered"; payload: { name: string } } | { kind: "elementSelectionApplied"; payload: { ids: ElementId[] } } | { kind: "marqueeHits"; payload: { ids: ElementId[] } } | { kind: "elementGeometry"; payload: { items: ElementGeometryItem[] } } | { kind: "groupLeaves"; payload: { ids: ElementId[] } } | { kind: "pathAnchors"; payload: { result: PathAnchorsResult | null } } | { kind: "textOutlines"; payload: { result: TextOutlinesResult | null } } | { kind: "snapPoint"; payload: { result: SnapPointResult } } | { kind: "snapSettingsApplied"; payload: { settings: SnapSettings } } | { kind: "planarRegions"; payload: { result: PlanarRegionsResult } } | { kind: "nearestPathPoint"; payload: { result: NearestPathPointResult | null } } | { kind: "layers"; payload: { items: LayerSummary[] } } | { kind: "collectionReply"; payload: { name: CollectionName; items: any } } | { kind: "frameChainResult"; payload: { links: FrameChainLink[] } } | { kind: "documentPlaceholders"; payload: { items: PlaceholderItem[] } } | { kind: "placedAssetBytes"; payload: { elementId: string; found: boolean; uri: string; width: number; height: number; encoded: number[] } } | { kind: "fontFaceBytes"; payload: { found: boolean; family: string; style: string | null; postscriptName: string | null; format: string; bytes: number[] } } | { kind: "measureTextResult"; payload: { advance: number; ascender: number; descender: number } } | { kind: "sceneLayerApplied"; payload: { elementId: string; applied: boolean; pageIds?: PageId[] } } | { kind: "resourceClaimApplied"; payload: { imageId: string; applied: boolean; needed?: ResourceTilesNeededWire[] } } | { kind: "resourceTilesNeeded"; payload: ResourceTilesNeededWire } | { kind: "frameReflow"; payload: { frameId: string; contentBox: [number, number, number, number] } } | { kind: "documentMetaReply"; payload: { meta: DocumentMeta } } | { kind: "colorPreviewReply"; payload: { result: ColorPreview | null } } | { kind: "colorComputeReply"; payload: { rgbHex: string; cmyk: [number, number, number, number] | null; outOfGamut: boolean } } | { kind: "gradientDetailReply"; payload: { result: GradientDetail | null } } | { kind: "swatchLibraryExported"; payload: { aseBytes: number[] } } | { kind: "exportPdfBegun"; payload: { session: number; pageCount: number } } | { kind: "exportPdfProgress"; payload: { session: number; done: number; total: number } } | { kind: "pdfExported"; payload: { pdfBytes: number[]; diagnostics: string[]; findings?: PreflightFinding[] } } | { kind: "exportPdfCancelled"; payload: { session: number } } | { kind: "exportPdfFailed"; payload: { error: string } } | { kind: "idmlExported"; payload: { idmlBytes: number[]; lost?: string[]; links?: ExportedLinkWire[] } } | { kind: "exportIdmlFailed"; payload: { error: string } } | { kind: "pagedPartWritten"; payload: {} } | { kind: "pagedPartRead"; payload: { found: boolean; bytes: number[] } } | { kind: "pagedPartList"; payload: { paths: string[] } } | { kind: "pagedPartDeleted"; payload: { existed: boolean } } | { kind: "pagedExported"; payload: { bytes: number[] } } | { kind: "pagedPartFailed"; payload: { error: string } } | { kind: "elementProperties"; payload: { result: ElementProperties | null } } | { kind: "styleProperties"; payload: { result: StyleProperties | null } } | { kind: "sceneTree"; payload: { roots: SceneTreeNode[] } } | { kind: "scriptResult"; payload: { output: string[]; error: string | null; budgetKind?: ScriptBudgetKind } } | { kind: "gestureBegun"; payload: { handle: GestureHandle } } | { kind: "gestureUpdated"; payload: { handle: GestureHandle; pageIds: PageId[]; snapLines?: SnapLine[] } } | { kind: "gestureCommitted"; payload: { handle: GestureHandle; appliedSeq: number; pageIds: PageId[]; cacheStats: LayoutCacheStats } } | { kind: "gestureCancelled"; payload: { handle: GestureHandle; pageIds: PageId[] } } | { kind: "gestureFailed"; payload: { error: GestureFailure } } | { kind: "attachReady"; payload: { gpuActive: boolean; sceneCacheBudget: number } } | { kind: "gestureSnapLines"; payload: { snapLines: SnapLine[] } } | { kind: "resolutionDone"; payload: ResolutionResult };
560
599
 
561
600
  /**
562
601
  * Editor-ops — wire mirror of `paged_model::GradientFeatherParams`.
@@ -693,6 +732,18 @@ export interface SceneTreeNode {
693
732
  */
694
733
  label: string;
695
734
  children?: SceneTreeNode[];
735
+ /**
736
+ * C-65 — the item\'s plugin metadata (its reserved-namespace
737
+ * `x-paged:` Label entries, the same rows `RequestElementProperties`
738
+ * reports as `pluginMetadata`), so one tree read answers what used to
739
+ * take one property read PER LEAF: paged.draw\'s link discovery cost
740
+ * 1 403 round trips on a 1 403-leaf document. PRESENT on every page
741
+ * ITEM row — empty when the item carries none — and omitted only for
742
+ * spread / page rows, so a reader can tell \"this engine reports
743
+ * metadata here and there is none\" from \"this engine predates the
744
+ * field\" (an older engine omits it everywhere). Additive.
745
+ */
746
+ pluginMetadata?: PluginMetadataEntry[];
696
747
  }
697
748
 
698
749
  /**
@@ -730,6 +781,18 @@ export interface ElementProperties {
730
781
  entries: PropertyEntry[];
731
782
  }
732
783
 
784
+ /**
785
+ * Leave an element (or some of its anchors) out of the targets. With
786
+ * `anchors` absent the whole element is ignored; with `anchors` given,
787
+ * those anchors (flat indices, the `pathAnchors` numbering) are not
788
+ * targets and neither are the element\'s segments, since a host editing
789
+ * those anchors is previewing a path the engine has not seen yet.
790
+ */
791
+ export interface SnapExclude {
792
+ id: ElementId;
793
+ anchors?: number[] | null;
794
+ }
795
+
733
796
  /**
734
797
  * Lightweight serialisable variant — the canvas worker hands this
735
798
  * (encoded as a `WorkerToMain` message) to the main thread. The
@@ -894,6 +957,41 @@ export interface FieldChange {
894
957
  newText: string;
895
958
  }
896
959
 
960
+ /**
961
+ * One fill colour\'s glyph outlines (see [`TextOutlinesResult`]).
962
+ */
963
+ export interface TextOutlineRun {
964
+ /**
965
+ * sRGB, 0..1 — the colour the renderer filled with.
966
+ */
967
+ rgb: [number, number, number];
968
+ /**
969
+ * The CMYK the paint carried, 0..1, when it was a process colour.
970
+ */
971
+ cmyk?: [number, number, number, number] | null;
972
+ anchors: PathAnchorTriple[];
973
+ subpathStarts: number[];
974
+ glyphs: number;
975
+ }
976
+
977
+ /**
978
+ * One point query. `point` is page-local pt on `page_id`.
979
+ */
980
+ export interface SnapPointQuery {
981
+ pageId: PageId;
982
+ point: [number, number];
983
+ /**
984
+ * CSS px per pt at the current zoom. Absent ⇒ 1.
985
+ */
986
+ cameraScale?: number | null;
987
+ exclude?: SnapExclude[];
988
+ /**
989
+ * Points only the caller knows about, page-local — the anchors of a
990
+ * path still being drawn. Targets as points and as alignment lines.
991
+ */
992
+ extraPoints?: [number, number][];
993
+ }
994
+
897
995
  /**
898
996
  * One stop of a gradient on the wire. Mirrors `GradientStopRef`.
899
997
  */
@@ -1010,6 +1108,14 @@ export interface ElementGeometryItem {
1010
1108
  * of `Translate`.
1011
1109
  */
1012
1110
  hasImage?: boolean;
1111
+ /**
1112
+ * The story a TEXT FRAME shows (its `ParentStory`); `None` for every
1113
+ * other kind. `hitTest` answers `storyId: null` for an EMPTY frame
1114
+ * (the text hit path needs a laid-out line), so a frame\'s story was
1115
+ * discoverable only by diffing the stories collection around its
1116
+ * insert. Additive: absent from the JSON when `None`.
1117
+ */
1118
+ storyId?: string;
1013
1119
  }
1014
1120
 
1015
1121
  /**
@@ -1093,6 +1199,15 @@ export type ResizeHandle = "north" | "south" | "east" | "west" | "northEast" | "
1093
1199
  export interface GestureAnchor {
1094
1200
  pageId: PageId;
1095
1201
  pointInPage: [number, number];
1202
+ /**
1203
+ * C-67 — the point Rotate / Scale / Shear turn about, page-local on
1204
+ * the same page as `point_in_page`. Absent (every caller before it
1205
+ * existed) keeps the union centroid of the targets — Illustrator\'s
1206
+ * default reference point; a click-to-set pivot, a reference-point
1207
+ * grid or \"about a corner\" pass it. Additive (`serde(default)`), so
1208
+ * it needs no protocol bump.
1209
+ */
1210
+ pivotInPage?: [number, number];
1096
1211
  }
1097
1212
 
1098
1213
  /**
@@ -1857,7 +1972,7 @@ export interface DocumentStats {
1857
1972
  * document\'s `BTreeMap` palettes/stylesheets rather than the scene
1858
1973
  * tree, so they\'re top-level variants rather than `InsertNode`.
1859
1974
  */
1860
- export type Operation = { kind: "SetProperty"; node: NodeId; path: PropertyPath; value: Value } | { kind: "InsertNode"; parent: NodeId; position: number; node: NodeSpec; z_slot?: number | null } | { kind: "RemoveNode"; node: NodeId } | { kind: "MoveNode"; node: NodeId; new_parent: NodeId; position: number } | { kind: "ReorderNode"; node: NodeId; target: ZOrderTarget } | { kind: "Batch"; ops: Operation[] } | { kind: "InsertPage"; after_page_id?: string | null; master_id?: string | null; spread_self_id?: string | null; page_self_id?: string | null; restore_spread_json?: string | null } | { kind: "RemovePage"; page_id: string } | { kind: "MoveLayer"; layer_id: string; new_index: number } | { kind: "InsertLayer"; position: number; name: string; self_id?: string | null } | { kind: "RemoveLayer"; layer_id: string } | { kind: "CreateSwatch"; spec: SwatchSpec } | { kind: "EditSwatch"; swatch_id: string; spec: SwatchSpec } | { kind: "DeleteSwatch"; swatch_id: string } | { kind: "CreateParagraphStyle"; self_id?: string | null; name?: string | null; based_on?: string | null; restore_json?: string | null } | { kind: "RenameParagraphStyle"; style_id: string; name: string } | { kind: "DeleteParagraphStyle"; style_id: string } | { kind: "CreateCharacterStyle"; self_id?: string | null; name?: string | null; based_on?: string | null; restore_json?: string | null } | { kind: "RenameCharacterStyle"; style_id: string; name: string } | { kind: "DeleteCharacterStyle"; style_id: string } | { kind: "CreateObjectStyle"; self_id?: string | null; name?: string | null; based_on?: string | null; restore_json?: string | null } | { kind: "RenameObjectStyle"; style_id: string; name: string } | { kind: "DeleteObjectStyle"; style_id: string } | { kind: "CreateCellStyle"; self_id?: string | null; name?: string | null; based_on?: string | null; restore_json?: string | null } | { kind: "RenameCellStyle"; style_id: string; name: string } | { kind: "DeleteCellStyle"; style_id: string } | { kind: "CreateTableStyle"; self_id?: string | null; name?: string | null; based_on?: string | null; restore_json?: string | null } | { kind: "RenameTableStyle"; style_id: string; name: string } | { kind: "DeleteTableStyle"; style_id: string } | { kind: "CreateGroup"; spec: GroupSpec } | { kind: "DissolveGroup"; group_id: string; restore_slots?: number[] | null } | { kind: "DuplicateNodes"; sources: NodeId[]; dx: number; dy: number; ids?: string[]; story_ids?: string[] } | { kind: "RemoveDuplicates"; sources: NodeId[]; dx: number; dy: number; ids?: string[]; story_ids?: string[] } | { kind: "SetGroupTransform"; group: string; transform?: [number, number, number, number, number, number] | null; prev?: [number, number, number, number, number, number] | null } | { kind: "CreateGradient"; spec: GradientSpec } | { kind: "EditGradient"; gradient_id: string; spec: GradientSpec } | { kind: "DeleteGradient"; gradient_id: string } | { kind: "CreateColorGroup"; spec: ColorGroupSpec } | { kind: "EditColorGroup"; group_id: string; spec: ColorGroupSpec } | { kind: "DeleteColorGroup"; group_id: string } | { kind: "CreateNumberingList"; spec: NumberingListSpec } | { kind: "EditNumberingList"; list_id: string; spec: NumberingListSpec } | { kind: "DeleteNumberingList"; list_id: string } | { kind: "SetStyleProperty"; collection: StyleCollection; style_id: string; path: PropertyPath; value: Value } | { kind: "PathfinderBoolean"; kept: NodeId; others: NodeId[]; opKind: PathfinderKind } | { kind: "PathfinderRegion"; elements: NodeId[]; verb: PathfinderRegionVerb } | { kind: "PathfinderFaces"; elements: NodeId[]; faces: string[]; mode: FaceSelectMode } | { kind: "JoinPaths"; kept: NodeId; other: NodeId } | { kind: "PasteInto"; container: NodeId; child: NodeId; child_index?: number | null } | { kind: "ReleaseFrom"; child: NodeId; restore_slot?: number | null } | { kind: "ApplyOpacityMask"; target: NodeId; mask: NodeId; mask_type?: OpacityMaskMode; invert?: boolean } | { kind: "ReleaseOpacityMask"; target: NodeId; restore_slot?: number | null } | { kind: "AttachTextToPath"; host: NodeId; story_id: string; spec?: TextPathSpec } | { kind: "DetachTextFromPath"; host: NodeId; index?: number | null; restore?: TextPathSpec | null } | { kind: "LinkFrames"; from: string; to: string } | { kind: "UnlinkFrames"; frame: string; prev_next?: string | null; restore_target?: [string, string | null, string | null] | null } | { kind: "ApplyStyle"; story_id: string; start: number; end: number; style: string; scope: StyleScope; cell?: CellAddr | null; paragraph?: number | null } | { kind: "InsertField"; story_id: string; offset: number; field: FieldKind } | { kind: "DeleteField"; story_id: string; offset: number; field: FieldKind } | { kind: "InsertAnchoredFrame"; story_id: string; offset: number; width: number; height: number; image_uri?: string | null; self_id: string; paragraph?: number | null } | { kind: "RemoveAnchoredFrame"; story_id: string; self_id: string } | { kind: "InsertHyperlink"; story_id: string; start: number; end: number; url: string; source_id: string; dest_id: string; hyperlink_id: string } | { kind: "RemoveHyperlink"; story_id: string; start: number; end: number; url: string; source_id: string; dest_id: string; hyperlink_id: string } | { kind: "SetFieldValue"; story_id: string; offset: number; value?: string | null } | { kind: "PlaceImage"; frame: NodeId; image_uri?: string | null; fit?: string | null } | { kind: "ReplaceImageBytes"; frame: NodeId; bytes?: number[] | null; prior_has_image_element?: boolean | null } | { kind: "InsertGuide"; spread_id: string; orientation: GuideOrientationSpec; position: number; page_index?: number; guide_id?: string | null } | { kind: "MoveGuide"; guide_id: string; position: number } | { kind: "DeleteGuide"; guide_id: string } | { kind: "SetConditionVisible"; condition: string; visible: boolean } | { kind: "SetFlowGrowRule"; story_id: string; rule: FlowGrowRule | null } | { kind: "ActivateConditionSet"; set: string } | { kind: "RestoreConditionVisibility"; states: [string, boolean][] } | { kind: "ApplyMasterToPage"; page: string; master?: string | null } | { kind: "DuplicatePage"; page: string; clone_spread_json?: string | null } | { kind: "InsertSection"; at_page: string; prefix?: string | null; numbering_style?: string | null; start_at?: number | null; self_id?: string | null } | { kind: "EditSection"; section_id: string; prefix?: string | null | null; numbering_style?: string | null; start_at?: number | null | null } | { kind: "DeleteSection"; section_id: string } | { kind: "SetRowHeight"; story_id: string; table_id: string; row: number; height?: number | null } | { kind: "SetColumnWidth"; story_id: string; table_id: string; col: number; width?: number | null } | { kind: "InsertTableRow"; story_id: string; table_id: string; at: number; restore?: TableLineRestoreJson | null } | { kind: "DeleteTableRow"; story_id: string; table_id: string; at: number } | { kind: "InsertTableColumn"; story_id: string; table_id: string; at: number; restore?: TableLineRestoreJson | null } | { kind: "DeleteTableColumn"; story_id: string; table_id: string; at: number } | { kind: "InsertHeaderRow"; story_id: string; table_id: string; restore?: TableLineRestoreJson | null } | { kind: "RemoveHeaderRow"; story_id: string; table_id: string } | { kind: "InsertFooterRow"; story_id: string; table_id: string; restore?: TableLineRestoreJson | null } | { kind: "RemoveFooterRow"; story_id: string; table_id: string } | { kind: "SetCellSpan"; story_id: string; table_id: string; row: number; col: number; row_span: number; column_span: number };
1975
+ export type Operation = { kind: "SetProperty"; node: NodeId; path: PropertyPath; value: Value } | { kind: "InsertNode"; parent: NodeId; position: number; node: NodeSpec; z_slot?: number | null } | { kind: "RemoveNode"; node: NodeId } | { kind: "MoveNode"; node: NodeId; new_parent: NodeId; position: number } | { kind: "ReorderNode"; node: NodeId; target: ZOrderTarget } | { kind: "Batch"; ops: Operation[] } | { kind: "RemoveStory"; story_id: string } | { kind: "RestoreStory"; position: number; story_json: string } | { kind: "InsertPage"; after_page_id?: string | null; master_id?: string | null; spread_self_id?: string | null; page_self_id?: string | null; restore_spread_json?: string | null } | { kind: "RemovePage"; page_id: string } | { kind: "MoveLayer"; layer_id: string; new_index: number } | { kind: "InsertLayer"; position: number; name: string; self_id?: string | null } | { kind: "RemoveLayer"; layer_id: string } | { kind: "CreateSwatch"; spec: SwatchSpec } | { kind: "EditSwatch"; swatch_id: string; spec: SwatchSpec } | { kind: "DeleteSwatch"; swatch_id: string } | { kind: "CreateParagraphStyle"; self_id?: string | null; name?: string | null; based_on?: string | null; restore_json?: string | null } | { kind: "RenameParagraphStyle"; style_id: string; name: string } | { kind: "DeleteParagraphStyle"; style_id: string } | { kind: "CreateCharacterStyle"; self_id?: string | null; name?: string | null; based_on?: string | null; restore_json?: string | null } | { kind: "RenameCharacterStyle"; style_id: string; name: string } | { kind: "DeleteCharacterStyle"; style_id: string } | { kind: "CreateObjectStyle"; self_id?: string | null; name?: string | null; based_on?: string | null; restore_json?: string | null } | { kind: "RenameObjectStyle"; style_id: string; name: string } | { kind: "DeleteObjectStyle"; style_id: string } | { kind: "CreateCellStyle"; self_id?: string | null; name?: string | null; based_on?: string | null; restore_json?: string | null } | { kind: "RenameCellStyle"; style_id: string; name: string } | { kind: "DeleteCellStyle"; style_id: string } | { kind: "CreateTableStyle"; self_id?: string | null; name?: string | null; based_on?: string | null; restore_json?: string | null } | { kind: "RenameTableStyle"; style_id: string; name: string } | { kind: "DeleteTableStyle"; style_id: string } | { kind: "CreateGroup"; spec: GroupSpec } | { kind: "DissolveGroup"; group_id: string; restore_slots?: number[] | null } | { kind: "DuplicateNodes"; sources: NodeId[]; dx: number; dy: number; ids?: string[]; story_ids?: string[] } | { kind: "RemoveDuplicates"; sources: NodeId[]; dx: number; dy: number; ids?: string[]; story_ids?: string[] } | { kind: "SetGroupTransform"; group: string; transform?: [number, number, number, number, number, number] | null; prev?: [number, number, number, number, number, number] | null } | { kind: "CreateGradient"; spec: GradientSpec } | { kind: "EditGradient"; gradient_id: string; spec: GradientSpec } | { kind: "DeleteGradient"; gradient_id: string } | { kind: "CreateColorGroup"; spec: ColorGroupSpec } | { kind: "EditColorGroup"; group_id: string; spec: ColorGroupSpec } | { kind: "DeleteColorGroup"; group_id: string } | { kind: "CreateNumberingList"; spec: NumberingListSpec } | { kind: "EditNumberingList"; list_id: string; spec: NumberingListSpec } | { kind: "DeleteNumberingList"; list_id: string } | { kind: "SetStyleProperty"; collection: StyleCollection; style_id: string; path: PropertyPath; value: Value } | { kind: "PathfinderBoolean"; kept: NodeId; others: NodeId[]; opKind: PathfinderKind } | { kind: "PathfinderRegion"; elements: NodeId[]; verb: PathfinderRegionVerb } | { kind: "PathfinderFaces"; elements: NodeId[]; faces: string[]; mode: FaceSelectMode } | { kind: "JoinPaths"; kept: NodeId; other: NodeId } | { kind: "PasteInto"; container: NodeId; child: NodeId; child_index?: number | null } | { kind: "ReleaseFrom"; child: NodeId; restore_slot?: number | null } | { kind: "ApplyOpacityMask"; target: NodeId; mask: NodeId; mask_type?: OpacityMaskMode; invert?: boolean } | { kind: "ReleaseOpacityMask"; target: NodeId; restore_slot?: number | null } | { kind: "AttachTextToPath"; host: NodeId; story_id: string; spec?: TextPathSpec } | { kind: "DetachTextFromPath"; host: NodeId; index?: number | null; restore?: TextPathSpec | null } | { kind: "LinkFrames"; from: string; to: string } | { kind: "UnlinkFrames"; frame: string; prev_next?: string | null; restore_target?: [string, string | null, string | null] | null } | { kind: "ApplyStyle"; story_id: string; start: number; end: number; style: string; scope: StyleScope; cell?: CellAddr | null; paragraph?: number | null } | { kind: "InsertField"; story_id: string; offset: number; field: FieldKind } | { kind: "DeleteField"; story_id: string; offset: number; field: FieldKind } | { kind: "InsertAnchoredFrame"; story_id: string; offset: number; width: number; height: number; image_uri?: string | null; self_id: string; paragraph?: number | null } | { kind: "RemoveAnchoredFrame"; story_id: string; self_id: string } | { kind: "InsertHyperlink"; story_id: string; start: number; end: number; url: string; source_id: string; dest_id: string; hyperlink_id: string } | { kind: "RemoveHyperlink"; story_id: string; start: number; end: number; url: string; source_id: string; dest_id: string; hyperlink_id: string } | { kind: "SetFieldValue"; story_id: string; offset: number; value?: string | null } | { kind: "PlaceImage"; frame: NodeId; image_uri?: string | null; fit?: string | null } | { kind: "ReplaceImageBytes"; frame: NodeId; bytes?: number[] | null; prior_has_image_element?: boolean | null } | { kind: "InsertGuide"; spread_id: string; orientation: GuideOrientationSpec; position: number; page_index?: number; guide_id?: string | null } | { kind: "MoveGuide"; guide_id: string; position: number } | { kind: "DeleteGuide"; guide_id: string } | { kind: "SetConditionVisible"; condition: string; visible: boolean } | { kind: "SetFlowGrowRule"; story_id: string; rule: FlowGrowRule | null } | { kind: "ActivateConditionSet"; set: string } | { kind: "RestoreConditionVisibility"; states: [string, boolean][] } | { kind: "ApplyMasterToPage"; page: string; master?: string | null } | { kind: "DuplicatePage"; page: string; clone_spread_json?: string | null } | { kind: "InsertSection"; at_page: string; prefix?: string | null; numbering_style?: string | null; start_at?: number | null; self_id?: string | null } | { kind: "EditSection"; section_id: string; prefix?: string | null | null; numbering_style?: string | null; start_at?: number | null | null } | { kind: "DeleteSection"; section_id: string } | { kind: "SetRowHeight"; story_id: string; table_id: string; row: number; height?: number | null } | { kind: "SetColumnWidth"; story_id: string; table_id: string; col: number; width?: number | null } | { kind: "InsertTableRow"; story_id: string; table_id: string; at: number; restore?: TableLineRestoreJson | null } | { kind: "DeleteTableRow"; story_id: string; table_id: string; at: number } | { kind: "InsertTableColumn"; story_id: string; table_id: string; at: number; restore?: TableLineRestoreJson | null } | { kind: "DeleteTableColumn"; story_id: string; table_id: string; at: number } | { kind: "InsertHeaderRow"; story_id: string; table_id: string; restore?: TableLineRestoreJson | null } | { kind: "RemoveHeaderRow"; story_id: string; table_id: string } | { kind: "InsertFooterRow"; story_id: string; table_id: string; restore?: TableLineRestoreJson | null } | { kind: "RemoveFooterRow"; story_id: string; table_id: string } | { kind: "SetCellSpan"; story_id: string; table_id: string; row: number; col: number; row_span: number; column_span: number };
1861
1976
 
1862
1977
  /**
1863
1978
  * The discriminated payload of a `MainToWorker` message. Tagged so
@@ -1866,7 +1981,64 @@ export type Operation = { kind: "SetProperty"; node: NodeId; path: PropertyPath;
1866
1981
  * variants so e.g. `cmyk_icc_profile` becomes `cmykIccProfile` on
1867
1982
  * the wire — the TS protocol mirror locks the camelCase contract.
1868
1983
  */
1869
- export type MainToWorkerKind = { kind: "hello" } | { kind: "loadDocument"; payload: { bytes: number[]; font?: number[] | null; cmykIccProfile?: number[] | null } } | { kind: "newBlankDocument"; payload: { widthPt: number; heightPt: number; font?: number[] | null } } | { kind: "registerFont"; payload: { family: string; style?: string | null; bytes: number[] } } | { kind: "clearFontRegistry" } | { kind: "registerColorProfile"; payload: { name: string; bytes: number[] } } | { kind: "mutate"; payload: Mutation } | { kind: "requestPage"; payload: { pageId: PageId; lod: LodTier } } | { kind: "hitTest"; payload: { pageId: PageId; docPoint: [number, number]; filter: HitFilter } } | { kind: "requestSnapshot"; payload: { pageId: PageId; targetWidthPx: number; dpi?: number | null } } | { kind: "setSelection"; payload: { selection: ContentSelection | null } } | { kind: "requestSelectionGeometry"; payload: { selection: ContentSelection } } | { kind: "requestCaretGeometry"; payload: { selection: ContentSelection } } | { kind: "requestCaretNav"; payload: { storyId: string; offset: number; direction: CaretDirection; cell?: TextCellAddr | null } } | { kind: "requestLineBounds"; payload: { storyId: string; offset: number; cell?: TextCellAddr | null } } | { kind: "requestWordBounds"; payload: { storyId: string; offset: number; cell?: TextCellAddr | null } } | { kind: "requestParagraphBounds"; payload: { storyId: string; offset: number; cell?: TextCellAddr | null } } | { kind: "undo" } | { kind: "redo" } | { kind: "setElementSelection"; payload: { ids: ElementId[]; mode: SelectionMode } } | { kind: "requestMarqueeHits"; payload: { pageId: PageId; rect: [number, number, number, number] } } | { kind: "requestElementGeometry"; payload: { ids: ElementId[] } } | { kind: "requestGroupLeaves"; payload: { groupId: string } } | { kind: "requestPathAnchors"; payload: { id: ElementId } } | { kind: "requestNearestPathPoint"; payload: { id: ElementId; point: [number, number] } } | { kind: "requestPlanarRegions"; payload: { elementIds: ElementId[]; point?: [number, number] | null } } | { kind: "requestLayers" } | { kind: "requestCollection"; payload: { name: CollectionName } } | { kind: "requestFrameChain"; payload: { storyId: string } } | { kind: "requestStoryContent"; payload: { storyId: string } } | { kind: "requestStyleProperties"; payload: { collection: StyleCollection; styleId: string } } | { kind: "requestPlacedAssetBytes"; payload: { elementId: string } } | { kind: "requestFontFaceBytes"; payload: { family: string; style?: string | null } } | { kind: "requestMeasureText"; payload: { family: string; style?: string | null; text: string; sizePt: number } } | { kind: "submitSceneLayer"; payload: { elementId: string; layer: SceneLayer; caller?: string } } | { kind: "clearSceneLayer"; payload: { elementId: string } } | { kind: "submitPixelLayer"; payload: { elementId: string; layer: PixelLayer } } | { kind: "clearPixelLayer"; payload: { elementId: string } } | { kind: "claimImageResource"; payload: { imageId: string; levels: number; tileSize: number; baseWidth: number; baseHeight: number; revision: number } } | { kind: "releaseImageResource"; payload: { imageId: string } } | { kind: "submitResourceTiles"; payload: { imageId: string; level: number; tiles: ProviderTileWire[]; generation: number } } | { kind: "requestDocumentMeta" } | { kind: "requestDocumentPlaceholders" } | { kind: "requestColorPreview"; payload: { swatchId: string } } | { kind: "requestColorCompute"; payload: { space: string; value: number[]; tint?: number | null; model?: string | null; alternateSpace?: string | null; alternateValue?: number[] | null } } | { kind: "requestGradientDetail"; payload: { gradientId: string } } | { kind: "exportSwatchLibrary"; payload: { groupId?: string | null } } | { kind: "executeScript"; payload: { source: string; budget?: ScriptBudgetWire | null } } | { kind: "exportPdfBegin"; payload: { options: ExportPdfWireOptions } } | { kind: "exportPdfPage"; payload: { session: number } } | { kind: "exportPdfFinish"; payload: { session: number } } | { kind: "exportPdfCancel"; payload: { session: number } } | { kind: "exportIdml"; payload: { linkBase?: string | null } } | { kind: "writePagedPart"; payload: { path: string; bytes: number[]; caller?: string } } | { kind: "readPagedPart"; payload: { path: string } } | { kind: "listPagedParts"; payload: { prefix: string } } | { kind: "exportPaged"; payload: {} } | { kind: "requestElementProperties"; payload: { id: ElementId } } | { kind: "requestSceneTree" } | { kind: "beginGesture"; payload: { nodes: ElementId[]; gesture: GestureType; anchor?: GestureAnchor | null; cameraScale?: number | null } } | { kind: "updateGesture"; payload: { handle: GestureHandle; delta: [number, number]; modifiers: GestureModifiers } } | { kind: "commitGesture"; payload: { handle: GestureHandle } } | { kind: "cancelGesture"; payload: { handle: GestureHandle } };
1984
+ export type MainToWorkerKind = { kind: "hello" } | { kind: "loadDocument"; payload: { bytes: number[]; font?: number[] | null; cmykIccProfile?: number[] | null } } | { kind: "newBlankDocument"; payload: { widthPt: number; heightPt: number; font?: number[] | null } } | { kind: "registerFont"; payload: { family: string; style?: string | null; bytes: number[] } } | { kind: "clearFontRegistry" } | { kind: "registerColorProfile"; payload: { name: string; bytes: number[] } } | { kind: "mutate"; payload: Mutation } | { kind: "requestPage"; payload: { pageId: PageId; lod: LodTier } } | { kind: "hitTest"; payload: { pageId: PageId; docPoint: [number, number]; filter: HitFilter } } | { kind: "requestSnapshot"; payload: { pageId: PageId; targetWidthPx: number; dpi?: number | null } } | { kind: "setSelection"; payload: { selection: ContentSelection | null } } | { kind: "requestSelectionGeometry"; payload: { selection: ContentSelection } } | { kind: "requestCaretGeometry"; payload: { selection: ContentSelection } } | { kind: "requestCaretNav"; payload: { storyId: string; offset: number; direction: CaretDirection; cell?: TextCellAddr | null } } | { kind: "requestLineBounds"; payload: { storyId: string; offset: number; cell?: TextCellAddr | null } } | { kind: "requestWordBounds"; payload: { storyId: string; offset: number; cell?: TextCellAddr | null } } | { kind: "requestParagraphBounds"; payload: { storyId: string; offset: number; cell?: TextCellAddr | null } } | { kind: "undo" } | { kind: "redo" } | { kind: "setElementSelection"; payload: { ids: ElementId[]; mode: SelectionMode } } | { kind: "requestMarqueeHits"; payload: { pageId: PageId; rect: [number, number, number, number] } } | { kind: "requestElementGeometry"; payload: { ids: ElementId[] } } | { kind: "requestGroupLeaves"; payload: { groupId: string } } | { kind: "requestPathAnchors"; payload: { id: ElementId } } | { kind: "requestTextOutlines"; payload: { id: ElementId } } | { kind: "requestSnapPoint"; payload: { query: SnapPointQuery } } | { kind: "setSnapSettings"; payload: { settings: SnapSettings } } | { kind: "requestNearestPathPoint"; payload: { id: ElementId; point: [number, number] } } | { kind: "requestPlanarRegions"; payload: { elementIds: ElementId[]; point?: [number, number] | null } } | { kind: "requestLayers" } | { kind: "requestCollection"; payload: { name: CollectionName } } | { kind: "requestFrameChain"; payload: { storyId: string } } | { kind: "requestStoryContent"; payload: { storyId: string } } | { kind: "requestStyleProperties"; payload: { collection: StyleCollection; styleId: string } } | { kind: "requestPlacedAssetBytes"; payload: { elementId: string } } | { kind: "requestFontFaceBytes"; payload: { family: string; style?: string | null } } | { kind: "requestMeasureText"; payload: { family: string; style?: string | null; text: string; sizePt: number } } | { kind: "submitSceneLayer"; payload: { elementId: string; layer: SceneLayer; caller?: string } } | { kind: "clearSceneLayer"; payload: { elementId: string } } | { kind: "submitPixelLayer"; payload: { elementId: string; layer: PixelLayer } } | { kind: "clearPixelLayer"; payload: { elementId: string } } | { kind: "claimImageResource"; payload: { imageId: string; levels: number; tileSize: number; baseWidth: number; baseHeight: number; revision: number } } | { kind: "releaseImageResource"; payload: { imageId: string } } | { kind: "submitResourceTiles"; payload: { imageId: string; level: number; tiles: ProviderTileWire[]; generation: number } } | { kind: "requestDocumentMeta" } | { kind: "requestDocumentPlaceholders" } | { kind: "requestColorPreview"; payload: { swatchId: string } } | { kind: "requestColorCompute"; payload: { space: string; value: number[]; tint?: number | null; model?: string | null; alternateSpace?: string | null; alternateValue?: number[] | null } } | { kind: "requestGradientDetail"; payload: { gradientId: string } } | { kind: "exportSwatchLibrary"; payload: { groupId?: string | null } } | { kind: "executeScript"; payload: { source: string; budget?: ScriptBudgetWire | null } } | { kind: "exportPdfBegin"; payload: { options: ExportPdfWireOptions } } | { kind: "exportPdfPage"; payload: { session: number } } | { kind: "exportPdfFinish"; payload: { session: number } } | { kind: "exportPdfCancel"; payload: { session: number } } | { kind: "exportIdml"; payload: { linkBase?: string | null } } | { kind: "writePagedPart"; payload: { path: string; bytes: number[]; caller?: string } } | { kind: "readPagedPart"; payload: { path: string } } | { kind: "listPagedParts"; payload: { prefix: string } } | { kind: "deletePagedPart"; payload: { path: string; caller?: string } } | { kind: "exportPaged"; payload: {} } | { kind: "requestElementProperties"; payload: { id: ElementId } } | { kind: "requestSceneTree" } | { kind: "beginGesture"; payload: { nodes: ElementId[]; gesture: GestureType; anchor?: GestureAnchor | null; cameraScale?: number | null } } | { kind: "updateGesture"; payload: { handle: GestureHandle; delta: [number, number]; modifiers: GestureModifiers } } | { kind: "commitGesture"; payload: { handle: GestureHandle } } | { kind: "cancelGesture"; payload: { handle: GestureHandle } };
1985
+
1986
+ /**
1987
+ * The document\'s snapping preferences — one set for every tool and
1988
+ * gesture, so a move and a pen click agree on what \"close\" means.
1989
+ * Session state, not document state: it is not saved and not undoable.
1990
+ */
1991
+ export interface SnapSettings {
1992
+ /**
1993
+ * Master switch. Off ⇒ no gesture snaps and every query answers the
1994
+ * point it was given.
1995
+ */
1996
+ enabled?: boolean;
1997
+ /**
1998
+ * Tolerance in CSS px, converted to pt through the camera scale.
1999
+ */
2000
+ tolerancePx?: number;
2001
+ /**
2002
+ * Anchors, frame corners, oval quadrant points and element centres.
2003
+ */
2004
+ points?: boolean;
2005
+ /**
2006
+ * The x / y lines through those points (smart guides).
2007
+ */
2008
+ alignment?: boolean;
2009
+ /**
2010
+ * The nearest point on an element\'s outline.
2011
+ */
2012
+ segments?: boolean;
2013
+ /**
2014
+ * Page corners, centre, edges and centre lines.
2015
+ */
2016
+ page?: boolean;
2017
+ /**
2018
+ * Ruler guides.
2019
+ */
2020
+ guides?: boolean;
2021
+ /**
2022
+ * The document grid (`GridPreference` gridline divisions). Off by
2023
+ * default, as in InDesign.
2024
+ */
2025
+ grid?: boolean;
2026
+ }
2027
+
2028
+ /**
2029
+ * The segment the query landed on.
2030
+ */
2031
+ export interface SnapSegmentHit {
2032
+ element: ElementId;
2033
+ /**
2034
+ * Flat index of the segment\'s start / end anchor. Absent for an
2035
+ * outline the element does not store as anchors (a box-drawn
2036
+ * frame, an oval).
2037
+ */
2038
+ segStart?: number | null;
2039
+ segEnd?: number | null;
2040
+ t: number;
2041
+ }
1870
2042
 
1871
2043
  /**
1872
2044
  * Track J — wire-shape mirror of `paged_model::PathAnchor`. The
@@ -2208,6 +2380,11 @@ export interface TableHitContext {
2208
2380
  col: number;
2209
2381
  }
2210
2382
 
2383
+ /**
2384
+ * What a snap landed on.
2385
+ */
2386
+ export type SnapSource = "anchor" | "corner" | "center" | "page" | "guide" | "grid" | "extra";
2387
+
2211
2388
  /**
2212
2389
  * What the resolver produced this pass. The canvas worker reads
2213
2390
  * `numbering_map` to drive the running-header / page-number
@@ -2364,6 +2541,29 @@ export interface LineBounds {
2364
2541
  lineEnd: number;
2365
2542
  }
2366
2543
 
2544
+ /**
2545
+ * `RequestSnapPoint` reply payload.
2546
+ */
2547
+ export interface SnapPointResult {
2548
+ /**
2549
+ * The point after snapping; the query\'s point when nothing snapped.
2550
+ */
2551
+ point: [number, number];
2552
+ snapped: boolean;
2553
+ pointTarget?: SnapPointHit | null;
2554
+ xTarget?: SnapAxisHit | null;
2555
+ yTarget?: SnapAxisHit | null;
2556
+ segmentTarget?: SnapSegmentHit | null;
2557
+ /**
2558
+ * The guides to draw, same shape the translate gesture reports.
2559
+ */
2560
+ lines: SnapLine[];
2561
+ /**
2562
+ * The tolerance the query ran with, in pt.
2563
+ */
2564
+ tolerancePt: number;
2565
+ }
2566
+
2367
2567
  /**
2368
2568
  * panels.md gap 20 — one structured PDF-export preflight finding for
2369
2569
  * the export dialog\'s findings list. The wire mirror of
@@ -2755,6 +2955,24 @@ export interface FrameBounds {
2755
2955
  bottom: number;
2756
2956
  }
2757
2957
 
2958
+ export interface NearestPathPointResult {
2959
+ /**
2960
+ * Flat index of the segment\'s START anchor.
2961
+ */
2962
+ segStart: number;
2963
+ /**
2964
+ * Flat index of the segment\'s END anchor (wraps to the subpath
2965
+ * start on a closing segment).
2966
+ */
2967
+ segEnd: number;
2968
+ /**
2969
+ * Curve parameter on that segment, 0..=1.
2970
+ */
2971
+ t: number;
2972
+ point: [number, number];
2973
+ distance: number;
2974
+ }
2975
+
2758
2976
  export interface RunningHeader {
2759
2977
  pageId: PageId;
2760
2978
  pageNumber: number;
@@ -2866,6 +3084,13 @@ export class CanvasWorker {
2866
3084
  * to the default face when one is registered.
2867
3085
  */
2868
3086
  measureText(family: string, style: string | null | undefined, text: string, size_pt: number): any;
3087
+ /**
3088
+ * v66 — apply one wire `Mutation` (JSON; a `batch` too) whose
3089
+ * first `replaceImageBytes` with `bytes: []` takes `bytes` — the
3090
+ * commit lane for processed pixels without a `number[]`. Returns
3091
+ * the `Mutate` reply envelope as JSON.
3092
+ */
3093
+ mutateWithBytesDirect(seq: number, mutation_json: string, bytes: Uint8Array): string;
2869
3094
  constructor();
2870
3095
  /**
2871
3096
  * Number of pages in the loaded document, or 0 if no
@@ -2881,6 +3106,12 @@ export class CanvasWorker {
2881
3106
  * serialised as a JS array.
2882
3107
  */
2883
3108
  pageInfo(index: number): Array<any> | undefined;
3109
+ /**
3110
+ * v66 — a frame's placed image as `{ uri, width, height, encoded }`
3111
+ * with `encoded` a `Uint8Array`, or `undefined` when there is none
3112
+ * (the cases `placedAssetBytes` answers `found: false`).
3113
+ */
3114
+ placedAssetBytesDirect(element_id: string): object | undefined;
2884
3115
  /**
2885
3116
  * Render the visible pages at the current camera into the
2886
3117
  * bound surface. Camera operates in CSS pixels; the
@@ -2892,6 +3123,11 @@ export class CanvasWorker {
2892
3123
  * CPU path in that case.
2893
3124
  */
2894
3125
  presentFrame(scale: number, tx: number, ty: number, dpr: number): boolean;
3126
+ /**
3127
+ * v66 — a `.paged` part's bytes as a `Uint8Array`, or `undefined`
3128
+ * when the part is absent or no document is loaded.
3129
+ */
3130
+ readPagedPartDirect(path: string): Uint8Array | undefined;
2895
3131
  /**
2896
3132
  * Sub-phase D — render `page_id` to a PNG via the Vello GPU
2897
3133
  * path (off-surface). Returns `None` if GPU is not
@@ -2945,6 +3181,24 @@ export class CanvasWorker {
2945
3181
  * when measuring memory behaviour.
2946
3182
  */
2947
3183
  setSceneCacheBudget(max_entries: number): void;
3184
+ /**
3185
+ * v66 — binary sibling of `SubmitSceneLayer` for the one-image
3186
+ * case: the frame's scene layer becomes the RGBA8 image in `rgba`
3187
+ * (`width*height*4` bytes) drawn at `x, y, w, h` frame-content
3188
+ * points. Take a `Uint8Array` (transfer it to the worker first);
3189
+ * no `number[]`, no JSON parse. Returns the `sceneLayerApplied`
3190
+ * envelope as JSON, like `handleMessage`. Only the pages showing
3191
+ * the frame lose their cached scene.
3192
+ */
3193
+ submitSceneImageDirect(seq: number, element_id: string, caller: string | null | undefined, rgba: Uint8Array, width: number, height: number, x: number, y: number, w: number, h: number): string;
3194
+ /**
3195
+ * v66 — patch rectangles of the image `submitSceneImageDirect`
3196
+ * set: `rects` is a `Uint32Array` of `x, y, w, h` (image pixels)
3197
+ * per tile, `rgba` the tiles' pixels back to back in that order.
3198
+ * Validated whole before any byte moves. Returns the
3199
+ * `sceneLayerApplied` envelope as JSON.
3200
+ */
3201
+ submitSceneImageTilesDirect(seq: number, element_id: string, caller: string | null | undefined, rects: Uint32Array, rgba: Uint8Array): string;
2948
3202
  /**
2949
3203
  * Handle one main-thread message. Input is the JSON string
2950
3204
  * the JS side produced via `JSON.stringify(msg)`. Output is
@@ -2967,6 +3221,11 @@ export class CanvasWorker {
2967
3221
  * in `packages/shell/src/gestures/gesture-sab.ts`.
2968
3222
  */
2969
3223
  updateGestureRaw(handle_lo: number, handle_hi: number, dx: number, dy: number, modifier_bits: number): string;
3224
+ /**
3225
+ * v66 — `WritePagedPart` with a `Uint8Array` body. Returns the
3226
+ * `pagedPartWritten` / `pagedPartFailed` envelope as JSON.
3227
+ */
3228
+ writePagedPartDirect(seq: number, path: string, caller: string | null | undefined, bytes: Uint8Array): string;
2970
3229
  /**
2971
3230
  * Protocol version constant; the JS side compares against
2972
3231
  * its bundled value before sending `LoadDocument`.
@@ -2997,11 +3256,14 @@ export interface InitOutput {
2997
3256
  readonly canvasworker_initGpu: (a: number, b: any, c: number, d: number) => any;
2998
3257
  readonly canvasworker_loadDocumentDirect: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
2999
3258
  readonly canvasworker_measureText: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => any;
3259
+ readonly canvasworker_mutateWithBytesDirect: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
3000
3260
  readonly canvasworker_new: () => number;
3001
3261
  readonly canvasworker_pageCount: (a: number) => number;
3002
3262
  readonly canvasworker_pageInfo: (a: number, b: number) => any;
3263
+ readonly canvasworker_placedAssetBytesDirect: (a: number, b: number, c: number) => any;
3003
3264
  readonly canvasworker_presentFrame: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
3004
3265
  readonly canvasworker_protocolVersion: (a: number) => number;
3266
+ readonly canvasworker_readPagedPartDirect: (a: number, b: number, c: number) => [number, number];
3005
3267
  readonly canvasworker_renderPageVelloPng: (a: number, b: number, c: number, d: number) => any;
3006
3268
  readonly canvasworker_renderTilePng: (a: number, b: number, c: number, d: number) => [number, number];
3007
3269
  readonly canvasworker_resizeGpu: (a: number, b: number, c: number) => void;
@@ -3009,7 +3271,10 @@ export interface InitOutput {
3009
3271
  readonly canvasworker_sceneCacheSize: (a: number) => number;
3010
3272
  readonly canvasworker_selectionGeometryJson: (a: number, b: number, c: number) => [number, number];
3011
3273
  readonly canvasworker_setSceneCacheBudget: (a: number, b: number) => void;
3274
+ readonly canvasworker_submitSceneImageDirect: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number) => [number, number];
3275
+ readonly canvasworker_submitSceneImageTilesDirect: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
3012
3276
  readonly canvasworker_updateGestureRaw: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
3277
+ readonly canvasworker_writePagedPartDirect: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
3013
3278
  readonly gestureSabBytes: () => number;
3014
3279
  readonly gestureSabLayout: () => any;
3015
3280
  readonly on_start: () => void;
@@ -156,6 +156,32 @@ export class CanvasWorker {
156
156
  const ret = wasm.canvasworker_measureText(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, size_pt);
157
157
  return ret;
158
158
  }
159
+ /**
160
+ * v66 — apply one wire `Mutation` (JSON; a `batch` too) whose
161
+ * first `replaceImageBytes` with `bytes: []` takes `bytes` — the
162
+ * commit lane for processed pixels without a `number[]`. Returns
163
+ * the `Mutate` reply envelope as JSON.
164
+ * @param {number} seq
165
+ * @param {string} mutation_json
166
+ * @param {Uint8Array} bytes
167
+ * @returns {string}
168
+ */
169
+ mutateWithBytesDirect(seq, mutation_json, bytes) {
170
+ let deferred3_0;
171
+ let deferred3_1;
172
+ try {
173
+ const ptr0 = passStringToWasm0(mutation_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
174
+ const len0 = WASM_VECTOR_LEN;
175
+ const ptr1 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
176
+ const len1 = WASM_VECTOR_LEN;
177
+ const ret = wasm.canvasworker_mutateWithBytesDirect(this.__wbg_ptr, seq, ptr0, len0, ptr1, len1);
178
+ deferred3_0 = ret[0];
179
+ deferred3_1 = ret[1];
180
+ return getStringFromWasm0(ret[0], ret[1]);
181
+ } finally {
182
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
183
+ }
184
+ }
159
185
  constructor() {
160
186
  const ret = wasm.canvasworker_new();
161
187
  this.__wbg_ptr = ret;
@@ -185,6 +211,19 @@ export class CanvasWorker {
185
211
  const ret = wasm.canvasworker_pageInfo(this.__wbg_ptr, index);
186
212
  return ret;
187
213
  }
214
+ /**
215
+ * v66 — a frame's placed image as `{ uri, width, height, encoded }`
216
+ * with `encoded` a `Uint8Array`, or `undefined` when there is none
217
+ * (the cases `placedAssetBytes` answers `found: false`).
218
+ * @param {string} element_id
219
+ * @returns {object | undefined}
220
+ */
221
+ placedAssetBytesDirect(element_id) {
222
+ const ptr0 = passStringToWasm0(element_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
223
+ const len0 = WASM_VECTOR_LEN;
224
+ const ret = wasm.canvasworker_placedAssetBytesDirect(this.__wbg_ptr, ptr0, len0);
225
+ return ret;
226
+ }
188
227
  /**
189
228
  * Render the visible pages at the current camera into the
190
229
  * bound surface. Camera operates in CSS pixels; the
@@ -216,6 +255,23 @@ export class CanvasWorker {
216
255
  const ret = wasm.canvasworker_protocolVersion(this.__wbg_ptr);
217
256
  return ret >>> 0;
218
257
  }
258
+ /**
259
+ * v66 — a `.paged` part's bytes as a `Uint8Array`, or `undefined`
260
+ * when the part is absent or no document is loaded.
261
+ * @param {string} path
262
+ * @returns {Uint8Array | undefined}
263
+ */
264
+ readPagedPartDirect(path) {
265
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
266
+ const len0 = WASM_VECTOR_LEN;
267
+ const ret = wasm.canvasworker_readPagedPartDirect(this.__wbg_ptr, ptr0, len0);
268
+ let v2;
269
+ if (ret[0] !== 0) {
270
+ v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
271
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
272
+ }
273
+ return v2;
274
+ }
219
275
  /**
220
276
  * Sub-phase D — render `page_id` to a PNG via the Vello GPU
221
277
  * path (off-surface). Returns `None` if GPU is not
@@ -322,6 +378,77 @@ export class CanvasWorker {
322
378
  setSceneCacheBudget(max_entries) {
323
379
  wasm.canvasworker_setSceneCacheBudget(this.__wbg_ptr, max_entries);
324
380
  }
381
+ /**
382
+ * v66 — binary sibling of `SubmitSceneLayer` for the one-image
383
+ * case: the frame's scene layer becomes the RGBA8 image in `rgba`
384
+ * (`width*height*4` bytes) drawn at `x, y, w, h` frame-content
385
+ * points. Take a `Uint8Array` (transfer it to the worker first);
386
+ * no `number[]`, no JSON parse. Returns the `sceneLayerApplied`
387
+ * envelope as JSON, like `handleMessage`. Only the pages showing
388
+ * the frame lose their cached scene.
389
+ * @param {number} seq
390
+ * @param {string} element_id
391
+ * @param {string | null | undefined} caller
392
+ * @param {Uint8Array} rgba
393
+ * @param {number} width
394
+ * @param {number} height
395
+ * @param {number} x
396
+ * @param {number} y
397
+ * @param {number} w
398
+ * @param {number} h
399
+ * @returns {string}
400
+ */
401
+ submitSceneImageDirect(seq, element_id, caller, rgba, width, height, x, y, w, h) {
402
+ let deferred4_0;
403
+ let deferred4_1;
404
+ try {
405
+ const ptr0 = passStringToWasm0(element_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
406
+ const len0 = WASM_VECTOR_LEN;
407
+ var ptr1 = isLikeNone(caller) ? 0 : passStringToWasm0(caller, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
408
+ var len1 = WASM_VECTOR_LEN;
409
+ const ptr2 = passArray8ToWasm0(rgba, wasm.__wbindgen_malloc);
410
+ const len2 = WASM_VECTOR_LEN;
411
+ const ret = wasm.canvasworker_submitSceneImageDirect(this.__wbg_ptr, seq, ptr0, len0, ptr1, len1, ptr2, len2, width, height, x, y, w, h);
412
+ deferred4_0 = ret[0];
413
+ deferred4_1 = ret[1];
414
+ return getStringFromWasm0(ret[0], ret[1]);
415
+ } finally {
416
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
417
+ }
418
+ }
419
+ /**
420
+ * v66 — patch rectangles of the image `submitSceneImageDirect`
421
+ * set: `rects` is a `Uint32Array` of `x, y, w, h` (image pixels)
422
+ * per tile, `rgba` the tiles' pixels back to back in that order.
423
+ * Validated whole before any byte moves. Returns the
424
+ * `sceneLayerApplied` envelope as JSON.
425
+ * @param {number} seq
426
+ * @param {string} element_id
427
+ * @param {string | null | undefined} caller
428
+ * @param {Uint32Array} rects
429
+ * @param {Uint8Array} rgba
430
+ * @returns {string}
431
+ */
432
+ submitSceneImageTilesDirect(seq, element_id, caller, rects, rgba) {
433
+ let deferred5_0;
434
+ let deferred5_1;
435
+ try {
436
+ const ptr0 = passStringToWasm0(element_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
437
+ const len0 = WASM_VECTOR_LEN;
438
+ var ptr1 = isLikeNone(caller) ? 0 : passStringToWasm0(caller, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
439
+ var len1 = WASM_VECTOR_LEN;
440
+ const ptr2 = passArray32ToWasm0(rects, wasm.__wbindgen_malloc);
441
+ const len2 = WASM_VECTOR_LEN;
442
+ const ptr3 = passArray8ToWasm0(rgba, wasm.__wbindgen_malloc);
443
+ const len3 = WASM_VECTOR_LEN;
444
+ const ret = wasm.canvasworker_submitSceneImageTilesDirect(this.__wbg_ptr, seq, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
445
+ deferred5_0 = ret[0];
446
+ deferred5_1 = ret[1];
447
+ return getStringFromWasm0(ret[0], ret[1]);
448
+ } finally {
449
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
450
+ }
451
+ }
325
452
  /**
326
453
  * Handle one main-thread message. Input is the JSON string
327
454
  * the JS side produced via `JSON.stringify(msg)`. Output is
@@ -361,6 +488,33 @@ export class CanvasWorker {
361
488
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
362
489
  }
363
490
  }
491
+ /**
492
+ * v66 — `WritePagedPart` with a `Uint8Array` body. Returns the
493
+ * `pagedPartWritten` / `pagedPartFailed` envelope as JSON.
494
+ * @param {number} seq
495
+ * @param {string} path
496
+ * @param {string | null | undefined} caller
497
+ * @param {Uint8Array} bytes
498
+ * @returns {string}
499
+ */
500
+ writePagedPartDirect(seq, path, caller, bytes) {
501
+ let deferred4_0;
502
+ let deferred4_1;
503
+ try {
504
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
505
+ const len0 = WASM_VECTOR_LEN;
506
+ var ptr1 = isLikeNone(caller) ? 0 : passStringToWasm0(caller, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
507
+ var len1 = WASM_VECTOR_LEN;
508
+ const ptr2 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
509
+ const len2 = WASM_VECTOR_LEN;
510
+ const ret = wasm.canvasworker_writePagedPartDirect(this.__wbg_ptr, seq, ptr0, len0, ptr1, len1, ptr2, len2);
511
+ deferred4_0 = ret[0];
512
+ deferred4_1 = ret[1];
513
+ return getStringFromWasm0(ret[0], ret[1]);
514
+ } finally {
515
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
516
+ }
517
+ }
364
518
  }
365
519
  if (Symbol.dispose) CanvasWorker.prototype[Symbol.dispose] = CanvasWorker.prototype.free;
366
520
 
@@ -799,6 +953,10 @@ function __wbg_get_imports() {
799
953
  const ret = new Array();
800
954
  return ret;
801
955
  },
956
+ __wbg_new_from_slice_4ee02165f9de919e: function(arg0, arg1) {
957
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
958
+ return ret;
959
+ },
802
960
  __wbg_new_typed_6f8b0d724fe26c07: function(arg0, arg1) {
803
961
  try {
804
962
  var state0 = {a: arg0, b: arg1};
@@ -1483,12 +1641,12 @@ function __wbg_get_imports() {
1483
1641
  arg0.writeTexture(arg1, getArrayU8FromWasm0(arg2, arg3), arg4, arg5);
1484
1642
  }, arguments); },
1485
1643
  __wbindgen_generic_0000000000000001: function(arg0, arg1) {
1486
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 5071, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1644
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 5101, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1487
1645
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h90756ddb99d2201d);
1488
1646
  return ret;
1489
1647
  },
1490
1648
  __wbindgen_generic_0000000000000002: function(arg0, arg1) {
1491
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 6259, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1649
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 6312, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1492
1650
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h78ff2cea7266d1aa);
1493
1651
  return ret;
1494
1652
  },
@@ -1777,6 +1935,13 @@ function makeMutClosure(arg0, arg1, f) {
1777
1935
  return real;
1778
1936
  }
1779
1937
 
1938
+ function passArray32ToWasm0(arg, malloc) {
1939
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
1940
+ getUint32ArrayMemory0().set(arg, ptr / 4);
1941
+ WASM_VECTOR_LEN = arg.length;
1942
+ return ptr;
1943
+ }
1944
+
1780
1945
  function passArray8ToWasm0(arg, malloc) {
1781
1946
  const ptr = malloc(arg.length * 1, 1) >>> 0;
1782
1947
  getUint8ArrayMemory0().set(arg, ptr / 1);
Binary file