@paged-media/plugin-sdk 0.2.27-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.js +31 -4
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -43,8 +43,17 @@ function toDisposable(fn) {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
// src/widgets-fallback.tsx
|
|
46
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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.27-canary.
|
|
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.27-canary.
|
|
14
|
+
"@paged-media/plugin-api": "0.2.27-canary.1"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
17
|
"react": "^18.3.0"
|