chore: move setCustomElements to app web-components

This commit is contained in:
Thomas Allmer 2019-10-27 20:59:41 +01:00
parent d07adbbfb4
commit 77b33cd184
6 changed files with 24 additions and 20 deletions

View File

@ -1,7 +1,7 @@
/* global window */
/* eslint-disable import/no-extraneous-dependencies */
import { addParameters } from '@storybook/client-api';
import { getCustomElements } from './customElements';
import { getCustomElements } from '@storybook/web-components';
function mapData(data) {
return data.map(item => ({

View File

@ -1,15 +0,0 @@
/* eslint-disable no-underscore-dangle */
/* global window */
/**
* @param customElements any for now as spec is not super stable yet
*/
export function setCustomElements(customElements: any) {
// @ts-ignore
window.__STORYBOOK_CUSTOM_ELEMENTS__ = customElements;
}
export function getCustomElements() {
// @ts-ignore
return window.__STORYBOOK_CUSTOM_ELEMENTS__;
}

View File

@ -1 +0,0 @@
export { setCustomElements, getCustomElements } from './frameworks/web-components/customElements';

View File

@ -7,7 +7,7 @@
- Add to your `.storybook/config.js`
```js
import { setCustomElements } from '@storybook/addon-docs';
import { setCustomElements } from '@storybook/web-components';
import customElements from '../custom-elements.json';
setCustomElements(customElements);

View File

@ -1,3 +1,6 @@
/* eslint-disable no-underscore-dangle */
/* global window */
export {
storiesOf,
setAddon,
@ -9,6 +12,19 @@ export {
raw,
} from './preview';
/**
* @param customElements any for now as spec is not super stable yet
*/
export function setCustomElements(customElements: any) {
// @ts-ignore
window.__STORYBOOK_CUSTOM_ELEMENTS__ = customElements;
}
export function getCustomElements() {
// @ts-ignore
return window.__STORYBOOK_CUSTOM_ELEMENTS__;
}
if (module && module.hot && module.hot.decline) {
module.hot.decline();
}

View File

@ -1,8 +1,12 @@
/* global window */
import { configure, addParameters, addDecorator } from '@storybook/web-components';
import {
configure,
addParameters,
addDecorator,
setCustomElements,
} from '@storybook/web-components';
import { withA11y } from '@storybook/addon-a11y';
import { setCustomElements } from '@storybook/addon-docs';
import customElements from '../custom-elements.json';