- Render the
AppComponentas a custom element
export class AppModule {
ngDoBootstrap(): void {
customElements.define('mg-root', createCustomIvyElement(AppComponent));
}
}| module.exports = { | |
| root: true, | |
| env: { | |
| browser: true | |
| }, | |
| parser: '@typescript-eslint/parser', | |
| parserOptions: { | |
| tsconfigRootDir: __dirname, | |
| project: ['./tsconfig.json'] | |
| }, |
| import { IconRegistry } from '@dna/core/icon'; | |
| import { faArrowsH, faArrowsV } from '@fortawesome/pro-regular-svg-icons'; | |
| import { styled } from '@storybook/theming'; | |
| import React, { FunctionComponent } from 'react'; | |
| IconRegistry.addIcons(faArrowsH, faArrowsV); | |
| export interface ComponentSizeProps { | |
| children?: JSX.Element; | |
| height?: string; |
| import { ListKeyController, ListKeyControllerOption } from './list-key-controller'; | |
| export interface FocusableOption extends ListKeyControllerOption { | |
| /** Focuses the `FocusableOption`. */ | |
| focus(): void; | |
| } | |
| export class FocusKeyController<T> extends ListKeyController<FocusableOption & T> { | |
| setActiveItem(index: number): void { | |
| super.setActiveItem(index); |
<form> API is not very DX, add helpers to make it more friendly:
export type Orientation = 'horizontal' | 'vertical';
export interface FormControl {npx -p @storybook/cli sb init --type react (we use react so you can use JSX inside your stories)npm add @babel/plugin-syntax-import-meta @open-wc/webpack-import-meta-loader webpack-merge -Dimport { defineCustomElements } from "../dist/esm/loader";| constructor(@Inject(DOCUMENT) private document: any) { | |
| this.style = this.document.createElement('style'); | |
| this.style.id = 'theme'; | |
| this.document.head.appendChild(this.style); | |
| } | |
| initialize(): Promise<void> { | |
| this._theme = 'magister'; |
| // webpack.vendor.js | |
| module.exports = { | |
| entry: { | |
| vendor: [ | |
| 'angular', | |
| 'jquery', | |
| 'jquery-ui/ui/position' | |
| ] | |
| }, | |
| externals: { |