Skip to content

Commit 6aba6ef

Browse files
authored
Merge pull request #32522 from storybookjs/version-non-patch-from-10.0.0-beta.6
Release: Prerelease 10.0.0-beta.7
2 parents ab5f8e9 + 8967a51 commit 6aba6ef

File tree

168 files changed

+6372
-1712
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

168 files changed

+6372
-1712
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ code/bench-results/
5757
/packs
5858
code/.nx/cache
5959
code/.nx/workspace-data
60-
code/.vite-inspect
60+
.vite-inspect
6161
.nx/cache
6262
.nx/workspace-data
6363
!**/fixtures/**/yarn.lock

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 9.1.8
2+
3+
- PreactVite: Add `node` entry point - [#32534](https://github.com/storybookjs/storybook/pull/32534), thanks @ndelangen!
4+
15
## 9.1.7
26

37
- Dependencies: Update `vite-plugin-storybook-nextjs` to 2.0.7 - [#32331](https://github.com/storybookjs/storybook/pull/32331), thanks @k35o!

CHANGELOG.prerelease.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
## 10.0.0-beta.7
2+
3+
- Addon A11y: Prevent setting highlights for old results - [#32178](https://github.com/storybookjs/storybook/pull/32178), thanks @ghengeveld!
4+
- AddonViewport: Stricter types - [#32324](https://github.com/storybookjs/storybook/pull/32324), thanks @hpohlmeyer!
5+
- CSF: Add Storybook test syntax (Storybook v10) - [#32455](https://github.com/storybookjs/storybook/pull/32455), thanks @yannbf!
6+
- Controls: Allow primitive values of ReactNode argType - [#31931](https://github.com/storybookjs/storybook/pull/31931), thanks @alexey-kozlenkov!
7+
- Core: Prevent `BAIL` state from showing in interactions panel when switching stories - [#32172](https://github.com/storybookjs/storybook/pull/32172), thanks @ghengeveld!
8+
- CoreServer: Fix `Arc can't get every window` - [#32508](https://github.com/storybookjs/storybook/pull/32508), thanks @ndelangen!
9+
- Dts: Ensure `.tsx` files emit `.d.ts` type files - [#32461](https://github.com/storybookjs/storybook/pull/32461), thanks @mrginglymus!
10+
- Svelte: Improve support for async components - [#31476](https://github.com/storybookjs/storybook/pull/31476), thanks @JReinhold!
11+
- SvelteKit: Add support for mocking `$app/state` - [#31369](https://github.com/storybookjs/storybook/pull/31369), thanks @xeho91!
12+
- SvelteKit: Fix `set_context_after_init` error when experimental async is enabled - [#32513](https://github.com/storybookjs/storybook/pull/32513), thanks @Jakeii!
13+
- UI: Allow showing or hiding the addon panel - [#32348](https://github.com/storybookjs/storybook/pull/32348), thanks @Sidnioulz!
14+
115
## 10.0.0-beta.6
216

317
- Core: Add "open in editor" feature - [#32452](https://github.com/storybookjs/storybook/pull/32452), thanks @yannbf!

code/.storybook/main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ const config = defineMain({
136136
},
137137
features: {
138138
developmentModeForBuild: true,
139+
experimentalTestSyntax: true,
139140
},
140141
staticDirs: [{ from: './bench/bundle-analyzer', to: '/bundle-analyzer' }],
141142
viteFinal: async (viteConfig, { configType }) => {

code/.storybook/preview.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,18 +216,21 @@ const decorators = [
216216
* This decorator renders the stories side-by-side, stacked or default based on the theme switcher
217217
* in the toolbar
218218
*/
219-
(StoryFn, { globals, playFunction, args, storyGlobals, parameters }) => {
219+
(StoryFn, { globals, playFunction, testFunction, args, storyGlobals, parameters }) => {
220220
let theme = globals.sb_theme;
221221
let showPlayFnNotice = false;
222222

223223
// this makes the decorator be out of 'phase' with the actually selected theme in the toolbar
224224
// but this is acceptable, I guess
225225
// we need to ensure only a single rendering in chromatic
226226
// a more 'correct' approach would be to set a specific theme global on every story that has a playFunction
227-
if (playFunction && args.autoplay !== false && !(theme === 'light' || theme === 'dark')) {
227+
if (
228+
(testFunction || (playFunction && args.autoplay !== false)) &&
229+
!(theme === 'light' || theme === 'dark')
230+
) {
228231
theme = 'light';
229232
showPlayFnNotice = true;
230-
} else if (isChromatic() && !storyGlobals.sb_theme && !playFunction) {
233+
} else if (isChromatic() && !storyGlobals.sb_theme && !playFunction && !testFunction) {
231234
theme = 'stacked';
232235
}
233236

@@ -282,8 +285,8 @@ const decorators = [
282285
<>
283286
<PlayFnNotice>
284287
<span>
285-
Detected play function in Chromatic. Rendering only light theme to avoid
286-
multiple play functions in the same story.
288+
Detected play/test function in Chromatic. Rendering only light theme to avoid
289+
multiple play/test functions in the same story.
287290
</span>
288291
</PlayFnNotice>
289292
<div style={{ marginBottom: 20 }} />

code/addons/a11y/src/components/A11yContext.tsx

Lines changed: 81 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -295,11 +295,13 @@ export const A11yContextProvider: FC<PropsWithChildren> = (props) => {
295295
setStatus(getInitialStatus(manual));
296296
}, [getInitialStatus, manual]);
297297

298+
const isInitial = status === 'initial';
299+
298300
useEffect(() => {
299301
emit(REMOVE_HIGHLIGHT, `${ADDON_ID}/selected`);
300302
emit(REMOVE_HIGHLIGHT, `${ADDON_ID}/others`);
301303

302-
if (!highlighted) {
304+
if (!highlighted || isInitial) {
303305
return;
304306
}
305307

@@ -312,84 +314,88 @@ export const A11yContextProvider: FC<PropsWithChildren> = (props) => {
312314
const target = result?.nodes[Number(number) - 1]?.target;
313315
return target ? [String(target)] : [];
314316
});
315-
emit(HIGHLIGHT, {
316-
id: `${ADDON_ID}/selected`,
317-
priority: 1,
318-
selectors: selected,
319-
styles: {
320-
outline: `1px solid color-mix(in srgb, ${colorsByType[tab]}, transparent 30%)`,
321-
backgroundColor: 'transparent',
322-
},
323-
hoverStyles: {
324-
outlineWidth: '2px',
325-
},
326-
focusStyles: {
327-
backgroundColor: 'transparent',
328-
},
329-
menu: results?.[tab as RuleType].map<HighlightMenuItem[]>((result) => {
330-
const selectors = result.nodes
331-
.flatMap((n) => n.target)
332-
.map(String)
333-
.filter((e) => selected.includes(e));
334-
return [
335-
{
336-
id: `${tab}.${result.id}:info`,
337-
title: getTitleForAxeResult(result),
338-
description: getFriendlySummaryForAxeResult(result),
339-
selectors,
340-
},
341-
{
342-
id: `${tab}.${result.id}`,
343-
iconLeft: 'info',
344-
iconRight: 'shareAlt',
345-
title: 'Learn how to resolve this violation',
346-
clickEvent: EVENTS.SELECT,
347-
selectors,
348-
},
349-
];
350-
}),
351-
});
317+
if (selected.length) {
318+
emit(HIGHLIGHT, {
319+
id: `${ADDON_ID}/selected`,
320+
priority: 1,
321+
selectors: selected,
322+
styles: {
323+
outline: `1px solid color-mix(in srgb, ${colorsByType[tab]}, transparent 30%)`,
324+
backgroundColor: 'transparent',
325+
},
326+
hoverStyles: {
327+
outlineWidth: '2px',
328+
},
329+
focusStyles: {
330+
backgroundColor: 'transparent',
331+
},
332+
menu: results?.[tab as RuleType].map<HighlightMenuItem[]>((result) => {
333+
const selectors = result.nodes
334+
.flatMap((n) => n.target)
335+
.map(String)
336+
.filter((e) => selected.includes(e));
337+
return [
338+
{
339+
id: `${tab}.${result.id}:info`,
340+
title: getTitleForAxeResult(result),
341+
description: getFriendlySummaryForAxeResult(result),
342+
selectors,
343+
},
344+
{
345+
id: `${tab}.${result.id}`,
346+
iconLeft: 'info',
347+
iconRight: 'shareAlt',
348+
title: 'Learn how to resolve this violation',
349+
clickEvent: EVENTS.SELECT,
350+
selectors,
351+
},
352+
];
353+
}),
354+
});
355+
}
352356

353357
const others = results?.[tab as RuleType]
354358
.flatMap((r) => r.nodes.flatMap((n) => n.target).map(String))
355359
.filter((e) => ![...unhighlightedSelectors, ...selected].includes(e));
356-
emit(HIGHLIGHT, {
357-
id: `${ADDON_ID}/others`,
358-
selectors: others,
359-
styles: {
360-
outline: `1px solid color-mix(in srgb, ${colorsByType[tab]}, transparent 30%)`,
361-
backgroundColor: `color-mix(in srgb, ${colorsByType[tab]}, transparent 60%)`,
362-
},
363-
hoverStyles: {
364-
outlineWidth: '2px',
365-
},
366-
focusStyles: {
367-
backgroundColor: 'transparent',
368-
},
369-
menu: results?.[tab as RuleType].map<HighlightMenuItem[]>((result) => {
370-
const selectors = result.nodes
371-
.flatMap((n) => n.target)
372-
.map(String)
373-
.filter((e) => !selected.includes(e));
374-
return [
375-
{
376-
id: `${tab}.${result.id}:info`,
377-
title: getTitleForAxeResult(result),
378-
description: getFriendlySummaryForAxeResult(result),
379-
selectors,
380-
},
381-
{
382-
id: `${tab}.${result.id}`,
383-
iconLeft: 'info',
384-
iconRight: 'shareAlt',
385-
title: 'Learn how to resolve this violation',
386-
clickEvent: EVENTS.SELECT,
387-
selectors,
388-
},
389-
];
390-
}),
391-
});
392-
}, [emit, highlighted, results, tab, selectedItems]);
360+
if (others?.length) {
361+
emit(HIGHLIGHT, {
362+
id: `${ADDON_ID}/others`,
363+
selectors: others,
364+
styles: {
365+
outline: `1px solid color-mix(in srgb, ${colorsByType[tab]}, transparent 30%)`,
366+
backgroundColor: `color-mix(in srgb, ${colorsByType[tab]}, transparent 60%)`,
367+
},
368+
hoverStyles: {
369+
outlineWidth: '2px',
370+
},
371+
focusStyles: {
372+
backgroundColor: 'transparent',
373+
},
374+
menu: results?.[tab as RuleType].map<HighlightMenuItem[]>((result) => {
375+
const selectors = result.nodes
376+
.flatMap((n) => n.target)
377+
.map(String)
378+
.filter((e) => !selected.includes(e));
379+
return [
380+
{
381+
id: `${tab}.${result.id}:info`,
382+
title: getTitleForAxeResult(result),
383+
description: getFriendlySummaryForAxeResult(result),
384+
selectors,
385+
},
386+
{
387+
id: `${tab}.${result.id}`,
388+
iconLeft: 'info',
389+
iconRight: 'shareAlt',
390+
title: 'Learn how to resolve this violation',
391+
clickEvent: EVENTS.SELECT,
392+
selectors,
393+
},
394+
];
395+
}),
396+
});
397+
}
398+
}, [isInitial, emit, highlighted, results, tab, selectedItems]);
393399

394400
const discrepancy: TestDiscrepancy = useMemo(() => {
395401
if (!currentStoryA11yStatusValue) {

code/addons/docs/src/blocks/blocks/external/ExternalPreview.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,11 @@ export class ExternalPreview<TRenderer extends Renderer = Renderer> extends Prev
7171
title,
7272
name,
7373
type: 'story',
74+
subtype: 'story',
7475
};
7576
});
7677

78+
// TODO: We probably need to do something here about story tests
7779
this.onStoriesChanged({ storyIndex: this.storyIndex });
7880

7981
return csfFile;

code/addons/docs/src/preview.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
import type { PreparedStory } from 'storybook/internal/types';
22

3-
import * as tocbot from 'tocbot';
4-
5-
if (!globalThis.__STORYBOOK_UNSAFE_TOCBOT__) {
6-
// Users that load dynamic content need to have a way to refresh the TOC, so we expose the tocbot instance
7-
globalThis.__STORYBOOK_UNSAFE_TOCBOT__ = tocbot.default ?? tocbot;
8-
}
9-
103
const excludeTags = Object.entries(globalThis.TAGS_OPTIONS ?? {}).reduce(
114
(acc, entry) => {
125
const [tag, option] = entry;

code/addons/docs/src/typings.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ declare var __DOCS_CONTEXT__: any;
77
declare var PREVIEW_URL: any;
88
declare var LOGLEVEL: 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'silent' | undefined;
99
declare var TAGS_OPTIONS: import('storybook/internal/types').TagsOptions;
10-
declare var __STORYBOOK_UNSAFE_TOCBOT__: typeof import('tocbot').default;
1110

1211
declare module '*.md';
1312
declare module '*.md?raw';

code/addons/vitest/src/components/TestProviderRender.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ export const InSidebarContextMenu: Story = {
310310
entry: {
311311
id: 'story-id-1',
312312
type: 'story',
313+
subtype: 'story',
313314
name: 'Example Story',
314315
tags: [],
315316
title: 'Example Story',

0 commit comments

Comments
 (0)