diff --git a/.github/workflows/linear-export.yml b/.github/workflows/linear-export.yml index f43331133aa0..1882d43d171b 100644 --- a/.github/workflows/linear-export.yml +++ b/.github/workflows/linear-export.yml @@ -12,12 +12,16 @@ jobs: name: Export to linear runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Install dependencies - run: yarn install - - name: Export to linear - run: > - yarn linear-export ${{ github.event.issue.number }} - env: - GH_TOKEN: ${{ secrets.LINEAR_GH_TOKEN }} - LINEAR_API_KEY: ${{ secrets.LINEAR_API_KEY }} + # - uses: hmarr/debug-action@v2 + - name: Linear action + uses: shilman/linear-action@v1 + with: + ghIssueNumber: ${{ github.event.number || github.event.issue.number }} + ghRepoOwner: ${{ github.event.repository.owner.login }} + ghRepoName: ${{ github.event.repository.name }} + ghToken: ${{ secrets.LINEAR_GH_TOKEN }} + linearIssuePrefix: SB + linearLabel: Storybook + linearPRLabel: PR + linearTeam: CH + linearApiKey: ${{ secrets.LINEAR_API_KEY }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 4725143ee4cf..6738bb7a31de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,56 @@ +## 6.4.0-rc.7 (November 24, 2021) + +### Bug Fixes + +- Core: Add `./` to start of hidden file & folder paths ([#16723](https://github.com/storybookjs/storybook/pull/16723)) + +### Dependency Upgrades + +- Update peer dependencies for angular 13 support ([#16758](https://github.com/storybookjs/storybook/pull/16758)) + +## 6.4.0-rc.6 (November 22, 2021) + +### Bug Fixes + +- CSF: Fix component id handling ([#16746](https://github.com/storybookjs/storybook/pull/16746)) +- Addon-docs: Improved loading state ([#16709](https://github.com/storybookjs/storybook/pull/16709)) + +### Maintenance + +- WebComponents: Update Lit peerDep to use Lit 2 stable version ([#16670](https://github.com/storybookjs/storybook/pull/16670)) + +### Dependency Upgrades + +- Upgrade react-router to 6.0.0 ([#16742](https://github.com/storybookjs/storybook/pull/16742)) + +## 6.4.0-rc.5 (November 19, 2021) + +### Bug Fixes + +- Core: Restore `stringifyEnvs` utility used by Vite builder ([#16731](https://github.com/storybookjs/storybook/pull/16731)) + +## 6.4.0-rc.4 (November 19, 2021) + +### Bug Fixes + +- Core: Fix `process.env` stringification ([#16725](https://github.com/storybookjs/storybook/pull/16725)) +- Core: Fix build-storybook sort bug in v6-mode ([#16724](https://github.com/storybookjs/storybook/pull/16724)) +- Addon-docs/Angular: fix extractEnumValues undefined error ([#16524](https://github.com/storybookjs/storybook/pull/16524)) + +### Maintenance + +- Angular: update addon interactions example ([#16698](https://github.com/storybookjs/storybook/pull/16698)) + +### Dependency Upgrades + +- Upgrade from node-sass to sass in examples/angular-cli ([#16663](https://github.com/storybookjs/storybook/pull/16663)) + +## 6.4.0-rc.3 (November 16, 2021) + +### Bug Fixes + +- Angular: Fix detection of @angular/cli package version ([#16696](https://github.com/storybookjs/storybook/pull/16696)) + ## 6.4.0-rc.2 (November 16, 2021) ### Features diff --git a/MIGRATION.md b/MIGRATION.md index e5cb03fb344a..c67da785fa7c 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -1,6 +1,7 @@

Migration

- [From version 6.3.x to 6.4.0](#from-version-63x-to-640) + - [Automigrate](#automigrate) - [CRA5 upgrade](#cra5-upgrade) - [CSF3 enabled](#csf3-enabled) - [Optional titles](#optional-titles) @@ -10,8 +11,8 @@ - [Behavioral differences](#behavioral-differences) - [Main.js framework field](#mainjs-framework-field) - [Using the v7 store](#using-the-v7-store) - - [V7-style story sort](#v7-style-story-sort) - - [V7 Store API changes for addon authors](#v7-store-api-changes-for-addon-authors) + - [v7-style story sort](#v7-style-story-sort) + - [v7 Store API changes for addon authors](#v7-store-api-changes-for-addon-authors) - [Storyshots compatibility in the v7 store](#storyshots-compatibility-in-the-v7-store) - [Emotion11 quasi-compatibility](#emotion11-quasi-compatibility) - [Babel mode v7](#babel-mode-v7) @@ -186,10 +187,25 @@ ## From version 6.3.x to 6.4.0 +### Automigrate + +Automigrate is a new 6.4 feature that provides zero-config upgrades to your dependencies, configurations, and story files. + +Each automigration analyzes your project, and if it's is applicable, propose a change alongside relevant documentation. If you accept the changes, the automigration will update your files accordingly. + +For example, if you're in a webpack5 project but still use Storybook's default webpack4 builder, the automigration can detect this and propose an upgrade. If you opt-in, it will install the webpack5 builder and update your `main.js` configuration automatically. + +You can run the existing suite of automigrations to see which ones apply to your project. This won't update any files unless you accept the changes: + +``` +npx sb@next automigrate +``` + +The automigration suite also runs when you create a new project (`sb init`) or when you update storybook (`sb upgrade`). + ### CRA5 upgrade -Storybook 6.3 supports CRA5 out of the box when you install it fresh. However, if you're upgrading your project from a previous version, you'll need to -upgrade the configuration. You can do this automatically by running: +Storybook 6.3 supports CRA5 out of the box when you install it fresh. However, if you're upgrading your project from a previous version, you'll need to upgrade the configuration. You can do this automatically by running: ``` npx sb@next automigrate diff --git a/addons/a11y/package.json b/addons/a11y/package.json index 16f4cd69bf27..5bd1826cf653 100644 --- a/addons/a11y/package.json +++ b/addons/a11y/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-a11y", - "version": "6.4.0-rc.2", + "version": "6.4.0-rc.7", "description": "Test component compliance with web accessibility standards", "keywords": [ "a11y", @@ -45,14 +45,14 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.4.0-rc.2", - "@storybook/api": "6.4.0-rc.2", - "@storybook/channels": "6.4.0-rc.2", - "@storybook/client-logger": "6.4.0-rc.2", - "@storybook/components": "6.4.0-rc.2", - "@storybook/core-events": "6.4.0-rc.2", + "@storybook/addons": "6.4.0-rc.7", + "@storybook/api": "6.4.0-rc.7", + "@storybook/channels": "6.4.0-rc.7", + "@storybook/client-logger": "6.4.0-rc.7", + "@storybook/components": "6.4.0-rc.7", + "@storybook/core-events": "6.4.0-rc.7", "@storybook/csf": "0.0.2--canary.87bc651.0", - "@storybook/theming": "6.4.0-rc.2", + "@storybook/theming": "6.4.0-rc.7", "axe-core": "^4.2.0", "core-js": "^3.8.2", "global": "^4.4.0", @@ -81,7 +81,7 @@ "publishConfig": { "access": "public" }, - "gitHead": "16be10b522569b4b55c684e1556b91b300009bf4", + "gitHead": "7162286c0d8d122c7206265fab41c4c191c86d40", "sbmodern": "dist/modern/index.js", "storybook": { "displayName": "Accessibility", diff --git a/addons/actions/package.json b/addons/actions/package.json index cffdf11cfe17..1142d358619a 100644 --- a/addons/actions/package.json +++ b/addons/actions/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-actions", - "version": "6.4.0-rc.2", + "version": "6.4.0-rc.7", "description": "Get UI feedback when an action is performed on an interactive element", "keywords": [ "storybook", @@ -41,12 +41,12 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.4.0-rc.2", - "@storybook/api": "6.4.0-rc.2", - "@storybook/components": "6.4.0-rc.2", - "@storybook/core-events": "6.4.0-rc.2", + "@storybook/addons": "6.4.0-rc.7", + "@storybook/api": "6.4.0-rc.7", + "@storybook/components": "6.4.0-rc.7", + "@storybook/core-events": "6.4.0-rc.7", "@storybook/csf": "0.0.2--canary.87bc651.0", - "@storybook/theming": "6.4.0-rc.2", + "@storybook/theming": "6.4.0-rc.7", "core-js": "^3.8.2", "fast-deep-equal": "^3.1.3", "global": "^4.4.0", @@ -79,7 +79,7 @@ "publishConfig": { "access": "public" }, - "gitHead": "16be10b522569b4b55c684e1556b91b300009bf4", + "gitHead": "7162286c0d8d122c7206265fab41c4c191c86d40", "sbmodern": "dist/modern/index.js", "storybook": { "displayName": "Actions", diff --git a/addons/backgrounds/package.json b/addons/backgrounds/package.json index 62fc469267c5..893ab2f2d9ac 100644 --- a/addons/backgrounds/package.json +++ b/addons/backgrounds/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-backgrounds", - "version": "6.4.0-rc.2", + "version": "6.4.0-rc.7", "description": "Switch backgrounds to view components in different settings", "keywords": [ "addon", @@ -45,13 +45,13 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.4.0-rc.2", - "@storybook/api": "6.4.0-rc.2", - "@storybook/client-logger": "6.4.0-rc.2", - "@storybook/components": "6.4.0-rc.2", - "@storybook/core-events": "6.4.0-rc.2", + "@storybook/addons": "6.4.0-rc.7", + "@storybook/api": "6.4.0-rc.7", + "@storybook/client-logger": "6.4.0-rc.7", + "@storybook/components": "6.4.0-rc.7", + "@storybook/core-events": "6.4.0-rc.7", "@storybook/csf": "0.0.2--canary.87bc651.0", - "@storybook/theming": "6.4.0-rc.2", + "@storybook/theming": "6.4.0-rc.7", "core-js": "^3.8.2", "global": "^4.4.0", "memoizerific": "^1.11.3", @@ -77,7 +77,7 @@ "publishConfig": { "access": "public" }, - "gitHead": "16be10b522569b4b55c684e1556b91b300009bf4", + "gitHead": "7162286c0d8d122c7206265fab41c4c191c86d40", "sbmodern": "dist/modern/index.js", "storybook": { "displayName": "Backgrounds", diff --git a/addons/controls/package.json b/addons/controls/package.json index c7c64c2b813b..6086b18ea0ef 100644 --- a/addons/controls/package.json +++ b/addons/controls/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-controls", - "version": "6.4.0-rc.2", + "version": "6.4.0-rc.7", "description": "Interact with component inputs dynamically in the Storybook UI", "keywords": [ "addon", @@ -45,15 +45,15 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.4.0-rc.2", - "@storybook/api": "6.4.0-rc.2", - "@storybook/client-logger": "6.4.0-rc.2", - "@storybook/components": "6.4.0-rc.2", - "@storybook/core-common": "6.4.0-rc.2", + "@storybook/addons": "6.4.0-rc.7", + "@storybook/api": "6.4.0-rc.7", + "@storybook/client-logger": "6.4.0-rc.7", + "@storybook/components": "6.4.0-rc.7", + "@storybook/core-common": "6.4.0-rc.7", "@storybook/csf": "0.0.2--canary.87bc651.0", - "@storybook/node-logger": "6.4.0-rc.2", - "@storybook/store": "6.4.0-rc.2", - "@storybook/theming": "6.4.0-rc.2", + "@storybook/node-logger": "6.4.0-rc.7", + "@storybook/store": "6.4.0-rc.7", + "@storybook/theming": "6.4.0-rc.7", "core-js": "^3.8.2", "lodash": "^4.17.20", "ts-dedent": "^2.0.0" @@ -73,7 +73,7 @@ "publishConfig": { "access": "public" }, - "gitHead": "16be10b522569b4b55c684e1556b91b300009bf4", + "gitHead": "7162286c0d8d122c7206265fab41c4c191c86d40", "sbmodern": "dist/modern/register.js", "storybook": { "displayName": "Controls", diff --git a/addons/docs/docs/recipes.md b/addons/docs/docs/recipes.md index 12940168fff3..db5681bdf07f 100644 --- a/addons/docs/docs/recipes.md +++ b/addons/docs/docs/recipes.md @@ -63,7 +63,8 @@ basic.parameters = { ```md import { Meta, Story } from '@storybook/addon-docs'; -import \* as stories from './Button.stories.js'; +import * as stories from './Button.stories.js'; +import { Button } from './Button'; import { SomeComponent } from 'path/to/SomeComponent'; diff --git a/addons/docs/package.json b/addons/docs/package.json index 2f7d75d2e30c..8dedf51955e6 100644 --- a/addons/docs/package.json +++ b/addons/docs/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-docs", - "version": "6.4.0-rc.2", + "version": "6.4.0-rc.7", "description": "Document component usage and properties in Markdown", "keywords": [ "addon", @@ -63,21 +63,21 @@ "@mdx-js/loader": "^1.6.22", "@mdx-js/mdx": "^1.6.22", "@mdx-js/react": "^1.6.22", - "@storybook/addons": "6.4.0-rc.2", - "@storybook/api": "6.4.0-rc.2", - "@storybook/builder-webpack4": "6.4.0-rc.2", - "@storybook/client-logger": "6.4.0-rc.2", - "@storybook/components": "6.4.0-rc.2", - "@storybook/core": "6.4.0-rc.2", - "@storybook/core-events": "6.4.0-rc.2", + "@storybook/addons": "6.4.0-rc.7", + "@storybook/api": "6.4.0-rc.7", + "@storybook/builder-webpack4": "6.4.0-rc.7", + "@storybook/client-logger": "6.4.0-rc.7", + "@storybook/components": "6.4.0-rc.7", + "@storybook/core": "6.4.0-rc.7", + "@storybook/core-events": "6.4.0-rc.7", "@storybook/csf": "0.0.2--canary.87bc651.0", - "@storybook/csf-tools": "6.4.0-rc.2", - "@storybook/node-logger": "6.4.0-rc.2", - "@storybook/postinstall": "6.4.0-rc.2", - "@storybook/preview-web": "6.4.0-rc.2", - "@storybook/source-loader": "6.4.0-rc.2", - "@storybook/store": "6.4.0-rc.2", - "@storybook/theming": "6.4.0-rc.2", + "@storybook/csf-tools": "6.4.0-rc.7", + "@storybook/node-logger": "6.4.0-rc.7", + "@storybook/postinstall": "6.4.0-rc.7", + "@storybook/preview-web": "6.4.0-rc.7", + "@storybook/source-loader": "6.4.0-rc.7", + "@storybook/store": "6.4.0-rc.7", + "@storybook/theming": "6.4.0-rc.7", "acorn": "^7.4.1", "acorn-jsx": "^5.3.1", "acorn-walk": "^7.2.0", @@ -106,11 +106,11 @@ "@babel/core": "^7.12.10", "@emotion/core": "^10.1.1", "@emotion/styled": "^10.0.27", - "@storybook/angular": "6.4.0-rc.2", - "@storybook/html": "6.4.0-rc.2", - "@storybook/react": "6.4.0-rc.2", - "@storybook/vue": "6.4.0-rc.2", - "@storybook/web-components": "6.4.0-rc.2", + "@storybook/angular": "6.4.0-rc.7", + "@storybook/html": "6.4.0-rc.7", + "@storybook/react": "6.4.0-rc.7", + "@storybook/vue": "6.4.0-rc.7", + "@storybook/web-components": "6.4.0-rc.7", "@types/cross-spawn": "^6.0.2", "@types/doctrine": "^0.0.3", "@types/enzyme": "^3.10.8", @@ -126,8 +126,8 @@ "fs-extra": "^9.0.1", "jest": "^26.6.3", "jest-specific-snapshot": "^4.0.0", - "lit-element": "^3.0.0-rc.2", - "lit-html": "^2.0.0-rc.3", + "lit-element": "^3.0.2", + "lit-html": "^2.0.2", "require-from-string": "^2.0.2", "rxjs": "^6.6.3", "styled-components": "^5.2.1", @@ -140,14 +140,14 @@ "zone.js": "^0.11.3" }, "peerDependencies": { - "@storybook/angular": "6.4.0-rc.2", - "@storybook/html": "6.4.0-rc.2", - "@storybook/react": "6.4.0-rc.2", - "@storybook/vue": "6.4.0-rc.2", - "@storybook/vue3": "6.4.0-rc.2", - "@storybook/web-components": "6.4.0-rc.2", - "lit": "^2.0.0-rc.1", - "lit-html": "^1.4.1 || ^2.0.0-rc.3", + "@storybook/angular": "6.4.0-rc.7", + "@storybook/html": "6.4.0-rc.7", + "@storybook/react": "6.4.0-rc.7", + "@storybook/vue": "6.4.0-rc.7", + "@storybook/vue3": "6.4.0-rc.7", + "@storybook/web-components": "6.4.0-rc.7", + "lit": "^2.0.0", + "lit-html": "^1.4.1 || ^2.0.0", "react": "^16.8.0 || ^17.0.0", "react-dom": "^16.8.0 || ^17.0.0", "svelte": "^3.31.2", @@ -202,7 +202,7 @@ "publishConfig": { "access": "public" }, - "gitHead": "16be10b522569b4b55c684e1556b91b300009bf4", + "gitHead": "7162286c0d8d122c7206265fab41c4c191c86d40", "sbmodern": "dist/modern/index.js", "storybook": { "displayName": "Docs", diff --git a/addons/docs/src/blocks/ArgsTable.tsx b/addons/docs/src/blocks/ArgsTable.tsx index 3820b6ea00bf..8efc0c5ecfd3 100644 --- a/addons/docs/src/blocks/ArgsTable.tsx +++ b/addons/docs/src/blocks/ArgsTable.tsx @@ -162,7 +162,7 @@ export const StoryTable: FC< const story = useStory(storyId, context); // eslint-disable-next-line prefer-const let [args, updateArgs, resetArgs] = useArgs(storyId, context); - if (!story) return ; + if (!story) return ; const argTypes = filterArgTypes(story.argTypes, include, exclude); diff --git a/addons/docs/src/frameworks/angular/compodoc.ts b/addons/docs/src/frameworks/angular/compodoc.ts index f56489da90fd..ec6d7037d0a9 100644 --- a/addons/docs/src/frameworks/angular/compodoc.ts +++ b/addons/docs/src/frameworks/angular/compodoc.ts @@ -120,7 +120,7 @@ const extractTypeFromValue = (defaultValue: any) => { const extractEnumValues = (compodocType: any) => { const compodocJson = getCompodocJson(); - const enumType = compodocJson?.miscellaneous.enumerations.find((x) => x.name === compodocType); + const enumType = compodocJson?.miscellaneous?.enumerations?.find((x) => x.name === compodocType); if (enumType?.childs.every((x) => x.value)) { return enumType.childs.map((x) => x.value); diff --git a/addons/docs/src/frameworks/web-components/sourceDecorator.ts b/addons/docs/src/frameworks/web-components/sourceDecorator.ts index 9cf5b9bec7e4..67d68c12af67 100644 --- a/addons/docs/src/frameworks/web-components/sourceDecorator.ts +++ b/addons/docs/src/frameworks/web-components/sourceDecorator.ts @@ -32,7 +32,7 @@ function applyTransformSource( export function sourceDecorator( storyFn: PartialStoryFn, context: StoryContext -) { +): WebComponentsFramework['storyResult'] { const story = context?.parameters.docs?.source?.excludeDecorators ? (context.originalStoryFn as ArgsStoryFn)(context.args, context) : storyFn(); diff --git a/addons/essentials/package.json b/addons/essentials/package.json index a3fda558f82a..1b80b799f848 100644 --- a/addons/essentials/package.json +++ b/addons/essentials/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-essentials", - "version": "6.4.0-rc.2", + "version": "6.4.0-rc.7", "description": "Curated addons to bring out the best of Storybook", "keywords": [ "addon", @@ -39,31 +39,31 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addon-actions": "6.4.0-rc.2", - "@storybook/addon-backgrounds": "6.4.0-rc.2", - "@storybook/addon-controls": "6.4.0-rc.2", - "@storybook/addon-docs": "6.4.0-rc.2", - "@storybook/addon-measure": "6.4.0-rc.2", - "@storybook/addon-outline": "6.4.0-rc.2", - "@storybook/addon-toolbars": "6.4.0-rc.2", - "@storybook/addon-viewport": "6.4.0-rc.2", - "@storybook/addons": "6.4.0-rc.2", - "@storybook/api": "6.4.0-rc.2", - "@storybook/node-logger": "6.4.0-rc.2", + "@storybook/addon-actions": "6.4.0-rc.7", + "@storybook/addon-backgrounds": "6.4.0-rc.7", + "@storybook/addon-controls": "6.4.0-rc.7", + "@storybook/addon-docs": "6.4.0-rc.7", + "@storybook/addon-measure": "6.4.0-rc.7", + "@storybook/addon-outline": "6.4.0-rc.7", + "@storybook/addon-toolbars": "6.4.0-rc.7", + "@storybook/addon-viewport": "6.4.0-rc.7", + "@storybook/addons": "6.4.0-rc.7", + "@storybook/api": "6.4.0-rc.7", + "@storybook/node-logger": "6.4.0-rc.7", "core-js": "^3.8.2", "regenerator-runtime": "^0.13.7", "ts-dedent": "^2.0.0" }, "devDependencies": { "@babel/core": "^7.12.10", - "@storybook/vue": "6.4.0-rc.2", + "@storybook/vue": "6.4.0-rc.7", "@types/jest": "^26.0.16", "@types/webpack-env": "^1.16.0" }, "peerDependencies": { "@babel/core": "^7.9.6", - "@storybook/vue": "6.4.0-rc.2", - "@storybook/web-components": "6.4.0-rc.2", + "@storybook/vue": "6.4.0-rc.7", + "@storybook/web-components": "6.4.0-rc.7", "babel-loader": "^8.0.0", "lit-html": "^1.4.1 || ^2.0.0-rc.3", "react": "^16.8.0 || ^17.0.0", @@ -93,6 +93,6 @@ "publishConfig": { "access": "public" }, - "gitHead": "16be10b522569b4b55c684e1556b91b300009bf4", + "gitHead": "7162286c0d8d122c7206265fab41c4c191c86d40", "sbmodern": "dist/modern/index.js" } diff --git a/addons/interactions/package.json b/addons/interactions/package.json index df8446c52135..65b1b661441b 100644 --- a/addons/interactions/package.json +++ b/addons/interactions/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-interactions", - "version": "6.4.0-rc.2", + "version": "6.4.0-rc.7", "description": "Automate, test and debug user interactions", "keywords": [ "storybook-addons", @@ -41,14 +41,14 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.4.0-rc.2", - "@storybook/api": "6.4.0-rc.2", - "@storybook/components": "6.4.0-rc.2", - "@storybook/core-common": "6.4.0-rc.2", - "@storybook/core-events": "6.4.0-rc.2", + "@storybook/addons": "6.4.0-rc.7", + "@storybook/api": "6.4.0-rc.7", + "@storybook/components": "6.4.0-rc.7", + "@storybook/core-common": "6.4.0-rc.7", + "@storybook/core-events": "6.4.0-rc.7", "@storybook/csf": "0.0.2--canary.87bc651.0", - "@storybook/instrumenter": "6.4.0-rc.2", - "@storybook/theming": "6.4.0-rc.2", + "@storybook/instrumenter": "6.4.0-rc.7", + "@storybook/theming": "6.4.0-rc.7", "global": "^4.4.0", "jest-mock": "^27.0.6", "polished": "^4.0.5", @@ -74,7 +74,7 @@ "publishConfig": { "access": "public" }, - "gitHead": "16be10b522569b4b55c684e1556b91b300009bf4", + "gitHead": "7162286c0d8d122c7206265fab41c4c191c86d40", "sbmodern": "dist/modern/index.js", "storybook": { "displayName": "Interactions", diff --git a/addons/jest/package.json b/addons/jest/package.json index 7f3b612f5c21..a4657d15a2e5 100644 --- a/addons/jest/package.json +++ b/addons/jest/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-jest", - "version": "6.4.0-rc.2", + "version": "6.4.0-rc.7", "description": "React storybook addon that show component jest report", "keywords": [ "addon", @@ -47,11 +47,11 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.4.0-rc.2", - "@storybook/api": "6.4.0-rc.2", - "@storybook/components": "6.4.0-rc.2", - "@storybook/core-events": "6.4.0-rc.2", - "@storybook/theming": "6.4.0-rc.2", + "@storybook/addons": "6.4.0-rc.7", + "@storybook/api": "6.4.0-rc.7", + "@storybook/components": "6.4.0-rc.7", + "@storybook/core-events": "6.4.0-rc.7", + "@storybook/theming": "6.4.0-rc.7", "core-js": "^3.8.2", "global": "^4.4.0", "react-sizeme": "^3.0.1", @@ -76,7 +76,7 @@ "publishConfig": { "access": "public" }, - "gitHead": "16be10b522569b4b55c684e1556b91b300009bf4", + "gitHead": "7162286c0d8d122c7206265fab41c4c191c86d40", "sbmodern": "dist/modern/index.js", "storybook": { "displayName": "Jest", diff --git a/addons/links/package.json b/addons/links/package.json index 19142dcc85bb..56bff0eb6278 100644 --- a/addons/links/package.json +++ b/addons/links/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-links", - "version": "6.4.0-rc.2", + "version": "6.4.0-rc.7", "description": "Link stories together to build demos and prototypes with your UI components", "keywords": [ "addon", @@ -41,11 +41,11 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.4.0-rc.2", - "@storybook/client-logger": "6.4.0-rc.2", - "@storybook/core-events": "6.4.0-rc.2", + "@storybook/addons": "6.4.0-rc.7", + "@storybook/client-logger": "6.4.0-rc.7", + "@storybook/core-events": "6.4.0-rc.7", "@storybook/csf": "0.0.2--canary.87bc651.0", - "@storybook/router": "6.4.0-rc.2", + "@storybook/router": "6.4.0-rc.7", "@types/qs": "^6.9.5", "core-js": "^3.8.2", "global": "^4.4.0", @@ -72,7 +72,7 @@ "publishConfig": { "access": "public" }, - "gitHead": "16be10b522569b4b55c684e1556b91b300009bf4", + "gitHead": "7162286c0d8d122c7206265fab41c4c191c86d40", "sbmodern": "dist/modern/index.js", "storybook": { "displayName": "Links", diff --git a/addons/measure/package.json b/addons/measure/package.json index af24d0dbfa17..2aa782dfa934 100644 --- a/addons/measure/package.json +++ b/addons/measure/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-measure", - "version": "6.4.0-rc.2", + "version": "6.4.0-rc.7", "description": "Inspect layouts by visualizing the box model", "keywords": [ "storybook-addons", @@ -44,11 +44,11 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.4.0-rc.2", - "@storybook/api": "6.4.0-rc.2", - "@storybook/client-logger": "6.4.0-rc.2", - "@storybook/components": "6.4.0-rc.2", - "@storybook/core-events": "6.4.0-rc.2", + "@storybook/addons": "6.4.0-rc.7", + "@storybook/api": "6.4.0-rc.7", + "@storybook/client-logger": "6.4.0-rc.7", + "@storybook/components": "6.4.0-rc.7", + "@storybook/core-events": "6.4.0-rc.7", "@storybook/csf": "0.0.2--canary.87bc651.0", "core-js": "^3.8.2", "global": "^4.4.0" @@ -71,7 +71,7 @@ "publishConfig": { "access": "public" }, - "gitHead": "16be10b522569b4b55c684e1556b91b300009bf4", + "gitHead": "7162286c0d8d122c7206265fab41c4c191c86d40", "sbmodern": "dist/modern/index.js", "storybook": { "displayName": "Measure", diff --git a/addons/outline/package.json b/addons/outline/package.json index 3c72c035db93..38c42efbb800 100644 --- a/addons/outline/package.json +++ b/addons/outline/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-outline", - "version": "6.4.0-rc.2", + "version": "6.4.0-rc.7", "description": "Outline all elements with CSS to help with layout placement and alignment", "keywords": [ "storybook-addons", @@ -47,11 +47,11 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.4.0-rc.2", - "@storybook/api": "6.4.0-rc.2", - "@storybook/client-logger": "6.4.0-rc.2", - "@storybook/components": "6.4.0-rc.2", - "@storybook/core-events": "6.4.0-rc.2", + "@storybook/addons": "6.4.0-rc.7", + "@storybook/api": "6.4.0-rc.7", + "@storybook/client-logger": "6.4.0-rc.7", + "@storybook/components": "6.4.0-rc.7", + "@storybook/core-events": "6.4.0-rc.7", "@storybook/csf": "0.0.2--canary.87bc651.0", "core-js": "^3.8.2", "global": "^4.4.0", @@ -76,7 +76,7 @@ "publishConfig": { "access": "public" }, - "gitHead": "16be10b522569b4b55c684e1556b91b300009bf4", + "gitHead": "7162286c0d8d122c7206265fab41c4c191c86d40", "sbmodern": "dist/modern/index.js", "storybook": { "displayName": "Outline", diff --git a/addons/storyshots/storyshots-core/package.json b/addons/storyshots/storyshots-core/package.json index 435dd6eaeb59..3cc033927a5f 100644 --- a/addons/storyshots/storyshots-core/package.json +++ b/addons/storyshots/storyshots-core/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-storyshots", - "version": "6.4.0-rc.2", + "version": "6.4.0-rc.7", "description": "Take a code snapshot of every story automatically with Jest", "keywords": [ "addon", @@ -45,12 +45,12 @@ }, "dependencies": { "@jest/transform": "^26.6.2", - "@storybook/addons": "6.4.0-rc.2", + "@storybook/addons": "6.4.0-rc.7", "@storybook/babel-plugin-require-context-hook": "1.0.1", - "@storybook/client-api": "6.4.0-rc.2", - "@storybook/core": "6.4.0-rc.2", - "@storybook/core-client": "6.4.0-rc.2", - "@storybook/core-common": "6.4.0-rc.2", + "@storybook/client-api": "6.4.0-rc.7", + "@storybook/core": "6.4.0-rc.7", + "@storybook/core-client": "6.4.0-rc.7", + "@storybook/core-common": "6.4.0-rc.7", "@storybook/csf": "0.0.2--canary.87bc651.0", "@types/glob": "^7.1.3", "@types/jest": "^26.0.16", @@ -69,11 +69,11 @@ "devDependencies": { "@angular/core": "^11.2.0", "@angular/platform-browser-dynamic": "^11.2.0", - "@storybook/addon-docs": "6.4.0-rc.2", - "@storybook/angular": "6.4.0-rc.2", - "@storybook/react": "6.4.0-rc.2", - "@storybook/vue": "6.4.0-rc.2", - "@storybook/vue3": "6.4.0-rc.2", + "@storybook/addon-docs": "6.4.0-rc.7", + "@storybook/angular": "6.4.0-rc.7", + "@storybook/react": "6.4.0-rc.7", + "@storybook/vue": "6.4.0-rc.7", + "@storybook/vue3": "6.4.0-rc.7", "babel-loader": "^8.0.0", "enzyme": "^3.11.0", "enzyme-to-json": "^3.6.1", @@ -151,7 +151,7 @@ "publishConfig": { "access": "public" }, - "gitHead": "16be10b522569b4b55c684e1556b91b300009bf4", + "gitHead": "7162286c0d8d122c7206265fab41c4c191c86d40", "storybook": { "displayName": "Storyshots", "icon": "https://user-images.githubusercontent.com/263385/101991676-48cdf300-3c7c-11eb-8aa1-944dab6ab29b.png", diff --git a/addons/storyshots/storyshots-puppeteer/package.json b/addons/storyshots/storyshots-puppeteer/package.json index ba694d369ef6..60d16fed7b12 100644 --- a/addons/storyshots/storyshots-puppeteer/package.json +++ b/addons/storyshots/storyshots-puppeteer/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-storyshots-puppeteer", - "version": "6.4.0-rc.2", + "version": "6.4.0-rc.7", "description": "Image snapshots addition to StoryShots based on puppeteer", "keywords": [ "addon", @@ -42,7 +42,7 @@ "dependencies": { "@axe-core/puppeteer": "^4.2.0", "@storybook/csf": "0.0.2--canary.87bc651.0", - "@storybook/node-logger": "6.4.0-rc.2", + "@storybook/node-logger": "6.4.0-rc.7", "@types/jest-image-snapshot": "^4.1.3", "core-js": "^3.8.2", "jest-image-snapshot": "^4.3.0", @@ -53,7 +53,7 @@ "@types/puppeteer": "^5.4.0" }, "peerDependencies": { - "@storybook/addon-storyshots": "6.4.0-rc.2", + "@storybook/addon-storyshots": "6.4.0-rc.7", "puppeteer": "^2.0.0 || ^3.0.0" }, "peerDependenciesMeta": { @@ -64,5 +64,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "16be10b522569b4b55c684e1556b91b300009bf4" + "gitHead": "7162286c0d8d122c7206265fab41c4c191c86d40" } diff --git a/addons/storysource/package.json b/addons/storysource/package.json index 000ace7e93c6..ba3b51729a33 100644 --- a/addons/storysource/package.json +++ b/addons/storysource/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-storysource", - "version": "6.4.0-rc.2", + "version": "6.4.0-rc.7", "description": "View a story’s source code to see how it works and paste into your app", "keywords": [ "addon", @@ -41,13 +41,13 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.4.0-rc.2", - "@storybook/api": "6.4.0-rc.2", - "@storybook/client-logger": "6.4.0-rc.2", - "@storybook/components": "6.4.0-rc.2", - "@storybook/router": "6.4.0-rc.2", - "@storybook/source-loader": "6.4.0-rc.2", - "@storybook/theming": "6.4.0-rc.2", + "@storybook/addons": "6.4.0-rc.7", + "@storybook/api": "6.4.0-rc.7", + "@storybook/client-logger": "6.4.0-rc.7", + "@storybook/components": "6.4.0-rc.7", + "@storybook/router": "6.4.0-rc.7", + "@storybook/source-loader": "6.4.0-rc.7", + "@storybook/theming": "6.4.0-rc.7", "core-js": "^3.8.2", "estraverse": "^5.2.0", "loader-utils": "^2.0.0", @@ -75,7 +75,7 @@ "publishConfig": { "access": "public" }, - "gitHead": "16be10b522569b4b55c684e1556b91b300009bf4", + "gitHead": "7162286c0d8d122c7206265fab41c4c191c86d40", "sbmodern": "dist/modern/index.js", "storybook": { "displayName": "Storysource", diff --git a/addons/toolbars/package.json b/addons/toolbars/package.json index 55756ec4223b..2c16a8eed392 100644 --- a/addons/toolbars/package.json +++ b/addons/toolbars/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-toolbars", - "version": "6.4.0-rc.2", + "version": "6.4.0-rc.7", "description": "Create your own toolbar items that control story rendering", "keywords": [ "addon", @@ -45,10 +45,10 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.4.0-rc.2", - "@storybook/api": "6.4.0-rc.2", - "@storybook/components": "6.4.0-rc.2", - "@storybook/theming": "6.4.0-rc.2", + "@storybook/addons": "6.4.0-rc.7", + "@storybook/api": "6.4.0-rc.7", + "@storybook/components": "6.4.0-rc.7", + "@storybook/theming": "6.4.0-rc.7", "core-js": "^3.8.2", "regenerator-runtime": "^0.13.7" }, @@ -67,7 +67,7 @@ "publishConfig": { "access": "public" }, - "gitHead": "16be10b522569b4b55c684e1556b91b300009bf4", + "gitHead": "7162286c0d8d122c7206265fab41c4c191c86d40", "sbmodern": "dist/modern/register.js", "storybook": { "displayName": "Toolbars", diff --git a/addons/viewport/package.json b/addons/viewport/package.json index 51400feb9d98..129aeccf445b 100644 --- a/addons/viewport/package.json +++ b/addons/viewport/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-viewport", - "version": "6.4.0-rc.2", + "version": "6.4.0-rc.7", "description": "Build responsive components by adjusting Storybook’s viewport size and orientation", "keywords": [ "addon", @@ -42,12 +42,12 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.4.0-rc.2", - "@storybook/api": "6.4.0-rc.2", - "@storybook/client-logger": "6.4.0-rc.2", - "@storybook/components": "6.4.0-rc.2", - "@storybook/core-events": "6.4.0-rc.2", - "@storybook/theming": "6.4.0-rc.2", + "@storybook/addons": "6.4.0-rc.7", + "@storybook/api": "6.4.0-rc.7", + "@storybook/client-logger": "6.4.0-rc.7", + "@storybook/components": "6.4.0-rc.7", + "@storybook/core-events": "6.4.0-rc.7", + "@storybook/theming": "6.4.0-rc.7", "core-js": "^3.8.2", "global": "^4.4.0", "memoizerific": "^1.11.3", @@ -69,7 +69,7 @@ "publishConfig": { "access": "public" }, - "gitHead": "16be10b522569b4b55c684e1556b91b300009bf4", + "gitHead": "7162286c0d8d122c7206265fab41c4c191c86d40", "sbmodern": "dist/modern/preview.js", "storybook": { "displayName": "Viewport", diff --git a/app/angular/package.json b/app/angular/package.json index d6ce08deb594..f017ca347eb0 100644 --- a/app/angular/package.json +++ b/app/angular/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/angular", - "version": "6.4.0-rc.2", + "version": "6.4.0-rc.7", "description": "Storybook for Angular: Develop Angular Components in isolation with Hot Reloading.", "keywords": [ "storybook" @@ -45,15 +45,15 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.4.0-rc.2", - "@storybook/api": "6.4.0-rc.2", - "@storybook/core": "6.4.0-rc.2", - "@storybook/core-common": "6.4.0-rc.2", - "@storybook/core-events": "6.4.0-rc.2", + "@storybook/addons": "6.4.0-rc.7", + "@storybook/api": "6.4.0-rc.7", + "@storybook/core": "6.4.0-rc.7", + "@storybook/core-common": "6.4.0-rc.7", + "@storybook/core-events": "6.4.0-rc.7", "@storybook/csf": "0.0.2--canary.87bc651.0", - "@storybook/node-logger": "6.4.0-rc.2", + "@storybook/node-logger": "6.4.0-rc.7", "@storybook/semver": "^7.3.2", - "@storybook/store": "6.4.0-rc.2", + "@storybook/store": "6.4.0-rc.7", "@types/webpack-env": "^1.16.0", "autoprefixer": "^9.8.6", "core-js": "^3.8.2", @@ -80,6 +80,7 @@ "@angular-devkit/architect": "~0.1102.0", "@angular-devkit/build-angular": "~0.1102.13", "@angular-devkit/core": "^11.2.13", + "@angular/cli": "^11.2.14", "@angular/common": "^11.2.14", "@angular/compiler": "^11.2.14", "@angular/compiler-cli": "^11.2.14", @@ -98,8 +99,9 @@ }, "peerDependencies": { "@angular-devkit/architect": ">=0.8.9", - "@angular-devkit/build-angular": ">=0.8.9", + "@angular-devkit/build-angular": ">=0.8.9 || >= 12.0.0", "@angular-devkit/core": "^0.6.1 || >=7.0.0", + "@angular/cli": ">=6.0.0", "@angular/common": ">=6.0.0", "@angular/compiler": ">=6.0.0", "@angular/compiler-cli": ">=6.0.0", @@ -111,11 +113,14 @@ "@babel/core": "*", "@nrwl/workspace": ">=11.1.0", "@webcomponents/custom-elements": ">=1.4.3", - "rxjs": "^6.0.0", + "rxjs": "^6.0.0 || ^7.4.0", "typescript": "^3.4.0 || >=4.0.0", "zone.js": "^0.8.29 || ^0.9.0 || ^0.10.0 || ^0.11.0" }, "peerDependenciesMeta": { + "@angular/cli": { + "optional": true + }, "@angular/elements": { "optional": true }, @@ -133,5 +138,5 @@ "access": "public" }, "builders": "dist/ts3.9/builders/builders.json", - "gitHead": "16be10b522569b4b55c684e1556b91b300009bf4" + "gitHead": "7162286c0d8d122c7206265fab41c4c191c86d40" } diff --git a/app/angular/src/server/framework-preset-angular-cli.ts b/app/angular/src/server/framework-preset-angular-cli.ts index 74a14765cf42..12bfbf2f371d 100644 --- a/app/angular/src/server/framework-preset-angular-cli.ts +++ b/app/angular/src/server/framework-preset-angular-cli.ts @@ -17,8 +17,7 @@ export async function webpackFinal(baseConfig: webpack.Configuration, options: P return baseConfig; } - const packageJson = await import(findUpSync('package.json', { cwd: options.configDir })); - const angularCliVersion = semver.coerce(packageJson.devDependencies['@angular/cli'])?.version; + const angularCliVersion = await import('@angular/cli').then((m) => semver.coerce(m.VERSION.full)); /** * Ordered array to use the specific getWebpackConfig according to some condition like angular-cli version diff --git a/app/ember/package.json b/app/ember/package.json index c69735e5eadc..34681daba321 100644 --- a/app/ember/package.json +++ b/app/ember/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/ember", - "version": "6.4.0-rc.2", + "version": "6.4.0-rc.7", "description": "Storybook for Ember: Develop Ember Component in isolation with Hot Reloading.", "homepage": "https://github.com/storybookjs/storybook/tree/main/app/ember", "bugs": { @@ -43,9 +43,9 @@ }, "dependencies": { "@ember/test-helpers": "^2.1.4", - "@storybook/core": "6.4.0-rc.2", - "@storybook/core-common": "6.4.0-rc.2", - "@storybook/store": "6.4.0-rc.2", + "@storybook/core": "6.4.0-rc.7", + "@storybook/core-common": "6.4.0-rc.7", + "@storybook/store": "6.4.0-rc.7", "core-js": "^3.8.2", "global": "^4.4.0", "react": "16.14.0", @@ -66,6 +66,6 @@ "publishConfig": { "access": "public" }, - "gitHead": "16be10b522569b4b55c684e1556b91b300009bf4", + "gitHead": "7162286c0d8d122c7206265fab41c4c191c86d40", "sbmodern": "dist/modern/client/index.js" } diff --git a/app/html/package.json b/app/html/package.json index 259f467a34a8..f5ae0c737435 100644 --- a/app/html/package.json +++ b/app/html/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/html", - "version": "6.4.0-rc.2", + "version": "6.4.0-rc.7", "description": "Storybook for HTML: View HTML snippets in isolation with Hot Reloading.", "keywords": [ "storybook" @@ -45,13 +45,13 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.4.0-rc.2", - "@storybook/client-api": "6.4.0-rc.2", - "@storybook/core": "6.4.0-rc.2", - "@storybook/core-common": "6.4.0-rc.2", + "@storybook/addons": "6.4.0-rc.7", + "@storybook/client-api": "6.4.0-rc.7", + "@storybook/core": "6.4.0-rc.7", + "@storybook/core-common": "6.4.0-rc.7", "@storybook/csf": "0.0.2--canary.87bc651.0", - "@storybook/preview-web": "6.4.0-rc.2", - "@storybook/store": "6.4.0-rc.2", + "@storybook/preview-web": "6.4.0-rc.7", + "@storybook/store": "6.4.0-rc.7", "@types/webpack-env": "^1.16.0", "core-js": "^3.8.2", "global": "^4.4.0", @@ -71,6 +71,6 @@ "publishConfig": { "access": "public" }, - "gitHead": "16be10b522569b4b55c684e1556b91b300009bf4", + "gitHead": "7162286c0d8d122c7206265fab41c4c191c86d40", "sbmodern": "dist/modern/client/index.js" } diff --git a/app/preact/package.json b/app/preact/package.json index f091bb485d1a..81a66fde532a 100644 --- a/app/preact/package.json +++ b/app/preact/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/preact", - "version": "6.4.0-rc.2", + "version": "6.4.0-rc.7", "description": "Storybook for Preact: Develop Preact Component in isolation.", "keywords": [ "storybook" @@ -46,11 +46,11 @@ }, "dependencies": { "@babel/plugin-transform-react-jsx": "^7.12.12", - "@storybook/addons": "6.4.0-rc.2", - "@storybook/core": "6.4.0-rc.2", - "@storybook/core-common": "6.4.0-rc.2", + "@storybook/addons": "6.4.0-rc.7", + "@storybook/core": "6.4.0-rc.7", + "@storybook/core-common": "6.4.0-rc.7", "@storybook/csf": "0.0.2--canary.87bc651.0", - "@storybook/store": "6.4.0-rc.2", + "@storybook/store": "6.4.0-rc.7", "@types/webpack-env": "^1.16.0", "core-js": "^3.8.2", "global": "^4.4.0", @@ -74,6 +74,6 @@ "publishConfig": { "access": "public" }, - "gitHead": "16be10b522569b4b55c684e1556b91b300009bf4", + "gitHead": "7162286c0d8d122c7206265fab41c4c191c86d40", "sbmodern": "dist/modern/client/index.js" } diff --git a/app/react/package.json b/app/react/package.json index 3fc631e81b10..3ad9aa4ae439 100644 --- a/app/react/package.json +++ b/app/react/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/react", - "version": "6.4.0-rc.2", + "version": "6.4.0-rc.7", "description": "Storybook for React: Develop React Component in isolation with Hot Reloading.", "keywords": [ "storybook" @@ -49,14 +49,14 @@ "@babel/preset-flow": "^7.12.1", "@babel/preset-react": "^7.12.10", "@pmmmwh/react-refresh-webpack-plugin": "^0.5.1", - "@storybook/addons": "6.4.0-rc.2", - "@storybook/core": "6.4.0-rc.2", - "@storybook/core-common": "6.4.0-rc.2", + "@storybook/addons": "6.4.0-rc.7", + "@storybook/core": "6.4.0-rc.7", + "@storybook/core-common": "6.4.0-rc.7", "@storybook/csf": "0.0.2--canary.87bc651.0", - "@storybook/node-logger": "6.4.0-rc.2", + "@storybook/node-logger": "6.4.0-rc.7", "@storybook/react-docgen-typescript-plugin": "1.0.2-canary.253f8c1.0", "@storybook/semver": "^7.3.2", - "@storybook/store": "6.4.0-rc.2", + "@storybook/store": "6.4.0-rc.7", "@types/webpack-env": "^1.16.0", "babel-plugin-add-react-displayname": "^0.0.5", "babel-plugin-named-asset-import": "^0.3.1", @@ -73,7 +73,7 @@ "webpack": "4" }, "devDependencies": { - "@storybook/client-api": "6.4.0-rc.2", + "@storybook/client-api": "6.4.0-rc.7", "@types/node": "^14.14.20", "@types/prompts": "^2.0.9" }, @@ -96,6 +96,6 @@ "publishConfig": { "access": "public" }, - "gitHead": "16be10b522569b4b55c684e1556b91b300009bf4", + "gitHead": "7162286c0d8d122c7206265fab41c4c191c86d40", "sbmodern": "dist/modern/client/index.js" } diff --git a/app/server/package.json b/app/server/package.json index 007a15dda11b..dab213d1cd37 100644 --- a/app/server/package.json +++ b/app/server/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/server", - "version": "6.4.0-rc.2", + "version": "6.4.0-rc.7", "description": "Storybook for Server: View HTML snippets from a server in isolation with Hot Reloading.", "keywords": [ "storybook" @@ -45,15 +45,15 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.4.0-rc.2", - "@storybook/api": "6.4.0-rc.2", - "@storybook/client-api": "6.4.0-rc.2", - "@storybook/core": "6.4.0-rc.2", - "@storybook/core-common": "6.4.0-rc.2", + "@storybook/addons": "6.4.0-rc.7", + "@storybook/api": "6.4.0-rc.7", + "@storybook/client-api": "6.4.0-rc.7", + "@storybook/core": "6.4.0-rc.7", + "@storybook/core-common": "6.4.0-rc.7", "@storybook/csf": "0.0.2--canary.87bc651.0", - "@storybook/node-logger": "6.4.0-rc.2", - "@storybook/preview-web": "6.4.0-rc.2", - "@storybook/store": "6.4.0-rc.2", + "@storybook/node-logger": "6.4.0-rc.7", + "@storybook/preview-web": "6.4.0-rc.7", + "@storybook/store": "6.4.0-rc.7", "@types/webpack-env": "^1.16.0", "core-js": "^3.8.2", "global": "^4.4.0", @@ -75,6 +75,6 @@ "publishConfig": { "access": "public" }, - "gitHead": "16be10b522569b4b55c684e1556b91b300009bf4", + "gitHead": "7162286c0d8d122c7206265fab41c4c191c86d40", "sbmodern": "dist/modern/client/index.js" } diff --git a/app/svelte/package.json b/app/svelte/package.json index 3c8f090c7514..20d38a664731 100644 --- a/app/svelte/package.json +++ b/app/svelte/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/svelte", - "version": "6.4.0-rc.2", + "version": "6.4.0-rc.7", "description": "Storybook for Svelte: Develop Svelte Component in isolation with Hot Reloading.", "keywords": [ "storybook" @@ -45,11 +45,11 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.4.0-rc.2", - "@storybook/core": "6.4.0-rc.2", - "@storybook/core-common": "6.4.0-rc.2", + "@storybook/addons": "6.4.0-rc.7", + "@storybook/core": "6.4.0-rc.7", + "@storybook/core-common": "6.4.0-rc.7", "@storybook/csf": "0.0.2--canary.87bc651.0", - "@storybook/store": "6.4.0-rc.2", + "@storybook/store": "6.4.0-rc.7", "core-js": "^3.8.2", "global": "^4.4.0", "react": "16.14.0", @@ -75,6 +75,6 @@ "publishConfig": { "access": "public" }, - "gitHead": "16be10b522569b4b55c684e1556b91b300009bf4", + "gitHead": "7162286c0d8d122c7206265fab41c4c191c86d40", "sbmodern": "dist/modern/client/index.js" } diff --git a/app/vue/package.json b/app/vue/package.json index 78270a41db24..ae1825cfca6e 100644 --- a/app/vue/package.json +++ b/app/vue/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/vue", - "version": "6.4.0-rc.2", + "version": "6.4.0-rc.7", "description": "Storybook for Vue: Develop Vue Component in isolation with Hot Reloading.", "keywords": [ "storybook" @@ -45,11 +45,11 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.4.0-rc.2", - "@storybook/core": "6.4.0-rc.2", - "@storybook/core-common": "6.4.0-rc.2", + "@storybook/addons": "6.4.0-rc.7", + "@storybook/core": "6.4.0-rc.7", + "@storybook/core-common": "6.4.0-rc.7", "@storybook/csf": "0.0.2--canary.87bc651.0", - "@storybook/store": "6.4.0-rc.2", + "@storybook/store": "6.4.0-rc.7", "@types/webpack-env": "^1.16.0", "core-js": "^3.8.2", "global": "^4.4.0", @@ -83,6 +83,6 @@ "publishConfig": { "access": "public" }, - "gitHead": "16be10b522569b4b55c684e1556b91b300009bf4", + "gitHead": "7162286c0d8d122c7206265fab41c4c191c86d40", "sbmodern": "dist/modern/client/index.js" } diff --git a/app/vue3/package.json b/app/vue3/package.json index 5951b0d7ec09..7c709873c89e 100644 --- a/app/vue3/package.json +++ b/app/vue3/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/vue3", - "version": "6.4.0-rc.2", + "version": "6.4.0-rc.7", "description": "Storybook for Vue 3: Develop Vue 3 Components in isolation with Hot Reloading.", "keywords": [ "storybook" @@ -45,11 +45,11 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "6.4.0-rc.2", - "@storybook/core": "6.4.0-rc.2", - "@storybook/core-common": "6.4.0-rc.2", + "@storybook/addons": "6.4.0-rc.7", + "@storybook/core": "6.4.0-rc.7", + "@storybook/core-common": "6.4.0-rc.7", "@storybook/csf": "0.0.2--canary.87bc651.0", - "@storybook/store": "6.4.0-rc.2", + "@storybook/store": "6.4.0-rc.7", "@types/webpack-env": "^1.16.0", "core-js": "^3.8.2", "global": "^4.4.0", @@ -81,6 +81,6 @@ "publishConfig": { "access": "public" }, - "gitHead": "16be10b522569b4b55c684e1556b91b300009bf4", + "gitHead": "7162286c0d8d122c7206265fab41c4c191c86d40", "sbmodern": "dist/modern/client/index.js" } diff --git a/app/web-components/package.json b/app/web-components/package.json index a5ff4e9ecf58..136f0411e9b2 100644 --- a/app/web-components/package.json +++ b/app/web-components/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/web-components", - "version": "6.4.0-rc.2", + "version": "6.4.0-rc.7", "description": "Storybook for web-components: View web components snippets in isolation with Hot Reloading.", "keywords": [ "lit-html", @@ -50,13 +50,13 @@ "@babel/plugin-syntax-dynamic-import": "^7.8.3", "@babel/plugin-syntax-import-meta": "^7.10.4", "@babel/preset-env": "^7.12.11", - "@storybook/addons": "6.4.0-rc.2", - "@storybook/client-api": "6.4.0-rc.2", - "@storybook/core": "6.4.0-rc.2", - "@storybook/core-common": "6.4.0-rc.2", + "@storybook/addons": "6.4.0-rc.7", + "@storybook/client-api": "6.4.0-rc.7", + "@storybook/core": "6.4.0-rc.7", + "@storybook/core-common": "6.4.0-rc.7", "@storybook/csf": "0.0.2--canary.87bc651.0", - "@storybook/preview-web": "6.4.0-rc.2", - "@storybook/store": "6.4.0-rc.2", + "@storybook/preview-web": "6.4.0-rc.7", + "@storybook/store": "6.4.0-rc.7", "@types/webpack-env": "^1.16.0", "babel-plugin-bundled-import-meta": "^0.3.1", "core-js": "^3.8.2", @@ -68,10 +68,10 @@ "ts-dedent": "^2.0.0" }, "devDependencies": { - "lit-html": "^2.0.0-rc.3" + "lit-html": "2.0.2" }, "peerDependencies": { - "lit-html": "^1.4.1 || ^2.0.0-rc.3" + "lit-html": "^1.4.1 || ^2.0.0" }, "engines": { "node": ">=10.13.0" @@ -79,6 +79,6 @@ "publishConfig": { "access": "public" }, - "gitHead": "16be10b522569b4b55c684e1556b91b300009bf4", + "gitHead": "7162286c0d8d122c7206265fab41c4c191c86d40", "sbmodern": "dist/modern/client/index.js" } diff --git a/docs/addons/writing-addons.md b/docs/addons/writing-addons.md index 573f0d1c49f4..7b3079ad94a0 100644 --- a/docs/addons/writing-addons.md +++ b/docs/addons/writing-addons.md @@ -187,6 +187,7 @@ When Storybook was initialized, it provided a small set of example stories. Chan + + -export function webpackFinal(config, { presets }) { - const version = await presets.apply('webpackVersion'); - const instance = (await presets.apply('webpackInstance'))?.default; + - logger.info(`=> Running in webpack ${version}: ${instance}`); - return config; -} -``` ### Manager entries @@ -110,30 +109,32 @@ This is equivalent to [registering the addon manually](../get-started/browse-sto ### Preview entries -The addon config `config` allows you to add extra preview configuration from within a preset, for example to add parameters or decorators from an addon. +The addon `config` function allows you to add extra preview configuration from within a preset, for example to add parameters or decorators from an addon. For example, the Backgrounds preset contains the following code: -```js -// preset.js -export function config(entry = []) { - return [...entry, require.resolve('./defaultParameters')]; -} -``` + + + + + + Which in turn invokes: -```js -// defaultParameters.js -export const parameters = { - backgrounds: { - values: [ - { name: 'light', value: '#F8F8F8' }, - { name: 'dark', value: '#333333' }, - ], - }, -}; -``` + + + + + This is equivalent to exporting the `backgrounds` parameter manually in `main.js`. diff --git a/docs/api/argtypes.md b/docs/api/argtypes.md index db77a4efd170..d8d5e9cf87fe 100644 --- a/docs/api/argtypes.md +++ b/docs/api/argtypes.md @@ -4,15 +4,15 @@ title: 'ArgTypes'
-NOTE: This API is experimental and may change outside of the typical semver release cycle +NOTE: This API is experimental and may change outside of the typical semver release cycle
-ArgTypes are a first-class feature in Storybook for specifying the behaviour of [Args](../writing-stories/args.md). By specifying the type of an arg you constrain the values that it can take and can also provide information about args that are not explicitly set (i.e. not required). +ArgTypes are a first-class feature in Storybook for specifying the behaviour of [Args](../writing-stories/args.md). By specifying the type of an arg, you constrain the values that it can take and provide information about args that are not explicitly set (i.e., not required). -You can also use argTypes to “annotate” args with information that is used by addons that make use of those args, for instance to instruct the controls addons to render a color choose for a string-valued arg. +You can also use argTypes to “annotate” args with information used by addons that make use of those args. For instance, to instruct the controls addon to render a color, you could choose a string-valued arg. -The most concrete realization of argTypes is the [Args Table](../writing-docs/doc-blocks.md#argstable) doc block. Each row in the table corresponds to a single argType, as well as the current value of that arg. +The most concrete realization of argTypes is the [Args Table](../writing-docs/doc-blocks.md#argstable) doc block. Each row in the table corresponds to a single argType and the current value of that arg. ![Storybook inferring automatically the argType](./argstable.png) @@ -34,7 +34,7 @@ To do so, Storybook uses various static analysis tools depending on your framewo - Ember - [YUI doc](https://github.com/ember-learn/ember-cli-addon-docs-yuidoc#documenting-components) -The format of the generated argType will look something like: +The format of the generated argType will look something like this: @@ -46,11 +46,11 @@ The format of the generated argType will look something like: -In this ArgTypes data structure, name, type, defaultValue, and description are standard fields in all ArgTypes (analogous to PropTypes in React). The table and control fields are addon-specific annotations. So, for example, the table annotation provides extra information to customize how label gets rendered, and the control annotation provides extra information for the control for editing the property. +This ArgTypes data structure, name, type, defaultValue, and description are standard fields in all ArgTypes (analogous to PropTypes in React). The table and control fields are addon-specific annotations. So, for example, the table annotation provides extra information to customize how the label gets rendered, and the control annotation includes additional information for the control editing the property.
-`@storybook/addon-docs` provide shorthand for common tasks: +💡 The `@storybook/addon-docs` provide a shorthand for common tasks: - `type: 'number'` is shorthand for type: { name: 'number' } - `control: 'radio'` is shorthand for control: { type: 'radio' } @@ -59,7 +59,7 @@ In this ArgTypes data structure, name, type, defaultValue, and description are s #### Manual specification -If you want more control over the args table or any other aspect of using argTypes, you can overwrite the generated argTypes for your component on a per-arg basis. For instance, with the above inferred argTypes and the following default export: +If you want more control over the args table or any other aspect of using argTypes, you can overwrite the generated argTypes for your component on a per-arg basis. For instance, with the above-inferred argTypes and the following default export: @@ -71,7 +71,7 @@ If you want more control over the args table or any other aspect of using argTyp -These values--description, table.type, and controls.type--get merged over the defaults that are extracted by Storybook. The final merged values would be: +The `values.description`, `table.type`, and `controls.type` are merged into the defaults extracted by Storybook. The final merged values would be: @@ -86,9 +86,7 @@ These values--description, table.type, and controls.type--get merged over the de In particular, this would render a row with a modified description, a type display with a dropdown that shows the detail, and no control.
- -As it happens with other properties such as `args`, `argTypes` can be overridden in a single story. - +💡 As with other Storybook properties (e.g., args, decorators), you can also override ArgTypes per story basis.
#### Using argTypes in addons @@ -103,4 +101,4 @@ If you want to access the argTypes of the current component inside an addon, you ]} /> - + \ No newline at end of file diff --git a/docs/api/cli-options.md b/docs/api/cli-options.md index 1011f5c4a1ea..953d12320b71 100644 --- a/docs/api/cli-options.md +++ b/docs/api/cli-options.md @@ -12,52 +12,58 @@ Pass these commands the following options to alter Storybook's behavior. Usage: start-storybook [options] ``` -| Options | Description | Example | -| ---------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------- | -| --help | Output usage information | `start-storybook --help` | -| -V, --version | Output the version number | `start-storybook -V` | -| -p, --port [number] | Port to run Storybook | `start-storybook -p 9009` | -| -h, --host [string] | Host to run Storybook | `start-storybook -h my-host.com` | -| -s, --static-dir `` | **[DEPRECATED]** Directory where to load static files from, comma-separated list | `start-storybook -s public` | -| -c, --config-dir [dir-name] | Directory where to load Storybook configurations from | `start-storybook -c .storybook` | -| --https | Serve Storybook over HTTPS. Note: You must provide your own certificate information. | `start-storybook --https` | -| --ssl-ca `` | Provide an SSL certificate authority. (Optional with --https, required if using a self-signed certificate) | `start-storybook --ssl-ca my-certificate` | -| --ssl-cert `` | Provide an SSL certificate. (Required with --https) | `start-storybook --ssl-cert my-ssl-certificate` | -| --ssl-key `` | Provide an SSL key. (Required with --https) | `start-storybook --ssl-key my-ssl-key` | -| --smoke-test | Exit after successful start | `start-storybook --smoke-test` | -| --ci | CI mode (skip interactive prompts, don't open browser) | `start-storybook --ci` | -| --no-open | Do not open Storybook automatically in the browser | `start-storybook --no-open` | -| --quiet | Suppress verbose build output | `start-storybook --quiet` | -| --no-dll | Do not use dll reference (no-op) | `start-storybook --no-dll` | -| --debug-webpack | Display final webpack configurations for debugging purposes | `start-storybook --debug-webpack` | -| `--webpack-stats-json ` | Write Webpack Stats JSON to disk | `start-storybook --webpack-stats-json /tmp/webpack-stats` | -| --docs | Starts Storybook in documentation mode. Learn more about it in [here](../writing-docs/build-documentation.md#preview-storybooks-documentation) | `start-storybook --docs` | -| --no-manager-cache | Disables Storybook's manager caching mechanism. See note below. | `start-storybook --no-manager-cache` | +| Options | Description | +| ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `--help` | Output usage information
`start-storybook --help` | +| `-V`, `--version` | Output the version number
`start-storybook -V` | +| `-p`, `--port [number]` | Port to run Storybook
`start-storybook -p 9009` | +| `-h`, `--host [string]` | Host to run Storybook
`start-storybook -h my-host.com` | +| `-s`, `--static-dir` | **Deprecated** [see note](#static-dir-deprecation). Directory where to load static files from, comma-separated list
`start-storybook -s public` | +| `-c`, `--config-dir [dir-name]` | Directory where to load Storybook configurations from
`start-storybook -c .storybook` | +| `--https` | Serve Storybook over HTTPS. Note: You must provide your own certificate information.
`start-storybook --https` | +| `--ssl-ca` | Provide an SSL certificate authority. (Optional with --https, required if using a self-signed certificate)
`start-storybook --ssl-ca my-certificate` | +| `--ssl-cert` | Provide an SSL certificate. (Required with --https)
`start-storybook --ssl-cert my-ssl-certificate` | +| `--ssl-key` | Provide an SSL key. (Required with --https)
`start-storybook --ssl-key my-ssl-key` | +| `--smoke-test` | Exit after successful start
`start-storybook --smoke-test` | +| `--ci` | CI mode (skip interactive prompts, don't open browser)
`start-storybook --ci` | +| `--no-open` | Do not open Storybook automatically in the browser
`start-storybook --no-open` | +| `--quiet` | Suppress verbose build output
`start-storybook --quiet` | +| `--no-dll` | Do not use dll reference (no-op)
`start-storybook --no-dll` | +| `--debug-webpack` | Display final webpack configurations for debugging purposes
`start-storybook --debug-webpack` | +| `--webpack-stats-json` | Write Webpack Stats JSON to disk
`start-storybook --webpack-stats-json /tmp/webpack-stats` | +| `--docs` | Starts Storybook in documentation mode. Learn more about it in [here](../writing-docs/build-documentation.md#preview-storybooks-documentation)
`start-storybook --docs` | +| `--no-manager-cache` | Disables Storybook's manager caching mechanism. See note below.
`start-storybook --no-manager-cache` |
💡 NOTE: The flag --no-manager-cache disables the internal caching of Storybook and can severely impact your Storybook loading time, so only use it when you need to refresh Storybook's UI, such as when editing themes.
+
+ +💡 NOTE: Starting in 6.4 the `-s` flag is deprecated. Instead, use a configuration object in your `.storybook/main.js` file. See the [images and assets documentation](../configure/images-and-assets.md#serving-static-files-via-storybook) for more information. + +
+ ## build-storybook ```plaintext Usage: build-storybook [options] ``` -| Options | Description | Example | -| ---------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------- | -| -h, --help | Output usage information | `build-storybook --help` | -| -V, --version | Output the version number | `build-storybook -V` | -| -s, --static-dir `` | **[DEPRECATED]** Directory where to load static files from, comma-separated list | `build-storybook -s public` | -| -o, --output-dir [dir-name] | Directory where to store built files | `build-storybook -o /my-deployed-storybook` | -| -c, --config-dir [dir-name] | Directory where to load Storybook configurations from | `build-storybook -c .storybook` | -| --loglevel [level] | Controls level of logging during build. Can be one of: [silly, verbose, info (default), warn, error, silent] | `build-storybook --loglevel warn` | -| --quiet | Suppress verbose build output | `build-storybook --quiet` | -| --no-dll | Do not use dll reference (no-op) | `build-storybook --no-dll` | -| --debug-webpack | Display final webpack configurations for debugging purposes | `build-storybook --debug-webpack` | -| `--webpack-stats-json ` | Write Webpack Stats JSON to disk | `build-storybook --webpack-stats-json /my-storybook/webpack-stats` | -| --docs | Builds Storybook in documentation mode. Learn more about it in [here](../writing-docs/build-documentation.md#publish-storybooks-documentation)) | `build-storybook --docs` | +| Options | Description | +| ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `-h`, `--help` | Output usage information
`build-storybook --help` | +| `-V`, `--version` | Output the version number
`build-storybook -V` | +| `-s`, `--static-dir` | **Deprecated** [see note](#static-dir-deprecation). Directory where to load static files from, comma-separated list
`build-storybook -s public` | +| `-o`, `--output-dir [dir-name]` | Directory where to store built files
`build-storybook -o /my-deployed-storybook` | +| `-c`, `--config-dir [dir-name]` | Directory where to load Storybook configurations from
`build-storybook -c .storybook` | +| `--loglevel [level]` | Controls level of logging during build. Can be one of: [silly, verbose, info (default), warn, error, silent]
`build-storybook --loglevel warn` | +| `--quiet` | Suppress verbose build output
`build-storybook --quiet` | +| `--no-dll` | Do not use dll reference (no-op)
`build-storybook --no-dll` | +| `--debug-webpack` | Display final webpack configurations for debugging purposes
`build-storybook --debug-webpack` | +| `--webpack-stats-json` | Write Webpack Stats JSON to disk
`build-storybook --webpack-stats-json /my-storybook/webpack-stats` | +| `--docs` | Builds Storybook in documentation mode. Learn more about it in [here](../writing-docs/build-documentation.md#publish-storybooks-documentation)
`build-storybook --docs` |
💡 NOTE: If you're using npm instead of yarn to publish Storybook, the commands work slightly different. For example, npm run build-storybook -- -o ./path/to/build. -
+
\ No newline at end of file diff --git a/docs/api/csf.md b/docs/api/csf.md index b2d26ad635d6..af8b1d8041cb 100644 --- a/docs/api/csf.md +++ b/docs/api/csf.md @@ -6,7 +6,7 @@ Component Story Format (CSF) is the recommended way to [write stories](../writin
-If you are writing stories in the older `storiesOf()` syntax, you can find documentation in an [advanced README](../../lib/core/docs/storiesOf.md). +💡 If you are writing stories in the older `storiesOf()` syntax, you can find documentation in an [advanced README](../../lib/core/docs/storiesOf.md).
@@ -18,7 +18,7 @@ CSF is supported in all frameworks except React Native, where you should use the The default export defines metadata about your component, including the `component` itself, its `title` (where it will show up in the [navigation UI story hierarchy](../writing-stories/naming-components-and-hierarchy.md#sorting-stories)), [decorators](../writing-stories/decorators.md), and [parameters](../writing-stories/parameters.md). -The `component` field is optional (but encouraged!), and is used by addons for automatic prop table generation and display of other component metadata. `title` should be unique, i.e. not re-used across files. +The `component` field is required and used by addons for automatic prop table generation and display of other component metadata. The `title` field is optional and should be unique (i.e., not re-used across files). @@ -34,16 +34,18 @@ For more examples, see [writing stories](../writing-stories/introduction.md). ## Named story exports -With CSF, every named export in the file represents a story function by default. +With CSF, every named export in the file represents a story object by default. @@ -59,11 +61,11 @@ The exported identifiers will be converted to "start case" using Lodash's [start | some_custom_NAME | Some Custom NAME | | someName1234 | Some Name 1 2 3 4 | -It's recommended to start export names with a capital letter. +We recommend that all export names to start with a capital letter. -Story functions can be annotated with a few different fields to define story-level [decorators](../writing-stories/decorators.md) and [parameters](../writing-stories/parameters.md), and also to define the `storyName` of the story. +Story objects can be annotated with a few different fields to define story-level [decorators](../writing-stories/decorators.md) and [parameters](../writing-stories/parameters.md), and also to define the `name` of the story. -The `storyName` is useful if you want to use names with special characters, names that correspond to restricted keywords in Javascript, or names that collide with other variables in the file. If it's not specified, the export name will be used instead. +Storybook's `name` configuration element is helpful in specific circumstances. Common use cases are names with special characters or Javascript restricted words. If not specified, Storybook defaults to the named export. @@ -86,10 +88,12 @@ Consider Storybook’s ["Button" example](../writing-stories/introduction.md#def @@ -104,13 +108,13 @@ Now consider the same example, re-written with args: 'react/button-story-click-handler-args.js.mdx', 'vue/button-story-click-handler-args.2.js.mdx', 'vue/button-story-click-handler-args.3.js.mdx', + 'angular/button-story-click-handler-args.ts.mdx', ]} /> - -At first blush this might seem no better than the original example. However, if we add the [Docs addon](https://github.com/storybookjs/storybook/tree/master/addons/docs) and configure the [Actions addon](https://github.com/storybookjs/storybook/tree/master/addons/actions) appropriately, we can write: +At first blush, this might seem no better than the original example. However, if we add the [Docs addon](https://github.com/storybookjs/storybook/tree/master/addons/docs) and configure the [Actions addon](https://github.com/storybookjs/storybook/tree/master/addons/actions) appropriately, we can write: @@ -131,24 +135,46 @@ Or even more simply: -Not only are these versions shorter and easier to write than their no-args counterparts, but they are also more portable since the code doesn't depend on the actions addon specifically. +Not only are these versions shorter and more accessible to write than their no-args counterparts, but they are also more portable since the code doesn't depend on the actions addon specifically. For more information on setting up [Docs](../writing-docs/introduction.md) and [Actions](../essentials/actions.md), see their respective documentation. -## Storybook export vs name handling +## Play function -Storybook handles named exports and `story.name` slightly differently. When should you use one vs. the other? +Storybook's `play` functions are small snippets of code executed when the story renders in the UI. They are convenient helper methods to help you test use cases that otherwise weren't possible or required user intervention. -The named export is always used to determine the story ID / URL. +A good use case for the `play` function is a form component. With previous Storybook versions, you'd write your set of stories and had to interact with the component to validate it. With Storybook's play functions, you could write the following story: -If you specify `story.name`, it will be used as the story display name in the UI. + + + + + + +When the story renders in the UI, Storybook executes each step defined in the `play` function and runs the assertions without the need for user interaction. + +## Storybook export vs. name handling + +Storybook handles named exports and the `name` option slightly differently. When should you use one vs. the other? + +Storybook will always use the named export to determine the story ID and URL. -If you don't specify `story.name`, the named export will be used to generate the display name. Storybook passes the named export through a `storyNameFromExport` function, which is implemented with `lodash.startCase`: +If you specify the `name` option, it will be used as the story display name in the UI. Otherwise, it defaults to the named export, processed through Storybook's `storyNameFromExport` and `lodash.startCase` functions. @@ -160,18 +186,18 @@ If you don't specify `story.name`, the named export will be used to generate the -When you want to change the name of your story, just rename the CSF export. This will change the name of the story and also change the story's ID and URL. +When you want to change the name of your story, rename the CSF export. It will change the name of the story and also change the story's ID and URL. -You should use the `story.name` option in the following cases: +It would be best if you used the `name` configuration element in the following cases: -1. You want the name to show up in the Storybook UI in a way that's not possible with a named export, e.g. reserved keywords like "default", special characters like emoji, spacing/capitalization other than what's provided by `storyNameFromExport`. -2. You want to preserve the Story ID independently from changing how it's displayed. Having stable Story ID's is useful for integration with third party tools. +1. You want the name to show up in the Storybook UI in a way that's not possible with a named export, e.g., reserved keywords like "default", special characters like emoji, spacing/capitalization other than what's provided by `storyNameFromExport`. +2. You want to preserve the Story ID independently from changing how it's displayed. Having stable Story IDs is helpful for integration with third-party tools. ## Non-story exports -In some cases, you may want to export a mixture of story and non-stories. For example, it can be useful to export data that's used in your stories. +In some cases, you may want to export a mixture of stories and non-stories (e.g., mocked data). -To make this possible, you can use optional `includeStories` and `excludeStories` configuration fields in the default export, which can be set to either an array of strings, or a regular expression. +You can use the optional configuration fields `includeStories` and `excludeStories` in the default export to make this possible. You can define them as an array of strings or regular expressions. Consider the following story file: @@ -180,16 +206,19 @@ Consider the following story file: -When Storybook loads this file, it will see all the exports, but it will ignore the data exports and only treat `SimpleStory` and `ComplexStory` as stories. +When this file renders in Storybook, it treats `ComplexStory` and `SimpleStory` as stories and ignores the `data` named exports. -For this specific example the equivalent result can be achieved in a few ways depending on what's convenient: +For this particular example, you could achieve the same result in different ways, depending on what's convenient: - `includeStories: /^[A-Z]/` - `includeStories: /.*Story$/` @@ -198,4 +227,4 @@ For this specific example the equivalent result can be achieved in a few ways de - `excludeStories: /.*Data$/` - `excludeStories: ['simpleData', 'complexData']` -If you follow the best practice of starting story exports with an uppercase letter (i.e. use UpperCamelCase), the first option is the recommended solution. +The first option is the recommended solution if you follow the best practice of starting story exports with an uppercase letter (i.e., use UpperCamelCase). \ No newline at end of file diff --git a/docs/api/frameworks-feature-support.md b/docs/api/frameworks-feature-support.md index 8b1ae823ed3d..94bab1ebf95c 100644 --- a/docs/api/frameworks-feature-support.md +++ b/docs/api/frameworks-feature-support.md @@ -16,4 +16,4 @@ Core frameworks have dedicated maintainers or contributors who are responsible f Community frameworks have fewer contributors which means they may not be as up to date as core frameworks. If you use one of these frameworks for your job, please consider contributing to its integration with Storybook. - + \ No newline at end of file diff --git a/docs/api/mdx.md b/docs/api/mdx.md index 61c2ca74dab8..4783ec5f12a3 100644 --- a/docs/api/mdx.md +++ b/docs/api/mdx.md @@ -20,27 +20,28 @@ Let's get started with an example that combines Markdown with a single story: -And here's how that's rendered in Storybook: +And here's how it renders in Storybook: ![Show a simple mdx example](./mdx-simple.png) -As you can see there's a lot going on here. We're writing Markdown, we're writing JSX, and somehow we're also defining Storybook stories that are drop-in compatible with the entire Storybook ecosystem. +As you can see, a lot is going on here. We're writing Markdown, we're writing JSX, and somehow we're also defining Storybook stories that are drop-in compatible with the entire Storybook ecosystem. Let's break it down. ## MDX-Flavored CSF -[MDX](https://mdxjs.com/) is a standard file format that combines Markdown with JSX. This means you can use Markdown’s terse syntax (such as `# heading`) for your documentation, and freely embed JSX component blocks at any point in the file. +[MDX](https://mdxjs.com/) is a standard file format that combines Markdown with JSX. It means you can use Markdown’s terse syntax (such as `# heading`) for your documentation and freely embed JSX component blocks at any point in the file. -MDX-flavored [Component Story Format (CSF)](https://medium.com/storybookjs/component-story-format-66f4c32366df) includes a collection of components called **"Doc Blocks"**, that allow Storybook to translate MDX files into storybook stories. MDX-defined stories are identical to regular Storybook stories, so they can be used with Storybook's entire ecosystem of addons and view layers. +MDX-flavored [Component Story Format (CSF)](https://medium.com/storybookjs/component-story-format-66f4c32366df) includes a collection of components called **"Doc Blocks"**, that allow Storybook to translate MDX files into Storybook stories. MDX-defined stories are identical to regular Storybook stories, so they can be used with Storybook's entire ecosystem of addons and view layers. -For example, here's the story from `Checkbox` example above, rewritten in CSF: +For example, here's the story from the `Checkbox` example above, rewritten in CSF: -There's a one-to-one mapping from the code in `MDX` to `CSF`, which in turn directly corresponds to Storybook's internal `storiesOf` API. As a user, this means your existing Storybook knowledge should translate between the three. And technically, this means that the transformations that happen under the hood are simple and predictable. +There's a one-to-one mapping from the code in `MDX` to `CSF`, which in turn directly corresponds to Storybook's internal `storiesOf` API. As a user, this means your existing Storybook knowledge should translate between the three constructs. And technically, this means that the transformations that happen under the hood are predictable and straightforward. ## Writing stories @@ -101,7 +102,7 @@ To add [decorators](../writing-docs/mdx.md#decorators-and-parameters) and [param -In addition, global decorators work just like before, e.g. adding the following to your [`.storybook/preview.js`](../configure/overview.md#configure-story-rendering): +In addition, global decorators work just like before, e.g., adding the following to your [`.storybook/preview.js`](../configure/overview.md#configure-story-rendering): @@ -113,20 +114,38 @@ In addition, global decorators work just like before, e.g. adding the following +### Play function + +Storybook's `play` functions are small snippets of code that run after the story loads. They're helpful methods to help test scenarios that otherwise would require user intervention. For example, if you're working on a login component and want to interact with it and verify the component's workflow, you could write the following story: + + + + + + + ## Documentation-only MDX -Typically, when you use Storybook MDX, you define stories in the MDX and the documentation is automatically associated with those stories. But what if you want to write Markdown-style documentation and have it show up in your Storybook? +Typically, when you use the MDX format, you define your stories and are automatically generated by Storybook. But what if you want to write Markdown-style documentation and have it show up in your Storybook? -If you don't define stories in your MDX, you can write MDX documentation and associate it with an existing story, or embed that MDX as its own documentation node in your Storybook's navigation. +Suppose you don't define stories in your MDX. In that case, you can write MDX documentation and associate it with an existing story or embed that MDX as its documentation node in your Storybook's navigation. -If you don't define a `Meta`, you can write Markdown and associate with an existing story. See ["CSF Stories with MDX Docs"](../writing-docs/mdx.md). +If you don't define a `Meta`, you can write Markdown and associate it with an existing story. See ["CSF Stories with MDX Docs"](../writing-docs/mdx.md). -To get a "documentation-only story", in your UI, define a `` as you normally would, but don't define any stories. It will show up in your UI as a documentation node: +To get a "documentation-only story" in your UI, define a `` as you usually would, but don't define any stories. It will show up in your UI as a documentation node: ![Show documentation](./mdx-documentation-only.png) ## MDX file names -Unless you use a custom webpack configuration, all of your `MDX` files should have the suffix `*.stories.mdx`. This tells Storybook to apply its special processing to the `` and `` elements in the file. +Unless you use a custom webpack configuration, all of your `MDX` files should have the suffix `*.stories.mdx`. It tells Storybook to apply its special processing to the `` and `` elements in the file. -Be sure to update your Storybook config file to load `.stories.mdx` stories, as per the [`addon-docs` installation instructions](https://github.com/storybookjs/storybook/tree/master/addons/docs#installation). +Be sure to update your Storybook config file to load `.stories.mdx` stories, as per the [`addon-docs` installation instructions](https://github.com/storybookjs/storybook/tree/master/addons/docs#installation). \ No newline at end of file diff --git a/docs/api/new-frameworks.md b/docs/api/new-frameworks.md index 5164c1af24f1..940417731bf1 100644 --- a/docs/api/new-frameworks.md +++ b/docs/api/new-frameworks.md @@ -2,33 +2,33 @@ title: 'Frameworks' --- -Storybook is architected to support diverse web frameworks including React, Vue, Angular, Web Components, Svelte and over a dozen others. This guide helps you get started on adding new framework support for Storybook. +Storybook is architected to support diverse web frameworks, including React, Vue, Angular, Web Components, Svelte, and over a dozen others. This guide helps you get started on adding new framework support for Storybook. ## Scaffolding a new framework -The first thing to do is scaffold your framework support in its own repo. +The first thing to do is to scaffold your framework support in its own repo. We recommend adopting the same project structure as the Storybook monorepo. That structure contains the framework package (`app/`) and an example app (`examples/-kitchen-sink`) as well as other associated documentation and configuration as needed. -This may seem like a little more hierarchy than what’s necessary. But because the structure mirrors the way Storybook’s own monorepo is structured, you can reuse Storybook’s tooling and it also makes it easier to move the framework into the Storybook into the monorepo at a later point if that is desirable. +It may seem like a little more hierarchy than what’s necessary. But because the structure mirrors the way Storybook’s monorepo is structured, you can reuse Storybook’s tooling. It also makes it easier to move the framework into the Storybook monorepo later if that is desirable. -We recommend using `@storybook/html` as a starter framework since it’s the simplest one and doesn’t contain any framework-specific oddities. There is a boilerplate to get you started [here](https://github.com/CodeByAlex/storybook-framework-boilerplate). +We recommend using `@storybook/html` as a starter framework since it’s the simplest and contains no framework-specific peculiarities. There is a boilerplate to get you started [here](https://github.com/CodeByAlex/storybook-framework-boilerplate). ## Framework architecture Supporting a new framework in Storybook typically consists of two main aspects: -1. Configuring the server. In Storybook, the server is the node process that runs when you `start-storybook` or `build-storybook`. Configuring the server typically means configuring babel and webpack in framework-specific ways. +1. Configuring the server. In Storybook, the server is the node process that runs when you run `start-storybook` or `build-storybook`. Configuring the server typically means configuring babel and webpack in framework-specific ways. -2. Configuring the client. The client is the code that runs in the browser. Configuring the client means providing a framework-specific story rendering function. +2. Configuring the client. The client is the code that runs in the browser, and configuring it, means providing a framework-specific story rendering function. ## Configuring the server -Storybook has the concept of [presets](../addons/writing-presets.md#presets-api), which are typically babel/webpack configurations for file loading. If your framework has its own file format, e.g. “.vue,” you might need to transform these files into JS files at load time. If you expect every user of your framework to need this, you should add it to the framework. So far every framework added to Storybook has done this, because Storybook’s core configuration is very minimal. +Storybook has the concept of [presets](../addons/writing-presets.md), which are typically babel/webpack configurations for file loading. If your framework has its own file format (e.g., “.vue”), you might need to transform them into JavaScript files at load time. If you assume every user of your framework needs this, you should add it to the framework. So far, every framework added to Storybook has done it because Storybook’s core configuration is extremely minimal. ### Package structure -To add a framework preset, it’s useful to understand the package structure. Each framework typically exposes two executables in its `package.json`: +It's helpful to understand Storybook's package structure before adding a framework preset. Each framework typically exposes two executables in its `package.json`: ```json { @@ -53,8 +53,7 @@ For example, here’s the boilerplate to start the dev server in `start-storyboo - -Thus the meat of adding framework presets is filling in that options object. +Thus the essence of adding framework presets is just filling in that options object. ### Server options @@ -72,36 +71,33 @@ Let’s look at the `@storybook/vue`’s options definition: -The value of the `framework` option (in this case ‘vue’) is something that gets passed to addons and allows them to do special case things for your framework. +The value of the `framework` option (i.e., ‘vue’) is something that gets passed to addons and allows them to do specific tasks related to your framework. -The real meat of this file is the framework presets, and these are standard [Storybook presets](./addons.md#addon-presets) -- you can look at framework packages in the Storybook monorepo (e.g. [React](https://github.com/storybookjs/storybook/blob/next/app/react/src/server/options.ts), [Vue](https://github.com/storybookjs/storybook/blob/next/app/vue/src/server/options.ts), [Web Components](https://github.com/storybookjs/storybook/blob/next/app/web-components/src/server/options.ts)) to see examples of framework-specific customizations. +The essence of this file is the framework presets, and these are standard [Storybook presets](../addons/writing-presets.md) -- you can look at framework packages in the Storybook monorepo (e.g. [React](https://github.com/storybookjs/storybook/blob/next/app/react/src/server/options.ts), [Vue](https://github.com/storybookjs/storybook/blob/next/app/vue/src/server/options.ts), [Web Components](https://github.com/storybookjs/storybook/blob/next/app/web-components/src/server/options.ts)) to see examples of framework-specific customizations. -When developing your own framework that is not published by storybook, you can pass the path to the framework location with the `frameworkPath` key: +While developing your custom framework, not maintained by Storybook, you can specify the path to the location file with the `frameworkPath` key: -```ts -// my-framework/src/server/options.ts + -import { sync } from 'read-pkg-up'; + -export default { - packageJson: sync({ cwd: __dirname }).packageJson, - framework: 'my-framework', - frameworkPath: '@my-framework/storybook', - frameworkPresets: [require.resolve('./framework-preset-my-framework.js')], -}; -``` + -Passing a relative path to `frameworkPath` is also possible, just keep in mind that these are resolved from the storybook config directory (`.storybook` by default). +You can add a relative path to `frameworkPath`. Don't forget that they resolve from the Storybook configuration directory (i.e., `.storybook`) by default. Make sure the `frameworkPath` ends up at the `dist/client/index.js` file within your framework app. ## Configuring the client -To configure the client, you must provide a framework specific render function. Before diving into the details, it’s important to understand how user-written stories relate to what is finally rendered on the screen. +To configure the client, you must provide a framework-specific render function. Before diving into the details, it’s essential to understand how user-written stories relate to what renders on the screen. ### Renderable objects -Storybook stories are ES6 functions that return a “renderable object.” +Storybook stories are ES6 objects that return a “renderable object.” Consider the following React story: @@ -117,7 +113,7 @@ Consider the following React story: In this case, the renderable object is the React element, ``, + template: ` + `, styleUrls: ['./button.css'], }) -export default class ButtonComponent { +export class ButtonComponent { /** * Checks if the button should be disabled */ @@ -23,4 +24,4 @@ export default class ButtonComponent { @Input() content: string; } -``` +``` \ No newline at end of file diff --git a/docs/snippets/angular/button-group-story.ts.mdx b/docs/snippets/angular/button-group-story.ts.mdx index ddebe9cc562c..ef7332db0db7 100644 --- a/docs/snippets/angular/button-group-story.ts.mdx +++ b/docs/snippets/angular/button-group-story.ts.mdx @@ -1,18 +1,21 @@ ```ts // ButtonGroup.stories.ts -import { Story, Meta } from '@storybook/angular/types-6-0'; +import { Meta, moduleMetadata, Story } from '@storybook/angular'; -import { moduleMetadata } from '@storybook/angular'; import { CommonModule } from '@angular/common'; -import ButtonGroup from './ButtonGroup.component'; -import Button from './button.component'; +import { ButtonGroup } from './ButtonGroup.component'; +import { Button } from './button.component'; //👇 Imports the Button stories import * as ButtonStories from './Button.stories'; export default { + /* 👇 The title prop is optional. + * See https://storybook.js.org/docs/angular/configure/overview#configure-story-loading + * to learn how to generate automatic titles + */ title: 'ButtonGroup', component: ButtonGroup, decorators: [ @@ -23,7 +26,7 @@ export default { ], } as Meta; -const Template: Story = (args) => ({ +const Template: Story = (args) => ({ props: args, }); @@ -35,4 +38,4 @@ Pair.args = { ], orientation: 'horizontal', }; -``` +``` \ No newline at end of file diff --git a/docs/snippets/angular/button-implementation.ts.mdx b/docs/snippets/angular/button-implementation.ts.mdx index 38ec77954319..d37ef9dc2811 100644 --- a/docs/snippets/angular/button-implementation.ts.mdx +++ b/docs/snippets/angular/button-implementation.ts.mdx @@ -7,7 +7,7 @@ import { Component, Input, Output, EventEmitter } from '@angular/core'; selector: 'button', template: `the component implementation markup`, }) -export default class ButtonComponent { +export class ButtonComponent { /** * Is this the principal call to action on the page? */ @@ -40,4 +40,4 @@ export default class ButtonComponent { @Output() onClick = new EventEmitter(); } -``` +``` \ No newline at end of file diff --git a/docs/snippets/angular/button-story-click-handler-args.ts.mdx b/docs/snippets/angular/button-story-click-handler-args.ts.mdx new file mode 100644 index 000000000000..7ed232bab028 --- /dev/null +++ b/docs/snippets/angular/button-story-click-handler-args.ts.mdx @@ -0,0 +1,28 @@ +```ts +// Button.stories.ts + +import { Meta, Story } from '@storybook/angular'; + +import { action } from '@storybook/addon-actions'; + +import { Button } from './button.component'; + +export default { + /* 👇 The title prop is optional. + * See https://storybook.js.org/docs/angular/configure/overview#configure-story-loading + * to learn how to generate automatic titles + */ + title: 'Button', + component: Button, +} as Meta; + +export const Text: Story = (args) => ({ + props: args, + template: ``, +}); + +Text.args = { + label: 'Hello', + onClick: action('clicked'), +}; +``` \ No newline at end of file diff --git a/docs/snippets/angular/button-story-click-handler-simplificated.ts.mdx b/docs/snippets/angular/button-story-click-handler-simplificated.ts.mdx new file mode 100644 index 000000000000..7cb711badc7c --- /dev/null +++ b/docs/snippets/angular/button-story-click-handler-simplificated.ts.mdx @@ -0,0 +1,20 @@ +```ts +// Button.stories.ts + +import { Meta, Story } from '@storybook/angular'; + +import { Button } from './button.component'; + +export default { + /* 👇 The title prop is optional. + * See https://storybook.js.org/docs/angular/configure/overview#configure-story-loading + * to learn how to generate automatic titles + */ + title: 'Button', + component: Button, +} as Meta; + +export const Text: Story = (args) => ({ + props: args, +}); +``` \ No newline at end of file diff --git a/docs/snippets/angular/button-story-click-handler.ts.mdx b/docs/snippets/angular/button-story-click-handler.ts.mdx new file mode 100644 index 000000000000..603e95d0fb45 --- /dev/null +++ b/docs/snippets/angular/button-story-click-handler.ts.mdx @@ -0,0 +1,25 @@ +```ts +// Button.stories.ts + +import { Meta, Story } from '@storybook/angular'; + +import { Button } from './button.component'; + +import { action } from '@storybook/addon-actions'; + +export default { + /* 👇 The title prop is optional. + * See https://storybook.js.org/docs/angular/configure/overview#configure-story-loading + * to learn how to generate automatic titles + */ + title: 'Button', + component: Button, +} as Meta; + +export const Text: Story = () => ({ + props: { + text: 'Hello Button', + onClick: action('clicked'), + }, +}); +``` \ No newline at end of file diff --git a/docs/snippets/angular/button-story-component-args-primary.mdx.mdx b/docs/snippets/angular/button-story-component-args-primary.mdx.mdx index aab7526697b5..a17e5fdaa840 100644 --- a/docs/snippets/angular/button-story-component-args-primary.mdx.mdx +++ b/docs/snippets/angular/button-story-component-args-primary.mdx.mdx @@ -3,9 +3,10 @@ import { Meta, Story } from '@storybook/addon-docs'; -import Button from './button.component'; +import { Button } from './button.component'; + + }} /> ``` \ No newline at end of file diff --git a/docs/snippets/angular/button-story-component-args-primary.ts.mdx b/docs/snippets/angular/button-story-component-args-primary.ts.mdx index 1f1cbe15cd60..882b9c223c73 100644 --- a/docs/snippets/angular/button-story-component-args-primary.ts.mdx +++ b/docs/snippets/angular/button-story-component-args-primary.ts.mdx @@ -1,11 +1,15 @@ ```ts // Button.stories.ts -import { Meta } from '@storybook/angular/types-6-0'; +import { Meta } from '@storybook/angular'; -import Button from './button.component'; +import { Button } from './button.component'; export default { + /* 👇 The title prop is optional. + * See https://storybook.js.org/docs/angular/configure/overview#configure-story-loading + * to learn how to generate automatic titles + */ title: 'Button', component: Button, //👇 Creates specific argTypes @@ -17,4 +21,4 @@ export default { primary: true, }, } as Meta; -``` +``` \ No newline at end of file diff --git a/docs/snippets/angular/button-story-component-decorator.mdx.mdx b/docs/snippets/angular/button-story-component-decorator.mdx.mdx index 9b68b3d32d6d..f58000f2659b 100644 --- a/docs/snippets/angular/button-story-component-decorator.mdx.mdx +++ b/docs/snippets/angular/button-story-component-decorator.mdx.mdx @@ -1,17 +1,17 @@ ```md -import { Meta, Story } from '@storybook/addon-docs'; +import { Meta } from '@storybook/addon-docs'; import { componentWrapperDecorator, moduleMetadata } from '@storybook/angular'; -import Button from './button.component'; +import { Button } from './button.component'; -import ParentComponent from './parent.component'; +import { ParentComponent } from './parent.component'; `
${story}
`) diff --git a/docs/snippets/angular/button-story-component-decorator.ts.mdx b/docs/snippets/angular/button-story-component-decorator.ts.mdx index db9b5bb8d803..82bbfb0fd821 100644 --- a/docs/snippets/angular/button-story-component-decorator.ts.mdx +++ b/docs/snippets/angular/button-story-component-decorator.ts.mdx @@ -1,14 +1,19 @@ ```ts // Button.stories.ts -import { componentWrapperDecorator, Meta, moduleMetadata, Story } from '@storybook/angular'; +import { componentWrapperDecorator, Meta, moduleMetadata } from '@storybook/angular'; -import { ButtonComponent } from './button.component'; -import { ParentComponent } from './parent.component'; +import { Button } from './button.component'; + +import { Parent } from './parent.component'; // Parent contains ng-content export default { - title: 'Components/Button', - component: ButtonComponent, + /* 👇 The title prop is optional. + * See https://storybook.js.org/docs/angular/configure/overview#configure-story-loading + * to learn how to generate automatic titles + */ + title: 'Button', + component: Button, decorators: [ moduleMetadata({ declarations: [ParentComponent], @@ -16,16 +21,7 @@ export default { // With template componentWrapperDecorator((story) => `
${story}
`), // With component which contains ng-content - componentWrapperDecorator(ParentComponent), + componentWrapperDecorator(Parent), ], } as Meta; - -const Template: Story = (args) => ({ - props: args, - template: '', -}); - -const Component: Story = (args) => ({ - props: args, -}); -``` +``` \ No newline at end of file diff --git a/docs/snippets/angular/button-story-decorator.mdx.mdx b/docs/snippets/angular/button-story-decorator.mdx.mdx index e27bfdd12b6e..ea2980777cca 100644 --- a/docs/snippets/angular/button-story-decorator.mdx.mdx +++ b/docs/snippets/angular/button-story-decorator.mdx.mdx @@ -1,36 +1,42 @@ ```md - + import { Meta, Story } from '@storybook/addon-docs'; -import { componentWrapperDecorator,moduleMetadata } from '@storybook/angular'; +import { componentWrapperDecorator, moduleMetadata } from '@storybook/angular'; -import Button from './button.component'; -import { ParentComponent } from './parent.component'; +import { Button } from './button.component'; - + +import { Parent } from './parent.component'; + + + + +export const Template = () => ({ + template: ``, +}); + `
${story}
`) - ]}> - {{ - template: ``, - }} + ]} > + {Template.bind({})}
+ - {{ - template: ``, - }} + componentWrapperDecorator(ParentComponent) + ]} > + {Template.bind({})} ``` \ No newline at end of file diff --git a/docs/snippets/angular/button-story-decorator.ts.mdx b/docs/snippets/angular/button-story-decorator.ts.mdx index 2ec5412685ae..58dcfdd08461 100644 --- a/docs/snippets/angular/button-story-decorator.ts.mdx +++ b/docs/snippets/angular/button-story-decorator.ts.mdx @@ -1,30 +1,38 @@ ```ts -// button.stories.ts +// Button.stories.mdx -import { Meta, Story, componentWrapperDecorator, moduleMetadata } from '@storybook/angular'; +import { componentWrapperDecorator, Meta, moduleMetadata, Story } from '@storybook/angular'; -import { ButtonComponent } from './button.component'; -import { ParentComponent } from './parent.component'; // ParentComponent contains ng-content +import { Button } from './button.component'; +import { Parent } from './parent.component'; // Parent contains ng-content export default { - title: 'Components/Button', - component: ButtonComponent, + /* 👇 The title prop is optional. + * See https://storybook.js.org/docs/angular/configure/overview#configure-story-loading + * to learn how to generate automatic titles + */ + title: 'Button', + component: Button, } as Meta; -export const Primary: Story = () => ({ +const Template: Story = (args) => ({ template: '', }); + +export const Primary = Template.bind({}); Primary.decorators = [ componentWrapperDecorator((story) => `
${story}
`), ]; -export const InsideParent: Story = () => ({ - template: '', -}); +export const Primary = { + decorators: [componentWrapperDecorator((story) => `
${story}
`)], +}; + +export const InsideParent= Template.bind({}); InsideParent.decorators = [ moduleMetadata({ - declarations: [ParentComponent], + declarations: [Parent], }), - componentWrapperDecorator(ParentComponent), + componentWrapperDecorator(Parent), ]; -``` +``` \ No newline at end of file diff --git a/docs/snippets/angular/button-story-default-docs-code.mdx.mdx b/docs/snippets/angular/button-story-default-docs-code.mdx.mdx index 2ac789306a27..22b41e4136dc 100644 --- a/docs/snippets/angular/button-story-default-docs-code.mdx.mdx +++ b/docs/snippets/angular/button-story-default-docs-code.mdx.mdx @@ -3,7 +3,7 @@ import { Meta, Story } from '@storybook/addon-docs'; -import Button from './button.component'; +import { Button } from './button.component'; { return `i am a ${someValue}`; }; -export const ExampleStory: Story