-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26424 from storybookjs/framework-doc-remaining
Docs: Bring frameworks docs to `next`
- Loading branch information
Showing
37 changed files
with
1,240 additions
and
332 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,3 @@ | ||
# Storybook for Svelte | ||
# Storybook for Svelte & Webpack | ||
|
||
Storybook for Svelte is a UI development environment for your Svelte components. | ||
With it, you can visualize different states of your UI components and develop them interactively. | ||
|
||
![Storybook Screenshot](https://github.com/storybookjs/storybook/blob/main/media/storybook-intro.gif) | ||
|
||
Storybook runs outside of your app. | ||
So you can develop UI components in isolation without worrying about app specific dependencies and requirements. | ||
|
||
## Getting Started | ||
|
||
```sh | ||
cd my-svelte-app | ||
npx storybook@latest init | ||
``` | ||
|
||
For more information visit: [storybook.js.org](https://storybook.js.org) | ||
|
||
--- | ||
|
||
Storybook also comes with a lot of [addons](https://storybook.js.org/addons) and a great API to customize as you wish. | ||
You can also build a [static version](https://storybook.js.org/docs/svelte/sharing/publish-storybook) of your Storybook and deploy it anywhere you want. | ||
|
||
## TODOs | ||
|
||
- Support `addon-info` | ||
- Support Svelte markup directly in stories | ||
- Add Svelte storybook generator | ||
- Provide stories that show advanced Svelte use cases | ||
- Hydratable | ||
- Advanced mount options | ||
See [documentation](https://storybook.js.org/docs/8.0/get-started/svelte-webpack5?renderer=svelte) for installation instructions, usage examples, APIs, and more. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,3 @@ | ||
# Storybook for Vue 3 and Webpack | ||
|
||
Storybook for Vue 3 is a UI development environment for your Vue 3 components. | ||
With it, you can visualize different states of your UI components and develop them interactively. | ||
|
||
![Storybook Screenshot](https://github.com/storybookjs/storybook/blob/main/media/storybook-intro.gif) | ||
|
||
Storybook runs outside of your app. | ||
So you can develop UI components in isolation without worrying about app specific dependencies and requirements. | ||
|
||
## Getting Started | ||
|
||
```sh | ||
cd my-vue3-app | ||
npx storybook@latest init | ||
``` | ||
|
||
For more information visit: [storybook.js.org](https://storybook.js.org) | ||
|
||
--- | ||
|
||
Storybook also comes with a lot of [addons](https://storybook.js.org/addons) and a great API to customize as you wish. | ||
You can also build a [static version](https://storybook.js.org/docs/sharing/publish-storybook) of your Storybook and deploy it anywhere you want. | ||
|
||
## Extending the Vue application | ||
|
||
Storybook creates a [Vue 3 application](https://vuejs.org/api/application.html#application-api) for your component preview. | ||
When using global custom components (`app.component`), directives (`app.directive`), extensions (`app.use`), or other application methods, you will need to configure those in the `./storybook/preview.js` file. | ||
|
||
Therefore, Storybook provides you with a `setup` function exported from this package, which receives as a callback your Storybook instance, which you can interact with and add your custom configuration. | ||
|
||
```js | ||
// .storybook/preview.js | ||
|
||
import { setup } from '@storybook/vue3'; | ||
|
||
setup((app) => { | ||
app.use(MyPlugin); | ||
app.component('my-component', MyComponent); | ||
app.mixin({ | ||
/* My mixin */ | ||
}); | ||
}); | ||
``` | ||
See [documentation](https://storybook.js.org/docs/8.0/get-started/vue3-webpack5?renderer=vue) for installation instructions, usage examples, APIs, and more. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
# Storybook for Web components | ||
# Storybook for Web components & Vite | ||
|
||
See [documentation](https://storybook.js.org/docs/8.0/get-started/web-components-vite?renderer=web-components) for installation instructions, usage examples, APIs, and more. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,3 @@ | ||
# Storybook for web-components | ||
# Storybook for Web components & Webpack | ||
|
||
--- | ||
|
||
Storybook for web-components is a UI development environment for your plain web-component snippets. | ||
With it, you can visualize different states of your UI components and develop them interactively. | ||
|
||
![Storybook Screenshot](https://github.com/storybookjs/storybook/blob/main/media/storybook-intro.gif) | ||
|
||
Storybook runs outside of your app. | ||
So you can develop UI components in isolation without worrying about app specific dependencies and requirements. | ||
|
||
## Getting Started | ||
|
||
```sh | ||
cd my-app | ||
npx storybook@latest init -t web_components | ||
``` | ||
|
||
For more information visit: [storybook.js.org](https://storybook.js.org) | ||
|
||
--- | ||
|
||
Storybook also comes with a lot of [addons](https://storybook.js.org/addons) and a great API to customize as you wish. | ||
You can also build a [static version](https://storybook.js.org/docs/web-components/sharing/publish-storybook) of your storybook and deploy it anywhere you want. | ||
|
||
# Hot Module Reloading (HMR) | ||
|
||
As web components register on a global registry which only accepts a certain name/class once it can lead to errors when using classical HMR. There are ideas on how to archive HMR with a static registry but there is no proven solution yet. Therefore the best approach for now is to do full page reloads. If you keep your stories to specific states of components (which we would recommend anyways) this usually means it is fast. | ||
|
||
# Setup es6/7 dependencies | ||
|
||
By default storybook only works with precompiled ES5 code but as most web components themselves and their libs are distributed as ES2017 you will need to manually mark those packages as "needs transpilation". | ||
|
||
For example if you have a library called `my-library` which is in ES2017 then you can add it like so | ||
|
||
```js | ||
// .storybook/main.js | ||
|
||
export default { | ||
webpackFinal: async (config) => { | ||
// find web-components rule for extra transpilation | ||
const webComponentsRule = config.module.rules.find( | ||
(rule) => rule.use && rule.use.options && rule.use.options.babelrc === false | ||
); | ||
// add your own `my-library` | ||
webComponentsRule.test.push(new RegExp(`node_modules(\\/|\\\\)my-library(.*)\\.js$`)); | ||
|
||
return config; | ||
}, | ||
}; | ||
``` | ||
|
||
By default the following folders are included | ||
|
||
- `src/*.js` | ||
- `packages/*/src/*.js` | ||
- `node_modules/lit-html/*.js` | ||
- `node_modules/lit-element/*.js` | ||
- `node_modules/@open-wc/*.js` | ||
- `node_modules/@polymer/*.js` | ||
- `node_modules/@vaadin/*.js` | ||
|
||
As you can see the `src` folder is also included. | ||
The reason for that is as it has some extra configuration to allow for example `import.meta`. | ||
If you use a different folder you will need to make sure webpack/babel can handle it. | ||
|
||
# FAQ | ||
|
||
- While working on my component I get the error `Failed to execute 'define' on 'CustomElementRegistry': the name "..." has already been used with this registry` | ||
=> please see <a href="#user-content-setup-page-reload-via-hmr">Setup page reload via HMR</a> | ||
See [documentation](https://storybook.js.org/docs/8.0/get-started/web-components-webpack5?renderer=web-components) for installation instructions, usage examples, APIs, and more. |
Oops, something went wrong.