@paged-media/plugin-api 0.2.42-canary.0 → 0.2.45-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/host.d.ts +80 -0
- package/dist/index.d.ts +6 -5
- package/dist/manifest.d.ts +25 -0
- package/dist/mutations.d.ts +1 -1
- package/dist/object-model.d.ts +556 -0
- package/dist/panel-schema.d.ts +113 -1
- package/dist/widgets.d.ts +56 -1
- package/dist/wire.d.ts +124 -9
- package/package.json +1 -1
- package/src/manifest.schema.json +170 -0
package/dist/host.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import type { MutationInput } from "./mutations";
|
|
|
8
8
|
import type { PluginManifest } from "./manifest";
|
|
9
9
|
import type { SchemaPanelContribution } from "./panel-schema";
|
|
10
10
|
import type { WidgetSurface } from "./widgets";
|
|
11
|
+
import type { ObjectModelContribution, ObjectModelHandle, ObjectsSurface } from "./object-model";
|
|
11
12
|
/** Everything a bundle registers is disposable; the host ALSO tracks
|
|
12
13
|
* it, so deactivation teardown is structural, not conventional. */
|
|
13
14
|
export interface Disposable {
|
|
@@ -474,6 +475,21 @@ export interface ContributionSurface {
|
|
|
474
475
|
* layer it submitted.
|
|
475
476
|
*/
|
|
476
477
|
sceneLayer(): SceneLayerSurface;
|
|
478
|
+
/**
|
|
479
|
+
* Contribute this bundle's OBJECT MODEL (ADR 323, DESIGN.md §21): its
|
|
480
|
+
* object kinds — typed schema rows plus `list` / `get` / `set` / `batch`
|
|
481
|
+
* handlers — and typed commands. Every kind becomes addressable as
|
|
482
|
+
* `plugin:<manifest.id>/<kind>/<id>` through `host.objects` (and so from
|
|
483
|
+
* bindings, Boa, the Node CLI and schema-driven panel fields), headless
|
|
484
|
+
* and outside any edit context.
|
|
485
|
+
*
|
|
486
|
+
* Capability-gated: every kind must be declared in
|
|
487
|
+
* `contributes.objectModel.kinds[]` and every command in
|
|
488
|
+
* `contributes.objectModel.commands[]`; a kind with no schema rows, a row
|
|
489
|
+
* whose type is not a `ValueType`, or a duplicate path is refused loudly.
|
|
490
|
+
* Probe `supports("contribute.objectModel@1")`.
|
|
491
|
+
*/
|
|
492
|
+
objectModel(model: ObjectModelContribution): ObjectModelHandle;
|
|
477
493
|
}
|
|
478
494
|
/** The scene-layer surface (C-1) returned by `contribute.sceneLayer()`.
|
|
479
495
|
* `elementId` is the host `Self` id of the frame to render into. */
|
|
@@ -726,6 +742,11 @@ export type MutationOutcome = {
|
|
|
726
742
|
createdId: ElementId | null;
|
|
727
743
|
pageIds: PageId[];
|
|
728
744
|
minted?: MintedElement[];
|
|
745
|
+
/** The engine's sequence number of this write (the wire's
|
|
746
|
+
* `mutationApplied.appliedSeq`), when the host knows it. A script
|
|
747
|
+
* host bridge reports it back as `HostObjectsResult.committed` so
|
|
748
|
+
* the write folds into the script's undo step (protocol 71). */
|
|
749
|
+
appliedSeq?: number;
|
|
729
750
|
} | {
|
|
730
751
|
applied: false;
|
|
731
752
|
error: unknown;
|
|
@@ -1138,6 +1159,55 @@ export interface ViewportSurface {
|
|
|
1138
1159
|
/** Screen px → document pt at the current zoom (the constant-
|
|
1139
1160
|
* screen-tolerance idiom every tool needs). */
|
|
1140
1161
|
pxToPt(px: number): number;
|
|
1162
|
+
/** v70 — bring a page into view, fitted to the viewport (a slide
|
|
1163
|
+
* sorter's click, a link to a page). `false` when the page is unknown
|
|
1164
|
+
* or the host can't navigate: probe `supports("viewport.pages@1")`. */
|
|
1165
|
+
goToPage(pageId: PageId, options?: {
|
|
1166
|
+
fit?: "page" | "width";
|
|
1167
|
+
}): Promise<boolean>;
|
|
1168
|
+
/** v70 — the page the user is on: the one the viewport's centre is
|
|
1169
|
+
* over, else the nearest (the same page `host.document.meta()`
|
|
1170
|
+
* reports as `activePage`). `null` with no document or no host
|
|
1171
|
+
* backend. */
|
|
1172
|
+
activePage(): PageId | null;
|
|
1173
|
+
/** v70 — fires when the active page changes (scrolling, zooming,
|
|
1174
|
+
* `goToPage`, a page deleted under it). Never fires without a host
|
|
1175
|
+
* backend. */
|
|
1176
|
+
onDidChangeActivePage(listener: (pageId: PageId | null) => void): Disposable;
|
|
1177
|
+
}
|
|
1178
|
+
/** v70 — what `host.render.snapshot` renders. */
|
|
1179
|
+
export interface RenderSnapshotOptions {
|
|
1180
|
+
/** Width of the image in device pixels, 1 to 8192; the height follows
|
|
1181
|
+
* the page's aspect. The engine renders at a resolution derived from
|
|
1182
|
+
* it, so the image can be a pixel off: `RenderedPage.widthPx` is exact. */
|
|
1183
|
+
widthPx: number;
|
|
1184
|
+
/** Items to leave out of this image only (a build step whose shapes
|
|
1185
|
+
* have not appeared yet). The document is not changed and no undo
|
|
1186
|
+
* step is recorded. */
|
|
1187
|
+
hideItems?: ElementId[];
|
|
1188
|
+
}
|
|
1189
|
+
/** v70 — one rendered page. */
|
|
1190
|
+
export interface RenderedPage {
|
|
1191
|
+
pageId: PageId;
|
|
1192
|
+
/** The image's own size, within a pixel of the requested width. */
|
|
1193
|
+
widthPx: number;
|
|
1194
|
+
heightPx: number;
|
|
1195
|
+
/** PNG bytes; `createImageBitmap(new Blob([png]))` draws them. */
|
|
1196
|
+
png: Uint8Array;
|
|
1197
|
+
/** The engine's layout generation the image shows: an image with an
|
|
1198
|
+
* older generation than a page's current one is stale. */
|
|
1199
|
+
layoutGeneration: number;
|
|
1200
|
+
}
|
|
1201
|
+
/**
|
|
1202
|
+
* v70 — render a page to an image with the engine's own renderer (CPU),
|
|
1203
|
+
* the same pixels the canvas shows: slide thumbnails, a slideshow's
|
|
1204
|
+
* frames, a build step's frames. A READ: gated on
|
|
1205
|
+
* `capabilities.document.read`. `supports("render.snapshot@1")`.
|
|
1206
|
+
*/
|
|
1207
|
+
export interface RenderSurface {
|
|
1208
|
+
/** The page as a PNG, or `null` when the page is unknown or the
|
|
1209
|
+
* engine refused (an invalid width). */
|
|
1210
|
+
snapshot(pageId: PageId, options: RenderSnapshotOptions): Promise<RenderedPage | null>;
|
|
1141
1211
|
}
|
|
1142
1212
|
/** Font advance + vertical metrics, in document points (pt). */
|
|
1143
1213
|
export interface TextMetrics {
|
|
@@ -1660,6 +1730,9 @@ export interface BundleHost {
|
|
|
1660
1730
|
readonly document: DocumentSurface;
|
|
1661
1731
|
readonly selection: SelectionSurface;
|
|
1662
1732
|
readonly viewport: ViewportSurface;
|
|
1733
|
+
/** v70 — page images from the engine's renderer (thumbnails, slideshow
|
|
1734
|
+
* frames). `supports("render.snapshot@1")`; gated on document read. */
|
|
1735
|
+
readonly render: RenderSurface;
|
|
1663
1736
|
/** Font measurement against the document's fonts (S-13). A read door,
|
|
1664
1737
|
* no capability gate; `supports("text.measure@1")` reports whether the
|
|
1665
1738
|
* host wired the engine shaper (it is false under a host that injects
|
|
@@ -1777,6 +1850,13 @@ export interface BundleHost {
|
|
|
1777
1850
|
* subscription. Always present; `supports("tools.settings@1")`
|
|
1778
1851
|
* reports whether a host store is wired. */
|
|
1779
1852
|
readonly tools: ToolsSurface;
|
|
1853
|
+
/** The OBJECT registry (ADR 323): one `query` / `get` / `set` / `batch` /
|
|
1854
|
+
* `schema` over core addresses and every plugin's contributed kinds.
|
|
1855
|
+
* Always present. Reads are gated on `capabilities.document.read`,
|
|
1856
|
+
* writes on `capabilities.document.write` (a refused write answers
|
|
1857
|
+
* `{ applied: false }`). `supports("objects@1")`; cross-plugin routing
|
|
1858
|
+
* (a SHARED registry the host injected) is `supports("objects.shared@1")`. */
|
|
1859
|
+
readonly objects: ObjectsSurface;
|
|
1780
1860
|
/** Capability detection over version sniffing: feature strings of
|
|
1781
1861
|
* the form `"area.member@major"` (see HOST_FEATURES in plugin-sdk). */
|
|
1782
1862
|
supports(feature: string): boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
export type { PluginId, PluginManifest, PluginCapabilities, PluginContributions, NetworkCapability, DataProvidersCapability, StorageCapability, WasmArtifact, WasmPurpose, WorkersCapability, SecretsCapability, DocumentsCapability, GpuCapability, } from "./manifest";
|
|
1
|
+
export type { PluginId, PluginManifest, PluginCapabilities, PluginContributions, NetworkCapability, DataProvidersCapability, StorageCapability, WasmArtifact, WasmPurpose, WorkersCapability, SecretsCapability, DocumentsCapability, GpuCapability, ObjectModelDeclaration, } from "./manifest";
|
|
2
|
+
export type { Address, Selector, PropertyPathName, PageItemKind, StyleFamily, ParsedAddress, AddressKind, ValueType, StructField, ValueTypeKind, PropertySchema, ContentSchema, ObjectErrorCode, ObjectValue, ObjectOp, PartChange, ObjectWrite, ObjectQuery, ObjectPredicate, ObjectKindContribution, TypedCommandContribution, ObjectModelContribution, ObjectModelHandle, ObjectWriteResult, ObjectCommandResult, ObjectChange, ObjectKindInfo, ObjectCommandInfo, ObjectsSurface, ListEdit, StructEdit, ValueEdit, } from "./object-model";
|
|
2
3
|
export type { BundleHandle, PagedBundle } from "./bundle";
|
|
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, OverlayLayer, ShellSurface, FilePickerOptions, PickedFile, SaveFileOptions, StorageSurface, BlobSurface, BlobUsage, PartsSurface, NativeDocumentSurface, DocumentsSurface, OpenDocumentOptions, OpenDocumentResult, NetworkSurface, ConsentResult, DataProvidersSurface, DataProviderRegistration, DataProviderHandle, DataProviderInfo, DataProviderSnapshot, ProviderSchema, ProviderField, ProviderRecordSet, DiagnosticsSurface, JournalSurface, JournalRecord, BindingsSurface, Diagnostic, DocumentChangeEvent, DocumentOpenedEvent, MutationOutcome, Disposable, PluginLogger, EditContextContribution, ObjectTypeContribution, EditContextCandidate, EnteredEditContext, ContentPointerEvent, ContentWheelEvent, EditContextDescriptor, ObjectTypeDescriptor, PluginMetadataEnvelope, ObjectTypeBaker, BakeContext, MenuContribution, } from "./host";
|
|
4
|
-
export type { PanelSchema, PanelSchemaSection, PanelSchemaRow, SchemaPanelContribution, SchemaPanelRenderer, SchemaPanelRendererProps, WidgetValueBinding, BindingRef, SchemaGate, WidgetCollectionBinding, SchemaRowAction, SchemaListAction, SchemaListSpec, } from "./panel-schema";
|
|
5
|
-
export type { WidgetSurface, ColorPickerProps, CodeEditorProps, CodeEditorDiagnostic, CodeEditorLanguage, } from "./widgets";
|
|
4
|
+
export type { BundleHost, ContributionSurface, SceneLayerSurface, SceneLayerSubmitResult, SceneImage, SceneImageTile, SceneImageSubmitOptions, WillSaveEvent, ToolsSurface, ToolSettingValue, ImagesSurface, ImageResourceClaimOptions, TileBytes, WorkersSurface, BundleWorker, SpawnWorkerOptions, SecretsSurface, SecretMaterial, DocumentSurface, MutateWithBytesOptions, SelectionSurface, ViewportSurface, RenderSurface, RenderSnapshotOptions, RenderedPage, TextSurface, TextMetrics, TextCaret, FrameChainLink, PlanarFace, PlanarRegionsResult, StoryContent, ParagraphContent, RunContent, OverlaySurface, OverlayLayer, ShellSurface, FilePickerOptions, PickedFile, SaveFileOptions, StorageSurface, BlobSurface, BlobUsage, PartsSurface, NativeDocumentSurface, DocumentsSurface, OpenDocumentOptions, OpenDocumentResult, NetworkSurface, ConsentResult, DataProvidersSurface, DataProviderRegistration, DataProviderHandle, DataProviderInfo, DataProviderSnapshot, ProviderSchema, ProviderField, ProviderRecordSet, DiagnosticsSurface, JournalSurface, JournalRecord, BindingsSurface, Diagnostic, DocumentChangeEvent, DocumentOpenedEvent, MutationOutcome, Disposable, PluginLogger, EditContextContribution, ObjectTypeContribution, EditContextCandidate, EnteredEditContext, ContentPointerEvent, ContentWheelEvent, EditContextDescriptor, ObjectTypeDescriptor, PluginMetadataEnvelope, ObjectTypeBaker, BakeContext, MenuContribution, } from "./host";
|
|
5
|
+
export type { PanelSchema, PanelSchemaSection, PanelSchemaRow, SchemaPanelContribution, SchemaPanelRenderer, SchemaPanelRendererProps, WidgetValueBinding, BindingRef, SchemaGate, WidgetCollectionBinding, SchemaRowAction, SchemaListAction, SchemaListSpec, PanelSchemaWidgetRow, PanelSchemaPropertyRow, PropertyFieldAddress, PropertyFieldStyle, PropertyFieldOption, PropertySubField, PropertyListPresentation, } from "./panel-schema";
|
|
6
|
+
export type { WidgetSurface, ColorPickerProps, CodeEditorProps, CodeEditorDiagnostic, CodeEditorLanguage, PropertyFieldProps, PropertyFrameProps, PropertyFieldTarget, } from "./widgets";
|
|
6
7
|
export type { BindingTarget, BindingPropertyRequest, BindingPropertyWrite, BindingCollectionRequest, BindingRead, BindingResolved, BindingDecline, BindingWrite, BindingCollection, BindingOp, BindingProvider, BindingProviderScope, BindingProviderHandle, BindingReadResult, BindingWriteResult, BindingCollectionResult, ActiveBindingProvider, } from "./binding-provider";
|
|
7
8
|
export type { AssetSurface, AssetKind, FontFaceAsset, FontFaceFormat, } from "./assets";
|
|
8
|
-
export type { ProviderTileWire } from "./wire";
|
|
9
|
+
export type { ProviderTileWire, SnapshotPng } from "./wire";
|
|
9
10
|
export type { SnapPointQuery, SnapPointResult, SnapPointHit, SnapAxisHit, SnapSegmentHit, SnapExclude, SnapSource, SnapSettings, } from "./wire";
|
|
10
11
|
export type { MintedElement } from "./wire";
|
|
11
12
|
export type { ClipboardSurface, ClipboardPayload, TabularClipboard, } from "./clipboard";
|
package/dist/manifest.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { AssetKind } from "./assets";
|
|
|
2
2
|
/** Reverse-DNS plugin identity, e.g. `media.paged.draw`. Doubles as
|
|
3
3
|
* the namespace prefix for every contribution id the bundle
|
|
4
4
|
* registers (`media.paged.draw.tool.pen`). */
|
|
5
|
+
import type { PropertySchema, ValueType } from "./object-model";
|
|
5
6
|
export type PluginId = string;
|
|
6
7
|
export interface PluginManifest {
|
|
7
8
|
id: PluginId;
|
|
@@ -337,6 +338,14 @@ export interface PluginContributions {
|
|
|
337
338
|
* WITHOUT central blessing of each data type. The bytes are read/written
|
|
338
339
|
* through the `host.parts` door into the plugin's own `paged/<plugin-id>/`
|
|
339
340
|
* namespace. Purely DECLARATIVE — no runtime behaviour rides on this. */
|
|
341
|
+
/** ADR 323 — the OBJECT MODEL this bundle contributes through
|
|
342
|
+
* `host.contribute.objectModel`. Declaring it is the capability gate: a
|
|
343
|
+
* kind or typed command registered at runtime must be listed here. Each
|
|
344
|
+
* `schema` / `args` is either the rows / value type INLINE or a
|
|
345
|
+
* bundle-relative path to a JSON file holding them (plugin-cli reads
|
|
346
|
+
* it). `plugin-cli validate` fails a kind with no schema rows, a row
|
|
347
|
+
* whose type is not a `ValueType`, and a command with no `args`. */
|
|
348
|
+
objectModel?: ObjectModelDeclaration;
|
|
340
349
|
partTypes?: Array<{
|
|
341
350
|
/** A plugin-local type name (e.g. "sheet", "imageStack", "barcode"). */
|
|
342
351
|
type: string;
|
|
@@ -351,3 +360,19 @@ export interface PluginContributions {
|
|
|
351
360
|
linkable?: boolean;
|
|
352
361
|
}>;
|
|
353
362
|
}
|
|
363
|
+
/** `contributes.objectModel` (ADR 323). */
|
|
364
|
+
export interface ObjectModelDeclaration {
|
|
365
|
+
kinds: Array<{
|
|
366
|
+
kind: string;
|
|
367
|
+
title: string;
|
|
368
|
+
/** Inline schema rows, or a bundle-relative path to a JSON array. */
|
|
369
|
+
schema: string | readonly PropertySchema[];
|
|
370
|
+
}>;
|
|
371
|
+
commands?: Array<{
|
|
372
|
+
id: string;
|
|
373
|
+
title: string;
|
|
374
|
+
/** Inline value type, or a bundle-relative path to a JSON file. */
|
|
375
|
+
args: string | ValueType;
|
|
376
|
+
result?: string | ValueType;
|
|
377
|
+
}>;
|
|
378
|
+
}
|
package/dist/mutations.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Mutation } from "./wire";
|
|
2
|
-
export type { ElementId, PageId, NodeId, NodeSpec, Mutation, Operation, PropertyPath, Value, PathAnchorSpec, PathAnchorTriple, PathAnchorsResult, PathPointAddress, PathPointRole, PathfinderKind, HitFilter, HitResult, CollectionName, DocumentMeta, ElementGeometryItem, SceneTreeNode, SelectionMode, ContentSelection, MainToWorker, MainToWorkerKind, WorkerToMain, SceneLayer, SceneItem, ScenePathSeg, ScenePaint, GestureType, GestureHandle, GestureModifiers, SwatchSpec, GradientSpec, GradientStopSpec, SwatchSummary, GradientSummary, LayerSummary, } from "./wire";
|
|
2
|
+
export type { ElementId, PageId, NodeId, NodeSpec, Mutation, Operation, PropertyPath, Value, PathAnchorSpec, PathAnchorTriple, PathAnchorsResult, PathPointAddress, PathPointRole, PathfinderKind, HitFilter, HitResult, CollectionName, DocumentMeta, ElementGeometryItem, SceneTreeNode, SelectionMode, ContentSelection, MainToWorker, MainToWorkerKind, WorkerToMain, SceneLayer, SceneItem, ScenePathSeg, ScenePaint, GestureType, GestureHandle, GestureModifiers, SwatchSpec, GradientSpec, GradientStopSpec, SwatchSummary, GradientSummary, LayerSummary, PageSummary, StorySummary, } from "./wire";
|
|
3
3
|
/** v56 (Wave B) — close an OPEN subpath of a path element: the inverse
|
|
4
4
|
* gesture of `pathOpenAt`'s scissors cut. `subpath` picks the contour
|
|
5
5
|
* by index; omit for the default (the single/last open subpath).
|