Skip to content

Commit

Permalink
Merge pull request #28982 from storybookjs/version-non-patch-from-8.3…
Browse files Browse the repository at this point in the history
….0-alpha.9

Release: Prerelease 8.3.0-alpha.10
  • Loading branch information
shilman authored Aug 27, 2024
2 parents 6388f93 + 438ce2c commit c109493
Show file tree
Hide file tree
Showing 80 changed files with 1,820 additions and 2,725 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,4 @@ code/.nx/cache
code/.vite-inspect
.nx/cache
!**/fixtures/**/yarn.lock
code/core/report
7 changes: 7 additions & 0 deletions CHANGELOG.prerelease.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 8.3.0-alpha.10

- Addon Vitest: Fix postinstall file types - [#28978](https://github.com/storybookjs/storybook/pull/28978), thanks @shilman!
- CLI: Fix dedent import in package managers - [#28980](https://github.com/storybookjs/storybook/pull/28980), thanks @shilman!
- Core: De-duplicate babel use in core - [#28972](https://github.com/storybookjs/storybook/pull/28972), thanks @ndelangen!
- Vitest: Fix add command - [#28975](https://github.com/storybookjs/storybook/pull/28975), thanks @ghengeveld!

## 8.3.0-alpha.9

- Addon Viewport: Add default options via parameters - [#28944](https://github.com/storybookjs/storybook/pull/28944), thanks @ndelangen!
Expand Down
132 changes: 74 additions & 58 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,17 @@
- [Tab addons cannot manually route, Tool addons can filter their visibility via tabId](#tab-addons-cannot-manually-route-tool-addons-can-filter-their-visibility-via-tabid)
- [Removed `config` preset](#removed-config-preset-1)
- [From version 7.5.0 to 7.6.0](#from-version-750-to-760)
- [CommonJS with Vite is deprecated](#commonjs-with-vite-is-deprecated)
- [Using implicit actions during rendering is deprecated](#using-implicit-actions-during-rendering-is-deprecated)
- [typescript.skipBabel deprecated](#typescriptskipbabel-deprecated)
- [Primary doc block accepts of prop](#primary-doc-block-accepts-of-prop)
- [Addons no longer need a peer dependency on React](#addons-no-longer-need-a-peer-dependency-on-react)
- [CommonJS with Vite is deprecated](#commonjs-with-vite-is-deprecated)
- [Using implicit actions during rendering is deprecated](#using-implicit-actions-during-rendering-is-deprecated)
- [typescript.skipBabel deprecated](#typescriptskipbabel-deprecated)
- [Primary doc block accepts of prop](#primary-doc-block-accepts-of-prop)
- [Addons no longer need a peer dependency on React](#addons-no-longer-need-a-peer-dependency-on-react)
- [From version 7.4.0 to 7.5.0](#from-version-740-to-750)
- [`storyStoreV6` and `storiesOf` is deprecated](#storystorev6-and-storiesof-is-deprecated)
- [`storyIndexers` is replaced with `experimental_indexers`](#storyindexers-is-replaced-with-experimental_indexers)
- [`storyStoreV6` and `storiesOf` is deprecated](#storystorev6-and-storiesof-is-deprecated)
- [`storyIndexers` is replaced with `experimental_indexers`](#storyindexers-is-replaced-with-experimental_indexers)
- [From version 7.0.0 to 7.2.0](#from-version-700-to-720)
- [Addon API is more type-strict](#addon-api-is-more-type-strict)
- [Addon-controls hideNoControlsWarning parameter is deprecated](#addon-controls-hidenocontrolswarning-parameter-is-deprecated)
- [Addon API is more type-strict](#addon-api-is-more-type-strict)
- [Addon-controls hideNoControlsWarning parameter is deprecated](#addon-controls-hidenocontrolswarning-parameter-is-deprecated)
- [From version 6.5.x to 7.0.0](#from-version-65x-to-700)
- [7.0 breaking changes](#70-breaking-changes)
- [Dropped support for Node 15 and below](#dropped-support-for-node-15-and-below)
Expand All @@ -141,7 +141,7 @@
- [Deploying build artifacts](#deploying-build-artifacts)
- [Dropped support for file URLs](#dropped-support-for-file-urls)
- [Serving with nginx](#serving-with-nginx)
- [Ignore story files from node_modules](#ignore-story-files-from-node_modules)
- [Ignore story files from node\_modules](#ignore-story-files-from-node_modules)
- [7.0 Core changes](#70-core-changes)
- [7.0 feature flags removed](#70-feature-flags-removed)
- [Story context is prepared before for supporting fine grained updates](#story-context-is-prepared-before-for-supporting-fine-grained-updates)
Expand All @@ -155,7 +155,7 @@
- [Addon-interactions: Interactions debugger is now default](#addon-interactions-interactions-debugger-is-now-default)
- [7.0 Vite changes](#70-vite-changes)
- [Vite builder uses Vite config automatically](#vite-builder-uses-vite-config-automatically)
- [Vite cache moved to node_modules/.cache/.vite-storybook](#vite-cache-moved-to-node_modulescachevite-storybook)
- [Vite cache moved to node\_modules/.cache/.vite-storybook](#vite-cache-moved-to-node_modulescachevite-storybook)
- [7.0 Webpack changes](#70-webpack-changes)
- [Webpack4 support discontinued](#webpack4-support-discontinued)
- [Babel mode v7 exclusively](#babel-mode-v7-exclusively)
Expand Down Expand Up @@ -205,7 +205,7 @@
- [Dropped addon-docs manual babel configuration](#dropped-addon-docs-manual-babel-configuration)
- [Dropped addon-docs manual configuration](#dropped-addon-docs-manual-configuration)
- [Autoplay in docs](#autoplay-in-docs)
- [Removed STORYBOOK_REACT_CLASSES global](#removed-storybook_react_classes-global)
- [Removed STORYBOOK\_REACT\_CLASSES global](#removed-storybook_react_classes-global)
- [7.0 Deprecations and default changes](#70-deprecations-and-default-changes)
- [storyStoreV7 enabled by default](#storystorev7-enabled-by-default)
- [`Story` type deprecated](#story-type-deprecated)
Expand Down Expand Up @@ -428,85 +428,101 @@ These APIs allowed addons to render arbitrary content in the Storybook sidebar.

### New parameters format for addon backgrounds

The `addon-backgrounds` addon now uses a new format for parameters. The `backgrounds` parameter is now an object with a `values` key that contains the background values.
> [!NOTE]
> You need to set the feature flag `backgroundsStoryGlobals` to `true` in your `.storybook/main.ts` to use the new format and set the value with `globals`.
> ! You need to set the feature flag `backgroundsStoryGlobals` to `true` in your `.storybook/main.ts` to use the new format.
The `addon-backgrounds` addon now uses a new format for parameters. The `backgrounds` parameter is now an object with an `options` property that is assigned to an object of background values, where the key is used when setting the global value.

```diff
// .storybook/preview.js
export const parameters = {
backgrounds: {
- values: [
- { name: 'twitter', value: '#00aced' },
- { name: 'facebook', value: '#3b5998' },
- ],
+ options: {
+ twitter: { name: 'twitter', value: '#00aced' },
+ facebook: { name: 'facebook', value: '#3b5998' },
+ },
- values: [
- { name: 'twitter', value: '#00aced' },
- { name: 'facebook', value: '#3b5998' },
- ],
+ options: {
+ twitter: { name: 'Twitter', value: '#00aced' },
+ facebook: { name: 'Facebook', value: '#3b5998' },
+ },
},
};
```

Setting an override value should now be done via a `globals` property on your component/meta or story itself:

```ts
```diff
// Button.stories.ts
export default {
component: Button,
globals: {
backgrounds: { value: "twitter" },
},
- parameters: {
- backgrounds: {
- default: "twitter",
- },
- },
+ globals: {
+ backgrounds: { value: "twitter" },
+ },
};
```

This locks that story to the `twitter` background, it cannot be changed by the addon UI.

### New parameters format for addon viewport

> ! You need to set the feature flag `viewportStoryGlobals` to `true` in your `.storybook/main.ts` to use the new format.
> [!NOTE]
> You need to set the feature flag `viewportStoryGlobals` to `true` in your `.storybook/main.ts` to use the new format and set the value with `globals`.
The `addon-viewport` addon now uses a new format for parameters. The `viewport` parameter is now an object with a `viewports` key that contains the viewport values.
The `addon-viewport` addon now uses a new format for parameters. The `viewport` parameter is now an object with an `options` property that is assigned to an object of viewport values, where the key is used when setting the global value.

```diff
// .storybook/preview.js
export const parameters = {
viewport: {
- viewports: {
- iphone5: {
- name: 'phone',
- styles: {
- width: '320px',
- height: '568px',
- },
- },
- viewports: {
- iphone5: {
- name: 'phone',
- styles: {
- width: '320px',
- height: '568px',
- },
- },
+ options: {
+ iphone5: {
+ name: 'phone',
+ styles: {
+ width: '320px',
+ height: '568px',
+ },
+ },
+ },
- },
+ options: {
+ iphone5: {
+ name: 'phone',
+ styles: {
+ width: '320px',
+ height: '568px',
+ },
+ },
+ },
},
};
```

Setting an override value should now be done via a `globals` property on your component/meta or story itself:
Setting an override value should now be done via a `globals` property on your component/meta or story itself. Also note the change from `defaultOrientation: "landscape"` to `isRotated: true`.

```ts
```diff
// Button.stories.ts
export default {
component: Button,
globals: {
viewport: { value: "phone" },
},
- parameters: {
- viewport: {
- defaultViewport: "iphone5",
- defaultOrientation: "landscape",
- },
- },
+ globals: {
+ viewport: {
+ value: "iphone5",
+ isRotated: true,
+ },
+ },
};
```

This locks that story to the `phone` viewport, it cannot be changed by the addon UI.
This locks that story to the `iphone5` viewport in landscape orientation, it cannot be changed by the addon UI.

## From version 8.1.x to 8.2.x

Expand Down Expand Up @@ -2497,13 +2513,13 @@ This means also, that there is no root ngModule anymore. Previously you were abl
For example, if you want to configure BrowserAnimationModule in your stories, please extract the necessary providers the following way and provide them via the `applicationConfig` decorator:

```js
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { importProvidersFrom } from '@angular/core';
import { applicationConfig, Meta, StoryObj } from '@storybook/angular';
import {ExampleComponent} from './example.component';
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { importProvidersFrom } from "@angular/core";
import { applicationConfig, Meta, StoryObj } from "@storybook/angular";
import { ExampleComponent } from "./example.component";

const meta: Meta = {
title: 'Example',
title: "Example",
component: ExampleComponent,
decorators: [
// Define application-wide providers with the applicationConfig decorator
Expand All @@ -2519,14 +2535,14 @@ const meta: Meta = {

export default meta;

type Story = StoryObj<typeof ExampleComponent>
type Story = StoryObj<typeof ExampleComponent>;

export const Default: Story = {
render: () => ({
// Define application-wide providers directly in the render function
applicationConfig: {
providers: [importProvidersFrom(BrowserAnimationsModule)],
}
},
}),
};
```
Expand Down
3 changes: 2 additions & 1 deletion code/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ ember-output
!.eslintrc-markdown.js
!.storybook
core/assets
core/src/core-server/utils/__search-files-tests__
core/src/core-server/utils/__search-files-tests__
core/report
3 changes: 2 additions & 1 deletion code/.prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.mdx

/.nx/cache
/.nx/cache
core/report

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion code/addons/vitest/postinstall.cjs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('./dist/postinstall.js');
module.exports = require('./dist/postinstall.cjs');
7 changes: 1 addition & 6 deletions code/addons/vitest/preset.cjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
function managerEntries(entry = []) {
return [...entry, require.resolve('./dist/manager.js')];
}

module.exports = {
managerEntries,
...require('./dist/preset'),
...require('./dist/preset.cjs'),
};
Loading

0 comments on commit c109493

Please sign in to comment.