@storybook/server 7.1.0-alpha.11 → 7.1.0-alpha.13
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/chunk-DS2DPF2X.mjs +8 -2
- package/dist/config.mjs +5 -1
- package/dist/index.mjs +7 -1
- package/package.json +11 -11
package/dist/chunk-DS2DPF2X.mjs
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import{global}from
|
|
1
|
+
import { global } from '@storybook/global';
|
|
2
|
+
import { dedent } from 'ts-dedent';
|
|
3
|
+
import { simulatePageLoad, simulateDOMContentLoaded } from '@storybook/preview-api';
|
|
4
|
+
|
|
5
|
+
var {fetch,Node}=global,defaultFetchStoryHtml=async(url,path,params,storyContext)=>{let fetchUrl=new URL(`${url}/${path}`);return fetchUrl.search=new URLSearchParams({...storyContext.globals,...params}).toString(),(await fetch(fetchUrl)).text()},buildStoryArgs=(args,argTypes)=>{let storyArgs={...args};return Object.keys(argTypes).forEach(key=>{let argType=argTypes[key],{control}=argType,controlType=control&&control.type.toLowerCase(),argValue=storyArgs[key];switch(controlType){case"date":storyArgs[key]=new Date(argValue).toISOString();break;case"object":storyArgs[key]=JSON.stringify(argValue);break;}}),storyArgs},render=args=>{};async function renderToCanvas({id,title,name,showMain,showError,forceRemount,storyFn,storyContext,storyContext:{parameters,args,argTypes}},canvasElement){storyFn();let storyArgs=buildStoryArgs(args,argTypes),{server:{url,id:storyId,fetchStoryHtml=defaultFetchStoryHtml,params}}=parameters,fetchId=storyId||id,storyParams={...params,...storyArgs},element=await fetchStoryHtml(url,fetchId,storyParams,storyContext);if(showMain(),typeof element=="string")canvasElement.innerHTML=element,simulatePageLoad(canvasElement);else if(element instanceof Node){if(canvasElement.firstChild===element&&forceRemount===!1)return;canvasElement.innerHTML="",canvasElement.appendChild(element),simulateDOMContentLoaded();}else showError({title:`Expecting an HTML snippet or DOM node from the story: "${name}" of "${title}".`,description:dedent`
|
|
2
6
|
Did you forget to return the HTML snippet from the story?
|
|
3
7
|
Use "() => <your snippet or node>" or when defining the story.
|
|
4
|
-
`})}
|
|
8
|
+
`});}
|
|
9
|
+
|
|
10
|
+
export { render, renderToCanvas };
|
package/dist/config.mjs
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
import{render
|
|
1
|
+
import { renderToCanvas, render } from './chunk-DS2DPF2X.mjs';
|
|
2
|
+
import { global } from '@storybook/global';
|
|
3
|
+
import { start } from '@storybook/preview-api';
|
|
4
|
+
|
|
5
|
+
var{window:globalWindow}=global;globalWindow.STORYBOOK_ENV="SERVER";var RENDERER="server",api=start(renderToCanvas,{render}),storiesOf=(kind,m)=>api.clientApi.storiesOf(kind,m).addParameters({renderer:RENDERER}),configure=(...args)=>api.configure(RENDERER,...args),{raw}=api.clientApi,{forceReRender}=api;typeof module<"u"&&module?.hot?.decline();
|
|
6
|
+
|
|
7
|
+
export { configure, forceReRender, raw, storiesOf };
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/server",
|
|
3
|
-
"version": "7.1.0-alpha.
|
|
3
|
+
"version": "7.1.0-alpha.13",
|
|
4
4
|
"description": "Storybook Server renderer",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook"
|
|
7
7
|
],
|
|
8
|
-
"homepage": "https://github.com/storybookjs/storybook/tree/
|
|
8
|
+
"homepage": "https://github.com/storybookjs/storybook/tree/next/code/renderers/server",
|
|
9
9
|
"bugs": {
|
|
10
10
|
"url": "https://github.com/storybookjs/storybook/issues"
|
|
11
11
|
},
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
14
14
|
"url": "https://github.com/storybookjs/storybook.git",
|
|
15
|
-
"directory": "renderers/server"
|
|
15
|
+
"directory": "code/renderers/server"
|
|
16
16
|
},
|
|
17
17
|
"funding": {
|
|
18
18
|
"type": "opencollective",
|
|
@@ -21,15 +21,15 @@
|
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"exports": {
|
|
23
23
|
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
24
25
|
"node": "./dist/index.js",
|
|
25
26
|
"require": "./dist/index.js",
|
|
26
|
-
"import": "./dist/index.mjs"
|
|
27
|
-
"types": "./dist/index.d.ts"
|
|
27
|
+
"import": "./dist/index.mjs"
|
|
28
28
|
},
|
|
29
29
|
"./preview": {
|
|
30
|
+
"types": "./dist/config.d.ts",
|
|
30
31
|
"require": "./dist/config.js",
|
|
31
|
-
"import": "./dist/config.mjs"
|
|
32
|
-
"types": "./dist/config.d.ts"
|
|
32
|
+
"import": "./dist/config.mjs"
|
|
33
33
|
},
|
|
34
34
|
"./package.json": "./package.json"
|
|
35
35
|
},
|
|
@@ -48,10 +48,10 @@
|
|
|
48
48
|
"prep": "../../../scripts/prepare/bundle.ts"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@storybook/core-client": "7.1.0-alpha.
|
|
51
|
+
"@storybook/core-client": "7.1.0-alpha.13",
|
|
52
52
|
"@storybook/global": "^5.0.0",
|
|
53
|
-
"@storybook/preview-api": "7.1.0-alpha.
|
|
54
|
-
"@storybook/types": "7.1.0-alpha.
|
|
53
|
+
"@storybook/preview-api": "7.1.0-alpha.13",
|
|
54
|
+
"@storybook/types": "7.1.0-alpha.13",
|
|
55
55
|
"ts-dedent": "^2.0.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
],
|
|
71
71
|
"platform": "browser"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "5f5be6cc6695e4ed9ddddc58f8f8258bf07e7c53"
|
|
74
74
|
}
|