@paged-media/plugin-api 0.2.14-canary.0 → 0.2.17-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.
@@ -0,0 +1,59 @@
1
+ /**
2
+ * The canonical tabular interchange — a RECTANGULAR grid of cell DISPLAY
3
+ * strings (already number-formatted; the consumer owns re-parsing on
4
+ * paste). `rows[r][c]` is the display text of the cell at grid row `r`,
5
+ * column `c`. Ragged input is the producer's responsibility to
6
+ * rectangularize; the host does not pad. Serializable (plain strings), so
7
+ * the door proxies across the future isolate boundary unchanged.
8
+ */
9
+ export interface TabularClipboard {
10
+ /** Row-major grid of cell display strings. `rows.length` = row count;
11
+ * each inner array is one row's cells, left to right. */
12
+ rows: string[][];
13
+ }
14
+ /**
15
+ * A clipboard payload — a plain-text half and/or a tabular half. Both are
16
+ * optional: a text-only copy carries `text`; a grid copy carries BOTH
17
+ * (the `tabular` grid AND a TSV `text` fallback so a paste into a plain
18
+ * editor still lands something). On READ the host fills whichever halves
19
+ * it could recover from the system clipboard (`tabular` is reconstructed
20
+ * from TSV `text` when the platform offers no richer form).
21
+ */
22
+ export interface ClipboardPayload {
23
+ /** Plain-text representation. For a grid copy this is the TSV fallback
24
+ * (rows joined by `\t` within a row and `\n` between rows). */
25
+ text?: string;
26
+ /** The rich rectangular cell grid (the canonical interchange). Present
27
+ * on a grid copy; absent for a plain-text copy. Gated on
28
+ * `capabilities.clipboard: "full"` — a `"vector"` declaration sees the
29
+ * `text` half only. */
30
+ tabular?: TabularClipboard;
31
+ }
32
+ /**
33
+ * The clipboard accessor a bundle reaches through `host.clipboard`. Two
34
+ * doors over the SYSTEM clipboard: `read` recovers a payload (or `null`
35
+ * when there is nothing readable / no backend wired), `write` puts a
36
+ * payload on the clipboard. Capability-gated on `capabilities.clipboard`
37
+ * (see the mapping above): `"full"` grants text + tabular, `"vector"`
38
+ * grants text only, `"none"`/absent denies. Probe
39
+ * `supports("clipboard@1")` to know whether a real system-clipboard
40
+ * backend is wired (false ⇒ `read` answers `null` and `write` no-ops).
41
+ */
42
+ export interface ClipboardSurface {
43
+ /**
44
+ * Read the current clipboard payload, or `null` when there is nothing
45
+ * readable, the read is denied by the platform, or no backend is wired
46
+ * (the honest no-clipboard door). A `"vector"` declaration never
47
+ * receives the `tabular` half (only `text`).
48
+ */
49
+ read(): Promise<ClipboardPayload | null>;
50
+ /**
51
+ * Write a payload to the system clipboard. A `"vector"` declaration may
52
+ * only write `text` — a `tabular` half it supplies is DROPPED (the host
53
+ * logs once). With no backend wired this is a no-op (probe
54
+ * `supports("clipboard@1")` first). Never throws on a platform refusal:
55
+ * a denied write resolves without effect (the honest browser posture —
56
+ * the clipboard API rejects without a user gesture).
57
+ */
58
+ write(payload: ClipboardPayload): Promise<void>;
59
+ }
@@ -1 +1 @@
1
- export type { ShellRegistries, ToolRegistry, PanelRegistry, CommandRegistry, KeybindingRegistry, OverlayRegistry, EditContextRegistry, ObjectTypeRegistry, ImporterRegistry, ExporterRegistry, ToolContribution, ToolId, ToolGroupId, ToolSectionId, ToolOptionsSpec, ToolOptionField, CursorSpec, CssCursorToken, GestureHandler, CanvasPointerEvent, OverlayContext, OverlayPrimitive, DeactivateReason, PanelContribution, PanelProps, PanelApi, OverlayContribution, OverlayProps, OverlayPageRect, CommandContribution, KeybindingContribution, ImporterContribution, ImportRequest, ExporterContribution, ExportResult, DockEdge, VisibilityPredicate, PagedEditor, PagedClient, ToolPreviewShape, ToolPreviewPolyline, ToolPreviewPath, MarqueeRectPageLocal, } from "./editor";
1
+ export type { ShellRegistries, ToolRegistry, PanelRegistry, CommandRegistry, KeybindingRegistry, OverlayRegistry, EditContextRegistry, ObjectTypeRegistry, ImporterRegistry, ExporterRegistry, ToolContribution, ToolId, ToolGroupId, ToolSectionId, ToolOptionsSpec, ToolOptionField, CursorSpec, CssCursorToken, GestureHandler, CanvasPointerEvent, OverlayContext, OverlayPrimitive, DeactivateReason, PanelContribution, PanelProps, PanelApi, OverlayContribution, OverlayProps, OverlayPageRect, CommandContribution, KeybindingContribution, ImporterContribution, ImportRequest, ExporterContribution, ExportResult, DockEdge, VisibilityPredicate, PagedEditor, PagedClient, ImageResourceClaim, ResourceTilesNeeded, ToolPreviewShape, ToolPreviewPolyline, ToolPreviewPath, MarqueeRectPageLocal, } from "./editor";
package/dist/editor.d.ts CHANGED
@@ -1,6 +1,21 @@
1
1
  import type { ComponentType } from "react";
2
2
  import type { EditContextContribution, ObjectTypeContribution } from "./host";
3
- import type { CollectionName, ContentSelection, DocumentMeta, ElementGeometryItem, ElementId, MainToWorkerKind, Mutation, PageId, PathAnchorsResult, SceneLayer, SelectionMode, WorkerToMain } from "./wire";
3
+ import type { CollectionName, ContentSelection, DocumentMeta, ElementGeometryItem, ElementId, MainToWorkerKind, Mutation, PageId, PathAnchorsResult, ProviderTileWire, ResourceTilesNeededWire, SceneLayer, SelectionMode, WorkerToMain } from "./wire";
4
+ /** C-6 (I-06) — the editor-channel claim shape (the v44
5
+ * `claimImageResource` payload, named for the `PagedEditor.images`
6
+ * member). The SDK adapter derives it from
7
+ * `ImageResourceClaimOptions` + the bundle-supplied revision. */
8
+ export interface ImageResourceClaim {
9
+ imageId: string;
10
+ levels: number;
11
+ tileSize: number;
12
+ baseWidth: number;
13
+ baseHeight: number;
14
+ revision: number;
15
+ }
16
+ /** C-6 — the worker's tile-miss notification, as the editor channel
17
+ * surfaces it (the v44 `resourceTilesNeeded` payload). */
18
+ export type ResourceTilesNeeded = ResourceTilesNeededWire;
4
19
  export interface Disposable {
5
20
  dispose(): void;
6
21
  }
@@ -386,6 +401,23 @@ export interface PagedEditor {
386
401
  submit(elementId: string, layer: SceneLayer): Promise<void>;
387
402
  clear(elementId: string): Promise<void>;
388
403
  };
404
+ /** C-6 (I-06) — the renderer RESOURCE-PROVIDER channel. The editor
405
+ * routes these to the canvas-wasm `claimImageResource` /
406
+ * `submitResourceTiles` / `releaseImageResource` messages (the v44
407
+ * wire) AND surfaces the worker's `resourceTilesNeeded` events
408
+ * (`onResourceTilesNeeded`) so the SDK adapter can pull + submit the
409
+ * tiles. `undefined` when the host build wires no resource channel
410
+ * (headless / older editor); `host.images.claimImageResource()` then
411
+ * warns + no-ops and `supports("rendering.resourceProvider@1")` is
412
+ * false. All four members mirror the editor's CanvasClient surface. */
413
+ images?: {
414
+ claim(claim: ImageResourceClaim): Promise<void>;
415
+ release(imageId: string): Promise<void>;
416
+ submitTiles(imageId: string, level: number, tiles: ProviderTileWire[], generation: number): Promise<void>;
417
+ /** Subscribe to the worker's `resourceTilesNeeded` notifications
418
+ * (worker → main). The returned function unsubscribes. */
419
+ onResourceTilesNeeded(listener: (need: ResourceTilesNeeded) => void): () => void;
420
+ };
389
421
  overlaySignals: {
390
422
  setToolPreview(value: ToolPreviewShape | null): void;
391
423
  };
package/dist/host.d.ts CHANGED
@@ -2,6 +2,7 @@ import type { CollectionName, DocumentMeta, ElementGeometryItem, ElementId, HitF
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";
5
+ import type { ClipboardSurface } from "./clipboard";
5
6
  import type { PluginManifest } from "./manifest";
6
7
  import type { SchemaPanelContribution } from "./panel-schema";
7
8
  import type { WidgetSurface } from "./widgets";
@@ -274,6 +275,65 @@ export interface SceneLayerSurface extends Disposable {
274
275
  * content). */
275
276
  clear(elementId: string): Promise<void>;
276
277
  }
278
+ /** One pyramid tile the bundle's `source` callback returns (C-6). `rgba`
279
+ * is tightly packed RGBA8 (`width*height*4` bytes, row-major); `[x, y]`
280
+ * is the tile's origin in LEVEL-space px (the provider's grid origin at
281
+ * that mip level). Returning `null` is the honest "no pixels for this
282
+ * tile yet" answer — the renderer keeps the best cached/fallback level. */
283
+ export interface TileBytes {
284
+ /** Tile origin x in level-space px. */
285
+ x: number;
286
+ /** Tile origin y in level-space px. */
287
+ y: number;
288
+ /** Pixel width of the buffer. */
289
+ width: number;
290
+ /** Pixel height of the buffer. */
291
+ height: number;
292
+ /** Tightly packed RGBA8, row-major (`width*height*4` bytes). */
293
+ rgba: Uint8Array;
294
+ }
295
+ /** What `host.images.claimImageResource` is handed (C-6). The first four
296
+ * fields describe the provider-owned pyramid; `source` serves a tile,
297
+ * `revision` is a monotonic damage signal (bump it and the renderer
298
+ * re-pulls — same etag discipline as the data provider). */
299
+ export interface ImageResourceClaimOptions {
300
+ /** Number of mip levels the provider serves (0 = full res; each level
301
+ * halves). */
302
+ levels: number;
303
+ /** Tile edge in level-space px (the grid step). */
304
+ tileSize: number;
305
+ /** Natural pixel width of the level-0 image. */
306
+ baseWidth: number;
307
+ /** Natural pixel height of the level-0 image. */
308
+ baseHeight: number;
309
+ /** Serve one tile at pyramid `level` whose origin is `(x, y)` in
310
+ * level-space px, or `null` when the provider has no pixels for it
311
+ * yet (the renderer holds the fallback level). Invoked by the SDK
312
+ * adapter for each tile the renderer reports needing. */
313
+ source(level: number, x: number, y: number): Promise<TileBytes | null>;
314
+ /** The current content revision — a monotonic counter the SDK sends
315
+ * on claim; bump the value your closure returns and re-claim (or rely
316
+ * on the renderer's damage) to invalidate. */
317
+ revision(): number;
318
+ }
319
+ /**
320
+ * The renderer resource-provider door (C-6 / I-06). A bundle claims a
321
+ * placed image's tiled mip pyramid; the renderer pulls tiles at the
322
+ * level its current scale needs. The SDK adapter owns the
323
+ * needed → source → submit plumbing (the bundle supplies only the
324
+ * `source` + `revision` callbacks). Always present — when the host wires
325
+ * no resource channel, `claimImageResource` warns + returns an inert
326
+ * Disposable and `supports("rendering.resourceProvider@1")` is false (the
327
+ * honest no-provider door). Capability-gated: `capabilities.rendering`
328
+ * must include `"resourceProvider"`.
329
+ */
330
+ export interface ImagesSurface {
331
+ /** Claim `elementId`'s image resource (the v44 wire's `image_id`). The
332
+ * renderer registers the claim and pulls tiles as it composites;
333
+ * disposing the returned handle releases the claim (the renderer drops
334
+ * to the whole-image fallback lane). */
335
+ claimImageResource(elementId: string, opts: ImageResourceClaimOptions): Disposable;
336
+ }
277
337
  /** Expected mutation failures are results, not throws — mirroring the
278
338
  * editor's mutate-never-throws convention. */
279
339
  export type MutationOutcome = {
@@ -696,6 +756,24 @@ export interface BundleHost {
696
756
  * `supports("assets.fonts@1")` is false. Capability-gated:
697
757
  * `getFontFace` requires `capabilities.assets` ∋ `"fonts"`. */
698
758
  readonly assets: AssetSurface;
759
+ /** The capability-gated RENDERER RESOURCE-PROVIDER door (C-6 / I-06):
760
+ * claim a placed image's tiled mip pyramid so the renderer pulls tiles
761
+ * at the level its current scale needs (the v44 wire). The SDK adapter
762
+ * owns the needed → source → submit plumbing; the bundle supplies the
763
+ * `source` + `revision` callbacks. Always present — when the host wires
764
+ * no resource channel, `claimImageResource` warns + returns an inert
765
+ * Disposable and `supports("rendering.resourceProvider@1")` is false.
766
+ * Capability-gated on `capabilities.rendering` ∋ `"resourceProvider"`. */
767
+ readonly images: ImagesSurface;
768
+ /** The capability-gated CLIPBOARD door (K-6 / S-14): read/write the
769
+ * SYSTEM clipboard with a rich `{ text?, tabular? }` payload (the
770
+ * sheets grid's range copy/paste interchange). Always present — when
771
+ * the host app injects no clipboard backend, `read` answers `null`,
772
+ * `write` is a no-op, and `supports("clipboard@1")` is false (the
773
+ * honest no-clipboard door). Capability-gated on
774
+ * `capabilities.clipboard`: `"full"` grants text + tabular, `"vector"`
775
+ * grants text only, `"none"`/absent denies. */
776
+ readonly clipboard: ClipboardSurface;
699
777
  /** Capability detection over version sniffing: feature strings of
700
778
  * the form `"area.member@major"` (see HOST_FEATURES in plugin-sdk). */
701
779
  supports(feature: string): boolean;
package/dist/index.d.ts CHANGED
@@ -1,8 +1,10 @@
1
1
  export type { PluginId, PluginManifest, PluginCapabilities, PluginContributions, NetworkCapability, DataProvidersCapability, StorageCapability, WasmArtifact, WasmPurpose, } from "./manifest";
2
2
  export type { BundleHandle, PagedBundle } from "./bundle";
3
- export type { BundleHost, ContributionSurface, SceneLayerSurface, DocumentSurface, SelectionSurface, ViewportSurface, TextSurface, TextMetrics, FrameChainLink, OverlaySurface, ShellSurface, FilePickerOptions, PickedFile, StorageSurface, BlobSurface, BlobUsage, NetworkSurface, ConsentResult, DataProvidersSurface, DataProviderRegistration, DataProviderHandle, DataProviderInfo, DataProviderSnapshot, ProviderSchema, ProviderField, ProviderRecordSet, DiagnosticsSurface, BindingsSurface, Diagnostic, DocumentChangeEvent, MutationOutcome, Disposable, PluginLogger, EditContextContribution, ObjectTypeContribution, EditContextCandidate, EnteredEditContext, ContentPointerEvent, EditContextDescriptor, ObjectTypeDescriptor, PluginMetadataEnvelope, ObjectTypeBaker, BakeContext, } from "./host";
3
+ export type { BundleHost, ContributionSurface, SceneLayerSurface, ImagesSurface, ImageResourceClaimOptions, TileBytes, DocumentSurface, SelectionSurface, ViewportSurface, TextSurface, TextMetrics, FrameChainLink, OverlaySurface, ShellSurface, FilePickerOptions, PickedFile, StorageSurface, BlobSurface, BlobUsage, NetworkSurface, ConsentResult, DataProvidersSurface, DataProviderRegistration, DataProviderHandle, DataProviderInfo, DataProviderSnapshot, ProviderSchema, ProviderField, ProviderRecordSet, DiagnosticsSurface, BindingsSurface, Diagnostic, DocumentChangeEvent, MutationOutcome, Disposable, PluginLogger, EditContextContribution, ObjectTypeContribution, EditContextCandidate, EnteredEditContext, ContentPointerEvent, EditContextDescriptor, ObjectTypeDescriptor, PluginMetadataEnvelope, ObjectTypeBaker, BakeContext, } from "./host";
4
4
  export type { PanelSchema, PanelSchemaSection, PanelSchemaRow, SchemaPanelContribution, SchemaPanelRenderer, SchemaPanelRendererProps, WidgetValueBinding, BindingRef, SchemaGate, } from "./panel-schema";
5
5
  export type { WidgetSurface, CodeEditorProps, CodeEditorDiagnostic, CodeEditorLanguage, } from "./widgets";
6
6
  export type { AssetSurface, AssetKind, FontFaceAsset, FontFaceFormat, } from "./assets";
7
+ export type { ProviderTileWire } from "./wire";
8
+ export type { ClipboardSurface, ClipboardPayload, TabularClipboard, } from "./clipboard";
7
9
  export type * from "./contributions";
8
10
  export type * from "./mutations";
@@ -28,13 +28,14 @@ export interface PluginCapabilities {
28
28
  read?: "broad" | "scoped";
29
29
  write?: "broad" | "scoped";
30
30
  };
31
- /** Render-pipeline surfaces the bundle uses. v0: `overlay` means
32
- * the shared TS overlay signals (tool previews) AND
33
- * `contribute.overlay`; `hitTest` gates `document.hitTest`;
34
- * `sceneLayer` is reserved for the P2 channel. Declaring a surface
35
- * is the prerequisite for the matching door (the host gate throws
36
- * on an undeclared use). */
37
- rendering?: Array<"sceneLayer" | "overlay" | "hitTest">;
31
+ /** Render-pipeline surfaces the bundle uses. `overlay` means the
32
+ * shared TS overlay signals (tool previews) AND `contribute.overlay`;
33
+ * `hitTest` gates `document.hitTest`; `sceneLayer` gates the in-frame
34
+ * `contribute.sceneLayer()` channel (C-1); `resourceProvider` gates
35
+ * the renderer pyramid-tile door `host.images.claimImageResource`
36
+ * (C-6 / I-06). Declaring a surface is the prerequisite for the
37
+ * matching door (the host gate throws on an undeclared use). */
38
+ rendering?: Array<"sceneLayer" | "overlay" | "hitTest" | "resourceProvider">;
38
39
  /** The bundle registers keybindings directly via
39
40
  * `contribute.keybinding`. Keybindings have no id to list under
40
41
  * `contributes`, so this boolean is their declaration. v0 first-
@@ -88,6 +89,15 @@ export interface PluginCapabilities {
88
89
  * gets no surface.
89
90
  */
90
91
  dataProviders?: DataProvidersCapability;
92
+ /**
93
+ * The clipboard door's grant (K-6 / S-14). Gates `host.clipboard`:
94
+ * `"full"` grants BOTH the text and the rich `tabular` (cell-grid)
95
+ * payload — the sheets range copy/paste interchange; `"vector"` grants
96
+ * the `text` half only (a vector plugin copies a textual representation,
97
+ * not a cell grid — a `tabular` write is dropped); `"none"` (the
98
+ * default) / absent DENIES the door (read → `null`, write refused). See
99
+ * `clipboard.ts` for the surface + DESIGN.md for the trust line.
100
+ */
91
101
  clipboard?: "none" | "vector" | "full";
92
102
  /**
93
103
  * Declared WebAssembly artifacts the bundle ships and loads at
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.43.0
4
+ // Synced from @paged-media/canvas-wasm@0.44.0
5
5
  /* tslint:disable */
6
6
  /* eslint-disable */
7
7
 
@@ -336,7 +336,7 @@ export type CaretDirection = "up" | "down";
336
336
  /**
337
337
  * Discriminated payload of a `WorkerToMain` message.
338
338
  */
339
- 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; 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: "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 } } | { kind: "fontRegistryCleared" } | { 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: "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: "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[] } } | { kind: "exportIdmlFailed"; payload: { error: string } } | { kind: "elementProperties"; payload: { result: ElementProperties | 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 };
339
+ 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; 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: "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 } } | { kind: "fontRegistryCleared" } | { 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: "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[] } } | { kind: "exportIdmlFailed"; payload: { error: string } } | { kind: "elementProperties"; payload: { result: ElementProperties | 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 };
340
340
 
341
341
  /**
342
342
  * Editor-ops — wire mirror of `paged_parse::GradientFeatherParams`.
@@ -1505,7 +1505,7 @@ export type Operation = { kind: "SetProperty"; node: NodeId; path: PropertyPath;
1505
1505
  * variants so e.g. `cmyk_icc_profile` becomes `cmykIccProfile` on
1506
1506
  * the wire — the TS protocol mirror locks the camelCase contract.
1507
1507
  */
1508
- export type MainToWorkerKind = { kind: "hello" } | { kind: "loadDocument"; payload: { bytes: number[]; font?: number[] | null; cmykIccProfile?: 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: "requestLayers" } | { kind: "requestCollection"; payload: { name: CollectionName } } | { kind: "requestFrameChain"; payload: { storyId: 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 } } | { kind: "clearSceneLayer"; payload: { elementId: string } } | { 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 } } | { kind: "exportPdfBegin"; payload: { options: ExportPdfWireOptions } } | { kind: "exportPdfPage"; payload: { session: number } } | { kind: "exportPdfFinish"; payload: { session: number } } | { kind: "exportPdfCancel"; payload: { session: number } } | { kind: "exportIdml"; 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 } };
1508
+ export type MainToWorkerKind = { kind: "hello" } | { kind: "loadDocument"; payload: { bytes: number[]; font?: number[] | null; cmykIccProfile?: 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: "requestLayers" } | { kind: "requestCollection"; payload: { name: CollectionName } } | { kind: "requestFrameChain"; payload: { storyId: 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 } } | { kind: "clearSceneLayer"; 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 } } | { kind: "exportPdfBegin"; payload: { options: ExportPdfWireOptions } } | { kind: "exportPdfPage"; payload: { session: number } } | { kind: "exportPdfFinish"; payload: { session: number } } | { kind: "exportPdfCancel"; payload: { session: number } } | { kind: "exportIdml"; 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 } };
1509
1509
 
1510
1510
  /**
1511
1511
  * Track J — wire-shape mirror of `paged_parse::PathAnchor`. The
@@ -2064,6 +2064,50 @@ export interface PlaceholderItem {
2064
2064
  value: string | null;
2065
2065
  }
2066
2066
 
2067
+ /**
2068
+ * v44 (C-6 / I-06) — one image\'s tile-miss request: the tiles a claimed
2069
+ * image lacked at `level` during the last build. `tiles` are grid origins
2070
+ * `[x, y]` in level-space px; `generation` is the pyramid revision the
2071
+ * request was computed against (the host echoes it on submit so a stale
2072
+ * reply is dropped).
2073
+ */
2074
+ export interface ResourceTilesNeededWire {
2075
+ imageId: string;
2076
+ level: number;
2077
+ tiles: [number, number][];
2078
+ generation: number;
2079
+ }
2080
+
2081
+ /**
2082
+ * v44 (C-6 / I-06) — one pyramid tile on the wire. `rgba` is tightly
2083
+ * packed RGBA8 (`width*height*4` bytes, row-major); `[x, y]` is the
2084
+ * tile\'s origin in level-space px (the provider\'s grid origin). The
2085
+ * worker interns these into its budgeted LRU tile cache; the renderer\'s
2086
+ * resource provider serves them back as `paged_renderer::ProviderTile`.
2087
+ */
2088
+ export interface ProviderTileWire {
2089
+ /**
2090
+ * Tile origin x in level-space px.
2091
+ */
2092
+ x: number;
2093
+ /**
2094
+ * Tile origin y in level-space px.
2095
+ */
2096
+ y: number;
2097
+ /**
2098
+ * Pixel width of the buffer.
2099
+ */
2100
+ width: number;
2101
+ /**
2102
+ * Pixel height of the buffer.
2103
+ */
2104
+ height: number;
2105
+ /**
2106
+ * Tightly packed RGBA8, row-major. Length must be `width*height*4`.
2107
+ */
2108
+ rgba: number[];
2109
+ }
2110
+
2067
2111
  export interface CaretGeometry {
2068
2112
  pageId: PageId;
2069
2113
  frameId: string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paged-media/plugin-api",
3
- "version": "0.2.14-canary.0",
3
+ "version": "0.2.17-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",
@@ -59,7 +59,8 @@
59
59
  "enum": [
60
60
  "sceneLayer",
61
61
  "overlay",
62
- "hitTest"
62
+ "hitTest",
63
+ "resourceProvider"
63
64
  ]
64
65
  }
65
66
  },