@cfp-studio/plugin-solid 14.0.6 → 14.1.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/package.json +2 -2
- package/preview/index.tsx +13 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cfp-studio/plugin-solid",
|
|
3
|
-
"version": "14.0
|
|
3
|
+
"version": "14.1.0",
|
|
4
4
|
"description": "SolidJS plugin for Preview.js enabling instant preview of SolidJS components and stories",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"solid-js": "1.9.17",
|
|
29
29
|
"vite": "6.4.5",
|
|
30
30
|
"vitest": "5.0.5",
|
|
31
|
-
"@cfp-studio/iframe": "18.4.14",
|
|
32
31
|
"@cfp-studio/core": "1.0.21",
|
|
32
|
+
"@cfp-studio/iframe": "18.4.14",
|
|
33
33
|
"@cfp-studio/testing": "14.0.1"
|
|
34
34
|
},
|
|
35
35
|
"cfp": {
|
package/preview/index.tsx
CHANGED
|
@@ -64,10 +64,21 @@ export const loadRenderer: RendererLoader = async ({
|
|
|
64
64
|
} catch (error) {
|
|
65
65
|
renderErrorPanel(container, { error, previewableName });
|
|
66
66
|
}
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
/*
|
|
68
|
+
* `play` 与 `rendered` 解耦 + 由页内策略决定要不要跑(0021 §5.5 / D11·D12)。
|
|
69
|
+
*/
|
|
70
|
+
const api = window.__PREVIEWJS_IFRAME__;
|
|
71
|
+
if (Previewable.play && api.shouldRunPlay?.() === true) {
|
|
72
|
+
void (Previewable.play as (context: object) => Promise<void>)(
|
|
73
|
+
api.playContext?.(container) ?? { canvasElement: container },
|
|
74
|
+
).catch((error: unknown) => api.reportPlayError?.(error));
|
|
69
75
|
}
|
|
70
76
|
},
|
|
71
77
|
jsxFactory: h,
|
|
78
|
+
// `window.unmount()`(Playwright gallery 契约):Solid.render 返回的 dispose 句柄
|
|
79
|
+
unmount: () => {
|
|
80
|
+
detachFn?.();
|
|
81
|
+
detachFn = undefined;
|
|
82
|
+
},
|
|
72
83
|
};
|
|
73
84
|
};
|