Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
e7beea4
hide runtime errors
donaldpipowitch Jun 21, 2023
599e7f5
linting
donaldpipowitch Jun 22, 2023
02a6c72
Merge branch 'next' into patch-2
ndelangen Sep 4, 2023
556b02e
fix: avoid relying on document for preview file used in the compose/t…
DylanPiercey Sep 20, 2023
45ab3c2
Merge branch 'next' into avoid-document-reference
ndelangen Sep 22, 2023
8de2033
Merge branch 'next' into patch-2
ndelangen Nov 24, 2023
6243f1c
Merge branch 'next' into avoid-document-reference
ndelangen Nov 24, 2023
5443ff8
Merge branch 'release-8-0' into patch-2
ndelangen Nov 27, 2023
43240c4
Update remove-argtypes-regex.ts
joevaugh4n Mar 6, 2024
ba41ad7
escape filename given as argument
YukiKitagata Mar 12, 2024
1ee2413
Merge branch 'next' into next
valentinpalkovic Mar 12, 2024
be1ccf4
Fix missing support for mts vite config
drik98 Mar 12, 2024
807aaa4
Merge branch 'next' into bugfix/missing-support-for-mts-vite-config
valentinpalkovic Mar 12, 2024
14a6893
Add storybook/test as dev dependency
arnabsen Mar 12, 2024
3fca534
Fix typos
deining Mar 15, 2024
d7c8b4d
Fix missing in viewport addon
jpzwarte Mar 16, 2024
3a91e24
Docs: Fix migration guide scripts
AriPerkkio Mar 17, 2024
7290a2c
add explicit react-dom/server alias for vite
JReinhold Mar 18, 2024
8699394
add stories and autodocs for resolved react in addon-docs templates
JReinhold Mar 20, 2024
c75c98f
account for version mismatch in react-dom
JReinhold Mar 21, 2024
94e518a
Merge branch 'next' into jeppe/fix-react-dom-server-resolution
JReinhold Mar 21, 2024
02b800d
typo
JReinhold Mar 21, 2024
ca283ff
Merge branch 'jeppe/fix-react-dom-server-resolution' of github.com:st…
JReinhold Mar 21, 2024
694540a
fix preact aliases
JReinhold Mar 21, 2024
016f701
change preact stories extension to jsx
yannbf Mar 21, 2024
e5a21d4
add preact-render-to-string to preact sandboxes
yannbf Mar 21, 2024
0996714
temporarily reenable test-runner dev
yannbf Mar 21, 2024
ef42e9c
add parallelism
yannbf Mar 21, 2024
439cc6a
disable test-runner-dev again
yannbf Mar 21, 2024
d3ad059
Add table.readonly to argType typing
valentinpalkovic Mar 20, 2024
2f66985
Support readonly mode for Boolean input
valentinpalkovic Mar 20, 2024
d1bbb95
Support readonly mode for Color input
valentinpalkovic Mar 20, 2024
fb3e179
Support readonly mode for Date input
valentinpalkovic Mar 20, 2024
613da90
Support readonly mode for Files input
valentinpalkovic Mar 20, 2024
6fc5915
Support readonly mode for Number input
valentinpalkovic Mar 20, 2024
2267fa4
Support readonly mode for Object input
valentinpalkovic Mar 20, 2024
a57b40e
Support readonly mode for Range input
valentinpalkovic Mar 20, 2024
d5c8563
Support readonly mode for Text input
valentinpalkovic Mar 20, 2024
18f7fad
Support readonly mode for Checkbox input
valentinpalkovic Mar 20, 2024
3e89607
Support readonly mode for Radio input
valentinpalkovic Mar 20, 2024
a4489a0
Support readonly mode for Select input
valentinpalkovic Mar 20, 2024
91b2abc
Refactor OptionsControl to include argType in normalized props
valentinpalkovic Mar 20, 2024
757ddf5
Update OptionsConfig interface in types.ts
valentinpalkovic Mar 20, 2024
4c188e6
Add a new Example Story to showcase the button component with readonl…
valentinpalkovic Mar 20, 2024
c209329
Add documentation for argTypes.<input>.table.readonly
valentinpalkovic Mar 20, 2024
baac183
Set onlyChanged:false in chronatic.config.json
valentinpalkovic Mar 20, 2024
098adc7
Set onlyChanged:true in chronatic.config.json
valentinpalkovic Mar 20, 2024
a42f217
Improve typing for ArgType.table
valentinpalkovic Mar 21, 2024
f13ed7f
Fix readonly assignment in control components
valentinpalkovic Mar 21, 2024
0dd73ea
Fix styling issue in RawInput component
valentinpalkovic Mar 21, 2024
5ac51f6
Remove deprecated parameters from ButtonReadonly.stories.tsx
valentinpalkovic Mar 21, 2024
2bf95f0
Update CHANGELOG.md for v8.0.3 [skip ci]
storybook-bot Mar 21, 2024
1b1bc45
Merge branch 'next-release' into next
storybook-bot Mar 21, 2024
e93a31f
fix preact stories
yannbf Mar 21, 2024
efd9fbe
Update CHANGELOG.md for v8.0.4 [skip ci]
storybook-bot Mar 21, 2024
2a38e0e
support react-dom/server version not being available in preact
JReinhold Mar 21, 2024
f52166b
Merge branch 'next' into jeppe/fix-react-dom-server-resolution
JReinhold Mar 21, 2024
384aa80
don't define React when it is already (implicitly) defined in Webpack
JReinhold Mar 21, 2024
3c583e0
Merge branch 'jeppe/fix-react-dom-server-resolution' of github.com:st…
JReinhold Mar 21, 2024
d4075eb
Merge pull request #26577 from storybookjs/valentin/introduce-argtype…
valentinpalkovic Mar 22, 2024
48c3272
CLI: Improve Yarn berry error parsing
yannbf Mar 22, 2024
e02325b
Docs: Minor Coverage addon updates
jonniebigodes Mar 22, 2024
031f47a
fix resolved react mdx docs page
yannbf Mar 22, 2024
0c20bae
Merge branch 'next' into docs_fix_coverage
jonniebigodes Mar 22, 2024
845c424
Merge pull request #26617 from storybookjs/docs_fix_coverage
jonniebigodes Mar 22, 2024
dcfdd0f
Merge branch 'next' into fix/active-viewport-size-not-centered
cdedreuille Mar 22, 2024
ee7c4d9
Merge pull request #26616 from storybookjs/yann/improve-yarn2-error-m…
yannbf Mar 22, 2024
e706ff5
Merge branch 'next' into fix/active-viewport-size-not-centered
JReinhold Mar 22, 2024
96b4314
Add getRendererName function to mainConfigFile
valentinpalkovic Mar 22, 2024
1e5a57c
only assert on major versions in resolved react e2e test
JReinhold Mar 22, 2024
5e2f1e7
Adjust react-docgen automigration to add possibility to migrate back …
valentinpalkovic Mar 22, 2024
5e2c5e0
Merge pull request #26441 from drik98/bugfix/missing-support-for-mts-…
valentinpalkovic Mar 22, 2024
08fd064
Align documentation with CSF v3
nathan-brown-omc Mar 22, 2024
078bf93
chore: update emotion dependencies
SimenB Mar 22, 2024
11c6099
Merge branch 'next' into docs-csf-v3
jonniebigodes Mar 24, 2024
d6eaf19
Merge pull request #26557 from storybookjs/jeppe/fix-react-dom-server…
JReinhold Mar 24, 2024
7edd5c9
Merge branch 'next' into docs-csf-v3
jonniebigodes Mar 25, 2024
3767f87
Make sure to be able to handle empty union that react-docgen sometime…
kasperpeulen Mar 25, 2024
b2f5a90
Update docs/writing-stories/index.md
nkabrown Mar 25, 2024
9673fe0
Merge branch 'next' into update-emotion-deps
ndelangen Mar 25, 2024
0d64515
Merge branch 'next' into fix/active-viewport-size-not-centered
jonniebigodes Mar 25, 2024
4cf0272
run dedupe
ndelangen Mar 25, 2024
b071c44
Merge pull request #26530 from storybookjs/fix/active-viewport-size-n…
jonniebigodes Mar 25, 2024
889cfdf
Merge pull request #26639 from storybookjs/kasper/empty-union
kasperpeulen Mar 25, 2024
ca5d41b
Merge branch 'next' into cli-copy-edit
jonniebigodes Mar 25, 2024
772ce6e
Merge pull request #26623 from SimenB/update-emotion-deps
ndelangen Mar 25, 2024
3aaa3bd
Merge branch 'next' into cli-copy-edit
jonniebigodes Mar 25, 2024
83de652
Merge pull request #26342 from storybookjs/cli-copy-edit
jonniebigodes Mar 25, 2024
9733666
Merge branch 'next' into docs-csf-v3
jonniebigodes Mar 25, 2024
f7ad100
Merge branch 'next' into docs/migration-guide-scripts
jonniebigodes Mar 25, 2024
09be01b
Merge pull request #26621 from nkabrown/docs-csf-v3
jonniebigodes Mar 25, 2024
dc825d4
Merge branch 'next' into docs/migration-guide-scripts
jonniebigodes Mar 25, 2024
2b1058d
Merge pull request #26541 from AriPerkkio/docs/migration-guide-scripts
jonniebigodes Mar 25, 2024
830890c
Fix document undefined error in UrlStore and WebView
ndelangen Mar 26, 2024
779117c
Merge branch 'next' into pr/DylanPiercey/24248
ndelangen Mar 26, 2024
4981436
Merge branch 'next' into patch-2
ndelangen Mar 26, 2024
11534e4
Merge pull request #24248 from DylanPiercey/avoid-document-reference
ndelangen Mar 26, 2024
4c9967b
Merge pull request #26528 from deining/fix-typo
ndelangen Mar 26, 2024
de113c8
Merge branch 'next' into pr/YukiKitagata/26430
ndelangen Mar 26, 2024
017600a
Fix formatting issue in index.ts
ndelangen Mar 26, 2024
0f7cddd
Merge pull request #23175 from donaldpipowitch/patch-2
ndelangen Mar 26, 2024
e358999
Merge pull request #26458 from arnabsen/next
ndelangen Mar 26, 2024
2118e9a
Merge pull request #26430 from YukiKitagata/next
ndelangen Mar 26, 2024
74e1718
Update Node.js versions in CircleCI config and .nvmrc
valentinpalkovic Mar 26, 2024
c366e03
Make versioning consistent in prompt
valentinpalkovic Mar 26, 2024
de173e8
Merge pull request #26620 from storybookjs/valentin/react-docgen-auto…
valentinpalkovic Mar 26, 2024
d80b2fb
NextJS: Support path aliases when no base url is set
yannbf Mar 26, 2024
44fc0b6
Merge pull request #26651 from storybookjs/yann/fix-tsconfig-paths-ne…
valentinpalkovic Mar 27, 2024
a832ca7
Merge pull request #26645 from storybookjs/valentin/bump-node-version…
valentinpalkovic Mar 27, 2024
c728fc6
Fix nx affected
kasperpeulen Mar 27, 2024
b18a7fe
Fix nx error
kasperpeulen Mar 27, 2024
7cf1f8b
Set main branch to next
kasperpeulen Mar 27, 2024
957acb7
Cleanup
kasperpeulen Mar 27, 2024
e19d98d
Cleanup
kasperpeulen Mar 27, 2024
72d3370
Merge pull request #26663 from storybookjs/kasper/fix-nx
kasperpeulen Mar 27, 2024
2f22902
Write changelog for 8.1.0-alpha.5 [skip ci]
storybook-bot Mar 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ executors:
default: "small"
working_directory: /tmp/storybook
docker:
- image: cimg/node:18.18.0
- image: cimg/node:18.19.1
environment:
NODE_OPTIONS: --max_old_space_size=6144
resource_class: <<parameters.class>>
Expand All @@ -30,7 +30,7 @@ executors:
default: "small"
working_directory: /tmp/storybook
docker:
- image: cimg/node:18.18.0-browsers
- image: cimg/node:18.19.1-browsers
environment:
NODE_OPTIONS: --max_old_space_size=6144
resource_class: <<parameters.class>>
Expand Down Expand Up @@ -66,6 +66,7 @@ orbs:
browser-tools: circleci/browser-tools@1.4.1
discord: antonioned/discord@0.1.0
codecov: codecov/codecov@3.2.4
nx: nrwl/nx@1.6.2

commands:
cancel-workflow-on-failure:
Expand Down Expand Up @@ -190,6 +191,9 @@ jobs:
clone_options: "--depth 1 --verbose"
- attach_workspace:
at: .
- nx/set-shas:
main-branch-name: "next"
workflow-name: << pipeline.parameters.workflow >>
- run:
name: Check
command: |
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.18.2
18.19.1
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## 8.0.4

- Addon Docs: Support Stencil based display names in source snippets - [#26592](https://github.com/storybookjs/storybook/pull/26592), thanks @yannbf!
- CLI: Instruct the correct auto-migration command - [#26515](https://github.com/storybookjs/storybook/pull/26515), thanks @ndelangen!
- CLI: Throw an error when running upgrade command in incorrect cwd - [#26585](https://github.com/storybookjs/storybook/pull/26585), thanks @yannbf!

## 8.0.3

- Bug: Remove redundant component check, as we auto-generate titles from the file system - [#26516](https://github.com/storybookjs/storybook/pull/26516), thanks @kasperpeulen!
- UI: Replace the icon prop in the Manager API - [#26477](https://github.com/storybookjs/storybook/pull/26477), thanks @cdedreuille!

## 8.0.2

- Addon Docs: Fix [Object object] displayName in some JSX components - [#26566](https://github.com/storybookjs/storybook/pull/26566), thanks @yannbf!
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.prerelease.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
## 8.1.0-alpha.5

- Addon-docs: Fix `react-dom/server` imports breaking stories and docs - [#26557](https://github.com/storybookjs/storybook/pull/26557), thanks @JReinhold!
- Args: Add possibility to mark controls as read-only - [#26577](https://github.com/storybookjs/storybook/pull/26577), thanks @valentinpalkovic!
- Automigrations: Add migration note about new react-docgen default - [#26620](https://github.com/storybookjs/storybook/pull/26620), thanks @valentinpalkovic!
- Automigrations: Fix missing support for mts vite config - [#26441](https://github.com/storybookjs/storybook/pull/26441), thanks @drik98!
- CLI: Automigrations copy edits - [#26342](https://github.com/storybookjs/storybook/pull/26342), thanks @joevaugh4n!
- CLI: Improve Yarn berry error parsing - [#26616](https://github.com/storybookjs/storybook/pull/26616), thanks @yannbf!
- Codemods: Escape filename given as argument - [#26430](https://github.com/storybookjs/storybook/pull/26430), thanks @YukiKitagata!
- NextJS: Support path aliases when no base url is set - [#26651](https://github.com/storybookjs/storybook/pull/26651), thanks @yannbf!
- Node: Safe use of `document` for preview - [#24248](https://github.com/storybookjs/storybook/pull/24248), thanks @DylanPiercey!
- React-Docgen: Make sure to be able to handle empty unions - [#26639](https://github.com/storybookjs/storybook/pull/26639), thanks @kasperpeulen!
- Test: Add @storybook/test as dev dependency - [#26458](https://github.com/storybookjs/storybook/pull/26458), thanks @arnabsen!
- Theming: Update emotion dependencies - [#26623](https://github.com/storybookjs/storybook/pull/26623), thanks @SimenB!
- Viewport: Fix missing style - [#26530](https://github.com/storybookjs/storybook/pull/26530), thanks @jpzwarte!
- Webpack: Hide runtime errors - [#23175](https://github.com/storybookjs/storybook/pull/23175), thanks @donaldpipowitch!

## 8.1.0-alpha.4

- Addon Docs: Support Stencil based display names in source snippets - [#26592](https://github.com/storybookjs/storybook/pull/26592), thanks @yannbf!
Expand Down
6 changes: 3 additions & 3 deletions CHANGELOG.v1-5.md
Original file line number Diff line number Diff line change
Expand Up @@ -3527,7 +3527,7 @@ See [the RC announcement](https://gist.github.com/shilman/0332090b63f1798a58ed8d
- UI: Fix ie 11 ([#5599](https://github.com/storybookjs/storybook/pull/5599))
- CLI: Fix for when outputDir is an absolute path ([#5573](https://github.com/storybookjs/storybook/pull/5573))
- CLI: Avoid false-negative checks for port ([#5565](https://github.com/storybookjs/storybook/pull/5565))
- Core: Prioritise programatic configuration ([#5564](https://github.com/storybookjs/storybook/pull/5564))
- Core: Prioritise programmatic configuration ([#5564](https://github.com/storybookjs/storybook/pull/5564))
- UI: FIX clear search ([#5550](https://github.com/storybookjs/storybook/pull/5550))
- Core: Transpile safe-eval package ([#5498](https://github.com/storybookjs/storybook/pull/5498))
- UI: Add default backgrounds to official example ([#5585](https://github.com/storybookjs/storybook/pull/5585))
Expand Down Expand Up @@ -5258,7 +5258,7 @@ NOTE: As part of the generic addon decorators, we've reversed the order of addon
#### Features

- Storybook for Marko [#3504](https://github.com/storybookjs/storybook/pull/3504)
- Storybook addon Jest angular suport [#3532](https://github.com/storybookjs/storybook/pull/3532)
- Storybook addon Jest angular support [#3532](https://github.com/storybookjs/storybook/pull/3532)
- Storybook for HTML snippets [#3475](https://github.com/storybookjs/storybook/pull/3475)
- Feature/config custom chrome executable path [#3518](https://github.com/storybookjs/storybook/pull/3518)
- Channel-postmessage: handle events from the same window [#3519](https://github.com/storybookjs/storybook/pull/3519)
Expand Down Expand Up @@ -9224,7 +9224,7 @@ Minor features including a new "events" addon, as well as the usual bugfixes, cl

- Fixed knobs addon editing bug [#1233](https://github.com/storybookjs/storybook/pull/1233)
- Fix bug in addons/graphql in reIndentQuery [#1207](https://github.com/storybookjs/storybook/pull/1207)
- Marksy initialized with mtrcConf intead of marksyConf [#1205](https://github.com/storybookjs/storybook/pull/1205)
- Marksy initialized with mtrcConf instead of marksyConf [#1205](https://github.com/storybookjs/storybook/pull/1205)

#### Documentation

Expand Down
4 changes: 2 additions & 2 deletions CHANGELOG.v6.md
Original file line number Diff line number Diff line change
Expand Up @@ -1950,7 +1950,7 @@ Fix bad publish of `6.4.0-alpha.27` to the `latest` tag
### Bug Fixes

- Controls: Don't set arg in validateOptions if it would be `undefined` ([#15654](https://github.com/storybookjs/storybook/pull/15654))
- Trailing comma handling for "-s" command line paramenter ([#15615](https://github.com/storybookjs/storybook/pull/15615))
- Trailing comma handling for "-s" command line parameter ([#15615](https://github.com/storybookjs/storybook/pull/15615))
- Controls: Fix color matching behavior for non-string types ([#15549](https://github.com/storybookjs/storybook/pull/15549))
- Composition: Fix refs ordering ([#15527](https://github.com/storybookjs/storybook/pull/15527))

Expand All @@ -1963,7 +1963,7 @@ Fix bad publish of `6.4.0-alpha.27` to the `latest` tag

### Bug Fixes

- CLI: Fix trailing comma handling for "-s" command line paramenter ([#15615](https://github.com/storybookjs/storybook/pull/15615))
- CLI: Fix trailing comma handling for "-s" command line parameter ([#15615](https://github.com/storybookjs/storybook/pull/15615))
- Components: Lazy-load syntax highlighter ([#15607](https://github.com/storybookjs/storybook/pull/15607))

### Maintenance
Expand Down
4 changes: 2 additions & 2 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -4177,7 +4177,7 @@ For more information, [see the documentation](https://github.com/storybookjs/sto

Storybook has built-in Typescript support in 6.0. That means you should remove your complex Typescript configurations from your `.storybook` config. We've tried to pick sensible defaults that work out of the box, especially for nice prop table generation in `@storybook/addon-docs`.

To migrate from an old setup, we recommend deleting any typescript-specific webpack/babel configurations in your project. You should also remove `@storybook/preset-typescript`, which is superceded by the built-in configuration.
To migrate from an old setup, we recommend deleting any typescript-specific webpack/babel configurations in your project. You should also remove `@storybook/preset-typescript`, which is superseded by the built-in configuration.

If you want to override the defaults, see the [typescript configuration docs](https://storybook.js.org/docs/react/configure/typescript).

Expand Down Expand Up @@ -5570,7 +5570,7 @@ The `@storybook/react-native` had built-in addons (`addon-actions` and `addon-li

1. `imageSnapshot` test function was extracted from `addon-storyshots`
and moved to a new package - `addon-storyshots-puppeteer` that now will
be dependant on puppeteer. [README](https://github.com/storybookjs/storybook/tree/master/addons/storyshots/storyshots-puppeteer)
be dependent on puppeteer. [README](https://github.com/storybookjs/storybook/tree/master/addons/storyshots/storyshots-puppeteer)
2. `getSnapshotFileName` export was replaced with the `Stories2SnapsConverter`
class that now can be overridden for a custom implementation of the
snapshot-name generation. [README](https://github.com/storybookjs/storybook/tree/master/addons/storyshots/storyshots-core#stories2snapsconverter)
Expand Down
2 changes: 1 addition & 1 deletion code/addons/actions/src/models/ActionOptions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Options as TelejsonOptions } from 'telejson';

interface Options {
depth: number; // backards compatibility, remove in 7.0
depth: number; // backwards compatibility, remove in 7.0
clearOnStoryChange: boolean;
limit: number;
implicit: boolean;
Expand Down
2 changes: 1 addition & 1 deletion code/addons/actions/src/runtime/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export function action(name: string, options: ActionOptions = {}): HandlerFuncti
}

const channel = addons.getChannel();
// this makes sure that in js enviroments like react native you can still get an id
// this makes sure that in js environments like react native you can still get an id
const id = generateId();
const minDepth = 5; // anything less is really just storybook internals
const serializedArgs = args.map(serializeArg);
Expand Down
2 changes: 1 addition & 1 deletion code/addons/docs/ember/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ import docJson from '../dist/storybook-docgen/index.json';
setJSONDoc(docJson);
```

Finally, be sure to fill in the `component` field in your story metadata. This should be a string that matches the name of the `@class` used in your souce comments:
Finally, be sure to fill in the `component` field in your story metadata. This should be a string that matches the name of the `@class` used in your source comments:

```ts
export default {
Expand Down
4 changes: 3 additions & 1 deletion code/addons/docs/src/preset.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { dirname, join } from 'path';
import { dirname, join, isAbsolute } from 'path';
import rehypeSlug from 'rehype-slug';
import rehypeExternalLinks from 'rehype-external-links';

Expand Down Expand Up @@ -147,6 +147,8 @@ export const viteFinal = async (config: any, options: Options) => {
resolve: {
alias: {
react,
// Vite doesn't respect export maps when resolving an absolute path, so we need to do that manually here
...(isAbsolute(reactDom) && { 'react-dom/server': `${reactDom}/server.browser.js` }),
'react-dom': reactDom,
'@mdx-js/react': mdx,
/**
Expand Down
28 changes: 28 additions & 0 deletions code/addons/docs/template/stories/docs2/ResolvedReact.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React, * as ReactExport from 'react';
import * as ReactDom from 'react-dom';
import * as ReactDomServer from 'react-dom/server';

export const ResolvedReact = () => {
return (
<>
<p>
<code>react</code>:{' '}
<code data-testid="component-react">
{ReactExport.version ?? 'no version export found'}
</code>
</p>
<p>
<code>react-dom</code>:{' '}
<code data-testid="component-react-dom">
{ReactDom.version ?? 'no version export found'}
</code>
</p>
<p>
<code>react-dom/server</code>:{' '}
<code data-testid="component-react-dom-server">
{ReactDomServer.version ?? 'no version export found'}
</code>
</p>
</>
);
};
30 changes: 23 additions & 7 deletions code/addons/docs/template/stories/docs2/ResolvedReact.mdx
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
import { version as reactVersion } from 'react';
import { version as reactDomVersion } from 'react-dom';
import { ResolvedReactVersion } from './ResolvedReactVersion';
import { Meta } from '@storybook/blocks';
import * as ReactExport from 'react';
import * as ReactDom from 'react-dom';
import * as ReactDomServer from 'react-dom/server';
import { ResolvedReact } from './ResolvedReact';

<Meta title="docs2/ResolvedReact" name="MDX"/>

This doc is used to display the resolved version of React and its related packages.
As long as `@storybook/addon-docs` is installed, `react` and `react-dom` should be available to import from and should resolve to the same version.

The MDX here ensures that it works in an MDX file.

- See the [autodocs](/docs/addons-docs-docs2-resolvedreact--docs) for how it resolves in autodocs.
- See the [Story](/story/addons-docs-docs2-resolvedreact--story) for how it resolves in the actual story.

**Note: There appears to be a bug in the _production_ build of `react-dom`, where it reports version `18.2.0-next-9e3b772b8-20220608` while in fact version `18.2.0` is installed.**

## In MDX

<code>react</code>: <code data-testid="mdx-react">{reactVersion}</code>
<code>react</code>: <code data-testid="mdx-react">{ReactExport.version ?? 'no version export found'}</code>

<code>react-dom</code>: <code data-testid="mdx-react-dom">{ReactDom.version ?? 'no version export found'}</code>

<code>react-dom</code>: <code data-testid="mdx-react-dom">{reactDomVersion}</code>
<code>react-dom/server</code>: <code data-testid="mdx-react-dom-server">{ReactDomServer.version ?? 'no version export found'}</code>

## In `ResolvedReactVersion` component
## In `ResolvedReact` component

<ResolvedReactVersion />
<ResolvedReact />
15 changes: 0 additions & 15 deletions code/addons/docs/template/stories/docs2/ResolvedReactVersion.jsx

This file was deleted.

70 changes: 70 additions & 0 deletions code/addons/docs/template/stories/docs2/resolved-react.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { within, expect } from '@storybook/test';
import * as ReactExport from 'react';
import * as ReactDom from 'react-dom';
import * as ReactDomServer from 'react-dom/server';

/**
* This component is used to display the resolved version of React and its related packages.
* As long as `@storybook/addon-docs` is installed, `react` and `react-dom` should be available to import from and should resolve to the same version.
*
* The autodocs here ensures that it also works in the generated documentation.
*
* - See the [MDX docs](/docs/addons-docs-docs2-resolvedreact--mdx) for how it resolves in MDX.
* - See the [Story](/story/addons-docs-docs2-resolvedreact--story) for how it resolves in the actual story.
*
* **Note: There appears to be a bug in the _production_ build of `react-dom`, where it reports version `18.2.0-next-9e3b772b8-20220608` while in fact version `18.2.0` is installed.**
*/
export default {
title: 'Docs2/ResolvedReact',
component: globalThis.Components.Html,
tags: ['autodocs'],
argTypes: {
content: { table: { disable: true } },
},
args: {
content: `
<p>
<code>react</code>: <code data-testid="react">${
ReactExport.version ?? 'no version export found'
}</code>
</p>
<p>
<code>react-dom</code>: <code data-testid="react-dom">${
ReactDom.version ?? 'no version export found'
}</code>
</p>
<p>
<code>react-dom/server</code>: <code data-testid="react-dom-server">${
ReactDomServer.version ?? 'no version export found'
}</code>
</p>
`,
},
parameters: {
docs: {
name: 'ResolvedReact',
},
},
};

export const Story = {
// This test is more or less the same as the E2E test we have for MDX and autodocs entries in addon-docs.spec.ts
play: async ({ canvasElement, step, parameters }: any) => {
const canvas = await within(canvasElement);

const actualReactVersion = (await canvas.findByTestId('react')).textContent;
const actualReactDomVersion = (await canvas.findByTestId('react-dom')).textContent;
const actualReactDomServerVersion = (await canvas.findByTestId('react-dom-server')).textContent;

step('Expect React packages to all resolve to the same version', () => {
// react-dom has a bug in its production build, reporting version 18.2.0-next-9e3b772b8-20220608 even though version 18.2.0 is installed.
expect(actualReactDomVersion!.startsWith(actualReactVersion!)).toBeTruthy();

if (parameters.renderer === 'preact') {
// the preact/compat alias doesn't have a version export in react-dom/server
return;
}
expect(actualReactDomServerVersion).toBe(actualReactVersion);
});
},
};
2 changes: 1 addition & 1 deletion code/addons/docs/web-components/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

In order to get [Props tables](..docs/../../docs/props-tables.md) documentation for web-components you will need to have a [custom-elements.json](https://github.com/webcomponents/custom-elements-json) file.

You can hand write it or better generate it. Depending on the web components sugar you are choosing your milage may vary.
You can hand write it or better generate it. Depending on the web components sugar you are choosing your mileage may vary.

Known analyzers that output `custom-elements.json` v1.0.0:

Expand Down
1 change: 1 addition & 0 deletions code/addons/viewport/src/Tool.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ const flip = ({ width, height, ...styles }: ViewportStyles) => ({

const ActiveViewportSize = styled.div(() => ({
display: 'inline-flex',
alignItems: 'center',
}));

const ActiveViewportLabel = styled.div(({ theme }) => ({
Expand Down
10 changes: 7 additions & 3 deletions code/builders/builder-webpack5/src/presets/preview-preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ export const entries = async (_: unknown, options: any) => {
// Suppress informational messages when --quiet is specified. webpack-hot-middleware's quiet
// parameter would also suppress warnings.
result = result.concat(
`${require.resolve('webpack-hot-middleware/client')}?reload=true&quiet=false&noInfo=${
options.quiet
}`
`${require.resolve(
'webpack-hot-middleware/client'
)}?reload=true&quiet=false&overlay=${JSON.stringify({
errors: true,
warnings: false,
runtimeErrors: false,
})}&noInfo=${options.quiet}`
);
}

Expand Down
Loading