@paged-media/plugin-api 0.2.32-canary.0 → 0.2.33-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 +22 -0
- package/dist/host.d.ts +77 -0
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/editor.d.ts
CHANGED
|
@@ -292,6 +292,24 @@ export interface OverlayRegistry {
|
|
|
292
292
|
/** W3.2 — the edit-context registry (the shell owns the stack + chrome
|
|
293
293
|
* + write-scope; this narrow contract is just the registration door).
|
|
294
294
|
* The contribution type lives in ./host (the bundle-facing surface). */
|
|
295
|
+
/** The host's menu registry, narrowed to what a bundle may do with it.
|
|
296
|
+
*
|
|
297
|
+
* `register` only, and the item shape is the HOST's own
|
|
298
|
+
* `MenuItemContribution` rather than the plugin-facing
|
|
299
|
+
* `MenuContribution` — the SDK translates one into the other, turning
|
|
300
|
+
* the declarative `scope` into the `when` predicate the host already
|
|
301
|
+
* uses for "does this apply where you are standing". Keeping the
|
|
302
|
+
* translation in the SDK is what lets the plugin-facing shape stay
|
|
303
|
+
* declarative while the host keeps one vocabulary for visibility. */
|
|
304
|
+
export interface MenuRegistry {
|
|
305
|
+
register(item: {
|
|
306
|
+
path: string;
|
|
307
|
+
command: string;
|
|
308
|
+
order?: number;
|
|
309
|
+
group?: string;
|
|
310
|
+
when?: (state: unknown) => boolean;
|
|
311
|
+
}): Disposable;
|
|
312
|
+
}
|
|
295
313
|
export interface EditContextRegistry {
|
|
296
314
|
register(contribution: EditContextContribution): Disposable;
|
|
297
315
|
}
|
|
@@ -320,6 +338,10 @@ export interface ShellRegistries {
|
|
|
320
338
|
* the contract so a host that hasn't wired the registry yet stays
|
|
321
339
|
* assignable; the SDK adapter falls back to a recording stub. */
|
|
322
340
|
editContexts?: EditContextRegistry;
|
|
341
|
+
/** Menu entries (`contribute.menu`). Optional for the same reason as
|
|
342
|
+
* `editContexts`: a host predating the door stays assignable, and the
|
|
343
|
+
* SDK reports the contribution as unavailable rather than throwing. */
|
|
344
|
+
menus?: MenuRegistry;
|
|
323
345
|
/** W3.2 — object types (W-03). Optional for the same reason. */
|
|
324
346
|
objectTypes?: ObjectTypeRegistry;
|
|
325
347
|
/** K-2 / S-06 — document importers (file → plugin). Optional on the
|
package/dist/host.d.ts
CHANGED
|
@@ -246,6 +246,77 @@ export type ObjectTypeDescriptor = ObjectTypeContribution;
|
|
|
246
246
|
* (ids start with `<manifest.id>.`) and tracks the registration for
|
|
247
247
|
* automatic teardown on deactivate.
|
|
248
248
|
*/
|
|
249
|
+
/** A menu entry a plugin places in the host's menu bar.
|
|
250
|
+
*
|
|
251
|
+
* WHY THIS EXISTS. Until it did, the contract had eleven contribution
|
|
252
|
+
* types and no way to reach the menu bar, so a plugin command's only
|
|
253
|
+
* host-wide home was the command palette — where the row shows the raw
|
|
254
|
+
* command id where every other application puts the key, and where
|
|
255
|
+
* nobody ever sees two creation verbs side by side. That is how six
|
|
256
|
+
* content types came to teach six different creation idioms (Insert /
|
|
257
|
+
* Place / Import, plus a `lowerToFrame` that is compiler vocabulary for
|
|
258
|
+
* the step that puts the sheet on the page). The host had begun
|
|
259
|
+
* hand-curating entries on plugins' behalf, which works and does not
|
|
260
|
+
* scale: the host has to know each plugin by name.
|
|
261
|
+
*
|
|
262
|
+
* TWO SCOPES, because there are two different problems and either one
|
|
263
|
+
* alone leaves the other standing.
|
|
264
|
+
*
|
|
265
|
+
* `"document"` is the front door: the entry is in the bar whenever a
|
|
266
|
+
* document is open, which is what makes a content type discoverable to
|
|
267
|
+
* someone who has not met it yet.
|
|
268
|
+
*
|
|
269
|
+
* `{ editContext }` is the in-context surface: the entry exists only
|
|
270
|
+
* while that edit context is active. This is the larger gap. Inside a
|
|
271
|
+
* `vectorGraphic` the draw plugin has ~92 relevant commands; inside a
|
|
272
|
+
* `sheet` the tool rail is deliberately EMPTY and the plugin still has
|
|
273
|
+
* sort, find-and-replace and cell-style verbs — and in both the menu
|
|
274
|
+
* bar shows the host's own menus, about the document the user stepped
|
|
275
|
+
* out of. The shell already scopes the tool rail (`toolIds`) and the
|
|
276
|
+
* Window menu (`panelIds`) to the active context; this is the same
|
|
277
|
+
* idea applied to the third surface, and it lands on machinery that
|
|
278
|
+
* already exists.
|
|
279
|
+
*/
|
|
280
|
+
export interface MenuContribution {
|
|
281
|
+
/** Slash-separated path, as the host's own menu items use.
|
|
282
|
+
* `"Object/Insert web frame…"`, `"Sheet/Sort range…"`. A path whose
|
|
283
|
+
* first segment names an existing menu merges into it; a new first
|
|
284
|
+
* segment inserts a new top-level menu. */
|
|
285
|
+
path: string;
|
|
286
|
+
/** Command id this entry invokes. Must be a command the bundle has
|
|
287
|
+
* registered — the host refuses an entry pointing at nothing, on the
|
|
288
|
+
* same principle the tool rail refuses a dead slot: an affordance
|
|
289
|
+
* that accepts a click and silently does nothing is worse than an
|
|
290
|
+
* absent one, because the user reads it as their own mistake. */
|
|
291
|
+
command: string;
|
|
292
|
+
/** Lower floats up within the group. Default 100. */
|
|
293
|
+
order?: number;
|
|
294
|
+
/** Separator group; items sharing one cluster together. */
|
|
295
|
+
group?: string;
|
|
296
|
+
/** When the entry is in the bar.
|
|
297
|
+
*
|
|
298
|
+
* `"document"` — whenever a document is open.
|
|
299
|
+
* `{ editContext }` — only while that context is active.
|
|
300
|
+
*
|
|
301
|
+
* Defaults to `"document"`, because an entry nobody can find is the
|
|
302
|
+
* problem this exists to solve. */
|
|
303
|
+
scope?: "document" | {
|
|
304
|
+
editContext: string;
|
|
305
|
+
};
|
|
306
|
+
/** How a context-scoped menu meets the host's own menus.
|
|
307
|
+
*
|
|
308
|
+
* `"augment"` (the default) leaves every host menu live alongside it.
|
|
309
|
+
* `"replace"` hides the host's document-level menus that the context
|
|
310
|
+
* cannot serve.
|
|
311
|
+
*
|
|
312
|
+
* paged.doc is the case that forces this to exist: it hands the tool
|
|
313
|
+
* rail back to the HOST's type and select tools, because a DOCX
|
|
314
|
+
* lowers to real text frames and real stories, so the host's Type and
|
|
315
|
+
* Edit menus genuinely still apply inside it. A door that only knew
|
|
316
|
+
* how to replace would be right for `sheet` and `webFrame` and wrong
|
|
317
|
+
* for precisely the one plugin whose content is native. */
|
|
318
|
+
mode?: "augment" | "replace";
|
|
319
|
+
}
|
|
249
320
|
export interface ContributionSurface {
|
|
250
321
|
tool(contribution: ToolContribution): Disposable;
|
|
251
322
|
panel(contribution: PanelContribution): Disposable;
|
|
@@ -262,6 +333,12 @@ export interface ContributionSurface {
|
|
|
262
333
|
schemaPanel(contribution: SchemaPanelContribution): Disposable;
|
|
263
334
|
command(contribution: CommandContribution): Disposable;
|
|
264
335
|
keybinding(contribution: KeybindingContribution): Disposable;
|
|
336
|
+
/**
|
|
337
|
+
* Register a MENU ENTRY. See {@link MenuContribution} for the two
|
|
338
|
+
* scopes and why both are needed. The path's first segment may name an
|
|
339
|
+
* existing host menu (merging into it) or a new one.
|
|
340
|
+
*/
|
|
341
|
+
menu(contribution: MenuContribution): Disposable;
|
|
265
342
|
overlay(contribution: OverlayContribution): Disposable;
|
|
266
343
|
/**
|
|
267
344
|
* Register an EDIT CONTEXT (W3.2, closes B-02): a double-click (or
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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, ImagesSurface, ImageResourceClaimOptions, TileBytes, WorkersSurface, BundleWorker, SpawnWorkerOptions, SecretsSurface, SecretMaterial, DocumentSurface, 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, 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, WorkersSurface, BundleWorker, SpawnWorkerOptions, SecretsSurface, SecretMaterial, DocumentSurface, 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, BindingsSurface, Diagnostic, DocumentChangeEvent, MutationOutcome, Disposable, PluginLogger, EditContextContribution, ObjectTypeContribution, EditContextCandidate, EnteredEditContext, ContentPointerEvent, 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, 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";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paged-media/plugin-api",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.33-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",
|