@storybook/preact 10.1.0-alpha.1 → 10.1.0-alpha.11

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.
@@ -0,0 +1,9 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: !0 });
5
+ };
6
+
7
+ export {
8
+ __export
9
+ };
@@ -1,7 +1,6 @@
1
1
  import {
2
- __export,
3
- __name
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
- var render2 = /* @__PURE__ */ __name((args, context) => {
19
- const { id, component: Component } = context;
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
- return h2(Component, { ...args });
26
- }, "render");
27
- var renderedStory;
22
+ return h2(Component, args);
23
+ }, renderedStory;
28
24
  function preactRender(story, canvasElement) {
29
- if (preact.Fragment) {
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
- __name(preactRender, "preactRender");
36
- var StoryHarness = /* @__PURE__ */ __name(({ showError, name, title, storyFn, canvasElement }) => {
37
- const content = preact.h(storyFn, null);
38
- if (!content) {
39
- showError({
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
- return null;
47
- }
48
- return content;
49
- }, "StoryHarness");
35
+ }), null);
36
+ };
50
37
  function renderToCanvas({ storyFn, title, name, showMain, showError, forceRemount }, canvasElement) {
51
- if (forceRemount) {
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" };
@@ -1,9 +1,9 @@
1
- import "./_browser-chunks/chunk-JFJ5UJ7Q.js";
1
+ import "./_browser-chunks/chunk-4BE7D4DS.js";
2
2
 
3
3
  // src/entry-preview-docs.ts
4
4
  var parameters = {
5
5
  docs: {
6
- story: { inline: true }
6
+ story: { inline: !0 }
7
7
  }
8
8
  };
9
9
  export {
@@ -2,8 +2,8 @@ import {
2
2
  parameters,
3
3
  render,
4
4
  renderToCanvas
5
- } from "./_browser-chunks/chunk-T4MBQD64.js";
6
- import "./_browser-chunks/chunk-JFJ5UJ7Q.js";
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-T4MBQD64.js";
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
- if (globalWindow) {
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 CJS_COMPAT_NODE_URL_7enbldzj8q9 from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_7enbldzj8q9 from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_7enbldzj8q9 from "node:module";
1
+ import CJS_COMPAT_NODE_URL_hnuchf1ayqh from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_hnuchf1ayqh from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_hnuchf1ayqh from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_7enbldzj8q9.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_7enbldzj8q9.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_7enbldzj8q9.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_hnuchf1ayqh.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_hnuchf1ayqh.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_hnuchf1ayqh.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 = /* @__PURE__ */ __name(async (input = [], options) => {
18
- const docsEnabled = Object.keys(await options.presets.apply("docs", {}, options)).length > 0;
19
- const result = [];
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
- }, "previewAnnotations");
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 (e) {
27
+ } catch {
32
28
  return existing;
33
29
  }
34
- }, "resolvedReact");
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-alpha.1",
3
+ "version": "10.1.0-alpha.11",
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-alpha.1"
59
+ "storybook": "^10.1.0-alpha.11"
60
60
  },
61
61
  "publishConfig": {
62
62
  "access": "public"
63
63
  },
64
- "gitHead": "a8e7fd8a655c69780bc20b9749d2699e45beae16"
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
- };