@paged-media/plugin-sdk 0.2.8-canary.0 → 0.2.10-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/index.d.ts +25 -1
- package/dist/index.js +44 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -129,7 +129,31 @@ interface DataProviderBackend {
|
|
|
129
129
|
* providers and consumers (different plugin hosts) meet through it. Reference
|
|
130
130
|
* implementation — an RPC/isolate host swaps a proxy with the same contract. */
|
|
131
131
|
declare function createDataProviderRegistry(): DataProviderBackend;
|
|
132
|
+
/**
|
|
133
|
+
* Trust posture the HOST asserts for a bundle at the load path
|
|
134
|
+
* (`plugin-trust-line.md`). Same-realm execution — full `BundleHost`
|
|
135
|
+
* + the raw `PagedEditor` via `host.editor` — is FIRST-PARTY-ONLY
|
|
136
|
+
* during incubation. There is no sound *cryptographic* identity signal
|
|
137
|
+
* yet (package signing is the last unchecked gate box), and the
|
|
138
|
+
* manifest `id` namespace (`media.paged.*`) is SELF-ASSERTED — a
|
|
139
|
+
* foreign bundle could claim it — so the trust signal cannot come from
|
|
140
|
+
* the bundle. It comes from the HOST vouching, here: a value the
|
|
141
|
+
* caller supplies, defaulting to `'first-party'`. The loader refuses
|
|
142
|
+
* anything else (`load.ts`), turning the drift-by-default the trust
|
|
143
|
+
* line warns about (a quiet dynamic-import of foreign code on the
|
|
144
|
+
* same-realm path) into a deliberate, greppable, reviewable act that
|
|
145
|
+
* still does not load until the isolate/RPC host gate is built.
|
|
146
|
+
*/
|
|
147
|
+
type BundleTrust = "first-party";
|
|
132
148
|
interface CreateBundleHostOptions {
|
|
149
|
+
/**
|
|
150
|
+
* The host's trust assertion for this bundle (`plugin-trust-line.md`).
|
|
151
|
+
* Defaults to `'first-party'` — the only value the loader accepts
|
|
152
|
+
* today. Passing any other value (e.g. via a future dynamic-import
|
|
153
|
+
* experiment) is refused loudly at the load path, gated on the
|
|
154
|
+
* isolate/RPC host + capability enforcement + signing.
|
|
155
|
+
*/
|
|
156
|
+
trust?: BundleTrust;
|
|
133
157
|
storage?: StorageBacking;
|
|
134
158
|
/** Host-provided network consent (paged.data D-03; base-idea §11): the editor
|
|
135
159
|
* injects the consent prompt + the data-source-manifest UI. When absent,
|
|
@@ -553,4 +577,4 @@ declare function contributeEditContext(host: BundleHost, contribution: EditConte
|
|
|
553
577
|
* descent. Capability-gated on `contributes.objectTypes`. */
|
|
554
578
|
declare function contributeObjectType(host: BundleHost, contribution: ObjectTypeContribution): Disposable;
|
|
555
579
|
|
|
556
|
-
export { API_VERSION, ASSET_BUDGETS, BLOB_BUDGETS, type BlobStore, type BundleAssetProvider, type BundleAssetSource, type BundleHostHandle, CANVAS_WASM_PKG, CLICK_DRAG_THRESHOLD_PX, type ConsentBackend, type CreateBundleHostOptions, type DataProviderBackend, type DiagnosticsSink, DisposableStore, FALLBACK_WIDGETS, HOST_FEATURES, type HarnessOptions, type HeadlessCanvasWorker, type HeadlessHost, type HeadlessHostHandle, type LoadBundleWasmOptions, type LoadHeadlessEngineOptions, type LoadedBundle, type LoadedBundleWasm, type LoadedEngine, type PageDrag, PluginApiNotImplemented, PluginCapabilityError, type RecordableAssetSource, type RecordedContribution, type RecordedFontFaceRequest, type SeededFace, type StorageBacking, WASM_BUDGETS, beginPageDrag, commitAndSelect, contributeEditContext, contributeObjectType, contributePanel, contributeSchemaPanel, contributeTool, createBundleHost, createDataProviderRegistry, createHeadlessHost, createRecordableAssetSource, defineBundle, endLocalFor, loadBundle, loadBundleWasm, loadHeadlessEngine, makeSchemaPanelComponent, protocolFromVersion, pxToPt, readVendoredWireVersion, resolveCanvasWasm, resolveGate, satisfiesApiVersion, toDisposable };
|
|
580
|
+
export { API_VERSION, ASSET_BUDGETS, BLOB_BUDGETS, type BlobStore, type BundleAssetProvider, type BundleAssetSource, type BundleHostHandle, type BundleTrust, CANVAS_WASM_PKG, CLICK_DRAG_THRESHOLD_PX, type ConsentBackend, type CreateBundleHostOptions, type DataProviderBackend, type DiagnosticsSink, DisposableStore, FALLBACK_WIDGETS, HOST_FEATURES, type HarnessOptions, type HeadlessCanvasWorker, type HeadlessHost, type HeadlessHostHandle, type LoadBundleWasmOptions, type LoadHeadlessEngineOptions, type LoadedBundle, type LoadedBundleWasm, type LoadedEngine, type PageDrag, PluginApiNotImplemented, PluginCapabilityError, type RecordableAssetSource, type RecordedContribution, type RecordedFontFaceRequest, type SeededFace, type StorageBacking, WASM_BUDGETS, beginPageDrag, commitAndSelect, contributeEditContext, contributeObjectType, contributePanel, contributeSchemaPanel, contributeTool, createBundleHost, createDataProviderRegistry, createHeadlessHost, createRecordableAssetSource, defineBundle, endLocalFor, loadBundle, loadBundleWasm, loadHeadlessEngine, makeSchemaPanelComponent, protocolFromVersion, pxToPt, readVendoredWireVersion, resolveCanvasWasm, resolveGate, satisfiesApiVersion, toDisposable };
|
package/dist/index.js
CHANGED
|
@@ -136,7 +136,12 @@ var HOST_FEATURES = [
|
|
|
136
136
|
"viewport@1",
|
|
137
137
|
"overlay.toolPreview@1",
|
|
138
138
|
"storage@1",
|
|
139
|
-
"diagnostics@1"
|
|
139
|
+
"diagnostics@1",
|
|
140
|
+
// C-5 / I-04 (core v42): the placed-image bytes read is engine-served
|
|
141
|
+
// through the wire (no injected source), so it is unconditionally
|
|
142
|
+
// implemented at the pinned canvas-wasm — unlike assets.fonts@1, which
|
|
143
|
+
// stays conditional on the editor's injected byte source.
|
|
144
|
+
"assets.images@1"
|
|
140
145
|
];
|
|
141
146
|
var PluginApiNotImplemented = class extends Error {
|
|
142
147
|
constructor(member, pointer) {
|
|
@@ -919,6 +924,38 @@ function createBundleHost(getEditor, manifest, options) {
|
|
|
919
924
|
return null;
|
|
920
925
|
}
|
|
921
926
|
return face;
|
|
927
|
+
},
|
|
928
|
+
// C-5 / I-04 (core v42): a placed DOCUMENT image's ORIGINAL bytes,
|
|
929
|
+
// straight from the engine's resolver/parse cache through the
|
|
930
|
+
// `requestPlacedAssetBytes` wire query — no injected source needed
|
|
931
|
+
// (the engine IS the byte holder). `found:false` and any channel
|
|
932
|
+
// failure both answer `null`, the door's honest no-bytes mode. No
|
|
933
|
+
// size clamp: document-scale originals (PSDs) are the use case and
|
|
934
|
+
// the engine only serves what the document already holds.
|
|
935
|
+
async getPlacedImage(elementId) {
|
|
936
|
+
requireDeclared(
|
|
937
|
+
hasAsset("images"),
|
|
938
|
+
"assets.getPlacedImage",
|
|
939
|
+
'capabilities.assets must include "images"'
|
|
940
|
+
);
|
|
941
|
+
try {
|
|
942
|
+
const reply = await getEditor().client.send({
|
|
943
|
+
kind: "requestPlacedAssetBytes",
|
|
944
|
+
payload: { elementId }
|
|
945
|
+
});
|
|
946
|
+
if (reply.kind !== "placedAssetBytes" || !reply.payload.found) {
|
|
947
|
+
return null;
|
|
948
|
+
}
|
|
949
|
+
const p = reply.payload;
|
|
950
|
+
return {
|
|
951
|
+
bytes: Uint8Array.from(p.encoded),
|
|
952
|
+
uri: p.uri,
|
|
953
|
+
width: p.width,
|
|
954
|
+
height: p.height
|
|
955
|
+
};
|
|
956
|
+
} catch {
|
|
957
|
+
return null;
|
|
958
|
+
}
|
|
922
959
|
}
|
|
923
960
|
};
|
|
924
961
|
const blobBackend = options?.blobStore;
|
|
@@ -1568,6 +1605,12 @@ function createRecordableAssetSource(seeds = []) {
|
|
|
1568
1605
|
var ID_PATTERN = /^[a-z][a-z0-9]*(\.[a-z][a-z0-9-]*)+$/;
|
|
1569
1606
|
function loadBundle(getEditor, bundle, options) {
|
|
1570
1607
|
const { manifest } = bundle;
|
|
1608
|
+
const trust = options?.trust ?? "first-party";
|
|
1609
|
+
if (trust !== "first-party") {
|
|
1610
|
+
throw new Error(
|
|
1611
|
+
`loadBundle: ${manifest.id} requested trust="${String(trust)}", but same-realm bundle execution is first-party-only during incubation. Loading non-first-party bundles is gated on the isolate/RPC host, enforced capabilities, and package signing (see plugin-trust-line.md "Gate checklist").`
|
|
1612
|
+
);
|
|
1613
|
+
}
|
|
1571
1614
|
if (!ID_PATTERN.test(manifest.id)) {
|
|
1572
1615
|
throw new Error(
|
|
1573
1616
|
`loadBundle: manifest id "${manifest.id}" is not reverse-DNS (expected e.g. "media.paged.draw")`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paged-media/plugin-sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.10-canary.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@paged-media/plugin-api": "0.2.
|
|
14
|
+
"@paged-media/plugin-api": "0.2.10-canary.0"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
17
|
"react": "^18.3.0"
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@paged-media/canvas-wasm": "0.
|
|
25
|
+
"@paged-media/canvas-wasm": "0.42.0",
|
|
26
26
|
"@types/node": "20.19.39",
|
|
27
27
|
"@types/react": "^18.3.12",
|
|
28
28
|
"react": "^18.3.0",
|