@paged-media/plugin-api 0.2.56-canary.0 → 0.2.57-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/assets.d.ts CHANGED
@@ -57,7 +57,8 @@ export interface PlacedImageAsset {
57
57
  * so nothing was sent: the door fills a gap, it never replaces a face;
58
58
  * - `refused` — nothing was registered; `reason` says why (the
59
59
  * `document.write` gate, the per-face budget, bytes the canvas cannot
60
- * draw, the engine's own refusal or a dead channel).
60
+ * draw, no open document, the document closing before the face was
61
+ * registered, the engine's own refusal or a dead channel).
61
62
  */
62
63
  export type DocumentFontOutcome = {
63
64
  status: "registered";
@@ -130,11 +131,17 @@ export interface AssetSurface {
130
131
  * `style` is omitted), nothing is sent and the outcome is `held`. So a
131
132
  * bundle cannot change how text that already resolves is drawn.
132
133
  *
133
- * The face is not undoable and is not written into a saved file (a
134
- * document names its fonts; it carries no face bytes): the engine keeps
135
- * it for the session, for every document opened after too. A bundle
136
- * whose text needs it in a later session provides it again (at
137
- * `document.onDidOpen`, or when it writes the text).
134
+ * The face belongs to the document open when the call is made (ADR
135
+ * 330, `supports("assets.documentFont@2")`): the host drops it when that
136
+ * document closes — when the next document opens, File ▸ New and a
137
+ * reopen of the same file included — and no other document lays out
138
+ * with it. With no document open the call is refused. It is not undoable
139
+ * and is not written into a saved file (a document names its fonts; it
140
+ * carries no face bytes), so a bundle whose text needs it gives it again
141
+ * each time the document opens (`document.onDidOpen`, from what the
142
+ * document keeps) — register AFTER the open, never before it. A host
143
+ * with only `@1` keeps the face for the engine session instead, for
144
+ * every document opened after; giving it again there answers `held`.
138
145
  *
139
146
  * Gates: `capabilities.assets` ∋ `"fonts"` (throws in 'enforce', as on
140
147
  * every asset door) and `capabilities.document.write` (it changes how
@@ -142,7 +149,8 @@ export interface AssetSurface {
142
149
  * over `ASSET_BUDGETS.maxFontFaceBytes`, bytes that are not a TrueType
143
150
  * or OpenType face (WOFF and WOFF2 included — the canvas reads neither),
144
151
  * an empty family. Never throws otherwise. Calls for one face at the
145
- * same time register it once. Probe `supports("assets.documentFont@1")`.
152
+ * same time register it once. Probe `supports("assets.documentFont@1")`
153
+ * for the door and `@2` for the per-document lifetime.
146
154
  */
147
155
  registerDocumentFont(bytes: Uint8Array, family: string, style?: string): Promise<DocumentFontOutcome>;
148
156
  }
package/dist/editor.d.ts CHANGED
@@ -439,6 +439,18 @@ export interface PagedClient {
439
439
  setElementSelection(ids: ElementId[], mode: SelectionMode): Promise<ElementId[]>;
440
440
  send(message: MainToWorkerKind): Promise<WorkerToMain>;
441
441
  subscribe(listener: (msg: WorkerToMain) => void): () => void;
442
+ /**
443
+ * ADR 330 — put a face in the engine's DOCUMENT font registry for the
444
+ * document open now: the client drops it before the next document loads
445
+ * (whatever loads it), so no other document lays out with it. Resolves
446
+ * with the engine's reply (`fontRegistered`, with the pages laid out
447
+ * again). Rejects when no document is open, or when the document closed
448
+ * before the face could be registered. Optional: without it
449
+ * `host.assets.registerDocumentFont` sends `registerFont` itself, the
450
+ * face lives for the engine session, and
451
+ * `supports("assets.documentFont@2")` is false.
452
+ */
453
+ registerDocumentFont?(family: string, bytes: Uint8Array, style: string | null): Promise<WorkerToMain>;
442
454
  }
443
455
  export interface PagedEditor {
444
456
  client: PagedClient;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paged-media/plugin-api",
3
- "version": "0.2.56-canary.0",
3
+ "version": "0.2.57-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",