@storybook/preact 7.0.0-alpha.37 → 7.0.0-alpha.39

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ import*as e from"preact";import{dedent as i}from"ts-dedent";var{h:l}=e,u=(r,t)=>{let{id:o,component:n}=t;if(!n)throw new Error(`Unable to render story ${o} as the component annotation is missing from the default export`);return l(n,{...r})},c;function p(r,t){e.Fragment?e.render(r,t):c=e.render(r,t,c)}var y=({showError:r,name:t,title:o,storyFn:n,domElement:s})=>{let a=e.h(n,null);return a||(r({title:`Expecting a Preact element from the story: "${t}" of "${o}".`,description:i`
2
+ Did you forget to return the Preact element from the story?
3
+ Use "() => (<MyComp/>)" or "() => { return <MyComp/>; }" when defining the story.
4
+ `}),null)};function h({storyFn:r,title:t,name:o,showMain:n,showError:s,forceRemount:a},m){a&&p(null,m),n(),p(e.h(y,{name:o,title:t,showError:s,storyFn:r,domElement:m}),m)}export{u as a,h as b};
package/dist/config.d.ts CHANGED
@@ -1,11 +1,13 @@
1
1
  import { RenderContext } from '@storybook/store';
2
- import { P as PreactFramework } from './types-ed8e97dc.js';
2
+ import { ArgsStoryFn } from '@storybook/csf';
3
+ import { P as PreactFramework } from './types-71aa9145.js';
3
4
  import 'preact';
4
5
 
6
+ declare const render: ArgsStoryFn<PreactFramework>;
5
7
  declare function renderToDOM({ storyFn, title, name, showMain, showError, forceRemount }: RenderContext<PreactFramework>, domElement: Element): void;
6
8
 
7
9
  declare const parameters: {
8
10
  framework: "preact";
9
11
  };
10
12
 
11
- export { parameters, renderToDOM };
13
+ export { parameters, render, renderToDOM };
package/dist/config.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var d=Object.create;var c=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var w=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var x=(e,r)=>{for(var t in r)c(e,t,{get:r[t],enumerable:!0})},s=(e,r,t,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of h(r))!F.call(e,n)&&n!==t&&c(e,n,{get:()=>r[n],enumerable:!(a=u(r,n))||a.enumerable});return e};var E=(e,r,t)=>(t=e!=null?d(w(e)):{},s(r||!e||!e.__esModule?c(t,"default",{value:e,enumerable:!0}):t,e)),P=e=>s(c({},"__esModule",{value:!0}),e);var C={};x(C,{parameters:()=>k,renderToDOM:()=>f});module.exports=P(C);var o=E(require("preact")),y=require("ts-dedent"),i;function l(e,r){o.Fragment?o.render(e,r):i=o.render(e,r,i)}var g=({showError:e,name:r,title:t,storyFn:a,domElement:n})=>{let p=o.h(a,null);return p||(e({title:`Expecting a Preact element from the story: "${r}" of "${t}".`,description:y.dedent`
1
+ "use strict";var u=Object.create;var m=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var F=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty;var x=(e,r)=>{for(var t in r)m(e,t,{get:r[t],enumerable:!0})},c=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of w(r))!g.call(e,a)&&a!==t&&m(e,a,{get:()=>r[a],enumerable:!(n=h(r,a))||n.enumerable});return e};var E=(e,r,t)=>(t=e!=null?u(F(e)):{},c(r||!e||!e.__esModule?m(t,"default",{value:e,enumerable:!0}):t,e)),P=e=>c(m({},"__esModule",{value:!0}),e);var S={};x(S,{parameters:()=>R,render:()=>d,renderToDOM:()=>f});module.exports=P(S);var o=E(require("preact")),y=require("ts-dedent"),{h:k}=o,d=(e,r)=>{let{id:t,component:n}=r;if(!n)throw new Error(`Unable to render story ${t} as the component annotation is missing from the default export`);return k(n,{...e})},i;function l(e,r){o.Fragment?o.render(e,r):i=o.render(e,r,i)}var C=({showError:e,name:r,title:t,storyFn:n,domElement:a})=>{let s=o.h(n,null);return s||(e({title:`Expecting a Preact element from the story: "${r}" of "${t}".`,description:y.dedent`
2
2
  Did you forget to return the Preact element from the story?
3
3
  Use "() => (<MyComp/>)" or "() => { return <MyComp/>; }" when defining the story.
4
- `}),null)};function f({storyFn:e,title:r,name:t,showMain:a,showError:n,forceRemount:p},m){p&&l(null,m),a(),l(o.h(g,{name:t,title:r,showError:n,storyFn:e,domElement:m}),m)}var k={framework:"preact"};0&&(module.exports={parameters,renderToDOM});
4
+ `}),null)};function f({storyFn:e,title:r,name:t,showMain:n,showError:a,forceRemount:s},p){s&&l(null,p),n(),l(o.h(C,{name:t,title:r,showError:a,storyFn:e,domElement:p}),p)}var R={framework:"preact"};0&&(module.exports={parameters,render,renderToDOM});
package/dist/config.mjs CHANGED
@@ -1 +1 @@
1
- import{a as r}from"./chunk-5JPFR37Q.mjs";var o={framework:"preact"};export{o as parameters,r as renderToDOM};
1
+ import{a as r,b as e}from"./chunk-BANKJHG6.mjs";var t={framework:"preact"};export{t as parameters,r as render,e as renderToDOM};
package/dist/index.d.ts CHANGED
@@ -1,26 +1,18 @@
1
1
  import { ClientStoryApi, Loadable } from '@storybook/addons';
2
- import { P as PreactFramework, I as IStorybookSection } from './types-ed8e97dc.js';
2
+ import { P as PreactFramework } from './types-71aa9145.js';
3
3
  import { Args, ComponentAnnotations, AnnotatedStoryFn, StoryAnnotations } from '@storybook/csf';
4
4
  export { ArgTypes, Args, Parameters, StoryContext } from '@storybook/csf';
5
5
  import 'preact';
6
6
 
7
7
  interface ClientApi extends ClientStoryApi<PreactFramework['storyResult']> {
8
- setAddon(addon: any): void;
9
8
  configure(loader: Loadable, module: NodeModule): void;
10
- getStorybook(): IStorybookSection[];
11
- clearDecorators(): void;
12
9
  forceReRender(): void;
13
10
  raw: () => any;
14
11
  load: (...args: any[]) => void;
15
12
  }
16
13
  declare const storiesOf: ClientApi['storiesOf'];
17
14
  declare const configure: ClientApi['configure'];
18
- declare const addDecorator: ClientApi['addDecorator'];
19
- declare const addParameters: ClientApi['addParameters'];
20
- declare const clearDecorators: ClientApi['clearDecorators'];
21
- declare const setAddon: ClientApi['setAddon'];
22
15
  declare const forceReRender: ClientApi['forceReRender'];
23
- declare const getStorybook: ClientApi['getStorybook'];
24
16
  declare const raw: ClientApi['raw'];
25
17
 
26
18
  /**
@@ -48,4 +40,4 @@ declare type StoryObj<TArgs = Args> = StoryAnnotations<PreactFramework, TArgs>;
48
40
  */
49
41
  declare type Story<TArgs = Args> = StoryObj<TArgs>;
50
42
 
51
- export { ClientApi, Meta, Story, StoryFn, StoryObj, addDecorator, addParameters, clearDecorators, configure, forceReRender, getStorybook, raw, setAddon, storiesOf };
43
+ export { ClientApi, Meta, Story, StoryFn, StoryObj, configure, forceReRender, raw, storiesOf };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var w=Object.create;var p=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var P=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var D=(e,r)=>{for(var t in r)p(e,t,{get:r[t],enumerable:!0})},s=(e,r,t,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of S(r))!b.call(e,n)&&n!==t&&p(e,n,{get:()=>r[n],enumerable:!(i=k(r,n))||i.enumerable});return e};var l=(e,r,t)=>(t=e!=null?w(P(e)):{},s(r||!e||!e.__esModule?p(t,"default",{value:e,enumerable:!0}):t,e)),F=e=>s(p({},"__esModule",{value:!0}),e);var W={};D(W,{addDecorator:()=>v,addParameters:()=>M,clearDecorators:()=>T,configure:()=>E,forceReRender:()=>K,getStorybook:()=>L,raw:()=>N,setAddon:()=>I,storiesOf:()=>O});module.exports=F(W);var f=l(require("global")),{window:m}=f.default;m&&(m.STORYBOOK_ENV="preact");var x=require("@storybook/core-client");var a=l(require("preact")),u=require("ts-dedent"),y;function A(e,r){a.Fragment?a.render(e,r):y=a.render(e,r,y)}var h=({showError:e,name:r,title:t,storyFn:i,domElement:n})=>{let c=a.h(i,null);return c||(e({title:`Expecting a Preact element from the story: "${r}" of "${t}".`,description:u.dedent`
1
+ "use strict";var F=Object.create;var p=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var P=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var E=(e,r)=>{for(var t in r)p(e,t,{get:r[t],enumerable:!0})},m=(e,r,t,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of A(r))!k.call(e,n)&&n!==t&&p(e,n,{get:()=>r[n],enumerable:!(i=h(r,n))||i.enumerable});return e};var l=(e,r,t)=>(t=e!=null?F(P(e)):{},m(r||!e||!e.__esModule?p(t,"default",{value:e,enumerable:!0}):t,e)),O=e=>m(p({},"__esModule",{value:!0}),e);var D={};E(D,{configure:()=>M,forceReRender:()=>T,raw:()=>v,storiesOf:()=>b});module.exports=O(D);var f=l(require("global")),{window:d}=f.default;d&&(d.STORYBOOK_ENV="preact");var g=require("@storybook/core-client");var o=l(require("preact")),w=require("ts-dedent"),{h:K}=o;var y;function u(e,r){o.Fragment?o.render(e,r):y=o.render(e,r,y)}var S=({showError:e,name:r,title:t,storyFn:i,domElement:n})=>{let a=o.h(i,null);return a||(e({title:`Expecting a Preact element from the story: "${r}" of "${t}".`,description:w.dedent`
2
2
  Did you forget to return the Preact element from the story?
3
3
  Use "() => (<MyComp/>)" or "() => { return <MyComp/>; }" when defining the story.
4
- `}),null)};function C({storyFn:e,title:r,name:t,showMain:i,showError:n,forceRemount:c},d){c&&A(null,d),i(),A(a.h(h,{name:t,title:r,showError:n,storyFn:e,domElement:d}),d)}var R="preact",o=(0,x.start)(C),O=(e,r)=>o.clientApi.storiesOf(e,r).addParameters({framework:R}),E=(...e)=>o.configure(R,...e),v=o.clientApi.addDecorator,M=o.clientApi.addParameters,T=o.clientApi.clearDecorators,I=o.clientApi.setAddon,K=o.forceReRender,L=o.clientApi.getStorybook,N=o.clientApi.raw;var g;(g=module==null?void 0:module.hot)==null||g.decline();0&&(module.exports={addDecorator,addParameters,clearDecorators,configure,forceReRender,getStorybook,raw,setAddon,storiesOf});
4
+ `}),null)};function R({storyFn:e,title:r,name:t,showMain:i,showError:n,forceRemount:a},c){a&&u(null,c),i(),u(o.h(S,{name:t,title:r,showError:n,storyFn:e,domElement:c}),c)}var x="preact",s=(0,g.start)(R),b=(e,r)=>s.clientApi.storiesOf(e,r).addParameters({framework:x}),M=(...e)=>s.configure(x,...e),T=s.forceReRender,v=s.clientApi.raw;var C;(C=module==null?void 0:module.hot)==null||C.decline();0&&(module.exports={configure,forceReRender,raw,storiesOf});
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{a as e}from"./chunk-5JPFR37Q.mjs";import s from"global";var{window:n}=s;n&&(n.STORYBOOK_ENV="preact");import{start as p}from"@storybook/core-client";var a="preact",o=p(e),l=(r,i)=>o.clientApi.storiesOf(r,i).addParameters({framework:a}),m=(...r)=>o.configure(a,...r),y=o.clientApi.addDecorator,f=o.clientApi.addParameters,g=o.clientApi.clearDecorators,x=o.clientApi.setAddon,S=o.forceReRender,C=o.clientApi.getStorybook,k=o.clientApi.raw;module?.hot?.decline();export{y as addDecorator,f as addParameters,g as clearDecorators,m as configure,S as forceReRender,C as getStorybook,k as raw,x as setAddon,l as storiesOf};
1
+ import{b as t}from"./chunk-BANKJHG6.mjs";import a from"global";var{window:n}=a;n&&(n.STORYBOOK_ENV="preact");import{start as p}from"@storybook/core-client";var s="preact",r=p(t),f=(o,i)=>r.clientApi.storiesOf(o,i).addParameters({framework:s}),y=(...o)=>r.configure(s,...o),d=r.forceReRender,l=r.clientApi.raw;module?.hot?.decline();export{y as configure,d as forceReRender,l as raw,f as storiesOf};
@@ -1,17 +1,9 @@
1
1
  import { AnyComponent } from 'preact';
2
2
 
3
3
  declare type StoryFnPreactReturnType = string | Node | preact.JSX.Element;
4
- interface IStorybookStory {
5
- name: string;
6
- render: (context: any) => any;
7
- }
8
- interface IStorybookSection {
9
- kind: string;
10
- stories: IStorybookStory[];
11
- }
12
4
  declare type PreactFramework = {
13
5
  component: AnyComponent<any, any>;
14
6
  storyResult: StoryFnPreactReturnType;
15
7
  };
16
8
 
17
- export { IStorybookSection as I, PreactFramework as P };
9
+ export { PreactFramework as P };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/preact",
3
- "version": "7.0.0-alpha.37",
3
+ "version": "7.0.0-alpha.39",
4
4
  "description": "Storybook Preact renderer",
5
5
  "keywords": [
6
6
  "storybook"
@@ -50,10 +50,10 @@
50
50
  "prep": "../../../scripts/prepare/bundle.ts"
51
51
  },
52
52
  "dependencies": {
53
- "@storybook/addons": "7.0.0-alpha.37",
54
- "@storybook/core-client": "7.0.0-alpha.37",
53
+ "@storybook/addons": "7.0.0-alpha.39",
54
+ "@storybook/core-client": "7.0.0-alpha.39",
55
55
  "@storybook/csf": "0.0.2--canary.49.258942b.0",
56
- "@storybook/store": "7.0.0-alpha.37",
56
+ "@storybook/store": "7.0.0-alpha.39",
57
57
  "global": "^4.4.0",
58
58
  "react": "16.14.0",
59
59
  "react-dom": "16.14.0",
@@ -79,5 +79,5 @@
79
79
  ],
80
80
  "platform": "browser"
81
81
  },
82
- "gitHead": "82667a655108283aafc828427f00bb3590a334e5"
82
+ "gitHead": "47386bd49d141ea70daac41ab3e4d52749fc5da9"
83
83
  }
@@ -1,4 +0,0 @@
1
- import*as e from"preact";import{dedent as s}from"ts-dedent";var p;function i(r,t){e.Fragment?e.render(r,t):p=e.render(r,t,p)}var l=({showError:r,name:t,title:o,storyFn:a,domElement:m})=>{let n=e.h(a,null);return n||(r({title:`Expecting a Preact element from the story: "${t}" of "${o}".`,description:s`
2
- Did you forget to return the Preact element from the story?
3
- Use "() => (<MyComp/>)" or "() => { return <MyComp/>; }" when defining the story.
4
- `}),null)};function d({storyFn:r,title:t,name:o,showMain:a,showError:m,forceRemount:n},c){n&&i(null,c),a(),i(e.h(l,{name:o,title:t,showError:m,storyFn:r,domElement:c}),c)}export{d as a};