mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-07 07:21:17 +08:00
Merge remote-tracking branch 'origin/next' into valentin/move-addon-actions-into-core
This commit is contained in:
commit
733ff35575
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
|
||||
import type { Meta } from '@storybook/react';
|
||||
import type { Meta } from '@storybook/react-vite';
|
||||
|
||||
// @ts-expect-error - TS doesn't know about import.meta.glob from Vite
|
||||
const allMetafiles = import.meta.glob([
|
||||
|
@ -16,8 +16,8 @@ import {
|
||||
|
||||
import { DocsContext } from '@storybook/blocks';
|
||||
import { global } from '@storybook/global';
|
||||
import type { Decorator, Loader, ReactRenderer } from '@storybook/react';
|
||||
|
||||
import type { Decorator, Loader, ReactRenderer } from '@storybook/react-vite';
|
||||
// TODO add empty preview
|
||||
// import * as storysource from '@storybook/addon-storysource';
|
||||
// import * as designs from '@storybook/addon-designs/preview';
|
||||
|
@ -3,7 +3,7 @@ import React from 'react';
|
||||
import { ManagerContext } from 'storybook/internal/manager-api';
|
||||
import { ThemeProvider, convert, themes } from 'storybook/internal/theming';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import type axe from 'axe-core';
|
||||
import { fn } from 'storybook/test';
|
||||
|
@ -2,7 +2,7 @@ import React from 'react';
|
||||
|
||||
import { ManagerContext } from 'storybook/internal/manager-api';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { action } from 'storybook/actions';
|
||||
import { expect, fireEvent, fn, userEvent, within } from 'storybook/test';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { CallStates } from 'storybook/internal/instrumenter';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { expect, userEvent, within } from 'storybook/test';
|
||||
|
||||
|
@ -3,7 +3,7 @@ import React from 'react';
|
||||
import { CallStates } from 'storybook/internal/instrumenter';
|
||||
import { styled } from 'storybook/internal/theming';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { expect, userEvent, waitFor, within } from 'storybook/test';
|
||||
|
||||
|
@ -48,7 +48,6 @@
|
||||
"@neoconfetti/react": "^1.0.0",
|
||||
"@radix-ui/react-dialog": "^1.0.5",
|
||||
"@storybook/icons": "^1.2.12",
|
||||
"@storybook/react": "workspace:*",
|
||||
"framer-motion": "^11.0.3",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { Button } from './Button';
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { Confetti } from './Confetti';
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { expect, waitFor, within } from 'storybook/test';
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React, { useState } from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { expect, userEvent, waitFor, within } from 'storybook/test';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { SplashScreen } from './SplashScreen';
|
||||
|
||||
|
@ -2,7 +2,7 @@ import React, { useState } from 'react';
|
||||
|
||||
import { ManagerContext } from 'storybook/internal/manager-api';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { expect, fn, userEvent, within } from 'storybook/test';
|
||||
import dedent from 'ts-dedent';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { CallStates } from 'storybook/internal/instrumenter';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { expect, userEvent, within } from 'storybook/test';
|
||||
|
||||
|
@ -4,7 +4,7 @@ import { CallStates } from 'storybook/internal/instrumenter';
|
||||
import { ManagerContext } from 'storybook/internal/manager-api';
|
||||
import { styled } from 'storybook/internal/theming';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { expect, fn, userEvent, waitFor, within } from 'storybook/test';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { RelativeTime } from './RelativeTime';
|
||||
|
||||
|
@ -3,7 +3,7 @@ import React from 'react';
|
||||
import { CallStates } from 'storybook/internal/instrumenter';
|
||||
import { ManagerContext } from 'storybook/internal/manager-api';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
|
@ -5,7 +5,7 @@ import { ManagerContext } from 'storybook/internal/manager-api';
|
||||
import { styled } from 'storybook/internal/theming';
|
||||
import { Addon_TypesEnum } from 'storybook/internal/types';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { expect, fn } from 'storybook/test';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { TestStatusIcon } from './TestStatusIcon';
|
||||
|
||||
|
@ -158,7 +158,7 @@ describe('Helpers', () => {
|
||||
filePath === normalizePath('@storybook/react/template/cli')
|
||||
);
|
||||
await helpers.copyTemplateFiles({
|
||||
renderer: 'react',
|
||||
templateLocation: 'react',
|
||||
language,
|
||||
packageManager: packageManagerMock,
|
||||
commonAssetsDir: normalizePath('create-storybook/rendererAssets/common'),
|
||||
@ -182,7 +182,7 @@ describe('Helpers', () => {
|
||||
return filePath === normalizePath('@storybook/react/template/cli') || filePath === './src';
|
||||
});
|
||||
await helpers.copyTemplateFiles({
|
||||
renderer: 'react',
|
||||
templateLocation: 'react',
|
||||
language: SupportedLanguage.JAVASCRIPT,
|
||||
packageManager: packageManagerMock,
|
||||
features: ['dev', 'docs', 'test'],
|
||||
@ -195,7 +195,7 @@ describe('Helpers', () => {
|
||||
return filePath === normalizePath('@storybook/react/template/cli');
|
||||
});
|
||||
await helpers.copyTemplateFiles({
|
||||
renderer: 'react',
|
||||
templateLocation: 'react',
|
||||
language: SupportedLanguage.JAVASCRIPT,
|
||||
packageManager: packageManagerMock,
|
||||
features: ['dev', 'docs', 'test'],
|
||||
@ -208,7 +208,7 @@ describe('Helpers', () => {
|
||||
const expectedMessage = `Unsupported renderer: ${renderer}`;
|
||||
await expect(
|
||||
helpers.copyTemplateFiles({
|
||||
renderer,
|
||||
templateLocation: renderer,
|
||||
language: SupportedLanguage.JAVASCRIPT,
|
||||
packageManager: packageManagerMock,
|
||||
features: ['dev', 'docs', 'test'],
|
||||
|
@ -135,7 +135,7 @@ export function copyTemplate(templateRoot: string, destination = '.') {
|
||||
|
||||
type CopyTemplateFilesOptions = {
|
||||
packageManager: JsPackageManager;
|
||||
renderer: SupportedFrameworks | SupportedRenderers;
|
||||
templateLocation: SupportedFrameworks | SupportedRenderers;
|
||||
language: SupportedLanguage;
|
||||
commonAssetsDir?: string;
|
||||
destination?: string;
|
||||
@ -205,7 +205,7 @@ export const cliStoriesTargetPath = async () => {
|
||||
|
||||
export async function copyTemplateFiles({
|
||||
packageManager,
|
||||
renderer,
|
||||
templateLocation,
|
||||
language,
|
||||
destination,
|
||||
commonAssetsDir,
|
||||
@ -218,7 +218,7 @@ export async function copyTemplateFiles({
|
||||
[SupportedLanguage.TYPESCRIPT_4_9]: 'ts-4-9',
|
||||
};
|
||||
// FIXME: remove after 9.0
|
||||
if (renderer === 'svelte') {
|
||||
if (templateLocation === 'svelte') {
|
||||
const svelteVersion = await getVersionSafe(packageManager, 'svelte');
|
||||
if (svelteVersion && major(svelteVersion) >= 5) {
|
||||
languageFolderMapping = {
|
||||
@ -230,7 +230,7 @@ export async function copyTemplateFiles({
|
||||
}
|
||||
}
|
||||
const templatePath = async () => {
|
||||
const baseDir = await getRendererDir(packageManager, renderer);
|
||||
const baseDir = await getRendererDir(packageManager, templateLocation);
|
||||
const assetsDir = join(baseDir, 'template', 'cli');
|
||||
|
||||
const assetsLanguage = join(assetsDir, languageFolderMapping[language]);
|
||||
@ -253,7 +253,7 @@ export async function copyTemplateFiles({
|
||||
if (existsSync(assetsDir)) {
|
||||
return assetsDir;
|
||||
}
|
||||
throw new Error(`Unsupported renderer: ${renderer} (${baseDir})`);
|
||||
throw new Error(`Unsupported renderer: ${templateLocation} (${baseDir})`);
|
||||
};
|
||||
|
||||
const destinationPath = destination ?? (await cliStoriesTargetPath());
|
||||
@ -264,7 +264,7 @@ export async function copyTemplateFiles({
|
||||
await cp(await templatePath(), destinationPath, { recursive: true, filter });
|
||||
|
||||
if (commonAssetsDir && features.includes('docs')) {
|
||||
let rendererType = frameworkToRenderer[renderer] || 'react';
|
||||
let rendererType = frameworkToRenderer[templateLocation] || 'react';
|
||||
|
||||
// This is only used for docs links and the docs site uses `vue` for both `vue` & `vue3` renderers
|
||||
if (rendererType === 'vue3') {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { Badge } from './Badge';
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
import React from 'react';
|
||||
|
||||
import { LinkIcon } from '@storybook/icons';
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { Form } from '../form';
|
||||
import { Button } from './Button';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { dedent } from 'ts-dedent';
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
import React from 'react';
|
||||
|
||||
import { FaceHappyIcon } from '@storybook/icons';
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { IconButton } from './IconButton';
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React, { useState } from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { expect, userEvent, within } from 'storybook/test';
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
import React from 'react';
|
||||
|
||||
import { StopAltIcon } from '@storybook/icons';
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { ProgressSpinner } from './ProgressSpinner';
|
||||
|
||||
|
@ -180,7 +180,7 @@ export const UnsupportedDark = {
|
||||
export const Story = {
|
||||
args: {
|
||||
language: 'jsx',
|
||||
children: `import type { Meta, StoryObj } from '@storybook/react';
|
||||
children: `import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { Header } from './Header';
|
||||
|
||||
|
@ -3,7 +3,8 @@ import React from 'react';
|
||||
import { Link } from 'storybook/internal/components';
|
||||
|
||||
import { DocumentIcon } from '@storybook/icons';
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { EmptyTabContent } from './EmptyTabContent';
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
import React from 'react';
|
||||
|
||||
import { BottomBarIcon, CloseIcon } from '@storybook/icons';
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { action } from 'core/src/actions/dist';
|
||||
import { expect } from 'storybook/test';
|
||||
|
@ -1,7 +1,8 @@
|
||||
import React from 'react';
|
||||
|
||||
import { LinkIcon, LinuxIcon } from '@storybook/icons';
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { action } from 'core/src/actions/dist';
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
|
||||
import type { Meta } from '@storybook/react';
|
||||
import type { Meta } from '@storybook/react-vite';
|
||||
|
||||
import { TooltipMessage } from './TooltipMessage';
|
||||
import { WithTooltip } from './WithTooltip';
|
||||
|
@ -3,7 +3,7 @@ import React from 'react';
|
||||
|
||||
import { styled } from 'storybook/internal/theming';
|
||||
|
||||
import type { StoryObj } from '@storybook/react';
|
||||
import type { StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { expect, screen } from 'storybook/test';
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import type { FC } from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
export default {
|
||||
title: 'MyComponent',
|
||||
|
@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import type { FC } from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
export default {
|
||||
title: 'MyComponent',
|
||||
|
@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import type { FC } from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
export default {
|
||||
title: 'MyComponent',
|
||||
|
@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import type { FC } from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
export default {
|
||||
title: 'MyComponent',
|
||||
|
@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import type { FC } from 'react';
|
||||
|
||||
import type { Meta } from '@storybook/react';
|
||||
import type { Meta } from '@storybook/react-vite';
|
||||
|
||||
export default {
|
||||
title: 'MyComponent',
|
||||
|
@ -4,7 +4,7 @@ import React, { useState } from 'react';
|
||||
import { LocationProvider } from 'storybook/internal/router';
|
||||
import { styled } from 'storybook/internal/theming';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { action } from 'core/src/actions/dist';
|
||||
import { fn } from 'storybook/test';
|
||||
|
@ -2,7 +2,7 @@ import React, { useEffect } from 'react';
|
||||
|
||||
import { ManagerContext } from 'storybook/internal/manager-api';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { within } from 'storybook/test';
|
||||
|
||||
|
@ -2,7 +2,7 @@ import React from 'react';
|
||||
|
||||
import { ManagerContext } from 'storybook/internal/manager-api';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { startCase } from 'es-toolkit';
|
||||
import { within } from 'storybook/test';
|
||||
|
@ -7,7 +7,8 @@ import {
|
||||
BookIcon as BookIconIcon,
|
||||
FaceHappyIcon,
|
||||
} from '@storybook/icons';
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { action } from 'core/src/actions/dist';
|
||||
import { expect, fn, userEvent, waitFor, within } from 'storybook/test';
|
||||
|
@ -2,7 +2,7 @@ import React from 'react';
|
||||
|
||||
import { LocationProvider } from 'storybook/internal/router';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import * as itemStories from './NotificationItem.stories';
|
||||
import { NotificationList } from './NotificationList';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { expect, findByText, fireEvent, fn } from 'storybook/test';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { FileSearchListLoadingSkeleton } from './FileSearchListSkeleton';
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React, { useState } from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { expect, findByText, fireEvent, fn } from 'storybook/test';
|
||||
|
||||
|
@ -4,7 +4,7 @@ import React from 'react';
|
||||
import { ThemeProvider, useTheme } from 'storybook/internal/theming';
|
||||
import type { Theme } from 'storybook/internal/theming';
|
||||
|
||||
import type { Meta, StoryFn, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryFn, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { action } from 'core/src/actions/dist';
|
||||
import { screen } from 'storybook/test';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { IconSymbols } from './IconSymbols';
|
||||
|
||||
|
@ -5,7 +5,8 @@ import type { State } from 'storybook/internal/manager-api';
|
||||
import { styled } from 'storybook/internal/theming';
|
||||
|
||||
import { LinkIcon } from '@storybook/icons';
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { expect, screen, userEvent, within } from 'storybook/test';
|
||||
|
||||
|
@ -3,7 +3,7 @@ import React from 'react';
|
||||
import type { API } from 'storybook/internal/manager-api';
|
||||
import { ManagerContext } from 'storybook/internal/manager-api';
|
||||
|
||||
import type { Meta, StoryFn } from '@storybook/react';
|
||||
import type { Meta, StoryFn } from '@storybook/react-vite';
|
||||
|
||||
import { action } from 'core/src/actions/dist';
|
||||
|
||||
|
@ -4,7 +4,7 @@ import type { IndexHash, State } from 'storybook/internal/manager-api';
|
||||
import { ManagerContext } from 'storybook/internal/manager-api';
|
||||
import type { API_StatusState, Addon_SidebarTopType } from 'storybook/internal/types';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { expect, fn, userEvent, within } from 'storybook/test';
|
||||
|
||||
|
@ -3,7 +3,7 @@ import React, { type FC, useEffect, useState } from 'react';
|
||||
import { type API, ManagerContext } from 'storybook/internal/manager-api';
|
||||
import { Addon_TypesEnum } from 'storybook/internal/types';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { expect, fireEvent, fn, waitFor, within } from 'storybook/test';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { findByRole, fn } from 'storybook/test';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
|
@ -6,7 +6,7 @@ import { ManagerContext, mockChannel } from 'storybook/internal/manager-api';
|
||||
import { styled } from 'storybook/internal/theming';
|
||||
import { Addon_TypesEnum } from 'storybook/internal/types';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { fireEvent, fn } from 'storybook/test';
|
||||
|
||||
|
@ -7,7 +7,7 @@ import {
|
||||
ManagerContext,
|
||||
} from 'storybook/internal/manager-api';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { action } from 'core/src/actions/dist';
|
||||
import { expect, fn, userEvent, within } from 'storybook/test';
|
||||
|
@ -2,7 +2,7 @@ import React from 'react';
|
||||
|
||||
import { ManagerContext } from 'storybook/internal/manager-api';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
|
@ -2,7 +2,7 @@ import React from 'react';
|
||||
|
||||
import { TooltipLinkList, WithTooltip } from 'storybook/internal/components';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { action } from 'core/src/actions/dist';
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
|
||||
import type { Decorator } from '@storybook/react';
|
||||
import type { Decorator } from '@storybook/react-vite';
|
||||
|
||||
import SettingsFooter from './SettingsFooter';
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
|
||||
import type { Decorator } from '@storybook/react';
|
||||
import type { Decorator } from '@storybook/react-vite';
|
||||
|
||||
import { actions as makeActions } from 'core/src/actions/dist';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { WhatsNewFooter } from './whats_new';
|
||||
|
||||
|
@ -46,9 +46,12 @@ const mockChannel = {
|
||||
describe('UniversalStore', () => {
|
||||
beforeEach((context) => {
|
||||
vi.useFakeTimers();
|
||||
let randomUUIDCounter = 0;
|
||||
vi.spyOn(globalThis.crypto, 'randomUUID').mockImplementation(() => {
|
||||
return `mocked-random-uuid-v4-${randomUUIDCounter++}`;
|
||||
|
||||
// Mock Date and Math.random to make the actorId deterministic
|
||||
let randomNumberCounter = 1;
|
||||
vi.setSystemTime(new Date('2025-02-14'));
|
||||
vi.spyOn(Math, 'random').mockImplementation(() => {
|
||||
return randomNumberCounter++ / 10;
|
||||
});
|
||||
|
||||
// Always prepare the store, unless the test is specifically for unprepared state
|
||||
@ -57,7 +60,7 @@ describe('UniversalStore', () => {
|
||||
}
|
||||
|
||||
return () => {
|
||||
randomUUIDCounter = 0;
|
||||
randomNumberCounter = 0;
|
||||
vi.clearAllTimers();
|
||||
mockedInstances.clearAllEnvironments();
|
||||
mockChannelListeners.clear();
|
||||
@ -78,7 +81,7 @@ describe('UniversalStore', () => {
|
||||
// Assert - the store should be created with the initial state and actor
|
||||
expect(store.getState()).toEqual({ count: 0 });
|
||||
expect(store.actor.type).toBe('LEADER');
|
||||
expect(store.actor.id).toBe('mocked-random-uuid-v4-0');
|
||||
expect(store.actor.id).toBe('m7405c003lllllllllm');
|
||||
});
|
||||
|
||||
it('should throw when trying to create an instance with the constructor directly', () => {
|
||||
@ -195,7 +198,6 @@ You should reuse the existing instance instead of trying to create a new one.`);
|
||||
// Arrange - create an initial leader and follower
|
||||
vi.spyOn(console, 'error').mockImplementation(() => {});
|
||||
|
||||
vi.spyOn(globalThis.crypto, 'randomUUID').mockReturnValueOnce('first-uuid-1-2-3-4');
|
||||
const firstLeader = UniversalStore.create({
|
||||
id: 'env1:test',
|
||||
leader: true,
|
||||
@ -203,7 +205,6 @@ You should reuse the existing instance instead of trying to create a new one.`);
|
||||
});
|
||||
|
||||
// Act - create the second leader
|
||||
vi.spyOn(globalThis.crypto, 'randomUUID').mockReturnValueOnce('second-uuid-1-2-3-4');
|
||||
const secondLeader = UniversalStore.create({
|
||||
id: 'env2:test',
|
||||
leader: true,
|
||||
@ -250,12 +251,12 @@ You should reuse the existing instance instead of trying to create a new one.`);
|
||||
Only one leader can exists at a time, your stores are now in an invalid state.
|
||||
Leaders detected:
|
||||
this: {
|
||||
"id": "second-uuid-1-2-3-4",
|
||||
"id": "m7405c0077777777778",
|
||||
"type": "LEADER",
|
||||
"environment": "MANAGER"
|
||||
}
|
||||
other: {
|
||||
"id": "first-uuid-1-2-3-4",
|
||||
"id": "m7405c003lllllllllm",
|
||||
"type": "LEADER",
|
||||
"environment": "MANAGER"
|
||||
}`
|
||||
@ -266,12 +267,12 @@ You should reuse the existing instance instead of trying to create a new one.`);
|
||||
Only one leader can exists at a time, your stores are now in an invalid state.
|
||||
Leaders detected:
|
||||
this: {
|
||||
"id": "first-uuid-1-2-3-4",
|
||||
"id": "m7405c003lllllllllm",
|
||||
"type": "LEADER",
|
||||
"environment": "MANAGER"
|
||||
}
|
||||
other: {
|
||||
"id": "second-uuid-1-2-3-4",
|
||||
"id": "m7405c0077777777778",
|
||||
"type": "LEADER",
|
||||
"environment": "MANAGER"
|
||||
}`
|
||||
@ -290,7 +291,7 @@ You should reuse the existing instance instead of trying to create a new one.`);
|
||||
// Assert - the store should be created with the initial state and actor
|
||||
expect(store.getState()).toEqual(undefined);
|
||||
expect(store.actor.type).toBe('FOLLOWER');
|
||||
expect(store.actor.id).toBe('mocked-random-uuid-v4-0');
|
||||
expect(store.actor.id).toBe('m7405c003lllllllllm');
|
||||
});
|
||||
|
||||
it('should get existing state when a follower is created without initialState', async () => {
|
||||
@ -325,7 +326,7 @@ You should reuse the existing instance instead of trying to create a new one.`);
|
||||
"eventInfo": {
|
||||
"actor": {
|
||||
"environment": "MANAGER",
|
||||
"id": "mocked-random-uuid-v4-0",
|
||||
"id": "m7405c003lllllllllm",
|
||||
"type": "LEADER",
|
||||
},
|
||||
},
|
||||
@ -340,7 +341,7 @@ You should reuse the existing instance instead of trying to create a new one.`);
|
||||
"eventInfo": {
|
||||
"actor": {
|
||||
"environment": "MANAGER",
|
||||
"id": "mocked-random-uuid-v4-1",
|
||||
"id": "m7405c0077777777778",
|
||||
"type": "FOLLOWER",
|
||||
},
|
||||
},
|
||||
@ -355,7 +356,7 @@ You should reuse the existing instance instead of trying to create a new one.`);
|
||||
"eventInfo": {
|
||||
"actor": {
|
||||
"environment": "MANAGER",
|
||||
"id": "mocked-random-uuid-v4-1",
|
||||
"id": "m7405c0077777777778",
|
||||
"type": "FOLLOWER",
|
||||
},
|
||||
},
|
||||
@ -370,12 +371,12 @@ You should reuse the existing instance instead of trying to create a new one.`);
|
||||
"eventInfo": {
|
||||
"actor": {
|
||||
"environment": "MANAGER",
|
||||
"id": "mocked-random-uuid-v4-1",
|
||||
"id": "m7405c0077777777778",
|
||||
"type": "FOLLOWER",
|
||||
},
|
||||
"forwardingActor": {
|
||||
"environment": "MANAGER",
|
||||
"id": "mocked-random-uuid-v4-0",
|
||||
"id": "m7405c003lllllllllm",
|
||||
"type": "LEADER",
|
||||
},
|
||||
},
|
||||
@ -393,7 +394,7 @@ You should reuse the existing instance instead of trying to create a new one.`);
|
||||
"eventInfo": {
|
||||
"actor": {
|
||||
"environment": "MANAGER",
|
||||
"id": "mocked-random-uuid-v4-0",
|
||||
"id": "m7405c003lllllllllm",
|
||||
"type": "LEADER",
|
||||
},
|
||||
},
|
||||
@ -437,7 +438,7 @@ You should reuse the existing instance instead of trying to create a new one.`);
|
||||
"eventInfo": {
|
||||
"actor": {
|
||||
"environment": "MANAGER",
|
||||
"id": "mocked-random-uuid-v4-0",
|
||||
"id": "m7405c003lllllllllm",
|
||||
"type": "LEADER",
|
||||
},
|
||||
},
|
||||
@ -452,7 +453,7 @@ You should reuse the existing instance instead of trying to create a new one.`);
|
||||
"eventInfo": {
|
||||
"actor": {
|
||||
"environment": "MANAGER",
|
||||
"id": "mocked-random-uuid-v4-1",
|
||||
"id": "m7405c0077777777778",
|
||||
"type": "FOLLOWER",
|
||||
},
|
||||
},
|
||||
@ -467,7 +468,7 @@ You should reuse the existing instance instead of trying to create a new one.`);
|
||||
"eventInfo": {
|
||||
"actor": {
|
||||
"environment": "MANAGER",
|
||||
"id": "mocked-random-uuid-v4-1",
|
||||
"id": "m7405c0077777777778",
|
||||
"type": "FOLLOWER",
|
||||
},
|
||||
},
|
||||
@ -482,12 +483,12 @@ You should reuse the existing instance instead of trying to create a new one.`);
|
||||
"eventInfo": {
|
||||
"actor": {
|
||||
"environment": "MANAGER",
|
||||
"id": "mocked-random-uuid-v4-1",
|
||||
"id": "m7405c0077777777778",
|
||||
"type": "FOLLOWER",
|
||||
},
|
||||
"forwardingActor": {
|
||||
"environment": "MANAGER",
|
||||
"id": "mocked-random-uuid-v4-0",
|
||||
"id": "m7405c003lllllllllm",
|
||||
"type": "LEADER",
|
||||
},
|
||||
},
|
||||
@ -505,7 +506,7 @@ You should reuse the existing instance instead of trying to create a new one.`);
|
||||
"eventInfo": {
|
||||
"actor": {
|
||||
"environment": "MANAGER",
|
||||
"id": "mocked-random-uuid-v4-0",
|
||||
"id": "m7405c003lllllllllm",
|
||||
"type": "LEADER",
|
||||
},
|
||||
},
|
||||
@ -560,7 +561,7 @@ You should reuse the existing instance instead of trying to create a new one.`);
|
||||
"eventInfo": {
|
||||
"actor": {
|
||||
"environment": "MANAGER",
|
||||
"id": "mocked-random-uuid-v4-0",
|
||||
"id": "m7405c003lllllllllm",
|
||||
"type": "LEADER",
|
||||
},
|
||||
},
|
||||
@ -575,7 +576,7 @@ You should reuse the existing instance instead of trying to create a new one.`);
|
||||
"eventInfo": {
|
||||
"actor": {
|
||||
"environment": "MANAGER",
|
||||
"id": "mocked-random-uuid-v4-1",
|
||||
"id": "m7405c0077777777778",
|
||||
"type": "FOLLOWER",
|
||||
},
|
||||
},
|
||||
@ -590,7 +591,7 @@ You should reuse the existing instance instead of trying to create a new one.`);
|
||||
"eventInfo": {
|
||||
"actor": {
|
||||
"environment": "MANAGER",
|
||||
"id": "mocked-random-uuid-v4-1",
|
||||
"id": "m7405c0077777777778",
|
||||
"type": "FOLLOWER",
|
||||
},
|
||||
},
|
||||
@ -605,12 +606,12 @@ You should reuse the existing instance instead of trying to create a new one.`);
|
||||
"eventInfo": {
|
||||
"actor": {
|
||||
"environment": "MANAGER",
|
||||
"id": "mocked-random-uuid-v4-1",
|
||||
"id": "m7405c0077777777778",
|
||||
"type": "FOLLOWER",
|
||||
},
|
||||
"forwardingActor": {
|
||||
"environment": "MANAGER",
|
||||
"id": "mocked-random-uuid-v4-0",
|
||||
"id": "m7405c003lllllllllm",
|
||||
"type": "LEADER",
|
||||
},
|
||||
},
|
||||
@ -628,7 +629,7 @@ You should reuse the existing instance instead of trying to create a new one.`);
|
||||
"eventInfo": {
|
||||
"actor": {
|
||||
"environment": "MANAGER",
|
||||
"id": "mocked-random-uuid-v4-0",
|
||||
"id": "m7405c003lllllllllm",
|
||||
"type": "LEADER",
|
||||
},
|
||||
},
|
||||
@ -664,7 +665,7 @@ You should reuse the existing instance instead of trying to create a new one.`);
|
||||
"eventInfo": {
|
||||
"actor": {
|
||||
"environment": "MANAGER",
|
||||
"id": "mocked-random-uuid-v4-0",
|
||||
"id": "m7405c003lllllllllm",
|
||||
"type": "FOLLOWER",
|
||||
},
|
||||
},
|
||||
@ -679,7 +680,7 @@ You should reuse the existing instance instead of trying to create a new one.`);
|
||||
"eventInfo": {
|
||||
"actor": {
|
||||
"environment": "MANAGER",
|
||||
"id": "mocked-random-uuid-v4-0",
|
||||
"id": "m7405c003lllllllllm",
|
||||
"type": "FOLLOWER",
|
||||
},
|
||||
},
|
||||
@ -951,7 +952,7 @@ You should reuse the existing instance instead of trying to create a new one.`);
|
||||
},
|
||||
"id": "env2:test",
|
||||
"actor": {
|
||||
"id": "mocked-random-uuid-v4-1",
|
||||
"id": "m7405c0077777777778",
|
||||
"type": "FOLLOWER",
|
||||
"environment": "MANAGER"
|
||||
},
|
||||
@ -1136,7 +1137,7 @@ You should reuse the existing instance instead of trying to create a new one.`);
|
||||
},
|
||||
"id": "env2:test",
|
||||
"actor": {
|
||||
"id": "mocked-random-uuid-v4-1",
|
||||
"id": "m7405c0077777777778",
|
||||
"type": "FOLLOWER",
|
||||
"environment": "MANAGER"
|
||||
},
|
||||
|
@ -259,10 +259,7 @@ export class UniversalStore<
|
||||
UniversalStore.isInternalConstructing = false;
|
||||
|
||||
this.id = options.id;
|
||||
this.actorId = globalThis.crypto
|
||||
? globalThis.crypto.randomUUID()
|
||||
: // TODO: remove this fallback in SB 9.0 when we no longer support Node 18
|
||||
Date.now().toString(36) + Math.random().toString(36).substring(2);
|
||||
this.actorId = Date.now().toString(36) + Math.random().toString(36).substring(2);
|
||||
this.actorType = options.leader
|
||||
? UniversalStore.ActorType.LEADER
|
||||
: UniversalStore.ActorType.FOLLOWER;
|
||||
|
@ -1,12 +1,17 @@
|
||||
import type { ProjectAnnotations } from 'storybook/internal/types';
|
||||
|
||||
import type { ReactPreview } from '@storybook/react';
|
||||
import { __definePreview } from '@storybook/react';
|
||||
import type { ReactRenderer } from '@storybook/react';
|
||||
|
||||
import type vitePluginStorybookNextJs from 'vite-plugin-storybook-nextjs';
|
||||
|
||||
import * as nextPreview from './preview';
|
||||
|
||||
export * from './types';
|
||||
export * from '@storybook/react';
|
||||
// @ts-expect-error (double exports)
|
||||
export * from './portable-stories';
|
||||
export * from './types';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
@ -17,7 +22,10 @@ declare module '@storybook/experimental-nextjs-vite/vite-plugin' {
|
||||
export function definePreview(preview: NextPreview['input']) {
|
||||
return __definePreview({
|
||||
...preview,
|
||||
addons: [nextPreview, ...(preview.addons ?? [])],
|
||||
addons: [
|
||||
nextPreview as unknown as ProjectAnnotations<ReactRenderer>,
|
||||
...(preview.addons ?? []),
|
||||
],
|
||||
}) as NextPreview;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,8 @@
|
||||
import type { Addon_DecoratorFunction, Addon_LoaderFunction } from 'storybook/internal/types';
|
||||
import type * as React from 'react';
|
||||
|
||||
import type { Addon_DecoratorFunction, LoaderFunction } from 'storybook/internal/types';
|
||||
|
||||
import type { ReactRenderer, StoryFn } from '@storybook/react';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore we must ignore types here as during compilation they are not generated yet
|
||||
@ -50,21 +54,25 @@ globalThis.addEventListener('error', (ev: WindowEventMap['error']): void => {
|
||||
}
|
||||
});
|
||||
|
||||
export const decorators: Addon_DecoratorFunction<any>[] = [
|
||||
StyledJsxDecorator,
|
||||
ImageDecorator,
|
||||
RouterDecorator,
|
||||
HeadManagerDecorator,
|
||||
// Type assertion to handle the decorator type mismatch
|
||||
const asDecorator = (decorator: (Story: React.FC, context?: any) => React.ReactNode) =>
|
||||
decorator as unknown as Addon_DecoratorFunction<ReactRenderer>;
|
||||
|
||||
export const decorators: Addon_DecoratorFunction<ReactRenderer>[] = [
|
||||
asDecorator(StyledJsxDecorator),
|
||||
asDecorator(ImageDecorator),
|
||||
asDecorator(RouterDecorator),
|
||||
asDecorator(HeadManagerDecorator),
|
||||
];
|
||||
|
||||
export const loaders: Addon_LoaderFunction = async ({ globals, parameters }) => {
|
||||
export const loaders: LoaderFunction<ReactRenderer> = async ({ globals, parameters }) => {
|
||||
const { router, appDirectory } = parameters.nextjs ?? {};
|
||||
if (appDirectory) {
|
||||
createNavigation(router);
|
||||
} else {
|
||||
createRouter({
|
||||
locale: globals.locale,
|
||||
...router,
|
||||
...(router as Record<string, unknown>),
|
||||
});
|
||||
}
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/experimental-nextjs-vite';
|
||||
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/experimental-nextjs-vite';
|
||||
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/experimental-nextjs-vite';
|
||||
|
||||
import { expect, userEvent, within } from 'storybook/test';
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React, { Suspense } from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/experimental-nextjs-vite';
|
||||
|
||||
import dynamic from 'next/dynamic';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/experimental-nextjs-vite';
|
||||
|
||||
import Font from './Font';
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/experimental-nextjs-vite';
|
||||
|
||||
import { type ImageProps, getImageProps } from 'next/image';
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
|
||||
import type { Meta } from '@storybook/react';
|
||||
import type { StoryObj } from '@storybook/react';
|
||||
import type { Meta } from '@storybook/experimental-nextjs-vite';
|
||||
import type { StoryObj } from '@storybook/experimental-nextjs-vite';
|
||||
|
||||
import Head from 'next/head';
|
||||
import { expect, waitFor } from 'storybook/test';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React, { useRef, useState } from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/experimental-nextjs-vite';
|
||||
|
||||
import Image from 'next/image';
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/experimental-nextjs-vite';
|
||||
|
||||
import Image from 'next/legacy/image';
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/experimental-nextjs-vite';
|
||||
|
||||
import Link from 'next/link';
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
import React from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/experimental-nextjs-vite';
|
||||
import { getRouter } from '@storybook/experimental-nextjs-vite/navigation.mock';
|
||||
|
||||
import {
|
||||
|
@ -1,6 +1,5 @@
|
||||
import type { Meta } from '@storybook/react';
|
||||
import type { StoryObj } from '@storybook/react';
|
||||
|
||||
import type { Meta } from '@storybook/experimental-nextjs-vite';
|
||||
import type { StoryObj } from '@storybook/experimental-nextjs-vite';
|
||||
import { cookies, headers } from '@storybook/experimental-nextjs-vite/headers.mock';
|
||||
|
||||
import { expect, userEvent, within } from 'storybook/test';
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* eslint-disable local-rules/no-uncategorized-errors */
|
||||
import React from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/experimental-nextjs-vite';
|
||||
|
||||
import { Nested, RSC } from './RSC';
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/experimental-nextjs-vite';
|
||||
|
||||
import { redirect } from 'next/navigation';
|
||||
import { userEvent, within } from 'storybook/test';
|
||||
|
@ -1,7 +1,6 @@
|
||||
import React from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/experimental-nextjs-vite';
|
||||
import { getRouter } from '@storybook/experimental-nextjs-vite/router.mock';
|
||||
|
||||
import Router, { useRouter } from 'next/router';
|
||||
|
@ -1,7 +1,6 @@
|
||||
import React from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/experimental-nextjs-vite';
|
||||
import { revalidatePath } from '@storybook/experimental-nextjs-vite/cache.mock';
|
||||
import { cookies } from '@storybook/experimental-nextjs-vite/headers.mock';
|
||||
import { getRouter, redirect } from '@storybook/experimental-nextjs-vite/navigation.mock';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/experimental-nextjs-vite';
|
||||
|
||||
const Component = () => (
|
||||
<div>
|
||||
|
@ -1 +1,2 @@
|
||||
export * from '@storybook/html';
|
||||
export * from './types';
|
||||
|
@ -1 +1,2 @@
|
||||
export * from '@storybook/html';
|
||||
export * from './types';
|
||||
|
@ -3,7 +3,9 @@ import { __definePreview } from '@storybook/react';
|
||||
|
||||
import * as nextPreview from './preview';
|
||||
|
||||
export * from '@storybook/react';
|
||||
export * from './types';
|
||||
// @ts-expect-error (double exports)
|
||||
export * from './portable-stories';
|
||||
|
||||
export function definePreview(preview: NextPreview['input']) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/nextjs';
|
||||
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/nextjs';
|
||||
|
||||
import { fn } from 'storybook/test';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/nextjs';
|
||||
|
||||
import { expect, userEvent, within } from 'storybook/test';
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React, { Suspense } from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/nextjs';
|
||||
|
||||
import dynamic from 'next/dynamic';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/nextjs';
|
||||
|
||||
import Font from './Font';
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/nextjs';
|
||||
|
||||
import Head from 'next/head';
|
||||
import { expect, waitFor } from 'storybook/test';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React, { useState } from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/nextjs';
|
||||
|
||||
import Image from 'next/image';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/nextjs';
|
||||
|
||||
import Image from 'next/legacy/image';
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/nextjs';
|
||||
|
||||
import Link from 'next/link';
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/nextjs';
|
||||
import { getRouter } from '@storybook/nextjs/navigation.mock';
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
|
||||
import {
|
||||
useParams,
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* eslint-disable local-rules/no-uncategorized-errors */
|
||||
import React from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import type { Meta, StoryObj } from '@storybook/nextjs';
|
||||
|
||||
import { Nested, RSC } from './RSC';
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
|
||||
import type { Meta, StoryObj } from '@storybook/nextjs';
|
||||
import { getRouter } from '@storybook/nextjs/router.mock';
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
|
||||
import Router, { useRouter } from 'next/router';
|
||||
import { expect, userEvent, within } from 'storybook/test';
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user