-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
31 additions
and
1,314 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1 @@ | ||
/* eslint-disable prefer-destructuring */ | ||
import { Addon_ClientStoryApi, Addon_Loadable } from '@storybook/types'; | ||
import { start } from '@storybook/preview-api'; | ||
import { renderToCanvas, render } from './render'; | ||
import decorateStory from './decorateStory'; | ||
import { AngularRenderer } from './types'; | ||
|
||
export * from './public-types'; | ||
|
||
const RENDERER = 'angular'; | ||
|
||
interface ClientApi extends Addon_ClientStoryApi<AngularRenderer['storyResult']> { | ||
configure(loader: Addon_Loadable, module: NodeModule): void; | ||
forceReRender(): void; | ||
raw: () => any; // todo add type | ||
load: (...args: any[]) => void; | ||
} | ||
|
||
const api = start<AngularRenderer>(renderToCanvas, { decorateStory, render }); | ||
|
||
export const storiesOf: ClientApi['storiesOf'] = (kind, m) => { | ||
return (api.clientApi.storiesOf(kind, m) as ReturnType<ClientApi['storiesOf']>).addParameters({ | ||
renderer: RENDERER, | ||
}); | ||
}; | ||
|
||
export const configure: ClientApi['configure'] = (...args) => api.configure(RENDERER, ...args); | ||
export const forceReRender: ClientApi['forceReRender'] = api.forceReRender; | ||
export const raw: ClientApi['raw'] = api.clientApi.raw; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1 @@ | ||
import { start } from '@storybook/preview-api'; | ||
|
||
import './globals'; | ||
import type { EmberRenderer } from './types'; | ||
import { renderToCanvas } from './render'; | ||
|
||
const { configure: coreConfigure, clientApi, forceReRender } = start<EmberRenderer>(renderToCanvas); | ||
|
||
export const { raw } = clientApi; | ||
|
||
const RENDERER = 'ember'; | ||
export const storiesOf = (kind: string, m: any) => | ||
clientApi.storiesOf(kind, m).addParameters({ renderer: RENDERER }); | ||
export const configure = (...args: any[]) => coreConfigure(RENDERER, ...args); | ||
|
||
export { forceReRender }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/// <reference types="webpack-env" /> | ||
|
||
export { storiesOf, configure, forceReRender, raw } from './client/preview'; | ||
import './client/preview'; | ||
|
||
// optimization: stop HMR propagation in webpack | ||
if (typeof module !== 'undefined') module?.hot?.decline(); |
55 changes: 0 additions & 55 deletions
55
code/lib/preview-api/src/modules/client-api/ClientApi.test.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.