This commit is contained in:
Norbert de Langen 2022-11-03 23:14:05 +01:00
parent ef7874bed2
commit 6cde3ad106
No known key found for this signature in database
GPG Key ID: FD0E78AF9A837762
3 changed files with 97 additions and 3 deletions

View File

@ -55,7 +55,7 @@ const storybookPaths: Record<string, string> = {
...acc, ...acc,
[`@storybook/${sbPackage}`]: join( [`@storybook/${sbPackage}`]: join(
dirname(require.resolve(`@storybook/preview/package.json`)), dirname(require.resolve(`@storybook/preview/package.json`)),
`dist/global/${sbPackage}.mjs` `dist/global/${sbPackage}`
), ),
}), }),
{} {}

View File

@ -71,6 +71,11 @@
"require": "./dist/global/preview-web.js", "require": "./dist/global/preview-web.js",
"types": "./dist/global/preview-web.d.ts" "types": "./dist/global/preview-web.d.ts"
}, },
"./dist/global/preview-api": {
"import": "./dist/global/preview-api.mjs",
"require": "./dist/global/preview-api.js",
"types": "./dist/global/preview-api.d.ts"
},
"./dist/global/store": { "./dist/global/store": {
"import": "./dist/global/store.mjs", "import": "./dist/global/store.mjs",
"require": "./dist/global/store.js", "require": "./dist/global/store.js",
@ -139,6 +144,7 @@
"./src/global/core-client.ts", "./src/global/core-client.ts",
"./src/global/core-events.ts", "./src/global/core-events.ts",
"./src/global/preview-web.ts", "./src/global/preview-web.ts",
"./src/global/preview-api.ts",
"./src/global/store.ts" "./src/global/store.ts"
] ]
}, },

View File

@ -1,5 +1,5 @@
/* eslint-disable no-underscore-dangle */ /* eslint-disable no-underscore-dangle */
import type * as MODULE from '../preview-web'; import type * as MODULE from '../preview-api';
const { const {
DocsContext, DocsContext,
@ -8,7 +8,51 @@ const {
composeConfigs, composeConfigs,
simulateDOMContentLoaded, simulateDOMContentLoaded,
simulatePageLoad, simulatePageLoad,
} = (globalThis as any).__STORYBOOK_MODULE_PREVIEW_WEB__ as typeof MODULE; ClientApi,
StoryStore,
HooksContext,
addArgTypes,
addArgTypesEnhancer,
addArgs,
addArgsEnhancer,
addDecorator,
addLoader,
addParameters,
addStepRunner,
addons,
applyHooks,
combineArgs,
combineParameters,
composeStepRunners,
composeStories,
composeStory,
decorateStory,
defaultDecorateStory,
filterArgTypes,
getQueryParam,
getQueryParams,
inferControls,
normalizeStory,
prepareStory,
sanitizeStoryContextUpdate,
setGlobalRender,
setProjectAnnotations,
sortStoriesV7,
userOrAutoTitleFromSpecifier,
makeDecorator,
start,
useArgs,
useCallback,
useChannel,
useEffect,
useGlobals,
useMemo,
useParameter,
useReducer,
useRef,
useState,
useStoryContext,
} = (globalThis as any).__STORYBOOK_MODULE_PREVIEW_API__ as typeof MODULE;
export { export {
DocsContext, DocsContext,
@ -17,4 +61,48 @@ export {
composeConfigs, composeConfigs,
simulateDOMContentLoaded, simulateDOMContentLoaded,
simulatePageLoad, simulatePageLoad,
ClientApi,
StoryStore,
HooksContext,
addArgTypes,
addArgTypesEnhancer,
addArgs,
addArgsEnhancer,
addDecorator,
addLoader,
addParameters,
addStepRunner,
addons,
applyHooks,
combineArgs,
combineParameters,
composeStepRunners,
composeStories,
composeStory,
decorateStory,
defaultDecorateStory,
filterArgTypes,
getQueryParam,
getQueryParams,
inferControls,
normalizeStory,
prepareStory,
sanitizeStoryContextUpdate,
setGlobalRender,
setProjectAnnotations,
sortStoriesV7,
userOrAutoTitleFromSpecifier,
makeDecorator,
start,
useArgs,
useCallback,
useChannel,
useEffect,
useGlobals,
useMemo,
useParameter,
useReducer,
useRef,
useState,
useStoryContext,
}; };