@shiqianjiang/ceru-plugin-core 0.3.1 → 0.3.3
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/README.md +2 -0
- package/assets/sandbox.js +19 -19
- package/dist/surface-document.d.ts +1 -1
- package/dist/surface.js +5 -0
- package/package.json +3 -3
|
@@ -4,7 +4,7 @@ import type { JsonObject } from '@shiqianjiang/ceru-plugin-sdk';
|
|
|
4
4
|
export declare function createWebSurfaceDocument(artifact: Artifact, surfaceId: string, sessionId: string): Promise<{
|
|
5
5
|
title: string;
|
|
6
6
|
presentation: {
|
|
7
|
-
kind: "drawer";
|
|
7
|
+
kind: "drawer" | "modal";
|
|
8
8
|
placement: "left" | "right" | "top" | "bottom";
|
|
9
9
|
size: number;
|
|
10
10
|
};
|
package/dist/surface.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { assertNativeView } from '@shiqianjiang/ceru-plugin-sdk';
|
|
1
2
|
/** Shared by preview and production hosts; no platform or login-specific behavior. */
|
|
2
3
|
export class SurfaceSession {
|
|
3
4
|
surface;
|
|
@@ -12,6 +13,8 @@ export class SurfaceSession {
|
|
|
12
13
|
this.surface = surface;
|
|
13
14
|
this.dispatch = dispatch;
|
|
14
15
|
this.actions = new Set(manifest.contributes?.commands?.map((command) => command.action));
|
|
16
|
+
if (surface.kind === 'native' && !this.actions.has(surface.entry))
|
|
17
|
+
throw new Error('Missing native render action: ' + surface.entry);
|
|
15
18
|
for (const action of Object.values(surface.lifecycle ?? {}))
|
|
16
19
|
if (!this.actions.has(action))
|
|
17
20
|
throw new Error('Unknown surface lifecycle action: ' + action);
|
|
@@ -41,6 +44,8 @@ export class SurfaceSession {
|
|
|
41
44
|
const result = await this.dispatch(action, input, controller.signal);
|
|
42
45
|
if (this.closed)
|
|
43
46
|
throw new Error('Surface is closed');
|
|
47
|
+
if (this.surface.kind === 'native' && action === this.surface.entry)
|
|
48
|
+
assertNativeView(result, this.actions);
|
|
44
49
|
return result;
|
|
45
50
|
}
|
|
46
51
|
finally {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shiqianjiang/ceru-plugin-core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Ceru Music v2 plugin Core runtime and Host adapter boundary",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"socket.io-client": "^4.8.3",
|
|
58
58
|
"ws": "^8.21.3",
|
|
59
59
|
"axios": "^1.13.2",
|
|
60
|
-
"@shiqianjiang/ceru-plugin-issuer": "0.3.
|
|
61
|
-
"@shiqianjiang/ceru-plugin-sdk": "0.3.
|
|
60
|
+
"@shiqianjiang/ceru-plugin-issuer": "0.3.3",
|
|
61
|
+
"@shiqianjiang/ceru-plugin-sdk": "0.3.3"
|
|
62
62
|
},
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"access": "public",
|