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

Release: Prerelease 8.3.0-alpha.2 #28617

Merged
merged 31 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
8d7ec24
change addon jsx to react-jsx
williamhelmrath Jul 10, 2024
bac0a0b
Fix: Prevent iframe from capturing mouse events in composed Storybooks
Vincentdevreede Jul 12, 2024
82a1336
fix status in interactions panel tab
yannbf Jul 12, 2024
33b487f
fix(vue-component-meta): fix out of memory issue
larsrickert Jul 13, 2024
70a6a41
update comment
larsrickert Jul 13, 2024
ebe47ff
fix test
larsrickert Jul 13, 2024
91e53a9
Add header for MountMustBeDestructuredError message
0916dhkim Jul 13, 2024
8e31fb2
feat: add conditional logging for manager and preview start
tobiasdiez Jul 15, 2024
e9e441a
Update CHANGELOG.md for v8.2.4 [skip ci]
storybook-bot Jul 16, 2024
6899755
Merge branch 'next' into header-for-mount-error
kasperpeulen Jul 16, 2024
121c448
Merge branch 'next' into addon-react-jsx
ndelangen Jul 16, 2024
3d6f63f
Merge pull request #28541 from williamhelmrath/addon-react-jsx
ndelangen Jul 16, 2024
6c895fe
Merge pull request #28603 from tobiasdiez/quiet
ndelangen Jul 16, 2024
d44e0e7
Merge branch 'next' into next
ndelangen Jul 16, 2024
40b1b2f
Merge branch 'next' into yann/fix-interaction-status
ndelangen Jul 16, 2024
7c3bac8
Merge pull request #28580 from storybookjs/yann/fix-interaction-status
ndelangen Jul 16, 2024
4f9108c
Merge pull request #28568 from Vincentdevreede/next
ndelangen Jul 16, 2024
e75ac8b
update docs
larsrickert Jul 16, 2024
9601e82
Merge branch 'next' into larsrickert/26647-out-of-memory
kasperpeulen Jul 16, 2024
f00dec5
Remove external overrides, use package.json as source of truth
kasperpeulen Jul 17, 2024
bd7c2b7
Merge pull request #28632 from storybookjs/kasper/externals
kasperpeulen Jul 17, 2024
0b54024
Merge pull request #28590 from 0916dhkim/header-for-mount-error
kasperpeulen Jul 17, 2024
3590a1c
Merge pull request #28589 from storybookjs/larsrickert/26647-out-of-m…
kasperpeulen Jul 17, 2024
e33dc8d
Fix source code snippet for newly created stories with a space in the…
ghengeveld Jul 18, 2024
cbac722
add the globals export on manager, even though this should not be use…
ndelangen Jul 18, 2024
0c91f47
Merge pull request #28650 from storybookjs/norbert/cpc-backwards-supp…
ndelangen Jul 18, 2024
6fbdf6a
fix: correct path to the `@storybook/theming/create` alias
Averethel Jul 18, 2024
57d0cd7
consistency
ndelangen Jul 19, 2024
2f38895
Merge pull request #28649 from storybookjs/fix-new-story-snippet
shilman Jul 19, 2024
4ea0e0c
Merge pull request #28643 from Averethel/patch-1
ndelangen Jul 19, 2024
a495441
Write changelog for 8.3.0-alpha.2 [skip ci]
storybook-bot Jul 19, 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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 8.2.4

- CLI: Add diagnostic when the `storybook` package is missing - [#28604](https://github.com/storybookjs/storybook/pull/28604), thanks @kasperpeulen!
- CLI: Make a few automigrations run on all version upgrades - [#28601](https://github.com/storybookjs/storybook/pull/28601), thanks @yannbf!
- CPC: Direct dependencies on shim packages in renderers - [#28599](https://github.com/storybookjs/storybook/pull/28599), thanks @ndelangen!

## 8.2.3

- Bug: Fix invalid docs links in Configure.mdx template page - [#28560](https://github.com/storybookjs/storybook/pull/28560), thanks @kylegach!
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.prerelease.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
## 8.3.0-alpha.2

- Addon-Interactions: Fix status in panel tab - [#28580](https://github.com/storybookjs/storybook/pull/28580), thanks @yannbf!
- Build: Remove external overrides, use package.json as source of truth - [#28632](https://github.com/storybookjs/storybook/pull/28632), thanks @kasperpeulen!
- CLI: Add conditional logging for manager and preview start - [#28603](https://github.com/storybookjs/storybook/pull/28603), thanks @tobiasdiez!
- CPC: Add the globals export for manager - [#28650](https://github.com/storybookjs/storybook/pull/28650), thanks @ndelangen!
- CPC: Correct path to the `@storybook/theming/create` alias - [#28643](https://github.com/storybookjs/storybook/pull/28643), thanks @Averethel!
- Core: Fix manager-builder `tsconfig` to emit `react-jsx` - [#28541](https://github.com/storybookjs/storybook/pull/28541), thanks @williamhelmrath!
- Fix: Add header for MountMustBeDestructuredError message - [#28590](https://github.com/storybookjs/storybook/pull/28590), thanks @0916dhkim!
- Fix: Prevent iframe from capturing mouse events in composed Storybooks - [#28568](https://github.com/storybookjs/storybook/pull/28568), thanks @Vincentdevreede!
- Onboarding: Fix code snippet when story name differs from export name - [#28649](https://github.com/storybookjs/storybook/pull/28649), thanks @ghengeveld!
- Vue: Fix out of memory error when using vue-component-meta - [#28589](https://github.com/storybookjs/storybook/pull/28589), thanks @larsrickert!

## 8.3.0-alpha.1

- Bug: Fix invalid docs links in Configure.mdx template page - [#28560](https://github.com/storybookjs/storybook/pull/28560), thanks @kylegach!
Expand Down
6 changes: 3 additions & 3 deletions code/addons/docs/src/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ async function webpack(
*
* In the future the `@storybook/theming` and `@storybook/components` can be removed, as they should be singletons in the future due to the peerDependency on `storybook` package.
*/
const cliPath = require.resolve('storybook/package.json');
const themingPath = join(cliPath, '..', 'core', 'theming', 'index.js');
const cliPath = dirname(require.resolve('storybook/package.json'));
const themingPath = join(cliPath, 'core', 'theming', 'index.js');
const themingCreatePath = join(cliPath, 'core', 'theming', 'create.js');

const componentsPath = join(cliPath, '..', 'core', 'components', 'index.js');
const componentsPath = join(cliPath, 'core', 'components', 'index.js');
const blocksPath = dirname(require.resolve('@storybook/blocks/package.json'));
if (Array.isArray(webpackConfig.resolve?.alias)) {
alias = [...webpackConfig.resolve?.alias];
Expand Down
6 changes: 3 additions & 3 deletions code/addons/interactions/src/Panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,13 @@ export const Panel = memo<{ storyId: string }>(function PanelMemoized({ storyId
});
},
[STORY_THREW_EXCEPTION]: () => {
set((s) => ({ ...s, isErrored: true }));
set((s) => ({ ...s, isErrored: true, hasException: true }));
},
[PLAY_FUNCTION_THREW_EXCEPTION]: (e) => {
set((s) => ({ ...s, caughtException: e }));
set((s) => ({ ...s, caughtException: e, hasException: true }));
},
[UNHANDLED_ERRORS_WHILE_PLAYING]: (e) => {
set((s) => ({ ...s, unhandledErrors: e }));
set((s) => ({ ...s, unhandledErrors: e, hasException: true }));
},
},
[collapsed]
Expand Down
7 changes: 0 additions & 7 deletions code/addons/interactions/src/components/TabStatus.tsx

This file was deleted.

4 changes: 1 addition & 3 deletions code/addons/interactions/src/manager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ import React, { useCallback } from 'react';
import type { Combo } from 'storybook/internal/manager-api';
import { addons, Consumer, types, useAddonState } from 'storybook/internal/manager-api';
import { AddonPanel, Badge, Spaced } from 'storybook/internal/components';
import { CallStates } from '@storybook/instrumenter';
import { ADDON_ID, PANEL_ID } from './constants';
import { Panel } from './Panel';
import { TabIcon } from './components/TabStatus';

function Title() {
const [addonState = {}] = useAddonState(ADDON_ID);
Expand All @@ -18,7 +16,7 @@ function Title() {
{interactionsCount && !hasException ? (
<Badge status="neutral">{interactionsCount}</Badge>
) : null}
{hasException ? <TabIcon status={CallStates.ERROR} /> : null}
{hasException ? <Badge status="negative">{interactionsCount}</Badge> : null}
</Spaced>
</div>
);
Expand Down
5 changes: 3 additions & 2 deletions code/addons/onboarding/src/Onboarding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export default function Onboarding({ api }: { api: API }) {
const [createNewStoryForm, setCreateNewStoryForm] = useState<HTMLElement | null>();
const [createdStory, setCreatedStory] = useState<{
newStoryName: string;
newStoryExportName: string;
sourceFileContent: string;
sourceFileName: string;
} | null>();
Expand Down Expand Up @@ -158,8 +159,8 @@ export default function Onboarding({ api }: { api: API }) {
}

const source = createdStory?.sourceFileContent;
const startIndex = source?.lastIndexOf(`export const ${createdStory?.newStoryName}`);
const snippet = source?.slice(startIndex);
const startIndex = source?.lastIndexOf(`export const ${createdStory?.newStoryExportName}`);
const snippet = source?.slice(startIndex).trim();
const startingLineNumber = source?.slice(0, startIndex).split('\n').length;

const steps: StepDefinition[] = [
Expand Down
2 changes: 1 addition & 1 deletion code/core/assets/server/addon.tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"jsx": "react",
"jsx": "react-jsx",
"jsxImportSource": "react"
}
}
8 changes: 8 additions & 0 deletions code/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@
"import": "./dist/manager/globals-module-info.js",
"require": "./dist/manager/globals-module-info.cjs"
},
"./manager/globals": {
"types": "./dist/manager/globals.d.ts",
"import": "./dist/manager/globals.js",
"require": "./dist/manager/globals.cjs"
},
"./preview/globals": {
"types": "./dist/preview/globals.d.ts",
"import": "./dist/preview/globals.js",
Expand Down Expand Up @@ -229,6 +234,9 @@
"manager/globals-module-info": [
"./dist/manager/globals-module-info.d.ts"
],
"manager/globals": [
"./dist/manager/globals.d.ts"
],
"preview/globals": [
"./dist/preview/globals.d.ts"
]
Expand Down
8 changes: 2 additions & 6 deletions code/core/scripts/entries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,13 @@ export const getEntries = (cwd: string) => {
define('src/preview-api/index.ts', ['browser', 'node'], true),
define('src/manager-api/index.ts', ['browser', 'node'], true, ['react']),
define('src/router/index.ts', ['browser', 'node'], true, ['react']),
define('src/components/index.ts', ['browser', 'node'], true, [
'react',
'react-dom',
'@storybook/csf',
'@storybook/global',
]),
define('src/components/index.ts', ['browser', 'node'], true, ['react', 'react-dom']),
define('src/theming/index.ts', ['browser', 'node'], true, ['react']),
define('src/theming/create.ts', ['browser', 'node'], true, ['react']),
define('src/docs-tools/index.ts', ['browser', 'node'], true),

define('src/manager/globals-module-info.ts', ['node'], true),
define('src/manager/globals.ts', ['node'], true),
define('src/preview/globals.ts', ['node'], true),
];
};
Expand Down
4 changes: 3 additions & 1 deletion code/core/src/builder-manager/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ const starter: StarterFunction = async function* starterGeneratorFn({
options,
router,
}) {
logger.info('=> Starting manager..');
if (!options.quiet) {
logger.info('=> Starting manager..');
}

const {
config,
Expand Down
2 changes: 2 additions & 0 deletions code/core/src/core-events/data/save-story.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ export interface SaveStoryResponsePayload {
csfId: string;
newStoryId?: string;
newStoryName?: string;
newStoryExportName?: string;
sourceFileContent?: string;
sourceFileName?: string;
sourceStoryName?: string;
sourceStoryExportName?: string;
}
4 changes: 3 additions & 1 deletion code/core/src/core-server/dev-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ export async function storybookDevServer(options: Options) {
let previewStarted: Promise<any> = Promise.resolve();

if (!options.ignorePreview) {
logger.info('=> Starting preview..');
if (!options.quiet) {
logger.info('=> Starting preview..');
}
previewStarted = previewBuilder
.start({
startTime: process.hrtime(),
Expand Down
2 changes: 2 additions & 0 deletions code/core/src/core-server/utils/save-story/save-story.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,11 @@ export function initializeSaveStory(channel: Channel, options: Options, coreConf
csfId,
newStoryId,
newStoryName,
newStoryExportName: name,
sourceFileContent: code,
sourceFileName,
sourceStoryName,
sourceStoryExportName: storyName,
},
error: null,
} satisfies ResponseData<SaveStoryResponsePayload>);
Expand Down
2 changes: 1 addition & 1 deletion code/core/src/manager/components/layout/useDragging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function useDragging({
useEffect(() => {
const panelResizer = panelResizerRef.current;
const sidebarResizer = sidebarResizerRef.current;
const previewIframe = document.querySelector('#storybook-preview-iframe') as HTMLIFrameElement;
const previewIframe = document.querySelector('#storybook-preview-wrapper') as HTMLIFrameElement;
let draggedElement: typeof panelResizer | typeof sidebarResizer | null = null;

const onDragStart = (e: MouseEvent) => {
Expand Down
1 change: 1 addition & 0 deletions code/core/src/preview-errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ export class MountMustBeDestructuredError extends StorybookError {
category: Category.PREVIEW_API,
code: 12,
message: dedent`
Incorrect use of mount in the play function.

To use mount in the play function, you must satisfy the following two requirements:

Expand Down
1 change: 1 addition & 0 deletions code/deprecated/manager/globals.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('storybook/internal/manager/globals');
1 change: 1 addition & 0 deletions code/deprecated/preview/globals.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('storybook/internal/preview/globals');
20 changes: 20 additions & 0 deletions code/frameworks/vue3-vite/src/plugins/vue-component-meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,26 @@ export async function vueComponentMeta(tsconfigPath = 'tsconfig.json'): Promise<

const exportName = exportNames[index];

// we remove nested object schemas here since they are not used inside Storybook (we don't generate controls for object properties)
// and they can cause "out of memory" issues for large/complex schemas (e.g. HTMLElement)
// it also reduced the bundle size when running "Storybook build" when such schemas are used
(['props', 'exposed'] as const).forEach((key) => {
meta[key].forEach((value) => {
if (typeof value.schema !== 'object') return;

// we need to use Object.defineProperty here since schema is a getter so we can not set it directly
Object.defineProperty(value, 'schema', {
configurable: true,
enumerable: true,
value: {
kind: value.schema.kind,
type: value.schema.type,
// note that value.schema.schema is not included here (see comment above)
},
});
});
});

const exposed =
// the meta also includes duplicated entries in the "exposed" array with "on"
// prefix (e.g. onClick instead of click), so we need to filter them out here
Expand Down
1 change: 1 addition & 0 deletions code/lib/cli/core/manager/globals.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('@storybook/core/manager/globals');
2 changes: 2 additions & 0 deletions code/lib/cli/core/manager/globals.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from '@storybook/core/manager/globals';
export type * from '@storybook/core/manager/globals';
1 change: 1 addition & 0 deletions code/lib/cli/core/manager/globals.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '@storybook/core/manager/globals';
8 changes: 8 additions & 0 deletions code/lib/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@
"types": "./core/preview/globals.d.ts",
"import": "./core/preview/globals.js",
"require": "./core/preview/globals.cjs"
},
"./internal/manager/globals": {
"types": "./core/manager/globals.d.ts",
"import": "./core/manager/globals.js",
"require": "./core/manager/globals.cjs"
}
},
"main": "dist/index.cjs",
Expand Down Expand Up @@ -219,6 +224,9 @@
"internal/manager-errors": [
"./core/manager-errors.d.ts"
],
"internal/manager/globals": [
"./core/manager/globals.d.ts"
],
"internal/manager/globals-module-info": [
"./core/manager/globals-module-info.d.ts"
],
Expand Down
3 changes: 2 additions & 1 deletion code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -278,5 +278,6 @@
"Dependency Upgrades"
]
]
}
},
"deferredNextVersion": "8.3.0-alpha.2"
}
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,7 @@ exports[`extractArgTypes (vue-docgen-api) > should extract props for component 1
"value": {
"name": "object",
"required": false,
"value": {
"nestedProp": {
"name": "string",
"required": true,
},
},
"value": {},
},
},
},
Expand All @@ -183,12 +178,7 @@ exports[`extractArgTypes (vue-docgen-api) > should extract props for component 1
"value": {
"name": "object",
"required": false,
"value": {
"nestedProp": {
"name": "string",
"required": true,
},
},
"value": {},
},
},
},
Expand Down Expand Up @@ -279,12 +269,7 @@ exports[`extractArgTypes (vue-docgen-api) > should extract props for component 1
"type": {
"name": "object",
"required": true,
"value": {
"foo": {
"name": "string",
"required": true,
},
},
"value": {},
},
},
"literalFromContext": {
Expand Down Expand Up @@ -325,12 +310,7 @@ exports[`extractArgTypes (vue-docgen-api) > should extract props for component 1
"type": {
"name": "object",
"required": true,
"value": {
"nestedProp": {
"name": "string",
"required": true,
},
},
"value": {},
},
},
"nestedIntersection": {
Expand All @@ -347,16 +327,7 @@ exports[`extractArgTypes (vue-docgen-api) > should extract props for component 1
"type": {
"name": "object",
"required": true,
"value": {
"additionalProp": {
"name": "string",
"required": true,
},
"nestedProp": {
"name": "string",
"required": true,
},
},
"value": {},
},
},
"nestedOptional": {
Expand All @@ -377,22 +348,12 @@ exports[`extractArgTypes (vue-docgen-api) > should extract props for component 1
{
"name": "object",
"required": false,
"value": {
"nestedProp": {
"name": "string",
"required": true,
},
},
"value": {},
},
{
"name": "object",
"required": false,
"value": {
"nestedProp": {
"name": "string",
"required": true,
},
},
"value": {},
},
],
},
Expand All @@ -411,13 +372,7 @@ exports[`extractArgTypes (vue-docgen-api) > should extract props for component 1
"type": {
"name": "object",
"required": false,
"value": {
"recursive": {
"name": "other",
"required": true,
"value": "MyNestedRecursiveProps",
},
},
"value": {},
},
},
"stringArray": {
Expand Down
Loading
Loading