mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-28 05:10:17 +08:00
45 lines
1008 B
JavaScript
45 lines
1008 B
JavaScript
/* global window */
|
|
|
|
import {
|
|
configure,
|
|
addParameters,
|
|
addDecorator,
|
|
setCustomElements,
|
|
} from '@storybook/web-components';
|
|
import { withA11y } from '@storybook/addon-a11y';
|
|
|
|
import customElements from '../custom-elements.json';
|
|
|
|
setCustomElements(customElements);
|
|
|
|
addDecorator(withA11y);
|
|
|
|
addParameters({
|
|
a11y: {
|
|
config: {},
|
|
options: {
|
|
checks: { 'color-contrast': { options: { noScroll: true } } },
|
|
restoreScroll: true,
|
|
},
|
|
},
|
|
options: {
|
|
hierarchyRootSeparator: /\|/,
|
|
},
|
|
docs: {
|
|
iframeHeight: '200px',
|
|
},
|
|
});
|
|
|
|
// configure(require.context('../stories', true, /\.stories\.(js|mdx)$/), module);
|
|
|
|
// force full reload to not reregister web components
|
|
const req = require.context('../stories', true, /\.stories\.(js|mdx)$/);
|
|
configure(req, module);
|
|
if (module.hot) {
|
|
module.hot.accept(req.id, () => {
|
|
const currentLocationHref = window.location.href;
|
|
window.history.pushState(null, null, currentLocationHref);
|
|
window.location.reload();
|
|
});
|
|
}
|