@paged-media/plugin-sdk 0.2.26-canary.0 → 0.2.27-canary.1

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 CHANGED
@@ -710,4 +710,4 @@ declare function contributeEditContext(host: BundleHost, contribution: EditConte
710
710
  * descent. Capability-gated on `contributes.objectTypes`. */
711
711
  declare function contributeObjectType(host: BundleHost, contribution: ObjectTypeContribution): Disposable;
712
712
 
713
- 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 ClipboardBackend, 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 SecretStoreBackend, type SeededFace, type SpawnedWorker, type StorageBacking, WASM_BUDGETS, WORKER_BUDGETS, type WorkerBackend, beginPageDrag, commitAndSelect, contributeEditContext, contributeObjectType, contributePanel, contributeSchemaPanel, contributeTool, createBundleHost, createDataProviderRegistry, createHeadlessHost, createRecordableAssetSource, defineBundle, endLocalFor, loadBundle, loadBundleWasm, loadHeadlessEngine, makeSchemaPanelComponent, protocolFromVersion, pxToPt, readVendoredWireVersion, resolveCanvasWasm, resolveGate, satisfiesApiVersion, toDisposable };
713
+ 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 ClipboardBackend, 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 NativeDocumentBackend, type PageDrag, PluginApiNotImplemented, PluginCapabilityError, type RecordableAssetSource, type RecordedContribution, type RecordedFontFaceRequest, type SecretStoreBackend, type SeededFace, type SpawnedWorker, type StorageBacking, WASM_BUDGETS, WORKER_BUDGETS, type WorkerBackend, 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
@@ -43,8 +43,17 @@ function toDisposable(fn) {
43
43
  }
44
44
 
45
45
  // src/widgets-fallback.tsx
46
- import { createElement } from "react";
46
+ var createElement = null;
47
+ try {
48
+ ({ createElement } = await import("react"));
49
+ } catch {
50
+ }
47
51
  function TextareaCodeEditor(props) {
52
+ if (!createElement) {
53
+ throw new Error(
54
+ "plugin-sdk: host.widgets.CodeEditor fell back to the built-in textarea, but React is not installed. Install react, or inject a widget catalog via createBundleHost({ widgets })."
55
+ );
56
+ }
48
57
  return createElement("textarea", {
49
58
  value: props.value,
50
59
  readOnly: props.readOnly,
@@ -71,7 +80,19 @@ var FALLBACK_WIDGETS = {
71
80
  };
72
81
 
73
82
  // src/schema-panel.tsx
74
- import { createElement as createElement2 } from "react";
83
+ var createElement2 = null;
84
+ try {
85
+ ({ createElement: createElement2 } = await import("react"));
86
+ } catch {
87
+ }
88
+ function h() {
89
+ if (!createElement2) {
90
+ throw new Error(
91
+ "plugin-sdk: rendering a schema panel needs React, which is not installed."
92
+ );
93
+ }
94
+ return createElement2;
95
+ }
75
96
  function resolveGate(gate, lookup) {
76
97
  if (gate === void 0) return true;
77
98
  if (typeof gate === "boolean") return gate;
@@ -82,7 +103,7 @@ function makeSchemaPanelComponent(contribution, bindings, renderer) {
82
103
  const { schema } = contribution;
83
104
  if (renderer) {
84
105
  let SchemaPanel2 = function(_props) {
85
- return createElement2(Renderer, { schema, bindings });
106
+ return h()(Renderer, { schema, bindings });
86
107
  };
87
108
  var SchemaPanel = SchemaPanel2;
88
109
  const Renderer = renderer;
@@ -90,7 +111,7 @@ function makeSchemaPanelComponent(contribution, bindings, renderer) {
90
111
  return SchemaPanel2;
91
112
  }
92
113
  function SchemaPanelSeam(_props) {
93
- return createElement2(
114
+ return h()(
94
115
  "div",
95
116
  {
96
117
  "data-schema-panel-seam": schema.id,
@@ -701,6 +722,12 @@ function createBundleHost(getEditor, manifest, options) {
701
722
  });
702
723
  return reply.kind === "frameChainResult" ? reply.payload.links : [];
703
724
  },
725
+ async storyContent(_storyId) {
726
+ throw new PluginApiNotImplemented(
727
+ "document.storyContent",
728
+ "awaiting @paged-media/canvas-wasm v54 publish + sync-wire; core op RequestStoryContent already exists"
729
+ );
730
+ },
704
731
  onDidChange(listener) {
705
732
  requireDocRead("document.onDidChange");
706
733
  const off = getEditor().client.subscribe((msg) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paged-media/plugin-sdk",
3
- "version": "0.2.26-canary.0",
3
+ "version": "0.2.27-canary.1",
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.26-canary.0"
14
+ "@paged-media/plugin-api": "0.2.27-canary.1"
15
15
  },
16
16
  "peerDependencies": {
17
17
  "react": "^18.3.0"