@paged-media/plugin-api 0.2.32-canary.0 → 0.2.34-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 +114 -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
|
|
@@ -1158,6 +1235,40 @@ export interface DiagnosticsSurface {
|
|
|
1158
1235
|
get(key: string): Diagnostic[];
|
|
1159
1236
|
onDidChange(listener: (key: string) => void): Disposable;
|
|
1160
1237
|
}
|
|
1238
|
+
/** One entry a bundle contributes to the host's journal.
|
|
1239
|
+
*
|
|
1240
|
+
* The host stamps `plugin`, `seq`, `t` and `origin` — a bundle cannot forge
|
|
1241
|
+
* attribution, the same provenance rule `contribute.panel` already applies. */
|
|
1242
|
+
export interface JournalRecord {
|
|
1243
|
+
/** Dotted, and MUST be namespaced under the manifest id — the same
|
|
1244
|
+
* chokepoint as every other contribution id, so an entry is always
|
|
1245
|
+
* attributable. e.g. `media.paged.draw.boolean.union`. */
|
|
1246
|
+
code: string;
|
|
1247
|
+
severity?: "debug" | "info" | "warn" | "error";
|
|
1248
|
+
durMs?: number;
|
|
1249
|
+
/** Bounded scalars. String values MUST match
|
|
1250
|
+
* `/^[a-z0-9][a-z0-9._:-]{0,63}$/` — a sentence, a file path, a font
|
|
1251
|
+
* family or any user text CANNOT pass, BY DESIGN. There is deliberately no
|
|
1252
|
+
* free-text field anywhere on this type: that is the field through which
|
|
1253
|
+
* PII leaks in every telemetry system ever built. A rejected value is
|
|
1254
|
+
* dropped and COUNTED, never silently truncated (a truncated path is still
|
|
1255
|
+
* a path). Keep the human sentence in `host.log`, which goes to the
|
|
1256
|
+
* console and is not part of any exported artifact. */
|
|
1257
|
+
data?: Record<string, number | boolean | string>;
|
|
1258
|
+
}
|
|
1259
|
+
/** The JOURNAL door — a local, in-memory flight recorder.
|
|
1260
|
+
*
|
|
1261
|
+
* With no host buffer wired this surface is INERT and
|
|
1262
|
+
* `supports("journal@1")` is false. That means "recording goes nowhere",
|
|
1263
|
+
* never "calling this throws": an instrumentation door that can break the
|
|
1264
|
+
* plugin it instruments is worse than no door. */
|
|
1265
|
+
export interface JournalSurface {
|
|
1266
|
+
record(entry: JournalRecord): void;
|
|
1267
|
+
/** Time a thunk (sync or async) and record one entry carrying `durMs` and
|
|
1268
|
+
* `data.ok`. The thunk's own result and exceptions pass through unchanged
|
|
1269
|
+
* — instrumenting a call must not alter what it returns or hide a throw. */
|
|
1270
|
+
time<T>(code: string, fn: () => T | Promise<T>): Promise<T>;
|
|
1271
|
+
}
|
|
1161
1272
|
export interface BindingsSurface {
|
|
1162
1273
|
/** Publish (or update) a named reactive value. Schema rows reading
|
|
1163
1274
|
* `{ bind: name }` re-render on every change. JSON only. */
|
|
@@ -1233,6 +1344,9 @@ export interface BundleHost {
|
|
|
1233
1344
|
* `supports("dataProviders@1")` is false (the honest no-registry posture). */
|
|
1234
1345
|
readonly dataProviders: DataProvidersSurface;
|
|
1235
1346
|
readonly diagnostics: DiagnosticsSurface;
|
|
1347
|
+
/** ADR 025 — the local flight recorder. Probe `supports("journal@1")`
|
|
1348
|
+
* before relying on it reaching a buffer; calling it is always safe. */
|
|
1349
|
+
readonly journal: JournalSurface;
|
|
1236
1350
|
/** Published reactive values (W3.1) — the dynamic half of schema
|
|
1237
1351
|
* panels: a bundle publishes named booleans (and JSON values) that
|
|
1238
1352
|
* schema rows reference for `visible`/`enabled`. The plugin owns the
|
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, JournalSurface, JournalRecord, 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.34-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",
|