mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-04 13:01:07 +08:00
fixes
This commit is contained in:
parent
5272feac51
commit
d3eab19d5b
@ -1,3 +1,5 @@
|
||||
/// <reference types="webpack-env" />
|
||||
|
||||
import './globals';
|
||||
|
||||
export * from './public-api';
|
||||
|
@ -1,3 +1,5 @@
|
||||
/// <reference types="webpack-env" />
|
||||
|
||||
export {
|
||||
storiesOf,
|
||||
setAddon,
|
||||
|
@ -39,7 +39,7 @@
|
||||
],
|
||||
"scripts": {
|
||||
"check": "../../../scripts/node_modules/.bin/tsc --noEmit",
|
||||
"prep": "node ../../../scripts/prepare.js"
|
||||
"prep": "../../../scripts/prepare/bundle.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@storybook/addons": "7.0.0-alpha.34",
|
||||
@ -67,8 +67,7 @@
|
||||
},
|
||||
"bundler": {
|
||||
"entries": [
|
||||
"./src/index.tsx",
|
||||
"./src/shortcut.ts"
|
||||
"./src/index.ts"
|
||||
]
|
||||
},
|
||||
"gitHead": "fc90fc875462421c1faa35862ac4bc436de8e75f"
|
||||
|
@ -11,6 +11,8 @@ import {
|
||||
setGlobalRender,
|
||||
} from './ClientApi';
|
||||
|
||||
export type { GetStorybookKind, GetStorybookStory } from './ClientApi';
|
||||
|
||||
export * from './types';
|
||||
|
||||
export * from './queryparams';
|
||||
|
@ -1,3 +1,6 @@
|
||||
/// <reference types="node" />
|
||||
/// <reference types="webpack-env" />
|
||||
|
||||
import { logger } from '@storybook/client-logger';
|
||||
import { Path, ModuleExports } from '@storybook/store';
|
||||
import { Loadable, RequireContext, LoaderFunction } from './types';
|
||||
|
@ -5,7 +5,7 @@ import { PreviewWeb } from '@storybook/preview-web';
|
||||
import type { AnyFramework, ArgsStoryFn } from '@storybook/csf';
|
||||
import { createChannel } from '@storybook/channel-postmessage';
|
||||
import { addons } from '@storybook/addons';
|
||||
import Events from '@storybook/core-events';
|
||||
import { FORCE_RE_RENDER } from '@storybook/core-events';
|
||||
import type { Path, WebProjectAnnotations } from '@storybook/store';
|
||||
|
||||
import { Loadable } from './types';
|
||||
@ -24,16 +24,45 @@ const removedApi = (name: string) => () => {
|
||||
throw new Error(`@storybook/client-api:${name} was removed in storyStoreV7.`);
|
||||
};
|
||||
|
||||
interface RendererImplementation<TFramework extends AnyFramework> {
|
||||
decorateStory?: WebProjectAnnotations<TFramework>['applyDecorators'];
|
||||
render?: ArgsStoryFn<TFramework>;
|
||||
}
|
||||
|
||||
interface ClientAPIFacade {
|
||||
/* deprecated */
|
||||
addDecorator: (...args: any[]) => never;
|
||||
/* deprecated */
|
||||
addParameters: (...args: any[]) => never;
|
||||
/* deprecated */
|
||||
clearDecorators: (...args: any[]) => never;
|
||||
/* deprecated */
|
||||
addLoader: (...args: any[]) => never;
|
||||
/* deprecated */
|
||||
setAddon: (...args: any[]) => never;
|
||||
/* deprecated */
|
||||
getStorybook: (...args: any[]) => never;
|
||||
/* deprecated */
|
||||
storiesOf: (...args: any[]) => never;
|
||||
/* deprecated */
|
||||
raw: (...args: any[]) => never;
|
||||
}
|
||||
|
||||
interface StartReturnValue<TFramework extends AnyFramework> {
|
||||
/* deprecated */
|
||||
forceReRender: () => void;
|
||||
/* deprecated */
|
||||
getStorybook: any;
|
||||
/* deprecated */
|
||||
configure: any;
|
||||
/* deprecated */
|
||||
clientApi: ClientApi<TFramework> | ClientAPIFacade;
|
||||
}
|
||||
|
||||
export function start<TFramework extends AnyFramework>(
|
||||
renderToDOM: WebProjectAnnotations<TFramework>['renderToDOM'],
|
||||
{
|
||||
decorateStory,
|
||||
render,
|
||||
}: {
|
||||
decorateStory?: WebProjectAnnotations<TFramework>['applyDecorators'];
|
||||
render?: ArgsStoryFn<TFramework>;
|
||||
} = {}
|
||||
) {
|
||||
{ decorateStory, render }: RendererImplementation<TFramework> = {}
|
||||
): StartReturnValue<TFramework> {
|
||||
if (globalWindow) {
|
||||
// To enable user code to detect if it is running in Storybook
|
||||
globalWindow.IS_STORYBOOK = true;
|
||||
@ -84,9 +113,8 @@ export function start<TFramework extends AnyFramework>(
|
||||
}
|
||||
|
||||
return {
|
||||
forceReRender: () => channel.emit(Events.FORCE_RE_RENDER),
|
||||
forceReRender: () => channel.emit(FORCE_RE_RENDER),
|
||||
getStorybook: (): void[] => [],
|
||||
raw: (): void => {},
|
||||
|
||||
clientApi,
|
||||
// This gets called each time the user calls configure (i.e. once per HMR)
|
||||
|
@ -1,3 +1,5 @@
|
||||
/// <reference types="webpack-env" />
|
||||
|
||||
import './globals';
|
||||
|
||||
export * from './public-api';
|
||||
|
@ -1,3 +1,5 @@
|
||||
/// <reference types="webpack-env" />
|
||||
|
||||
export * from './globals';
|
||||
|
||||
export * from './public-api';
|
||||
|
@ -1,3 +1,5 @@
|
||||
/// <reference types="webpack-env" />
|
||||
|
||||
import './globals';
|
||||
|
||||
export * from './public-api';
|
||||
|
@ -1,3 +1,5 @@
|
||||
/// <reference types="webpack-env" />
|
||||
|
||||
import './globals';
|
||||
|
||||
export * from './public-api';
|
||||
|
@ -1,3 +1,5 @@
|
||||
/// <reference types="webpack-env" />
|
||||
|
||||
import './globals';
|
||||
|
||||
export * from './public-api';
|
||||
|
@ -1,3 +1,5 @@
|
||||
/// <reference types="webpack-env" />
|
||||
|
||||
import './globals';
|
||||
|
||||
export * from './public-api';
|
||||
|
@ -1,3 +1,5 @@
|
||||
/// <reference types="webpack-env" />
|
||||
|
||||
import './globals';
|
||||
|
||||
export * from './public-api';
|
||||
|
@ -1,3 +1,5 @@
|
||||
/// <reference types="webpack-env" />
|
||||
|
||||
// @ts-expect-error (Converted from ts-ignore)
|
||||
import global from 'global';
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user