@paged-media/plugin-api 0.2.38-canary.3 → 0.2.40-canary.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/dist/editor.d.ts CHANGED
@@ -483,7 +483,12 @@ export interface PagedEditor {
483
483
  * unconditional insert. The SDK adapter fills it from the manifest
484
484
  * id, so a bundle never passes it itself.
485
485
  */
486
- submit(elementId: string, layer: SceneLayer, caller?: string): Promise<void>;
486
+ /** Resolves with the engine's `sceneLayerApplied` report (protocol
487
+ * 68: `fontFallbacks`, the text faces that fell back to the default
488
+ * font); an older host resolves `void`, read as "no fallbacks". */
489
+ submit(elementId: string, layer: SceneLayer, caller?: string): Promise<void | {
490
+ fontFallbacks?: readonly string[] | null;
491
+ }>;
487
492
  clear(elementId: string): Promise<void>;
488
493
  /** Protocol 66 — the BINARY scene-image lane (canvas-wasm
489
494
  * `submitSceneImageDirect`): the bytes cross as a `Uint8Array`,
package/dist/host.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { CollectionName, DocumentMeta, ElementGeometryItem, ElementId, HitFilter, HitResult, MintedElement, Mutation, PageId, ElementProperties, PathAnchorsResult, PathAnchorTriple, SceneTreeNode, SelectionMode } from "./wire";
1
+ import type { CollectionName, DocumentMeta, ElementGeometryItem, ElementId, HitFilter, HitResult, MintedElement, Mutation, PageId, ElementProperties, PathAnchorsResult, PathAnchorTriple, SceneTreeNode, SelectionMode, SnapPointQuery, SnapPointResult } from "./wire";
2
2
  import type { CommandContribution, ExporterContribution, ImporterContribution, KeybindingContribution, OverlayContribution, PagedEditor, PanelContribution, ToolContribution, ToolPreviewShape } from "./editor";
3
3
  import type { SceneLayer } from "./wire";
4
4
  import type { AssetSurface } from "./assets";
@@ -452,8 +452,18 @@ export interface ContributionSurface {
452
452
  /** The scene-layer surface (C-1) returned by `contribute.sceneLayer()`.
453
453
  * `elementId` is the host `Self` id of the frame to render into. */
454
454
  export interface SceneLayerSurface extends Disposable {
455
- /** Submit (replacing any previous) the vector layer for `elementId`. */
456
- submit(elementId: string, layer: SceneLayer): Promise<void>;
455
+ /**
456
+ * Submit (replacing any previous) the vector layer for `elementId`.
457
+ *
458
+ * Protocol 68 — a text item draws in the face it names: `family` plus
459
+ * `style` (IDML `FontStyle` spelling, `"Bold Italic"`) or, when `style`
460
+ * is absent, `weight` (CSS `100..900`, also the `wght` of a variable
461
+ * face) and `italic`. The engine resolves the face through the fonts the
462
+ * host registered for the document; a family that does not resolve draws
463
+ * in the document default font and is listed in the result's
464
+ * `fontFallbacks`. Probe `supports("rendering.sceneLayer.faces@1")`.
465
+ */
466
+ submit(elementId: string, layer: SceneLayer): Promise<SceneLayerSubmitResult>;
457
467
  /** Clear the layer for `elementId` (returns the frame to native
458
468
  * content). */
459
469
  clear(elementId: string): Promise<void>;
@@ -475,6 +485,15 @@ export interface SceneLayerSurface extends Disposable {
475
485
  */
476
486
  submitImageTiles(elementId: string, tiles: readonly SceneImageTile[], options?: SceneImageSubmitOptions): Promise<void>;
477
487
  }
488
+ /** What {@link SceneLayerSurface.submit} reports (protocol 68). */
489
+ export interface SceneLayerSubmitResult {
490
+ /** The faces this layer's text items named that the engine could not
491
+ * resolve, each drawn in the document default font instead
492
+ * (`"Family Style"`, report order). Empty when every named family
493
+ * resolved, when the layer names none, and on a host that does not
494
+ * report (no scene channel, or an older editor). */
495
+ readonly fontFallbacks: readonly string[];
496
+ }
478
497
  /** One whole RGBA8 image for {@link SceneLayerSurface.submitImage}. */
479
498
  export interface SceneImage {
480
499
  /** Tightly packed RGBA8, row-major, `width*height*4` bytes. */
@@ -904,6 +923,25 @@ export interface DocumentSurface {
904
923
  * forwards at all.
905
924
  */
906
925
  planarRegions(elementIds: ElementId[], point?: [number, number]): Promise<PlanarRegionsResult>;
926
+ /**
927
+ * v67 (RFI C-68) — snap one page-local point the way the host's own
928
+ * tools do: to the anchors, frame corners and centres of every visible
929
+ * element, the page, the x / y lines through all of them (smart
930
+ * guides), ruler guides, the document grid and the nearest outline,
931
+ * with the session's tolerance and switches. One engine resolver
932
+ * answers the Pen, Direct Selection, a move and this door, so a plugin
933
+ * tool snaps exactly like the host.
934
+ *
935
+ * Leave the path being edited out with `exclude` (`anchors` names the
936
+ * dragged ones; the element's outline is then skipped too, since the
937
+ * host is previewing a shape the engine has not seen), and add the
938
+ * points of a path still being drawn with `extraPoints`.
939
+ *
940
+ * Pure READ, gated on `capabilities.document.read`. Never throws: a
941
+ * host whose engine predates v67 answers the point unsnapped
942
+ * (`snapped: false`). Probe `supports("document.snapPoint@1")`.
943
+ */
944
+ snapPoint(query: SnapPointQuery): Promise<SnapPointResult>;
907
945
  /** D-01 (protocol v43) — enumerate every plugin-tagged placeholder
908
946
  * field in the document, in story order. Offsets are FRESH-READ
909
947
  * addresses (a placeholder is its own tagged run; re-enumerate
package/dist/index.d.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  export type { PluginId, PluginManifest, PluginCapabilities, PluginContributions, NetworkCapability, DataProvidersCapability, StorageCapability, WasmArtifact, WasmPurpose, WorkersCapability, SecretsCapability, GpuCapability, } from "./manifest";
2
2
  export type { BundleHandle, PagedBundle } from "./bundle";
3
- export type { BundleHost, ContributionSurface, SceneLayerSurface, SceneImage, SceneImageTile, SceneImageSubmitOptions, WillSaveEvent, ToolsSurface, ToolSettingValue, ImagesSurface, ImageResourceClaimOptions, TileBytes, WorkersSurface, BundleWorker, SpawnWorkerOptions, SecretsSurface, SecretMaterial, DocumentSurface, MutateWithBytesOptions, SelectionSurface, ViewportSurface, TextSurface, TextMetrics, TextCaret, FrameChainLink, PlanarFace, PlanarRegionsResult, StoryContent, ParagraphContent, RunContent, OverlaySurface, ShellSurface, FilePickerOptions, PickedFile, SaveFileOptions, StorageSurface, BlobSurface, BlobUsage, PartsSurface, NativeDocumentSurface, NetworkSurface, ConsentResult, DataProvidersSurface, DataProviderRegistration, DataProviderHandle, DataProviderInfo, DataProviderSnapshot, ProviderSchema, ProviderField, ProviderRecordSet, DiagnosticsSurface, JournalSurface, JournalRecord, BindingsSurface, Diagnostic, DocumentChangeEvent, MutationOutcome, Disposable, PluginLogger, EditContextContribution, ObjectTypeContribution, EditContextCandidate, EnteredEditContext, ContentPointerEvent, ContentWheelEvent, EditContextDescriptor, ObjectTypeDescriptor, PluginMetadataEnvelope, ObjectTypeBaker, BakeContext, MenuContribution, } from "./host";
3
+ export type { BundleHost, ContributionSurface, SceneLayerSurface, SceneLayerSubmitResult, SceneImage, SceneImageTile, SceneImageSubmitOptions, WillSaveEvent, ToolsSurface, ToolSettingValue, ImagesSurface, ImageResourceClaimOptions, TileBytes, WorkersSurface, BundleWorker, SpawnWorkerOptions, SecretsSurface, SecretMaterial, DocumentSurface, MutateWithBytesOptions, SelectionSurface, ViewportSurface, TextSurface, TextMetrics, TextCaret, FrameChainLink, PlanarFace, PlanarRegionsResult, StoryContent, ParagraphContent, RunContent, OverlaySurface, ShellSurface, FilePickerOptions, PickedFile, SaveFileOptions, StorageSurface, BlobSurface, BlobUsage, PartsSurface, NativeDocumentSurface, NetworkSurface, ConsentResult, DataProvidersSurface, DataProviderRegistration, DataProviderHandle, DataProviderInfo, DataProviderSnapshot, ProviderSchema, ProviderField, ProviderRecordSet, DiagnosticsSurface, JournalSurface, JournalRecord, BindingsSurface, Diagnostic, DocumentChangeEvent, MutationOutcome, Disposable, PluginLogger, EditContextContribution, ObjectTypeContribution, EditContextCandidate, EnteredEditContext, ContentPointerEvent, ContentWheelEvent, EditContextDescriptor, ObjectTypeDescriptor, PluginMetadataEnvelope, ObjectTypeBaker, BakeContext, MenuContribution, } from "./host";
4
4
  export type { PanelSchema, PanelSchemaSection, PanelSchemaRow, SchemaPanelContribution, SchemaPanelRenderer, SchemaPanelRendererProps, WidgetValueBinding, BindingRef, SchemaGate, WidgetCollectionBinding, SchemaRowAction, SchemaListAction, SchemaListSpec, } from "./panel-schema";
5
5
  export type { WidgetSurface, ColorPickerProps, CodeEditorProps, CodeEditorDiagnostic, CodeEditorLanguage, } from "./widgets";
6
6
  export type { BindingTarget, BindingPropertyRequest, BindingPropertyWrite, BindingCollectionRequest, BindingRead, BindingResolved, BindingDecline, BindingWrite, BindingCollection, BindingOp, BindingProvider, BindingProviderScope, BindingProviderHandle, BindingReadResult, BindingWriteResult, BindingCollectionResult, ActiveBindingProvider, } from "./binding-provider";
7
7
  export type { AssetSurface, AssetKind, FontFaceAsset, FontFaceFormat, } from "./assets";
8
8
  export type { ProviderTileWire } from "./wire";
9
+ export type { SnapPointQuery, SnapPointResult, SnapPointHit, SnapAxisHit, SnapSegmentHit, SnapExclude, SnapSource, SnapSettings, } from "./wire";
9
10
  export type { MintedElement } from "./wire";
10
11
  export type { ClipboardSurface, ClipboardPayload, TabularClipboard, } from "./clipboard";
11
12
  export type * from "./contributions";
package/dist/wire.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  // GENERATED — do not edit. Vendored verbatim from the published
2
2
  // @paged-media/canvas-wasm .d.ts (tsify output from paged-media/core,
3
3
  // MPL-2.0 OR PMEL). Sync: node scripts/sync-wire.mjs · Check: --check.
4
- // Synced from @paged-media/canvas-wasm@0.66.0
4
+ // Synced from @paged-media/canvas-wasm@0.68.0
5
5
  /* tslint:disable */
6
6
  /* eslint-disable */
7
7
 
@@ -102,6 +102,19 @@ export interface SceneLayer {
102
102
  items: SceneItem[];
103
103
  }
104
104
 
105
+ /**
106
+ * A point target the query landed on.
107
+ */
108
+ export interface SnapPointHit {
109
+ source: SnapSource;
110
+ at: [number, number];
111
+ element?: ElementId | null;
112
+ /**
113
+ * Flat anchor index when `source` is `anchor` on a path.
114
+ */
115
+ anchorIndex?: number | null;
116
+ }
117
+
105
118
  /**
106
119
  * A single-line text run in frame-content coordinates (C-1.1).
107
120
  */
@@ -124,10 +137,30 @@ export interface SceneTextItem {
124
137
  size: number;
125
138
  paint: ScenePaint;
126
139
  /**
127
- * Reserved face hints (v1 renders in the document default font).
140
+ * v68 — the run\'s font family. Resolved through the renderer\'s font
141
+ * resolver (the faces the host registered for the document); the
142
+ * document default font draws the run only when the family does not
143
+ * resolve, and that fallback is reported (a `FontSubstituted`
144
+ * diagnostic carrying the frame id, and `SceneLayerApplied.
145
+ * fontFallbacks`). Absent ⇒ the default font, as before v68.
128
146
  */
129
147
  family?: string;
148
+ /**
149
+ * v68 — the face within `family`, spelled like IDML\'s `FontStyle`
150
+ * (`\"Bold\"`, `\"Italic\"`, `\"Bold Italic\"`, `\"Light\"`). When absent it
151
+ * is derived from `weight` / `italic`.
152
+ */
130
153
  style?: string;
154
+ /**
155
+ * v68 — numeric weight (CSS scale, `100..=900`). Sets the `wght`
156
+ * axis of a variable face; when `style` is absent it also picks the
157
+ * style name (`700` ⇒ `\"Bold\"`).
158
+ */
159
+ weight?: number;
160
+ /**
161
+ * v68 — italic. Only consulted when `style` is absent.
162
+ */
163
+ italic?: boolean;
131
164
  }
132
165
 
133
166
  /**
@@ -159,6 +192,25 @@ export interface WordBounds {
159
192
  end: number;
160
193
  }
161
194
 
195
+ /**
196
+ * An alignment line the query was pulled onto (one per axis).
197
+ */
198
+ export interface SnapAxisHit {
199
+ source: SnapSource;
200
+ /**
201
+ * x for the vertical line, y for the horizontal one (page-local).
202
+ */
203
+ position: number;
204
+ /**
205
+ * The element whose point the line runs through, for smart guides.
206
+ */
207
+ element?: ElementId | null;
208
+ /**
209
+ * That point, so a host can draw the guide from it to the pointer.
210
+ */
211
+ through?: [number, number] | null;
212
+ }
213
+
162
214
  /**
163
215
  * Axis the snap line guides. `X` is a vertical guide (snaps the x
164
216
  * coordinate); `Y` is a horizontal guide (snaps the y coordinate).
@@ -567,7 +619,7 @@ export type CaretDirection = "up" | "down";
567
619
  /**
568
620
  * Discriminated payload of a `WorkerToMain` message.
569
621
  */
570
- 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: "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 };
622
+ 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[]; fontFallbacks?: string[] } } | { 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 };
571
623
 
572
624
  /**
573
625
  * Editor-ops — wire mirror of `paged_model::GradientFeatherParams`.
@@ -753,6 +805,18 @@ export interface ElementProperties {
753
805
  entries: PropertyEntry[];
754
806
  }
755
807
 
808
+ /**
809
+ * Leave an element (or some of its anchors) out of the targets. With
810
+ * `anchors` absent the whole element is ignored; with `anchors` given,
811
+ * those anchors (flat indices, the `pathAnchors` numbering) are not
812
+ * targets and neither are the element\'s segments, since a host editing
813
+ * those anchors is previewing a path the engine has not seen yet.
814
+ */
815
+ export interface SnapExclude {
816
+ id: ElementId;
817
+ anchors?: number[] | null;
818
+ }
819
+
756
820
  /**
757
821
  * Lightweight serialisable variant — the canvas worker hands this
758
822
  * (encoded as a `WorkerToMain` message) to the main thread. The
@@ -934,6 +998,24 @@ export interface TextOutlineRun {
934
998
  glyphs: number;
935
999
  }
936
1000
 
1001
+ /**
1002
+ * One point query. `point` is page-local pt on `page_id`.
1003
+ */
1004
+ export interface SnapPointQuery {
1005
+ pageId: PageId;
1006
+ point: [number, number];
1007
+ /**
1008
+ * CSS px per pt at the current zoom. Absent ⇒ 1.
1009
+ */
1010
+ cameraScale?: number | null;
1011
+ exclude?: SnapExclude[];
1012
+ /**
1013
+ * Points only the caller knows about, page-local — the anchors of a
1014
+ * path still being drawn. Targets as points and as alignment lines.
1015
+ */
1016
+ extraPoints?: [number, number][];
1017
+ }
1018
+
937
1019
  /**
938
1020
  * One stop of a gradient on the wire. Mirrors `GradientStopRef`.
939
1021
  */
@@ -1923,7 +2005,64 @@ export type Operation = { kind: "SetProperty"; node: NodeId; path: PropertyPath;
1923
2005
  * variants so e.g. `cmyk_icc_profile` becomes `cmykIccProfile` on
1924
2006
  * the wire — the TS protocol mirror locks the camelCase contract.
1925
2007
  */
1926
- 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: "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 } };
2008
+ 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 } };
2009
+
2010
+ /**
2011
+ * The document\'s snapping preferences — one set for every tool and
2012
+ * gesture, so a move and a pen click agree on what \"close\" means.
2013
+ * Session state, not document state: it is not saved and not undoable.
2014
+ */
2015
+ export interface SnapSettings {
2016
+ /**
2017
+ * Master switch. Off ⇒ no gesture snaps and every query answers the
2018
+ * point it was given.
2019
+ */
2020
+ enabled?: boolean;
2021
+ /**
2022
+ * Tolerance in CSS px, converted to pt through the camera scale.
2023
+ */
2024
+ tolerancePx?: number;
2025
+ /**
2026
+ * Anchors, frame corners, oval quadrant points and element centres.
2027
+ */
2028
+ points?: boolean;
2029
+ /**
2030
+ * The x / y lines through those points (smart guides).
2031
+ */
2032
+ alignment?: boolean;
2033
+ /**
2034
+ * The nearest point on an element\'s outline.
2035
+ */
2036
+ segments?: boolean;
2037
+ /**
2038
+ * Page corners, centre, edges and centre lines.
2039
+ */
2040
+ page?: boolean;
2041
+ /**
2042
+ * Ruler guides.
2043
+ */
2044
+ guides?: boolean;
2045
+ /**
2046
+ * The document grid (`GridPreference` gridline divisions). Off by
2047
+ * default, as in InDesign.
2048
+ */
2049
+ grid?: boolean;
2050
+ }
2051
+
2052
+ /**
2053
+ * The segment the query landed on.
2054
+ */
2055
+ export interface SnapSegmentHit {
2056
+ element: ElementId;
2057
+ /**
2058
+ * Flat index of the segment\'s start / end anchor. Absent for an
2059
+ * outline the element does not store as anchors (a box-drawn
2060
+ * frame, an oval).
2061
+ */
2062
+ segStart?: number | null;
2063
+ segEnd?: number | null;
2064
+ t: number;
2065
+ }
1927
2066
 
1928
2067
  /**
1929
2068
  * Track J — wire-shape mirror of `paged_model::PathAnchor`. The
@@ -2265,6 +2404,11 @@ export interface TableHitContext {
2265
2404
  col: number;
2266
2405
  }
2267
2406
 
2407
+ /**
2408
+ * What a snap landed on.
2409
+ */
2410
+ export type SnapSource = "anchor" | "corner" | "center" | "page" | "guide" | "grid" | "extra";
2411
+
2268
2412
  /**
2269
2413
  * What the resolver produced this pass. The canvas worker reads
2270
2414
  * `numbering_map` to drive the running-header / page-number
@@ -2421,6 +2565,29 @@ export interface LineBounds {
2421
2565
  lineEnd: number;
2422
2566
  }
2423
2567
 
2568
+ /**
2569
+ * `RequestSnapPoint` reply payload.
2570
+ */
2571
+ export interface SnapPointResult {
2572
+ /**
2573
+ * The point after snapping; the query\'s point when nothing snapped.
2574
+ */
2575
+ point: [number, number];
2576
+ snapped: boolean;
2577
+ pointTarget?: SnapPointHit | null;
2578
+ xTarget?: SnapAxisHit | null;
2579
+ yTarget?: SnapAxisHit | null;
2580
+ segmentTarget?: SnapSegmentHit | null;
2581
+ /**
2582
+ * The guides to draw, same shape the translate gesture reports.
2583
+ */
2584
+ lines: SnapLine[];
2585
+ /**
2586
+ * The tolerance the query ran with, in pt.
2587
+ */
2588
+ tolerancePt: number;
2589
+ }
2590
+
2424
2591
  /**
2425
2592
  * panels.md gap 20 — one structured PDF-export preflight finding for
2426
2593
  * the export dialog\'s findings list. The wire mirror of
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paged-media/plugin-api",
3
- "version": "0.2.38-canary.3",
3
+ "version": "0.2.40-canary.0",
4
4
  "description": "The Paged plugin contract: manifest, bundle lifecycle, the BundleHost surface, and the contribution + engine wire types. Type-only.",
5
5
  "license": "MPL-2.0 OR LicenseRef-PMEL",
6
6
  "type": "module",