Merge branch 'next-6.0.0' into pr/alexandre-lelain/9249

This commit is contained in:
Norbert de Langen 2020-01-08 15:08:49 +01:00
commit d68bfd92bd
206 changed files with 148983 additions and 1104 deletions

View File

@ -18,6 +18,7 @@ examples/cra-ts-kitchen-sink/*.json
examples/cra-ts-kitchen-sink/public/*
examples/cra-ts-essentials/*.json
examples/cra-ts-essentials/public/*
.yarn
!.remarkrc.js
!.babelrc.js

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
.yarn/releases/yarn-*.js linguist-generated=true

1
.prettierignore Normal file
View File

@ -0,0 +1 @@
.yarn

147315
.yarn/releases/yarn-1.21.1.js generated vendored Executable file

File diff suppressed because one or more lines are too long

7
.yarnrc Normal file
View File

@ -0,0 +1,7 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
frozen-lockfile true
lastUpdateCheck 1576044003885
yarn-path ".yarn/releases/yarn-1.21.1.js"

View File

@ -1,3 +1,94 @@
## 5.3.0-rc.11 (January 7, 2020)
### Bug Fixes
* Addon-Docs: Handle leaf/non-leaf mixture in docs-mode navigation ([#9321](https://github.com/storybookjs/storybook/pull/9321))
### Dependency Upgrades
* Axe storyshots: move to original @wordpress/jest-puppeteer-axe package ([#9337](https://github.com/storybookjs/storybook/pull/9337))
## 5.3.0-rc.10 (January 6, 2020)
### Bug Fixes
* Revert "Source-loader: Disable no-implicit-any linting" ([#9333](https://github.com/storybookjs/storybook/pull/9333))
* Addon-docs: Fix scroll behavior on page navigation ([#9331](https://github.com/storybookjs/storybook/pull/9331))
## 5.3.0-rc.9 (January 4, 2020)
### Features
* CSF: Use `__namedExportsOrder` array in loader if provided ([#9315](https://github.com/storybookjs/storybook/pull/9315))
### Bug Fixes
* Router: Add storyNameFromExport to avoid breaking changes ([#9320](https://github.com/storybookjs/storybook/pull/9320))
## 5.3.0-rc.8 (January 3, 2020)
### Bug Fixes
* Addon-docs: Tweak props table paragraph spacing ([#9307](https://github.com/storybookjs/storybook/pull/9307))
### Maintenance
* Add minimal typescript component to official-storybook ([#9308](https://github.com/storybookjs/storybook/pull/9308))
### Dependency Upgrades
* React: Upgrade babel-plugin-react-docgen to 4.0.0 ([#9303](https://github.com/storybookjs/storybook/pull/9303))
## 5.3.0-rc.7 (January 2, 2020)
### Bug Fixes
* Core: Fix babel.js to disable simplify ([#9280](https://github.com/storybookjs/storybook/pull/9280))
* Storyshots-Puppeteer: Don't infer story ID from its name ([#9291](https://github.com/storybookjs/storybook/pull/9291))
## 5.3.0-rc.6 (December 31, 2019)
This is significant change to `main.js` aka tri-config, dramatically simplifying how addons and presets are registered. See the maintenannce PR for details.
### Maintenance
* Main.js: Combine presets/registers in `addons` field ([#9246](https://github.com/storybookjs/storybook/pull/9246))
## 5.3.0-rc.5 (December 31, 2019)
### Bug Fixes
* Addon-docs: Hide stories block when there are no stories ([#9271](https://github.com/storybookjs/storybook/pull/9271))
* Source-loader: Disable no-implicit-any linting ([#9272](https://github.com/storybookjs/storybook/pull/9272))
## 5.3.0-rc.4 (December 28, 2019)
### Bug Fixes
* Addon-docs: Fix MDX story rendering with dynamic component titles ([#9248](https://github.com/storybookjs/storybook/pull/9248))
### Maintenance
* Ignore testfixtures directory in storybook publish ([#9244](https://github.com/storybookjs/storybook/pull/9244))
## 5.3.0-rc.3 (December 26, 2019)
### Bug Fixes
* Addon-docs: Include ember files in addon-docs publish ([#9230](https://github.com/storybookjs/storybook/pull/9230))
### Maintenance
* Standalone CSF example ([#9223](https://github.com/storybookjs/storybook/pull/9223))
### Dependency Upgrades
* Addon-info: Upgrade marksy for security ([#9234](https://github.com/storybookjs/storybook/pull/9234))
## 5.3.0-rc.2 (December 26, 2019)
Failed NPM publish
## 5.3.0-rc.1 (December 23, 2019)
### Bug Fixes

View File

@ -4,7 +4,7 @@ Thanks for your interest in improving Storybook! We are a community-driven proje
Please review this document to help to streamline the process and save everyone's precious time.
This repo uses yarn workspaces, so you should install `yarn@1.3.2` or higher as a package manager. See [installation guide](https://yarnpkg.com/en/docs/install).
This repo uses yarn workspaces, so you should install `yarn` as the package manager. See [installation guide](https://yarnpkg.com/en/docs/install).
## Issues
@ -273,7 +273,7 @@ If you run into trouble here, make sure your node, npm, and **_yarn_** are on th
_This method is slow_
1. `yarn bootstrap --all`
2. Have a beer 🍺
2. Take a break 🍵
3. `yarn test` (to verify everything worked)
### Working with the kitchen sink apps
@ -283,9 +283,10 @@ Within the `examples` folder of the Storybook repo, you will find kitchen sink e
Not only do these show many of the options and add-ons available, they are also automatically linked to all the development packages. We highly encourage you to use these to develop/test contributions on.
#### React and Vue
1. `cd examples/official-storybook`
2. `yarn storybook`
3. Verify that your local version works
2. `yarn storybook`
3. Verify that your local version works
### Working with your own app

View File

@ -2,7 +2,7 @@
- [Migration](#migration)
- [From version 5.2.x to 5.3.x](#from-version-52x-to-53x)
- [To tri-config configuration](#to-tri-config-configuration)
- [To main.js configuration](#to-main-js-configuration)
- [Create React App preset](#create-react-app-preset)
- [Description doc block](#description-doc-block)
- [React Native Async Storage](#react-native-async-storage)
@ -75,14 +75,13 @@
- [Packages renaming](#packages-renaming)
- [Deprecated embedded addons](#deprecated-embedded-addons)
## From version 5.2.x to 5.3.x
### To tri-config configuration
### To main.js configuration
In storybook 5.3 3 new files for configuration were introduced, that replaced some previous files.
These files are now soft-deprecated, (*they still work, but over time we will promote users to migrate*):
These files are now soft-deprecated, (_they still work, but over time we will promote users to migrate_):
- `config.js` has been renamed to `preview.js`.
- `addons.js` has been renamed to `manager.js`.
@ -95,13 +94,11 @@ These files are now soft-deprecated, (*they still work, but over time we will pr
```js
module.exports = {
stories: ['../**/*.stories.js'],
addons: [
'@storybook/addon-docs/register',
],
addons: ['@storybook/addon-knobs'],
};
```
You remove all "register" import from `addons.js` and place them inside the array. If this means `addons.js` is now empty for you, it's safe to remove.
You remove all "register" import from `addons.js` and place them inside the array. You can also safely remove the `/register` suffix from these entries, for a cleaner, more readable configuration. If this means `addons.js` is now empty for you, it's safe to remove.
Next you remove the code that imports/requires all your stories from `config.js`, and change it to a glob-pattern and place that glob in the `stories` array. If this means `config.js` is empty, it's safe to remove.
@ -110,10 +107,20 @@ If you had a `presets.js` file before you can add the array of presets to the ma
```js
module.exports = {
stories: ['../**/*.stories.js'],
presets: ['@storybook/addon-docs/preset'],
addons: [
'@storybook/preset-create-react-app'
{
name: '@storybook/addon-docs',
options: { configureJSX: true }
}
],
};
```
By default, adding a package to the `addons` array will first try to load its `preset` entry, then its `register` entry, and finally, it will just assume the package itself is a preset.
If you want to load a specific package entry, for example you want to use `@storybook/addon-docs/register`, you can also include that in the addons array and Storybook will do the right thing.
#### Using preview.js
If after migrating the imports/requires of your stories to `main.js` you're left with some code in `config.js` it's likely the usage of `addParameters` & `addDecorator`.
@ -142,7 +149,7 @@ addons.setConfig({
});
```
This makes storybook load and use the theme in the manager directly.
This makes storybook load and use the theme in the manager directly.
This allows for richer theming in the future, and has a much better performance!
### Create React App preset

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-a11y",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "a11y addon for storybook",
"keywords": [
"a11y",
@ -33,12 +33,12 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@storybook/addons": "5.3.0-rc.1",
"@storybook/api": "5.3.0-rc.1",
"@storybook/client-logger": "5.3.0-rc.1",
"@storybook/components": "5.3.0-rc.1",
"@storybook/core-events": "5.3.0-rc.1",
"@storybook/theming": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"@storybook/api": "5.3.0-rc.11",
"@storybook/client-logger": "5.3.0-rc.11",
"@storybook/components": "5.3.0-rc.11",
"@storybook/core-events": "5.3.0-rc.11",
"@storybook/theming": "5.3.0-rc.11",
"axe-core": "^3.3.2",
"core-js": "^3.0.1",
"global": "^4.3.2",
@ -56,5 +56,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-actions",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "Action Logger addon for storybook",
"keywords": [
"storybook"
@ -28,12 +28,12 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@storybook/addons": "5.3.0-rc.1",
"@storybook/api": "5.3.0-rc.1",
"@storybook/client-api": "5.3.0-rc.1",
"@storybook/components": "5.3.0-rc.1",
"@storybook/core-events": "5.3.0-rc.1",
"@storybook/theming": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"@storybook/api": "5.3.0-rc.11",
"@storybook/client-api": "5.3.0-rc.11",
"@storybook/components": "5.3.0-rc.11",
"@storybook/core-events": "5.3.0-rc.11",
"@storybook/theming": "5.3.0-rc.11",
"core-js": "^3.0.1",
"fast-deep-equal": "^2.0.1",
"global": "^4.3.2",
@ -50,5 +50,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-backgrounds",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "A storybook addon to show different backgrounds for your preview",
"keywords": [
"addon",
@ -32,12 +32,12 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@storybook/addons": "5.3.0-rc.1",
"@storybook/api": "5.3.0-rc.1",
"@storybook/client-logger": "5.3.0-rc.1",
"@storybook/components": "5.3.0-rc.1",
"@storybook/core-events": "5.3.0-rc.1",
"@storybook/theming": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"@storybook/api": "5.3.0-rc.11",
"@storybook/client-logger": "5.3.0-rc.11",
"@storybook/components": "5.3.0-rc.11",
"@storybook/core-events": "5.3.0-rc.11",
"@storybook/theming": "5.3.0-rc.11",
"core-js": "^3.0.1",
"memoizerific": "^1.11.3",
"react": "^16.8.3",
@ -49,5 +49,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-centered",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "Storybook decorator to center components",
"keywords": [
"addon",
@ -29,7 +29,7 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@storybook/addons": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"core-js": "^3.0.1",
"global": "^4.3.2",
"util-deprecate": "^1.0.2"
@ -40,5 +40,5 @@
"preact": "*",
"react": "*"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -109,8 +109,8 @@ export const contexts = [
],
params: [
// an array of params contains a set of predefined `props` for `components`
{ name: 'Light Theme', props: { theme /* : your dark theme */ } },
{ name: 'Dark Theme', props: { theme /* : your light theme */ }, default: true },
{ name: 'Light Theme', props: { theme /* : your light theme */ } },
{ name: 'Dark Theme', props: { theme /* : your dark theme */ }, default: true },
],
options: {
deep: true, // pass the `props` deeply into all wrapping components

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-contexts",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "Storybook Addon Contexts",
"keywords": [
"preact",
@ -27,10 +27,10 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@storybook/addons": "5.3.0-rc.1",
"@storybook/api": "5.3.0-rc.1",
"@storybook/components": "5.3.0-rc.1",
"@storybook/core-events": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"@storybook/api": "5.3.0-rc.11",
"@storybook/components": "5.3.0-rc.11",
"@storybook/core-events": "5.3.0-rc.11",
"core-js": "^3.0.1",
"global": "^4.3.2",
"qs": "^6.6.0"
@ -45,5 +45,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-cssresources",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "A storybook addon to switch between css resources at runtime for your story",
"keywords": [
"addon",
@ -32,10 +32,10 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@storybook/addons": "5.3.0-rc.1",
"@storybook/api": "5.3.0-rc.1",
"@storybook/components": "5.3.0-rc.1",
"@storybook/core-events": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"@storybook/api": "5.3.0-rc.11",
"@storybook/components": "5.3.0-rc.11",
"@storybook/core-events": "5.3.0-rc.11",
"core-js": "^3.0.1",
"global": "^4.3.2",
"react": "^16.8.3"
@ -46,5 +46,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-design-assets",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "Design asset preview for storybook",
"keywords": [
"addon",
@ -34,12 +34,12 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@storybook/addons": "5.3.0-rc.1",
"@storybook/api": "5.3.0-rc.1",
"@storybook/client-logger": "5.3.0-rc.1",
"@storybook/components": "5.3.0-rc.1",
"@storybook/core-events": "5.3.0-rc.1",
"@storybook/theming": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"@storybook/api": "5.3.0-rc.11",
"@storybook/client-logger": "5.3.0-rc.11",
"@storybook/components": "5.3.0-rc.11",
"@storybook/core-events": "5.3.0-rc.11",
"@storybook/theming": "5.3.0-rc.11",
"core-js": "^3.0.1",
"global": "^4.3.2",
"react": "^16.8.3",
@ -49,5 +49,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -110,8 +110,8 @@ Then add the following to your `.storybook/main.js`:
```js
module.exports = {
presets: ['@storybook/addon-docs/preset'],
stories: ['../src/**/*.stories.(js|mdx)'],
addons: ['@storybook/addon-docs'],
};
```
@ -143,9 +143,9 @@ The `addon-docs` preset has a few configuration options that can be used to conf
```js
module.exports = {
presets: [
addons: [
{
name: '@storybook/addon-docs/preset',
name: '@storybook/addon-docs',
options: {
configureJSX: true,
babelOptions: {},
@ -156,7 +156,7 @@ module.exports = {
};
```
The `configureJsx` option is useful when you're writing your docs in MDX and your project's babel config isn't already set up to handle JSX files. `babelOptions` is a way to further configure the babel processor when you're using `configureJSX`.
The `configureJSX` option is useful when you're writing your docs in MDX and your project's babel config isn't already set up to handle JSX files. `babelOptions` is a way to further configure the babel processor when you're using `configureJSX`.
`sourceLoaderOptions` is an object for configuring `@storybook/source-loader`. When set to `null` it tells docs not to run the `source-loader` at all, which can be used as an optimization, or if you're already using `source-loader` in your `main.js`.

View File

@ -26,7 +26,7 @@ Then add the following to your `.storybook/main.js` exports:
```js
module.exports = {
presets: ['@storybook/addon-docs/preset'],
addons: ['@storybook/addon-docs'],
};
```

View File

@ -18,11 +18,11 @@ First add the package. Make sure that the versions for your `@storybook/*` packa
yarn add -D @storybook/addon-docs@next
```
Then add the following to your `.storybook/main.js` presets:
Then add the following to your `.storybook/main.js` addons:
```js
module.exports = {
presets: ['@storybook/addon-docs/preset'],
addons: ['@storybook/addon-docs'],
};
```

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-docs",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "Superior documentation for your components",
"keywords": [
"addon",
@ -46,13 +46,13 @@
"@mdx-js/loader": "^1.5.1",
"@mdx-js/mdx": "^1.5.1",
"@mdx-js/react": "^1.5.1",
"@storybook/addons": "5.3.0-rc.1",
"@storybook/api": "5.3.0-rc.1",
"@storybook/components": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"@storybook/api": "5.3.0-rc.11",
"@storybook/components": "5.3.0-rc.11",
"@storybook/csf": "0.0.1",
"@storybook/postinstall": "5.3.0-rc.1",
"@storybook/source-loader": "5.3.0-rc.1",
"@storybook/theming": "5.3.0-rc.1",
"@storybook/postinstall": "5.3.0-rc.11",
"@storybook/source-loader": "5.3.0-rc.11",
"@storybook/theming": "5.3.0-rc.11",
"acorn": "^7.1.0",
"acorn-jsx": "^5.1.0",
"acorn-walk": "^7.0.0",
@ -89,5 +89,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -22,12 +22,12 @@ First add the package. Make sure that the versions for your `@storybook/*` packa
yarn add -D @storybook/addon-docs@next
```
Then add the following to your `.storybook/main.js` list of `presets`:
Then add the following to your `.storybook/main.js` list of `addons`:
```js
module.exports = {
// other settings
presets: ['@storybook/addon-docs/preset'];
addons: ['@storybook/addon-docs'];
}
```

View File

@ -6,11 +6,12 @@ export interface DocsContextProps {
selectedStory?: string;
/**
* mdxStoryNameToId is an MDX-compiler-generated mapping of an MDX story's
* display name to its storyId. It's used internally by the `<Story>`
* doc block.
* mdxStoryNameToKey is an MDX-compiler-generated mapping of an MDX story's
* display name to its story key for ID generation. It's used internally by the `<Story>`
* and `Preview` doc blocks.
*/
mdxStoryNameToId?: Record<string, string>;
mdxStoryNameToKey?: Record<string, string>;
mdxComponentMeta?: any;
parameters?: any;
storyStore?: any;
forceRender?: () => void;

View File

@ -1,4 +1,8 @@
import { FunctionComponent } from 'react';
import React, { FC, useContext } from 'react';
import { document } from 'global';
import { Anchor } from './Anchor';
import { DocsContext, DocsContextProps } from './DocsContext';
import { getDocsStories } from './utils';
type Decorator = (...args: any) => any;
@ -9,9 +13,27 @@ interface MetaProps {
parameters?: any;
}
function getFirstStoryId(docsContext: DocsContextProps): string {
const stories = getDocsStories(docsContext);
return stories.length > 0 ? stories[0].id : null;
}
function renderAnchor() {
const context = useContext(DocsContext);
// eslint-disable-next-line react/destructuring-assignment
const anchorId = getFirstStoryId(context) || context.id;
return <Anchor storyId={anchorId} />;
}
/**
* This component is used to declare component metadata in docs
* and gets transformed into a default export underneath the hood.
* It doesn't actually render anything.
*/
export const Meta: FunctionComponent<MetaProps> = props => null;
export const Meta: FC<MetaProps> = () => {
const params = new URL(document.location).searchParams;
const isDocs = params.get('viewMode') === 'docs';
return isDocs ? renderAnchor() : null;
};

View File

@ -1,4 +1,5 @@
import React, { FunctionComponent, ReactElement, ReactNode, ReactNodeArray } from 'react';
import { toId, storyNameFromExport } from '@storybook/csf';
import { Preview as PurePreview, PreviewProps as PurePreviewProps } from '@storybook/components';
import { getSourceProps } from './Source';
import { DocsContext, DocsContextProps } from './DocsContext';
@ -21,7 +22,7 @@ const getPreviewProps = (
children,
...props
}: PreviewProps & { children?: ReactNode },
{ mdxStoryNameToId, storyStore }: DocsContextProps
{ mdxStoryNameToKey, mdxComponentMeta, storyStore }: DocsContextProps
): PurePreviewProps => {
if (withSource === SourceState.NONE) {
return props;
@ -36,7 +37,14 @@ const getPreviewProps = (
const stories = childArray.filter(
(c: ReactElement) => c.props && (c.props.id || c.props.name)
) as ReactElement[];
const targetIds = stories.map(s => s.props.id || mdxStoryNameToId[s.props.name]);
const targetIds = stories.map(
s =>
s.props.id ||
toId(
mdxComponentMeta.id || mdxComponentMeta.title,
storyNameFromExport(mdxStoryNameToKey[s.props.name])
)
);
const sourceProps = getSourceProps({ ids: targetIds }, { storyStore });
return {
...props, // pass through columns etc.

View File

@ -17,7 +17,7 @@ export const Stories: FunctionComponent<StoriesProps> = ({ slot, title }) => {
const stories: DocsStoryProps[] = slot
? slot(componentStories, context)
: componentStories && componentStories.slice(1);
if (!stories) {
if (!stories || stories.length === 0) {
return null;
}
return (

View File

@ -2,6 +2,7 @@ import React, { createElement, ElementType, FunctionComponent, ReactNode } from
import { MDXProvider } from '@mdx-js/react';
import { components as docsComponents } from '@storybook/components/html';
import { Story, StoryProps as PureStoryProps } from '@storybook/components';
import { toId, storyNameFromExport } from '@storybook/csf';
import { CURRENT_SELECTION } from './shared';
import { DocsContext, DocsContextProps } from './DocsContext';
@ -40,12 +41,17 @@ const inferInlineStories = (framework: string): boolean => {
export const getStoryProps = (
props: StoryProps,
{ id: currentId, storyStore, parameters, mdxStoryNameToId }: DocsContextProps | null
{ id: currentId, storyStore, mdxStoryNameToKey, mdxComponentMeta }: DocsContextProps | null
): PureStoryProps => {
const { id } = props as StoryRefProps;
const { name } = props as StoryDefProps;
const inputId = id === CURRENT_SELECTION ? currentId : id;
const previewId = inputId || mdxStoryNameToId[name];
const previewId =
inputId ||
toId(
mdxComponentMeta.id || mdxComponentMeta.title,
storyNameFromExport(mdxStoryNameToKey[name])
);
const { height, inline } = props;
const data = storyStore.fromId(previewId);

View File

@ -4,6 +4,11 @@ import { StoryData, Component } from './shared';
export const getDocsStories = (context: DocsContextProps): StoryData[] => {
const { storyStore, selectedKind } = context;
if (!storyStore) {
return [];
}
return storyStore
.getStoriesForKind(selectedKind)
.filter((s: any) => !(s.parameters && s.parameters.docs && s.parameters.docs.disable));

View File

@ -99,7 +99,7 @@ export function webpack(webpackConfig: any = {}, options: any = {}) {
return result;
}
export function addons(entry: any[] = [], options: any) {
export function managerEntries(entry: any[] = [], options: any) {
return [...entry, require.resolve('../../register')];
}

View File

@ -39,13 +39,13 @@ componentNotes.story.parameters = { mdxSource: '<Button>Component notes</Button>
const componentMeta = { title: 'Button', id: 'button-id', includeStories: ['componentNotes'] };
const mdxStoryNameToId = { 'component notes': 'button-id--component-notes' };
const mdxStoryNameToKey = { 'component notes': 'componentNotes' };
componentMeta.parameters = componentMeta.parameters || {};
componentMeta.parameters.docs = {
...(componentMeta.parameters.docs || {}),
page: () => (
<AddContext mdxStoryNameToId={mdxStoryNameToId}>
<AddContext mdxStoryNameToKey={mdxStoryNameToKey} mdxComponentMeta={componentMeta}>
<MDXContent />
</AddContext>
),

View File

@ -73,13 +73,13 @@ const componentMeta = {
includeStories: ['one'],
};
const mdxStoryNameToId = { one: 'button--one' };
const mdxStoryNameToKey = { one: 'one' };
componentMeta.parameters = componentMeta.parameters || {};
componentMeta.parameters.docs = {
...(componentMeta.parameters.docs || {}),
page: () => (
<AddContext mdxStoryNameToId={mdxStoryNameToId}>
<AddContext mdxStoryNameToKey={mdxStoryNameToKey} mdxComponentMeta={componentMeta}>
<MDXContent />
</AddContext>
),

View File

@ -42,13 +42,13 @@ __page.story = { parameters: { docsOnly: true } };
const componentMeta = { title: 'docs-only', includeStories: ['__page'] };
const mdxStoryNameToId = {};
const mdxStoryNameToKey = {};
componentMeta.parameters = componentMeta.parameters || {};
componentMeta.parameters.docs = {
...(componentMeta.parameters.docs || {}),
page: () => (
<AddContext mdxStoryNameToId={mdxStoryNameToId}>
<AddContext mdxStoryNameToKey={mdxStoryNameToKey} mdxComponentMeta={componentMeta}>
<MDXContent />
</AddContext>
),

View File

@ -36,13 +36,13 @@ __page.story = { parameters: { docsOnly: true } };
const componentMeta = { title: \\"Addons/Docs/what's in a title?\\", includeStories: ['__page'] };
const mdxStoryNameToId = {};
const mdxStoryNameToKey = {};
componentMeta.parameters = componentMeta.parameters || {};
componentMeta.parameters.docs = {
...(componentMeta.parameters.docs || {}),
page: () => (
<AddContext mdxStoryNameToId={mdxStoryNameToId}>
<AddContext mdxStoryNameToKey={mdxStoryNameToKey} mdxComponentMeta={componentMeta}>
<MDXContent />
</AddContext>
),

View File

@ -51,13 +51,13 @@ helloStory.story.parameters = { mdxSource: '<Button>Hello button</Button>' };
const componentMeta = { title: 'Button', includeStories: ['one', 'helloStory'] };
const mdxStoryNameToId = { one: 'button--one', 'hello story': 'button--hello-story' };
const mdxStoryNameToKey = { one: 'one', 'hello story': 'helloStory' };
componentMeta.parameters = componentMeta.parameters || {};
componentMeta.parameters.docs = {
...(componentMeta.parameters.docs || {}),
page: () => (
<AddContext mdxStoryNameToId={mdxStoryNameToId}>
<AddContext mdxStoryNameToKey={mdxStoryNameToKey} mdxComponentMeta={componentMeta}>
<MDXContent />
</AddContext>
),

View File

@ -71,16 +71,13 @@ const componentMeta = {
includeStories: ['componentNotes', 'storyNotes'],
};
const mdxStoryNameToId = {
'component notes': 'button--component-notes',
'story notes': 'button--story-notes',
};
const mdxStoryNameToKey = { 'component notes': 'componentNotes', 'story notes': 'storyNotes' };
componentMeta.parameters = componentMeta.parameters || {};
componentMeta.parameters.docs = {
...(componentMeta.parameters.docs || {}),
page: () => (
<AddContext mdxStoryNameToId={mdxStoryNameToId}>
<AddContext mdxStoryNameToKey={mdxStoryNameToKey} mdxComponentMeta={componentMeta}>
<MDXContent />
</AddContext>
),

View File

@ -70,13 +70,13 @@ const componentMeta = {
includeStories: ['helloButton', 'two'],
};
const mdxStoryNameToId = { 'hello button': 'button--hello-button', two: 'button--two' };
const mdxStoryNameToKey = { 'hello button': 'helloButton', two: 'two' };
componentMeta.parameters = componentMeta.parameters || {};
componentMeta.parameters.docs = {
...(componentMeta.parameters.docs || {}),
page: () => (
<AddContext mdxStoryNameToId={mdxStoryNameToId}>
<AddContext mdxStoryNameToKey={mdxStoryNameToKey} mdxComponentMeta={componentMeta}>
<MDXContent />
</AddContext>
),

View File

@ -31,13 +31,13 @@ MDXContent.isMDXComponent = true;
const componentMeta = { includeStories: [] };
const mdxStoryNameToId = {};
const mdxStoryNameToKey = {};
componentMeta.parameters = componentMeta.parameters || {};
componentMeta.parameters.docs = {
...(componentMeta.parameters.docs || {}),
page: () => (
<AddContext mdxStoryNameToId={mdxStoryNameToId}>
<AddContext mdxStoryNameToKey={mdxStoryNameToKey} mdxComponentMeta={componentMeta}>
<MDXContent />
</AddContext>
),

View File

@ -39,13 +39,13 @@ text.story.parameters = { mdxSource: \\"'Plain text'\\" };
const componentMeta = { title: 'Text', includeStories: ['text'] };
const mdxStoryNameToId = { text: 'text--text' };
const mdxStoryNameToKey = { text: 'text' };
componentMeta.parameters = componentMeta.parameters || {};
componentMeta.parameters.docs = {
...(componentMeta.parameters.docs || {}),
page: () => (
<AddContext mdxStoryNameToId={mdxStoryNameToId}>
<AddContext mdxStoryNameToKey={mdxStoryNameToKey} mdxComponentMeta={componentMeta}>
<MDXContent />
</AddContext>
),

View File

@ -67,18 +67,18 @@ const componentMeta = {
includeStories: ['one', 'helloStory', 'wPunctuation', '_1FineDay'],
};
const mdxStoryNameToId = {
one: 'button--one',
'hello story': 'button--hello-story',
'w/punctuation': 'button--w-punctuation',
'1 fine day': 'button--1-fine-day',
const mdxStoryNameToKey = {
one: 'one',
'hello story': 'helloStory',
'w/punctuation': 'wPunctuation',
'1 fine day': '_1FineDay',
};
componentMeta.parameters = componentMeta.parameters || {};
componentMeta.parameters.docs = {
...(componentMeta.parameters.docs || {}),
page: () => (
<AddContext mdxStoryNameToId={mdxStoryNameToId}>
<AddContext mdxStoryNameToKey={mdxStoryNameToKey} mdxComponentMeta={componentMeta}>
<MDXContent />
</AddContext>
),

View File

@ -43,13 +43,13 @@ basic.story.parameters = { mdxSource: 'basicFn' };
const componentMeta = { title: 'story-function-var', includeStories: ['basic'] };
const mdxStoryNameToId = { basic: 'story-function-var--basic' };
const mdxStoryNameToKey = { basic: 'basic' };
componentMeta.parameters = componentMeta.parameters || {};
componentMeta.parameters.docs = {
...(componentMeta.parameters.docs || {}),
page: () => (
<AddContext mdxStoryNameToId={mdxStoryNameToId}>
<AddContext mdxStoryNameToKey={mdxStoryNameToKey} mdxComponentMeta={componentMeta}>
<MDXContent />
</AddContext>
),

View File

@ -48,13 +48,13 @@ functionStory.story.parameters = {
const componentMeta = { includeStories: ['functionStory'] };
const mdxStoryNameToId = {};
const mdxStoryNameToKey = { function: 'functionStory' };
componentMeta.parameters = componentMeta.parameters || {};
componentMeta.parameters.docs = {
...(componentMeta.parameters.docs || {}),
page: () => (
<AddContext mdxStoryNameToId={mdxStoryNameToId}>
<AddContext mdxStoryNameToKey={mdxStoryNameToKey} mdxComponentMeta={componentMeta}>
<MDXContent />
</AddContext>
),

View File

@ -60,13 +60,13 @@ toStorybook.story.parameters = {
const componentMeta = { title: 'MDX|Welcome', includeStories: ['toStorybook'] };
const mdxStoryNameToId = { 'to storybook': 'mdx-welcome--to-storybook' };
const mdxStoryNameToKey = { 'to storybook': 'toStorybook' };
componentMeta.parameters = componentMeta.parameters || {};
componentMeta.parameters.docs = {
...(componentMeta.parameters.docs || {}),
page: () => (
<AddContext mdxStoryNameToId={mdxStoryNameToId}>
<AddContext mdxStoryNameToKey={mdxStoryNameToKey} mdxComponentMeta={componentMeta}>
<MDXContent />
</AddContext>
),

View File

@ -31,13 +31,13 @@ MDXContent.isMDXComponent = true;
const componentMeta = { includeStories: [] };
const mdxStoryNameToId = {};
const mdxStoryNameToKey = {};
componentMeta.parameters = componentMeta.parameters || {};
componentMeta.parameters.docs = {
...(componentMeta.parameters.docs || {}),
page: () => (
<AddContext mdxStoryNameToId={mdxStoryNameToId}>
<AddContext mdxStoryNameToKey={mdxStoryNameToKey} mdxComponentMeta={componentMeta}>
<MDXContent />
</AddContext>
),

View File

@ -37,13 +37,13 @@ __page.story = { parameters: { docsOnly: true } };
const componentMeta = { title: \`\${titleFunction('template')}\`, includeStories: ['__page'] };
const mdxStoryNameToId = {};
const mdxStoryNameToKey = {};
componentMeta.parameters = componentMeta.parameters || {};
componentMeta.parameters.docs = {
...(componentMeta.parameters.docs || {}),
page: () => (
<AddContext mdxStoryNameToId={mdxStoryNameToId}>
<AddContext mdxStoryNameToKey={mdxStoryNameToKey} mdxComponentMeta={componentMeta}>
<MDXContent />
</AddContext>
),

View File

@ -32,13 +32,13 @@ MDXContent.isMDXComponent = true;
const componentMeta = { includeStories: [] };
const mdxStoryNameToId = {};
const mdxStoryNameToKey = {};
componentMeta.parameters = componentMeta.parameters || {};
componentMeta.parameters.docs = {
...(componentMeta.parameters.docs || {}),
page: () => (
<AddContext mdxStoryNameToId={mdxStoryNameToId}>
<AddContext mdxStoryNameToKey={mdxStoryNameToKey} mdxComponentMeta={componentMeta}>
<MDXContent />
</AddContext>
),

View File

@ -3,7 +3,6 @@ const parser = require('@babel/parser');
const generate = require('@babel/generator').default;
const camelCase = require('lodash/camelCase');
const jsStringEscape = require('js-string-escape');
const { toId, storyNameFromExport } = require('@storybook/csf');
// Generate the MDX as is, but append named exports for every
// story in the contents
@ -198,13 +197,13 @@ function getExports(node, counter, options) {
return null;
}
// insert `mdxKind` into the context so that we can know what "kind" we're rendering into
// when we render <Story name="xxx">...</Story>, since this MDX can be attached to any `selectedKind`!
// insert `mdxStoryNameToKey` and `mdxComponentMeta` into the context so that we
// can reconstruct the Story ID dynamically from the `name` at render time
const wrapperJs = `
componentMeta.parameters = componentMeta.parameters || {};
componentMeta.parameters.docs = {
...(componentMeta.parameters.docs || {}),
page: () => <AddContext mdxStoryNameToId={mdxStoryNameToId}><MDXContent /></AddContext>,
page: () => <AddContext mdxStoryNameToKey={mdxStoryNameToKey} mdxComponentMeta={componentMeta}><MDXContent /></AddContext>,
};
`.trim();
@ -322,23 +321,12 @@ function extractExports(node, options) {
}
metaExport.includeStories = JSON.stringify(includeStories);
const { title, id: componentId } = metaExport;
const mdxStoryNameToId = Object.entries(context.storyNameToKey).reduce(
(acc, [storyName, storyKey]) => {
if (title) {
acc[storyName] = toId(componentId || title, storyNameFromExport(storyKey));
}
return acc;
},
{}
);
const fullJsx = [
'import { assertIsFn, AddContext } from "@storybook/addon-docs/blocks";',
defaultJsx,
...storyExports,
`const componentMeta = ${stringifyMeta(metaExport)};`,
`const mdxStoryNameToId = ${JSON.stringify(mdxStoryNameToId)};`,
`const mdxStoryNameToKey = ${JSON.stringify(context.storyNameToKey)};`,
wrapperJs,
'export default componentMeta;',
].join('\n\n');

View File

@ -11,7 +11,7 @@ const PRESET_METHODS = [
'webpack',
'webpackFinal',
'managerWebpack',
'addons',
'managerEntries',
'entries',
'config',
];

View File

@ -22,11 +22,11 @@ First add the package. Make sure that the versions for your `@storybook/*` packa
yarn add -D @storybook/addon-docs@next
```
Then add the following to your `.storybook/main.js` presets:
Then add the following to your `.storybook/main.js` addons:
```js
module.exports = {
presets: ['@storybook/addon-docs/preset'],
addons: ['@storybook/addon-docs'],
};
```

View File

@ -23,7 +23,7 @@ And then add the following line to your `.storybook/main.js`:
```js
module.exports = {
presets: ['@storybook/addon-essentials'],
addons: ['@storybook/addon-essentials'],
};
```
@ -39,8 +39,8 @@ Yuu can disable any of Essential's addons using the following configuration sche
```js
module.exports = {
presets: [{
name: '@storybook/addon-essentials'],
addons: [{
name: '@storybook/addon-essentials',
options: {
<addon-key>: false,
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-essentials",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "Curated addons to bring out the best of Storybook",
"keywords": [
"addon",
@ -27,11 +27,11 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@storybook/addon-backgrounds": "5.3.0-rc.1",
"@storybook/addon-viewport": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.1",
"@storybook/api": "5.3.0-rc.1",
"@storybook/node-logger": "5.3.0-rc.1",
"@storybook/addon-backgrounds": "5.3.0-rc.11",
"@storybook/addon-viewport": "5.3.0-rc.11",
"@storybook/addons": "5.3.0-rc.11",
"@storybook/api": "5.3.0-rc.11",
"@storybook/node-logger": "5.3.0-rc.11",
"ts-dedent": "^1.1.0"
},
"devDependencies": {
@ -45,5 +45,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -22,7 +22,7 @@ const isInstalled = (addon: string) => {
const makeAddon = (key: string) => `@storybook/addon-${key}`;
export function addons(entry: any[] = [], options: PresetOptions = {}) {
export function managerEntries(entry: any[] = [], options: PresetOptions = {}) {
const registerAddons = ['backgrounds', 'viewport']
.filter(key => (options as any)[key] !== false)
.map(key => makeAddon(key))

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-events",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "Add events to your Storybook stories.",
"keywords": [
"addon",
@ -31,11 +31,11 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@storybook/addons": "5.3.0-rc.1",
"@storybook/api": "5.3.0-rc.1",
"@storybook/client-api": "5.3.0-rc.1",
"@storybook/core-events": "5.3.0-rc.1",
"@storybook/theming": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"@storybook/api": "5.3.0-rc.11",
"@storybook/client-api": "5.3.0-rc.11",
"@storybook/core-events": "5.3.0-rc.11",
"@storybook/theming": "5.3.0-rc.11",
"core-js": "^3.0.1",
"format-json": "^1.0.3",
"lodash": "^4.17.15",
@ -51,5 +51,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-google-analytics",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "Storybook addon for google analytics",
"keywords": [
"addon",
@ -20,8 +20,8 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@storybook/addons": "5.3.0-rc.1",
"@storybook/core-events": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"@storybook/core-events": "5.3.0-rc.11",
"core-js": "^3.0.1",
"global": "^4.3.2",
"react-ga": "^2.5.7"
@ -29,5 +29,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-graphql",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "Storybook addon to display the GraphiQL IDE",
"keywords": [
"addon",
@ -29,8 +29,8 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@storybook/addons": "5.3.0-rc.1",
"@storybook/api": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"@storybook/api": "5.3.0-rc.11",
"core-js": "^3.0.1",
"global": "^4.3.2",
"graphiql": "^0.16.0",
@ -43,5 +43,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-info",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "A Storybook addon to show additional information for your stories.",
"keywords": [
"addon",
@ -28,10 +28,10 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@storybook/addons": "5.3.0-rc.1",
"@storybook/client-logger": "5.3.0-rc.1",
"@storybook/components": "5.3.0-rc.1",
"@storybook/theming": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"@storybook/client-logger": "5.3.0-rc.11",
"@storybook/components": "5.3.0-rc.11",
"@storybook/theming": "5.3.0-rc.11",
"core-js": "^3.0.1",
"global": "^4.3.2",
"marksy": "^8.0.0",
@ -53,5 +53,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-jest",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "React storybook addon that show component jest report",
"keywords": [
"addon",
@ -35,11 +35,11 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@storybook/addons": "5.3.0-rc.1",
"@storybook/api": "5.3.0-rc.1",
"@storybook/components": "5.3.0-rc.1",
"@storybook/core-events": "5.3.0-rc.1",
"@storybook/theming": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"@storybook/api": "5.3.0-rc.11",
"@storybook/components": "5.3.0-rc.11",
"@storybook/core-events": "5.3.0-rc.11",
"@storybook/theming": "5.3.0-rc.11",
"core-js": "^3.0.1",
"global": "^4.3.2",
"react": "^16.8.3",
@ -53,5 +53,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-knobs",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "Storybook Addon Prop Editor Component",
"keywords": [
"addon",
@ -29,12 +29,12 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@storybook/addons": "5.3.0-rc.1",
"@storybook/api": "5.3.0-rc.1",
"@storybook/client-api": "5.3.0-rc.1",
"@storybook/components": "5.3.0-rc.1",
"@storybook/core-events": "5.3.0-rc.1",
"@storybook/theming": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"@storybook/api": "5.3.0-rc.11",
"@storybook/client-api": "5.3.0-rc.11",
"@storybook/components": "5.3.0-rc.11",
"@storybook/core-events": "5.3.0-rc.11",
"@storybook/theming": "5.3.0-rc.11",
"@types/react-color": "^3.0.1",
"copy-to-clipboard": "^3.0.8",
"core-js": "^3.0.1",
@ -59,5 +59,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -2,7 +2,7 @@ type KnobsOptions = {
addDecorator?: boolean;
};
export function addons(entry: any[] = [], options: any) {
export function managerEntries(entry: any[] = [], options: any) {
return [...entry, require.resolve('../register')];
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-links",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "Story Links addon for storybook",
"keywords": [
"addon",
@ -29,11 +29,11 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@storybook/addons": "5.3.0-rc.1",
"@storybook/client-logger": "5.3.0-rc.1",
"@storybook/core-events": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"@storybook/client-logger": "5.3.0-rc.11",
"@storybook/core-events": "5.3.0-rc.11",
"@storybook/csf": "0.0.1",
"@storybook/router": "5.3.0-rc.1",
"@storybook/router": "5.3.0-rc.11",
"core-js": "^3.0.1",
"global": "^4.3.2",
"prop-types": "^15.7.2",
@ -46,5 +46,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-notes",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "Write notes for your Storybook stories.",
"keywords": [
"addon",
@ -30,13 +30,13 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@storybook/addons": "5.3.0-rc.1",
"@storybook/api": "5.3.0-rc.1",
"@storybook/client-logger": "5.3.0-rc.1",
"@storybook/components": "5.3.0-rc.1",
"@storybook/core-events": "5.3.0-rc.1",
"@storybook/router": "5.3.0-rc.1",
"@storybook/theming": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"@storybook/api": "5.3.0-rc.11",
"@storybook/client-logger": "5.3.0-rc.11",
"@storybook/components": "5.3.0-rc.11",
"@storybook/core-events": "5.3.0-rc.11",
"@storybook/router": "5.3.0-rc.11",
"@storybook/theming": "5.3.0-rc.11",
"core-js": "^3.0.1",
"global": "^4.3.2",
"markdown-to-jsx": "^6.10.3",
@ -55,5 +55,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-ondevice-actions",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "Action Logger addon for react-native storybook",
"keywords": [
"storybook"
@ -26,13 +26,13 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@storybook/addons": "5.3.0-rc.1",
"@storybook/core-events": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"@storybook/core-events": "5.3.0-rc.11",
"core-js": "^3.0.1",
"fast-deep-equal": "^2.0.1"
},
"devDependencies": {
"@storybook/addon-actions": "5.3.0-rc.1"
"@storybook/addon-actions": "5.3.0-rc.11"
},
"peerDependencies": {
"@storybook/addon-actions": "*",
@ -42,5 +42,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-ondevice-backgrounds",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "A react-native storybook addon to show different backgrounds for your preview",
"keywords": [
"addon",
@ -31,9 +31,9 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@storybook/addons": "5.3.0-rc.1",
"@storybook/api": "5.3.0-rc.1",
"@storybook/client-api": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"@storybook/api": "5.3.0-rc.11",
"@storybook/client-api": "5.3.0-rc.11",
"core-js": "^3.0.1",
"prop-types": "^15.7.2"
},
@ -44,5 +44,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-ondevice-knobs",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "Display storybook story knobs on your deviced.",
"keywords": [
"addon",
@ -28,8 +28,8 @@
},
"dependencies": {
"@emotion/native": "^10.0.14",
"@storybook/addons": "5.3.0-rc.1",
"@storybook/core-events": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"@storybook/core-events": "5.3.0-rc.11",
"core-js": "^3.0.1",
"deep-equal": "^1.0.1",
"prop-types": "^15.7.2",
@ -39,12 +39,12 @@
"react-native-switch": "^1.5.0"
},
"peerDependencies": {
"@storybook/addon-knobs": "5.3.0-rc.1",
"@storybook/addon-knobs": "5.3.0-rc.11",
"react": "*",
"react-native": "*"
},
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-ondevice-notes",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "Write notes for your react-native Storybook stories.",
"keywords": [
"addon",
@ -28,11 +28,11 @@
},
"dependencies": {
"@emotion/core": "^10.0.20",
"@storybook/addons": "5.3.0-rc.1",
"@storybook/api": "5.3.0-rc.1",
"@storybook/client-api": "5.3.0-rc.1",
"@storybook/client-logger": "5.3.0-rc.1",
"@storybook/core-events": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"@storybook/api": "5.3.0-rc.11",
"@storybook/client-api": "5.3.0-rc.11",
"@storybook/client-logger": "5.3.0-rc.11",
"@storybook/core-events": "5.3.0-rc.11",
"core-js": "^3.0.1",
"prop-types": "^15.7.2",
"react-native-simple-markdown": "^1.1.0"
@ -44,5 +44,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-options",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "Options addon for storybook",
"keywords": [
"addon",
@ -29,7 +29,7 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@storybook/addons": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"core-js": "^3.0.1",
"util-deprecate": "^1.0.2"
},
@ -39,5 +39,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-queryparams",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "parameter addon for storybook",
"keywords": [
"addon",
@ -30,12 +30,12 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@storybook/addons": "5.3.0-rc.1",
"@storybook/api": "5.3.0-rc.1",
"@storybook/client-logger": "5.3.0-rc.1",
"@storybook/components": "5.3.0-rc.1",
"@storybook/core-events": "5.3.0-rc.1",
"@storybook/theming": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"@storybook/api": "5.3.0-rc.11",
"@storybook/client-logger": "5.3.0-rc.11",
"@storybook/components": "5.3.0-rc.11",
"@storybook/core-events": "5.3.0-rc.11",
"@storybook/theming": "5.3.0-rc.11",
"core-js": "^3.0.1",
"global": "^4.3.2",
"qs": "^6.6.0",
@ -45,5 +45,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-storyshots",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "StoryShots is a Jest Snapshot Testing Addon for Storybook.",
"keywords": [
"addon",
@ -33,9 +33,9 @@
},
"dependencies": {
"@jest/transform": "^24.9.0",
"@storybook/addons": "5.3.0-rc.1",
"@storybook/client-api": "5.3.0-rc.1",
"@storybook/core": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"@storybook/client-api": "5.3.0-rc.11",
"@storybook/core": "5.3.0-rc.11",
"@types/glob": "^7.1.1",
"@types/jest": "^24.0.16",
"@types/jest-specific-snapshot": "^0.5.3",
@ -49,8 +49,8 @@
"ts-dedent": "^1.1.0"
},
"devDependencies": {
"@storybook/addon-docs": "5.3.0-rc.1",
"@storybook/react": "5.3.0-rc.1",
"@storybook/addon-docs": "5.3.0-rc.11",
"@storybook/react": "5.3.0-rc.11",
"babel-loader": "^8.0.6",
"enzyme-to-json": "^3.4.1",
"jest-emotion": "^10.0.17",
@ -59,5 +59,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-storyshots-puppeteer",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "Image snapshots addition to StoryShots based on puppeteer",
"keywords": [
"addon",
@ -29,25 +29,26 @@
"prepare": "node ../../../scripts/prepare.js"
},
"dependencies": {
"@hypnosphi/jest-puppeteer-axe": "^1.4.0",
"@storybook/csf": "0.0.1",
"@storybook/node-logger": "5.3.0-rc.1",
"@storybook/node-logger": "5.3.0-rc.11",
"@types/jest-image-snapshot": "^2.8.0",
"@wordpress/jest-puppeteer-axe": "^1.5.0",
"core-js": "^3.0.1",
"jest-image-snapshot": "^2.8.2",
"regenerator-runtime": "^0.13.3"
},
"devDependencies": {
"@storybook/csf": "0.0.1",
"@types/puppeteer": "^2.0.0"
},
"peerDependencies": {
"@storybook/addon-storyshots": "5.3.0-rc.1",
"@storybook/addon-storyshots": "5.3.0-rc.11",
"puppeteer": "^1.12.2 || ^2.0.0"
},
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a",
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff",
"peerDependenciesMeta": {
"puppeteer": {
"optional": true

View File

@ -1,46 +1,50 @@
import { toId } from '@storybook/csf';
import { constructUrl } from '../url';
jest.mock('@storybook/node-logger');
const id = toId('someKind', 'someStory');
describe('Construct URL for Storyshots', () => {
it('can use a url without path and without query params', () => {
expect(constructUrl('http://localhost:9001', 'someKind', 'someStory')).toEqual(
expect(constructUrl('http://localhost:9001', id)).toEqual(
'http://localhost:9001/iframe.html?id=somekind--somestory'
);
});
it('can use a url without path (but slash) and without query params', () => {
expect(constructUrl('http://localhost:9001/', 'someKind', 'someStory')).toEqual(
expect(constructUrl('http://localhost:9001/', id)).toEqual(
'http://localhost:9001/iframe.html?id=somekind--somestory'
);
});
it('can use a url without path and with query params', () => {
expect(constructUrl('http://localhost:9001?hello=world', 'someKind', 'someStory')).toEqual(
expect(constructUrl('http://localhost:9001?hello=world', id)).toEqual(
'http://localhost:9001/iframe.html?id=somekind--somestory&hello=world'
);
});
it('can use a url without path (buth slash) and with query params', () => {
expect(constructUrl('http://localhost:9001/?hello=world', 'someKind', 'someStory')).toEqual(
expect(constructUrl('http://localhost:9001/?hello=world', id)).toEqual(
'http://localhost:9001/iframe.html?id=somekind--somestory&hello=world'
);
});
it('can use a url with some path and query params', () => {
expect(
constructUrl('http://localhost:9001/nice-path?hello=world', 'someKind', 'someStory')
).toEqual('http://localhost:9001/nice-path/iframe.html?id=somekind--somestory&hello=world');
expect(constructUrl('http://localhost:9001/nice-path?hello=world', id)).toEqual(
'http://localhost:9001/nice-path/iframe.html?id=somekind--somestory&hello=world'
);
});
it('can use a url with some path (slash) and query params', () => {
expect(
constructUrl('http://localhost:9001/nice-path/?hello=world', 'someKind', 'someStory')
).toEqual('http://localhost:9001/nice-path/iframe.html?id=somekind--somestory&hello=world');
expect(constructUrl('http://localhost:9001/nice-path/?hello=world', id)).toEqual(
'http://localhost:9001/nice-path/iframe.html?id=somekind--somestory&hello=world'
);
});
it('can use a url with file protocol', () => {
expect(constructUrl('file://users/storybook', 'someKind', 'someStory')).toEqual(
expect(constructUrl('file://users/storybook', id)).toEqual(
'file://users/storybook/iframe.html?id=somekind--somestory'
);
});

View File

@ -1,4 +1,4 @@
import '@hypnosphi/jest-puppeteer-axe';
import '@wordpress/jest-puppeteer-axe';
import { defaultCommonConfig, CommonConfig } from './config';
import { puppeteerTest } from './puppeteerTest';

View File

@ -19,7 +19,7 @@ export const puppeteerTest = (customConfig: Partial<PuppeteerTestConfig> = {}) =
let page: Page; // Hold ref to the page to screenshot.
const testFn = async ({ context }: any) => {
const { kind, framework, name } = context;
const { kind, framework, name, id } = context;
if (framework === 'react-native') {
// Skip tests since RN is not a browser environment.
logger.error(
@ -29,7 +29,7 @@ export const puppeteerTest = (customConfig: Partial<PuppeteerTestConfig> = {}) =
return;
}
const url = constructUrl(storybookUrl, kind, name);
const url = constructUrl(storybookUrl, id);
const options = { context, url };
if (testBody.filter != null && !testBody.filter(options)) {
return;

View File

@ -1,10 +1,6 @@
import { toId } from '@storybook/csf';
import { URL } from 'url';
export const constructUrl = (storybookUrl: string, kind: string, story: string) => {
const id = toId(kind, story);
export const constructUrl = (storybookUrl: string, id: string) => {
const storyUrl = `/iframe.html?id=${id}`;
const { protocol, host, pathname, search } = new URL(storybookUrl);
const pname = pathname.replace(/\/$/, ''); // removes trailing /

View File

@ -18,29 +18,33 @@ You can add configuration for this addon by using a preset or by using the addon
### Install using preset
Add the following to your `.storybook/presets.js` exports:
Add the following to your `.storybook/main.js` exports:
```js
module.exports = ['@storybook/addon-storysource/preset'];
module.exports = {
addons: ['@storybook/addon-storysource'],
};
```
You can pass configurations into the addon-storysource loader in your `.storybook/presets.js` file, e.g.:
You can pass configurations into the addon-storysource loader in your `.storybook/main.js` file, e.g.:
```javascript
module.exports = [
{
name: '@storybook/addon-storysource/preset',
options: {
rule: {
// test: [/\.stories\.jsx?$/], This is default
include: [path.resolve(__dirname, '../src')], // You can specify directories
},
loaderOptions: {
prettierConfig: { printWidth: 80, singleQuote: false },
```js
module.exports = {
addons: [
{
name: '@storybook/addon-storysource',
options: {
rule: {
// test: [/\.stories\.jsx?$/], This is default
include: [path.resolve(__dirname, '../src')], // You can specify directories
},
loaderOptions: {
prettierConfig: { printWidth: 80, singleQuote: false },
},
},
},
},
];
],
};
```
## Loader Options

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-storysource",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "Stories addon for storybook",
"keywords": [
"addon",
@ -28,11 +28,11 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@storybook/addons": "5.3.0-rc.1",
"@storybook/components": "5.3.0-rc.1",
"@storybook/router": "5.3.0-rc.1",
"@storybook/source-loader": "5.3.0-rc.1",
"@storybook/theming": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"@storybook/components": "5.3.0-rc.11",
"@storybook/router": "5.3.0-rc.11",
"@storybook/source-loader": "5.3.0-rc.11",
"@storybook/theming": "5.3.0-rc.11",
"core-js": "^3.0.1",
"estraverse": "^4.2.0",
"loader-utils": "^1.2.3",
@ -49,5 +49,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -24,8 +24,8 @@ function webpack(webpackConfig = {}, options = {}) {
};
}
function addons(entry = []) {
function managerEntries(entry = []) {
return [...entry, require.resolve('@storybook/addon-storysource/register')];
}
module.exports = { webpack, addons };
module.exports = { webpack, managerEntries };

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-viewport",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "Storybook addon to change the viewport size to mobile",
"keywords": [
"addon",
@ -29,12 +29,12 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@storybook/addons": "5.3.0-rc.1",
"@storybook/api": "5.3.0-rc.1",
"@storybook/client-logger": "5.3.0-rc.1",
"@storybook/components": "5.3.0-rc.1",
"@storybook/core-events": "5.3.0-rc.1",
"@storybook/theming": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"@storybook/api": "5.3.0-rc.11",
"@storybook/client-logger": "5.3.0-rc.11",
"@storybook/components": "5.3.0-rc.11",
"@storybook/core-events": "5.3.0-rc.11",
"@storybook/theming": "5.3.0-rc.11",
"core-js": "^3.0.1",
"global": "^4.3.2",
"memoizerific": "^1.11.3",
@ -50,5 +50,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/angular",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "Storybook for Angular: Develop Angular Components in isolation with Hot Reloading.",
"keywords": [
"storybook"
@ -33,9 +33,9 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@storybook/addons": "5.3.0-rc.1",
"@storybook/core": "5.3.0-rc.1",
"@storybook/node-logger": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"@storybook/core": "5.3.0-rc.11",
"@storybook/node-logger": "5.3.0-rc.11",
"core-js": "^3.0.1",
"fork-ts-checker-webpack-plugin": "^3.0.1",
"global": "^4.3.2",
@ -72,5 +72,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/ember",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "Storybook for Ember: Develop Ember Component in isolation with Hot Reloading.",
"homepage": "https://github.com/storybookjs/storybook/tree/master/app/ember",
"bugs": {
@ -31,7 +31,7 @@
},
"dependencies": {
"@ember/test-helpers": "^1.5.0",
"@storybook/core": "5.3.0-rc.1",
"@storybook/core": "5.3.0-rc.11",
"core-js": "^3.0.1",
"global": "^4.3.2",
"regenerator-runtime": "^0.13.3",
@ -49,5 +49,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/html",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "Storybook for HTML: View HTML snippets in isolation with Hot Reloading.",
"keywords": [
"storybook"
@ -33,8 +33,8 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@storybook/addons": "5.3.0-rc.1",
"@storybook/core": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"@storybook/core": "5.3.0-rc.11",
"@types/webpack-env": "^1.13.9",
"core-js": "^3.0.1",
"global": "^4.3.2",
@ -51,5 +51,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/marko",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "Storybook for Marko: Develop Marko Component in isolation with Hot Reloading.",
"keywords": [
"storybook"
@ -33,8 +33,8 @@
},
"dependencies": {
"@marko/webpack": "^2.0.0",
"@storybook/client-logger": "5.3.0-rc.1",
"@storybook/core": "5.3.0-rc.1",
"@storybook/client-logger": "5.3.0-rc.11",
"@storybook/core": "5.3.0-rc.11",
"core-js": "^3.0.1",
"global": "^4.3.2",
"regenerator-runtime": "^0.13.3",
@ -50,5 +50,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/mithril",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "Storybook for Mithril: Develop Mithril Component in isolation.",
"keywords": [
"storybook"
@ -35,8 +35,8 @@
"dependencies": {
"@babel/core": "^7.6.2",
"@babel/plugin-transform-react-jsx": "^7.3.0",
"@storybook/addons": "5.3.0-rc.1",
"@storybook/core": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"@storybook/core": "5.3.0-rc.11",
"@types/mithril": "^2.0.0",
"core-js": "^3.0.1",
"global": "^4.3.2",
@ -56,5 +56,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/polymer",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "Storybook for Polymer: Develop Polymer components in isolation with Hot Reloading.",
"keywords": [
"storybook"
@ -32,7 +32,7 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@storybook/core": "5.3.0-rc.1",
"@storybook/core": "5.3.0-rc.11",
"@webcomponents/webcomponentsjs": "^1.2.0",
"core-js": "^3.0.1",
"global": "^4.3.2",
@ -55,5 +55,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/preact",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "Storybook for Preact: Develop Preact Component in isolation.",
"keywords": [
"storybook"
@ -34,8 +34,8 @@
},
"dependencies": {
"@babel/plugin-transform-react-jsx": "^7.3.0",
"@storybook/addons": "5.3.0-rc.1",
"@storybook/core": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"@storybook/core": "5.3.0-rc.11",
"@types/webpack-env": "^1.13.9",
"core-js": "^3.0.1",
"global": "^4.3.2",
@ -56,5 +56,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/rax",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "Storybook for Rax: Develop Rax Component in isolation.",
"keywords": [
"rax",
@ -33,7 +33,7 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@storybook/core": "5.3.0-rc.1",
"@storybook/core": "5.3.0-rc.11",
"babel-preset-rax": "^1.0.0-beta.0",
"core-js": "^3.0.1",
"driver-dom": "^2.0.0",
@ -51,5 +51,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/react-native-server",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "A better way to develop React Native Components for your app",
"keywords": [
"react",
@ -31,12 +31,12 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@storybook/addons": "5.3.0-rc.1",
"@storybook/api": "5.3.0-rc.1",
"@storybook/channel-websocket": "5.3.0-rc.1",
"@storybook/core": "5.3.0-rc.1",
"@storybook/core-events": "5.3.0-rc.1",
"@storybook/ui": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"@storybook/api": "5.3.0-rc.11",
"@storybook/channel-websocket": "5.3.0-rc.11",
"@storybook/core": "5.3.0-rc.11",
"@storybook/core-events": "5.3.0-rc.11",
"@storybook/ui": "5.3.0-rc.11",
"commander": "^4.0.1",
"core-js": "^3.0.1",
"global": "^4.3.2",
@ -55,5 +55,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/react-native",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "A better way to develop React Native Components for your app",
"keywords": [
"react",
@ -31,11 +31,11 @@
"dependencies": {
"@emotion/core": "^10.0.20",
"@emotion/native": "^10.0.14",
"@storybook/addons": "5.3.0-rc.1",
"@storybook/channel-websocket": "5.3.0-rc.1",
"@storybook/channels": "5.3.0-rc.1",
"@storybook/client-api": "5.3.0-rc.1",
"@storybook/core-events": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"@storybook/channel-websocket": "5.3.0-rc.11",
"@storybook/channels": "5.3.0-rc.11",
"@storybook/client-api": "5.3.0-rc.11",
"@storybook/core-events": "5.3.0-rc.11",
"core-js": "^3.0.1",
"emotion-theming": "^10.0.19",
"react-native-swipe-gestures": "^1.0.4"
@ -54,5 +54,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/react",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "Storybook for React: Develop React Component in isolation with Hot Reloading.",
"keywords": [
"storybook"
@ -36,14 +36,14 @@
"@babel/plugin-transform-react-constant-elements": "^7.2.0",
"@babel/preset-flow": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"@storybook/addons": "5.3.0-rc.1",
"@storybook/core": "5.3.0-rc.1",
"@storybook/node-logger": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"@storybook/core": "5.3.0-rc.11",
"@storybook/node-logger": "5.3.0-rc.11",
"@svgr/webpack": "^4.0.3",
"@types/webpack-env": "^1.13.7",
"babel-plugin-add-react-displayname": "^0.0.5",
"babel-plugin-named-asset-import": "^0.3.1",
"babel-plugin-react-docgen": "^4.0.0-beta.1",
"babel-plugin-react-docgen": "^4.0.0",
"core-js": "^3.0.1",
"global": "^4.3.2",
"lodash": "^4.17.15",
@ -72,5 +72,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/riot",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "Storybook for riot.js: View riot snippets in isolation with Hot Reloading.",
"keywords": [
"storybook"
@ -33,7 +33,7 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@storybook/core": "5.3.0-rc.1",
"@storybook/core": "5.3.0-rc.11",
"core-js": "^3.0.1",
"global": "^4.3.2",
"raw-loader": "^3.1.0",
@ -59,5 +59,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/svelte",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "Storybook for Svelte: Develop Svelte Component in isolation with Hot Reloading.",
"keywords": [
"storybook"
@ -33,8 +33,8 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@storybook/addons": "5.3.0-rc.1",
"@storybook/core": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"@storybook/core": "5.3.0-rc.11",
"core-js": "^3.0.1",
"global": "^4.3.2",
"regenerator-runtime": "^0.13.3",
@ -55,5 +55,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/vue",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "Storybook for Vue: Develop Vue Component in isolation with Hot Reloading.",
"keywords": [
"storybook"
@ -33,8 +33,8 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@storybook/addons": "5.3.0-rc.1",
"@storybook/core": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"@storybook/core": "5.3.0-rc.11",
"@types/webpack-env": "^1.13.9",
"core-js": "^3.0.1",
"global": "^4.3.2",
@ -63,5 +63,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -14,7 +14,7 @@ So you can develop UI components in isolation without worrying about app specifi
```sh
cd my-app
npx -p @storybook/cli sb init -t web-components
npx -p @storybook/cli sb init -t web_components
```
For more information visit: [storybook.js.org](https://storybook.js.org)

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/web-components",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "Storybook for web-components: View web components snippets in isolation with Hot Reloading.",
"keywords": [
"lit-html",
@ -37,8 +37,8 @@
"dependencies": {
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/plugin-syntax-import-meta": "^7.2.0",
"@storybook/addons": "5.3.0-rc.1",
"@storybook/core": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"@storybook/core": "5.3.0-rc.11",
"@types/webpack-env": "^1.13.9",
"babel-plugin-bundled-import-meta": "^0.3.1",
"core-js": "^3.0.1",
@ -59,5 +59,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-decorator",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "decorator addon for storybook",
"keywords": [
"addon",
@ -24,13 +24,13 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@storybook/addons": "5.3.0-rc.1",
"@storybook/client-api": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"@storybook/client-api": "5.3.0-rc.11",
"core-js": "^3.0.1",
"global": "^4.4.0"
},
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-parameter",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "parameter addon for storybook",
"keywords": [
"addon",
@ -24,12 +24,12 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@storybook/addons": "5.3.0-rc.1",
"@storybook/api": "5.3.0-rc.1",
"@storybook/client-logger": "5.3.0-rc.1",
"@storybook/components": "5.3.0-rc.1",
"@storybook/core-events": "5.3.0-rc.1",
"@storybook/theming": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"@storybook/api": "5.3.0-rc.11",
"@storybook/client-logger": "5.3.0-rc.11",
"@storybook/components": "5.3.0-rc.11",
"@storybook/core-events": "5.3.0-rc.11",
"@storybook/theming": "5.3.0-rc.11",
"core-js": "^3.0.1",
"global": "^4.3.2",
"react": "^16.8.3",
@ -38,5 +38,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-preview-wrapper",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "preview wrapper addon for storybook",
"keywords": [
"addon",
@ -24,11 +24,11 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@storybook/addons": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"react": "^16.8.3"
},
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -1,6 +1,6 @@
{
"name": "@storybook/addon-roundtrip",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"description": "roundtrip addon for storybook",
"keywords": [
"addon",
@ -24,13 +24,13 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@storybook/addons": "5.3.0-rc.1",
"@storybook/api": "5.3.0-rc.1",
"@storybook/client-api": "5.3.0-rc.1",
"@storybook/client-logger": "5.3.0-rc.1",
"@storybook/components": "5.3.0-rc.1",
"@storybook/core-events": "5.3.0-rc.1",
"@storybook/theming": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.11",
"@storybook/api": "5.3.0-rc.11",
"@storybook/client-api": "5.3.0-rc.11",
"@storybook/client-logger": "5.3.0-rc.11",
"@storybook/components": "5.3.0-rc.11",
"@storybook/core-events": "5.3.0-rc.11",
"@storybook/theming": "5.3.0-rc.11",
"core-js": "^3.0.1",
"global": "^4.3.2",
"react": "^16.8.3",
@ -39,5 +39,5 @@
"publishConfig": {
"access": "public"
},
"gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a"
"gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff"
}

View File

@ -9,18 +9,20 @@ For example, to write your stories in Typescript, rather than [manually configur
## Basic usage
Each preset has its own installation instructions, but the idea of presets is to install the preset and then load it.
Each preset has its own installation instructions, but the idea of presets is to install an addon and then load its preset.
For example, to get typescript support, first install the preset:
For example, to get typescript support, first install the addon:
```sh
yarn add @storybook/preset-typescript --dev
```
Then load it in the file `presets.js` in your storybook folder (`.storybook` by default):
Then load it in the file `main.js` in your storybook folder (`.storybook` by default):
```js
module.exports = ['@storybook/preset-typescript'];
module.exports = {
addons: ['@storybook/preset-typescript'],
};
```
That's it. When Storybook starts up, it will configure itself for typescript without any further configuration. For more information, see the Typescript preset [README](https://github.com/storybookjs/presets/tree/master/packages/preset-typescript).
@ -33,17 +35,19 @@ Consider this example:
```js
const path = require('path');
module.exports = [
{
name: '@storybook/preset-typescript',
options: {
tsDocgenLoaderOptions: {
tsconfigPath: path.resolve(__dirname, '../tsconfig.json'),
module.exports = {
addons: [
{
name: '@storybook/preset-typescript',
options: {
tsDocgenLoaderOptions: {
tsconfigPath: path.resolve(__dirname, '../tsconfig.json'),
},
include: [path.resolve(__dirname)],
},
include: [path.resolve(__dirname)],
},
},
];
],
};
```
This configures the typescript docgen loader using the app's `tsconfig.json` and also tells the typescript loaders to only be applied to the current directory.

View File

@ -79,14 +79,14 @@ export function webpackFinal(config, { configDir }) {
- `webpackFinal` is applied to the preview config after all user presets have been applied
- `webpackManager` is applied to the manager config
### Addons
### Manager entries
The addon config `addons` allows you to add addons to Storybook from within a preset. For addons that require custom webpack/babel configuration, it is easier to install the preset, and it will take care of everything.
The addon config `managerEntries` allows you to add addons to Storybook from within a preset. For addons that require custom webpack/babel configuration, it is easier to install the preset, and it will take care of everything.
For example, the Storysource preset contains the following code:
```js
export function addons(entry = []) {
export function managerEntries(entry = []) {
return [...entry, require.resolve('@storybook/addon-storysource/register')];
}
```
@ -95,8 +95,8 @@ This is equivalent to [registering the addon manually](../../addons/using-addons
```js
module.exports = {
addons: ['@storybook/addon-storysource/register']
}
managerEntries: ['@storybook/addon-storysource/register'],
};
```
### Entries
@ -128,7 +128,7 @@ module.exports = {
return config;
},
addons: [],
}
};
```
## Sharing advanced configuration
@ -162,7 +162,7 @@ module.exports = {
return config;
},
addons: [],
}
};
```
Place your `my-preset.js` file where ever you want, if you want to share if far and wide you'll want to make it it's own package.
Place your `my-preset.js` file where ever you want, if you want to share if far and wide you'll want to make it it's own package.

View File

@ -1 +1 @@
{"version":"5.3.0-rc.1","info":{"plain":"### Bug Fixes\n\n* Angular: Add default value to the budgets property ([#9207](https://github.com/storybookjs/storybook/pull/9207))\n* DocsPage: Fix title with new path separator scheme ([#9204](https://github.com/storybookjs/storybook/pull/9204))\n\n### Maintenance\n\n* CLI: Make template `stories` glob more permissive ([#9224](https://github.com/storybookjs/storybook/pull/9224))"}}
{"version":"5.3.0-rc.11","info":{"plain":"### Bug Fixes\n\n* Addon-Docs: Handle leaf/non-leaf mixture in docs-mode navigation ([#9321](https://github.com/storybookjs/storybook/pull/9321))\n\n### Dependency Upgrades\n\n* Axe storyshots: move to original @wordpress/jest-puppeteer-axe package ([#9337](https://github.com/storybookjs/storybook/pull/9337))"}}

View File

@ -1,6 +1,6 @@
{
"name": "crna-kitchen-sink",
"version": "5.3.0-rc.1",
"version": "5.3.0-rc.11",
"private": true,
"main": "node_modules/expo/AppEntry.js",
"workspaces": {
@ -31,15 +31,15 @@
"devDependencies": {
"@babel/core": "^7.2.2",
"@babel/plugin-transform-react-jsx-source": "^7.2.0",
"@storybook/addon-actions": "5.3.0-rc.1",
"@storybook/addon-knobs": "5.3.0-rc.1",
"@storybook/addon-links": "5.3.0-rc.1",
"@storybook/addon-ondevice-actions": "5.3.0-rc.1",
"@storybook/addon-ondevice-backgrounds": "5.3.0-rc.1",
"@storybook/addon-ondevice-knobs": "5.3.0-rc.1",
"@storybook/addon-ondevice-notes": "5.3.0-rc.1",
"@storybook/addons": "5.3.0-rc.1",
"@storybook/react-native": "5.3.0-rc.1",
"@storybook/addon-actions": "5.3.0-rc.11",
"@storybook/addon-knobs": "5.3.0-rc.11",
"@storybook/addon-links": "5.3.0-rc.11",
"@storybook/addon-ondevice-actions": "5.3.0-rc.11",
"@storybook/addon-ondevice-backgrounds": "5.3.0-rc.11",
"@storybook/addon-ondevice-knobs": "5.3.0-rc.11",
"@storybook/addon-ondevice-notes": "5.3.0-rc.11",
"@storybook/addons": "5.3.0-rc.11",
"@storybook/react-native": "5.3.0-rc.11",
"babel-loader": "^8.0.4",
"babel-plugin-module-resolver": "^3.2.0",
"babel-preset-expo": "^7.0.0",

View File

@ -1,15 +1,15 @@
module.exports = {
presets: ['@storybook/addon-docs/preset'],
stories: ['../src/stories/**/*.stories.(ts|mdx)'],
addons: [
'@storybook/addon-storysource/register',
'@storybook/addon-actions/register',
'@storybook/addon-links/register',
'@storybook/addon-notes/register',
'@storybook/addon-knobs/register',
'@storybook/addon-options/register',
'@storybook/addon-jest/register',
'@storybook/addon-backgrounds/register',
'@storybook/addon-a11y/register',
'@storybook/addon-docs',
'@storybook/addon-storysource',
'@storybook/addon-actions',
'@storybook/addon-links',
'@storybook/addon-notes',
'@storybook/addon-knobs',
'@storybook/addon-options',
'@storybook/addon-jest',
'@storybook/addon-backgrounds',
'@storybook/addon-a11y',
],
};

Some files were not shown because too many files have changed in this diff Show More