2023-03-20 00:56:34 -05:00
|
|
|
import { type Preview, setup } from '@storybook/vue3';
|
2023-03-20 02:13:07 -05:00
|
|
|
import { initialize, mswDecorator } from 'msw-storybook-addon';
|
2023-03-20 00:56:34 -05:00
|
|
|
import locale from './locale';
|
2023-03-20 08:12:11 -05:00
|
|
|
import { commonHandlers, onUnhandledRequest } from './mocks';
|
2023-03-19 08:22:14 -05:00
|
|
|
import theme from './theme';
|
|
|
|
import '../src/style.scss';
|
|
|
|
|
2023-03-20 08:12:11 -05:00
|
|
|
initialize({
|
|
|
|
onUnhandledRequest,
|
|
|
|
});
|
2023-03-20 00:56:34 -05:00
|
|
|
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-20 02:13:07 -05:00
|
|
|
});
|
2023-03-19 08:22:14 -05:00
|
|
|
|
|
|
|
const preview = {
|
2023-03-20 02:13:07 -05:00
|
|
|
decorators: [
|
|
|
|
mswDecorator,
|
|
|
|
],
|
2023-03-20 08:12:11 -05:00
|
|
|
parameters: {
|
|
|
|
msw: {
|
|
|
|
handlers: commonHandlers,
|
|
|
|
},
|
|
|
|
},
|
2023-03-19 08:22:14 -05:00
|
|
|
} satisfies Preview;
|
|
|
|
|
|
|
|
export default preview;
|