@storybook/preact 10.1.0-alpha.8 → 10.1.0-beta.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/_browser-chunks/chunk-4BE7D4DS.js +9 -0
- package/dist/_browser-chunks/{chunk-XE6JW6JY.js → chunk-6ALRTL7G.js} +15 -33
- package/dist/entry-preview-docs.js +2 -2
- package/dist/entry-preview.js +2 -2
- package/dist/index.js +4 -10
- package/dist/preset.js +12 -16
- package/package.json +3 -3
- package/dist/_browser-chunks/chunk-JFJ5UJ7Q.js +0 -11
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
__export
|
|
3
|
-
|
|
4
|
-
} from "./chunk-JFJ5UJ7Q.js";
|
|
2
|
+
__export
|
|
3
|
+
} from "./chunk-4BE7D4DS.js";
|
|
5
4
|
|
|
6
5
|
// src/entry-preview.ts
|
|
7
6
|
var entry_preview_exports = {};
|
|
@@ -14,50 +13,33 @@ __export(entry_preview_exports, {
|
|
|
14
13
|
// src/render.tsx
|
|
15
14
|
import * as preact from "preact";
|
|
16
15
|
import { dedent } from "ts-dedent";
|
|
17
|
-
var { h: h2 } = preact
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
if (!Component) {
|
|
16
|
+
var { h: h2 } = preact, render2 = (args, context) => {
|
|
17
|
+
let { id, component: Component } = context;
|
|
18
|
+
if (!Component)
|
|
21
19
|
throw new Error(
|
|
22
20
|
`Unable to render story ${id} as the component annotation is missing from the default export`
|
|
23
21
|
);
|
|
24
|
-
}
|
|
25
22
|
return h2(Component, args);
|
|
26
|
-
},
|
|
27
|
-
var renderedStory;
|
|
23
|
+
}, renderedStory;
|
|
28
24
|
function preactRender(story, canvasElement) {
|
|
29
|
-
|
|
30
|
-
preact.render(story, canvasElement);
|
|
31
|
-
} else {
|
|
32
|
-
renderedStory = preact.render(story, canvasElement, renderedStory);
|
|
33
|
-
}
|
|
25
|
+
preact.Fragment ? preact.render(story, canvasElement) : renderedStory = preact.render(story, canvasElement, renderedStory);
|
|
34
26
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
title: `Expecting a Preact element from the story: "${name}" of "${title}".`,
|
|
41
|
-
description: dedent`
|
|
27
|
+
var StoryHarness = ({ showError, name, title, storyFn, canvasElement }) => {
|
|
28
|
+
let content = preact.h(storyFn, null);
|
|
29
|
+
return content || (showError({
|
|
30
|
+
title: `Expecting a Preact element from the story: "${name}" of "${title}".`,
|
|
31
|
+
description: dedent`
|
|
42
32
|
Did you forget to return the Preact element from the story?
|
|
43
33
|
Use "() => (<MyComp/>)" or "() => { return <MyComp/>; }" when defining the story.
|
|
44
34
|
`
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
return content;
|
|
49
|
-
}, "StoryHarness");
|
|
35
|
+
}), null);
|
|
36
|
+
};
|
|
50
37
|
function renderToCanvas({ storyFn, title, name, showMain, showError, forceRemount }, canvasElement) {
|
|
51
|
-
|
|
52
|
-
preactRender(null, canvasElement);
|
|
53
|
-
}
|
|
54
|
-
showMain();
|
|
55
|
-
preactRender(
|
|
38
|
+
forceRemount && preactRender(null, canvasElement), showMain(), preactRender(
|
|
56
39
|
preact.h(StoryHarness, { name, title, showError, storyFn, canvasElement }),
|
|
57
40
|
canvasElement
|
|
58
41
|
);
|
|
59
42
|
}
|
|
60
|
-
__name(renderToCanvas, "renderToCanvas");
|
|
61
43
|
|
|
62
44
|
// src/entry-preview.ts
|
|
63
45
|
var parameters = { renderer: "preact" };
|
package/dist/entry-preview.js
CHANGED
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
parameters,
|
|
3
3
|
render,
|
|
4
4
|
renderToCanvas
|
|
5
|
-
} from "./_browser-chunks/chunk-
|
|
6
|
-
import "./_browser-chunks/chunk-
|
|
5
|
+
} from "./_browser-chunks/chunk-6ALRTL7G.js";
|
|
6
|
+
import "./_browser-chunks/chunk-4BE7D4DS.js";
|
|
7
7
|
export {
|
|
8
8
|
parameters,
|
|
9
9
|
render,
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
entry_preview_exports
|
|
3
|
-
} from "./_browser-chunks/chunk-
|
|
4
|
-
import
|
|
5
|
-
__name
|
|
6
|
-
} from "./_browser-chunks/chunk-JFJ5UJ7Q.js";
|
|
3
|
+
} from "./_browser-chunks/chunk-6ALRTL7G.js";
|
|
4
|
+
import "./_browser-chunks/chunk-4BE7D4DS.js";
|
|
7
5
|
|
|
8
6
|
// src/globals.ts
|
|
9
7
|
import { global } from "@storybook/global";
|
|
10
8
|
var { window: globalWindow } = global;
|
|
11
|
-
|
|
12
|
-
globalWindow.STORYBOOK_ENV = "preact";
|
|
13
|
-
}
|
|
9
|
+
globalWindow && (globalWindow.STORYBOOK_ENV = "preact");
|
|
14
10
|
|
|
15
11
|
// src/portable-stories.ts
|
|
16
12
|
import {
|
|
@@ -18,12 +14,10 @@ import {
|
|
|
18
14
|
setDefaultProjectAnnotations
|
|
19
15
|
} from "storybook/preview-api";
|
|
20
16
|
function setProjectAnnotations(projectAnnotations) {
|
|
21
|
-
setDefaultProjectAnnotations(entry_preview_exports)
|
|
22
|
-
return originalSetProjectAnnotations(
|
|
17
|
+
return setDefaultProjectAnnotations(entry_preview_exports), originalSetProjectAnnotations(
|
|
23
18
|
projectAnnotations
|
|
24
19
|
);
|
|
25
20
|
}
|
|
26
|
-
__name(setProjectAnnotations, "setProjectAnnotations");
|
|
27
21
|
export {
|
|
28
22
|
setProjectAnnotations
|
|
29
23
|
};
|
package/dist/preset.js
CHANGED
|
@@ -1,37 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_7r8ft89r41j from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_7r8ft89r41j from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_7r8ft89r41j from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_7r8ft89r41j.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_7r8ft89r41j.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_7r8ft89r41j.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
|
-
var __defProp = Object.defineProperty;
|
|
13
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
14
12
|
|
|
15
13
|
// src/preset.ts
|
|
16
14
|
import { fileURLToPath } from "node:url";
|
|
17
|
-
var previewAnnotations =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return result.concat(input).concat([fileURLToPath(import.meta.resolve("@storybook/preact/entry-preview"))]).concat(
|
|
15
|
+
var previewAnnotations = async (input = [], options) => {
|
|
16
|
+
let docsEnabled = Object.keys(await options.presets.apply("docs", {}, options)).length > 0;
|
|
17
|
+
return [].concat(input).concat([fileURLToPath(import.meta.resolve("@storybook/preact/entry-preview"))]).concat(
|
|
21
18
|
docsEnabled ? [fileURLToPath(import.meta.resolve("@storybook/preact/entry-preview-docs"))] : []
|
|
22
19
|
);
|
|
23
|
-
},
|
|
24
|
-
var resolvedReact = /* @__PURE__ */ __name(async (existing) => {
|
|
20
|
+
}, resolvedReact = async (existing) => {
|
|
25
21
|
try {
|
|
26
22
|
return {
|
|
27
23
|
...existing,
|
|
28
24
|
react: "preact/compat",
|
|
29
25
|
reactDom: "preact/compat"
|
|
30
26
|
};
|
|
31
|
-
} catch
|
|
27
|
+
} catch {
|
|
32
28
|
return existing;
|
|
33
29
|
}
|
|
34
|
-
}
|
|
30
|
+
};
|
|
35
31
|
export {
|
|
36
32
|
previewAnnotations,
|
|
37
33
|
resolvedReact
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/preact",
|
|
3
|
-
"version": "10.1.0-
|
|
3
|
+
"version": "10.1.0-beta.0",
|
|
4
4
|
"description": "Storybook Preact renderer: Develop, document, and test UI components in isolation",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -56,10 +56,10 @@
|
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"preact": "^8.0.0||^10.0.0",
|
|
59
|
-
"storybook": "^10.1.0-
|
|
59
|
+
"storybook": "^10.1.0-beta.0"
|
|
60
60
|
},
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"access": "public"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "a8e7fd8a655c69780bc20b9749d2699e45beae1l"
|
|
65
65
|
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
var __export = (target, all) => {
|
|
4
|
-
for (var name in all)
|
|
5
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export {
|
|
9
|
-
__name,
|
|
10
|
-
__export
|
|
11
|
-
};
|