@paged-media/plugin-api 0.2.16-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.
@@ -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
@@ -275,6 +275,65 @@ export interface SceneLayerSurface extends Disposable {
275
275
  * content). */
276
276
  clear(elementId: string): Promise<void>;
277
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
+ }
278
337
  /** Expected mutation failures are results, not throws — mirroring the
279
338
  * editor's mutate-never-throws convention. */
280
339
  export type MutationOutcome = {
@@ -697,6 +756,15 @@ export interface BundleHost {
697
756
  * `supports("assets.fonts@1")` is false. Capability-gated:
698
757
  * `getFontFace` requires `capabilities.assets` ∋ `"fonts"`. */
699
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;
700
768
  /** The capability-gated CLIPBOARD door (K-6 / S-14): read/write the
701
769
  * SYSTEM clipboard with a rich `{ text?, tabular? }` payload (the
702
770
  * sheets grid's range copy/paste interchange). Always present — when
package/dist/index.d.ts CHANGED
@@ -1,9 +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";
7
8
  export type { ClipboardSurface, ClipboardPayload, TabularClipboard, } from "./clipboard";
8
9
  export type * from "./contributions";
9
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-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paged-media/plugin-api",
3
- "version": "0.2.16-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
  },