Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

7.0.11 patch release #22530

Merged
merged 20 commits into from
May 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
83d1115
Merge pull request #21602 from gitstart/addon-measure/disable-in-docs
yannbf May 9, 2023
45f40fb
Merge pull request #21773 from g-cappai/fix-double-border
yannbf May 9, 2023
6069b7b
Merge pull request #21619 from gitstart/ui/show-current-search-shortcut
yannbf May 10, 2023
fa5c55b
Merge pull request #22414 from orangecms/docs-webserver
jonniebigodes May 9, 2023
8b941ed
Merge pull request #22109 from storybookjs/fix/hide-migration-summary…
shilman May 10, 2023
dd9382d
Merge pull request #22469 from mvarendorff/patch-1
jonniebigodes May 10, 2023
12e3d22
Merge pull request #22256 from JungHoe/code-snippets-for-framework
jonniebigodes May 10, 2023
9ab1f3e
Merge pull request #22512 from michens/windows-path
valentinpalkovic May 11, 2023
dd6fdc8
Merge pull request #22497 from storybookjs/chore/fix-css-inconsistency
yannbf May 11, 2023
678fd2f
Merge pull request #22392 from storybookjs/valentin/angular-already-i…
valentinpalkovic May 11, 2023
cbbc01f
Merge pull request #22513 from bashmish/fix/wc-source-decorator-docum…
shilman May 11, 2023
b7c145e
Merge pull request #22492 from storybookjs/valentin/fix-could-not-fin…
valentinpalkovic May 11, 2023
918eba9
Merge pull request #22515 from storybookjs/fix/fix-error-throwing
yannbf May 11, 2023
e5098f9
Merge pull request #22522 from storybookjs/chore_docs_vet_outdated_fr…
jonniebigodes May 11, 2023
bead557
Merge pull request #22514 from mdornseif/patch-1
jonniebigodes May 11, 2023
5d27e3a
Merge pull request #22525 from storybookjs/chore_fix_styling_snippets
jonniebigodes May 11, 2023
fcbe6e3
Merge pull request #22517 from storybookjs/fix/upgrade-precheck-failure
yannbf May 12, 2023
368ca69
Merge pull request #22471 from sjwilczynski/stwilczy/idInComposeStories
yannbf May 11, 2023
83fbd63
Merge pull request #22496 from storybookjs/shilman/toolbars-fix-title
shilman May 10, 2023
45bb166
7.0.11 changelog
shilman May 12, 2023
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
1 change: 0 additions & 1 deletion .spelling
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ addon
addons
api
apollo
aurelia
bundlers
center
centered
Expand Down
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
## 7.0.11 (May 12, 2023)

#### Bug Fixes

- Toolbars: Fix title behavior in UI [#22496](https://github.com/storybooks/storybook/pull/22496)
- CLI: Fix storybook upgrade precheckfailure object [#22517](https://github.com/storybooks/storybook/pull/22517)
- CLI: Throw errors instead of rejecting promises [#22515](https://github.com/storybooks/storybook/pull/22515)
- CLI: Remove unsupported frameworks/renderers and improve builder detection [#22492](https://github.com/storybooks/storybook/pull/22492)
- Web-components: Fix source decorator to handle document fragments [#22513](https://github.com/storybooks/storybook/pull/22513)
- Core: Fix windows path error in StoryStore v6 [#22512](https://github.com/storybooks/storybook/pull/22512)
- CLI: Do not show a migration summary on sb init [#22109](https://github.com/storybooks/storybook/pull/22109)
- UI: Show current search shortcut in search box sidebar [#21619](https://github.com/storybooks/storybook/pull/21619)
- Outline: Fix additional outline border in docs mode [#21773](https://github.com/storybooks/storybook/pull/21773)
- Measure: Deactivate when switching to Docs mode [#21602](https://github.com/storybooks/storybook/pull/21602)
- CSF: Expose story id in composeStories [#22471](https://github.com/storybooks/storybook/pull/22471)
- CLI: Prompt to force initialization when storybook folder is detected [#22392](https://github.com/storybooks/storybook/pull/22392)
- UI: Fix css inconsistency in Button and Icon components [#22497](https://github.com/storybooks/storybook/pull/22497)

## 7.0.10 (May 9, 2023)

#### Bug Fixes
Expand Down
35 changes: 31 additions & 4 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
- [Importing plain markdown files with `transcludeMarkdown` has changed](#importing-plain-markdown-files-with-transcludemarkdown-has-changed)
- [Stories field in .storybook/main.js is mandatory](#stories-field-in-storybookmainjs-is-mandatory)
- [Stricter global types](#stricter-global-types)
- [Dropped support for file URLs](#dropped-support-for-file-urls)
- [Deploying build artifacts](#deploying-build-artifacts)
- [Dropped support for file URLs](#dropped-support-for-file-urls)
- [Serving with nginx](#serving-with-nginx)
- [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 Down Expand Up @@ -905,11 +907,36 @@ Please follow up the [Configure your Storybook project](https://storybook.js.org

In 6.x, you could declare and use [`globals`](https://storybook.js.org/docs/react/essentials/toolbars-and-globals) without declaring their corresponding `globalTypes`. We've made this more strict in 7.0, so that the `globalTypes` declaration is required, and undeclared globals will be ignored.

#### Dropped support for file URLs
#### Deploying build artifacts

In 6.x it was possible to open a storybook from the file system. In 7.x, you must serve your static storybook with an HTTP server, e.g. `npx http-server storybook-static`.
Starting with 7.x, we are using modern [ECMAScript Modules (ESM)](https://nodejs.org/api/esm.html).

The reason for this change is that we're now using `.mjs` (modern ESM) and these are incompatible with the browser's CORS settings for file URLs.
Those end up as `.mjs` files in your static Storybook artifact and need to be served as `application/javascript`, indicated by the `Content-Type` HTTP header.

For a simple HTTP server to view a Storybook build, you can run `npx http-server storybook-static`.

Note that [using the serve package](https://storybook.js.org/docs/react/faq#i-see-a-no-preview-error-with-a-storybook-production-build) will not work.

##### Dropped support for file URLs

In 6.x it was possible to open a Storybook build from the file system.

ESM requires loading over HTTP(S), which is incompatible with the browser's CORS settings for `file://` URLs.

So you now need to use a web server as described above.

##### Serving with nginx

With [nginx](https://www.nginx.com/), you need to extend [the MIME type handling](https://github.com/nginx/nginx/blob/master/conf/mime.types) in your configuration:

```
include mime.types;
types {
application/javascript mjs;
}
```

It would otherwise default to serving the `.mjs` files as `application/octet-stream`.

### 7.0 Core changes

Expand Down
6 changes: 0 additions & 6 deletions code/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,6 @@ module.exports = {
'spaced-comment': 'off',
},
},
{
files: ['**/mithril/**/*'],
rules: {
'react/no-unknown-property': 'off', // Need to deactivate otherwise eslint replaces some unknown properties with React ones
},
},
{
files: ['**/e2e-tests/**/*'],
rules: {
Expand Down
1 change: 0 additions & 1 deletion code/addons/links/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@
"displayName": "Links",
"icon": "https://user-images.githubusercontent.com/263385/101991673-48355c80-3c7c-11eb-9b6e-b627c96a75f6.png",
"unsupportedFrameworks": [
"marko",
"react-native"
]
}
Expand Down
4 changes: 2 additions & 2 deletions code/addons/measure/src/withMeasure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const withMeasure = (StoryFn: StoryFunction<Renderer>, context: StoryCont
});
};

if (measureEnabled) {
if (context.viewMode === 'story' && measureEnabled) {
document.addEventListener('pointerover', onPointerOver);
init();
window.addEventListener('resize', onResize);
Expand All @@ -58,7 +58,7 @@ export const withMeasure = (StoryFn: StoryFunction<Renderer>, context: StoryCont
window.removeEventListener('resize', onResize);
destroy();
};
}, [measureEnabled]);
}, [measureEnabled, context.viewMode]);

return StoryFn();
};
2 changes: 1 addition & 1 deletion code/addons/outline/src/withOutline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const withOutline = (StoryFn: StoryFunction<Renderer>, context: StoryCont
const isInDocs = context.viewMode === 'docs';

const outlineStyles = useMemo(() => {
const selector = isInDocs ? `#anchor--${context.id} .docs-story` : '.sb-show-main';
const selector = isInDocs ? `[data-story-block="true"]` : '.sb-show-main';

return outlineCSS(selector);
}, [context]);
Expand Down
9 changes: 4 additions & 5 deletions code/addons/storyshots-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -603,11 +603,10 @@ initStoryshots({

Use this table as a reference for manually specifying the framework.

| angular | html | preact |
| -------------- | ---- | ------------ |
| react | riot | react-native |
| svelte | vue | vue3 |
| web-components | rax | |
| angular | html | preact |
| ------- | ------------ | -------------- |
| react | react-native | vue3 |
| svelte | vue | web-components |

### `test`

Expand Down
4 changes: 1 addition & 3 deletions code/addons/storyshots-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,7 @@
"displayName": "Storyshots",
"icon": "https://user-images.githubusercontent.com/263385/101991676-48cdf300-3c7c-11eb-8aa1-944dab6ab29b.png",
"unsupportedFrameworks": [
"ember",
"mithril",
"marko"
"ember"
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ export type SupportedFramework =
| 'html'
| 'preact'
| 'react'
| 'riot'
| 'react-native'
| 'svelte'
| 'vue'
| 'vue3'
| 'web-components'
| 'rax';
| 'web-components';
60 changes: 0 additions & 60 deletions code/addons/storyshots-core/src/frameworks/rax/loader.ts

This file was deleted.

12 changes: 0 additions & 12 deletions code/addons/storyshots-core/src/frameworks/rax/renderTree.ts

This file was deleted.

65 changes: 0 additions & 65 deletions code/addons/storyshots-core/src/frameworks/riot/loader.ts

This file was deleted.

36 changes: 0 additions & 36 deletions code/addons/storyshots-core/src/frameworks/riot/renderTree.ts

This file was deleted.

1 change: 0 additions & 1 deletion code/addons/storyshots-core/src/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
declare module 'jest-preset-angular/*';
declare module 'preact-render-to-string/jsx';
declare module 'react-test-renderer*';
declare module 'rax-test-renderer*';

declare module '@storybook/babel-plugin-require-context-hook/register';

Expand Down
18 changes: 4 additions & 14 deletions code/addons/toolbars/src/components/ToolbarMenuList.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { FC } from 'react';
import React, { useState, useCallback } from 'react';
import { useGlobals } from '@storybook/manager-api';
import { deprecate } from '@storybook/client-logger';
import { WithTooltip, TooltipLinkList } from '@storybook/components';
import { ToolbarMenuButton } from './ToolbarMenuButton';
import type { WithKeyboardCycleProps } from '../hoc/withKeyboardCycle';
Expand Down Expand Up @@ -31,23 +30,14 @@ export const ToolbarMenuList: FC<ToolbarMenuListProps> = withKeyboardCycle(
icon = getSelectedIcon({ currentValue, items }) || icon;
}

// Deprecation support for old "name of global arg used as title"
if (!title) {
title = name;
deprecate(
'`showName` is deprecated as `name` will stop having dual purposes in the future. Please specify a `title` in `globalTypes` instead.'
);
} else if (!icon && !title) {
title = name;
deprecate(
`Using the \`name\` "${name}" as toolbar title for backward compatibility. \`name\` will stop having dual purposes in the future. Please specify either a \`title\` or an \`icon\` in \`globalTypes\` instead.`
);
}

if (dynamicTitle) {
title = getSelectedTitle({ currentValue, items }) || title;
}

if (!title && !icon) {
console.warn(`Toolbar '${name}' has no title or icon`);
}

const handleItemClick = useCallback(
(value: string | undefined) => {
updateGlobals({ [id]: value });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const ToolbarMenuListItem = ({
const Icon = icon && <Icons style={{ opacity: 1 }} icon={icon} />;

const Item: TooltipLinkListLink = {
id: value || currentValue,
id: value ?? '_reset',
active: currentValue === value,
right,
title,
Expand Down
Loading