misskey/packages/frontend/.storybook/preview.ts

37 lines
873 B
TypeScript
Raw Normal View History

import { type Preview, setup } from '@storybook/vue3';
import { initialize, mswDecorator } from 'msw-storybook-addon';
import locale from './locale';
2023-03-20 06:12:11 -07:00
import { commonHandlers, onUnhandledRequest } from './mocks';
2023-03-19 06:22:14 -07:00
import theme from './theme';
import '../src/style.scss';
2023-03-20 06:12:11 -07:00
initialize({
onUnhandledRequest,
});
localStorage.setItem("locale", JSON.stringify(locale));
Promise.all([
import('../src/components'),
import('../src/directives'),
import('../src/widgets'),
import('../src/scripts/theme').then(({ applyTheme }) => applyTheme(theme)),
]).then(([{ default: components }, { default: directives }, { default: widgets }]) => {
setup((app) => {
components(app);
directives(app);
widgets(app);
});
});
2023-03-19 06:22:14 -07:00
const preview = {
decorators: [
mswDecorator,
],
2023-03-20 06:12:11 -07:00
parameters: {
msw: {
handlers: commonHandlers,
},
},
2023-03-19 06:22:14 -07:00
} satisfies Preview;
export default preview;