From f11f5e99c06579705ea903c12688ad6fd9fb92cc Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Thu, 3 Nov 2022 11:46:22 +0100 Subject: [PATCH 01/47] step 1 --- code/lib/preview-api/README.md | 94 ++++++++++++++++++++++++++++++ code/lib/preview-api/package.json | 60 +++++++++++++++++++ code/lib/preview-api/src/index.ts | 65 +++++++++++++++++++++ code/lib/preview-api/tsconfig.json | 8 +++ code/workspace.json | 29 +++++---- code/yarn.lock | 12 ++++ 6 files changed, 256 insertions(+), 12 deletions(-) create mode 100644 code/lib/preview-api/README.md create mode 100644 code/lib/preview-api/package.json create mode 100644 code/lib/preview-api/src/index.ts create mode 100644 code/lib/preview-api/tsconfig.json diff --git a/code/lib/preview-api/README.md b/code/lib/preview-api/README.md new file mode 100644 index 00000000000..cb44e3b4b07 --- /dev/null +++ b/code/lib/preview-api/README.md @@ -0,0 +1,94 @@ +# Preview (Web) + +This is the main API for the (web) version of the Storybook Preview. + +The preview's job is: + +1. Read and update the URL (via the URL Store) + +2. Listen to instructions on the channel and emit events as things occur. + +3. Render the current selection to the web view in either story or docs mode. + +## V7 Store vs Legacy (V6) + +The story store is designed to load stories 'on demand', and will operate in this fashion if the `storyStoreV7` feature is enabled. + +However, for back-compat reasons, in v6 mode, we need to load all stories, synchronously on bootup, emitting the `SET_STORIES` event. + +In V7 mode we do not emit that event, instead preferring the `STORY_PREPARED` event, with the data for the single story being rendered. + +## Initialization + +The preview is `initialized` in two ways. + +### V7 Mode: + +- `importFn` - is an async `import()` function + +- `getProjectAnnotations` - is a simple function that evaluations `preview.js` and addon config files and combines them. If it errors, the Preview will show the error. + +- No `getStoryIndex` function is passed, instead the preview creates a `StoryIndexClient` that pulls `stories.json` from node and watches the event stream for invalidation events. + +### V6 Mode + +- `importFn` - is a simulated `import()` function, that is synchronous, see `client-api` for details. +- `getProjectAnnotations` - also evaluates `preview.js` et al, but watches for calls to `setStories`, and passes them to the `ClientApi` +- `getStoryIndex` is a local function (that must be called _after_ `getProjectAnnotations`) that gets the list of stories added. + +See `client-api` for more details on this process. + +## Story Rendering and interruptions + +The Preview is split into three parts responsible for state management: + +- `PreviewWeb` - which story is rendered, receives events and (maybe) changes/re-renders stories +- `StoryRender` - (imports +) prepares the story, renders it through the various phases +- `DocsRender` - if a story renders in docs mode, it is "transformed" into a `DocsRender` once we know. + +A rendering story goes through these phases: + +- `preparing` - (maybe async) import the story file and prepare the story function. +- `loading` - async loaders are running +- `rendering` - the `renderToDOM` function for the framework is running +- `playing` - the `play` function is running +- `completed` - the story is done. + +It also has two error states: + +- `aborted` - the story was stopped midway (see below) +- `errored` - there was an error thrown somewhere along the way. + +### Re-rendering and aborting + +A story may re-render due to various events, which can have implications if the story is not in the `completed` phase: + +- `UPDATE_STORY_ARGS` / `UPDATE_GLOBALS` -- change of inputs +- `FORCE_RE_RENDER` - re-render unchanged + +If these events happen during a render: + +- if the story is `preparing` or `loading`, leave thing unchanged and let the new `args`/`globals` be picked up by the render phase +- otherwise, use the result of the previous `loaders` run, and simply re-render over the top + +- `FORCE_REMOUNT` - remount (or equivalent) the component and re-render. + +If this happens during a render, treat `loading` similarly, but: + +- if the story is `rendering`, start a new render and abort the previous render immediately afterwards +- if the story is `playing`, attempt to abort the previous play function, and start a new render. + +### Changing story + +Also the `SET_CURRENT_STORY` event may change the current story. We need to check: + +- If the `storyId` changed +- If the `viewMode` changed +- If the story implementation changed (i.e if HMR occurred). + +If the _previous_ story is still `preparing`, we cannot know if the implementation changed, so we +abort the preparing immediately, and let the new story take over. + +Otherwise, if all of the above are the same, we do nothing. + +If they are different, and the old story is not `completed`, we try to abort it immediately. If that fails (e.g. the `play` function doesn't respond to the `abort` event), then we reload the window. diff --git a/code/lib/preview-api/package.json b/code/lib/preview-api/package.json new file mode 100644 index 00000000000..5e7698b1be7 --- /dev/null +++ b/code/lib/preview-api/package.json @@ -0,0 +1,60 @@ +{ + "name": "@storybook/preview-api", + "version": "7.0.0-alpha.47", + "description": "", + "keywords": [ + "storybook" + ], + "homepage": "https://github.com/storybookjs/storybook/tree/main/code/lib/preview-api", + "bugs": { + "url": "https://github.com/storybookjs/storybook/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/storybookjs/storybook.git", + "directory": "code/lib/preview-api" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/storybook" + }, + "license": "MIT", + "sideEffects": false, + "exports": { + ".": { + "import": "./dist/index.mjs", + "require": "./dist/index.js", + "types": "./dist/index.d.ts" + }, + "./package.json": "./package.json" + }, + "main": "dist/index.js", + "module": "dist/index.mjs", + "types": "dist/index.d.ts", + "files": [ + "dist/**/*", + "README.md", + "*.js", + "*.d.ts" + ], + "scripts": { + "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "prep": "../../../scripts/prepare/bundle.ts" + }, + "dependencies": { + "@storybook/addons": "7.0.0-alpha.47", + "@storybook/client-api": "7.0.0-alpha.47", + "@storybook/core-client": "7.0.0-alpha.47", + "@storybook/preview-web": "7.0.0-alpha.47", + "@storybook/store": "7.0.0-alpha.47" + }, + "publishConfig": { + "access": "public" + }, + "bundler": { + "entries": [ + "./src/index.ts" + ] + }, + "gitHead": "3ef14366115c56c1d45c0359ff681cc47ed50532" +} diff --git a/code/lib/preview-api/src/index.ts b/code/lib/preview-api/src/index.ts new file mode 100644 index 00000000000..50a38f1a20d --- /dev/null +++ b/code/lib/preview-api/src/index.ts @@ -0,0 +1,65 @@ +import * as ADDONS from '@storybook/addons'; +import * as CLIENT_API from '@storybook/client-api'; +import * as CORE_CLIENT from '@storybook/core-client'; +import * as PREVIEW_WEB from '@storybook/preview-web'; +import * as STORE from '@storybook/store'; + +/** + * HOOKS API + */ +export const { + useArgs, + useCallback, + useChannel, + useEffect, + useGlobals, + useMemo, + useParameter, + useReducer, + useRef, + useState, + useStoryContext, + HooksContext, +} = ADDONS; + +/** + * DECORATORS API + */ +export const { makeDecorator } = ADDONS; + +/** + * STORIES API + */ +export const { + addArgTypes, + addArgTypesEnhancer, + addArgs, + addArgsEnhancer, + addDecorator, + addLoader, + addParameters, + addStepRunner, +} = CLIENT_API; +export const { getQueryParam, getQueryParams } = CLIENT_API; +export const { setGlobalRender } = CLIENT_API; + +export const { + combineArgs, + combineParameters, + composeConfigs, + composeStepRunners, + composeStories, + composeStory, + decorateStory, + defaultDecorateStory, + prepareStory, + normalizeStory, +} = STORE; + +/** + * STORIES API + */ +export const { ClientApi } = CLIENT_API; +export const { StoryStore } = STORE; +export const { Preview, PreviewWeb } = PREVIEW_WEB; +export const { start } = CORE_CLIENT; diff --git a/code/lib/preview-api/tsconfig.json b/code/lib/preview-api/tsconfig.json new file mode 100644 index 00000000000..abd5b1fe874 --- /dev/null +++ b/code/lib/preview-api/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "strict": true + }, + "include": ["src/**/*"], + "exclude": [] +} diff --git a/code/workspace.json b/code/workspace.json index 3d83aeb3fad..66d44986537 100644 --- a/code/workspace.json +++ b/code/workspace.json @@ -156,11 +156,6 @@ "root": "lib/codemod", "type": "library" }, - "@storybook/[preview]": { - "implicitDependencies": [], - "root": "lib/preview", - "type": "library" - }, "@storybook/components": { "implicitDependencies": [], "root": "ui/components", @@ -241,10 +236,15 @@ "root": "lib/instrumenter", "type": "library" }, + "@storybook/manager": { + "implicitDependencies": [], + "root": "ui/manager", + "type": "library" + }, "@storybook/nextjs": { + "implicitDependencies": [], "root": "frameworks/nextjs", - "type": "library", - "implicitDependencies": [] + "type": "library" }, "@storybook/node-logger": { "implicitDependencies": [], @@ -306,6 +306,16 @@ "root": "presets/web-components-webpack", "type": "library" }, + "@storybook/preview": { + "implicitDependencies": [], + "root": "lib/preview", + "type": "library" + }, + "@storybook/preview-api": { + "implicitDependencies": [], + "root": "lib/preview-api", + "type": "library" + }, "@storybook/preview-web": { "implicitDependencies": [], "root": "lib/preview-web", @@ -381,11 +391,6 @@ "root": "lib/types", "type": "library" }, - "@storybook/manager": { - "implicitDependencies": [], - "root": "ui/manager", - "type": "library" - }, "@storybook/vue": { "implicitDependencies": [], "root": "renderers/vue", diff --git a/code/yarn.lock b/code/yarn.lock index e6932582945..21b30f17f13 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -7234,6 +7234,18 @@ __metadata: languageName: unknown linkType: soft +"@storybook/preview-api@workspace:lib/preview-api": + version: 0.0.0-use.local + resolution: "@storybook/preview-api@workspace:lib/preview-api" + dependencies: + "@storybook/addons": 7.0.0-alpha.47 + "@storybook/client-api": 7.0.0-alpha.47 + "@storybook/core-client": 7.0.0-alpha.47 + "@storybook/preview-web": 7.0.0-alpha.47 + "@storybook/store": 7.0.0-alpha.47 + languageName: unknown + linkType: soft + "@storybook/preview-web@7.0.0-alpha.47, @storybook/preview-web@workspace:*, @storybook/preview-web@workspace:lib/preview-web": version: 0.0.0-use.local resolution: "@storybook/preview-web@workspace:lib/preview-web" From fec9ff475baf78ad5dd770ce899d72029e8fa667 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Thu, 3 Nov 2022 12:18:07 +0100 Subject: [PATCH 02/47] step 2 --- code/lib/builder-webpack5/package.json | 1 + .../src/preview/iframe-webpack.config.ts | 13 ++++++----- code/lib/preview/package.json | 1 + code/lib/preview/src/global/preview-api.ts | 20 +++++++++++++++++ code/lib/preview/src/index.ts | 22 ++++++++++--------- code/lib/preview/src/preview-api.ts | 2 ++ code/yarn.lock | 4 +++- 7 files changed, 46 insertions(+), 17 deletions(-) create mode 100644 code/lib/preview/src/global/preview-api.ts create mode 100644 code/lib/preview/src/preview-api.ts diff --git a/code/lib/builder-webpack5/package.json b/code/lib/builder-webpack5/package.json index de4574034f2..d802c7e738f 100644 --- a/code/lib/builder-webpack5/package.json +++ b/code/lib/builder-webpack5/package.json @@ -67,6 +67,7 @@ "@storybook/core-webpack": "7.0.0-alpha.47", "@storybook/node-logger": "7.0.0-alpha.47", "@storybook/preview": "7.0.0-alpha.47", + "@storybook/preview-api": "7.0.0-alpha.47", "@storybook/preview-web": "7.0.0-alpha.47", "@storybook/router": "7.0.0-alpha.47", "@storybook/store": "7.0.0-alpha.47", diff --git a/code/lib/builder-webpack5/src/preview/iframe-webpack.config.ts b/code/lib/builder-webpack5/src/preview/iframe-webpack.config.ts index c984444da13..fdbe5f71f5b 100644 --- a/code/lib/builder-webpack5/src/preview/iframe-webpack.config.ts +++ b/code/lib/builder-webpack5/src/preview/iframe-webpack.config.ts @@ -39,16 +39,17 @@ const storybookPaths: Record = { ), ...[ // - 'channels', + 'addons', 'channel-postmessage', 'channel-websocket', - 'core-events', - 'client-logger', - 'addons', - 'store', - 'preview-web', + 'channels', 'client-api', + 'client-logger', 'core-client', + 'core-events', + 'preview-api', + 'preview-web', + 'store', ].reduce( (acc, sbPackage) => ({ ...acc, diff --git a/code/lib/preview/package.json b/code/lib/preview/package.json index 51fb42d1265..379e3c945d8 100644 --- a/code/lib/preview/package.json +++ b/code/lib/preview/package.json @@ -101,6 +101,7 @@ "@storybook/core-common": "7.0.0-alpha.47", "@storybook/core-events": "7.0.0-alpha.47", "@storybook/csf": "next", + "@storybook/preview-api": "7.0.0-alpha.47", "@storybook/preview-web": "7.0.0-alpha.47", "@storybook/router": "7.0.0-alpha.47", "@storybook/theming": "7.0.0-alpha.47", diff --git a/code/lib/preview/src/global/preview-api.ts b/code/lib/preview/src/global/preview-api.ts new file mode 100644 index 00000000000..760bd04cb38 --- /dev/null +++ b/code/lib/preview/src/global/preview-api.ts @@ -0,0 +1,20 @@ +/* eslint-disable no-underscore-dangle */ +import type * as MODULE from '../preview-web'; + +const { + DocsContext, + Preview, + PreviewWeb, + composeConfigs, + simulateDOMContentLoaded, + simulatePageLoad, +} = (globalThis as any).__STORYBOOK_MODULE_PREVIEW_WEB__ as typeof MODULE; + +export { + DocsContext, + Preview, + PreviewWeb, + composeConfigs, + simulateDOMContentLoaded, + simulatePageLoad, +}; diff --git a/code/lib/preview/src/index.ts b/code/lib/preview/src/index.ts index 83f9f0a5903..c03e1d5faa0 100644 --- a/code/lib/preview/src/index.ts +++ b/code/lib/preview/src/index.ts @@ -1,26 +1,28 @@ /* eslint-disable no-underscore-dangle */ import * as ADDONS from './addons'; -import * as CLIENT_API from './client-api'; -import * as CORE_CLIENT from './core-client'; -import * as PREVIEW_WEB from './preview-web'; -import * as STORE from './store'; -import * as CHANNELS from './channels'; import * as CHANNEL_POSTMESSAGE from './channel-postmessage'; import * as CHANNEL_WEBSOCKET from './channel-websocket'; +import * as CHANNELS from './channels'; +import * as CLIENT_API from './client-api'; import * as CLIENT_LOGGER from './client-logger'; +import * as CORE_CLIENT from './core-client'; import * as CORE_EVENTS from './core-events'; +import * as PREVIEW_API from './preview-api'; +import * as PREVIEW_WEB from './preview-web'; +import * as STORE from './store'; (globalThis as any).__STORYBOOK_MODULE_ADDONS__ = ADDONS; -(globalThis as any).__STORYBOOK_MODULE_CLIENT_API__ = CLIENT_API; -(globalThis as any).__STORYBOOK_MODULE_CORE_CLIENT__ = CORE_CLIENT; -(globalThis as any).__STORYBOOK_MODULE_PREVIEW_WEB__ = PREVIEW_WEB; -(globalThis as any).__STORYBOOK_MODULE_STORE__ = STORE; -(globalThis as any).__STORYBOOK_MODULE_CHANNELS__ = CHANNELS; (globalThis as any).__STORYBOOK_MODULE_CHANNEL_POSTMESSAGE__ = CHANNEL_POSTMESSAGE; (globalThis as any).__STORYBOOK_MODULE_CHANNEL_WEBSOCKET__ = CHANNEL_WEBSOCKET; +(globalThis as any).__STORYBOOK_MODULE_CHANNELS__ = CHANNELS; +(globalThis as any).__STORYBOOK_MODULE_CLIENT_API__ = CLIENT_API; (globalThis as any).__STORYBOOK_MODULE_CLIENT_LOGGER__ = CLIENT_LOGGER; +(globalThis as any).__STORYBOOK_MODULE_CORE_CLIENT__ = CORE_CLIENT; (globalThis as any).__STORYBOOK_MODULE_CORE_EVENTS__ = CORE_EVENTS; +(globalThis as any).__STORYBOOK_MODULE_PREVIEW_API__ = PREVIEW_API; +(globalThis as any).__STORYBOOK_MODULE_PREVIEW_WEB__ = PREVIEW_WEB; +(globalThis as any).__STORYBOOK_MODULE_STORE__ = STORE; const element = document.getElementById('storybook-script'); diff --git a/code/lib/preview/src/preview-api.ts b/code/lib/preview/src/preview-api.ts new file mode 100644 index 00000000000..633e7e9d933 --- /dev/null +++ b/code/lib/preview/src/preview-api.ts @@ -0,0 +1,2 @@ +/* eslint-disable import/no-extraneous-dependencies */ +export * from '@storybook/preview-api'; diff --git a/code/yarn.lock b/code/yarn.lock index 21b30f17f13..03fe88140e6 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -6222,6 +6222,7 @@ __metadata: "@storybook/core-webpack": 7.0.0-alpha.47 "@storybook/node-logger": 7.0.0-alpha.47 "@storybook/preview": 7.0.0-alpha.47 + "@storybook/preview-api": 7.0.0-alpha.47 "@storybook/preview-web": 7.0.0-alpha.47 "@storybook/router": 7.0.0-alpha.47 "@storybook/store": 7.0.0-alpha.47 @@ -7234,7 +7235,7 @@ __metadata: languageName: unknown linkType: soft -"@storybook/preview-api@workspace:lib/preview-api": +"@storybook/preview-api@7.0.0-alpha.47, @storybook/preview-api@workspace:lib/preview-api": version: 0.0.0-use.local resolution: "@storybook/preview-api@workspace:lib/preview-api" dependencies: @@ -7283,6 +7284,7 @@ __metadata: "@storybook/core-common": 7.0.0-alpha.47 "@storybook/core-events": 7.0.0-alpha.47 "@storybook/csf": next + "@storybook/preview-api": 7.0.0-alpha.47 "@storybook/preview-web": 7.0.0-alpha.47 "@storybook/router": 7.0.0-alpha.47 "@storybook/theming": 7.0.0-alpha.47 From c1b3c2d19f956be85b3c12db36a4e59ae42f3ba8 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Thu, 3 Nov 2022 13:58:04 +0100 Subject: [PATCH 03/47] step 3 --- code/frameworks/react-vite/package.json | 1 + code/frameworks/react-vite/src/index.ts | 2 +- code/frameworks/svelte-vite/package.json | 1 + code/frameworks/svelte-vite/src/index.ts | 2 +- code/frameworks/vue-vite/package.json | 1 + code/frameworks/vue-vite/src/index.ts | 2 +- code/frameworks/vue3-vite/package.json | 1 + code/frameworks/vue3-vite/src/index.ts | 2 +- code/frameworks/web-components-vite/package.json | 1 + code/frameworks/web-components-vite/src/index.ts | 2 +- code/lib/api/src/index.tsx | 2 +- code/lib/builder-vite/src/codegen-iframe-script.ts | 4 ++-- code/lib/builder-vite/src/optimizeDeps.ts | 1 + .../builder-webpack5/src/preview/iframe-webpack.config.ts | 4 ++-- .../templates/virtualModuleEntry.template.js | 2 +- .../templates/virtualModuleModernEntry.js.handlebars | 2 +- code/lib/cli/src/versions.ts | 5 +++-- code/lib/cli/src/window.d.ts | 2 +- code/yarn.lock | 5 +++++ 19 files changed, 27 insertions(+), 15 deletions(-) diff --git a/code/frameworks/react-vite/package.json b/code/frameworks/react-vite/package.json index e275e8074ca..f1f6bf24dc2 100644 --- a/code/frameworks/react-vite/package.json +++ b/code/frameworks/react-vite/package.json @@ -58,6 +58,7 @@ "@storybook/channel-postmessage": "7.0.0-alpha.47", "@storybook/channel-websocket": "7.0.0-alpha.47", "@storybook/client-api": "7.0.0-alpha.47", + "@storybook/preview-api": "7.0.0-alpha.47", "@storybook/preview-web": "7.0.0-alpha.47", "@storybook/react": "7.0.0-alpha.47", "@vitejs/plugin-react": "^2.0.0", diff --git a/code/frameworks/react-vite/src/index.ts b/code/frameworks/react-vite/src/index.ts index 8fbdfff5e6e..a814c5bd240 100644 --- a/code/frameworks/react-vite/src/index.ts +++ b/code/frameworks/react-vite/src/index.ts @@ -3,6 +3,6 @@ export { createChannel as createPostMessageChannel } from '@storybook/channel-po export { createChannel as createWebSocketChannel } from '@storybook/channel-websocket'; export { addons } from '@storybook/addons'; export { composeConfigs, PreviewWeb } from '@storybook/preview-web'; -export { ClientApi } from '@storybook/client-api'; +export { ClientApi } from '@storybook/preview-api'; export type { StorybookConfig } from '@storybook/builder-vite'; diff --git a/code/frameworks/svelte-vite/package.json b/code/frameworks/svelte-vite/package.json index b98437e8927..c38e881f388 100644 --- a/code/frameworks/svelte-vite/package.json +++ b/code/frameworks/svelte-vite/package.json @@ -58,6 +58,7 @@ "@storybook/channel-websocket": "7.0.0-alpha.47", "@storybook/client-api": "7.0.0-alpha.47", "@storybook/node-logger": "7.0.0-alpha.47", + "@storybook/preview-api": "7.0.0-alpha.47", "@storybook/preview-web": "7.0.0-alpha.47", "@storybook/svelte": "7.0.0-alpha.47", "@sveltejs/vite-plugin-svelte": "^1.0.0", diff --git a/code/frameworks/svelte-vite/src/index.ts b/code/frameworks/svelte-vite/src/index.ts index 8fbdfff5e6e..a814c5bd240 100644 --- a/code/frameworks/svelte-vite/src/index.ts +++ b/code/frameworks/svelte-vite/src/index.ts @@ -3,6 +3,6 @@ export { createChannel as createPostMessageChannel } from '@storybook/channel-po export { createChannel as createWebSocketChannel } from '@storybook/channel-websocket'; export { addons } from '@storybook/addons'; export { composeConfigs, PreviewWeb } from '@storybook/preview-web'; -export { ClientApi } from '@storybook/client-api'; +export { ClientApi } from '@storybook/preview-api'; export type { StorybookConfig } from '@storybook/builder-vite'; diff --git a/code/frameworks/vue-vite/package.json b/code/frameworks/vue-vite/package.json index 78a386da4e1..86a6e527b20 100644 --- a/code/frameworks/vue-vite/package.json +++ b/code/frameworks/vue-vite/package.json @@ -57,6 +57,7 @@ "@storybook/client-api": "7.0.0-alpha.47", "@storybook/core-common": "7.0.0-alpha.47", "@storybook/core-server": "7.0.0-alpha.47", + "@storybook/preview-api": "7.0.0-alpha.47", "@storybook/preview-web": "7.0.0-alpha.47", "@storybook/vue": "7.0.0-alpha.47", "magic-string": "^0.26.1", diff --git a/code/frameworks/vue-vite/src/index.ts b/code/frameworks/vue-vite/src/index.ts index 8fbdfff5e6e..a814c5bd240 100644 --- a/code/frameworks/vue-vite/src/index.ts +++ b/code/frameworks/vue-vite/src/index.ts @@ -3,6 +3,6 @@ export { createChannel as createPostMessageChannel } from '@storybook/channel-po export { createChannel as createWebSocketChannel } from '@storybook/channel-websocket'; export { addons } from '@storybook/addons'; export { composeConfigs, PreviewWeb } from '@storybook/preview-web'; -export { ClientApi } from '@storybook/client-api'; +export { ClientApi } from '@storybook/preview-api'; export type { StorybookConfig } from '@storybook/builder-vite'; diff --git a/code/frameworks/vue3-vite/package.json b/code/frameworks/vue3-vite/package.json index 10ee9f308eb..1d38b1a3907 100644 --- a/code/frameworks/vue3-vite/package.json +++ b/code/frameworks/vue3-vite/package.json @@ -57,6 +57,7 @@ "@storybook/channel-websocket": "7.0.0-alpha.47", "@storybook/client-api": "7.0.0-alpha.47", "@storybook/core-server": "7.0.0-alpha.47", + "@storybook/preview-api": "7.0.0-alpha.47", "@storybook/preview-web": "7.0.0-alpha.47", "@storybook/vue3": "7.0.0-alpha.47", "@vitejs/plugin-vue": "^3.0.0", diff --git a/code/frameworks/vue3-vite/src/index.ts b/code/frameworks/vue3-vite/src/index.ts index 8fbdfff5e6e..a814c5bd240 100644 --- a/code/frameworks/vue3-vite/src/index.ts +++ b/code/frameworks/vue3-vite/src/index.ts @@ -3,6 +3,6 @@ export { createChannel as createPostMessageChannel } from '@storybook/channel-po export { createChannel as createWebSocketChannel } from '@storybook/channel-websocket'; export { addons } from '@storybook/addons'; export { composeConfigs, PreviewWeb } from '@storybook/preview-web'; -export { ClientApi } from '@storybook/client-api'; +export { ClientApi } from '@storybook/preview-api'; export type { StorybookConfig } from '@storybook/builder-vite'; diff --git a/code/frameworks/web-components-vite/package.json b/code/frameworks/web-components-vite/package.json index 023d64308e1..b79c1336aea 100644 --- a/code/frameworks/web-components-vite/package.json +++ b/code/frameworks/web-components-vite/package.json @@ -58,6 +58,7 @@ "@storybook/client-api": "7.0.0-alpha.47", "@storybook/core-server": "7.0.0-alpha.47", "@storybook/node-logger": "7.0.0-alpha.47", + "@storybook/preview-api": "7.0.0-alpha.47", "@storybook/preview-web": "7.0.0-alpha.47", "@storybook/web-components": "7.0.0-alpha.47", "magic-string": "^0.26.1", diff --git a/code/frameworks/web-components-vite/src/index.ts b/code/frameworks/web-components-vite/src/index.ts index 8fbdfff5e6e..a814c5bd240 100644 --- a/code/frameworks/web-components-vite/src/index.ts +++ b/code/frameworks/web-components-vite/src/index.ts @@ -3,6 +3,6 @@ export { createChannel as createPostMessageChannel } from '@storybook/channel-po export { createChannel as createWebSocketChannel } from '@storybook/channel-websocket'; export { addons } from '@storybook/addons'; export { composeConfigs, PreviewWeb } from '@storybook/preview-web'; -export { ClientApi } from '@storybook/client-api'; +export { ClientApi } from '@storybook/preview-api'; export type { StorybookConfig } from '@storybook/builder-vite'; diff --git a/code/lib/api/src/index.tsx b/code/lib/api/src/index.tsx index 380bd908597..7038d9b8254 100644 --- a/code/lib/api/src/index.tsx +++ b/code/lib/api/src/index.tsx @@ -125,7 +125,7 @@ export type ManagerProviderProps = RouterData & children: ReactNode | ((props: Combo) => ReactNode); }; -// This is duplicated from @storybook/client-api for the reasons mentioned in lib-addons/types.js +// This is duplicated from @storybook/preview-api for the reasons mentioned in lib-addons/types.js export const combineParameters = (...parameterSets: Parameters[]) => mergeWith({}, ...parameterSets, (objValue: any, srcValue: any) => { // Treat arrays as scalars: diff --git a/code/lib/builder-vite/src/codegen-iframe-script.ts b/code/lib/builder-vite/src/codegen-iframe-script.ts index 90b1315d06e..c3d82584916 100644 --- a/code/lib/builder-vite/src/codegen-iframe-script.ts +++ b/code/lib/builder-vite/src/codegen-iframe-script.ts @@ -29,7 +29,7 @@ export async function generateIframeScriptCode(options: ExtendedOptions) { // is loaded. That way our client-apis can assume the existence of the API+store import { configure } from '${rendererName}'; - import * as clientApi from "@storybook/client-api"; + import * as clientApi from "@storybook/preview-api"; import { logger } from '@storybook/client-logger'; ${absoluteFilesToImport(configEntries, 'config')} import * as preview from '${virtualPreviewFile}'; @@ -45,7 +45,7 @@ export async function generateIframeScriptCode(options: ExtendedOptions) { addArgTypesEnhancer, addArgsEnhancer, setGlobalRender, - } = clientApi; + } = previewApi; const configs = [${importArray('config', configEntries.length) .concat('preview.default') diff --git a/code/lib/builder-vite/src/optimizeDeps.ts b/code/lib/builder-vite/src/optimizeDeps.ts index c9f1bf398e7..d3c43e40aae 100644 --- a/code/lib/builder-vite/src/optimizeDeps.ts +++ b/code/lib/builder-vite/src/optimizeDeps.ts @@ -17,6 +17,7 @@ const INCLUDE_CANDIDATES = [ '@storybook/channel-postmessage', '@storybook/channel-websocket', '@storybook/client-api', + '@storybook/preview-api', '@storybook/client-logger', '@storybook/core/client', '@storybook/types', diff --git a/code/lib/builder-webpack5/src/preview/iframe-webpack.config.ts b/code/lib/builder-webpack5/src/preview/iframe-webpack.config.ts index fdbe5f71f5b..500219a302d 100644 --- a/code/lib/builder-webpack5/src/preview/iframe-webpack.config.ts +++ b/code/lib/builder-webpack5/src/preview/iframe-webpack.config.ts @@ -139,7 +139,7 @@ export default async ( previewAnnotations.forEach((previewAnnotationFilename: string | undefined) => { if (!previewAnnotationFilename) return; - const clientApi = storybookPaths['@storybook/client-api']; + const previewApi = storybookPaths['@storybook/preview-api']; const clientLogger = storybookPaths['@storybook/client-logger']; // Ensure that relative paths end up mapped to a filename in the cwd, so a later import @@ -151,7 +151,7 @@ export default async ( // file, see https://github.com/storybookjs/storybook/pull/16727#issuecomment-986485173 virtualModuleMapping[entryFilename] = interpolate(entryTemplate, { previewAnnotationFilename, - clientApi, + previewApi, clientLogger, }); entries.push(entryFilename); diff --git a/code/lib/builder-webpack5/templates/virtualModuleEntry.template.js b/code/lib/builder-webpack5/templates/virtualModuleEntry.template.js index 6df03401a33..d1f4918b665 100644 --- a/code/lib/builder-webpack5/templates/virtualModuleEntry.template.js +++ b/code/lib/builder-webpack5/templates/virtualModuleEntry.template.js @@ -9,7 +9,7 @@ import { addArgsEnhancer, addArgTypesEnhancer, setGlobalRender, -} from '{{clientApi}}'; +} from '{{previewApi}}'; import * as previewAnnotations from '{{previewAnnotationFilename}}'; Object.keys(previewAnnotations).forEach((key) => { diff --git a/code/lib/builder-webpack5/templates/virtualModuleModernEntry.js.handlebars b/code/lib/builder-webpack5/templates/virtualModuleModernEntry.js.handlebars index fddbe23fd1f..4917d4c2843 100644 --- a/code/lib/builder-webpack5/templates/virtualModuleModernEntry.js.handlebars +++ b/code/lib/builder-webpack5/templates/virtualModuleModernEntry.js.handlebars @@ -2,7 +2,7 @@ import global from 'global'; import { PreviewWeb } from '@storybook/preview-web'; import { composeConfigs } from '@storybook/store'; -import { ClientApi } from '@storybook/client-api'; +import { ClientApi } from '@storybook/preview-api'; import { addons } from '@storybook/addons'; import { createChannel as createPostMessageChannel } from '@storybook/channel-postmessage'; import { createChannel as createWebSocketChannel } from '@storybook/channel-websocket'; diff --git a/code/lib/cli/src/versions.ts b/code/lib/cli/src/versions.ts index efebad6dd65..94364df670b 100644 --- a/code/lib/cli/src/versions.ts +++ b/code/lib/cli/src/versions.ts @@ -43,6 +43,7 @@ export default { '@storybook/html': '7.0.0-alpha.47', '@storybook/html-webpack5': '7.0.0-alpha.47', '@storybook/instrumenter': '7.0.0-alpha.47', + '@storybook/manager': '7.0.0-alpha.47', '@storybook/nextjs': '7.0.0-alpha.47', '@storybook/node-logger': '7.0.0-alpha.47', '@storybook/postinstall': '7.0.0-alpha.47', @@ -56,6 +57,7 @@ export default { '@storybook/preset-vue-webpack': '7.0.0-alpha.47', '@storybook/preset-vue3-webpack': '7.0.0-alpha.47', '@storybook/preset-web-components-webpack': '7.0.0-alpha.47', + '@storybook/preview-api': '7.0.0-alpha.47', '@storybook/preview-web': '7.0.0-alpha.47', '@storybook/react': '7.0.0-alpha.47', '@storybook/react-vite': '7.0.0-alpha.47', @@ -70,7 +72,6 @@ export default { '@storybook/svelte-webpack5': '7.0.0-alpha.47', '@storybook/telemetry': '7.0.0-alpha.47', '@storybook/theming': '7.0.0-alpha.47', - '@storybook/manager': '7.0.0-alpha.47', '@storybook/vue': '7.0.0-alpha.47', '@storybook/vue-vite': '7.0.0-alpha.47', '@storybook/vue-webpack5': '7.0.0-alpha.47', @@ -78,8 +79,8 @@ export default { '@storybook/vue3-vite': '7.0.0-alpha.47', '@storybook/vue3-webpack5': '7.0.0-alpha.47', '@storybook/web-components': '7.0.0-alpha.47', - '@storybook/web-components-webpack5': '7.0.0-alpha.47', '@storybook/web-components-vite': '7.0.0-alpha.47', + '@storybook/web-components-webpack5': '7.0.0-alpha.47', sb: '7.0.0-alpha.47', storybook: '7.0.0-alpha.47', }; diff --git a/code/lib/cli/src/window.d.ts b/code/lib/cli/src/window.d.ts index 64dda386a29..962acdb411c 100644 --- a/code/lib/cli/src/window.d.ts +++ b/code/lib/cli/src/window.d.ts @@ -1,5 +1,5 @@ import type { AnyFramework } from '@storybook/types'; -import type { StoryStore } from '@storybook/client-api'; +import type { StoryStore } from '@storybook/preview-api'; declare global { interface Window { diff --git a/code/yarn.lock b/code/yarn.lock index 03fe88140e6..b3d4edd0c93 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -7336,6 +7336,7 @@ __metadata: "@storybook/channel-postmessage": 7.0.0-alpha.47 "@storybook/channel-websocket": 7.0.0-alpha.47 "@storybook/client-api": 7.0.0-alpha.47 + "@storybook/preview-api": 7.0.0-alpha.47 "@storybook/preview-web": 7.0.0-alpha.47 "@storybook/react": 7.0.0-alpha.47 "@types/node": ^16.0.0 @@ -7809,6 +7810,7 @@ __metadata: "@storybook/channel-websocket": 7.0.0-alpha.47 "@storybook/client-api": 7.0.0-alpha.47 "@storybook/node-logger": 7.0.0-alpha.47 + "@storybook/preview-api": 7.0.0-alpha.47 "@storybook/preview-web": 7.0.0-alpha.47 "@storybook/svelte": 7.0.0-alpha.47 "@sveltejs/vite-plugin-svelte": ^1.0.0 @@ -7968,6 +7970,7 @@ __metadata: "@storybook/client-api": 7.0.0-alpha.47 "@storybook/core-common": 7.0.0-alpha.47 "@storybook/core-server": 7.0.0-alpha.47 + "@storybook/preview-api": 7.0.0-alpha.47 "@storybook/preview-web": 7.0.0-alpha.47 "@storybook/vue": 7.0.0-alpha.47 magic-string: ^0.26.1 @@ -8015,6 +8018,7 @@ __metadata: "@storybook/channel-websocket": 7.0.0-alpha.47 "@storybook/client-api": 7.0.0-alpha.47 "@storybook/core-server": 7.0.0-alpha.47 + "@storybook/preview-api": 7.0.0-alpha.47 "@storybook/preview-web": 7.0.0-alpha.47 "@storybook/vue3": 7.0.0-alpha.47 "@types/node": ^16.0.0 @@ -8116,6 +8120,7 @@ __metadata: "@storybook/client-api": 7.0.0-alpha.47 "@storybook/core-server": 7.0.0-alpha.47 "@storybook/node-logger": 7.0.0-alpha.47 + "@storybook/preview-api": 7.0.0-alpha.47 "@storybook/preview-web": 7.0.0-alpha.47 "@storybook/web-components": 7.0.0-alpha.47 "@types/node": ^16.0.0 From ed3a8ec6420ba9d574930edc89219f67d63f487f Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Thu, 3 Nov 2022 14:39:43 +0100 Subject: [PATCH 04/47] step 4 --- code/addons/a11y/package.json | 1 + code/addons/a11y/src/a11yRunner.test.ts | 4 +-- code/addons/a11y/src/a11yRunner.ts | 2 +- code/addons/a11y/src/manager.test.tsx | 4 +-- code/addons/a11y/src/manager.tsx | 2 +- code/addons/actions/package.json | 1 + code/addons/actions/src/decorator.ts | 2 +- code/addons/actions/src/manager.tsx | 2 +- .../src/runtime/__tests__/action.test.js | 4 +-- .../src/runtime/__tests__/actions.test.js | 4 +-- code/addons/actions/src/runtime/action.ts | 2 +- code/addons/backgrounds/package.json | 1 + .../src/decorators/withBackground.ts | 2 +- .../backgrounds/src/decorators/withGrid.ts | 2 +- code/addons/backgrounds/src/manager.tsx | 2 +- code/addons/controls/package.json | 1 + code/addons/controls/src/manager.tsx | 2 +- code/addons/docs/package.json | 1 + code/addons/essentials/package.json | 1 + code/addons/highlight/package.json | 1 + code/addons/highlight/src/highlight.ts | 2 +- code/addons/interactions/package.json | 1 + code/addons/interactions/src/manager.tsx | 2 +- .../addons/interactions/src/preset/preview.ts | 2 +- code/addons/jest/package.json | 1 + code/addons/jest/src/index.ts | 2 +- code/addons/jest/src/manager.tsx | 2 +- code/addons/links/package.json | 1 + code/addons/links/src/manager.ts | 2 +- .../links/src/react/components/link.test.tsx | 4 +-- code/addons/links/src/utils.test.ts | 4 +-- code/addons/links/src/utils.ts | 2 +- code/addons/measure/package.json | 1 + code/addons/measure/src/manager.tsx | 2 +- code/addons/measure/src/withMeasure.ts | 2 +- code/addons/outline/package.json | 1 + code/addons/outline/src/manager.tsx | 2 +- code/addons/outline/src/withOutline.ts | 2 +- .../storyshots/storyshots-core/package.json | 1 + .../storyshots-core/src/api/index.ts | 2 +- code/addons/storysource/package.json | 1 + code/addons/storysource/src/manager.tsx | 2 +- code/addons/toolbars/package.json | 1 + code/addons/toolbars/src/manager.tsx | 2 +- code/addons/viewport/package.json | 1 + code/addons/viewport/src/manager.tsx | 2 +- code/frameworks/angular/package.json | 1 + .../src/client/angular-beta/DocsRenderer.ts | 2 +- .../src/client/docs/sourceDecorator.ts | 2 +- .../framework-preset-angular-cli.test.ts | 2 +- code/frameworks/nextjs/package.json | 1 + code/frameworks/react-vite/src/index.ts | 2 +- code/frameworks/svelte-vite/src/index.ts | 2 +- code/frameworks/vue-vite/src/index.ts | 2 +- code/frameworks/vue3-vite/src/index.ts | 2 +- .../web-components-vite/src/index.ts | 2 +- code/lib/builder-vite/src/optimizeDeps.ts | 2 +- .../virtualModuleModernEntry.js.handlebars | 2 +- .../js-package-manager/JsPackageManager.ts | 2 +- .../src/js-package-manager/NPMProxy.test.ts | 34 +++++++++---------- .../src/js-package-manager/PNPMProxy.test.ts | 22 ++++++------ .../src/js-package-manager/Yarn1Proxy.test.ts | 22 ++++++------ .../src/js-package-manager/Yarn2Proxy.test.ts | 26 +++++++------- code/lib/cli/src/versions.ts | 2 +- .../transforms/update-organisation-name.js | 2 +- code/lib/instrumenter/package.json | 1 + .../lib/instrumenter/src/instrumenter.test.ts | 2 +- code/lib/instrumenter/src/instrumenter.ts | 2 +- code/lib/postinstall/src/frameworks.test.ts | 2 +- code/lib/preview-api/package.json | 1 + code/lib/preview-api/src/index.ts | 7 ++++ code/package.json | 1 + code/renderers/html/package.json | 1 + .../html/src/docs/sourceDecorator.test.ts | 4 +-- .../html/src/docs/sourceDecorator.ts | 2 +- code/renderers/preact/package.json | 1 + code/renderers/react/package.json | 1 + .../react/src/__test__/internals.test.tsx | 2 +- .../react/src/docs/jsxDecorator.test.tsx | 4 +-- .../renderers/react/src/docs/jsxDecorator.tsx | 2 +- code/renderers/server/package.json | 1 + code/renderers/svelte/package.json | 1 + .../svelte/src/docs/sourceDecorator.ts | 2 +- code/renderers/vue/package.json | 1 + .../renderers/vue/src/docs/sourceDecorator.ts | 2 +- code/renderers/vue3/package.json | 1 + code/renderers/web-components/package.json | 1 + .../src/docs/sourceDecorator.test.ts | 4 +-- .../src/docs/sourceDecorator.ts | 2 +- code/ui/.storybook/manager.ts | 2 +- code/ui/blocks/package.json | 1 + code/ui/manager/package.json | 1 + code/ui/manager/paths.js | 2 +- code/ui/manager/src/FakeProvider.tsx | 2 +- .../components/preview/preview.mockdata.tsx | 2 +- .../src/components/preview/tools/addons.tsx | 2 +- .../src/components/preview/tools/copy.tsx | 2 +- .../src/components/preview/tools/eject.tsx | 2 +- .../src/components/preview/tools/menu.tsx | 2 +- .../src/components/preview/tools/remount.tsx | 2 +- .../src/components/preview/tools/zoom.tsx | 2 +- code/ui/manager/src/globals/exports.ts | 32 ++++++++++++++--- code/ui/manager/src/globals/runtime.ts | 4 +-- code/ui/manager/src/globals/types.ts | 2 +- code/ui/manager/src/runtime.ts | 4 +-- code/yarn.lock | 33 +++++++++++++++++- .../component-story-highlight-addon.ts.mdx | 2 +- ...addon-consume-and-update-globaltype.js.mdx | 2 +- .../my-addon-initial-panel-state.js.mdx | 2 +- .../storybook-addon-panel-example.js.mdx | 2 +- .../storybook-addon-panel-initial.js.mdx | 2 +- .../common/storybook-addon-tab-example.js.mdx | 2 +- .../storybook-addon-toolbar-example.js.mdx | 2 +- .../storybook-addons-api-imports.js.mdx | 2 +- .../storybook-addons-api-makedecorator.js.mdx | 2 +- .../storybook-addons-api-register.js.mdx | 2 +- .../common/storybook-config-layout.js.mdx | 2 +- .../storybook-manager-custom-theme.js.mdx | 2 +- .../storybook-manager-dark-theme.js.mdx | 2 +- .../storybook-manager-disable-roots.js.mdx | 2 +- ...rybook-manager-render-label-stories.js.mdx | 2 +- .../component-story-highlight-addon.js.mdx | 2 +- .../component-story-highlight-addon.js.mdx | 2 +- .../component-story-highlight-addon.js.mdx | 2 +- 124 files changed, 246 insertions(+), 155 deletions(-) diff --git a/code/addons/a11y/package.json b/code/addons/a11y/package.json index 8c6d1d8e168..e94ab68c0f4 100644 --- a/code/addons/a11y/package.json +++ b/code/addons/a11y/package.json @@ -69,6 +69,7 @@ "@storybook/client-logger": "7.0.0-alpha.47", "@storybook/components": "7.0.0-alpha.47", "@storybook/core-events": "7.0.0-alpha.47", + "@storybook/preview-api": "7.0.0-alpha.47", "@storybook/theming": "7.0.0-alpha.47", "@storybook/types": "7.0.0-alpha.47", "axe-core": "^4.2.0", diff --git a/code/addons/a11y/src/a11yRunner.test.ts b/code/addons/a11y/src/a11yRunner.test.ts index 47d9dac7d20..c1662d39369 100644 --- a/code/addons/a11y/src/a11yRunner.test.ts +++ b/code/addons/a11y/src/a11yRunner.test.ts @@ -1,7 +1,7 @@ -import { addons } from '@storybook/addons'; +import { addons } from '@storybook/preview-api'; import { EVENTS } from './constants'; -jest.mock('@storybook/addons'); +jest.mock('@storybook/preview-api'); const mockedAddons = addons as jest.Mocked; describe('a11yRunner', () => { diff --git a/code/addons/a11y/src/a11yRunner.ts b/code/addons/a11y/src/a11yRunner.ts index 1f1c24b6ebe..88dd78a6466 100644 --- a/code/addons/a11y/src/a11yRunner.ts +++ b/code/addons/a11y/src/a11yRunner.ts @@ -1,5 +1,5 @@ import global from 'global'; -import { addons } from '@storybook/addons'; +import { addons } from '@storybook/preview-api'; import { EVENTS } from './constants'; import type { A11yParameters } from './params'; diff --git a/code/addons/a11y/src/manager.test.tsx b/code/addons/a11y/src/manager.test.tsx index ff6c90a4452..25729475f15 100644 --- a/code/addons/a11y/src/manager.test.tsx +++ b/code/addons/a11y/src/manager.test.tsx @@ -1,10 +1,10 @@ -import { addons } from '@storybook/addons'; +import { addons } from '@storybook/preview-api'; import * as api from '@storybook/api'; import { PANEL_ID } from './constants'; import './manager'; jest.mock('@storybook/api'); -jest.mock('@storybook/addons'); +jest.mock('@storybook/preview-api'); const mockedApi = api as unknown as jest.Mocked; mockedApi.getAddonState = jest.fn(); const mockedAddons = addons as jest.Mocked; diff --git a/code/addons/a11y/src/manager.tsx b/code/addons/a11y/src/manager.tsx index 3d863b3eb1b..f7ae42e5243 100644 --- a/code/addons/a11y/src/manager.tsx +++ b/code/addons/a11y/src/manager.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { addons, types } from '@storybook/addons'; +import { addons, types } from '@storybook/preview-api'; import { ADDON_ID, PANEL_ID, PARAM_KEY } from './constants'; import { VisionSimulator } from './components/VisionSimulator'; import { A11YPanel } from './components/A11YPanel'; diff --git a/code/addons/actions/package.json b/code/addons/actions/package.json index 91b57e0027e..85297dd35e1 100644 --- a/code/addons/actions/package.json +++ b/code/addons/actions/package.json @@ -68,6 +68,7 @@ "@storybook/client-logger": "7.0.0-alpha.47", "@storybook/components": "7.0.0-alpha.47", "@storybook/core-events": "7.0.0-alpha.47", + "@storybook/preview-api": "7.0.0-alpha.47", "@storybook/theming": "7.0.0-alpha.47", "@storybook/types": "7.0.0-alpha.47", "dequal": "^2.0.2", diff --git a/code/addons/actions/src/decorator.ts b/code/addons/actions/src/decorator.ts index 4b5d2f8e944..5a1ba2b3deb 100644 --- a/code/addons/actions/src/decorator.ts +++ b/code/addons/actions/src/decorator.ts @@ -1,5 +1,5 @@ import global from 'global'; -import { useEffect, makeDecorator } from '@storybook/addons'; +import { useEffect, makeDecorator } from '@storybook/preview-api'; import { actions } from './runtime/actions'; import { PARAM_KEY } from './constants'; diff --git a/code/addons/actions/src/manager.tsx b/code/addons/actions/src/manager.tsx index bd024620ac5..75e288ac907 100644 --- a/code/addons/actions/src/manager.tsx +++ b/code/addons/actions/src/manager.tsx @@ -1,5 +1,5 @@ import React, { useState, useEffect } from 'react'; -import { addons, types } from '@storybook/addons'; +import { addons, types } from '@storybook/preview-api'; import { STORY_CHANGED } from '@storybook/core-events'; import ActionLogger from './containers/ActionLogger'; import { ADDON_ID, EVENT_ID, PANEL_ID, PARAM_KEY } from './constants'; diff --git a/code/addons/actions/src/runtime/__tests__/action.test.js b/code/addons/actions/src/runtime/__tests__/action.test.js index d89b120476b..4f8f8676106 100644 --- a/code/addons/actions/src/runtime/__tests__/action.test.js +++ b/code/addons/actions/src/runtime/__tests__/action.test.js @@ -1,7 +1,7 @@ -import { addons } from '@storybook/addons'; +import { addons } from '@storybook/preview-api'; import { action, configureActions } from '../..'; -jest.mock('@storybook/addons'); +jest.mock('@storybook/preview-api'); const createChannel = () => { const channel = { emit: jest.fn() }; diff --git a/code/addons/actions/src/runtime/__tests__/actions.test.js b/code/addons/actions/src/runtime/__tests__/actions.test.js index a9cd65c80ed..b3e1ae2779a 100644 --- a/code/addons/actions/src/runtime/__tests__/actions.test.js +++ b/code/addons/actions/src/runtime/__tests__/actions.test.js @@ -1,7 +1,7 @@ -import { addons } from '@storybook/addons'; +import { addons } from '@storybook/preview-api'; import { actions } from '../..'; -jest.mock('@storybook/addons'); +jest.mock('@storybook/preview-api'); const createChannel = () => { const channel = { emit: jest.fn() }; diff --git a/code/addons/actions/src/runtime/action.ts b/code/addons/actions/src/runtime/action.ts index d56a290192f..3a0fc25e9cd 100644 --- a/code/addons/actions/src/runtime/action.ts +++ b/code/addons/actions/src/runtime/action.ts @@ -1,5 +1,5 @@ import uuidv4 from 'uuid-browser/v4'; -import { addons } from '@storybook/addons'; +import { addons } from '@storybook/preview-api'; import { EVENT_ID } from '../constants'; import type { ActionDisplay, ActionOptions, HandlerFunction } from '../models'; import { config } from './configureActions'; diff --git a/code/addons/backgrounds/package.json b/code/addons/backgrounds/package.json index 12124cdcd4c..983fcde295f 100644 --- a/code/addons/backgrounds/package.json +++ b/code/addons/backgrounds/package.json @@ -67,6 +67,7 @@ "@storybook/client-logger": "7.0.0-alpha.47", "@storybook/components": "7.0.0-alpha.47", "@storybook/core-events": "7.0.0-alpha.47", + "@storybook/preview-api": "7.0.0-alpha.47", "@storybook/theming": "7.0.0-alpha.47", "@storybook/types": "7.0.0-alpha.47", "global": "^4.4.0", diff --git a/code/addons/backgrounds/src/decorators/withBackground.ts b/code/addons/backgrounds/src/decorators/withBackground.ts index 306f06398a3..c814dc3a2d6 100644 --- a/code/addons/backgrounds/src/decorators/withBackground.ts +++ b/code/addons/backgrounds/src/decorators/withBackground.ts @@ -1,4 +1,4 @@ -import { useMemo, useEffect } from '@storybook/addons'; +import { useMemo, useEffect } from '@storybook/preview-api'; import type { AnyFramework, PartialStoryFn as StoryFunction, StoryContext } from '@storybook/types'; import { PARAM_KEY as BACKGROUNDS_PARAM_KEY } from '../constants'; diff --git a/code/addons/backgrounds/src/decorators/withGrid.ts b/code/addons/backgrounds/src/decorators/withGrid.ts index 2aafc186c1e..1285bea764c 100644 --- a/code/addons/backgrounds/src/decorators/withGrid.ts +++ b/code/addons/backgrounds/src/decorators/withGrid.ts @@ -1,4 +1,4 @@ -import { useMemo, useEffect } from '@storybook/addons'; +import { useMemo, useEffect } from '@storybook/preview-api'; import type { AnyFramework, PartialStoryFn as StoryFunction, StoryContext } from '@storybook/types'; import { clearStyles, addGridStyle } from '../helpers'; diff --git a/code/addons/backgrounds/src/manager.tsx b/code/addons/backgrounds/src/manager.tsx index d3b8d095ec9..0ca6932cd83 100644 --- a/code/addons/backgrounds/src/manager.tsx +++ b/code/addons/backgrounds/src/manager.tsx @@ -1,5 +1,5 @@ import React, { Fragment } from 'react'; -import { addons, types } from '@storybook/addons'; +import { addons, types } from '@storybook/preview-api'; import { ADDON_ID } from './constants'; import { BackgroundSelector } from './containers/BackgroundSelector'; diff --git a/code/addons/controls/package.json b/code/addons/controls/package.json index 18adadb1e42..e25c3108c8a 100644 --- a/code/addons/controls/package.json +++ b/code/addons/controls/package.json @@ -64,6 +64,7 @@ "@storybook/components": "7.0.0-alpha.47", "@storybook/core-common": "7.0.0-alpha.47", "@storybook/node-logger": "7.0.0-alpha.47", + "@storybook/preview-api": "7.0.0-alpha.47", "@storybook/store": "7.0.0-alpha.47", "@storybook/theming": "7.0.0-alpha.47", "@storybook/types": "7.0.0-alpha.47", diff --git a/code/addons/controls/src/manager.tsx b/code/addons/controls/src/manager.tsx index f76dfaf83e9..64e2c1a541a 100644 --- a/code/addons/controls/src/manager.tsx +++ b/code/addons/controls/src/manager.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { addons, types } from '@storybook/addons'; +import { addons, types } from '@storybook/preview-api'; import { AddonPanel } from '@storybook/components'; import { type API, useArgTypes } from '@storybook/api'; import { ControlsPanel } from './ControlsPanel'; diff --git a/code/addons/docs/package.json b/code/addons/docs/package.json index 0bdef57c666..99c471cf85f 100644 --- a/code/addons/docs/package.json +++ b/code/addons/docs/package.json @@ -64,6 +64,7 @@ "@storybook/mdx2-csf": "next", "@storybook/node-logger": "7.0.0-alpha.47", "@storybook/postinstall": "7.0.0-alpha.47", + "@storybook/preview-api": "7.0.0-alpha.47", "@storybook/preview-web": "7.0.0-alpha.47", "@storybook/store": "7.0.0-alpha.47", "@storybook/theming": "7.0.0-alpha.47", diff --git a/code/addons/essentials/package.json b/code/addons/essentials/package.json index 114f34133fe..b89535214c2 100644 --- a/code/addons/essentials/package.json +++ b/code/addons/essentials/package.json @@ -54,6 +54,7 @@ "@storybook/api": "7.0.0-alpha.47", "@storybook/core-common": "7.0.0-alpha.47", "@storybook/node-logger": "7.0.0-alpha.47", + "@storybook/preview-api": "7.0.0-alpha.47", "ts-dedent": "^2.0.0" }, "devDependencies": { diff --git a/code/addons/highlight/package.json b/code/addons/highlight/package.json index 4d11f001001..fbc71b0658c 100644 --- a/code/addons/highlight/package.json +++ b/code/addons/highlight/package.json @@ -52,6 +52,7 @@ "dependencies": { "@storybook/addons": "7.0.0-alpha.47", "@storybook/core-events": "7.0.0-alpha.47", + "@storybook/preview-api": "7.0.0-alpha.47", "global": "^4.4.0" }, "devDependencies": { diff --git a/code/addons/highlight/src/highlight.ts b/code/addons/highlight/src/highlight.ts index b3bf0acfaa7..36e486b90f7 100644 --- a/code/addons/highlight/src/highlight.ts +++ b/code/addons/highlight/src/highlight.ts @@ -1,6 +1,6 @@ /* eslint-env browser */ import global from 'global'; -import { addons } from '@storybook/addons'; +import { addons } from '@storybook/preview-api'; import { STORY_CHANGED } from '@storybook/core-events'; import { HIGHLIGHT, RESET_HIGHLIGHT, HIGHLIGHT_STYLE_ID } from './constants'; diff --git a/code/addons/interactions/package.json b/code/addons/interactions/package.json index aaf19034814..0e9abf41334 100644 --- a/code/addons/interactions/package.json +++ b/code/addons/interactions/package.json @@ -66,6 +66,7 @@ "@storybook/core-common": "7.0.0-alpha.47", "@storybook/core-events": "7.0.0-alpha.47", "@storybook/instrumenter": "7.0.0-alpha.47", + "@storybook/preview-api": "7.0.0-alpha.47", "@storybook/theming": "7.0.0-alpha.47", "@storybook/types": "7.0.0-alpha.47", "global": "^4.4.0", diff --git a/code/addons/interactions/src/manager.tsx b/code/addons/interactions/src/manager.tsx index 454945d6c44..bd36869a9c5 100644 --- a/code/addons/interactions/src/manager.tsx +++ b/code/addons/interactions/src/manager.tsx @@ -1,4 +1,4 @@ -import { addons, types } from '@storybook/addons'; +import { addons, types } from '@storybook/preview-api'; import { ADDON_ID, PANEL_ID } from './constants'; import { Panel } from './Panel'; diff --git a/code/addons/interactions/src/preset/preview.ts b/code/addons/interactions/src/preset/preview.ts index 9faae0eefe7..84e215cd317 100644 --- a/code/addons/interactions/src/preset/preview.ts +++ b/code/addons/interactions/src/preset/preview.ts @@ -1,6 +1,6 @@ /// -import { addons } from '@storybook/addons'; +import { addons } from '@storybook/preview-api'; import { FORCE_REMOUNT, STORY_RENDER_PHASE_CHANGED } from '@storybook/core-events'; import type { AnyFramework, diff --git a/code/addons/jest/package.json b/code/addons/jest/package.json index bb6a5b226ee..10f3dddb881 100644 --- a/code/addons/jest/package.json +++ b/code/addons/jest/package.json @@ -64,6 +64,7 @@ "@storybook/client-logger": "7.0.0-alpha.47", "@storybook/components": "7.0.0-alpha.47", "@storybook/core-events": "7.0.0-alpha.47", + "@storybook/preview-api": "7.0.0-alpha.47", "@storybook/theming": "7.0.0-alpha.47", "global": "^4.4.0", "react-sizeme": "^3.0.1", diff --git a/code/addons/jest/src/index.ts b/code/addons/jest/src/index.ts index 2e8b0715121..5b68c9d9a9a 100644 --- a/code/addons/jest/src/index.ts +++ b/code/addons/jest/src/index.ts @@ -1,6 +1,6 @@ /// -import { addons } from '@storybook/addons'; +import { addons } from '@storybook/preview-api'; import { normalize, sep } from 'upath'; import { ADD_TESTS, defineJestParameter } from './shared'; diff --git a/code/addons/jest/src/manager.tsx b/code/addons/jest/src/manager.tsx index 19a1e46f115..c5a5cd26ae6 100644 --- a/code/addons/jest/src/manager.tsx +++ b/code/addons/jest/src/manager.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import { addons } from '@storybook/addons'; +import { addons } from '@storybook/preview-api'; import { ADDON_ID, PANEL_ID, PARAM_KEY } from './shared'; import Panel from './components/Panel'; diff --git a/code/addons/links/package.json b/code/addons/links/package.json index 45d083b1e68..d6dccd92bb4 100644 --- a/code/addons/links/package.json +++ b/code/addons/links/package.json @@ -67,6 +67,7 @@ "@storybook/client-logger": "7.0.0-alpha.47", "@storybook/core-events": "7.0.0-alpha.47", "@storybook/csf": "next", + "@storybook/preview-api": "7.0.0-alpha.47", "@storybook/router": "7.0.0-alpha.47", "@storybook/types": "7.0.0-alpha.47", "global": "^4.4.0", diff --git a/code/addons/links/src/manager.ts b/code/addons/links/src/manager.ts index 98b7feca38f..bf7b59d9940 100644 --- a/code/addons/links/src/manager.ts +++ b/code/addons/links/src/manager.ts @@ -1,4 +1,4 @@ -import { addons } from '@storybook/addons'; +import { addons } from '@storybook/preview-api'; import EVENTS, { ADDON_ID } from './constants'; diff --git a/code/addons/links/src/react/components/link.test.tsx b/code/addons/links/src/react/components/link.test.tsx index 664670baa26..0057264b14a 100644 --- a/code/addons/links/src/react/components/link.test.tsx +++ b/code/addons/links/src/react/components/link.test.tsx @@ -1,11 +1,11 @@ import React from 'react'; -import { addons } from '@storybook/addons'; +import { addons } from '@storybook/preview-api'; import { render, screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { SELECT_STORY } from '@storybook/core-events'; import LinkTo from './link'; -jest.mock('@storybook/addons'); +jest.mock('@storybook/preview-api'); jest.mock('global', () => ({ document: { location: { diff --git a/code/addons/links/src/utils.test.ts b/code/addons/links/src/utils.test.ts index 44388665381..1b78ebc1b20 100644 --- a/code/addons/links/src/utils.test.ts +++ b/code/addons/links/src/utils.test.ts @@ -1,9 +1,9 @@ -import { addons } from '@storybook/addons'; +import { addons } from '@storybook/preview-api'; import { SELECT_STORY } from '@storybook/core-events'; import { linkTo, hrefTo } from './utils'; -jest.mock('@storybook/addons'); +jest.mock('@storybook/preview-api'); jest.mock('global', () => ({ // @ts-expect-error (Converted from ts-ignore) document: global.document, diff --git a/code/addons/links/src/utils.ts b/code/addons/links/src/utils.ts index b4ece3c80fe..82494c60bb5 100644 --- a/code/addons/links/src/utils.ts +++ b/code/addons/links/src/utils.ts @@ -1,5 +1,5 @@ import global from 'global'; -import { addons, makeDecorator } from '@storybook/addons'; +import { addons, makeDecorator } from '@storybook/preview-api'; import { STORY_CHANGED, SELECT_STORY } from '@storybook/core-events'; import type { StoryId, StoryName, ComponentTitle } from '@storybook/types'; import { toId } from '@storybook/csf'; diff --git a/code/addons/measure/package.json b/code/addons/measure/package.json index 8b2d88c0bb0..cc8ca1723b6 100644 --- a/code/addons/measure/package.json +++ b/code/addons/measure/package.json @@ -66,6 +66,7 @@ "@storybook/client-logger": "7.0.0-alpha.47", "@storybook/components": "7.0.0-alpha.47", "@storybook/core-events": "7.0.0-alpha.47", + "@storybook/preview-api": "7.0.0-alpha.47", "@storybook/types": "7.0.0-alpha.47", "global": "^4.4.0" }, diff --git a/code/addons/measure/src/manager.tsx b/code/addons/measure/src/manager.tsx index 162e7ce43ec..026c530a1f6 100644 --- a/code/addons/measure/src/manager.tsx +++ b/code/addons/measure/src/manager.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { addons, types } from '@storybook/addons'; +import { addons, types } from '@storybook/preview-api'; import { ADDON_ID, TOOL_ID } from './constants'; import { Tool } from './Tool'; diff --git a/code/addons/measure/src/withMeasure.ts b/code/addons/measure/src/withMeasure.ts index e68e8f4d79e..51eb5976812 100644 --- a/code/addons/measure/src/withMeasure.ts +++ b/code/addons/measure/src/withMeasure.ts @@ -1,5 +1,5 @@ /* eslint-env browser */ -import { useEffect } from '@storybook/addons'; +import { useEffect } from '@storybook/preview-api'; import type { AnyFramework, PartialStoryFn as StoryFunction, StoryContext } from '@storybook/types'; import { drawSelectedElement } from './box-model/visualizer'; import { init, rescale, destroy } from './box-model/canvas'; diff --git a/code/addons/outline/package.json b/code/addons/outline/package.json index ca64da59d95..1b780d03c4f 100644 --- a/code/addons/outline/package.json +++ b/code/addons/outline/package.json @@ -69,6 +69,7 @@ "@storybook/client-logger": "7.0.0-alpha.47", "@storybook/components": "7.0.0-alpha.47", "@storybook/core-events": "7.0.0-alpha.47", + "@storybook/preview-api": "7.0.0-alpha.47", "@storybook/types": "7.0.0-alpha.47", "global": "^4.4.0", "ts-dedent": "^2.0.0" diff --git a/code/addons/outline/src/manager.tsx b/code/addons/outline/src/manager.tsx index 3f3f96ae3b0..b0bf0f20ca5 100644 --- a/code/addons/outline/src/manager.tsx +++ b/code/addons/outline/src/manager.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { addons, types } from '@storybook/addons'; +import { addons, types } from '@storybook/preview-api'; import { ADDON_ID } from './constants'; import { OutlineSelector } from './OutlineSelector'; diff --git a/code/addons/outline/src/withOutline.ts b/code/addons/outline/src/withOutline.ts index 037c8eb090e..513c9cf75cd 100644 --- a/code/addons/outline/src/withOutline.ts +++ b/code/addons/outline/src/withOutline.ts @@ -1,4 +1,4 @@ -import { useMemo, useEffect } from '@storybook/addons'; +import { useMemo, useEffect } from '@storybook/preview-api'; import type { AnyFramework, PartialStoryFn as StoryFunction, StoryContext } from '@storybook/types'; import { clearStyles, addOutlineStyles } from './helpers'; diff --git a/code/addons/storyshots/storyshots-core/package.json b/code/addons/storyshots/storyshots-core/package.json index 5d47cb1d359..750805bcb49 100644 --- a/code/addons/storyshots/storyshots-core/package.json +++ b/code/addons/storyshots/storyshots-core/package.json @@ -44,6 +44,7 @@ "@storybook/core-client": "7.0.0-alpha.47", "@storybook/core-common": "7.0.0-alpha.47", "@storybook/core-webpack": "7.0.0-alpha.47", + "@storybook/preview-api": "7.0.0-alpha.47", "@storybook/types": "7.0.0-alpha.47", "@types/glob": "^7.1.3", "@types/jest": "^26.0.16", diff --git a/code/addons/storyshots/storyshots-core/src/api/index.ts b/code/addons/storyshots/storyshots-core/src/api/index.ts index ae22540ccc9..c05c2f23a21 100644 --- a/code/addons/storyshots/storyshots-core/src/api/index.ts +++ b/code/addons/storyshots/storyshots-core/src/api/index.ts @@ -1,5 +1,5 @@ import global from 'global'; -import { addons, mockChannel } from '@storybook/addons'; +import { addons, mockChannel } from '@storybook/preview-api'; import ensureOptionsDefaults from './ensureOptionsDefaults'; import snapshotsTests from './snapshotsTestsTemplate'; import integrityTest from './integrityTestTemplate'; diff --git a/code/addons/storysource/package.json b/code/addons/storysource/package.json index b99a34b22e4..f76156c368f 100644 --- a/code/addons/storysource/package.json +++ b/code/addons/storysource/package.json @@ -57,6 +57,7 @@ "@storybook/api": "7.0.0-alpha.47", "@storybook/client-logger": "7.0.0-alpha.47", "@storybook/components": "7.0.0-alpha.47", + "@storybook/preview-api": "7.0.0-alpha.47", "@storybook/router": "7.0.0-alpha.47", "@storybook/source-loader": "7.0.0-alpha.47", "@storybook/theming": "7.0.0-alpha.47", diff --git a/code/addons/storysource/src/manager.tsx b/code/addons/storysource/src/manager.tsx index 7de7e8845f0..8c4f04dc8a6 100644 --- a/code/addons/storysource/src/manager.tsx +++ b/code/addons/storysource/src/manager.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { addons } from '@storybook/addons'; +import { addons } from '@storybook/preview-api'; import { StoryPanel } from './StoryPanel'; import { ADDON_ID, PANEL_ID } from './index'; diff --git a/code/addons/toolbars/package.json b/code/addons/toolbars/package.json index e2f62ba9de7..5fb8051c8a3 100644 --- a/code/addons/toolbars/package.json +++ b/code/addons/toolbars/package.json @@ -61,6 +61,7 @@ "@storybook/api": "7.0.0-alpha.47", "@storybook/client-logger": "7.0.0-alpha.47", "@storybook/components": "7.0.0-alpha.47", + "@storybook/preview-api": "7.0.0-alpha.47", "@storybook/theming": "7.0.0-alpha.47" }, "devDependencies": { diff --git a/code/addons/toolbars/src/manager.tsx b/code/addons/toolbars/src/manager.tsx index c6681e98935..54b233c57f4 100644 --- a/code/addons/toolbars/src/manager.tsx +++ b/code/addons/toolbars/src/manager.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { addons, types } from '@storybook/addons'; +import { addons, types } from '@storybook/preview-api'; import { ToolbarManager } from './components/ToolbarManager'; import { ADDON_ID } from './constants'; diff --git a/code/addons/viewport/package.json b/code/addons/viewport/package.json index 4a7bd33a2b6..b12736014bf 100644 --- a/code/addons/viewport/package.json +++ b/code/addons/viewport/package.json @@ -64,6 +64,7 @@ "@storybook/client-logger": "7.0.0-alpha.47", "@storybook/components": "7.0.0-alpha.47", "@storybook/core-events": "7.0.0-alpha.47", + "@storybook/preview-api": "7.0.0-alpha.47", "@storybook/theming": "7.0.0-alpha.47", "global": "^4.4.0", "memoizerific": "^1.11.3", diff --git a/code/addons/viewport/src/manager.tsx b/code/addons/viewport/src/manager.tsx index 81b1b17e588..e5a4810a073 100644 --- a/code/addons/viewport/src/manager.tsx +++ b/code/addons/viewport/src/manager.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import { addons, types } from '@storybook/addons'; +import { addons, types } from '@storybook/preview-api'; import { ADDON_ID } from './constants'; diff --git a/code/frameworks/angular/package.json b/code/frameworks/angular/package.json index 756aa89192d..36e4f3cba12 100644 --- a/code/frameworks/angular/package.json +++ b/code/frameworks/angular/package.json @@ -45,6 +45,7 @@ "@storybook/core-webpack": "7.0.0-alpha.47", "@storybook/docs-tools": "7.0.0-alpha.47", "@storybook/node-logger": "7.0.0-alpha.47", + "@storybook/preview-api": "7.0.0-alpha.47", "@storybook/store": "7.0.0-alpha.47", "@storybook/types": "7.0.0-alpha.47", "@types/node": "^16.0.0", diff --git a/code/frameworks/angular/src/client/angular-beta/DocsRenderer.ts b/code/frameworks/angular/src/client/angular-beta/DocsRenderer.ts index 3f9d94ac8b3..0e1de248988 100644 --- a/code/frameworks/angular/src/client/angular-beta/DocsRenderer.ts +++ b/code/frameworks/angular/src/client/angular-beta/DocsRenderer.ts @@ -1,4 +1,4 @@ -import { addons } from '@storybook/addons'; +import { addons } from '@storybook/preview-api'; import { DOCS_RENDERED, STORY_CHANGED } from '@storybook/core-events'; import { AbstractRenderer } from './AbstractRenderer'; import { StoryFnAngularReturnType, Parameters } from '../types'; diff --git a/code/frameworks/angular/src/client/docs/sourceDecorator.ts b/code/frameworks/angular/src/client/docs/sourceDecorator.ts index 605112b11b2..112c2e533e8 100644 --- a/code/frameworks/angular/src/client/docs/sourceDecorator.ts +++ b/code/frameworks/angular/src/client/docs/sourceDecorator.ts @@ -1,4 +1,4 @@ -import { addons, useEffect } from '@storybook/addons'; +import { addons, useEffect } from '@storybook/preview-api'; import { PartialStoryFn } from '@storybook/types'; import { SNIPPET_RENDERED, SourceType } from '@storybook/docs-tools'; import { StoryContext, AngularFramework } from '../types'; diff --git a/code/frameworks/angular/src/server/framework-preset-angular-cli.test.ts b/code/frameworks/angular/src/server/framework-preset-angular-cli.test.ts index f61bb6ef600..c7b933627f6 100644 --- a/code/frameworks/angular/src/server/framework-preset-angular-cli.test.ts +++ b/code/frameworks/angular/src/server/framework-preset-angular-cli.test.ts @@ -815,7 +815,7 @@ const newWebpackConfiguration = ( modules: ['node_modules'], mainFields: ['browser', 'main'], alias: { - '@storybook/addons': '/Users/joe/storybook/lib/addons', + '@storybook/preview-api': '/Users/joe/storybook/lib/addons', '@storybook/api': '/Users/joe/storybook/lib/api', '@storybook/channels': '/Users/joe/storybook/lib/channels', '@storybook/channel-postmessage': '/Users/joe/storybook/lib/channel-postmessage', diff --git a/code/frameworks/nextjs/package.json b/code/frameworks/nextjs/package.json index 88b421ada87..5f6304fff97 100644 --- a/code/frameworks/nextjs/package.json +++ b/code/frameworks/nextjs/package.json @@ -65,6 +65,7 @@ "@storybook/core-common": "7.0.0-alpha.47", "@storybook/node-logger": "7.0.0-alpha.47", "@storybook/preset-react-webpack": "7.0.0-alpha.47", + "@storybook/preview-api": "7.0.0-alpha.47", "@storybook/react": "7.0.0-alpha.47", "@types/node": "^14.14.20 || ^16.0.0", "find-up": "^5.0.0", diff --git a/code/frameworks/react-vite/src/index.ts b/code/frameworks/react-vite/src/index.ts index a814c5bd240..14382e06236 100644 --- a/code/frameworks/react-vite/src/index.ts +++ b/code/frameworks/react-vite/src/index.ts @@ -1,7 +1,7 @@ // exports for builder-vite export { createChannel as createPostMessageChannel } from '@storybook/channel-postmessage'; export { createChannel as createWebSocketChannel } from '@storybook/channel-websocket'; -export { addons } from '@storybook/addons'; +export { addons } from '@storybook/preview-api'; export { composeConfigs, PreviewWeb } from '@storybook/preview-web'; export { ClientApi } from '@storybook/preview-api'; diff --git a/code/frameworks/svelte-vite/src/index.ts b/code/frameworks/svelte-vite/src/index.ts index a814c5bd240..14382e06236 100644 --- a/code/frameworks/svelte-vite/src/index.ts +++ b/code/frameworks/svelte-vite/src/index.ts @@ -1,7 +1,7 @@ // exports for builder-vite export { createChannel as createPostMessageChannel } from '@storybook/channel-postmessage'; export { createChannel as createWebSocketChannel } from '@storybook/channel-websocket'; -export { addons } from '@storybook/addons'; +export { addons } from '@storybook/preview-api'; export { composeConfigs, PreviewWeb } from '@storybook/preview-web'; export { ClientApi } from '@storybook/preview-api'; diff --git a/code/frameworks/vue-vite/src/index.ts b/code/frameworks/vue-vite/src/index.ts index a814c5bd240..14382e06236 100644 --- a/code/frameworks/vue-vite/src/index.ts +++ b/code/frameworks/vue-vite/src/index.ts @@ -1,7 +1,7 @@ // exports for builder-vite export { createChannel as createPostMessageChannel } from '@storybook/channel-postmessage'; export { createChannel as createWebSocketChannel } from '@storybook/channel-websocket'; -export { addons } from '@storybook/addons'; +export { addons } from '@storybook/preview-api'; export { composeConfigs, PreviewWeb } from '@storybook/preview-web'; export { ClientApi } from '@storybook/preview-api'; diff --git a/code/frameworks/vue3-vite/src/index.ts b/code/frameworks/vue3-vite/src/index.ts index a814c5bd240..14382e06236 100644 --- a/code/frameworks/vue3-vite/src/index.ts +++ b/code/frameworks/vue3-vite/src/index.ts @@ -1,7 +1,7 @@ // exports for builder-vite export { createChannel as createPostMessageChannel } from '@storybook/channel-postmessage'; export { createChannel as createWebSocketChannel } from '@storybook/channel-websocket'; -export { addons } from '@storybook/addons'; +export { addons } from '@storybook/preview-api'; export { composeConfigs, PreviewWeb } from '@storybook/preview-web'; export { ClientApi } from '@storybook/preview-api'; diff --git a/code/frameworks/web-components-vite/src/index.ts b/code/frameworks/web-components-vite/src/index.ts index a814c5bd240..14382e06236 100644 --- a/code/frameworks/web-components-vite/src/index.ts +++ b/code/frameworks/web-components-vite/src/index.ts @@ -1,7 +1,7 @@ // exports for builder-vite export { createChannel as createPostMessageChannel } from '@storybook/channel-postmessage'; export { createChannel as createWebSocketChannel } from '@storybook/channel-websocket'; -export { addons } from '@storybook/addons'; +export { addons } from '@storybook/preview-api'; export { composeConfigs, PreviewWeb } from '@storybook/preview-web'; export { ClientApi } from '@storybook/preview-api'; diff --git a/code/lib/builder-vite/src/optimizeDeps.ts b/code/lib/builder-vite/src/optimizeDeps.ts index d3c43e40aae..3c193368265 100644 --- a/code/lib/builder-vite/src/optimizeDeps.ts +++ b/code/lib/builder-vite/src/optimizeDeps.ts @@ -13,7 +13,7 @@ const INCLUDE_CANDIDATES = [ '@mdx-js/react', '@storybook/addon-docs > acorn-jsx', '@storybook/addon-docs', - '@storybook/addons', + '@storybook/preview-api', '@storybook/channel-postmessage', '@storybook/channel-websocket', '@storybook/client-api', diff --git a/code/lib/builder-webpack5/templates/virtualModuleModernEntry.js.handlebars b/code/lib/builder-webpack5/templates/virtualModuleModernEntry.js.handlebars index 4917d4c2843..d95a7bf460a 100644 --- a/code/lib/builder-webpack5/templates/virtualModuleModernEntry.js.handlebars +++ b/code/lib/builder-webpack5/templates/virtualModuleModernEntry.js.handlebars @@ -3,7 +3,7 @@ import global from 'global'; import { PreviewWeb } from '@storybook/preview-web'; import { composeConfigs } from '@storybook/store'; import { ClientApi } from '@storybook/preview-api'; -import { addons } from '@storybook/addons'; +import { addons } from '@storybook/preview-api'; import { createChannel as createPostMessageChannel } from '@storybook/channel-postmessage'; import { createChannel as createWebSocketChannel } from '@storybook/channel-websocket'; diff --git a/code/lib/cli/src/js-package-manager/JsPackageManager.ts b/code/lib/cli/src/js-package-manager/JsPackageManager.ts index bb8739fd7cb..cc617b28bb7 100644 --- a/code/lib/cli/src/js-package-manager/JsPackageManager.ts +++ b/code/lib/cli/src/js-package-manager/JsPackageManager.ts @@ -132,7 +132,7 @@ export abstract class JsPackageManager { * `@storybook/react@${storybookVersion}`, * `@storybook/addon-actions@${actionsVersion}`, * `@storybook/addon-links@${linksVersion}`, - * `@storybook/addons@${addonsVersion}`, + * `@storybook/preview-api@${addonsVersion}`, * ]); */ public addDependencies( diff --git a/code/lib/cli/src/js-package-manager/NPMProxy.test.ts b/code/lib/cli/src/js-package-manager/NPMProxy.test.ts index b622e2caaa8..64ccc474802 100644 --- a/code/lib/cli/src/js-package-manager/NPMProxy.test.ts +++ b/code/lib/cli/src/js-package-manager/NPMProxy.test.ts @@ -63,27 +63,27 @@ describe('NPM Proxy', () => { describe('addDependencies', () => { describe('npm6', () => { - it('with devDep it should run `npm install -D @storybook/addons`', () => { + it('with devDep it should run `npm install -D @storybook/preview-api`', () => { const executeCommandSpy = jest.spyOn(npmProxy, 'executeCommand').mockReturnValue('6.0.0'); - npmProxy.addDependencies({ installAsDevDependencies: true }, ['@storybook/addons']); + npmProxy.addDependencies({ installAsDevDependencies: true }, ['@storybook/preview-api']); expect(executeCommandSpy).toHaveBeenLastCalledWith( 'npm', - ['install', '-D', '@storybook/addons'], + ['install', '-D', '@storybook/preview-api'], expect.any(String) ); }); }); describe('npm7', () => { - it('with devDep it should run `npm install -D @storybook/addons`', () => { + it('with devDep it should run `npm install -D @storybook/preview-api`', () => { const executeCommandSpy = jest.spyOn(npmProxy, 'executeCommand').mockReturnValue('7.0.0'); - npmProxy.addDependencies({ installAsDevDependencies: true }, ['@storybook/addons']); + npmProxy.addDependencies({ installAsDevDependencies: true }, ['@storybook/preview-api']); expect(executeCommandSpy).toHaveBeenLastCalledWith( 'npm', - ['install', '--legacy-peer-deps', '-D', '@storybook/addons'], + ['install', '--legacy-peer-deps', '-D', '@storybook/preview-api'], expect.any(String) ); }); @@ -92,27 +92,27 @@ describe('NPM Proxy', () => { describe('removeDependencies', () => { describe('npm6', () => { - it('with devDep it should run `npm uninstall @storybook/addons`', () => { + it('with devDep it should run `npm uninstall @storybook/preview-api`', () => { const executeCommandSpy = jest.spyOn(npmProxy, 'executeCommand').mockReturnValue('6.0.0'); - npmProxy.removeDependencies({}, ['@storybook/addons']); + npmProxy.removeDependencies({}, ['@storybook/preview-api']); expect(executeCommandSpy).toHaveBeenLastCalledWith( 'npm', - ['uninstall', '@storybook/addons'], + ['uninstall', '@storybook/preview-api'], expect.any(String) ); }); }); describe('npm7', () => { - it('with devDep it should run `npm uninstall @storybook/addons`', () => { + it('with devDep it should run `npm uninstall @storybook/preview-api`', () => { const executeCommandSpy = jest.spyOn(npmProxy, 'executeCommand').mockReturnValue('7.0.0'); - npmProxy.removeDependencies({}, ['@storybook/addons']); + npmProxy.removeDependencies({}, ['@storybook/preview-api']); expect(executeCommandSpy).toHaveBeenLastCalledWith( 'npm', - ['uninstall', '--legacy-peer-deps', '@storybook/addons'], + ['uninstall', '--legacy-peer-deps', '@storybook/preview-api'], expect.any(String) ); }); @@ -151,11 +151,11 @@ describe('NPM Proxy', () => { it('without constraint it returns the latest version', async () => { const executeCommandSpy = jest.spyOn(npmProxy, 'executeCommand').mockReturnValue('"5.3.19"'); - const version = await npmProxy.latestVersion('@storybook/addons'); + const version = await npmProxy.latestVersion('@storybook/preview-api'); expect(executeCommandSpy).toHaveBeenCalledWith('npm', [ 'info', - '@storybook/addons', + '@storybook/preview-api', 'version', '--json', ]); @@ -167,11 +167,11 @@ describe('NPM Proxy', () => { .spyOn(npmProxy, 'executeCommand') .mockReturnValue('["4.25.3","5.3.19","6.0.0-beta.23"]'); - const version = await npmProxy.latestVersion('@storybook/addons', '5.X'); + const version = await npmProxy.latestVersion('@storybook/preview-api', '5.X'); expect(executeCommandSpy).toHaveBeenCalledWith('npm', [ 'info', - '@storybook/addons', + '@storybook/preview-api', 'versions', '--json', ]); @@ -181,7 +181,7 @@ describe('NPM Proxy', () => { it('throws an error if command output is not a valid JSON', async () => { jest.spyOn(npmProxy, 'executeCommand').mockReturnValue('NOT A JSON'); - await expect(npmProxy.latestVersion('@storybook/addons')).rejects.toThrow(); + await expect(npmProxy.latestVersion('@storybook/preview-api')).rejects.toThrow(); }); }); diff --git a/code/lib/cli/src/js-package-manager/PNPMProxy.test.ts b/code/lib/cli/src/js-package-manager/PNPMProxy.test.ts index 17ebaffad8b..d501e5aa307 100644 --- a/code/lib/cli/src/js-package-manager/PNPMProxy.test.ts +++ b/code/lib/cli/src/js-package-manager/PNPMProxy.test.ts @@ -47,28 +47,28 @@ describe('NPM Proxy', () => { }); describe('addDependencies', () => { - it('with devDep it should run `pnpm add -D @storybook/addons`', () => { + it('with devDep it should run `pnpm add -D @storybook/preview-api`', () => { const executeCommandSpy = jest.spyOn(pnpmProxy, 'executeCommand').mockReturnValue('6.0.0'); - pnpmProxy.addDependencies({ installAsDevDependencies: true }, ['@storybook/addons']); + pnpmProxy.addDependencies({ installAsDevDependencies: true }, ['@storybook/preview-api']); expect(executeCommandSpy).toHaveBeenLastCalledWith( 'pnpm', - ['add', '-D', '@storybook/addons'], + ['add', '-D', '@storybook/preview-api'], expect.any(String) ); }); }); describe('removeDependencies', () => { - it('with devDep it should run `npm uninstall @storybook/addons`', () => { + it('with devDep it should run `npm uninstall @storybook/preview-api`', () => { const executeCommandSpy = jest.spyOn(pnpmProxy, 'executeCommand').mockReturnValue('6.0.0'); - pnpmProxy.removeDependencies({}, ['@storybook/addons']); + pnpmProxy.removeDependencies({}, ['@storybook/preview-api']); expect(executeCommandSpy).toHaveBeenLastCalledWith( 'pnpm', - ['remove', '@storybook/addons'], + ['remove', '@storybook/preview-api'], expect.any(String) ); }); @@ -107,11 +107,11 @@ describe('NPM Proxy', () => { it('without constraint it returns the latest version', async () => { const executeCommandSpy = jest.spyOn(pnpmProxy, 'executeCommand').mockReturnValue('"5.3.19"'); - const version = await pnpmProxy.latestVersion('@storybook/addons'); + const version = await pnpmProxy.latestVersion('@storybook/preview-api'); expect(executeCommandSpy).toHaveBeenCalledWith('pnpm', [ 'info', - '@storybook/addons', + '@storybook/preview-api', 'version', '--json', ]); @@ -123,11 +123,11 @@ describe('NPM Proxy', () => { .spyOn(pnpmProxy, 'executeCommand') .mockReturnValue('["4.25.3","5.3.19","6.0.0-beta.23"]'); - const version = await pnpmProxy.latestVersion('@storybook/addons', '5.X'); + const version = await pnpmProxy.latestVersion('@storybook/preview-api', '5.X'); expect(executeCommandSpy).toHaveBeenCalledWith('pnpm', [ 'info', - '@storybook/addons', + '@storybook/preview-api', 'versions', '--json', ]); @@ -137,7 +137,7 @@ describe('NPM Proxy', () => { it('throws an error if command output is not a valid JSON', async () => { jest.spyOn(pnpmProxy, 'executeCommand').mockReturnValue('NOT A JSON'); - await expect(pnpmProxy.latestVersion('@storybook/addons')).rejects.toThrow(); + await expect(pnpmProxy.latestVersion('@storybook/preview-api')).rejects.toThrow(); }); }); diff --git a/code/lib/cli/src/js-package-manager/Yarn1Proxy.test.ts b/code/lib/cli/src/js-package-manager/Yarn1Proxy.test.ts index 9128506f842..7d8fd5ad11e 100644 --- a/code/lib/cli/src/js-package-manager/Yarn1Proxy.test.ts +++ b/code/lib/cli/src/js-package-manager/Yarn1Proxy.test.ts @@ -47,28 +47,28 @@ describe('Yarn 1 Proxy', () => { }); describe('addDependencies', () => { - it('with devDep it should run `yarn install -D --ignore-workspace-root-check @storybook/addons`', () => { + it('with devDep it should run `yarn install -D --ignore-workspace-root-check @storybook/preview-api`', () => { const executeCommandSpy = jest.spyOn(yarn1Proxy, 'executeCommand').mockReturnValue(''); - yarn1Proxy.addDependencies({ installAsDevDependencies: true }, ['@storybook/addons']); + yarn1Proxy.addDependencies({ installAsDevDependencies: true }, ['@storybook/preview-api']); expect(executeCommandSpy).toHaveBeenCalledWith( 'yarn', - ['add', '-D', '--ignore-workspace-root-check', '@storybook/addons'], + ['add', '-D', '--ignore-workspace-root-check', '@storybook/preview-api'], expect.any(String) ); }); }); describe('removeDependencies', () => { - it('should run `yarn remove --ignore-workspace-root-check @storybook/addons`', () => { + it('should run `yarn remove --ignore-workspace-root-check @storybook/preview-api`', () => { const executeCommandSpy = jest.spyOn(yarn1Proxy, 'executeCommand').mockReturnValue(''); - yarn1Proxy.removeDependencies({}, ['@storybook/addons']); + yarn1Proxy.removeDependencies({}, ['@storybook/preview-api']); expect(executeCommandSpy).toHaveBeenCalledWith( 'yarn', - ['remove', '--ignore-workspace-root-check', '@storybook/addons'], + ['remove', '--ignore-workspace-root-check', '@storybook/preview-api'], expect.any(String) ); }); @@ -107,11 +107,11 @@ describe('Yarn 1 Proxy', () => { .spyOn(yarn1Proxy, 'executeCommand') .mockReturnValue('{"type":"inspect","data":"5.3.19"}'); - const version = await yarn1Proxy.latestVersion('@storybook/addons'); + const version = await yarn1Proxy.latestVersion('@storybook/preview-api'); expect(executeCommandSpy).toHaveBeenCalledWith('yarn', [ 'info', - '@storybook/addons', + '@storybook/preview-api', 'version', '--json', ]); @@ -123,11 +123,11 @@ describe('Yarn 1 Proxy', () => { .spyOn(yarn1Proxy, 'executeCommand') .mockReturnValue('{"type":"inspect","data":["4.25.3","5.3.19","6.0.0-beta.23"]}'); - const version = await yarn1Proxy.latestVersion('@storybook/addons', '5.X'); + const version = await yarn1Proxy.latestVersion('@storybook/preview-api', '5.X'); expect(executeCommandSpy).toHaveBeenCalledWith('yarn', [ 'info', - '@storybook/addons', + '@storybook/preview-api', 'versions', '--json', ]); @@ -137,7 +137,7 @@ describe('Yarn 1 Proxy', () => { it('throws an error if command output is not a valid JSON', async () => { jest.spyOn(yarn1Proxy, 'executeCommand').mockReturnValue('NOT A JSON'); - await expect(yarn1Proxy.latestVersion('@storybook/addons')).rejects.toThrow(); + await expect(yarn1Proxy.latestVersion('@storybook/preview-api')).rejects.toThrow(); }); }); diff --git a/code/lib/cli/src/js-package-manager/Yarn2Proxy.test.ts b/code/lib/cli/src/js-package-manager/Yarn2Proxy.test.ts index 581c48d9d52..8c7cb184f43 100644 --- a/code/lib/cli/src/js-package-manager/Yarn2Proxy.test.ts +++ b/code/lib/cli/src/js-package-manager/Yarn2Proxy.test.ts @@ -47,28 +47,28 @@ describe('Yarn 2 Proxy', () => { }); describe('addDependencies', () => { - it('with devDep it should run `yarn install -D @storybook/addons`', () => { + it('with devDep it should run `yarn install -D @storybook/preview-api`', () => { const executeCommandSpy = jest.spyOn(yarn2Proxy, 'executeCommand').mockReturnValue(''); - yarn2Proxy.addDependencies({ installAsDevDependencies: true }, ['@storybook/addons']); + yarn2Proxy.addDependencies({ installAsDevDependencies: true }, ['@storybook/preview-api']); expect(executeCommandSpy).toHaveBeenCalledWith( 'yarn', - ['add', '-D', '@storybook/addons'], + ['add', '-D', '@storybook/preview-api'], expect.any(String) ); }); }); describe('removeDependencies', () => { - it('should run `yarn remove @storybook/addons`', () => { + it('should run `yarn remove @storybook/preview-api`', () => { const executeCommandSpy = jest.spyOn(yarn2Proxy, 'executeCommand').mockReturnValue(''); - yarn2Proxy.removeDependencies({}, ['@storybook/addons']); + yarn2Proxy.removeDependencies({}, ['@storybook/preview-api']); expect(executeCommandSpy).toHaveBeenCalledWith( 'yarn', - ['remove', '@storybook/addons'], + ['remove', '@storybook/preview-api'], expect.any(String) ); }); @@ -105,14 +105,14 @@ describe('Yarn 2 Proxy', () => { it('without constraint it returns the latest version', async () => { const executeCommandSpy = jest .spyOn(yarn2Proxy, 'executeCommand') - .mockReturnValue('{"name":"@storybook/addons","version":"5.3.19"}'); + .mockReturnValue('{"name":"@storybook/preview-api","version":"5.3.19"}'); - const version = await yarn2Proxy.latestVersion('@storybook/addons'); + const version = await yarn2Proxy.latestVersion('@storybook/preview-api'); expect(executeCommandSpy).toHaveBeenCalledWith('yarn', [ 'npm', 'info', - '@storybook/addons', + '@storybook/preview-api', '--fields', 'version', '--json', @@ -124,15 +124,15 @@ describe('Yarn 2 Proxy', () => { const executeCommandSpy = jest .spyOn(yarn2Proxy, 'executeCommand') .mockReturnValue( - '{"name":"@storybook/addons","versions":["4.25.3","5.3.19","6.0.0-beta.23"]}' + '{"name":"@storybook/preview-api","versions":["4.25.3","5.3.19","6.0.0-beta.23"]}' ); - const version = await yarn2Proxy.latestVersion('@storybook/addons', '5.X'); + const version = await yarn2Proxy.latestVersion('@storybook/preview-api', '5.X'); expect(executeCommandSpy).toHaveBeenCalledWith('yarn', [ 'npm', 'info', - '@storybook/addons', + '@storybook/preview-api', '--fields', 'versions', '--json', @@ -143,7 +143,7 @@ describe('Yarn 2 Proxy', () => { it('throws an error if command output is not a valid JSON', async () => { jest.spyOn(yarn2Proxy, 'executeCommand').mockReturnValue('NOT A JSON'); - await expect(yarn2Proxy.latestVersion('@storybook/addons')).rejects.toThrow(); + await expect(yarn2Proxy.latestVersion('@storybook/preview-api')).rejects.toThrow(); }); }); diff --git a/code/lib/cli/src/versions.ts b/code/lib/cli/src/versions.ts index 94364df670b..80ee1493729 100644 --- a/code/lib/cli/src/versions.ts +++ b/code/lib/cli/src/versions.ts @@ -17,7 +17,7 @@ export default { '@storybook/addon-storysource': '7.0.0-alpha.47', '@storybook/addon-toolbars': '7.0.0-alpha.47', '@storybook/addon-viewport': '7.0.0-alpha.47', - '@storybook/addons': '7.0.0-alpha.47', + '@storybook/preview-api': '7.0.0-alpha.47', '@storybook/angular': '7.0.0-alpha.47', '@storybook/api': '7.0.0-alpha.47', '@storybook/blocks': '7.0.0-alpha.47', diff --git a/code/lib/codemod/src/transforms/update-organisation-name.js b/code/lib/codemod/src/transforms/update-organisation-name.js index 6e4ca34a523..4774df6538f 100644 --- a/code/lib/codemod/src/transforms/update-organisation-name.js +++ b/code/lib/codemod/src/transforms/update-organisation-name.js @@ -1,6 +1,6 @@ export const packageNames = { '@kadira/react-storybook-decorator-centered': '@storybook/addon-centered', - '@kadira/storybook-addons': '@storybook/addons', + '@kadira/storybook-addons': '@storybook/preview-api', '@kadira/storybook-addon-actions': '@storybook/addon-actions', '@kadira/storybook-addon-comments': '@storybook/addon-comments', '@kadira/storybook-addon-graphql': '@storybook/addon-graphql', diff --git a/code/lib/instrumenter/package.json b/code/lib/instrumenter/package.json index 52201a05a34..b71f450df9a 100644 --- a/code/lib/instrumenter/package.json +++ b/code/lib/instrumenter/package.json @@ -46,6 +46,7 @@ "@storybook/channels": "7.0.0-alpha.47", "@storybook/client-logger": "7.0.0-alpha.47", "@storybook/core-events": "7.0.0-alpha.47", + "@storybook/preview-api": "7.0.0-alpha.47", "core-js": "^3.8.2", "global": "^4.4.0" }, diff --git a/code/lib/instrumenter/src/instrumenter.test.ts b/code/lib/instrumenter/src/instrumenter.test.ts index 647dbedb148..6ac0827c851 100644 --- a/code/lib/instrumenter/src/instrumenter.test.ts +++ b/code/lib/instrumenter/src/instrumenter.test.ts @@ -1,7 +1,7 @@ /// ; /* eslint-disable no-underscore-dangle */ -import { addons, mockChannel } from '@storybook/addons'; +import { addons, mockChannel } from '@storybook/preview-api'; import { logger } from '@storybook/client-logger'; import { FORCE_REMOUNT, diff --git a/code/lib/instrumenter/src/instrumenter.ts b/code/lib/instrumenter/src/instrumenter.ts index 05aed24fb5e..8085f16b1f2 100644 --- a/code/lib/instrumenter/src/instrumenter.ts +++ b/code/lib/instrumenter/src/instrumenter.ts @@ -1,6 +1,6 @@ /* eslint-disable no-underscore-dangle */ import type { Channel } from '@storybook/channels'; -import { addons } from '@storybook/addons'; +import { addons } from '@storybook/preview-api'; import type { StoryId } from '@storybook/types'; import { once, logger } from '@storybook/client-logger'; import { diff --git a/code/lib/postinstall/src/frameworks.test.ts b/code/lib/postinstall/src/frameworks.test.ts index 32192dacfca..6b498477e19 100644 --- a/code/lib/postinstall/src/frameworks.test.ts +++ b/code/lib/postinstall/src/frameworks.test.ts @@ -9,7 +9,7 @@ const VUE = { }; const NONE = { - '@storybook/addons': '5.2.5', + '@storybook/preview-api': '5.2.5', lodash: '^4.17.15', }; diff --git a/code/lib/preview-api/package.json b/code/lib/preview-api/package.json index 5e7698b1be7..b09bd46cc70 100644 --- a/code/lib/preview-api/package.json +++ b/code/lib/preview-api/package.json @@ -45,6 +45,7 @@ "@storybook/addons": "7.0.0-alpha.47", "@storybook/client-api": "7.0.0-alpha.47", "@storybook/core-client": "7.0.0-alpha.47", + "@storybook/preview-api": "7.0.0-alpha.47", "@storybook/preview-web": "7.0.0-alpha.47", "@storybook/store": "7.0.0-alpha.47" }, diff --git a/code/lib/preview-api/src/index.ts b/code/lib/preview-api/src/index.ts index 50a38f1a20d..b7c88bef35e 100644 --- a/code/lib/preview-api/src/index.ts +++ b/code/lib/preview-api/src/index.ts @@ -19,6 +19,7 @@ export const { useRef, useState, useStoryContext, + applyHooks, HooksContext, } = ADDONS; @@ -27,6 +28,12 @@ export const { */ export const { makeDecorator } = ADDONS; +/** + * ADDON API + * @deprecated + */ +export const { addons } = ADDONS; + /** * STORIES API */ diff --git a/code/package.json b/code/package.json index 041f52e6755..51ba3cb1e67 100644 --- a/code/package.json +++ b/code/package.json @@ -209,6 +209,7 @@ "@storybook/preset-vue-webpack": "workspace:*", "@storybook/preset-vue3-webpack": "workspace:*", "@storybook/preset-web-components-webpack": "workspace:*", + "@storybook/preview-api": "workspace:*", "@storybook/preview-web": "workspace:*", "@storybook/react": "workspace:*", "@storybook/react-vite": "workspace:*", diff --git a/code/renderers/html/package.json b/code/renderers/html/package.json index 5fa591cd8b8..be12c642534 100644 --- a/code/renderers/html/package.json +++ b/code/renderers/html/package.json @@ -54,6 +54,7 @@ "@storybook/addons": "7.0.0-alpha.47", "@storybook/core-client": "7.0.0-alpha.47", "@storybook/docs-tools": "7.0.0-alpha.47", + "@storybook/preview-api": "7.0.0-alpha.47", "@storybook/preview-web": "7.0.0-alpha.47", "@storybook/store": "7.0.0-alpha.47", "@storybook/types": "7.0.0-alpha.47", diff --git a/code/renderers/html/src/docs/sourceDecorator.test.ts b/code/renderers/html/src/docs/sourceDecorator.test.ts index b5e85126e72..06534288bf7 100644 --- a/code/renderers/html/src/docs/sourceDecorator.test.ts +++ b/code/renderers/html/src/docs/sourceDecorator.test.ts @@ -1,9 +1,9 @@ import { SNIPPET_RENDERED } from '@storybook/docs-tools'; -import { addons, useEffect } from '@storybook/addons'; +import { addons, useEffect } from '@storybook/preview-api'; import { sourceDecorator } from './sourceDecorator'; import type { StoryContext } from '../types'; -jest.mock('@storybook/addons'); +jest.mock('@storybook/preview-api'); const mockedAddons = addons as jest.Mocked; const mockedUseEffect = useEffect as jest.Mocked; diff --git a/code/renderers/html/src/docs/sourceDecorator.ts b/code/renderers/html/src/docs/sourceDecorator.ts index 419013e7372..711c0a83a5c 100644 --- a/code/renderers/html/src/docs/sourceDecorator.ts +++ b/code/renderers/html/src/docs/sourceDecorator.ts @@ -1,7 +1,7 @@ /* eslint-disable no-underscore-dangle */ /* global window */ import { SNIPPET_RENDERED, SourceType } from '@storybook/docs-tools'; -import { addons, useEffect } from '@storybook/addons'; +import { addons, useEffect } from '@storybook/preview-api'; import type { PartialStoryFn } from '@storybook/types'; import { dedent } from 'ts-dedent'; diff --git a/code/renderers/preact/package.json b/code/renderers/preact/package.json index 690ec7da696..f3f3961367c 100644 --- a/code/renderers/preact/package.json +++ b/code/renderers/preact/package.json @@ -53,6 +53,7 @@ "dependencies": { "@storybook/addons": "7.0.0-alpha.47", "@storybook/core-client": "7.0.0-alpha.47", + "@storybook/preview-api": "7.0.0-alpha.47", "@storybook/store": "7.0.0-alpha.47", "@storybook/types": "7.0.0-alpha.47", "global": "^4.4.0", diff --git a/code/renderers/react/package.json b/code/renderers/react/package.json index 6abb292ed5c..df7bfc6d211 100644 --- a/code/renderers/react/package.json +++ b/code/renderers/react/package.json @@ -56,6 +56,7 @@ "@storybook/client-logger": "7.0.0-alpha.47", "@storybook/core-client": "7.0.0-alpha.47", "@storybook/docs-tools": "7.0.0-alpha.47", + "@storybook/preview-api": "7.0.0-alpha.47", "@storybook/store": "7.0.0-alpha.47", "@storybook/types": "7.0.0-alpha.47", "@types/estree": "^0.0.51", diff --git a/code/renderers/react/src/__test__/internals.test.tsx b/code/renderers/react/src/__test__/internals.test.tsx index dd4eb1b86ed..40cdb069f49 100644 --- a/code/renderers/react/src/__test__/internals.test.tsx +++ b/code/renderers/react/src/__test__/internals.test.tsx @@ -1,7 +1,7 @@ /// ; /* eslint-disable @typescript-eslint/no-non-null-assertion */ import React from 'react'; -import { addons } from '@storybook/addons'; +import { addons } from '@storybook/preview-api'; import { render, screen } from '@testing-library/react'; import { composeStories, composeStory } from '..'; diff --git a/code/renderers/react/src/docs/jsxDecorator.test.tsx b/code/renderers/react/src/docs/jsxDecorator.test.tsx index cbc163f1384..9adeea67d5e 100644 --- a/code/renderers/react/src/docs/jsxDecorator.test.tsx +++ b/code/renderers/react/src/docs/jsxDecorator.test.tsx @@ -2,11 +2,11 @@ import type { FC, PropsWithChildren } from 'react'; import React, { createElement, Profiler } from 'react'; import PropTypes from 'prop-types'; -import { addons, useEffect } from '@storybook/addons'; +import { addons, useEffect } from '@storybook/preview-api'; import { SNIPPET_RENDERED } from '@storybook/docs-tools'; import { renderJsx, jsxDecorator } from './jsxDecorator'; -jest.mock('@storybook/addons'); +jest.mock('@storybook/preview-api'); const mockedAddons = addons as jest.Mocked; const mockedUseEffect = useEffect as jest.Mocked; diff --git a/code/renderers/react/src/docs/jsxDecorator.tsx b/code/renderers/react/src/docs/jsxDecorator.tsx index 75e9d461697..a1cfadd69be 100644 --- a/code/renderers/react/src/docs/jsxDecorator.tsx +++ b/code/renderers/react/src/docs/jsxDecorator.tsx @@ -4,7 +4,7 @@ import React, { createElement } from 'react'; import type { Options } from 'react-element-to-jsx-string'; import reactElementToJSXString from 'react-element-to-jsx-string'; -import { addons, useEffect } from '@storybook/addons'; +import { addons, useEffect } from '@storybook/preview-api'; import type { StoryContext, ArgsStoryFn, PartialStoryFn } from '@storybook/types'; import { SourceType, SNIPPET_RENDERED, getDocgenSection } from '@storybook/docs-tools'; import { logger } from '@storybook/client-logger'; diff --git a/code/renderers/server/package.json b/code/renderers/server/package.json index fe56f38fd9c..538f2a58fcd 100644 --- a/code/renderers/server/package.json +++ b/code/renderers/server/package.json @@ -53,6 +53,7 @@ "dependencies": { "@storybook/addons": "7.0.0-alpha.47", "@storybook/core-client": "7.0.0-alpha.47", + "@storybook/preview-api": "7.0.0-alpha.47", "@storybook/preview-web": "7.0.0-alpha.47", "@storybook/store": "7.0.0-alpha.47", "@storybook/types": "7.0.0-alpha.47", diff --git a/code/renderers/svelte/package.json b/code/renderers/svelte/package.json index 6c4187f5a24..64f734e99df 100644 --- a/code/renderers/svelte/package.json +++ b/code/renderers/svelte/package.json @@ -59,6 +59,7 @@ "@storybook/client-logger": "7.0.0-alpha.47", "@storybook/core-client": "7.0.0-alpha.47", "@storybook/docs-tools": "7.0.0-alpha.47", + "@storybook/preview-api": "7.0.0-alpha.47", "@storybook/store": "7.0.0-alpha.47", "@storybook/types": "7.0.0-alpha.47", "global": "^4.4.0", diff --git a/code/renderers/svelte/src/docs/sourceDecorator.ts b/code/renderers/svelte/src/docs/sourceDecorator.ts index 229ceb87662..1ed7909d194 100644 --- a/code/renderers/svelte/src/docs/sourceDecorator.ts +++ b/code/renderers/svelte/src/docs/sourceDecorator.ts @@ -1,5 +1,5 @@ /* eslint-disable no-underscore-dangle */ -import { addons, useEffect } from '@storybook/addons'; +import { addons, useEffect } from '@storybook/preview-api'; import { deprecate } from '@storybook/client-logger'; import type { ArgTypes, Args, StoryContext, AnyFramework } from '@storybook/types'; diff --git a/code/renderers/vue/package.json b/code/renderers/vue/package.json index 8a3043975ac..a9b4566ffbe 100644 --- a/code/renderers/vue/package.json +++ b/code/renderers/vue/package.json @@ -55,6 +55,7 @@ "@storybook/client-logger": "7.0.0-alpha.47", "@storybook/core-client": "7.0.0-alpha.47", "@storybook/docs-tools": "7.0.0-alpha.47", + "@storybook/preview-api": "7.0.0-alpha.47", "@storybook/store": "7.0.0-alpha.47", "@storybook/types": "7.0.0-alpha.47", "global": "^4.4.0", diff --git a/code/renderers/vue/src/docs/sourceDecorator.ts b/code/renderers/vue/src/docs/sourceDecorator.ts index 3e3b79cda26..8c9839acb13 100644 --- a/code/renderers/vue/src/docs/sourceDecorator.ts +++ b/code/renderers/vue/src/docs/sourceDecorator.ts @@ -1,7 +1,7 @@ /* eslint-disable no-underscore-dangle */ /* eslint no-underscore-dangle: ["error", { "allow": ["_vnode"] }] */ -import { addons } from '@storybook/addons'; +import { addons } from '@storybook/preview-api'; import { logger } from '@storybook/client-logger'; import { SourceType, SNIPPET_RENDERED } from '@storybook/docs-tools'; import type { ComponentOptions } from 'vue'; diff --git a/code/renderers/vue3/package.json b/code/renderers/vue3/package.json index c2bba2f61ab..10be0b9ef75 100644 --- a/code/renderers/vue3/package.json +++ b/code/renderers/vue3/package.json @@ -54,6 +54,7 @@ "@storybook/addons": "7.0.0-alpha.47", "@storybook/core-client": "7.0.0-alpha.47", "@storybook/docs-tools": "7.0.0-alpha.47", + "@storybook/preview-api": "7.0.0-alpha.47", "@storybook/store": "7.0.0-alpha.47", "@storybook/types": "7.0.0-alpha.47", "global": "^4.4.0", diff --git a/code/renderers/web-components/package.json b/code/renderers/web-components/package.json index e14b64898c3..f124202f5ae 100644 --- a/code/renderers/web-components/package.json +++ b/code/renderers/web-components/package.json @@ -58,6 +58,7 @@ "@storybook/client-logger": "7.0.0-alpha.47", "@storybook/core-client": "7.0.0-alpha.47", "@storybook/docs-tools": "7.0.0-alpha.47", + "@storybook/preview-api": "7.0.0-alpha.47", "@storybook/preview-web": "7.0.0-alpha.47", "@storybook/store": "7.0.0-alpha.47", "@storybook/types": "7.0.0-alpha.47", diff --git a/code/renderers/web-components/src/docs/sourceDecorator.test.ts b/code/renderers/web-components/src/docs/sourceDecorator.test.ts index bbf7975ef5d..e659f4f5e22 100644 --- a/code/renderers/web-components/src/docs/sourceDecorator.test.ts +++ b/code/renderers/web-components/src/docs/sourceDecorator.test.ts @@ -1,12 +1,12 @@ /* eslint-disable import/extensions */ import { html } from 'lit-html'; import { styleMap } from 'lit-html/directives/style-map.js'; -import { addons, useEffect } from '@storybook/addons'; +import { addons, useEffect } from '@storybook/preview-api'; import { SNIPPET_RENDERED } from '@storybook/docs-tools'; import type { StoryContext } from '../types'; import { sourceDecorator } from './sourceDecorator'; -jest.mock('@storybook/addons'); +jest.mock('@storybook/preview-api'); const mockedAddons = addons as jest.Mocked; const mockedUseEffect = useEffect as jest.Mock; diff --git a/code/renderers/web-components/src/docs/sourceDecorator.ts b/code/renderers/web-components/src/docs/sourceDecorator.ts index 8436dab16fc..aef73e12ee6 100644 --- a/code/renderers/web-components/src/docs/sourceDecorator.ts +++ b/code/renderers/web-components/src/docs/sourceDecorator.ts @@ -2,7 +2,7 @@ /* global window */ import { render } from 'lit-html'; import type { ArgsStoryFn, PartialStoryFn, StoryContext } from '@storybook/types'; -import { addons, useEffect } from '@storybook/addons'; +import { addons, useEffect } from '@storybook/preview-api'; import { SNIPPET_RENDERED, SourceType } from '@storybook/docs-tools'; import type { WebComponentsFramework } from '../types'; diff --git a/code/ui/.storybook/manager.ts b/code/ui/.storybook/manager.ts index ece01ccdfae..76b9e19f9d7 100644 --- a/code/ui/.storybook/manager.ts +++ b/code/ui/.storybook/manager.ts @@ -1,4 +1,4 @@ -import { addons } from '@storybook/addons'; +import { addons } from '@storybook/preview-api'; import startCase from 'lodash/startCase'; addons.setConfig({ diff --git a/code/ui/blocks/package.json b/code/ui/blocks/package.json index 0251187b4c6..ad08e009516 100644 --- a/code/ui/blocks/package.json +++ b/code/ui/blocks/package.json @@ -67,6 +67,7 @@ "devDependencies": { "@storybook/addon-actions": "7.0.0-alpha.47", "@storybook/addons": "7.0.0-alpha.47", + "@storybook/preview-api": "7.0.0-alpha.47", "@types/color-convert": "^2.0.0" }, "peerDependencies": { diff --git a/code/ui/manager/package.json b/code/ui/manager/package.json index e0293adbcaf..ed900398e98 100644 --- a/code/ui/manager/package.json +++ b/code/ui/manager/package.json @@ -61,6 +61,7 @@ "@storybook/client-logger": "7.0.0-alpha.47", "@storybook/components": "7.0.0-alpha.47", "@storybook/core-events": "7.0.0-alpha.47", + "@storybook/preview-api": "7.0.0-alpha.47", "@storybook/router": "7.0.0-alpha.47", "@storybook/theming": "7.0.0-alpha.47", "@storybook/types": "7.0.0-alpha.47", diff --git a/code/ui/manager/paths.js b/code/ui/manager/paths.js index 47098e2f940..2e5037b0301 100644 --- a/code/ui/manager/paths.js +++ b/code/ui/manager/paths.js @@ -6,7 +6,7 @@ const resolve = resolveFrom.bind(null, __dirname); // These paths need to be aliased in the manager webpack config to ensure that all // code running inside the manager uses the *same* version of react[-dom] that we use. module.exports = { - '@storybook/addons': dirname(resolve('@storybook/addons/package.json')), + '@storybook/preview-api': dirname(resolve('@storybook/preview-api/package.json')), '@storybook/api': dirname(resolve('@storybook/api/package.json')), '@storybook/channels': dirname(resolve('@storybook/channels/package.json')), '@storybook/components': dirname(resolve('@storybook/components/package.json')), diff --git a/code/ui/manager/src/FakeProvider.tsx b/code/ui/manager/src/FakeProvider.tsx index a1abbbaca0d..5f009340e96 100644 --- a/code/ui/manager/src/FakeProvider.tsx +++ b/code/ui/manager/src/FakeProvider.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { styled } from '@storybook/theming'; -import { addons } from '@storybook/addons'; +import { addons } from '@storybook/preview-api'; import Provider from './provider'; export class FakeProvider extends Provider { diff --git a/code/ui/manager/src/components/preview/preview.mockdata.tsx b/code/ui/manager/src/components/preview/preview.mockdata.tsx index f4f172766c6..639a6026ce6 100644 --- a/code/ui/manager/src/components/preview/preview.mockdata.tsx +++ b/code/ui/manager/src/components/preview/preview.mockdata.tsx @@ -1,4 +1,4 @@ -import { types, type Addon } from '@storybook/addons'; +import { types, type Addon } from '@storybook/preview-api'; import type { API, State } from '@storybook/api'; import type { PreviewProps } from './utils/types'; diff --git a/code/ui/manager/src/components/preview/tools/addons.tsx b/code/ui/manager/src/components/preview/tools/addons.tsx index 1bd66a22ac8..88f61fec22d 100644 --- a/code/ui/manager/src/components/preview/tools/addons.tsx +++ b/code/ui/manager/src/components/preview/tools/addons.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { IconButton, Icons } from '@storybook/components'; import { Consumer, type Combo } from '@storybook/api'; -import type { Addon } from '@storybook/addons'; +import type { Addon } from '@storybook/preview-api'; const menuMapper = ({ api, state }: Combo) => ({ isVisible: state.layout.showPanel, diff --git a/code/ui/manager/src/components/preview/tools/copy.tsx b/code/ui/manager/src/components/preview/tools/copy.tsx index aa8c48f8d33..306ec458f6c 100644 --- a/code/ui/manager/src/components/preview/tools/copy.tsx +++ b/code/ui/manager/src/components/preview/tools/copy.tsx @@ -3,7 +3,7 @@ import React from 'react'; import copy from 'copy-to-clipboard'; import { getStoryHref, IconButton, Icons } from '@storybook/components'; import { Consumer, type Combo } from '@storybook/api'; -import type { Addon } from '@storybook/addons'; +import type { Addon } from '@storybook/preview-api'; const { PREVIEW_URL, document } = global; diff --git a/code/ui/manager/src/components/preview/tools/eject.tsx b/code/ui/manager/src/components/preview/tools/eject.tsx index 1a28a84c16b..33629f1006e 100644 --- a/code/ui/manager/src/components/preview/tools/eject.tsx +++ b/code/ui/manager/src/components/preview/tools/eject.tsx @@ -2,7 +2,7 @@ import global from 'global'; import React from 'react'; import { getStoryHref, IconButton, Icons } from '@storybook/components'; import { Consumer, type Combo } from '@storybook/api'; -import type { Addon } from '@storybook/addons'; +import type { Addon } from '@storybook/preview-api'; const { PREVIEW_URL } = global; diff --git a/code/ui/manager/src/components/preview/tools/menu.tsx b/code/ui/manager/src/components/preview/tools/menu.tsx index d5f4daea381..4156a3e7096 100644 --- a/code/ui/manager/src/components/preview/tools/menu.tsx +++ b/code/ui/manager/src/components/preview/tools/menu.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { IconButton, Icons, Separator } from '@storybook/components'; import { Consumer, type Combo } from '@storybook/api'; -import type { Addon } from '@storybook/addons'; +import type { Addon } from '@storybook/preview-api'; const menuMapper = ({ api, state }: Combo) => ({ isVisible: state.layout.showNav, diff --git a/code/ui/manager/src/components/preview/tools/remount.tsx b/code/ui/manager/src/components/preview/tools/remount.tsx index d56616bcdd5..f8b0e1b6730 100644 --- a/code/ui/manager/src/components/preview/tools/remount.tsx +++ b/code/ui/manager/src/components/preview/tools/remount.tsx @@ -2,7 +2,7 @@ import type { ComponentProps } from 'react'; import React, { useState } from 'react'; import { IconButton, Icons } from '@storybook/components'; import { Consumer, type Combo } from '@storybook/api'; -import type { Addon } from '@storybook/addons'; +import type { Addon } from '@storybook/preview-api'; import { styled } from '@storybook/theming'; import { FORCE_REMOUNT } from '@storybook/core-events'; diff --git a/code/ui/manager/src/components/preview/tools/zoom.tsx b/code/ui/manager/src/components/preview/tools/zoom.tsx index 1ab5cc879e9..dc9196bbc8e 100644 --- a/code/ui/manager/src/components/preview/tools/zoom.tsx +++ b/code/ui/manager/src/components/preview/tools/zoom.tsx @@ -2,7 +2,7 @@ import type { SyntheticEvent, MouseEventHandler } from 'react'; import React, { Component, useCallback } from 'react'; import { Icons, IconButton, Separator } from '@storybook/components'; -import type { Addon } from '@storybook/addons'; +import type { Addon } from '@storybook/preview-api'; const initialZoom = 1 as const; diff --git a/code/ui/manager/src/globals/exports.ts b/code/ui/manager/src/globals/exports.ts index 5ebf5209712..ee5851f1031 100644 --- a/code/ui/manager/src/globals/exports.ts +++ b/code/ui/manager/src/globals/exports.ts @@ -216,15 +216,37 @@ export default { 'useStorybookApi', 'useStorybookState', ], - '@storybook/addons': [ - 'AddonStore', + '@storybook/preview-api': [ + 'ClientApi', 'HooksContext', + 'Preview', + 'PreviewWeb', + 'StoryStore', + 'addArgTypes', + 'addArgTypesEnhancer', + 'addArgs', + 'addArgsEnhancer', + 'addDecorator', + 'addLoader', + 'addParameters', + 'addStepRunner', 'addons', 'applyHooks', - 'isSupportedType', + 'combineArgs', + 'combineParameters', + 'composeConfigs', + 'composeStepRunners', + 'composeStories', + 'composeStory', + 'decorateStory', + 'defaultDecorateStory', + 'getQueryParam', + 'getQueryParams', 'makeDecorator', - 'mockChannel', - 'types', + 'normalizeStory', + 'prepareStory', + 'setGlobalRender', + 'start', 'useArgs', 'useCallback', 'useChannel', diff --git a/code/ui/manager/src/globals/runtime.ts b/code/ui/manager/src/globals/runtime.ts index e8890929e0a..e41240a3ce8 100644 --- a/code/ui/manager/src/globals/runtime.ts +++ b/code/ui/manager/src/globals/runtime.ts @@ -7,7 +7,7 @@ import * as STORYBOOKEVENTS from '@storybook/core-events'; import * as STORYBOOKROUTER from '@storybook/router'; import * as STORYBOOKTHEMING from '@storybook/theming'; import * as STORYBOOKAPI from '@storybook/api'; -import * as STORYBOOKADDONS from '@storybook/addons'; +import * as STORYBOOKADDONS from '@storybook/preview-api'; import * as STORYBOOKCLIENTLOGGER from '@storybook/client-logger'; import type { Keys } from './types'; @@ -22,6 +22,6 @@ export const values: Required> = { '@storybook/router': STORYBOOKROUTER, '@storybook/theming': STORYBOOKTHEMING, '@storybook/api': STORYBOOKAPI, - '@storybook/addons': STORYBOOKADDONS, + '@storybook/preview-api': STORYBOOKADDONS, '@storybook/client-logger': STORYBOOKCLIENTLOGGER, }; diff --git a/code/ui/manager/src/globals/types.ts b/code/ui/manager/src/globals/types.ts index cee0c83b1af..0c3a8bb56a7 100644 --- a/code/ui/manager/src/globals/types.ts +++ b/code/ui/manager/src/globals/types.ts @@ -10,7 +10,7 @@ export enum Keys { '@storybook/router' = '__STORYBOOKROUTER__', '@storybook/theming' = '__STORYBOOKTHEMING__', '@storybook/api' = '__STORYBOOKAPI__', - '@storybook/addons' = '__STORYBOOKADDONS__', + '@storybook/preview-api' = '__STORYBOOKADDONS__', '@storybook/client-logger' = '__STORYBOOKCLIENTLOGGER__', } diff --git a/code/ui/manager/src/runtime.ts b/code/ui/manager/src/runtime.ts index 81754fd9967..2fd9d4a72c2 100644 --- a/code/ui/manager/src/runtime.ts +++ b/code/ui/manager/src/runtime.ts @@ -1,8 +1,8 @@ import global from 'global'; import type { Channel } from '@storybook/channels'; -import type { AddonStore } from '@storybook/addons'; -import { addons } from '@storybook/addons'; +import type { AddonStore } from '@storybook/preview-api'; +import { addons } from '@storybook/preview-api'; import type { Addon_Types, Addon_Config } from '@storybook/types'; import * as postMessage from '@storybook/channel-postmessage'; import * as webSocket from '@storybook/channel-websocket'; diff --git a/code/yarn.lock b/code/yarn.lock index b3d4edd0c93..8fe83332bf2 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -5388,6 +5388,7 @@ __metadata: "@storybook/client-logger": 7.0.0-alpha.47 "@storybook/components": 7.0.0-alpha.47 "@storybook/core-events": 7.0.0-alpha.47 + "@storybook/preview-api": 7.0.0-alpha.47 "@storybook/theming": 7.0.0-alpha.47 "@storybook/types": 7.0.0-alpha.47 "@testing-library/react": ^11.2.2 @@ -5416,6 +5417,7 @@ __metadata: "@storybook/client-logger": 7.0.0-alpha.47 "@storybook/components": 7.0.0-alpha.47 "@storybook/core-events": 7.0.0-alpha.47 + "@storybook/preview-api": 7.0.0-alpha.47 "@storybook/theming": 7.0.0-alpha.47 "@storybook/types": 7.0.0-alpha.47 "@types/lodash": ^4.14.167 @@ -5449,6 +5451,7 @@ __metadata: "@storybook/client-logger": 7.0.0-alpha.47 "@storybook/components": 7.0.0-alpha.47 "@storybook/core-events": 7.0.0-alpha.47 + "@storybook/preview-api": 7.0.0-alpha.47 "@storybook/theming": 7.0.0-alpha.47 "@storybook/types": 7.0.0-alpha.47 global: ^4.4.0 @@ -5477,6 +5480,7 @@ __metadata: "@storybook/components": 7.0.0-alpha.47 "@storybook/core-common": 7.0.0-alpha.47 "@storybook/node-logger": 7.0.0-alpha.47 + "@storybook/preview-api": 7.0.0-alpha.47 "@storybook/store": 7.0.0-alpha.47 "@storybook/theming": 7.0.0-alpha.47 "@storybook/types": 7.0.0-alpha.47 @@ -5513,6 +5517,7 @@ __metadata: "@storybook/mdx2-csf": next "@storybook/node-logger": 7.0.0-alpha.47 "@storybook/postinstall": 7.0.0-alpha.47 + "@storybook/preview-api": 7.0.0-alpha.47 "@storybook/preview-web": 7.0.0-alpha.47 "@storybook/store": 7.0.0-alpha.47 "@storybook/theming": 7.0.0-alpha.47 @@ -5553,6 +5558,7 @@ __metadata: "@storybook/api": 7.0.0-alpha.47 "@storybook/core-common": 7.0.0-alpha.47 "@storybook/node-logger": 7.0.0-alpha.47 + "@storybook/preview-api": 7.0.0-alpha.47 "@storybook/vue": 7.0.0-alpha.47 "@types/jest": ^26.0.16 ts-dedent: ^2.0.0 @@ -5593,6 +5599,7 @@ __metadata: dependencies: "@storybook/addons": 7.0.0-alpha.47 "@storybook/core-events": 7.0.0-alpha.47 + "@storybook/preview-api": 7.0.0-alpha.47 "@types/webpack-env": ^1.16.0 global: ^4.4.0 typescript: ~4.6.3 @@ -5612,6 +5619,7 @@ __metadata: "@storybook/core-events": 7.0.0-alpha.47 "@storybook/instrumenter": 7.0.0-alpha.47 "@storybook/jest": ^0.0.10 + "@storybook/preview-api": 7.0.0-alpha.47 "@storybook/testing-library": 0.0.14-next.0 "@storybook/theming": 7.0.0-alpha.47 "@storybook/types": 7.0.0-alpha.47 @@ -5642,6 +5650,7 @@ __metadata: "@storybook/client-logger": 7.0.0-alpha.47 "@storybook/components": 7.0.0-alpha.47 "@storybook/core-events": 7.0.0-alpha.47 + "@storybook/preview-api": 7.0.0-alpha.47 "@storybook/theming": 7.0.0-alpha.47 global: ^4.4.0 react-sizeme: ^3.0.1 @@ -5666,6 +5675,7 @@ __metadata: "@storybook/client-logger": 7.0.0-alpha.47 "@storybook/core-events": 7.0.0-alpha.47 "@storybook/csf": next + "@storybook/preview-api": 7.0.0-alpha.47 "@storybook/router": 7.0.0-alpha.47 "@storybook/types": 7.0.0-alpha.47 global: ^4.4.0 @@ -5692,6 +5702,7 @@ __metadata: "@storybook/client-logger": 7.0.0-alpha.47 "@storybook/components": 7.0.0-alpha.47 "@storybook/core-events": 7.0.0-alpha.47 + "@storybook/preview-api": 7.0.0-alpha.47 "@storybook/types": 7.0.0-alpha.47 global: ^4.4.0 typescript: ~4.6.3 @@ -5715,6 +5726,7 @@ __metadata: "@storybook/client-logger": 7.0.0-alpha.47 "@storybook/components": 7.0.0-alpha.47 "@storybook/core-events": 7.0.0-alpha.47 + "@storybook/preview-api": 7.0.0-alpha.47 "@storybook/types": 7.0.0-alpha.47 global: ^4.4.0 ts-dedent: ^2.0.0 @@ -5767,6 +5779,7 @@ __metadata: "@storybook/core-client": 7.0.0-alpha.47 "@storybook/core-common": 7.0.0-alpha.47 "@storybook/core-webpack": 7.0.0-alpha.47 + "@storybook/preview-api": 7.0.0-alpha.47 "@storybook/react": 7.0.0-alpha.47 "@storybook/types": 7.0.0-alpha.47 "@storybook/vue": 7.0.0-alpha.47 @@ -5849,6 +5862,7 @@ __metadata: "@storybook/api": 7.0.0-alpha.47 "@storybook/client-logger": 7.0.0-alpha.47 "@storybook/components": 7.0.0-alpha.47 + "@storybook/preview-api": 7.0.0-alpha.47 "@storybook/router": 7.0.0-alpha.47 "@storybook/source-loader": 7.0.0-alpha.47 "@storybook/theming": 7.0.0-alpha.47 @@ -5893,6 +5907,7 @@ __metadata: "@storybook/api": 7.0.0-alpha.47 "@storybook/client-logger": 7.0.0-alpha.47 "@storybook/components": 7.0.0-alpha.47 + "@storybook/preview-api": 7.0.0-alpha.47 "@storybook/theming": 7.0.0-alpha.47 typescript: ~4.6.3 peerDependencies: @@ -5915,6 +5930,7 @@ __metadata: "@storybook/client-logger": 7.0.0-alpha.47 "@storybook/components": 7.0.0-alpha.47 "@storybook/core-events": 7.0.0-alpha.47 + "@storybook/preview-api": 7.0.0-alpha.47 "@storybook/theming": 7.0.0-alpha.47 global: ^4.4.0 memoizerific: ^1.11.3 @@ -5998,6 +6014,7 @@ __metadata: "@storybook/core-webpack": 7.0.0-alpha.47 "@storybook/docs-tools": 7.0.0-alpha.47 "@storybook/node-logger": 7.0.0-alpha.47 + "@storybook/preview-api": 7.0.0-alpha.47 "@storybook/store": 7.0.0-alpha.47 "@storybook/types": 7.0.0-alpha.47 "@types/node": ^16.0.0 @@ -6133,6 +6150,7 @@ __metadata: "@storybook/core-events": 7.0.0-alpha.47 "@storybook/csf": next "@storybook/docs-tools": 7.0.0-alpha.47 + "@storybook/preview-api": 7.0.0-alpha.47 "@storybook/preview-web": 7.0.0-alpha.47 "@storybook/store": 7.0.0-alpha.47 "@storybook/theming": 7.0.0-alpha.47 @@ -6778,6 +6796,7 @@ __metadata: "@storybook/addons": 7.0.0-alpha.47 "@storybook/core-client": 7.0.0-alpha.47 "@storybook/docs-tools": 7.0.0-alpha.47 + "@storybook/preview-api": 7.0.0-alpha.47 "@storybook/preview-web": 7.0.0-alpha.47 "@storybook/store": 7.0.0-alpha.47 "@storybook/types": 7.0.0-alpha.47 @@ -6799,6 +6818,7 @@ __metadata: "@storybook/channels": 7.0.0-alpha.47 "@storybook/client-logger": 7.0.0-alpha.47 "@storybook/core-events": 7.0.0-alpha.47 + "@storybook/preview-api": 7.0.0-alpha.47 core-js: ^3.8.2 global: ^4.4.0 typescript: ~4.6.3 @@ -6898,6 +6918,7 @@ __metadata: "@storybook/client-logger": 7.0.0-alpha.47 "@storybook/components": 7.0.0-alpha.47 "@storybook/core-events": 7.0.0-alpha.47 + "@storybook/preview-api": 7.0.0-alpha.47 "@storybook/router": 7.0.0-alpha.47 "@storybook/theming": 7.0.0-alpha.47 "@storybook/types": 7.0.0-alpha.47 @@ -6956,6 +6977,7 @@ __metadata: "@storybook/core-common": 7.0.0-alpha.47 "@storybook/node-logger": 7.0.0-alpha.47 "@storybook/preset-react-webpack": 7.0.0-alpha.47 + "@storybook/preview-api": 7.0.0-alpha.47 "@storybook/react": 7.0.0-alpha.47 "@types/loader-utils": ^2.0.3 "@types/node": ^14.14.20 || ^16.0.0 @@ -7040,6 +7062,7 @@ __metadata: dependencies: "@storybook/addons": 7.0.0-alpha.47 "@storybook/core-client": 7.0.0-alpha.47 + "@storybook/preview-api": 7.0.0-alpha.47 "@storybook/store": 7.0.0-alpha.47 "@storybook/types": 7.0.0-alpha.47 global: ^4.4.0 @@ -7235,13 +7258,14 @@ __metadata: languageName: unknown linkType: soft -"@storybook/preview-api@7.0.0-alpha.47, @storybook/preview-api@workspace:lib/preview-api": +"@storybook/preview-api@7.0.0-alpha.47, @storybook/preview-api@workspace:*, @storybook/preview-api@workspace:lib/preview-api": version: 0.0.0-use.local resolution: "@storybook/preview-api@workspace:lib/preview-api" dependencies: "@storybook/addons": 7.0.0-alpha.47 "@storybook/client-api": 7.0.0-alpha.47 "@storybook/core-client": 7.0.0-alpha.47 + "@storybook/preview-api": 7.0.0-alpha.47 "@storybook/preview-web": 7.0.0-alpha.47 "@storybook/store": 7.0.0-alpha.47 languageName: unknown @@ -7384,6 +7408,7 @@ __metadata: "@storybook/client-logger": 7.0.0-alpha.47 "@storybook/core-client": 7.0.0-alpha.47 "@storybook/docs-tools": 7.0.0-alpha.47 + "@storybook/preview-api": 7.0.0-alpha.47 "@storybook/store": 7.0.0-alpha.47 "@storybook/types": 7.0.0-alpha.47 "@types/estree": ^0.0.51 @@ -7506,6 +7531,7 @@ __metadata: "@storybook/preset-vue-webpack": "workspace:*" "@storybook/preset-vue3-webpack": "workspace:*" "@storybook/preset-web-components-webpack": "workspace:*" + "@storybook/preview-api": "workspace:*" "@storybook/preview-web": "workspace:*" "@storybook/react": "workspace:*" "@storybook/react-vite": "workspace:*" @@ -7747,6 +7773,7 @@ __metadata: dependencies: "@storybook/addons": 7.0.0-alpha.47 "@storybook/core-client": 7.0.0-alpha.47 + "@storybook/preview-api": 7.0.0-alpha.47 "@storybook/preview-web": 7.0.0-alpha.47 "@storybook/store": 7.0.0-alpha.47 "@storybook/types": 7.0.0-alpha.47 @@ -7856,6 +7883,7 @@ __metadata: "@storybook/client-logger": 7.0.0-alpha.47 "@storybook/core-client": 7.0.0-alpha.47 "@storybook/docs-tools": 7.0.0-alpha.47 + "@storybook/preview-api": 7.0.0-alpha.47 "@storybook/store": 7.0.0-alpha.47 "@storybook/types": 7.0.0-alpha.47 expect-type: ^0.14.2 @@ -8060,6 +8088,7 @@ __metadata: "@storybook/addons": 7.0.0-alpha.47 "@storybook/core-client": 7.0.0-alpha.47 "@storybook/docs-tools": 7.0.0-alpha.47 + "@storybook/preview-api": 7.0.0-alpha.47 "@storybook/store": 7.0.0-alpha.47 "@storybook/types": 7.0.0-alpha.47 global: ^4.4.0 @@ -8088,6 +8117,7 @@ __metadata: "@storybook/client-logger": 7.0.0-alpha.47 "@storybook/core-client": 7.0.0-alpha.47 "@storybook/docs-tools": 7.0.0-alpha.47 + "@storybook/preview-api": 7.0.0-alpha.47 "@storybook/store": 7.0.0-alpha.47 "@storybook/types": 7.0.0-alpha.47 global: ^4.4.0 @@ -8158,6 +8188,7 @@ __metadata: "@storybook/client-logger": 7.0.0-alpha.47 "@storybook/core-client": 7.0.0-alpha.47 "@storybook/docs-tools": 7.0.0-alpha.47 + "@storybook/preview-api": 7.0.0-alpha.47 "@storybook/preview-web": 7.0.0-alpha.47 "@storybook/store": 7.0.0-alpha.47 "@storybook/types": 7.0.0-alpha.47 diff --git a/docs/snippets/angular/component-story-highlight-addon.ts.mdx b/docs/snippets/angular/component-story-highlight-addon.ts.mdx index 79282658faf..a7ad93a6d31 100644 --- a/docs/snippets/angular/component-story-highlight-addon.ts.mdx +++ b/docs/snippets/angular/component-story-highlight-addon.ts.mdx @@ -2,7 +2,7 @@ // Card.stories.ts import { componentWrapperDecorator, Meta, Story } from '@storybook/angular'; -import { useChannel } from '@storybook/addons'; +import { useChannel } from '@storybook/preview-api'; import { HIGHLIGHT, RESET_HIGHLIGHT } from '@storybook/addon-highlight'; import { Card } form './card.component'; diff --git a/docs/snippets/common/addon-consume-and-update-globaltype.js.mdx b/docs/snippets/common/addon-consume-and-update-globaltype.js.mdx index 96a8a5a57b1..92fbb34bbee 100644 --- a/docs/snippets/common/addon-consume-and-update-globaltype.js.mdx +++ b/docs/snippets/common/addon-consume-and-update-globaltype.js.mdx @@ -8,7 +8,7 @@ import { useGlobals } from '@storybook/api'; import { IconButton, Icons } from '@storybook/components'; -import { addons } from '@storybook/addons'; +import { addons } from '@storybook/preview-api'; const ExampleToolbar = () => { const [globals, updateGlobals] = useGlobals(); diff --git a/docs/snippets/common/my-addon-initial-panel-state.js.mdx b/docs/snippets/common/my-addon-initial-panel-state.js.mdx index 8009d61ac4f..0e67a5444f8 100644 --- a/docs/snippets/common/my-addon-initial-panel-state.js.mdx +++ b/docs/snippets/common/my-addon-initial-panel-state.js.mdx @@ -3,7 +3,7 @@ import React from 'react'; -import { addons, types } from '@storybook/addons'; +import { addons, types } from '@storybook/preview-api'; import { AddonPanel } from '@storybook/components'; diff --git a/docs/snippets/common/storybook-addon-panel-example.js.mdx b/docs/snippets/common/storybook-addon-panel-example.js.mdx index 29d8a1ab9d4..5c80a0dea42 100644 --- a/docs/snippets/common/storybook-addon-panel-example.js.mdx +++ b/docs/snippets/common/storybook-addon-panel-example.js.mdx @@ -5,7 +5,7 @@ import React from 'react'; import { AddonPanel } from '@storybook/components'; -import { addons, types } from '@storybook/addons'; +import { addons, types } from '@storybook/preview-api'; import { useGlobals } from '@storybook/api'; diff --git a/docs/snippets/common/storybook-addon-panel-initial.js.mdx b/docs/snippets/common/storybook-addon-panel-initial.js.mdx index 9f9e6b6c05f..93c63e16d00 100644 --- a/docs/snippets/common/storybook-addon-panel-initial.js.mdx +++ b/docs/snippets/common/storybook-addon-panel-initial.js.mdx @@ -3,7 +3,7 @@ import React from 'react'; -import { addons, types } from '@storybook/addons'; +import { addons, types } from '@storybook/preview-api'; import { AddonPanel } from '@storybook/components'; diff --git a/docs/snippets/common/storybook-addon-tab-example.js.mdx b/docs/snippets/common/storybook-addon-tab-example.js.mdx index 6f471c7c675..29f77891c62 100644 --- a/docs/snippets/common/storybook-addon-tab-example.js.mdx +++ b/docs/snippets/common/storybook-addon-tab-example.js.mdx @@ -3,7 +3,7 @@ import React from 'react'; -import { addons, type types } from '@storybook/addons'; +import { addons, type types } from '@storybook/preview-api'; addons.register('my/tab', () => { addons.add('my-panel-addon/tab', { diff --git a/docs/snippets/common/storybook-addon-toolbar-example.js.mdx b/docs/snippets/common/storybook-addon-toolbar-example.js.mdx index 869c9df49ad..11220e3a01f 100644 --- a/docs/snippets/common/storybook-addon-toolbar-example.js.mdx +++ b/docs/snippets/common/storybook-addon-toolbar-example.js.mdx @@ -3,7 +3,7 @@ import React from "react"; -import { addons, types } from '@storybook/addons'; +import { addons, types } from '@storybook/preview-api'; import { Icons, IconButton } from '@storybook/components'; diff --git a/docs/snippets/common/storybook-addons-api-imports.js.mdx b/docs/snippets/common/storybook-addons-api-imports.js.mdx index e44d88ab048..2290d7cfd2f 100644 --- a/docs/snippets/common/storybook-addons-api-imports.js.mdx +++ b/docs/snippets/common/storybook-addons-api-imports.js.mdx @@ -1,5 +1,5 @@ ```js // .storybook/my-addon/manager.js -import { addons } from '@storybook/addons'; +import { addons } from '@storybook/preview-api'; ``` \ No newline at end of file diff --git a/docs/snippets/common/storybook-addons-api-makedecorator.js.mdx b/docs/snippets/common/storybook-addons-api-makedecorator.js.mdx index 3c9617bfa19..dae89b20b20 100644 --- a/docs/snippets/common/storybook-addons-api-makedecorator.js.mdx +++ b/docs/snippets/common/storybook-addons-api-makedecorator.js.mdx @@ -1,7 +1,7 @@ ```js // .storybook/my-addon/manager.js -import { makeDecorator } from '@storybook/addons'; +import { makeDecorator } from '@storybook/preview-api'; export makeDecorator({ name: 'withSomething', diff --git a/docs/snippets/common/storybook-addons-api-register.js.mdx b/docs/snippets/common/storybook-addons-api-register.js.mdx index 3c044eebd8c..5ce4f9f848d 100644 --- a/docs/snippets/common/storybook-addons-api-register.js.mdx +++ b/docs/snippets/common/storybook-addons-api-register.js.mdx @@ -1,7 +1,7 @@ ```js // .storybook/my-addon/manager.js -import { addons } from '@storybook/addons'; +import { addons } from '@storybook/preview-api'; // Register the addon with a unique name. addons.register('my-organisation/my-addon', (api) => {}); diff --git a/docs/snippets/common/storybook-config-layout.js.mdx b/docs/snippets/common/storybook-config-layout.js.mdx index c36446aebea..73f69aa9334 100644 --- a/docs/snippets/common/storybook-config-layout.js.mdx +++ b/docs/snippets/common/storybook-config-layout.js.mdx @@ -1,7 +1,7 @@ ```js // .storybook/manager.js -import { addons } from '@storybook/addons'; +import { addons } from '@storybook/preview-api'; addons.setConfig({ isFullscreen: false, diff --git a/docs/snippets/common/storybook-manager-custom-theme.js.mdx b/docs/snippets/common/storybook-manager-custom-theme.js.mdx index be5df4a7d45..45bf92e29e3 100644 --- a/docs/snippets/common/storybook-manager-custom-theme.js.mdx +++ b/docs/snippets/common/storybook-manager-custom-theme.js.mdx @@ -1,7 +1,7 @@ ```js // .storybook/manager.js -import { addons } from '@storybook/addons'; +import { addons } from '@storybook/preview-api'; import yourTheme from './YourTheme'; addons.setConfig({ diff --git a/docs/snippets/common/storybook-manager-dark-theme.js.mdx b/docs/snippets/common/storybook-manager-dark-theme.js.mdx index ab37efb2de8..39a73477cfc 100644 --- a/docs/snippets/common/storybook-manager-dark-theme.js.mdx +++ b/docs/snippets/common/storybook-manager-dark-theme.js.mdx @@ -1,7 +1,7 @@ ```js // .storybook/manager.js -import { addons } from '@storybook/addons'; +import { addons } from '@storybook/preview-api'; import { themes } from '@storybook/theming'; addons.setConfig({ diff --git a/docs/snippets/common/storybook-manager-disable-roots.js.mdx b/docs/snippets/common/storybook-manager-disable-roots.js.mdx index 952d363c23d..2d3bc31de8c 100644 --- a/docs/snippets/common/storybook-manager-disable-roots.js.mdx +++ b/docs/snippets/common/storybook-manager-disable-roots.js.mdx @@ -1,7 +1,7 @@ ```js // ./storybook/manager.js -import { addons } from '@storybook/addons'; +import { addons } from '@storybook/preview-api'; addons.setConfig({ sidebar: { diff --git a/docs/snippets/common/storybook-manager-render-label-stories.js.mdx b/docs/snippets/common/storybook-manager-render-label-stories.js.mdx index a40abfbadc9..f6444aa6a1f 100644 --- a/docs/snippets/common/storybook-manager-render-label-stories.js.mdx +++ b/docs/snippets/common/storybook-manager-render-label-stories.js.mdx @@ -1,7 +1,7 @@ ```js // .storybook/manager.js -import { addons } from '@storybook/addons'; +import { addons } from '@storybook/preview-api'; import startCase from 'lodash/startCase'; diff --git a/docs/snippets/react/component-story-highlight-addon.js.mdx b/docs/snippets/react/component-story-highlight-addon.js.mdx index 0c68f53d98a..db3e9abfe4c 100644 --- a/docs/snippets/react/component-story-highlight-addon.js.mdx +++ b/docs/snippets/react/component-story-highlight-addon.js.mdx @@ -2,7 +2,7 @@ // Card.stories.js|jsx import React, { useEffect } from 'react'; -import { useChannel } from '@storybook/addons'; +import { useChannel } from '@storybook/preview-api'; import { HIGHLIGHT, RESET_HIGHLIGHT } from '@storybook/addon-highlight'; import { Card } form './Card'; diff --git a/docs/snippets/vue/component-story-highlight-addon.js.mdx b/docs/snippets/vue/component-story-highlight-addon.js.mdx index 3bb3d0f30b6..9acba2faa66 100644 --- a/docs/snippets/vue/component-story-highlight-addon.js.mdx +++ b/docs/snippets/vue/component-story-highlight-addon.js.mdx @@ -1,7 +1,7 @@ ```js // Card.stories.js -import { useChannel } from '@storybook/addons'; +import { useChannel } from '@storybook/preview-api'; import { HIGHLIGHT, RESET_HIGHLIGHT } from '@storybook/addon-highlight'; import { Card } form './Card.vue'; diff --git a/docs/snippets/web-components/component-story-highlight-addon.js.mdx b/docs/snippets/web-components/component-story-highlight-addon.js.mdx index 4a8f436b4e4..2509855d6ca 100644 --- a/docs/snippets/web-components/component-story-highlight-addon.js.mdx +++ b/docs/snippets/web-components/component-story-highlight-addon.js.mdx @@ -2,7 +2,7 @@ // card-component.stories.js import { html } from 'lit-html'; -import { useChannel } from '@storybook/addons'; +import { useChannel } from '@storybook/preview-api'; import { HIGHLIGHT, RESET_HIGHLIGHT } from '@storybook/addon-highlight'; import './card-component'; From a3db46b3b58cbfc31a9fcd265d745d653d784156 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Thu, 3 Nov 2022 14:48:22 +0100 Subject: [PATCH 05/47] fix --- code/lib/cli/src/versions.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/code/lib/cli/src/versions.ts b/code/lib/cli/src/versions.ts index 80ee1493729..85dbc34ea25 100644 --- a/code/lib/cli/src/versions.ts +++ b/code/lib/cli/src/versions.ts @@ -17,7 +17,6 @@ export default { '@storybook/addon-storysource': '7.0.0-alpha.47', '@storybook/addon-toolbars': '7.0.0-alpha.47', '@storybook/addon-viewport': '7.0.0-alpha.47', - '@storybook/preview-api': '7.0.0-alpha.47', '@storybook/angular': '7.0.0-alpha.47', '@storybook/api': '7.0.0-alpha.47', '@storybook/blocks': '7.0.0-alpha.47', From 3a801158ed0570130bea059a441c0d69c218f3dd Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Thu, 3 Nov 2022 15:29:51 +0100 Subject: [PATCH 06/47] step 5 --- code/addons/docs/src/DocsRenderer.tsx | 2 +- code/frameworks/react-vite/src/index.ts | 2 +- code/frameworks/svelte-vite/src/index.ts | 2 +- code/frameworks/vue-vite/src/index.ts | 2 +- code/frameworks/vue3-vite/src/index.ts | 2 +- .../web-components-vite/src/index.ts | 2 +- .../virtualModuleModernEntry.js.handlebars | 4 +- code/lib/preview-api/src/index.ts | 10 +++ .../src/docs-context/DocsContextProps.ts | 65 +------------------ code/lib/types/src/index.ts | 1 + code/lib/types/src/modules/docs.ts | 57 ++++++++++++++++ code/renderers/html/src/render.ts | 2 +- code/renderers/server/src/render.ts | 2 +- code/renderers/web-components/src/render.ts | 2 +- code/ui/blocks/package.json | 1 + code/ui/blocks/src/blocks/DocsContext.ts | 3 +- .../blocks/external/ExternalDocsContext.ts | 4 +- .../src/blocks/external/ExternalPreview.ts | 2 +- 18 files changed, 85 insertions(+), 80 deletions(-) create mode 100644 code/lib/types/src/modules/docs.ts diff --git a/code/addons/docs/src/DocsRenderer.tsx b/code/addons/docs/src/DocsRenderer.tsx index 83f9a2e49af..6465e75311b 100644 --- a/code/addons/docs/src/DocsRenderer.tsx +++ b/code/addons/docs/src/DocsRenderer.tsx @@ -1,7 +1,7 @@ import React from 'react'; import ReactDOM from 'react-dom'; import type { AnyFramework, Parameters } from '@storybook/types'; -import type { DocsContextProps, DocsRenderFunction } from '@storybook/preview-web'; +import type { DocsContextProps, DocsRenderFunction } from '@storybook/preview-api'; import { components as htmlComponents } from '@storybook/components'; import { Docs, CodeOrSourceMdx, AnchorMdx, HeadersMdx } from '@storybook/blocks'; import { MDXProvider } from '@mdx-js/react'; diff --git a/code/frameworks/react-vite/src/index.ts b/code/frameworks/react-vite/src/index.ts index 14382e06236..b929559a3b0 100644 --- a/code/frameworks/react-vite/src/index.ts +++ b/code/frameworks/react-vite/src/index.ts @@ -2,7 +2,7 @@ export { createChannel as createPostMessageChannel } from '@storybook/channel-postmessage'; export { createChannel as createWebSocketChannel } from '@storybook/channel-websocket'; export { addons } from '@storybook/preview-api'; -export { composeConfigs, PreviewWeb } from '@storybook/preview-web'; +export { composeConfigs, PreviewWeb } from '@storybook/preview-api'; export { ClientApi } from '@storybook/preview-api'; export type { StorybookConfig } from '@storybook/builder-vite'; diff --git a/code/frameworks/svelte-vite/src/index.ts b/code/frameworks/svelte-vite/src/index.ts index 14382e06236..b929559a3b0 100644 --- a/code/frameworks/svelte-vite/src/index.ts +++ b/code/frameworks/svelte-vite/src/index.ts @@ -2,7 +2,7 @@ export { createChannel as createPostMessageChannel } from '@storybook/channel-postmessage'; export { createChannel as createWebSocketChannel } from '@storybook/channel-websocket'; export { addons } from '@storybook/preview-api'; -export { composeConfigs, PreviewWeb } from '@storybook/preview-web'; +export { composeConfigs, PreviewWeb } from '@storybook/preview-api'; export { ClientApi } from '@storybook/preview-api'; export type { StorybookConfig } from '@storybook/builder-vite'; diff --git a/code/frameworks/vue-vite/src/index.ts b/code/frameworks/vue-vite/src/index.ts index 14382e06236..b929559a3b0 100644 --- a/code/frameworks/vue-vite/src/index.ts +++ b/code/frameworks/vue-vite/src/index.ts @@ -2,7 +2,7 @@ export { createChannel as createPostMessageChannel } from '@storybook/channel-postmessage'; export { createChannel as createWebSocketChannel } from '@storybook/channel-websocket'; export { addons } from '@storybook/preview-api'; -export { composeConfigs, PreviewWeb } from '@storybook/preview-web'; +export { composeConfigs, PreviewWeb } from '@storybook/preview-api'; export { ClientApi } from '@storybook/preview-api'; export type { StorybookConfig } from '@storybook/builder-vite'; diff --git a/code/frameworks/vue3-vite/src/index.ts b/code/frameworks/vue3-vite/src/index.ts index 14382e06236..b929559a3b0 100644 --- a/code/frameworks/vue3-vite/src/index.ts +++ b/code/frameworks/vue3-vite/src/index.ts @@ -2,7 +2,7 @@ export { createChannel as createPostMessageChannel } from '@storybook/channel-postmessage'; export { createChannel as createWebSocketChannel } from '@storybook/channel-websocket'; export { addons } from '@storybook/preview-api'; -export { composeConfigs, PreviewWeb } from '@storybook/preview-web'; +export { composeConfigs, PreviewWeb } from '@storybook/preview-api'; export { ClientApi } from '@storybook/preview-api'; export type { StorybookConfig } from '@storybook/builder-vite'; diff --git a/code/frameworks/web-components-vite/src/index.ts b/code/frameworks/web-components-vite/src/index.ts index 14382e06236..b929559a3b0 100644 --- a/code/frameworks/web-components-vite/src/index.ts +++ b/code/frameworks/web-components-vite/src/index.ts @@ -2,7 +2,7 @@ export { createChannel as createPostMessageChannel } from '@storybook/channel-postmessage'; export { createChannel as createWebSocketChannel } from '@storybook/channel-websocket'; export { addons } from '@storybook/preview-api'; -export { composeConfigs, PreviewWeb } from '@storybook/preview-web'; +export { composeConfigs, PreviewWeb } from '@storybook/preview-api'; export { ClientApi } from '@storybook/preview-api'; export type { StorybookConfig } from '@storybook/builder-vite'; diff --git a/code/lib/builder-webpack5/templates/virtualModuleModernEntry.js.handlebars b/code/lib/builder-webpack5/templates/virtualModuleModernEntry.js.handlebars index d95a7bf460a..8162f690832 100644 --- a/code/lib/builder-webpack5/templates/virtualModuleModernEntry.js.handlebars +++ b/code/lib/builder-webpack5/templates/virtualModuleModernEntry.js.handlebars @@ -1,9 +1,7 @@ import global from 'global'; -import { PreviewWeb } from '@storybook/preview-web'; import { composeConfigs } from '@storybook/store'; -import { ClientApi } from '@storybook/preview-api'; -import { addons } from '@storybook/preview-api'; +import { ClientApi, PreviewWeb, addons } from '@storybook/preview-api'; import { createChannel as createPostMessageChannel } from '@storybook/channel-postmessage'; import { createChannel as createWebSocketChannel } from '@storybook/channel-websocket'; diff --git a/code/lib/preview-api/src/index.ts b/code/lib/preview-api/src/index.ts index b7c88bef35e..7bf3522671e 100644 --- a/code/lib/preview-api/src/index.ts +++ b/code/lib/preview-api/src/index.ts @@ -34,6 +34,16 @@ export const { makeDecorator } = ADDONS; */ export const { addons } = ADDONS; +/** + * DOCS API + */ +export const { DocsContext } = PREVIEW_WEB; + +/** + * SIMULATION API + */ +export const { simulatePageLoad, simulateDOMContentLoaded } = PREVIEW_WEB; + /** * STORIES API */ diff --git a/code/lib/preview-web/src/docs-context/DocsContextProps.ts b/code/lib/preview-web/src/docs-context/DocsContextProps.ts index 49ffbe8a755..52c9b1498e0 100644 --- a/code/lib/preview-web/src/docs-context/DocsContextProps.ts +++ b/code/lib/preview-web/src/docs-context/DocsContextProps.ts @@ -1,64 +1,3 @@ -import type { - AnyFramework, - Store_ModuleExport, - Store_ModuleExports, - Store_Story, - StoryContextForLoaders, - StoryId, - StoryName, -} from '@storybook/types'; -import type { Channel } from '@storybook/channels'; +import type { DocsContextProps } from '@storybook/types'; -export interface DocsContextProps { - /** - * Register the CSF file that this docs entry represents. - * Used by the `` block. - */ - setMeta: (metaExports: Store_ModuleExports) => void; - - /** - * Find a story's id from the direct export from the CSF file. - * This is primarily used by the ` block. - */ - storyIdByModuleExport: ( - storyExport: Store_ModuleExport, - metaExports?: Store_ModuleExports - ) => StoryId; - /** - * Find a story's id from the name of the story. - * This is primarily used by the ` block. - * Note that the story must be part of the primary CSF file of the docs entry. - */ - storyIdByName: (storyName: StoryName) => StoryId; - /** - * Syncronously find a story by id (if the id is not provided, this will look up the primary - * story in the CSF file, if such a file exists). - */ - storyById: (id?: StoryId) => Store_Story; - /** - * Syncronously find all stories of the component referenced by the CSF file. - */ - componentStories: () => Store_Story[]; - - /** - * Get the story context of the referenced story. - */ - getStoryContext: (story: Store_Story) => StoryContextForLoaders; - /** - * Asyncronously load an arbitrary story by id. - */ - loadStory: (id: StoryId) => Promise>; - - /** - * Render a story to a given HTML element and keep it up to date across context changes - */ - renderStoryToElement: ( - story: Store_Story, - element: HTMLElement - ) => () => Promise; - - /** - * Storybook channel -- use for low level event watching/emitting - */ - channel: Channel; -} +export { DocsContextProps }; diff --git a/code/lib/types/src/index.ts b/code/lib/types/src/index.ts index c2a5bacb891..628a6ca94a5 100644 --- a/code/lib/types/src/index.ts +++ b/code/lib/types/src/index.ts @@ -9,4 +9,5 @@ export * from './modules/core-client'; export * from './modules/core-common'; export * from './modules/builder'; export * from './modules/api'; +export * from './modules/docs'; export * from './modules/api-stories'; diff --git a/code/lib/types/src/modules/docs.ts b/code/lib/types/src/modules/docs.ts new file mode 100644 index 00000000000..74c2e610817 --- /dev/null +++ b/code/lib/types/src/modules/docs.ts @@ -0,0 +1,57 @@ +import type { Channel } from '@storybook/channels'; +import type { AnyFramework, StoryContextForLoaders, StoryId, StoryName } from './csf'; +import type { Store_ModuleExport, Store_ModuleExports, Store_Story } from './store'; + +export interface DocsContextProps { + /** + * Register the CSF file that this docs entry represents. + * Used by the `` block. + */ + setMeta: (metaExports: Store_ModuleExports) => void; + + /** + * Find a story's id from the direct export from the CSF file. + * This is primarily used by the ` block. + */ + storyIdByModuleExport: ( + storyExport: Store_ModuleExport, + metaExports?: Store_ModuleExports + ) => StoryId; + /** + * Find a story's id from the name of the story. + * This is primarily used by the ` block. + * Note that the story must be part of the primary CSF file of the docs entry. + */ + storyIdByName: (storyName: StoryName) => StoryId; + /** + * Syncronously find a story by id (if the id is not provided, this will look up the primary + * story in the CSF file, if such a file exists). + */ + storyById: (id?: StoryId) => Store_Story; + /** + * Syncronously find all stories of the component referenced by the CSF file. + */ + componentStories: () => Store_Story[]; + + /** + * Get the story context of the referenced story. + */ + getStoryContext: (story: Store_Story) => StoryContextForLoaders; + /** + * Asyncronously load an arbitrary story by id. + */ + loadStory: (id: StoryId) => Promise>; + + /** + * Render a story to a given HTML element and keep it up to date across context changes + */ + renderStoryToElement: ( + story: Store_Story, + element: HTMLElement + ) => () => Promise; + + /** + * Storybook channel -- use for low level event watching/emitting + */ + channel: Channel; +} diff --git a/code/renderers/html/src/render.ts b/code/renderers/html/src/render.ts index 9cc055c4e2e..955257bc973 100644 --- a/code/renderers/html/src/render.ts +++ b/code/renderers/html/src/render.ts @@ -3,7 +3,7 @@ import global from 'global'; import { dedent } from 'ts-dedent'; -import { simulatePageLoad, simulateDOMContentLoaded } from '@storybook/preview-web'; +import { simulatePageLoad, simulateDOMContentLoaded } from '@storybook/preview-api'; import type { Store_RenderContext, ArgsStoryFn } from '@storybook/types'; import type { HtmlFramework } from './types'; diff --git a/code/renderers/server/src/render.ts b/code/renderers/server/src/render.ts index 507061c8869..bbc9d72340e 100644 --- a/code/renderers/server/src/render.ts +++ b/code/renderers/server/src/render.ts @@ -4,7 +4,7 @@ import global from 'global'; import { dedent } from 'ts-dedent'; import type { Store_RenderContext } from '@storybook/types'; -import { simulatePageLoad, simulateDOMContentLoaded } from '@storybook/preview-web'; +import { simulatePageLoad, simulateDOMContentLoaded } from '@storybook/preview-api'; import type { StoryFn, Args, ArgTypes } from './public-types'; import type { FetchStoryHtmlType, ServerFramework } from './types'; diff --git a/code/renderers/web-components/src/render.ts b/code/renderers/web-components/src/render.ts index b7480e6112d..32ed944bfd4 100644 --- a/code/renderers/web-components/src/render.ts +++ b/code/renderers/web-components/src/render.ts @@ -7,7 +7,7 @@ import { render as litRender } from 'lit-html'; // Keep `.js` extension to avoid issue with Webpack (related to export map?) // eslint-disable-next-line import/extensions import { isTemplateResult } from 'lit-html/directive-helpers.js'; -import { simulatePageLoad, simulateDOMContentLoaded } from '@storybook/preview-web'; +import { simulatePageLoad, simulateDOMContentLoaded } from '@storybook/preview-api'; import type { Store_RenderContext, ArgsStoryFn } from '@storybook/types'; import type { WebComponentsFramework } from './types'; diff --git a/code/ui/blocks/package.json b/code/ui/blocks/package.json index ad08e009516..a9d63a476f7 100644 --- a/code/ui/blocks/package.json +++ b/code/ui/blocks/package.json @@ -48,6 +48,7 @@ "@storybook/core-events": "7.0.0-alpha.47", "@storybook/csf": "next", "@storybook/docs-tools": "7.0.0-alpha.47", + "@storybook/preview-api": "7.0.0-alpha.47", "@storybook/preview-web": "7.0.0-alpha.47", "@storybook/store": "7.0.0-alpha.47", "@storybook/theming": "7.0.0-alpha.47", diff --git a/code/ui/blocks/src/blocks/DocsContext.ts b/code/ui/blocks/src/blocks/DocsContext.ts index 79cab65693f..6f3953f6b2b 100644 --- a/code/ui/blocks/src/blocks/DocsContext.ts +++ b/code/ui/blocks/src/blocks/DocsContext.ts @@ -3,8 +3,7 @@ import type { Context } from 'react'; import { createContext } from 'react'; import { window as globalWindow } from 'global'; -import type { DocsContextProps } from '@storybook/preview-web'; -import type { AnyFramework } from '@storybook/types'; +import type { DocsContextProps, AnyFramework } from '@storybook/types'; export type { DocsContextProps }; diff --git a/code/ui/blocks/src/blocks/external/ExternalDocsContext.ts b/code/ui/blocks/src/blocks/external/ExternalDocsContext.ts index 3c98ec71d3e..dbe6a5d9cec 100644 --- a/code/ui/blocks/src/blocks/external/ExternalDocsContext.ts +++ b/code/ui/blocks/src/blocks/external/ExternalDocsContext.ts @@ -3,10 +3,10 @@ import type { Store_CSFFile, Store_ModuleExport, Store_ModuleExports, + DocsContextProps, } from '@storybook/types'; -import { DocsContext } from '@storybook/preview-web'; +import { DocsContext } from '@storybook/preview-api'; import type { StoryStore } from '@storybook/store'; -import type { DocsContextProps } from '@storybook/preview-web'; import type { Channel } from '@storybook/channels'; export class ExternalDocsContext extends DocsContext { diff --git a/code/ui/blocks/src/blocks/external/ExternalPreview.ts b/code/ui/blocks/src/blocks/external/ExternalPreview.ts index ebcd9ade608..1e4d7f8202f 100644 --- a/code/ui/blocks/src/blocks/external/ExternalPreview.ts +++ b/code/ui/blocks/src/blocks/external/ExternalPreview.ts @@ -1,4 +1,4 @@ -import { Preview } from '@storybook/preview-web'; +import { Preview } from '@storybook/preview-api'; import type { AnyFramework, ComponentTitle, From bc12c3804f4df8c55ea69abd79951eb3c314d89c Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Thu, 3 Nov 2022 15:31:43 +0100 Subject: [PATCH 07/47] fixes --- code/ui/manager/src/globals/exports.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/ui/manager/src/globals/exports.ts b/code/ui/manager/src/globals/exports.ts index ee5851f1031..06e3e89fde6 100644 --- a/code/ui/manager/src/globals/exports.ts +++ b/code/ui/manager/src/globals/exports.ts @@ -218,6 +218,7 @@ export default { ], '@storybook/preview-api': [ 'ClientApi', + 'DocsContext', 'HooksContext', 'Preview', 'PreviewWeb', @@ -246,6 +247,8 @@ export default { 'normalizeStory', 'prepareStory', 'setGlobalRender', + 'simulateDOMContentLoaded', + 'simulatePageLoad', 'start', 'useArgs', 'useCallback', From edccb7db6df84b0db11110a6e9db2f6cdfee19a1 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Thu, 3 Nov 2022 16:00:40 +0100 Subject: [PATCH 08/47] part 6 --- code/frameworks/angular/src/client/decorateStory.ts | 2 +- .../templates/virtualModuleModernEntry.js.handlebars | 3 +-- code/lib/core-server/package.json | 1 + code/lib/core-server/src/utils/StoryIndexGenerator.ts | 2 +- code/lib/docs-tools/package.json | 1 + code/lib/docs-tools/src/argTypes/enhanceArgTypes.ts | 2 +- code/lib/preview-api/src/index.ts | 6 ++++++ code/renderers/react/src/docs/extractArgTypes.test.ts | 2 +- code/renderers/react/src/testing-api.ts | 2 +- code/renderers/svelte/src/decorators.ts | 2 +- code/renderers/vue/src/decorateStory.ts | 2 +- code/renderers/vue3/src/decorateStory.ts | 2 +- code/ui/blocks/src/blocks/ArgsTable.tsx | 2 +- code/ui/blocks/src/blocks/enhanceSource.ts | 7 +++---- code/ui/blocks/src/blocks/external/ExternalDocs.tsx | 2 +- code/ui/blocks/src/blocks/external/ExternalDocsContext.ts | 2 +- code/ui/blocks/src/blocks/external/ExternalPreview.ts | 3 +-- code/ui/manager/src/globals/exports.ts | 6 ++++++ code/yarn.lock | 2 ++ scripts/tasks/compile.ts | 2 +- scripts/tasks/sandbox-parts.ts | 7 ++++--- 21 files changed, 37 insertions(+), 23 deletions(-) diff --git a/code/frameworks/angular/src/client/decorateStory.ts b/code/frameworks/angular/src/client/decorateStory.ts index a7816084f23..2338212c739 100644 --- a/code/frameworks/angular/src/client/decorateStory.ts +++ b/code/frameworks/angular/src/client/decorateStory.ts @@ -1,5 +1,5 @@ import { DecoratorFunction, LegacyStoryFn, StoryContext } from '@storybook/types'; -import { sanitizeStoryContextUpdate } from '@storybook/store'; +import { sanitizeStoryContextUpdate } from '@storybook/preview-api'; import { computesTemplateFromComponent } from './angular-beta/ComputesTemplateFromComponent'; import { AngularFramework } from './types'; diff --git a/code/lib/builder-webpack5/templates/virtualModuleModernEntry.js.handlebars b/code/lib/builder-webpack5/templates/virtualModuleModernEntry.js.handlebars index 8162f690832..1d0dbb14b95 100644 --- a/code/lib/builder-webpack5/templates/virtualModuleModernEntry.js.handlebars +++ b/code/lib/builder-webpack5/templates/virtualModuleModernEntry.js.handlebars @@ -1,7 +1,6 @@ import global from 'global'; -import { composeConfigs } from '@storybook/store'; -import { ClientApi, PreviewWeb, addons } from '@storybook/preview-api'; +import { ClientApi, PreviewWeb, addons, composeConfigs } from '@storybook/preview-api'; import { createChannel as createPostMessageChannel } from '@storybook/channel-postmessage'; import { createChannel as createWebSocketChannel } from '@storybook/channel-websocket'; diff --git a/code/lib/core-server/package.json b/code/lib/core-server/package.json index 8b965838aa8..64457f3d485 100644 --- a/code/lib/core-server/package.json +++ b/code/lib/core-server/package.json @@ -43,6 +43,7 @@ "@storybook/csf-tools": "7.0.0-alpha.47", "@storybook/docs-mdx": "0.0.1-canary.12433cf.0", "@storybook/node-logger": "7.0.0-alpha.47", + "@storybook/preview-api": "7.0.0-alpha.47", "@storybook/store": "7.0.0-alpha.47", "@storybook/telemetry": "7.0.0-alpha.47", "@storybook/types": "7.0.0-alpha.47", diff --git a/code/lib/core-server/src/utils/StoryIndexGenerator.ts b/code/lib/core-server/src/utils/StoryIndexGenerator.ts index 2fd5658b68c..5d51e0fb5e7 100644 --- a/code/lib/core-server/src/utils/StoryIndexGenerator.ts +++ b/code/lib/core-server/src/utils/StoryIndexGenerator.ts @@ -19,7 +19,7 @@ import type { StoryId, StoryName, } from '@storybook/types'; -import { userOrAutoTitleFromSpecifier, sortStoriesV7 } from '@storybook/store'; +import { userOrAutoTitleFromSpecifier, sortStoriesV7 } from '@storybook/preview-api'; import { normalizeStoryPath } from '@storybook/core-common'; import { logger } from '@storybook/node-logger'; import { getStorySortParameter, NoMetaError } from '@storybook/csf-tools'; diff --git a/code/lib/docs-tools/package.json b/code/lib/docs-tools/package.json index 83455a4301d..6f7835d5332 100644 --- a/code/lib/docs-tools/package.json +++ b/code/lib/docs-tools/package.json @@ -44,6 +44,7 @@ "dependencies": { "@babel/core": "^7.12.10", "@storybook/core-common": "7.0.0-alpha.47", + "@storybook/preview-api": "7.0.0-alpha.47", "@storybook/store": "7.0.0-alpha.47", "@storybook/types": "7.0.0-alpha.47", "doctrine": "^3.0.0", diff --git a/code/lib/docs-tools/src/argTypes/enhanceArgTypes.ts b/code/lib/docs-tools/src/argTypes/enhanceArgTypes.ts index 62726be0f30..6e7c7b7050b 100644 --- a/code/lib/docs-tools/src/argTypes/enhanceArgTypes.ts +++ b/code/lib/docs-tools/src/argTypes/enhanceArgTypes.ts @@ -1,5 +1,5 @@ import type { AnyFramework, StoryContextForEnhancers } from '@storybook/types'; -import { combineParameters } from '@storybook/store'; +import { combineParameters } from '@storybook/preview-api'; export const enhanceArgTypes = ( context: StoryContextForEnhancers diff --git a/code/lib/preview-api/src/index.ts b/code/lib/preview-api/src/index.ts index 7bf3522671e..3f43c77de44 100644 --- a/code/lib/preview-api/src/index.ts +++ b/code/lib/preview-api/src/index.ts @@ -71,6 +71,12 @@ export const { defaultDecorateStory, prepareStory, normalizeStory, + filterArgTypes, + sanitizeStoryContextUpdate, + setProjectAnnotations, + inferControls, + userOrAutoTitleFromSpecifier, + sortStoriesV7, } = STORE; /** diff --git a/code/renderers/react/src/docs/extractArgTypes.test.ts b/code/renderers/react/src/docs/extractArgTypes.test.ts index 96cb1346097..c867e10a99c 100644 --- a/code/renderers/react/src/docs/extractArgTypes.test.ts +++ b/code/renderers/react/src/docs/extractArgTypes.test.ts @@ -4,7 +4,7 @@ import fs from 'fs'; import requireFromString from 'require-from-string'; import { transformFileSync, transformSync } from '@babel/core'; -import { inferControls } from '@storybook/store'; +import { inferControls } from '@storybook/preview-api'; import type { AnyFramework } from '@storybook/types'; import { normalizeNewlines } from '@storybook/docs-tools'; diff --git a/code/renderers/react/src/testing-api.ts b/code/renderers/react/src/testing-api.ts index 0b655419f33..0cbb579f0a7 100644 --- a/code/renderers/react/src/testing-api.ts +++ b/code/renderers/react/src/testing-api.ts @@ -2,7 +2,7 @@ import { composeStory as originalComposeStory, composeStories as originalComposeStories, setProjectAnnotations as originalSetProjectAnnotations, -} from '@storybook/store'; +} from '@storybook/preview-api'; import type { Args, ProjectAnnotations, diff --git a/code/renderers/svelte/src/decorators.ts b/code/renderers/svelte/src/decorators.ts index 8bbb2d90e17..59bfa9d14c8 100644 --- a/code/renderers/svelte/src/decorators.ts +++ b/code/renderers/svelte/src/decorators.ts @@ -1,5 +1,5 @@ import type { DecoratorFunction, StoryContext, LegacyStoryFn } from '@storybook/types'; -import { sanitizeStoryContextUpdate } from '@storybook/store'; +import { sanitizeStoryContextUpdate } from '@storybook/preview-api'; import SlotDecorator from '../templates/SlotDecorator.svelte'; import type { SvelteFramework } from './types'; diff --git a/code/renderers/vue/src/decorateStory.ts b/code/renderers/vue/src/decorateStory.ts index 6cde549fb8c..ebc8c378497 100644 --- a/code/renderers/vue/src/decorateStory.ts +++ b/code/renderers/vue/src/decorateStory.ts @@ -1,7 +1,7 @@ import type { VueConstructor, ComponentOptions } from 'vue'; import Vue from 'vue'; import type { DecoratorFunction, StoryContext, LegacyStoryFn } from '@storybook/types'; -import { sanitizeStoryContextUpdate } from '@storybook/store'; +import { sanitizeStoryContextUpdate } from '@storybook/preview-api'; import type { StoryFnVueReturnType, VueFramework } from './types'; import { extractProps } from './util'; diff --git a/code/renderers/vue3/src/decorateStory.ts b/code/renderers/vue3/src/decorateStory.ts index c066e21a147..f6cfa70faa2 100644 --- a/code/renderers/vue3/src/decorateStory.ts +++ b/code/renderers/vue3/src/decorateStory.ts @@ -1,7 +1,7 @@ import type { ConcreteComponent, Component, ComponentOptions } from 'vue'; import { h } from 'vue'; import type { DecoratorFunction, StoryContext, LegacyStoryFn } from '@storybook/types'; -import { sanitizeStoryContextUpdate } from '@storybook/store'; +import { sanitizeStoryContextUpdate } from '@storybook/preview-api'; import type { VueFramework } from './types'; diff --git a/code/ui/blocks/src/blocks/ArgsTable.tsx b/code/ui/blocks/src/blocks/ArgsTable.tsx index 3227c104d97..f7d0ee2ec0b 100644 --- a/code/ui/blocks/src/blocks/ArgsTable.tsx +++ b/code/ui/blocks/src/blocks/ArgsTable.tsx @@ -2,7 +2,7 @@ import type { FC } from 'react'; import React, { useContext, useEffect, useState, useCallback } from 'react'; import mapValues from 'lodash/mapValues'; import type { ArgTypesExtractor } from '@storybook/docs-tools'; -import { filterArgTypes } from '@storybook/store'; +import { filterArgTypes } from '@storybook/preview-api'; import type { Store_PropDescriptor, StrictArgTypes, Args, Globals } from '@storybook/types'; import { STORY_ARGS_UPDATED, diff --git a/code/ui/blocks/src/blocks/enhanceSource.ts b/code/ui/blocks/src/blocks/enhanceSource.ts index 704d36abdba..cd96be2d29e 100644 --- a/code/ui/blocks/src/blocks/enhanceSource.ts +++ b/code/ui/blocks/src/blocks/enhanceSource.ts @@ -1,6 +1,5 @@ -import type { Parameters } from '@storybook/types'; -import type { Story } from '@storybook/store'; -import { combineParameters } from '@storybook/store'; +import type { Parameters, Store_Story } from '@storybook/types'; +import { combineParameters } from '@storybook/preview-api'; // ============================================================ // START @storybook/source-loader/extract-source @@ -77,7 +76,7 @@ const extract = (targetId: string, { source, locationsMap }: StorySource) => { return extractSource(location, lines); }; -export const enhanceSource = (story: Story): Parameters => { +export const enhanceSource = (story: Store_Story): Parameters => { const { id, parameters } = story; const { storySource, docs = {} } = parameters; const { transformSource } = docs; diff --git a/code/ui/blocks/src/blocks/external/ExternalDocs.tsx b/code/ui/blocks/src/blocks/external/ExternalDocs.tsx index a4ac09145b4..474a4e7ffad 100644 --- a/code/ui/blocks/src/blocks/external/ExternalDocs.tsx +++ b/code/ui/blocks/src/blocks/external/ExternalDocs.tsx @@ -1,7 +1,7 @@ import type { FunctionComponent } from 'react'; import React, { useRef } from 'react'; import type { AnyFramework, ProjectAnnotations } from '@storybook/types'; -import { composeConfigs } from '@storybook/store'; +import { composeConfigs } from '@storybook/preview-api'; import { Docs } from '../Docs'; import { ExternalPreview } from './ExternalPreview'; diff --git a/code/ui/blocks/src/blocks/external/ExternalDocsContext.ts b/code/ui/blocks/src/blocks/external/ExternalDocsContext.ts index dbe6a5d9cec..e3cc6f6a2f0 100644 --- a/code/ui/blocks/src/blocks/external/ExternalDocsContext.ts +++ b/code/ui/blocks/src/blocks/external/ExternalDocsContext.ts @@ -6,7 +6,7 @@ import type { DocsContextProps, } from '@storybook/types'; import { DocsContext } from '@storybook/preview-api'; -import type { StoryStore } from '@storybook/store'; +import type { StoryStore } from '@storybook/preview-api'; import type { Channel } from '@storybook/channels'; export class ExternalDocsContext extends DocsContext { diff --git a/code/ui/blocks/src/blocks/external/ExternalPreview.ts b/code/ui/blocks/src/blocks/external/ExternalPreview.ts index 1e4d7f8202f..14567fe5731 100644 --- a/code/ui/blocks/src/blocks/external/ExternalPreview.ts +++ b/code/ui/blocks/src/blocks/external/ExternalPreview.ts @@ -1,4 +1,4 @@ -import { Preview } from '@storybook/preview-api'; +import { Preview, composeConfigs } from '@storybook/preview-api'; import type { AnyFramework, ComponentTitle, @@ -7,7 +7,6 @@ import type { Store_ModuleExports, Store_StoryIndex, } from '@storybook/types'; -import { composeConfigs } from '@storybook/store'; import { Channel } from '@storybook/channels'; import { ExternalDocsContext } from './ExternalDocsContext'; diff --git a/code/ui/manager/src/globals/exports.ts b/code/ui/manager/src/globals/exports.ts index 06e3e89fde6..0bb4e9000a9 100644 --- a/code/ui/manager/src/globals/exports.ts +++ b/code/ui/manager/src/globals/exports.ts @@ -241,14 +241,19 @@ export default { 'composeStory', 'decorateStory', 'defaultDecorateStory', + 'filterArgTypes', 'getQueryParam', 'getQueryParams', + 'inferControls', 'makeDecorator', 'normalizeStory', 'prepareStory', + 'sanitizeStoryContextUpdate', 'setGlobalRender', + 'setProjectAnnotations', 'simulateDOMContentLoaded', 'simulatePageLoad', + 'sortStoriesV7', 'start', 'useArgs', 'useCallback', @@ -261,6 +266,7 @@ export default { 'useRef', 'useState', 'useStoryContext', + 'userOrAutoTitleFromSpecifier', ], '@storybook/client-logger': ['deprecate', 'logger', 'once', 'pretty'], } as const; diff --git a/code/yarn.lock b/code/yarn.lock index 8fe83332bf2..e156472110c 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -6576,6 +6576,7 @@ __metadata: "@storybook/csf-tools": 7.0.0-alpha.47 "@storybook/docs-mdx": 0.0.1-canary.12433cf.0 "@storybook/node-logger": 7.0.0-alpha.47 + "@storybook/preview-api": 7.0.0-alpha.47 "@storybook/store": 7.0.0-alpha.47 "@storybook/telemetry": 7.0.0-alpha.47 "@storybook/types": 7.0.0-alpha.47 @@ -6717,6 +6718,7 @@ __metadata: dependencies: "@babel/core": ^7.12.10 "@storybook/core-common": 7.0.0-alpha.47 + "@storybook/preview-api": 7.0.0-alpha.47 "@storybook/store": 7.0.0-alpha.47 "@storybook/types": 7.0.0-alpha.47 doctrine: ^3.0.0 diff --git a/scripts/tasks/compile.ts b/scripts/tasks/compile.ts index 03cb0378aff..21f08a9ecee 100644 --- a/scripts/tasks/compile.ts +++ b/scripts/tasks/compile.ts @@ -17,7 +17,7 @@ export const compile: Task = { async ready({ codeDir }, { link }) { try { // To check if the code has been compiled as we need, we check the compiled output of - // `@storybook/store`. To check if it has been built for publishing (i.e. `--no-link`), + // `@storybook/preview`. To check if it has been built for publishing (i.e. `--no-link`), // we check if it built types or references source files directly. const contents = await readFile(resolve(codeDir, './lib/preview/dist/index.d.ts'), 'utf8'); const isLinkedContents = contents.indexOf(linkedContents) !== -1; diff --git a/scripts/tasks/sandbox-parts.ts b/scripts/tasks/sandbox-parts.ts index 5d0530567e0..41340932b40 100644 --- a/scripts/tasks/sandbox-parts.ts +++ b/scripts/tasks/sandbox-parts.ts @@ -6,11 +6,12 @@ import { copy, ensureSymlink, ensureDir, existsSync, pathExists } from 'fs-extra import { join, resolve, sep } from 'path'; import dedent from 'ts-dedent'; -import { Task } from '../task'; +import type { Task } from '../task'; import { executeCLIStep, steps } from '../utils/cli-step'; import { installYarn2, configureYarn2ForVerdaccio, addPackageResolutions } from '../utils/yarn'; import { exec } from '../utils/exec'; -import { ConfigFile, writeConfig } from '../../code/lib/csf-tools'; +import type { ConfigFile } from '../../code/lib/csf-tools'; +import { writeConfig } from '../../code/lib/csf-tools'; import { filterExistsInCodeDir } from '../utils/filterExistsInCodeDir'; import { findFirstPath } from '../utils/paths'; import { detectLanguage } from '../../code/lib/cli/src/detect'; @@ -342,7 +343,7 @@ export const addStories: Task['run'] = async ( // Add stories for lib/store (and addons below). NOTE: these stories will be in the // template-stories folder and *not* processed by the framework build config (instead by esbuild-loader) - await linkPackageStories(await workspacePath('core package', '@storybook/store'), { + await linkPackageStories(await workspacePath('core package', '@storybook/preview-api'), { mainConfig, cwd, }); From ed15e7cfcb63d83e47103677ef85397d7b007990 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Thu, 3 Nov 2022 19:38:24 +0100 Subject: [PATCH 09/47] fixes --- code/addons/a11y/src/manager.tsx | 2 +- code/addons/actions/src/manager.tsx | 2 +- code/addons/backgrounds/src/manager.tsx | 2 +- code/addons/controls/src/manager.tsx | 2 +- code/addons/docs/src/DocsRenderer.tsx | 8 +++- code/addons/interactions/src/manager.tsx | 2 +- code/addons/jest/src/manager.tsx | 2 +- code/addons/measure/src/manager.tsx | 2 +- code/addons/outline/src/manager.tsx | 2 +- .../storyshots-core/src/api/index.ts | 2 +- code/addons/storysource/src/manager.tsx | 2 +- code/addons/toolbars/src/manager.tsx | 2 +- code/addons/viewport/src/manager.tsx | 2 +- code/lib/addons/src/make-decorator.ts | 4 +- code/lib/preview-api/package.json | 1 - code/lib/preview-api/src/index.ts | 38 ++++++++----------- .../src/docs-context/DocsRenderFunction.ts | 10 +---- code/lib/types/package.json | 1 + code/lib/types/src/modules/docs.ts | 9 ++++- code/ui/manager/src/runtime.ts | 4 +- code/yarn.lock | 9 ++++- 21 files changed, 57 insertions(+), 51 deletions(-) diff --git a/code/addons/a11y/src/manager.tsx b/code/addons/a11y/src/manager.tsx index f7ae42e5243..3d863b3eb1b 100644 --- a/code/addons/a11y/src/manager.tsx +++ b/code/addons/a11y/src/manager.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { addons, types } from '@storybook/preview-api'; +import { addons, types } from '@storybook/addons'; import { ADDON_ID, PANEL_ID, PARAM_KEY } from './constants'; import { VisionSimulator } from './components/VisionSimulator'; import { A11YPanel } from './components/A11YPanel'; diff --git a/code/addons/actions/src/manager.tsx b/code/addons/actions/src/manager.tsx index 75e288ac907..bd024620ac5 100644 --- a/code/addons/actions/src/manager.tsx +++ b/code/addons/actions/src/manager.tsx @@ -1,5 +1,5 @@ import React, { useState, useEffect } from 'react'; -import { addons, types } from '@storybook/preview-api'; +import { addons, types } from '@storybook/addons'; import { STORY_CHANGED } from '@storybook/core-events'; import ActionLogger from './containers/ActionLogger'; import { ADDON_ID, EVENT_ID, PANEL_ID, PARAM_KEY } from './constants'; diff --git a/code/addons/backgrounds/src/manager.tsx b/code/addons/backgrounds/src/manager.tsx index 0ca6932cd83..d3b8d095ec9 100644 --- a/code/addons/backgrounds/src/manager.tsx +++ b/code/addons/backgrounds/src/manager.tsx @@ -1,5 +1,5 @@ import React, { Fragment } from 'react'; -import { addons, types } from '@storybook/preview-api'; +import { addons, types } from '@storybook/addons'; import { ADDON_ID } from './constants'; import { BackgroundSelector } from './containers/BackgroundSelector'; diff --git a/code/addons/controls/src/manager.tsx b/code/addons/controls/src/manager.tsx index 64e2c1a541a..f76dfaf83e9 100644 --- a/code/addons/controls/src/manager.tsx +++ b/code/addons/controls/src/manager.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { addons, types } from '@storybook/preview-api'; +import { addons, types } from '@storybook/addons'; import { AddonPanel } from '@storybook/components'; import { type API, useArgTypes } from '@storybook/api'; import { ControlsPanel } from './ControlsPanel'; diff --git a/code/addons/docs/src/DocsRenderer.tsx b/code/addons/docs/src/DocsRenderer.tsx index 6465e75311b..d5110ef4d1b 100644 --- a/code/addons/docs/src/DocsRenderer.tsx +++ b/code/addons/docs/src/DocsRenderer.tsx @@ -1,7 +1,11 @@ import React from 'react'; import ReactDOM from 'react-dom'; -import type { AnyFramework, Parameters } from '@storybook/types'; -import type { DocsContextProps, DocsRenderFunction } from '@storybook/preview-api'; +import type { + AnyFramework, + Parameters, + DocsContextProps, + DocsRenderFunction, +} from '@storybook/types'; import { components as htmlComponents } from '@storybook/components'; import { Docs, CodeOrSourceMdx, AnchorMdx, HeadersMdx } from '@storybook/blocks'; import { MDXProvider } from '@mdx-js/react'; diff --git a/code/addons/interactions/src/manager.tsx b/code/addons/interactions/src/manager.tsx index bd36869a9c5..454945d6c44 100644 --- a/code/addons/interactions/src/manager.tsx +++ b/code/addons/interactions/src/manager.tsx @@ -1,4 +1,4 @@ -import { addons, types } from '@storybook/preview-api'; +import { addons, types } from '@storybook/addons'; import { ADDON_ID, PANEL_ID } from './constants'; import { Panel } from './Panel'; diff --git a/code/addons/jest/src/manager.tsx b/code/addons/jest/src/manager.tsx index c5a5cd26ae6..19a1e46f115 100644 --- a/code/addons/jest/src/manager.tsx +++ b/code/addons/jest/src/manager.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import { addons } from '@storybook/preview-api'; +import { addons } from '@storybook/addons'; import { ADDON_ID, PANEL_ID, PARAM_KEY } from './shared'; import Panel from './components/Panel'; diff --git a/code/addons/measure/src/manager.tsx b/code/addons/measure/src/manager.tsx index 026c530a1f6..162e7ce43ec 100644 --- a/code/addons/measure/src/manager.tsx +++ b/code/addons/measure/src/manager.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { addons, types } from '@storybook/preview-api'; +import { addons, types } from '@storybook/addons'; import { ADDON_ID, TOOL_ID } from './constants'; import { Tool } from './Tool'; diff --git a/code/addons/outline/src/manager.tsx b/code/addons/outline/src/manager.tsx index b0bf0f20ca5..3f3f96ae3b0 100644 --- a/code/addons/outline/src/manager.tsx +++ b/code/addons/outline/src/manager.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { addons, types } from '@storybook/preview-api'; +import { addons, types } from '@storybook/addons'; import { ADDON_ID } from './constants'; import { OutlineSelector } from './OutlineSelector'; diff --git a/code/addons/storyshots/storyshots-core/src/api/index.ts b/code/addons/storyshots/storyshots-core/src/api/index.ts index c05c2f23a21..ae22540ccc9 100644 --- a/code/addons/storyshots/storyshots-core/src/api/index.ts +++ b/code/addons/storyshots/storyshots-core/src/api/index.ts @@ -1,5 +1,5 @@ import global from 'global'; -import { addons, mockChannel } from '@storybook/preview-api'; +import { addons, mockChannel } from '@storybook/addons'; import ensureOptionsDefaults from './ensureOptionsDefaults'; import snapshotsTests from './snapshotsTestsTemplate'; import integrityTest from './integrityTestTemplate'; diff --git a/code/addons/storysource/src/manager.tsx b/code/addons/storysource/src/manager.tsx index 8c4f04dc8a6..7de7e8845f0 100644 --- a/code/addons/storysource/src/manager.tsx +++ b/code/addons/storysource/src/manager.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { addons } from '@storybook/preview-api'; +import { addons } from '@storybook/addons'; import { StoryPanel } from './StoryPanel'; import { ADDON_ID, PANEL_ID } from './index'; diff --git a/code/addons/toolbars/src/manager.tsx b/code/addons/toolbars/src/manager.tsx index 54b233c57f4..c6681e98935 100644 --- a/code/addons/toolbars/src/manager.tsx +++ b/code/addons/toolbars/src/manager.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { addons, types } from '@storybook/preview-api'; +import { addons, types } from '@storybook/addons'; import { ToolbarManager } from './components/ToolbarManager'; import { ADDON_ID } from './constants'; diff --git a/code/addons/viewport/src/manager.tsx b/code/addons/viewport/src/manager.tsx index e5a4810a073..81b1b17e588 100644 --- a/code/addons/viewport/src/manager.tsx +++ b/code/addons/viewport/src/manager.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import { addons, types } from '@storybook/preview-api'; +import { addons, types } from '@storybook/addons'; import { ADDON_ID } from './constants'; diff --git a/code/lib/addons/src/make-decorator.ts b/code/lib/addons/src/make-decorator.ts index e96505e4be1..8735eeda006 100644 --- a/code/lib/addons/src/make-decorator.ts +++ b/code/lib/addons/src/make-decorator.ts @@ -1,8 +1,8 @@ import type { Addon_StoryWrapper, Addon_LegacyStoryFn, Addon_StoryContext } from '@storybook/types'; -type MakeDecoratorResult = (...args: any) => any; +export type MakeDecoratorResult = (...args: any) => any; -interface MakeDecoratorOptions { +export interface MakeDecoratorOptions { name: string; parameterName: string; skipIfNoParametersOrOptions?: boolean; diff --git a/code/lib/preview-api/package.json b/code/lib/preview-api/package.json index b09bd46cc70..5e7698b1be7 100644 --- a/code/lib/preview-api/package.json +++ b/code/lib/preview-api/package.json @@ -45,7 +45,6 @@ "@storybook/addons": "7.0.0-alpha.47", "@storybook/client-api": "7.0.0-alpha.47", "@storybook/core-client": "7.0.0-alpha.47", - "@storybook/preview-api": "7.0.0-alpha.47", "@storybook/preview-web": "7.0.0-alpha.47", "@storybook/store": "7.0.0-alpha.47" }, diff --git a/code/lib/preview-api/src/index.ts b/code/lib/preview-api/src/index.ts index 3f43c77de44..099bd5cf6bc 100644 --- a/code/lib/preview-api/src/index.ts +++ b/code/lib/preview-api/src/index.ts @@ -1,13 +1,7 @@ -import * as ADDONS from '@storybook/addons'; -import * as CLIENT_API from '@storybook/client-api'; -import * as CORE_CLIENT from '@storybook/core-client'; -import * as PREVIEW_WEB from '@storybook/preview-web'; -import * as STORE from '@storybook/store'; - /** * HOOKS API */ -export const { +export { useArgs, useCallback, useChannel, @@ -21,33 +15,33 @@ export const { useStoryContext, applyHooks, HooksContext, -} = ADDONS; +} from '@storybook/addons'; /** * DECORATORS API */ -export const { makeDecorator } = ADDONS; +export { makeDecorator } from '@storybook/addons'; /** * ADDON API * @deprecated */ -export const { addons } = ADDONS; +export { addons } from '@storybook/addons'; /** * DOCS API */ -export const { DocsContext } = PREVIEW_WEB; +export { DocsContext } from '@storybook/preview-web'; /** * SIMULATION API */ -export const { simulatePageLoad, simulateDOMContentLoaded } = PREVIEW_WEB; +export { simulatePageLoad, simulateDOMContentLoaded } from '@storybook/preview-web'; /** * STORIES API */ -export const { +export { addArgTypes, addArgTypesEnhancer, addArgs, @@ -56,11 +50,11 @@ export const { addLoader, addParameters, addStepRunner, -} = CLIENT_API; -export const { getQueryParam, getQueryParams } = CLIENT_API; -export const { setGlobalRender } = CLIENT_API; +} from '@storybook/client-api'; +export { getQueryParam, getQueryParams } from '@storybook/client-api'; +export { setGlobalRender } from '@storybook/client-api'; -export const { +export { combineArgs, combineParameters, composeConfigs, @@ -77,12 +71,12 @@ export const { inferControls, userOrAutoTitleFromSpecifier, sortStoriesV7, -} = STORE; +} from '@storybook/store'; /** * STORIES API */ -export const { ClientApi } = CLIENT_API; -export const { StoryStore } = STORE; -export const { Preview, PreviewWeb } = PREVIEW_WEB; -export const { start } = CORE_CLIENT; +export { ClientApi } from '@storybook/client-api'; +export { StoryStore } from '@storybook/store'; +export { Preview, PreviewWeb } from '@storybook/preview-web'; +export { start } from '@storybook/core-client'; diff --git a/code/lib/preview-web/src/docs-context/DocsRenderFunction.ts b/code/lib/preview-web/src/docs-context/DocsRenderFunction.ts index 5c2bd9792cf..819b7e8607e 100644 --- a/code/lib/preview-web/src/docs-context/DocsRenderFunction.ts +++ b/code/lib/preview-web/src/docs-context/DocsRenderFunction.ts @@ -1,9 +1,3 @@ -import type { AnyFramework, Parameters } from '@storybook/types'; -import type { DocsContextProps } from './DocsContextProps'; +import type { DocsRenderFunction } from '@storybook/types'; -export type DocsRenderFunction = ( - docsContext: DocsContextProps, - docsParameters: Parameters, - element: HTMLElement, - callback: () => void -) => void; +export type { DocsRenderFunction }; diff --git a/code/lib/types/package.json b/code/lib/types/package.json index 3c837664f5e..dedaddc4a37 100644 --- a/code/lib/types/package.json +++ b/code/lib/types/package.json @@ -41,6 +41,7 @@ }, "dependencies": { "@babel/core": "^7.12.10", + "@storybook/channels": "next", "@types/babel__core": "^7.0.0", "@types/express": "^4.7.0", "express": "^4.17.1", diff --git a/code/lib/types/src/modules/docs.ts b/code/lib/types/src/modules/docs.ts index 74c2e610817..8ae9a12840d 100644 --- a/code/lib/types/src/modules/docs.ts +++ b/code/lib/types/src/modules/docs.ts @@ -1,5 +1,5 @@ import type { Channel } from '@storybook/channels'; -import type { AnyFramework, StoryContextForLoaders, StoryId, StoryName } from './csf'; +import type { AnyFramework, StoryContextForLoaders, StoryId, StoryName, Parameters } from './csf'; import type { Store_ModuleExport, Store_ModuleExports, Store_Story } from './store'; export interface DocsContextProps { @@ -55,3 +55,10 @@ export interface DocsContextProps = ( + docsContext: DocsContextProps, + docsParameters: Parameters, + element: HTMLElement, + callback: () => void +) => void; diff --git a/code/ui/manager/src/runtime.ts b/code/ui/manager/src/runtime.ts index 2fd9d4a72c2..81754fd9967 100644 --- a/code/ui/manager/src/runtime.ts +++ b/code/ui/manager/src/runtime.ts @@ -1,8 +1,8 @@ import global from 'global'; import type { Channel } from '@storybook/channels'; -import type { AddonStore } from '@storybook/preview-api'; -import { addons } from '@storybook/preview-api'; +import type { AddonStore } from '@storybook/addons'; +import { addons } from '@storybook/addons'; import type { Addon_Types, Addon_Config } from '@storybook/types'; import * as postMessage from '@storybook/channel-postmessage'; import * as webSocket from '@storybook/channel-websocket'; diff --git a/code/yarn.lock b/code/yarn.lock index e156472110c..7ba0a5291fa 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -6329,6 +6329,13 @@ __metadata: languageName: node linkType: hard +"@storybook/channels@npm:next": + version: 7.0.0-alpha.47 + resolution: "@storybook/channels@npm:7.0.0-alpha.47" + checksum: 089aac0bb8a3a0fa2d60360adea1342593acb61e1a4faeb48e9c8b82a8ec3e0df721b0720b614fcf9a72cc7868865067ba6fed07df4ccde7c3ca4d8c07651a45 + languageName: node + linkType: hard + "@storybook/cli@7.0.0-alpha.47, @storybook/cli@workspace:*, @storybook/cli@workspace:lib/cli": version: 0.0.0-use.local resolution: "@storybook/cli@workspace:lib/cli" @@ -7267,7 +7274,6 @@ __metadata: "@storybook/addons": 7.0.0-alpha.47 "@storybook/client-api": 7.0.0-alpha.47 "@storybook/core-client": 7.0.0-alpha.47 - "@storybook/preview-api": 7.0.0-alpha.47 "@storybook/preview-web": 7.0.0-alpha.47 "@storybook/store": 7.0.0-alpha.47 languageName: unknown @@ -7978,6 +7984,7 @@ __metadata: resolution: "@storybook/types@workspace:lib/types" dependencies: "@babel/core": ^7.12.10 + "@storybook/channels": next "@storybook/csf": next "@types/babel__core": ^7.0.0 "@types/express": ^4.7.0 From e7e4395bc00c6ec69167396deb3376b621e53f74 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Thu, 3 Nov 2022 21:54:35 +0100 Subject: [PATCH 10/47] wip --- code/lib/client-api/package.json | 35 ++----- code/lib/client-api/src/entry.ts | 1 + code/lib/core-client/package.json | 36 ++------ code/lib/core-client/src/entry.ts | 1 + code/lib/core-client/src/index.ts | 5 - code/lib/preview-api/package.json | 45 ++++++++- code/lib/preview-api/src/client-api.ts | 1 + code/lib/preview-api/src/core-client.ts | 1 + code/lib/preview-api/src/index.ts | 20 ++-- .../src/modules/client-api}/ClientApi.test.ts | 0 .../src/modules/client-api}/ClientApi.ts | 27 +++--- .../modules/client-api}/StoryStoreFacade.ts | 49 +++++----- .../src/modules/client-api}/index.ts | 0 .../src/modules/client-api}/queryparams.ts | 0 .../src/modules/client-api}/typings.d.ts | 0 .../core-client}/PreviewWeb.mockdata.ts | 0 .../modules/core-client}/executeLoadable.ts | 0 .../src/modules/core-client/index.ts | 5 + .../src/modules/core-client}/start.test.ts | 10 +- .../src/modules/core-client}/start.ts | 4 +- .../src/modules/core-client}/typings.d.ts | 0 .../src/modules/preview-web}/Preview.tsx | 2 +- .../PreviewWeb.integration.test.ts | 0 .../preview-web}/PreviewWeb.mockdata.ts | 0 .../modules/preview-web}/PreviewWeb.test.ts | 2 +- .../src/modules/preview-web}/PreviewWeb.tsx | 0 .../src/modules/preview-web}/UrlStore.test.ts | 0 .../src/modules/preview-web}/UrlStore.ts | 0 .../src/modules/preview-web}/WebView.ts | 0 .../preview-web}/docs-context/DocsContext.ts | 2 +- .../docs-context/DocsContextProps.ts | 0 .../docs-context/DocsRenderFunction.ts | 0 .../src/modules/preview-web}/index.ts | 2 +- .../preview-web}/parseArgsParam.test.ts | 0 .../modules/preview-web}/parseArgsParam.ts | 0 .../src/modules/preview-web}/render/Render.ts | 0 .../render/StandaloneDocsRender.test.ts | 2 +- .../render/StandaloneDocsRender.ts | 2 +- .../preview-web}/render/StoryRender.test.ts | 2 +- .../preview-web}/render/StoryRender.ts | 2 +- .../render/TemplateDocsRender.test.ts | 2 +- .../preview-web}/render/TemplateDocsRender.ts | 2 +- .../preview-web}/simulate-pageload.test.ts | 0 .../modules/preview-web}/simulate-pageload.ts | 0 .../src/modules/preview-web}/typings.d.ts | 0 .../src/modules/store}/ArgsStore.test.ts | 0 .../src/modules/store}/ArgsStore.ts | 0 .../src/modules/store}/GlobalsStore.test.ts | 0 .../src/modules/store}/GlobalsStore.ts | 0 .../modules/store}/StoryIndexStore.test.ts | 0 .../src/modules/store}/StoryIndexStore.ts | 0 .../src/modules/store}/StoryStore.test.ts | 0 .../src/modules/store}/StoryStore.ts | 0 .../src/modules/store}/args.test.ts | 0 .../src/modules/store}/args.ts | 0 .../src/modules/store}/autoTitle.test.ts | 0 .../src/modules/store}/autoTitle.ts | 0 .../modules/store}/csf/composeConfigs.test.ts | 0 .../src/modules/store}/csf/composeConfigs.ts | 0 .../store}/csf/getValuesFromArgTypes.ts | 0 .../src/modules/store}/csf/index.ts | 0 .../csf/normalizeComponentAnnotations.ts | 0 .../store}/csf/normalizeInputTypes.test.ts | 0 .../modules/store}/csf/normalizeInputTypes.ts | 0 .../store}/csf/normalizeProjectAnnotations.ts | 0 .../modules/store}/csf/normalizeStory.test.ts | 0 .../src/modules/store}/csf/normalizeStory.ts | 0 .../modules/store}/csf/prepareStory.test.ts | 0 .../src/modules/store}/csf/prepareStory.ts | 0 .../modules/store}/csf/processCSFFile.test.ts | 0 .../src/modules/store}/csf/processCSFFile.ts | 0 .../modules/store}/csf/stepRunners.test.ts | 0 .../src/modules/store}/csf/stepRunners.ts | 0 .../store}/csf/testing-utils/index.test.ts | 0 .../modules/store}/csf/testing-utils/index.ts | 0 .../src/modules/store}/decorators.test.ts | 0 .../src/modules/store}/decorators.ts | 0 .../src/modules/store}/filterArgTypes.ts | 0 .../src/modules/store}/hooks.test.ts | 0 .../src/modules/store}/hooks.ts | 0 .../src/modules/store}/index.ts | 0 .../src/modules/store}/inferArgTypes.test.ts | 0 .../src/modules/store}/inferArgTypes.ts | 0 .../src/modules/store}/inferControls.test.ts | 0 .../src/modules/store}/inferControls.ts | 0 .../src/modules/store}/parameters.test.ts | 0 .../src/modules/store}/parameters.ts | 0 .../src/modules/store}/sortStories.ts | 0 .../src/modules/store}/storySort.test.ts | 0 .../src/modules/store}/storySort.ts | 0 .../src/modules/store}/typings.d.ts | 0 code/lib/preview-api/src/preview-web.ts | 1 + code/lib/preview-api/src/store.ts | 1 + code/lib/preview-web/package.json | 37 ++------ code/lib/preview-web/src/entry.ts | 1 + code/lib/store/package.json | 35 ++----- code/lib/store/src/entry.ts | 1 + code/yarn.lock | 91 ++++--------------- 98 files changed, 170 insertions(+), 257 deletions(-) create mode 100644 code/lib/client-api/src/entry.ts create mode 100644 code/lib/core-client/src/entry.ts delete mode 100644 code/lib/core-client/src/index.ts create mode 100644 code/lib/preview-api/src/client-api.ts create mode 100644 code/lib/preview-api/src/core-client.ts rename code/lib/{client-api/src => preview-api/src/modules/client-api}/ClientApi.test.ts (100%) rename code/lib/{client-api/src => preview-api/src/modules/client-api}/ClientApi.ts (94%) rename code/lib/{client-api/src => preview-api/src/modules/client-api}/StoryStoreFacade.ts (87%) rename code/lib/{client-api/src => preview-api/src/modules/client-api}/index.ts (100%) rename code/lib/{client-api/src => preview-api/src/modules/client-api}/queryparams.ts (100%) rename code/lib/{client-api/src => preview-api/src/modules/client-api}/typings.d.ts (100%) rename code/lib/{core-client/src => preview-api/src/modules/core-client}/PreviewWeb.mockdata.ts (100%) rename code/lib/{core-client/src => preview-api/src/modules/core-client}/executeLoadable.ts (100%) create mode 100644 code/lib/preview-api/src/modules/core-client/index.ts rename code/lib/{core-client/src => preview-api/src/modules/core-client}/start.test.ts (99%) rename code/lib/{core-client/src => preview-api/src/modules/core-client}/start.ts (97%) rename code/lib/{core-client/src => preview-api/src/modules/core-client}/typings.d.ts (100%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/Preview.tsx (99%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/PreviewWeb.integration.test.ts (100%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/PreviewWeb.mockdata.ts (100%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/PreviewWeb.test.ts (99%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/PreviewWeb.tsx (100%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/UrlStore.test.ts (100%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/UrlStore.ts (100%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/WebView.ts (100%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/docs-context/DocsContext.ts (98%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/docs-context/DocsContextProps.ts (100%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/docs-context/DocsRenderFunction.ts (100%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/index.ts (91%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/parseArgsParam.test.ts (100%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/parseArgsParam.ts (100%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/render/Render.ts (100%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/render/StandaloneDocsRender.test.ts (96%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/render/StandaloneDocsRender.ts (98%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/render/StoryRender.test.ts (96%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/render/StoryRender.ts (99%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/render/TemplateDocsRender.test.ts (96%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/render/TemplateDocsRender.ts (98%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/simulate-pageload.test.ts (100%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/simulate-pageload.ts (100%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/typings.d.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/ArgsStore.test.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/ArgsStore.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/GlobalsStore.test.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/GlobalsStore.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/StoryIndexStore.test.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/StoryIndexStore.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/StoryStore.test.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/StoryStore.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/args.test.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/args.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/autoTitle.test.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/autoTitle.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/csf/composeConfigs.test.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/csf/composeConfigs.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/csf/getValuesFromArgTypes.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/csf/index.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/csf/normalizeComponentAnnotations.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/csf/normalizeInputTypes.test.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/csf/normalizeInputTypes.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/csf/normalizeProjectAnnotations.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/csf/normalizeStory.test.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/csf/normalizeStory.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/csf/prepareStory.test.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/csf/prepareStory.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/csf/processCSFFile.test.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/csf/processCSFFile.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/csf/stepRunners.test.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/csf/stepRunners.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/csf/testing-utils/index.test.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/csf/testing-utils/index.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/decorators.test.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/decorators.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/filterArgTypes.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/hooks.test.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/hooks.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/index.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/inferArgTypes.test.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/inferArgTypes.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/inferControls.test.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/inferControls.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/parameters.test.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/parameters.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/sortStories.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/storySort.test.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/storySort.ts (100%) rename code/lib/{store/src => preview-api/src/modules/store}/typings.d.ts (100%) create mode 100644 code/lib/preview-api/src/preview-web.ts create mode 100644 code/lib/preview-api/src/store.ts create mode 100644 code/lib/preview-web/src/entry.ts create mode 100644 code/lib/store/src/entry.ts diff --git a/code/lib/client-api/package.json b/code/lib/client-api/package.json index b0a7d82c24e..64dac4f9aac 100644 --- a/code/lib/client-api/package.json +++ b/code/lib/client-api/package.json @@ -22,15 +22,15 @@ "sideEffects": false, "exports": { ".": { - "require": "./dist/index.js", - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts" + "require": "./dist/entry.js", + "import": "./dist/entry.mjs", + "types": "./dist/entry.d.ts" }, "./package.json": "./package.json" }, - "main": "dist/index.js", - "module": "dist/index.mjs", - "types": "dist/index.d.ts", + "main": "dist/entry.js", + "module": "dist/entry.mjs", + "types": "dist/entry.d.ts", "files": [ "dist/**/*", "README.md", @@ -42,33 +42,14 @@ "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { - "@storybook/addons": "7.0.0-alpha.47", - "@storybook/client-logger": "7.0.0-alpha.47", - "@storybook/csf": "next", - "@storybook/store": "7.0.0-alpha.47", - "@storybook/types": "7.0.0-alpha.47", - "@types/qs": "^6.9.5", - "@types/webpack-env": "^1.16.4", - "global": "^4.4.0", - "qs": "^6.10.0", - "synchronous-promise": "^2.0.15", - "ts-dedent": "^2.0.0", - "util-deprecate": "^1.0.2" - }, - "devDependencies": { - "@storybook/core-common": "7.0.0-alpha.47", - "typescript": "~4.6.3" - }, - "peerDependencies": { - "react": "^16.8.0 || ^17.0.0 || ^18.0.0", - "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0" + "@storybook/preview-api": "7.0.0-alpha.47" }, "publishConfig": { "access": "public" }, "bundler": { "entries": [ - "./src/index.ts" + "./src/entry.ts" ] }, "gitHead": "1c706a4a778831e012343c905f86225fa71491a7" diff --git a/code/lib/client-api/src/entry.ts b/code/lib/client-api/src/entry.ts new file mode 100644 index 00000000000..7d0286b54ea --- /dev/null +++ b/code/lib/client-api/src/entry.ts @@ -0,0 +1 @@ +export * from '@storybook/preview-api/dist/client-api'; diff --git a/code/lib/core-client/package.json b/code/lib/core-client/package.json index 838bd92a813..4f6845eaff7 100644 --- a/code/lib/core-client/package.json +++ b/code/lib/core-client/package.json @@ -21,48 +21,28 @@ "license": "MIT", "exports": { ".": { - "require": "./dist/index.js", - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts" + "require": "./dist/entry.js", + "import": "./dist/entry.mjs", + "types": "./dist/entry.d.ts" }, "./package.json": "./package.json" }, - "main": "dist/index.js", - "module": "dist/index.mjs", - "types": "dist/index.d.ts", + "main": "dist/entry.js", + "module": "dist/entry.mjs", + "types": "dist/entry.d.ts", "scripts": { "check": "../../../scripts/node_modules/.bin/tsc --noEmit", "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { - "@storybook/addons": "7.0.0-alpha.47", - "@storybook/channel-postmessage": "7.0.0-alpha.47", - "@storybook/channel-websocket": "7.0.0-alpha.47", - "@storybook/channels": "7.0.0-alpha.47", - "@storybook/client-api": "7.0.0-alpha.47", - "@storybook/client-logger": "7.0.0-alpha.47", - "@storybook/core-events": "7.0.0-alpha.47", - "@storybook/csf": "next", - "@storybook/preview-web": "7.0.0-alpha.47", - "@storybook/store": "7.0.0-alpha.47", - "@storybook/types": "7.0.0-alpha.47", - "global": "^4.4.0", - "util-deprecate": "^1.0.2" - }, - "devDependencies": { - "typescript": "~4.6.3" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } + "@storybook/preview-api": "7.0.0-alpha.47" }, "publishConfig": { "access": "public" }, "bundler": { "entries": [ - "./src/index.ts" + "./src/entry.ts" ] }, "gitHead": "1c706a4a778831e012343c905f86225fa71491a7" diff --git a/code/lib/core-client/src/entry.ts b/code/lib/core-client/src/entry.ts new file mode 100644 index 00000000000..ba915a18f53 --- /dev/null +++ b/code/lib/core-client/src/entry.ts @@ -0,0 +1 @@ +export * from '@storybook/preview-api/dist/core-client'; diff --git a/code/lib/core-client/src/index.ts b/code/lib/core-client/src/index.ts deleted file mode 100644 index 23c8d04e27e..00000000000 --- a/code/lib/core-client/src/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { ClientApi } from '@storybook/client-api'; -import { StoryStore } from '@storybook/store'; -import { start } from './start'; - -export { start, ClientApi, StoryStore }; diff --git a/code/lib/preview-api/package.json b/code/lib/preview-api/package.json index 5e7698b1be7..d2b283db2d3 100644 --- a/code/lib/preview-api/package.json +++ b/code/lib/preview-api/package.json @@ -26,6 +26,26 @@ "require": "./dist/index.js", "types": "./dist/index.d.ts" }, + "./dist/store": { + "import": "./dist/store.mjs", + "require": "./dist/store.js", + "types": "./dist/store.d.ts" + }, + "./dist/client-api": { + "import": "./dist/client-api.mjs", + "require": "./dist/client-api.js", + "types": "./dist/client-api.d.ts" + }, + "./dist/core-client": { + "import": "./dist/core-client.mjs", + "require": "./dist/core-client.js", + "types": "./dist/core-client.d.ts" + }, + "./dist/preview-web": { + "import": "./dist/preview-web.mjs", + "require": "./dist/preview-web.js", + "types": "./dist/preview-web.d.ts" + }, "./package.json": "./package.json" }, "main": "dist/index.js", @@ -43,17 +63,32 @@ }, "dependencies": { "@storybook/addons": "7.0.0-alpha.47", - "@storybook/client-api": "7.0.0-alpha.47", - "@storybook/core-client": "7.0.0-alpha.47", - "@storybook/preview-web": "7.0.0-alpha.47", - "@storybook/store": "7.0.0-alpha.47" + "@storybook/client-logger": "7.0.0-alpha.47", + "@storybook/core-events": "7.0.0-alpha.47", + "@storybook/csf": "next", + "@storybook/types": "7.0.0-alpha.47", + "@types/qs": "^6.9.5", + "@types/webpack-env": "^1.16.4", + "dequal": "^2.0.2", + "global": "^4.4.0", + "lodash": "^4.17.21", + "memoizerific": "^1.11.3", + "qs": "^6.10.0", + "slash": "^3.0.0", + "synchronous-promise": "^2.0.15", + "ts-dedent": "^2.0.0", + "util-deprecate": "^1.0.2" }, "publishConfig": { "access": "public" }, "bundler": { "entries": [ - "./src/index.ts" + "./src/index.ts", + "./src/store.ts", + "./src/client-api.ts", + "./src/core-client.ts", + "./src/preview-web.ts" ] }, "gitHead": "3ef14366115c56c1d45c0359ff681cc47ed50532" diff --git a/code/lib/preview-api/src/client-api.ts b/code/lib/preview-api/src/client-api.ts new file mode 100644 index 00000000000..0ba8fe19999 --- /dev/null +++ b/code/lib/preview-api/src/client-api.ts @@ -0,0 +1 @@ +export * from './modules/client-api'; diff --git a/code/lib/preview-api/src/core-client.ts b/code/lib/preview-api/src/core-client.ts new file mode 100644 index 00000000000..86513ed4b7f --- /dev/null +++ b/code/lib/preview-api/src/core-client.ts @@ -0,0 +1 @@ +export * from './modules/core-client'; diff --git a/code/lib/preview-api/src/index.ts b/code/lib/preview-api/src/index.ts index 099bd5cf6bc..7b16a286dd9 100644 --- a/code/lib/preview-api/src/index.ts +++ b/code/lib/preview-api/src/index.ts @@ -31,12 +31,12 @@ export { addons } from '@storybook/addons'; /** * DOCS API */ -export { DocsContext } from '@storybook/preview-web'; +export { DocsContext } from './preview-web'; /** * SIMULATION API */ -export { simulatePageLoad, simulateDOMContentLoaded } from '@storybook/preview-web'; +export { simulatePageLoad, simulateDOMContentLoaded } from './preview-web'; /** * STORIES API @@ -50,9 +50,9 @@ export { addLoader, addParameters, addStepRunner, -} from '@storybook/client-api'; -export { getQueryParam, getQueryParams } from '@storybook/client-api'; -export { setGlobalRender } from '@storybook/client-api'; +} from './client-api'; +export { getQueryParam, getQueryParams } from './client-api'; +export { setGlobalRender } from './client-api'; export { combineArgs, @@ -71,12 +71,12 @@ export { inferControls, userOrAutoTitleFromSpecifier, sortStoriesV7, -} from '@storybook/store'; +} from './store'; /** * STORIES API */ -export { ClientApi } from '@storybook/client-api'; -export { StoryStore } from '@storybook/store'; -export { Preview, PreviewWeb } from '@storybook/preview-web'; -export { start } from '@storybook/core-client'; +export { ClientApi } from './client-api'; +export { StoryStore } from './store'; +export { Preview, PreviewWeb } from './preview-web'; +export { start } from './core-client'; diff --git a/code/lib/client-api/src/ClientApi.test.ts b/code/lib/preview-api/src/modules/client-api/ClientApi.test.ts similarity index 100% rename from code/lib/client-api/src/ClientApi.test.ts rename to code/lib/preview-api/src/modules/client-api/ClientApi.test.ts diff --git a/code/lib/client-api/src/ClientApi.ts b/code/lib/preview-api/src/modules/client-api/ClientApi.ts similarity index 94% rename from code/lib/client-api/src/ClientApi.ts rename to code/lib/preview-api/src/modules/client-api/ClientApi.ts index 805b00fa24a..60d3025915d 100644 --- a/code/lib/client-api/src/ClientApi.ts +++ b/code/lib/preview-api/src/modules/client-api/ClientApi.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-this-alias */ /// import { dedent } from 'ts-dedent'; @@ -24,8 +25,8 @@ import type { Store_ModuleImportFn, Store_ModuleExports, } from '@storybook/types'; -import type { StoryStore } from '@storybook/store'; -import { combineParameters, composeStepRunners, normalizeInputTypes } from '@storybook/store'; +import type { StoryStore } from '../../store'; +import { combineParameters, composeStepRunners, normalizeInputTypes } from '../../store'; import { StoryStoreFacade } from './StoryStoreFacade'; @@ -105,7 +106,9 @@ export const getGlobalRender = () => { return singleton.facade.projectAnnotations.render; }; -export const setGlobalRender = (render: StoryFn) => { +export const setGlobalRender = ( + render: typeof singleton['facade']['projectAnnotations']['render'] +) => { checkMethod('setGlobalRender'); singleton.facade.projectAnnotations.render = render; }; @@ -131,7 +134,7 @@ export class ClientApi { this.storyStore = storyStore; - // eslint-disable-next-line @typescript-eslint/no-this-alias + // @ts-expect-error (whatever) singleton = this; } @@ -147,7 +150,7 @@ export class ClientApi { } addDecorator = (decorator: DecoratorFunction) => { - this.facade.projectAnnotations.decorators.push(decorator); + this.facade.projectAnnotations.decorators?.push(decorator); }; addParameters = ({ @@ -175,12 +178,12 @@ export class ClientApi { addStepRunner = (stepRunner: StepRunner) => { this.facade.projectAnnotations.runStep = composeStepRunners( - [this.facade.projectAnnotations.runStep, stepRunner].filter(Boolean) + [this.facade.projectAnnotations.runStep, stepRunner].filter(Boolean) as StepRunner[] ); }; addLoader = (loader: LoaderFunction) => { - this.facade.projectAnnotations.loaders.push(loader); + this.facade.projectAnnotations.loaders?.push(loader); }; addArgs = (args: Args) => { @@ -198,11 +201,11 @@ export class ClientApi { }; addArgsEnhancer = (enhancer: ArgsEnhancer) => { - this.facade.projectAnnotations.argsEnhancers.push(enhancer); + this.facade.projectAnnotations.argsEnhancers?.push(enhancer); }; addArgTypesEnhancer = (enhancer: ArgTypesEnhancer) => { - this.facade.projectAnnotations.argTypesEnhancers.push(enhancer); + this.facade.projectAnnotations.argTypesEnhancers?.push(enhancer); }; // Because of the API of `storiesOf().add()` we don't have a good "end" call for a @@ -345,14 +348,14 @@ export class ClientApi { throw new Error(`You cannot add a decorator after the first story for a kind. Read more here: https://github.com/storybookjs/storybook/blob/master/MIGRATION.md#can-no-longer-add-decoratorsparameters-after-stories`); - meta.decorators.push(decorator); + meta.decorators?.push(decorator); return api; }; api.addLoader = (loader: LoaderFunction) => { if (hasAdded) throw new Error(`You cannot add a loader after the first story for a kind.`); - meta.loaders.push(loader); + meta.loaders?.push(loader); return api; }; @@ -374,7 +377,7 @@ Read more here: https://github.com/storybookjs/storybook/blob/master/MIGRATION.m // @deprecated raw = () => { - return this.storyStore.raw(); + return this.storyStore?.raw(); }; // @deprecated diff --git a/code/lib/client-api/src/StoryStoreFacade.ts b/code/lib/preview-api/src/modules/client-api/StoryStoreFacade.ts similarity index 87% rename from code/lib/client-api/src/StoryStoreFacade.ts rename to code/lib/preview-api/src/modules/client-api/StoryStoreFacade.ts index 3bbef76dc2e..f7b10b77d40 100644 --- a/code/lib/client-api/src/StoryStoreFacade.ts +++ b/code/lib/preview-api/src/modules/client-api/StoryStoreFacade.ts @@ -17,9 +17,9 @@ import type { Store_StoryIndex, StoryId, } from '@storybook/types'; -import type { StoryStore } from '@storybook/store'; -import { userOrAutoTitle, sortStoriesV6 } from '@storybook/store'; import { logger } from '@storybook/client-logger'; +import type { StoryStore } from '../../store'; +import { userOrAutoTitle, sortStoriesV6 } from '../../store'; export class StoryStoreFacade { projectAnnotations: Store_NormalizedProjectAnnotations; @@ -60,36 +60,35 @@ export class StoryStoreFacade { const storyEntries = Object.entries(this.entries); // Add the kind parameters and global parameters to each entry - const sortableV6: [StoryId, Store_Story, Parameters, Parameters][] = - storyEntries.map(([storyId, { type, importPath, ...entry }]) => { - const exports = this.csfExports[importPath]; - const csfFile = store.processCSFFileWithCache( - exports, - importPath, - exports.default.title - ); + const sortableV6 = storyEntries.map(([storyId, { type, importPath, ...entry }]) => { + const exports = this.csfExports[importPath]; + const csfFile = store.processCSFFileWithCache( + exports, + importPath, + exports.default.title + ); - let storyLike: Store_Story; - if (type === 'story') { - storyLike = store.storyFromCSFFile({ storyId, csfFile }); - } else { - storyLike = { - ...entry, - story: entry.name, - kind: entry.title, - componentId: toId(entry.componentId || entry.title), - parameters: { fileName: importPath }, - } as any; - } - return [storyId, storyLike, csfFile.meta.parameters, this.projectAnnotations.parameters]; - }); + let storyLike: Store_Story; + if (type === 'story') { + storyLike = store.storyFromCSFFile({ storyId, csfFile }); + } else { + storyLike = { + ...entry, + story: entry.name, + kind: entry.title, + componentId: toId(entry.componentId || entry.title), + parameters: { fileName: importPath }, + } as any; + } + return [storyId, storyLike, csfFile.meta.parameters, this.projectAnnotations.parameters]; + }) as [StoryId, Store_Story, Parameters, Parameters][]; // NOTE: the sortStoriesV6 version returns the v7 data format. confusing but more convenient! let sortedV7: Addon_IndexEntry[]; try { sortedV7 = sortStoriesV6(sortableV6, storySortParameter, fileNameOrder); - } catch (err) { + } catch (err: any) { if (typeof storySortParameter === 'function') { throw new Error(dedent` Error sorting stories with sort parameter ${storySortParameter}: diff --git a/code/lib/client-api/src/index.ts b/code/lib/preview-api/src/modules/client-api/index.ts similarity index 100% rename from code/lib/client-api/src/index.ts rename to code/lib/preview-api/src/modules/client-api/index.ts diff --git a/code/lib/client-api/src/queryparams.ts b/code/lib/preview-api/src/modules/client-api/queryparams.ts similarity index 100% rename from code/lib/client-api/src/queryparams.ts rename to code/lib/preview-api/src/modules/client-api/queryparams.ts diff --git a/code/lib/client-api/src/typings.d.ts b/code/lib/preview-api/src/modules/client-api/typings.d.ts similarity index 100% rename from code/lib/client-api/src/typings.d.ts rename to code/lib/preview-api/src/modules/client-api/typings.d.ts diff --git a/code/lib/core-client/src/PreviewWeb.mockdata.ts b/code/lib/preview-api/src/modules/core-client/PreviewWeb.mockdata.ts similarity index 100% rename from code/lib/core-client/src/PreviewWeb.mockdata.ts rename to code/lib/preview-api/src/modules/core-client/PreviewWeb.mockdata.ts diff --git a/code/lib/core-client/src/executeLoadable.ts b/code/lib/preview-api/src/modules/core-client/executeLoadable.ts similarity index 100% rename from code/lib/core-client/src/executeLoadable.ts rename to code/lib/preview-api/src/modules/core-client/executeLoadable.ts diff --git a/code/lib/preview-api/src/modules/core-client/index.ts b/code/lib/preview-api/src/modules/core-client/index.ts new file mode 100644 index 00000000000..72d57e5f9d7 --- /dev/null +++ b/code/lib/preview-api/src/modules/core-client/index.ts @@ -0,0 +1,5 @@ +import { ClientApi } from '../../client-api'; +import { StoryStore } from '../../store'; +import { start } from './start'; + +export { start, ClientApi, StoryStore }; diff --git a/code/lib/core-client/src/start.test.ts b/code/lib/preview-api/src/modules/core-client/start.test.ts similarity index 99% rename from code/lib/core-client/src/start.test.ts rename to code/lib/preview-api/src/modules/core-client/start.test.ts index 8c3092d147e..bd4ff6e245f 100644 --- a/code/lib/core-client/src/start.test.ts +++ b/code/lib/preview-api/src/modules/core-client/start.test.ts @@ -2,8 +2,8 @@ import { STORY_RENDERED, STORY_UNCHANGED, SET_INDEX } from '@storybook/core-events'; import type { Store_ModuleExports, Path, Loadable } from '@storybook/types'; -import { setGlobalRender } from '@storybook/client-api'; import global from 'global'; +import { setGlobalRender } from '../../client-api'; import { waitForRender, waitForEvents, @@ -36,8 +36,8 @@ jest.mock('@storybook/channel-postmessage', () => ({ createChannel: () => mockCh jest.mock('react-dom'); // for the auto-title test -jest.mock('@storybook/store', () => { - const actualStore = jest.requireActual('@storybook/store'); +jest.mock('../../store', () => { + const actualStore = jest.requireActual('../../store'); return { ...actualStore, userOrAutoTitle: (importPath: Path, specifier: any, userTitle?: string) => @@ -45,8 +45,8 @@ jest.mock('@storybook/store', () => { }; }); -jest.mock('@storybook/preview-web', () => { - const actualPreviewWeb = jest.requireActual('@storybook/preview-web'); +jest.mock('../../preview-web', () => { + const actualPreviewWeb = jest.requireActual('../../preview-web'); class OverloadPreviewWeb extends actualPreviewWeb.PreviewWeb { constructor() { diff --git a/code/lib/core-client/src/start.ts b/code/lib/preview-api/src/modules/core-client/start.ts similarity index 97% rename from code/lib/core-client/src/start.ts rename to code/lib/preview-api/src/modules/core-client/start.ts index bb6748bb11f..25414650ca4 100644 --- a/code/lib/core-client/src/start.ts +++ b/code/lib/preview-api/src/modules/core-client/start.ts @@ -1,7 +1,5 @@ /* eslint-disable @typescript-eslint/naming-convention */ import global from 'global'; -import { ClientApi } from '@storybook/client-api'; -import { PreviewWeb } from '@storybook/preview-web'; import type { AnyFramework, ArgsStoryFn, @@ -12,6 +10,8 @@ import type { import { createChannel } from '@storybook/channel-postmessage'; import { addons } from '@storybook/addons'; import { FORCE_RE_RENDER } from '@storybook/core-events'; +import { PreviewWeb } from '../../preview-web'; +import { ClientApi } from '../../client-api'; import { executeLoadableForChanges } from './executeLoadable'; diff --git a/code/lib/core-client/src/typings.d.ts b/code/lib/preview-api/src/modules/core-client/typings.d.ts similarity index 100% rename from code/lib/core-client/src/typings.d.ts rename to code/lib/preview-api/src/modules/core-client/typings.d.ts diff --git a/code/lib/preview-web/src/Preview.tsx b/code/lib/preview-api/src/modules/preview-web/Preview.tsx similarity index 99% rename from code/lib/preview-web/src/Preview.tsx rename to code/lib/preview-api/src/modules/preview-web/Preview.tsx index fcf46c794a4..b9cec4dac04 100644 --- a/code/lib/preview-web/src/Preview.tsx +++ b/code/lib/preview-api/src/modules/preview-web/Preview.tsx @@ -29,7 +29,7 @@ import type { Store_WebProjectAnnotations, StoryId, } from '@storybook/types'; -import { StoryStore } from '@storybook/store'; +import { StoryStore } from '../../store'; import { StoryRender } from './render/StoryRender'; import type { TemplateDocsRender } from './render/TemplateDocsRender'; diff --git a/code/lib/preview-web/src/PreviewWeb.integration.test.ts b/code/lib/preview-api/src/modules/preview-web/PreviewWeb.integration.test.ts similarity index 100% rename from code/lib/preview-web/src/PreviewWeb.integration.test.ts rename to code/lib/preview-api/src/modules/preview-web/PreviewWeb.integration.test.ts diff --git a/code/lib/preview-web/src/PreviewWeb.mockdata.ts b/code/lib/preview-api/src/modules/preview-web/PreviewWeb.mockdata.ts similarity index 100% rename from code/lib/preview-web/src/PreviewWeb.mockdata.ts rename to code/lib/preview-api/src/modules/preview-web/PreviewWeb.mockdata.ts diff --git a/code/lib/preview-web/src/PreviewWeb.test.ts b/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts similarity index 99% rename from code/lib/preview-web/src/PreviewWeb.test.ts rename to code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts index 36cf0b17ce7..605b7df48e7 100644 --- a/code/lib/preview-web/src/PreviewWeb.test.ts +++ b/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts @@ -30,8 +30,8 @@ import { import { logger } from '@storybook/client-logger'; import { addons, mockChannel as createMockChannel } from '@storybook/addons'; import type { AnyFramework } from '@storybook/types'; -import type { ModuleImportFn, WebProjectAnnotations } from '@storybook/store'; import { mocked } from 'ts-jest/utils'; +import type { ModuleImportFn, WebProjectAnnotations } from '../../store'; import { PreviewWeb } from './PreviewWeb'; import { diff --git a/code/lib/preview-web/src/PreviewWeb.tsx b/code/lib/preview-api/src/modules/preview-web/PreviewWeb.tsx similarity index 100% rename from code/lib/preview-web/src/PreviewWeb.tsx rename to code/lib/preview-api/src/modules/preview-web/PreviewWeb.tsx diff --git a/code/lib/preview-web/src/UrlStore.test.ts b/code/lib/preview-api/src/modules/preview-web/UrlStore.test.ts similarity index 100% rename from code/lib/preview-web/src/UrlStore.test.ts rename to code/lib/preview-api/src/modules/preview-web/UrlStore.test.ts diff --git a/code/lib/preview-web/src/UrlStore.ts b/code/lib/preview-api/src/modules/preview-web/UrlStore.ts similarity index 100% rename from code/lib/preview-web/src/UrlStore.ts rename to code/lib/preview-api/src/modules/preview-web/UrlStore.ts diff --git a/code/lib/preview-web/src/WebView.ts b/code/lib/preview-api/src/modules/preview-web/WebView.ts similarity index 100% rename from code/lib/preview-web/src/WebView.ts rename to code/lib/preview-api/src/modules/preview-web/WebView.ts diff --git a/code/lib/preview-web/src/docs-context/DocsContext.ts b/code/lib/preview-api/src/modules/preview-web/docs-context/DocsContext.ts similarity index 98% rename from code/lib/preview-web/src/docs-context/DocsContext.ts rename to code/lib/preview-api/src/modules/preview-web/docs-context/DocsContext.ts index 50f46884899..cc0c66e7684 100644 --- a/code/lib/preview-web/src/docs-context/DocsContext.ts +++ b/code/lib/preview-api/src/modules/preview-web/docs-context/DocsContext.ts @@ -8,8 +8,8 @@ import type { StoryId, StoryName, } from '@storybook/types'; -import type { StoryStore } from '@storybook/store'; import type { Channel } from '@storybook/channels'; +import type { StoryStore } from '../../store'; import type { DocsContextProps } from './DocsContextProps'; diff --git a/code/lib/preview-web/src/docs-context/DocsContextProps.ts b/code/lib/preview-api/src/modules/preview-web/docs-context/DocsContextProps.ts similarity index 100% rename from code/lib/preview-web/src/docs-context/DocsContextProps.ts rename to code/lib/preview-api/src/modules/preview-web/docs-context/DocsContextProps.ts diff --git a/code/lib/preview-web/src/docs-context/DocsRenderFunction.ts b/code/lib/preview-api/src/modules/preview-web/docs-context/DocsRenderFunction.ts similarity index 100% rename from code/lib/preview-web/src/docs-context/DocsRenderFunction.ts rename to code/lib/preview-api/src/modules/preview-web/docs-context/DocsRenderFunction.ts diff --git a/code/lib/preview-web/src/index.ts b/code/lib/preview-api/src/modules/preview-web/index.ts similarity index 91% rename from code/lib/preview-web/src/index.ts rename to code/lib/preview-api/src/modules/preview-web/index.ts index dd3ff24cfec..f243aa5a98d 100644 --- a/code/lib/preview-web/src/index.ts +++ b/code/lib/preview-api/src/modules/preview-web/index.ts @@ -1,5 +1,5 @@ // FIXME: breaks builder-vite, remove this in 7.0 -export { composeConfigs } from '@storybook/store'; +export { composeConfigs } from '../../store'; export type { Store_WebProjectAnnotations as WebProjectAnnotations } from '@storybook/types'; export { Preview } from './Preview'; diff --git a/code/lib/preview-web/src/parseArgsParam.test.ts b/code/lib/preview-api/src/modules/preview-web/parseArgsParam.test.ts similarity index 100% rename from code/lib/preview-web/src/parseArgsParam.test.ts rename to code/lib/preview-api/src/modules/preview-web/parseArgsParam.test.ts diff --git a/code/lib/preview-web/src/parseArgsParam.ts b/code/lib/preview-api/src/modules/preview-web/parseArgsParam.ts similarity index 100% rename from code/lib/preview-web/src/parseArgsParam.ts rename to code/lib/preview-api/src/modules/preview-web/parseArgsParam.ts diff --git a/code/lib/preview-web/src/render/Render.ts b/code/lib/preview-api/src/modules/preview-web/render/Render.ts similarity index 100% rename from code/lib/preview-web/src/render/Render.ts rename to code/lib/preview-api/src/modules/preview-web/render/Render.ts diff --git a/code/lib/preview-web/src/render/StandaloneDocsRender.test.ts b/code/lib/preview-api/src/modules/preview-web/render/StandaloneDocsRender.test.ts similarity index 96% rename from code/lib/preview-web/src/render/StandaloneDocsRender.test.ts rename to code/lib/preview-api/src/modules/preview-web/render/StandaloneDocsRender.test.ts index 07e98e462ad..228286b3e8e 100644 --- a/code/lib/preview-web/src/render/StandaloneDocsRender.test.ts +++ b/code/lib/preview-api/src/modules/preview-web/render/StandaloneDocsRender.test.ts @@ -1,7 +1,7 @@ import { jest, describe, it, expect } from '@jest/globals'; import { Channel } from '@storybook/channels'; import type { AnyFramework, Addon_StandaloneDocsIndexEntry } from '@storybook/types'; -import type { StoryStore } from '@storybook/store'; +import type { StoryStore } from '../../store'; import { PREPARE_ABORTED } from './Render'; import { StandaloneDocsRender } from './StandaloneDocsRender'; diff --git a/code/lib/preview-web/src/render/StandaloneDocsRender.ts b/code/lib/preview-api/src/modules/preview-web/render/StandaloneDocsRender.ts similarity index 98% rename from code/lib/preview-web/src/render/StandaloneDocsRender.ts rename to code/lib/preview-api/src/modules/preview-web/render/StandaloneDocsRender.ts index 02137c7c892..8969018a630 100644 --- a/code/lib/preview-web/src/render/StandaloneDocsRender.ts +++ b/code/lib/preview-api/src/modules/preview-web/render/StandaloneDocsRender.ts @@ -5,9 +5,9 @@ import type { Store_ModuleExports, StoryId, } from '@storybook/types'; -import type { StoryStore } from '@storybook/store'; import type { Channel } from '@storybook/channels'; import { DOCS_RENDERED } from '@storybook/core-events'; +import type { StoryStore } from '../../store'; import type { Render, RenderType } from './Render'; import { PREPARE_ABORTED } from './Render'; diff --git a/code/lib/preview-web/src/render/StoryRender.test.ts b/code/lib/preview-api/src/modules/preview-web/render/StoryRender.test.ts similarity index 96% rename from code/lib/preview-web/src/render/StoryRender.test.ts rename to code/lib/preview-api/src/modules/preview-web/render/StoryRender.test.ts index 4ca15195c07..b820552d441 100644 --- a/code/lib/preview-web/src/render/StoryRender.test.ts +++ b/code/lib/preview-api/src/modules/preview-web/render/StoryRender.test.ts @@ -1,7 +1,7 @@ import { jest, describe, it, expect } from '@jest/globals'; import { Channel } from '@storybook/channels'; import type { AnyFramework, Addon_StoryIndexEntry } from '@storybook/types'; -import type { StoryStore } from '@storybook/store'; +import type { StoryStore } from '../../store'; import { PREPARE_ABORTED } from './Render'; import { StoryRender } from './StoryRender'; diff --git a/code/lib/preview-web/src/render/StoryRender.ts b/code/lib/preview-api/src/modules/preview-web/render/StoryRender.ts similarity index 99% rename from code/lib/preview-web/src/render/StoryRender.ts rename to code/lib/preview-api/src/modules/preview-web/render/StoryRender.ts index e2b3d056ae9..900b17a4051 100644 --- a/code/lib/preview-web/src/render/StoryRender.ts +++ b/code/lib/preview-api/src/modules/preview-web/render/StoryRender.ts @@ -10,7 +10,6 @@ import type { StoryId, ViewMode, } from '@storybook/types'; -import type { StoryStore } from '@storybook/store'; import type { Channel } from '@storybook/channels'; import { logger } from '@storybook/client-logger'; import { @@ -18,6 +17,7 @@ import { STORY_RENDERED, PLAY_FUNCTION_THREW_EXCEPTION, } from '@storybook/core-events'; +import type { StoryStore } from '../../store'; import type { Render, RenderType } from './Render'; import { PREPARE_ABORTED } from './Render'; diff --git a/code/lib/preview-web/src/render/TemplateDocsRender.test.ts b/code/lib/preview-api/src/modules/preview-web/render/TemplateDocsRender.test.ts similarity index 96% rename from code/lib/preview-web/src/render/TemplateDocsRender.test.ts rename to code/lib/preview-api/src/modules/preview-web/render/TemplateDocsRender.test.ts index e1b4bf1e474..164924d15ff 100644 --- a/code/lib/preview-web/src/render/TemplateDocsRender.test.ts +++ b/code/lib/preview-api/src/modules/preview-web/render/TemplateDocsRender.test.ts @@ -1,7 +1,7 @@ import { jest, describe, it, expect } from '@jest/globals'; import { Channel } from '@storybook/channels'; import type { AnyFramework, Addon_TemplateDocsIndexEntry } from '@storybook/types'; -import type { StoryStore } from '@storybook/store'; +import type { StoryStore } from '../../store'; import { PREPARE_ABORTED } from './Render'; import { TemplateDocsRender } from './TemplateDocsRender'; diff --git a/code/lib/preview-web/src/render/TemplateDocsRender.ts b/code/lib/preview-api/src/modules/preview-web/render/TemplateDocsRender.ts similarity index 98% rename from code/lib/preview-web/src/render/TemplateDocsRender.ts rename to code/lib/preview-api/src/modules/preview-web/render/TemplateDocsRender.ts index dfe5a64577d..80e9a40602f 100644 --- a/code/lib/preview-web/src/render/TemplateDocsRender.ts +++ b/code/lib/preview-api/src/modules/preview-web/render/TemplateDocsRender.ts @@ -5,9 +5,9 @@ import type { Store_Story, StoryId, } from '@storybook/types'; -import type { StoryStore } from '@storybook/store'; import type { Channel } from '@storybook/channels'; import { DOCS_RENDERED } from '@storybook/core-events'; +import type { StoryStore } from '../../../store'; import type { Render, RenderType } from './Render'; import { PREPARE_ABORTED } from './Render'; diff --git a/code/lib/preview-web/src/simulate-pageload.test.ts b/code/lib/preview-api/src/modules/preview-web/simulate-pageload.test.ts similarity index 100% rename from code/lib/preview-web/src/simulate-pageload.test.ts rename to code/lib/preview-api/src/modules/preview-web/simulate-pageload.test.ts diff --git a/code/lib/preview-web/src/simulate-pageload.ts b/code/lib/preview-api/src/modules/preview-web/simulate-pageload.ts similarity index 100% rename from code/lib/preview-web/src/simulate-pageload.ts rename to code/lib/preview-api/src/modules/preview-web/simulate-pageload.ts diff --git a/code/lib/preview-web/src/typings.d.ts b/code/lib/preview-api/src/modules/preview-web/typings.d.ts similarity index 100% rename from code/lib/preview-web/src/typings.d.ts rename to code/lib/preview-api/src/modules/preview-web/typings.d.ts diff --git a/code/lib/store/src/ArgsStore.test.ts b/code/lib/preview-api/src/modules/store/ArgsStore.test.ts similarity index 100% rename from code/lib/store/src/ArgsStore.test.ts rename to code/lib/preview-api/src/modules/store/ArgsStore.test.ts diff --git a/code/lib/store/src/ArgsStore.ts b/code/lib/preview-api/src/modules/store/ArgsStore.ts similarity index 100% rename from code/lib/store/src/ArgsStore.ts rename to code/lib/preview-api/src/modules/store/ArgsStore.ts diff --git a/code/lib/store/src/GlobalsStore.test.ts b/code/lib/preview-api/src/modules/store/GlobalsStore.test.ts similarity index 100% rename from code/lib/store/src/GlobalsStore.test.ts rename to code/lib/preview-api/src/modules/store/GlobalsStore.test.ts diff --git a/code/lib/store/src/GlobalsStore.ts b/code/lib/preview-api/src/modules/store/GlobalsStore.ts similarity index 100% rename from code/lib/store/src/GlobalsStore.ts rename to code/lib/preview-api/src/modules/store/GlobalsStore.ts diff --git a/code/lib/store/src/StoryIndexStore.test.ts b/code/lib/preview-api/src/modules/store/StoryIndexStore.test.ts similarity index 100% rename from code/lib/store/src/StoryIndexStore.test.ts rename to code/lib/preview-api/src/modules/store/StoryIndexStore.test.ts diff --git a/code/lib/store/src/StoryIndexStore.ts b/code/lib/preview-api/src/modules/store/StoryIndexStore.ts similarity index 100% rename from code/lib/store/src/StoryIndexStore.ts rename to code/lib/preview-api/src/modules/store/StoryIndexStore.ts diff --git a/code/lib/store/src/StoryStore.test.ts b/code/lib/preview-api/src/modules/store/StoryStore.test.ts similarity index 100% rename from code/lib/store/src/StoryStore.test.ts rename to code/lib/preview-api/src/modules/store/StoryStore.test.ts diff --git a/code/lib/store/src/StoryStore.ts b/code/lib/preview-api/src/modules/store/StoryStore.ts similarity index 100% rename from code/lib/store/src/StoryStore.ts rename to code/lib/preview-api/src/modules/store/StoryStore.ts diff --git a/code/lib/store/src/args.test.ts b/code/lib/preview-api/src/modules/store/args.test.ts similarity index 100% rename from code/lib/store/src/args.test.ts rename to code/lib/preview-api/src/modules/store/args.test.ts diff --git a/code/lib/store/src/args.ts b/code/lib/preview-api/src/modules/store/args.ts similarity index 100% rename from code/lib/store/src/args.ts rename to code/lib/preview-api/src/modules/store/args.ts diff --git a/code/lib/store/src/autoTitle.test.ts b/code/lib/preview-api/src/modules/store/autoTitle.test.ts similarity index 100% rename from code/lib/store/src/autoTitle.test.ts rename to code/lib/preview-api/src/modules/store/autoTitle.test.ts diff --git a/code/lib/store/src/autoTitle.ts b/code/lib/preview-api/src/modules/store/autoTitle.ts similarity index 100% rename from code/lib/store/src/autoTitle.ts rename to code/lib/preview-api/src/modules/store/autoTitle.ts diff --git a/code/lib/store/src/csf/composeConfigs.test.ts b/code/lib/preview-api/src/modules/store/csf/composeConfigs.test.ts similarity index 100% rename from code/lib/store/src/csf/composeConfigs.test.ts rename to code/lib/preview-api/src/modules/store/csf/composeConfigs.test.ts diff --git a/code/lib/store/src/csf/composeConfigs.ts b/code/lib/preview-api/src/modules/store/csf/composeConfigs.ts similarity index 100% rename from code/lib/store/src/csf/composeConfigs.ts rename to code/lib/preview-api/src/modules/store/csf/composeConfigs.ts diff --git a/code/lib/store/src/csf/getValuesFromArgTypes.ts b/code/lib/preview-api/src/modules/store/csf/getValuesFromArgTypes.ts similarity index 100% rename from code/lib/store/src/csf/getValuesFromArgTypes.ts rename to code/lib/preview-api/src/modules/store/csf/getValuesFromArgTypes.ts diff --git a/code/lib/store/src/csf/index.ts b/code/lib/preview-api/src/modules/store/csf/index.ts similarity index 100% rename from code/lib/store/src/csf/index.ts rename to code/lib/preview-api/src/modules/store/csf/index.ts diff --git a/code/lib/store/src/csf/normalizeComponentAnnotations.ts b/code/lib/preview-api/src/modules/store/csf/normalizeComponentAnnotations.ts similarity index 100% rename from code/lib/store/src/csf/normalizeComponentAnnotations.ts rename to code/lib/preview-api/src/modules/store/csf/normalizeComponentAnnotations.ts diff --git a/code/lib/store/src/csf/normalizeInputTypes.test.ts b/code/lib/preview-api/src/modules/store/csf/normalizeInputTypes.test.ts similarity index 100% rename from code/lib/store/src/csf/normalizeInputTypes.test.ts rename to code/lib/preview-api/src/modules/store/csf/normalizeInputTypes.test.ts diff --git a/code/lib/store/src/csf/normalizeInputTypes.ts b/code/lib/preview-api/src/modules/store/csf/normalizeInputTypes.ts similarity index 100% rename from code/lib/store/src/csf/normalizeInputTypes.ts rename to code/lib/preview-api/src/modules/store/csf/normalizeInputTypes.ts diff --git a/code/lib/store/src/csf/normalizeProjectAnnotations.ts b/code/lib/preview-api/src/modules/store/csf/normalizeProjectAnnotations.ts similarity index 100% rename from code/lib/store/src/csf/normalizeProjectAnnotations.ts rename to code/lib/preview-api/src/modules/store/csf/normalizeProjectAnnotations.ts diff --git a/code/lib/store/src/csf/normalizeStory.test.ts b/code/lib/preview-api/src/modules/store/csf/normalizeStory.test.ts similarity index 100% rename from code/lib/store/src/csf/normalizeStory.test.ts rename to code/lib/preview-api/src/modules/store/csf/normalizeStory.test.ts diff --git a/code/lib/store/src/csf/normalizeStory.ts b/code/lib/preview-api/src/modules/store/csf/normalizeStory.ts similarity index 100% rename from code/lib/store/src/csf/normalizeStory.ts rename to code/lib/preview-api/src/modules/store/csf/normalizeStory.ts diff --git a/code/lib/store/src/csf/prepareStory.test.ts b/code/lib/preview-api/src/modules/store/csf/prepareStory.test.ts similarity index 100% rename from code/lib/store/src/csf/prepareStory.test.ts rename to code/lib/preview-api/src/modules/store/csf/prepareStory.test.ts diff --git a/code/lib/store/src/csf/prepareStory.ts b/code/lib/preview-api/src/modules/store/csf/prepareStory.ts similarity index 100% rename from code/lib/store/src/csf/prepareStory.ts rename to code/lib/preview-api/src/modules/store/csf/prepareStory.ts diff --git a/code/lib/store/src/csf/processCSFFile.test.ts b/code/lib/preview-api/src/modules/store/csf/processCSFFile.test.ts similarity index 100% rename from code/lib/store/src/csf/processCSFFile.test.ts rename to code/lib/preview-api/src/modules/store/csf/processCSFFile.test.ts diff --git a/code/lib/store/src/csf/processCSFFile.ts b/code/lib/preview-api/src/modules/store/csf/processCSFFile.ts similarity index 100% rename from code/lib/store/src/csf/processCSFFile.ts rename to code/lib/preview-api/src/modules/store/csf/processCSFFile.ts diff --git a/code/lib/store/src/csf/stepRunners.test.ts b/code/lib/preview-api/src/modules/store/csf/stepRunners.test.ts similarity index 100% rename from code/lib/store/src/csf/stepRunners.test.ts rename to code/lib/preview-api/src/modules/store/csf/stepRunners.test.ts diff --git a/code/lib/store/src/csf/stepRunners.ts b/code/lib/preview-api/src/modules/store/csf/stepRunners.ts similarity index 100% rename from code/lib/store/src/csf/stepRunners.ts rename to code/lib/preview-api/src/modules/store/csf/stepRunners.ts diff --git a/code/lib/store/src/csf/testing-utils/index.test.ts b/code/lib/preview-api/src/modules/store/csf/testing-utils/index.test.ts similarity index 100% rename from code/lib/store/src/csf/testing-utils/index.test.ts rename to code/lib/preview-api/src/modules/store/csf/testing-utils/index.test.ts diff --git a/code/lib/store/src/csf/testing-utils/index.ts b/code/lib/preview-api/src/modules/store/csf/testing-utils/index.ts similarity index 100% rename from code/lib/store/src/csf/testing-utils/index.ts rename to code/lib/preview-api/src/modules/store/csf/testing-utils/index.ts diff --git a/code/lib/store/src/decorators.test.ts b/code/lib/preview-api/src/modules/store/decorators.test.ts similarity index 100% rename from code/lib/store/src/decorators.test.ts rename to code/lib/preview-api/src/modules/store/decorators.test.ts diff --git a/code/lib/store/src/decorators.ts b/code/lib/preview-api/src/modules/store/decorators.ts similarity index 100% rename from code/lib/store/src/decorators.ts rename to code/lib/preview-api/src/modules/store/decorators.ts diff --git a/code/lib/store/src/filterArgTypes.ts b/code/lib/preview-api/src/modules/store/filterArgTypes.ts similarity index 100% rename from code/lib/store/src/filterArgTypes.ts rename to code/lib/preview-api/src/modules/store/filterArgTypes.ts diff --git a/code/lib/store/src/hooks.test.ts b/code/lib/preview-api/src/modules/store/hooks.test.ts similarity index 100% rename from code/lib/store/src/hooks.test.ts rename to code/lib/preview-api/src/modules/store/hooks.test.ts diff --git a/code/lib/store/src/hooks.ts b/code/lib/preview-api/src/modules/store/hooks.ts similarity index 100% rename from code/lib/store/src/hooks.ts rename to code/lib/preview-api/src/modules/store/hooks.ts diff --git a/code/lib/store/src/index.ts b/code/lib/preview-api/src/modules/store/index.ts similarity index 100% rename from code/lib/store/src/index.ts rename to code/lib/preview-api/src/modules/store/index.ts diff --git a/code/lib/store/src/inferArgTypes.test.ts b/code/lib/preview-api/src/modules/store/inferArgTypes.test.ts similarity index 100% rename from code/lib/store/src/inferArgTypes.test.ts rename to code/lib/preview-api/src/modules/store/inferArgTypes.test.ts diff --git a/code/lib/store/src/inferArgTypes.ts b/code/lib/preview-api/src/modules/store/inferArgTypes.ts similarity index 100% rename from code/lib/store/src/inferArgTypes.ts rename to code/lib/preview-api/src/modules/store/inferArgTypes.ts diff --git a/code/lib/store/src/inferControls.test.ts b/code/lib/preview-api/src/modules/store/inferControls.test.ts similarity index 100% rename from code/lib/store/src/inferControls.test.ts rename to code/lib/preview-api/src/modules/store/inferControls.test.ts diff --git a/code/lib/store/src/inferControls.ts b/code/lib/preview-api/src/modules/store/inferControls.ts similarity index 100% rename from code/lib/store/src/inferControls.ts rename to code/lib/preview-api/src/modules/store/inferControls.ts diff --git a/code/lib/store/src/parameters.test.ts b/code/lib/preview-api/src/modules/store/parameters.test.ts similarity index 100% rename from code/lib/store/src/parameters.test.ts rename to code/lib/preview-api/src/modules/store/parameters.test.ts diff --git a/code/lib/store/src/parameters.ts b/code/lib/preview-api/src/modules/store/parameters.ts similarity index 100% rename from code/lib/store/src/parameters.ts rename to code/lib/preview-api/src/modules/store/parameters.ts diff --git a/code/lib/store/src/sortStories.ts b/code/lib/preview-api/src/modules/store/sortStories.ts similarity index 100% rename from code/lib/store/src/sortStories.ts rename to code/lib/preview-api/src/modules/store/sortStories.ts diff --git a/code/lib/store/src/storySort.test.ts b/code/lib/preview-api/src/modules/store/storySort.test.ts similarity index 100% rename from code/lib/store/src/storySort.test.ts rename to code/lib/preview-api/src/modules/store/storySort.test.ts diff --git a/code/lib/store/src/storySort.ts b/code/lib/preview-api/src/modules/store/storySort.ts similarity index 100% rename from code/lib/store/src/storySort.ts rename to code/lib/preview-api/src/modules/store/storySort.ts diff --git a/code/lib/store/src/typings.d.ts b/code/lib/preview-api/src/modules/store/typings.d.ts similarity index 100% rename from code/lib/store/src/typings.d.ts rename to code/lib/preview-api/src/modules/store/typings.d.ts diff --git a/code/lib/preview-api/src/preview-web.ts b/code/lib/preview-api/src/preview-web.ts new file mode 100644 index 00000000000..1f0814fb7af --- /dev/null +++ b/code/lib/preview-api/src/preview-web.ts @@ -0,0 +1 @@ +export * from './modules/preview-web'; diff --git a/code/lib/preview-api/src/store.ts b/code/lib/preview-api/src/store.ts new file mode 100644 index 00000000000..33f273a9603 --- /dev/null +++ b/code/lib/preview-api/src/store.ts @@ -0,0 +1 @@ +export * from './modules/store'; diff --git a/code/lib/preview-web/package.json b/code/lib/preview-web/package.json index d7b6a3ed83b..47839436b54 100644 --- a/code/lib/preview-web/package.json +++ b/code/lib/preview-web/package.json @@ -22,15 +22,15 @@ "sideEffects": false, "exports": { ".": { - "require": "./dist/index.js", - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts" + "require": "./dist/entry.js", + "import": "./dist/entry.mjs", + "types": "./dist/entry.d.ts" }, "./package.json": "./package.json" }, - "main": "dist/index.js", - "module": "dist/index.mjs", - "types": "dist/index.d.ts", + "main": "dist/entry.js", + "module": "dist/entry.mjs", + "types": "dist/entry.d.ts", "files": [ "dist/**/*", "README.md", @@ -42,32 +42,11 @@ "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { - "@storybook/addons": "7.0.0-alpha.47", - "@storybook/channels": "7.0.0-alpha.47", - "@storybook/client-logger": "7.0.0-alpha.47", - "@storybook/core-events": "7.0.0-alpha.47", - "@storybook/store": "7.0.0-alpha.47", - "@storybook/types": "7.0.0-alpha.47", - "ansi-to-html": "^0.6.11", - "global": "^4.4.0", - "lodash": "^4.17.21", - "qs": "^6.10.0", - "synchronous-promise": "^2.0.15", - "ts-dedent": "^2.0.0", - "util-deprecate": "^1.0.2" - }, - "devDependencies": { - "@storybook/channel-postmessage": "7.0.0-alpha.47", - "react": "16.14.0", - "ts-jest": "^28.0.8", - "typescript": "~4.6.3" - }, - "publishConfig": { - "access": "public" + "@storybook/preview-api": "7.0.0-alpha.47" }, "bundler": { "entries": [ - "./src/index.ts" + "./src/entry.ts" ] }, "gitHead": "1c706a4a778831e012343c905f86225fa71491a7" diff --git a/code/lib/preview-web/src/entry.ts b/code/lib/preview-web/src/entry.ts new file mode 100644 index 00000000000..bc3e97098ac --- /dev/null +++ b/code/lib/preview-web/src/entry.ts @@ -0,0 +1 @@ +export * from '@storybook/preview-api/dist/preview-web'; diff --git a/code/lib/store/package.json b/code/lib/store/package.json index 337fbbc3ea3..4a747deeb18 100644 --- a/code/lib/store/package.json +++ b/code/lib/store/package.json @@ -22,15 +22,15 @@ "sideEffects": false, "exports": { ".": { - "require": "./dist/index.js", - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts" + "require": "./dist/entry.js", + "import": "./dist/entry.mjs", + "types": "./dist/entry.d.ts" }, "./package.json": "./package.json" }, - "main": "dist/index.js", - "module": "dist/index.mjs", - "types": "dist/index.d.ts", + "main": "dist/entry.js", + "module": "dist/entry.mjs", + "types": "dist/entry.d.ts", "files": [ "dist/**/*", "README.md", @@ -42,33 +42,14 @@ "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { - "@storybook/addons": "7.0.0-alpha.47", - "@storybook/client-logger": "7.0.0-alpha.47", - "@storybook/core-events": "7.0.0-alpha.47", - "@storybook/csf": "next", - "@storybook/types": "7.0.0-alpha.47", - "dequal": "^2.0.2", - "global": "^4.4.0", - "lodash": "^4.17.21", - "memoizerific": "^1.11.3", - "slash": "^3.0.0", - "synchronous-promise": "^2.0.15", - "ts-dedent": "^2.0.0", - "util-deprecate": "^1.0.2" - }, - "devDependencies": { - "typescript": "~4.6.3" - }, - "peerDependencies": { - "react": "^16.8.0 || ^17.0.0 || ^18.0.0", - "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0" + "@storybook/preview-api": "7.0.0-alpha.47" }, "publishConfig": { "access": "public" }, "bundler": { "entries": [ - "./src/index.ts" + "./src/entry.ts" ], "platform": "node" }, diff --git a/code/lib/store/src/entry.ts b/code/lib/store/src/entry.ts new file mode 100644 index 00000000000..5fb0b87c253 --- /dev/null +++ b/code/lib/store/src/entry.ts @@ -0,0 +1 @@ +export * from '@storybook/preview-api/dist/store'; diff --git a/code/yarn.lock b/code/yarn.lock index 7ba0a5291fa..90612493157 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -6393,23 +6393,7 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/client-api@workspace:lib/client-api" dependencies: - "@storybook/addons": 7.0.0-alpha.47 - "@storybook/client-logger": 7.0.0-alpha.47 - "@storybook/core-common": 7.0.0-alpha.47 - "@storybook/csf": next - "@storybook/store": 7.0.0-alpha.47 - "@storybook/types": 7.0.0-alpha.47 - "@types/qs": ^6.9.5 - "@types/webpack-env": ^1.16.4 - global: ^4.4.0 - qs: ^6.10.0 - synchronous-promise: ^2.0.15 - ts-dedent: ^2.0.0 - typescript: ~4.6.3 - util-deprecate: ^1.0.2 - peerDependencies: - react: ^16.8.0 || ^17.0.0 || ^18.0.0 - react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 + "@storybook/preview-api": 7.0.0-alpha.47 languageName: unknown linkType: soft @@ -6488,23 +6472,7 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/core-client@workspace:lib/core-client" dependencies: - "@storybook/addons": 7.0.0-alpha.47 - "@storybook/channel-postmessage": 7.0.0-alpha.47 - "@storybook/channel-websocket": 7.0.0-alpha.47 - "@storybook/channels": 7.0.0-alpha.47 - "@storybook/client-api": 7.0.0-alpha.47 - "@storybook/client-logger": 7.0.0-alpha.47 - "@storybook/core-events": 7.0.0-alpha.47 - "@storybook/csf": next - "@storybook/preview-web": 7.0.0-alpha.47 - "@storybook/store": 7.0.0-alpha.47 - "@storybook/types": 7.0.0-alpha.47 - global: ^4.4.0 - typescript: ~4.6.3 - util-deprecate: ^1.0.2 - peerDependenciesMeta: - typescript: - optional: true + "@storybook/preview-api": 7.0.0-alpha.47 languageName: unknown linkType: soft @@ -7272,10 +7240,21 @@ __metadata: resolution: "@storybook/preview-api@workspace:lib/preview-api" dependencies: "@storybook/addons": 7.0.0-alpha.47 - "@storybook/client-api": 7.0.0-alpha.47 - "@storybook/core-client": 7.0.0-alpha.47 - "@storybook/preview-web": 7.0.0-alpha.47 - "@storybook/store": 7.0.0-alpha.47 + "@storybook/client-logger": 7.0.0-alpha.47 + "@storybook/core-events": 7.0.0-alpha.47 + "@storybook/csf": next + "@storybook/types": 7.0.0-alpha.47 + "@types/qs": ^6.9.5 + "@types/webpack-env": ^1.16.4 + dequal: ^2.0.2 + global: ^4.4.0 + lodash: ^4.17.21 + memoizerific: ^1.11.3 + qs: ^6.10.0 + slash: ^3.0.0 + synchronous-promise: ^2.0.15 + ts-dedent: ^2.0.0 + util-deprecate: ^1.0.2 languageName: unknown linkType: soft @@ -7283,23 +7262,7 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/preview-web@workspace:lib/preview-web" dependencies: - "@storybook/addons": 7.0.0-alpha.47 - "@storybook/channel-postmessage": 7.0.0-alpha.47 - "@storybook/channels": 7.0.0-alpha.47 - "@storybook/client-logger": 7.0.0-alpha.47 - "@storybook/core-events": 7.0.0-alpha.47 - "@storybook/store": 7.0.0-alpha.47 - "@storybook/types": 7.0.0-alpha.47 - ansi-to-html: ^0.6.11 - global: ^4.4.0 - lodash: ^4.17.21 - qs: ^6.10.0 - react: 16.14.0 - synchronous-promise: ^2.0.15 - ts-dedent: ^2.0.0 - ts-jest: ^28.0.8 - typescript: ~4.6.3 - util-deprecate: ^1.0.2 + "@storybook/preview-api": 7.0.0-alpha.47 languageName: unknown linkType: soft @@ -7814,23 +7777,7 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/store@workspace:lib/store" dependencies: - "@storybook/addons": 7.0.0-alpha.47 - "@storybook/client-logger": 7.0.0-alpha.47 - "@storybook/core-events": 7.0.0-alpha.47 - "@storybook/csf": next - "@storybook/types": 7.0.0-alpha.47 - dequal: ^2.0.2 - global: ^4.4.0 - lodash: ^4.17.21 - memoizerific: ^1.11.3 - slash: ^3.0.0 - synchronous-promise: ^2.0.15 - ts-dedent: ^2.0.0 - typescript: ~4.6.3 - util-deprecate: ^1.0.2 - peerDependencies: - react: ^16.8.0 || ^17.0.0 || ^18.0.0 - react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 + "@storybook/preview-api": 7.0.0-alpha.47 languageName: unknown linkType: soft From 4201357936700f1ea496bd2f2d3bcb2f91f708d9 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Thu, 3 Nov 2022 22:12:43 +0100 Subject: [PATCH 11/47] wip --- code/lib/client-api/package.json | 5 +- code/lib/core-client/package.json | 5 +- code/lib/preview-web/package.json | 8 ++- code/lib/store/package.json | 5 +- scripts/prepare/facade.ts | 91 +++++++++++++++++++++++++++++++ 5 files changed, 106 insertions(+), 8 deletions(-) create mode 100755 scripts/prepare/facade.ts diff --git a/code/lib/client-api/package.json b/code/lib/client-api/package.json index 64dac4f9aac..c61ff7a6579 100644 --- a/code/lib/client-api/package.json +++ b/code/lib/client-api/package.json @@ -39,7 +39,7 @@ ], "scripts": { "check": "../../../scripts/node_modules/.bin/tsc --noEmit", - "prep": "../../../scripts/prepare/bundle.ts" + "prep": "../../../scripts/prepare/facade.ts" }, "dependencies": { "@storybook/preview-api": "7.0.0-alpha.47" @@ -50,7 +50,8 @@ "bundler": { "entries": [ "./src/entry.ts" - ] + ], + "shim": "@storybook/preview-api/dist/client-api" }, "gitHead": "1c706a4a778831e012343c905f86225fa71491a7" } diff --git a/code/lib/core-client/package.json b/code/lib/core-client/package.json index 4f6845eaff7..04c22277ac3 100644 --- a/code/lib/core-client/package.json +++ b/code/lib/core-client/package.json @@ -32,7 +32,7 @@ "types": "dist/entry.d.ts", "scripts": { "check": "../../../scripts/node_modules/.bin/tsc --noEmit", - "prep": "../../../scripts/prepare/bundle.ts" + "prep": "../../../scripts/prepare/facade.ts" }, "dependencies": { "@storybook/preview-api": "7.0.0-alpha.47" @@ -43,7 +43,8 @@ "bundler": { "entries": [ "./src/entry.ts" - ] + ], + "shim": "@storybook/preview-api/dist/core-client" }, "gitHead": "1c706a4a778831e012343c905f86225fa71491a7" } diff --git a/code/lib/preview-web/package.json b/code/lib/preview-web/package.json index 47839436b54..32973356502 100644 --- a/code/lib/preview-web/package.json +++ b/code/lib/preview-web/package.json @@ -39,15 +39,19 @@ ], "scripts": { "check": "../../../scripts/node_modules/.bin/tsc --noEmit", - "prep": "../../../scripts/prepare/bundle.ts" + "prep": "../../../scripts/prepare/facade.ts" }, "dependencies": { "@storybook/preview-api": "7.0.0-alpha.47" }, + "publishConfig": { + "access": "public" + }, "bundler": { "entries": [ "./src/entry.ts" - ] + ], + "shim": "@storybook/preview-api/dist/preview-web" }, "gitHead": "1c706a4a778831e012343c905f86225fa71491a7" } diff --git a/code/lib/store/package.json b/code/lib/store/package.json index 4a747deeb18..4e2569b9789 100644 --- a/code/lib/store/package.json +++ b/code/lib/store/package.json @@ -39,7 +39,7 @@ ], "scripts": { "check": "../../../scripts/node_modules/.bin/tsc --noEmit", - "prep": "../../../scripts/prepare/bundle.ts" + "prep": "../../../scripts/prepare/facade.ts" }, "dependencies": { "@storybook/preview-api": "7.0.0-alpha.47" @@ -51,7 +51,8 @@ "entries": [ "./src/entry.ts" ], - "platform": "node" + "platform": "node", + "shim": "@storybook/preview-api/dist/store" }, "gitHead": "1c706a4a778831e012343c905f86225fa71491a7" } diff --git a/scripts/prepare/facade.ts b/scripts/prepare/facade.ts new file mode 100755 index 00000000000..6c96103c0f7 --- /dev/null +++ b/scripts/prepare/facade.ts @@ -0,0 +1,91 @@ +#!/usr/bin/env ../../node_modules/.bin/ts-node + +import { join, parse } from 'path'; +import fs from 'fs-extra'; +import dedent from 'ts-dedent'; +import { build } from 'tsup'; +import slash from 'slash'; +import { exec } from '../utils/exec'; + +const hasFlag = (flags: string[], name: string) => !!flags.find((s) => s.startsWith(`--${name}`)); + +const run = async ({ cwd, flags }: { cwd: string; flags: string[] }) => { + const { + name, + dependencies, + peerDependencies, + bundler: { entries, pre, post, shim }, + } = await fs.readJson(join(cwd, 'package.json')); + + const optimized = hasFlag(flags, 'optimized'); + const tsnodePath = join(__dirname, '..', 'node_modules', '.bin', 'ts-node'); + + if (pre) { + await exec(`${tsnodePath} ${pre}`, { cwd }); + } + + await Promise.all([ + ...entries.map(async (file: string) => { + const { name: entryName } = parse(file); + + const dtsPathName = join(process.cwd(), 'dist', `${entryName}.d.ts`); + const mjsPathName = join(process.cwd(), 'dist', `${entryName}.mjs`); + + await Promise.all([ + fs.ensureFile(dtsPathName).then(() => + fs.writeFile( + dtsPathName, + dedent` + // shim-mmode + export * from '${shim}' + ` + ) + ), + fs.ensureFile(mjsPathName).then(() => + fs.writeFile( + mjsPathName, + dedent` + // shim-mmode + export * from '${shim}' + ` + ) + ), + ]); + }), + build({ + entry: entries.map((e: string) => slash(join(cwd, e))), + outDir: join(process.cwd(), 'dist'), + format: ['cjs'], + target: 'node16', + platform: 'node', + external: [name, ...Object.keys(dependencies || {}), ...Object.keys(peerDependencies || {})], + + esbuildOptions: (c) => { + /* eslint-disable no-param-reassign */ + c.platform = 'node'; + c.legalComments = 'none'; + c.minifyWhitespace = optimized; + c.minifyIdentifiers = optimized; + c.minifySyntax = optimized; + /* eslint-enable no-param-reassign */ + }, + }), + ]); + + if (pre) { + await exec(`${tsnodePath} ${post}`, { cwd }); + } +}; + +const flags = process.argv.slice(2); +const cwd = process.cwd(); + +run({ cwd, flags }).catch((err: unknown) => { + // We can't let the stack try to print, it crashes in a way that sets the exit code to 0. + // Seems to have something to do with running JSON.parse() on binary / base64 encoded sourcemaps + // in @cspotcode/source-map-support + if (err instanceof Error) { + console.error(err.message); + } + process.exit(1); +}); From aaddf6b538b039e112bfb919698464c21ee42169 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Thu, 3 Nov 2022 22:28:14 +0100 Subject: [PATCH 12/47] fix --- code/lib/core-server/package.json | 2 -- code/lib/preview-api/package.json | 1 + code/yarn.lock | 3 +-- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/code/lib/core-server/package.json b/code/lib/core-server/package.json index 64457f3d485..edb34e25c20 100644 --- a/code/lib/core-server/package.json +++ b/code/lib/core-server/package.json @@ -36,7 +36,6 @@ "@aw-web-design/x-default-browser": "1.4.88", "@discoveryjs/json-ext": "^0.5.3", "@storybook/builder-manager": "7.0.0-alpha.47", - "@storybook/core-client": "7.0.0-alpha.47", "@storybook/core-common": "7.0.0-alpha.47", "@storybook/core-events": "7.0.0-alpha.47", "@storybook/csf": "next", @@ -44,7 +43,6 @@ "@storybook/docs-mdx": "0.0.1-canary.12433cf.0", "@storybook/node-logger": "7.0.0-alpha.47", "@storybook/preview-api": "7.0.0-alpha.47", - "@storybook/store": "7.0.0-alpha.47", "@storybook/telemetry": "7.0.0-alpha.47", "@storybook/types": "7.0.0-alpha.47", "@types/node": "^16.0.0", diff --git a/code/lib/preview-api/package.json b/code/lib/preview-api/package.json index d2b283db2d3..909d634539e 100644 --- a/code/lib/preview-api/package.json +++ b/code/lib/preview-api/package.json @@ -63,6 +63,7 @@ }, "dependencies": { "@storybook/addons": "7.0.0-alpha.47", + "@storybook/channels": "next", "@storybook/client-logger": "7.0.0-alpha.47", "@storybook/core-events": "7.0.0-alpha.47", "@storybook/csf": "next", diff --git a/code/yarn.lock b/code/yarn.lock index 90612493157..631920aa161 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -6544,7 +6544,6 @@ __metadata: "@discoveryjs/json-ext": ^0.5.3 "@storybook/builder-manager": 7.0.0-alpha.47 "@storybook/builder-webpack5": 7.0.0-alpha.47 - "@storybook/core-client": 7.0.0-alpha.47 "@storybook/core-common": 7.0.0-alpha.47 "@storybook/core-events": 7.0.0-alpha.47 "@storybook/csf": next @@ -6552,7 +6551,6 @@ __metadata: "@storybook/docs-mdx": 0.0.1-canary.12433cf.0 "@storybook/node-logger": 7.0.0-alpha.47 "@storybook/preview-api": 7.0.0-alpha.47 - "@storybook/store": 7.0.0-alpha.47 "@storybook/telemetry": 7.0.0-alpha.47 "@storybook/types": 7.0.0-alpha.47 "@types/compression": ^1.7.0 @@ -7240,6 +7238,7 @@ __metadata: resolution: "@storybook/preview-api@workspace:lib/preview-api" dependencies: "@storybook/addons": 7.0.0-alpha.47 + "@storybook/channels": next "@storybook/client-logger": 7.0.0-alpha.47 "@storybook/core-events": 7.0.0-alpha.47 "@storybook/csf": next From adc0f08eae8731e4efff479676bf5c54cb24f682 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Thu, 3 Nov 2022 22:43:51 +0100 Subject: [PATCH 13/47] fix --- code/lib/preview-api/src/modules/client-api/ClientApi.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/code/lib/preview-api/src/modules/client-api/ClientApi.ts b/code/lib/preview-api/src/modules/client-api/ClientApi.ts index 60d3025915d..1008e670bf8 100644 --- a/code/lib/preview-api/src/modules/client-api/ClientApi.ts +++ b/code/lib/preview-api/src/modules/client-api/ClientApi.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-this-alias */ /// import { dedent } from 'ts-dedent'; @@ -134,8 +133,7 @@ export class ClientApi { this.storyStore = storyStore; - // @ts-expect-error (whatever) - singleton = this; + singleton = this as any; } importFn(path: Path) { From ef7874bed2f816c3dc1e5afec455fd296dfb5349 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Thu, 3 Nov 2022 22:53:29 +0100 Subject: [PATCH 14/47] fix --- scripts/tasks/sandbox-parts.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/tasks/sandbox-parts.ts b/scripts/tasks/sandbox-parts.ts index 41340932b40..f9aeb4f06e5 100644 --- a/scripts/tasks/sandbox-parts.ts +++ b/scripts/tasks/sandbox-parts.ts @@ -343,7 +343,7 @@ export const addStories: Task['run'] = async ( // Add stories for lib/store (and addons below). NOTE: these stories will be in the // template-stories folder and *not* processed by the framework build config (instead by esbuild-loader) - await linkPackageStories(await workspacePath('core package', '@storybook/preview-api'), { + await linkPackageStories(await workspacePath('core package', '@storybook/store'), { mainConfig, cwd, }); From 6cde3ad106ea861c71c47bdaa21f5672ebc05304 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Thu, 3 Nov 2022 23:14:05 +0100 Subject: [PATCH 15/47] fix --- .../src/preview/iframe-webpack.config.ts | 2 +- code/lib/preview/package.json | 6 ++ code/lib/preview/src/global/preview-api.ts | 92 ++++++++++++++++++- 3 files changed, 97 insertions(+), 3 deletions(-) diff --git a/code/lib/builder-webpack5/src/preview/iframe-webpack.config.ts b/code/lib/builder-webpack5/src/preview/iframe-webpack.config.ts index 500219a302d..bfa24c931b6 100644 --- a/code/lib/builder-webpack5/src/preview/iframe-webpack.config.ts +++ b/code/lib/builder-webpack5/src/preview/iframe-webpack.config.ts @@ -55,7 +55,7 @@ const storybookPaths: Record = { ...acc, [`@storybook/${sbPackage}`]: join( dirname(require.resolve(`@storybook/preview/package.json`)), - `dist/global/${sbPackage}.mjs` + `dist/global/${sbPackage}` ), }), {} diff --git a/code/lib/preview/package.json b/code/lib/preview/package.json index 379e3c945d8..d50ac5f28aa 100644 --- a/code/lib/preview/package.json +++ b/code/lib/preview/package.json @@ -71,6 +71,11 @@ "require": "./dist/global/preview-web.js", "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": { "import": "./dist/global/store.mjs", "require": "./dist/global/store.js", @@ -139,6 +144,7 @@ "./src/global/core-client.ts", "./src/global/core-events.ts", "./src/global/preview-web.ts", + "./src/global/preview-api.ts", "./src/global/store.ts" ] }, diff --git a/code/lib/preview/src/global/preview-api.ts b/code/lib/preview/src/global/preview-api.ts index 760bd04cb38..8e768cc5fc7 100644 --- a/code/lib/preview/src/global/preview-api.ts +++ b/code/lib/preview/src/global/preview-api.ts @@ -1,5 +1,5 @@ /* eslint-disable no-underscore-dangle */ -import type * as MODULE from '../preview-web'; +import type * as MODULE from '../preview-api'; const { DocsContext, @@ -8,7 +8,51 @@ const { composeConfigs, simulateDOMContentLoaded, 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 { DocsContext, @@ -17,4 +61,48 @@ export { composeConfigs, simulateDOMContentLoaded, 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, }; From f5194da656f9d38b916fc70c08572fa633a4afe9 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Fri, 4 Nov 2022 09:15:53 +0100 Subject: [PATCH 16/47] fixes --- code/lib/preview-api/package.json | 3 ++ .../src/modules/client-api/ClientApi.test.ts | 2 +- .../modules/core-client/executeLoadable.ts | 9 ++++- .../src/modules/core-client/start.test.ts | 29 +++++++------- .../PreviewWeb.integration.test.ts | 1 - .../preview-web/PreviewWeb.mockdata.ts | 10 +++-- .../modules/preview-web/PreviewWeb.test.ts | 38 ++++++++++++++----- .../src/modules/preview-web/UrlStore.test.ts | 2 +- .../src/modules/store/StoryIndexStore.test.ts | 4 +- .../src/modules/store/StoryStore.test.ts | 10 ++--- .../src/modules/store/autoTitle.test.ts | 2 +- .../modules/store/csf/composeConfigs.test.ts | 6 +-- .../store/csf/testing-utils/index.test.ts | 1 + .../src/modules/store/decorators.test.ts | 26 ++++++------- .../src/modules/store/hooks.test.ts | 30 +++++++-------- code/lib/preview-api/tsconfig.json | 3 +- .../src/components/preview/tools/addons.tsx | 2 +- .../src/components/preview/tools/copy.tsx | 2 +- .../src/components/preview/tools/eject.tsx | 2 +- .../src/components/preview/tools/menu.tsx | 2 +- .../src/components/preview/tools/remount.tsx | 2 +- .../src/components/preview/tools/zoom.tsx | 2 +- code/yarn.lock | 1 + 23 files changed, 110 insertions(+), 79 deletions(-) diff --git a/code/lib/preview-api/package.json b/code/lib/preview-api/package.json index 909d634539e..0b5f9c2e665 100644 --- a/code/lib/preview-api/package.json +++ b/code/lib/preview-api/package.json @@ -80,6 +80,9 @@ "ts-dedent": "^2.0.0", "util-deprecate": "^1.0.2" }, + "devDependencies": { + "@jest/globals": "^26.6.2" + }, "publishConfig": { "access": "public" }, diff --git a/code/lib/preview-api/src/modules/client-api/ClientApi.test.ts b/code/lib/preview-api/src/modules/client-api/ClientApi.test.ts index d4b44e04a1d..18e96557ad3 100644 --- a/code/lib/preview-api/src/modules/client-api/ClientApi.test.ts +++ b/code/lib/preview-api/src/modules/client-api/ClientApi.test.ts @@ -18,7 +18,7 @@ describe('ClientApi', () => { }; clientApi.storyStore = store as any; - let disposeCallback: () => void; + let disposeCallback: () => void = () => {}; const module1 = { id: 'file1', hot: { diff --git a/code/lib/preview-api/src/modules/core-client/executeLoadable.ts b/code/lib/preview-api/src/modules/core-client/executeLoadable.ts index cf6a1e9c394..a586d243428 100644 --- a/code/lib/preview-api/src/modules/core-client/executeLoadable.ts +++ b/code/lib/preview-api/src/modules/core-client/executeLoadable.ts @@ -36,7 +36,7 @@ export function executeLoadable(loadable: Loadable) { typeof req.resolve === 'function' ? req.resolve(filename) : filename, fileExports ); - } catch (error) { + } catch (error: any) { const errorString = error.message && error.stack ? `${error.message}\n ${error.stack}` : error.toString(); logger.error(`Unexpected error while loading ${filename}: ${errorString}`); @@ -92,7 +92,12 @@ export function executeLoadableForChanges(loadable: Loadable, m?: NodeModule) { const removed = new Map(); Array.from(lastExportsMap.keys()) .filter((fileName) => !exportsMap.has(fileName)) - .forEach((fileName) => removed.set(fileName, lastExportsMap.get(fileName))); + .forEach((fileName) => { + const value = lastExportsMap.get(fileName); + if (value) { + removed.set(fileName, value); + } + }); // Save the value for the dispose() call above lastExportsMap = exportsMap; diff --git a/code/lib/preview-api/src/modules/core-client/start.test.ts b/code/lib/preview-api/src/modules/core-client/start.test.ts index bd4ff6e245f..26cef772b0a 100644 --- a/code/lib/preview-api/src/modules/core-client/start.test.ts +++ b/code/lib/preview-api/src/modules/core-client/start.test.ts @@ -15,7 +15,6 @@ import { import { start as realStart } from './start'; jest.mock('global', () => ({ - // @ts-expect-error (jest is not happy with this) ...jest.requireActual('global'), history: { replaceState: jest.fn() }, document: { @@ -122,7 +121,7 @@ describe('start', () => { await waitForRender(); - expect(mockChannel.emit.mock.calls.find((call: [string, any]) => call[0] === SET_INDEX)[1]) + expect(mockChannel.emit.mock.calls.find((call) => call[0] === SET_INDEX)?.[1]) .toMatchInlineSnapshot(` Object { "entries": Object { @@ -277,9 +276,7 @@ describe('start', () => { await waitForRender(); expect(mockChannel.emit).toHaveBeenCalledWith(STORY_RENDERED, 'component-a--default'); - const storiesOfData = mockChannel.emit.mock.calls.find( - (call: any[]) => call[0] === SET_INDEX - )[1]; + const storiesOfData = mockChannel.emit.mock.calls.find((call) => call[0] === SET_INDEX)?.[1]; expect(Object.values(storiesOfData.entries).map((s: any) => s.parameters.fileName)).toEqual([ 'file1', 'file1-2', @@ -410,7 +407,7 @@ describe('start', () => { .add('new', jest.fn()); await waitForEvents([SET_INDEX]); - expect(mockChannel.emit.mock.calls.find((call: [string, any]) => call[0] === SET_INDEX)[1]) + expect(mockChannel.emit.mock.calls.find((call) => call[0] === SET_INDEX)?.[1]) .toMatchInlineSnapshot(` Object { "entries": Object { @@ -481,7 +478,7 @@ describe('start', () => { }); await waitForEvents([SET_INDEX]); - expect(mockChannel.emit.mock.calls.find((call: [string, any]) => call[0] === SET_INDEX)[1]) + expect(mockChannel.emit.mock.calls.find((call) => call[0] === SET_INDEX)?.[1]) .toMatchInlineSnapshot(` Object { "entries": Object { @@ -533,7 +530,7 @@ describe('start', () => { disposeCallback(); await waitForEvents([SET_INDEX]); - expect(mockChannel.emit.mock.calls.find((call: [string, any]) => call[0] === SET_INDEX)[1]) + expect(mockChannel.emit.mock.calls.find((call) => call[0] === SET_INDEX)?.[1]) .toMatchInlineSnapshot(` Object { "entries": Object { @@ -584,7 +581,7 @@ describe('start', () => { configure('test', () => [componentCExports]); await waitForRender(); - expect(mockChannel.emit.mock.calls.find((call: [string, any]) => call[0] === SET_INDEX)[1]) + expect(mockChannel.emit.mock.calls.find((call) => call[0] === SET_INDEX)?.[1]) .toMatchInlineSnapshot(` Object { "entries": Object { @@ -705,7 +702,7 @@ describe('start', () => { configure('test', () => [{ ...componentCExports, StoryThree: jest.fn() }], module as any); await waitForEvents([SET_INDEX]); - expect(mockChannel.emit.mock.calls.find((call: [string, any]) => call[0] === SET_INDEX)[1]) + expect(mockChannel.emit.mock.calls.find((call) => call[0] === SET_INDEX)?.[1]) .toMatchInlineSnapshot(` Object { "entries": Object { @@ -796,7 +793,7 @@ describe('start', () => { ); await waitForEvents([SET_INDEX]); - expect(mockChannel.emit.mock.calls.find((call: [string, any]) => call[0] === SET_INDEX)[1]) + expect(mockChannel.emit.mock.calls.find((call) => call[0] === SET_INDEX)?.[1]) .toMatchInlineSnapshot(` Object { "entries": Object { @@ -868,7 +865,7 @@ describe('start', () => { configure('test', () => [componentCExports], module as any); await waitForEvents([SET_INDEX]); - expect(mockChannel.emit.mock.calls.find((call: [string, any]) => call[0] === SET_INDEX)[1]) + expect(mockChannel.emit.mock.calls.find((call) => call[0] === SET_INDEX)?.[1]) .toMatchInlineSnapshot(` Object { "entries": Object { @@ -968,7 +965,7 @@ describe('start', () => { ); await waitForEvents([SET_INDEX]); - expect(mockChannel.emit.mock.calls.find((call: [string, any]) => call[0] === SET_INDEX)[1]) + expect(mockChannel.emit.mock.calls.find((call) => call[0] === SET_INDEX)?.[1]) .toMatchInlineSnapshot(` Object { "entries": Object { @@ -1014,7 +1011,7 @@ describe('start', () => { }); await waitForRender(); - expect(mockChannel.emit.mock.calls.find((call: [string, any]) => call[0] === SET_INDEX)[1]) + expect(mockChannel.emit.mock.calls.find((call) => call[0] === SET_INDEX)?.[1]) .toMatchInlineSnapshot(` Object { "entries": Object { @@ -1157,7 +1154,7 @@ describe('start', () => { }); await waitForRender(); - expect(mockChannel.emit.mock.calls.find((call: [string, any]) => call[0] === SET_INDEX)[1]) + expect(mockChannel.emit.mock.calls.find((call) => call[0] === SET_INDEX)?.[1]) .toMatchInlineSnapshot(` Object { "entries": Object { @@ -1311,7 +1308,7 @@ describe('start', () => { configure('test', () => [componentDExports]); await waitForEvents([SET_INDEX]); - expect(mockChannel.emit.mock.calls.find((call: [string, any]) => call[0] === SET_INDEX)[1]) + expect(mockChannel.emit.mock.calls.find((call) => call[0] === SET_INDEX)?.[1]) .toMatchInlineSnapshot(` Object { "entries": Object { diff --git a/code/lib/preview-api/src/modules/preview-web/PreviewWeb.integration.test.ts b/code/lib/preview-api/src/modules/preview-web/PreviewWeb.integration.test.ts index 894bbb08318..c971d12a2be 100644 --- a/code/lib/preview-api/src/modules/preview-web/PreviewWeb.integration.test.ts +++ b/code/lib/preview-api/src/modules/preview-web/PreviewWeb.integration.test.ts @@ -29,7 +29,6 @@ jest.mock('./WebView'); const { window, document } = global; jest.mock('global', () => ({ - // @ts-expect-error (Converted from ts-ignore) ...jest.requireActual('global'), history: { replaceState: jest.fn() }, document: { diff --git a/code/lib/preview-api/src/modules/preview-web/PreviewWeb.mockdata.ts b/code/lib/preview-api/src/modules/preview-web/PreviewWeb.mockdata.ts index f836bc56c7a..d17d14d1803 100644 --- a/code/lib/preview-api/src/modules/preview-web/PreviewWeb.mockdata.ts +++ b/code/lib/preview-api/src/modules/preview-web/PreviewWeb.mockdata.ts @@ -10,7 +10,11 @@ import { STORY_THREW_EXCEPTION, } from '@storybook/core-events'; -import type { Store_StoryIndex, Store_TeardownRenderToDOM } from '@storybook/types'; +import type { + Store_ModuleImportFn, + Store_StoryIndex, + Store_TeardownRenderToDOM, +} from '@storybook/types'; import type { RenderPhase } from './render/StoryRender'; export const componentOneExports = { @@ -44,7 +48,7 @@ export const extraComponentOneExports = { }, e: {}, }; -export const importFn = jest.fn( +export const importFn: Store_ModuleImportFn = jest.fn( async (path: string) => ({ './src/ComponentOne.stories.js': componentOneExports, @@ -52,7 +56,7 @@ export const importFn = jest.fn( './src/Introduction.mdx': standaloneDocsExports, './src/ExtraComponentOne.stories.js': extraComponentOneExports, }[path]) -); +) as any as Store_ModuleImportFn; export const docsRenderer = { render: jest.fn().mockImplementation((context, parameters, element, cb) => cb()), diff --git a/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts b/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts index 605b7df48e7..e6dd033fe8a 100644 --- a/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts +++ b/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts @@ -29,9 +29,13 @@ import { } from '@storybook/core-events'; import { logger } from '@storybook/client-logger'; import { addons, mockChannel as createMockChannel } from '@storybook/addons'; -import type { AnyFramework } from '@storybook/types'; +import type { + AnyFramework, + Store_ModuleImportFn, + Store_WebProjectAnnotations, +} from '@storybook/types'; import { mocked } from 'ts-jest/utils'; -import type { ModuleImportFn, WebProjectAnnotations } from '../../store'; +// import type { ModuleImportFn, WebProjectAnnotations } from '../../store'; import { PreviewWeb } from './PreviewWeb'; import { @@ -57,7 +61,7 @@ const { history, document } = global; const mockStoryIndex = jest.fn(() => storyIndex); -let mockFetchResult; +let mockFetchResult: any; jest.mock('global', () => ({ ...(mockJest.requireActual('global') as any), history: { replaceState: mockJest.fn() }, @@ -109,8 +113,8 @@ async function createAndRenderPreview({ importFn: inputImportFn = importFn, getProjectAnnotations: inputGetProjectAnnotations = getProjectAnnotations, }: { - importFn?: ModuleImportFn; - getProjectAnnotations?: () => WebProjectAnnotations; + importFn?: Store_ModuleImportFn; + getProjectAnnotations?: () => Store_WebProjectAnnotations; } = {}) { const preview = new PreviewWeb(); await preview.initialize({ @@ -685,7 +689,7 @@ describe('PreviewWeb', () => { const context = docsRenderer.render.mock.calls[0][0]; - expect(context.componentStories().map((s) => s.id)).toEqual([ + expect(context.componentStories().map((s: any) => s.id)).toEqual([ 'component-one--a', 'component-one--b', 'component-one--e', @@ -1141,6 +1145,7 @@ describe('PreviewWeb', () => { const preview = await createAndRenderPreview(); await waitForRender(); + // @ts-expect-error (jest mock) importFn.mockClear(); await preview.onPreloadStories({ ids: ['component-two--c'] }); expect(importFn).toHaveBeenCalledWith('./src/ComponentTwo.stories.js'); @@ -1151,6 +1156,7 @@ describe('PreviewWeb', () => { const preview = await createAndRenderPreview(); await waitForRender(); + // @ts-expect-error (jest mock) importFn.mockClear(); await preview.onPreloadStories({ ids: ['component-one--docs'] }); expect(importFn).toHaveBeenCalledWith('./src/ComponentOne.stories.js'); @@ -1161,6 +1167,7 @@ describe('PreviewWeb', () => { const preview = await createAndRenderPreview(); await waitForRender(); + // @ts-expect-error (jest mock) importFn.mockClear(); await preview.onPreloadStories({ ids: ['introduction--docs'] }); expect(importFn).toHaveBeenCalledWith('./src/Introduction.mdx'); @@ -1170,6 +1177,7 @@ describe('PreviewWeb', () => { const preview = await createAndRenderPreview(); await waitForRender(); + // @ts-expect-error (jest mock) importFn.mockClear(); await preview.onPreloadStories({ ids: ['introduction--docs'] }); expect(importFn).toHaveBeenCalledWith('./src/ComponentTwo.stories.js'); @@ -1607,14 +1615,18 @@ describe('PreviewWeb', () => { const [gate, openGate] = createGate(); const [importedGate, openImportedGate] = createGate(); importFn + // @ts-expect-error (jest mock) .mockImplementationOnce(async (...args) => { await gate; + // @ts-expect-error (jest mock) return importFn(...args); }) + // @ts-expect-error (jest mock) .mockImplementationOnce(async (...args) => { // The second time we `import()` we open the "imported" gate openImportedGate(); await gate; + // @ts-expect-error (jest mock) return importFn(...args); }); @@ -1652,14 +1664,18 @@ describe('PreviewWeb', () => { const [gate, openGate] = createGate(); const [importedGate, openImportedGate] = createGate(); importFn + // @ts-expect-error (jest mock) .mockImplementationOnce(async (...args) => { await gate; + // @ts-expect-error (jest mock) return importFn(...args); }) + // @ts-expect-error (jest mock) .mockImplementationOnce(async (...args) => { // The second time we `import()` we open the "imported" gate openImportedGate(); await gate; + // @ts-expect-error (jest mock) return importFn(...args); }); @@ -1696,14 +1712,18 @@ describe('PreviewWeb', () => { const [gate, openGate] = createGate(); const [importedGate, openImportedGate] = createGate(); importFn + // @ts-expect-error (jest mock) .mockImplementationOnce(async (...args) => { await gate; + // @ts-expect-error (jest mock) return importFn(...args); }) + // @ts-expect-error (jest mock) .mockImplementationOnce(async (...args) => { // The second time we `import()` we open the "imported" gate openImportedGate(); await gate; + // @ts-expect-error (jest mock) return importFn(...args); }); @@ -3072,7 +3092,7 @@ describe('PreviewWeb', () => { describe('when a standalone docs file changes', () => { const newStandaloneDocsExports = { default: jest.fn() }; - const newImportFn = jest.fn(async (path) => { + const newImportFn = jest.fn(async (path: string) => { return path === './src/Introduction.mdx' ? newStandaloneDocsExports : importFn(path); }); @@ -3180,7 +3200,7 @@ describe('PreviewWeb', () => { expect(mockChannel.emit).toHaveBeenCalledWith(CONFIG_ERROR, err); }); - const newGlobalDecorator = jest.fn((s) => s()); + const newGlobalDecorator = jest.fn((s: any) => s()); const newGetProjectAnnotations = () => { return { ...projectAnnotations, @@ -3388,7 +3408,7 @@ describe('PreviewWeb', () => { it('waits for stories to be cached', async () => { const [gate, openGate] = createGate(); - const gatedImportFn = async (path) => { + const gatedImportFn = async (path: string) => { await gate; return importFn(path); }; diff --git a/code/lib/preview-api/src/modules/preview-web/UrlStore.test.ts b/code/lib/preview-api/src/modules/preview-web/UrlStore.test.ts index 132e368ede9..9abba8f7c0e 100644 --- a/code/lib/preview-api/src/modules/preview-web/UrlStore.test.ts +++ b/code/lib/preview-api/src/modules/preview-web/UrlStore.test.ts @@ -20,7 +20,7 @@ describe('UrlStore', () => { expect(pathToId('/story/story--id')).toEqual('story--id'); }); it('should error on invalid ids', () => { - [null, '', '/whatever/story/story--id'].forEach((path) => { + [null, '', '/whatever/story/story--id'].forEach((path: any) => { expect(() => pathToId(path)).toThrow(/Invalid/); }); }); diff --git a/code/lib/preview-api/src/modules/store/StoryIndexStore.test.ts b/code/lib/preview-api/src/modules/store/StoryIndexStore.test.ts index c49e5988a78..b2ad87c6dae 100644 --- a/code/lib/preview-api/src/modules/store/StoryIndexStore.test.ts +++ b/code/lib/preview-api/src/modules/store/StoryIndexStore.test.ts @@ -32,11 +32,11 @@ const storyIndex: Store_StoryIndex = { }, }; -const makeStoryIndex = (titlesAndNames) => { +const makeStoryIndex = (titlesAndNames: any) => { return { v: 4, entries: Object.fromEntries( - titlesAndNames.map(([title, name]) => { + titlesAndNames.map(([title, name]: any[]) => { const id = `${title}--${name}`.replace('/', '-'); return [ id, diff --git a/code/lib/preview-api/src/modules/store/StoryStore.test.ts b/code/lib/preview-api/src/modules/store/StoryStore.test.ts index 2510e14374b..4ccc6af8571 100644 --- a/code/lib/preview-api/src/modules/store/StoryStore.test.ts +++ b/code/lib/preview-api/src/modules/store/StoryStore.test.ts @@ -1,12 +1,11 @@ -import type { AnyFramework, ProjectAnnotations } from '@storybook/types'; +import type { AnyFramework, ProjectAnnotations, Store_StoryIndex } from '@storybook/types'; import global from 'global'; import { expect } from '@jest/globals'; import { prepareStory } from './csf/prepareStory'; import { processCSFFile } from './csf/processCSFFile'; import { StoryStore } from './StoryStore'; -import type { StoryIndex } from './types'; -import type { HooksContext } from './hooks'; +import type { HooksContext } from '../..'; // Spy on prepareStory/processCSFFile jest.mock('./csf/prepareStory', () => ({ @@ -43,7 +42,7 @@ const projectAnnotations: ProjectAnnotations = { render: jest.fn(), }; -const storyIndex: StoryIndex = { +const storyIndex: Store_StoryIndex = { v: 4, entries: { 'component-one--a': { @@ -631,10 +630,11 @@ describe('StoryStore', () => { }); it('does not include (modern) docs entries ever', async () => { - const docsOnlyStoryIndex: StoryIndex = { + const docsOnlyStoryIndex: Store_StoryIndex = { v: 4, entries: { ...storyIndex.entries, + // @ts-expect-error (not strict) 'introduction--docs': { type: 'docs', id: 'introduction--docs', diff --git a/code/lib/preview-api/src/modules/store/autoTitle.test.ts b/code/lib/preview-api/src/modules/store/autoTitle.test.ts index 256b91d2d40..e4c1fe23dbb 100644 --- a/code/lib/preview-api/src/modules/store/autoTitle.test.ts +++ b/code/lib/preview-api/src/modules/store/autoTitle.test.ts @@ -5,7 +5,7 @@ import { userOrAutoTitleFromSpecifier as userOrAuto } from './autoTitle'; expect.addSnapshotSerializer({ print: (val: any) => val, - test: (val) => true, + test: (val: any) => true, }); // Make these two the same so `normalizeStoriesEntry` doesn't change anything diff --git a/code/lib/preview-api/src/modules/store/csf/composeConfigs.test.ts b/code/lib/preview-api/src/modules/store/csf/composeConfigs.test.ts index 97c920c7993..45bfdfdd333 100644 --- a/code/lib/preview-api/src/modules/store/csf/composeConfigs.test.ts +++ b/code/lib/preview-api/src/modules/store/csf/composeConfigs.test.ts @@ -162,9 +162,9 @@ describe('composeConfigs', () => { const fn = jest.fn(); const { runStep } = composeConfigs([ - { runStep: (label, play, context) => fn(`${label}1`, play(context)) }, - { runStep: (label, play, context) => fn(`${label}2`, play(context)) }, - { runStep: (label, play, context) => fn(`${label}3`, play(context)) }, + { runStep: (label: any, play: any, context: any) => fn(`${label}1`, play(context)) }, + { runStep: (label: any, play: any, context: any) => fn(`${label}2`, play(context)) }, + { runStep: (label: any, play: any, context: any) => fn(`${label}3`, play(context)) }, ]); // @ts-expect-error We don't care about the context value here diff --git a/code/lib/preview-api/src/modules/store/csf/testing-utils/index.test.ts b/code/lib/preview-api/src/modules/store/csf/testing-utils/index.test.ts index 1f2d7c25c6c..67af03fb2e5 100644 --- a/code/lib/preview-api/src/modules/store/csf/testing-utils/index.test.ts +++ b/code/lib/preview-api/src/modules/store/csf/testing-utils/index.test.ts @@ -31,6 +31,7 @@ describe('composeStory', () => { test('should throw an error if Story is undefined', () => { expect(() => { + // @ts-expect-error (this is supposed to fail) composeStory(undefined, meta); }).toThrow(); }); diff --git a/code/lib/preview-api/src/modules/store/decorators.test.ts b/code/lib/preview-api/src/modules/store/decorators.test.ts index 5739dd5f28d..bebc25e05e7 100644 --- a/code/lib/preview-api/src/modules/store/decorators.test.ts +++ b/code/lib/preview-api/src/modules/store/decorators.test.ts @@ -18,9 +18,9 @@ describe('client-api.decorators', () => { it('calls decorators in out to in order', () => { const order: number[] = []; const decorators = [ - (s) => order.push(1) && s(), - (s) => order.push(2) && s(), - (s) => order.push(3) && s(), + (s: any) => order.push(1) && s(), + (s: any) => order.push(2) && s(), + (s: any) => order.push(3) && s(), ]; const decorated = defaultDecorateStory(() => order.push(4), decorators); @@ -32,9 +32,9 @@ describe('client-api.decorators', () => { it('passes context through to sub decorators', () => { const contexts: StoryContext[] = []; const decorators = [ - (s, c) => contexts.push(c) && s({ args: { k: 1 } }), - (s, c) => contexts.push(c) && s({ args: { k: 2 } }), - (s, c) => contexts.push(c) && s({ args: { k: 3 } }), + (s: any, c: any) => contexts.push(c) && s({ args: { k: 1 } }), + (s: any, c: any) => contexts.push(c) && s({ args: { k: 2 } }), + (s: any, c: any) => contexts.push(c) && s({ args: { k: 3 } }), ]; const decorated = defaultDecorateStory((c) => contexts.push(c), decorators); @@ -46,8 +46,8 @@ describe('client-api.decorators', () => { it('passes context through to sub decorators additively', () => { const contexts: StoryContext[] = []; const decorators = [ - (s, c) => contexts.push(c) && s({ args: { a: 1 } }), - (s, c) => contexts.push(c) && s({ globals: { g: 2 } }), + (s: any, c: any) => contexts.push(c) && s({ args: { a: 1 } }), + (s: any, c: any) => contexts.push(c) && s({ globals: { g: 2 } }), ]; const decorated = defaultDecorateStory((c) => contexts.push(c), decorators); @@ -61,9 +61,9 @@ describe('client-api.decorators', () => { }); it('does not recreate decorated story functions each time', () => { - const decoratedStories = []; + const decoratedStories: any[] = []; const decorators = [ - (s, c) => { + (s: any, c: any) => { decoratedStories.push = s; return s(); }, @@ -80,12 +80,12 @@ describe('client-api.decorators', () => { // the same story twice at the same time. it('does not interleave contexts if two decorated stories are call simultaneously', async () => { const contexts: StoryContext[] = []; - let resolve; + let resolve: any; const fence = new Promise((r) => { resolve = r; }); const decorators = [ - async (s, c) => { + async (s: any, c: any) => { // The fence here simulates async-ness in react rendering an element (`` doesn't run `S()` straight away) await fence; s(); @@ -107,7 +107,7 @@ describe('client-api.decorators', () => { it('DOES NOT merge core metadata or pass through core metadata keys in context', () => { const contexts: StoryContext[] = []; const decorators = [ - (s, c) => + (s: any, c: any) => contexts.push(c) && s({ parameters: { c: 'd' }, id: 'notId', kind: 'notKind', name: 'notName' }), ]; diff --git a/code/lib/preview-api/src/modules/store/hooks.test.ts b/code/lib/preview-api/src/modules/store/hooks.test.ts index c124c9f63fc..c789fcbedae 100644 --- a/code/lib/preview-api/src/modules/store/hooks.test.ts +++ b/code/lib/preview-api/src/modules/store/hooks.test.ts @@ -31,16 +31,16 @@ jest.mock('@storybook/client-logger', () => ({ })); const SOME_EVENT = 'someEvent'; -let mockChannel; -let hooks; -let onSomeEvent; -let removeSomeEventListener; +let mockChannel: any; +let hooks: any; +let onSomeEvent: any; +let removeSomeEventListener: any; beforeEach(() => { onSomeEvent = jest.fn(); removeSomeEventListener = jest.fn(); mockChannel = { emit: jest.fn(), - on(event, callback) { + on(event: any, callback: any) { switch (event) { case STORY_RENDERED: callback(); @@ -51,7 +51,7 @@ beforeEach(() => { default: } }, - removeListener(event, callback) { + removeListener(event: any, callback: any) { if (event === SOME_EVENT) { removeSomeEventListener(event, callback); } @@ -63,7 +63,7 @@ beforeEach(() => { const decorateStory = applyHooks(defaultDecorateStory); -const run = (storyFn, decorators: DecoratorFunction[] = [], context = {}) => +const run = (storyFn: any, decorators: DecoratorFunction[] = [], context = {}) => decorateStory(storyFn, decorators)({ ...context, hooks } as StoryContext); describe('Preview hooks', () => { @@ -116,7 +116,7 @@ describe('Preview hooks', () => { }); it("doesn't retrigger the effect from decorator if story has changed", () => { const effect = jest.fn(); - const decorator = (storyFn) => { + const decorator = (storyFn: any) => { useEffect(effect, []); return storyFn(); }; @@ -126,7 +126,7 @@ describe('Preview hooks', () => { }); it("doesn't retrigger the effect from decorator if story has changed and story call comes before useEffect", () => { const effect = jest.fn(); - const decorator = (storyFn) => { + const decorator = (storyFn: any) => { const story = storyFn(); useEffect(effect, []); return story; @@ -140,7 +140,7 @@ describe('Preview hooks', () => { const story = () => { useEffect(effect, []); }; - const decorator = (storyFn) => { + const decorator = (storyFn: any) => { storyFn(); return storyFn(); }; @@ -348,7 +348,7 @@ describe('Preview hooks', () => { }); describe('useRef', () => { it('attaches initial value', () => { - let ref; + let ref: any; const storyFn = () => { ref = useRef('foo'); }; @@ -430,8 +430,8 @@ describe('Preview hooks', () => { expect(state).toBe(3); }); it('performs asynchronous state updates', () => { - let state; - let setState; + let state: any; + let setState: any; const storyFn = jest.fn(() => { [state, setState] = useState('foo'); }); @@ -484,8 +484,8 @@ describe('Preview hooks', () => { expect(state).toBe(3); }); it('performs asynchronous state updates', () => { - let state; - let dispatch; + let state: any; + let dispatch: any; const storyFn = jest.fn(() => { [state, dispatch] = useReducer((prevState, action) => { switch (action) { diff --git a/code/lib/preview-api/tsconfig.json b/code/lib/preview-api/tsconfig.json index abd5b1fe874..756dc08f473 100644 --- a/code/lib/preview-api/tsconfig.json +++ b/code/lib/preview-api/tsconfig.json @@ -1,7 +1,8 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "strict": true + "strict": true, + "skipLibCheck": true }, "include": ["src/**/*"], "exclude": [] diff --git a/code/ui/manager/src/components/preview/tools/addons.tsx b/code/ui/manager/src/components/preview/tools/addons.tsx index 88f61fec22d..1bd66a22ac8 100644 --- a/code/ui/manager/src/components/preview/tools/addons.tsx +++ b/code/ui/manager/src/components/preview/tools/addons.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { IconButton, Icons } from '@storybook/components'; import { Consumer, type Combo } from '@storybook/api'; -import type { Addon } from '@storybook/preview-api'; +import type { Addon } from '@storybook/addons'; const menuMapper = ({ api, state }: Combo) => ({ isVisible: state.layout.showPanel, diff --git a/code/ui/manager/src/components/preview/tools/copy.tsx b/code/ui/manager/src/components/preview/tools/copy.tsx index 306ec458f6c..aa8c48f8d33 100644 --- a/code/ui/manager/src/components/preview/tools/copy.tsx +++ b/code/ui/manager/src/components/preview/tools/copy.tsx @@ -3,7 +3,7 @@ import React from 'react'; import copy from 'copy-to-clipboard'; import { getStoryHref, IconButton, Icons } from '@storybook/components'; import { Consumer, type Combo } from '@storybook/api'; -import type { Addon } from '@storybook/preview-api'; +import type { Addon } from '@storybook/addons'; const { PREVIEW_URL, document } = global; diff --git a/code/ui/manager/src/components/preview/tools/eject.tsx b/code/ui/manager/src/components/preview/tools/eject.tsx index 33629f1006e..1a28a84c16b 100644 --- a/code/ui/manager/src/components/preview/tools/eject.tsx +++ b/code/ui/manager/src/components/preview/tools/eject.tsx @@ -2,7 +2,7 @@ import global from 'global'; import React from 'react'; import { getStoryHref, IconButton, Icons } from '@storybook/components'; import { Consumer, type Combo } from '@storybook/api'; -import type { Addon } from '@storybook/preview-api'; +import type { Addon } from '@storybook/addons'; const { PREVIEW_URL } = global; diff --git a/code/ui/manager/src/components/preview/tools/menu.tsx b/code/ui/manager/src/components/preview/tools/menu.tsx index 4156a3e7096..d5f4daea381 100644 --- a/code/ui/manager/src/components/preview/tools/menu.tsx +++ b/code/ui/manager/src/components/preview/tools/menu.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { IconButton, Icons, Separator } from '@storybook/components'; import { Consumer, type Combo } from '@storybook/api'; -import type { Addon } from '@storybook/preview-api'; +import type { Addon } from '@storybook/addons'; const menuMapper = ({ api, state }: Combo) => ({ isVisible: state.layout.showNav, diff --git a/code/ui/manager/src/components/preview/tools/remount.tsx b/code/ui/manager/src/components/preview/tools/remount.tsx index f8b0e1b6730..d56616bcdd5 100644 --- a/code/ui/manager/src/components/preview/tools/remount.tsx +++ b/code/ui/manager/src/components/preview/tools/remount.tsx @@ -2,7 +2,7 @@ import type { ComponentProps } from 'react'; import React, { useState } from 'react'; import { IconButton, Icons } from '@storybook/components'; import { Consumer, type Combo } from '@storybook/api'; -import type { Addon } from '@storybook/preview-api'; +import type { Addon } from '@storybook/addons'; import { styled } from '@storybook/theming'; import { FORCE_REMOUNT } from '@storybook/core-events'; diff --git a/code/ui/manager/src/components/preview/tools/zoom.tsx b/code/ui/manager/src/components/preview/tools/zoom.tsx index dc9196bbc8e..1ab5cc879e9 100644 --- a/code/ui/manager/src/components/preview/tools/zoom.tsx +++ b/code/ui/manager/src/components/preview/tools/zoom.tsx @@ -2,7 +2,7 @@ import type { SyntheticEvent, MouseEventHandler } from 'react'; import React, { Component, useCallback } from 'react'; import { Icons, IconButton, Separator } from '@storybook/components'; -import type { Addon } from '@storybook/preview-api'; +import type { Addon } from '@storybook/addons'; const initialZoom = 1 as const; diff --git a/code/yarn.lock b/code/yarn.lock index 631920aa161..ae6796cc6a0 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -7237,6 +7237,7 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/preview-api@workspace:lib/preview-api" dependencies: + "@jest/globals": ^26.6.2 "@storybook/addons": 7.0.0-alpha.47 "@storybook/channels": next "@storybook/client-logger": 7.0.0-alpha.47 From 37c1b5ed3415315706e12f99a5d39a3792258716 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Fri, 4 Nov 2022 09:18:53 +0100 Subject: [PATCH 17/47] fixes --- code/addons/a11y/src/manager.test.tsx | 4 ++-- .../update-organisation-name.output.snapshot | 2 +- code/lib/instrumenter/src/instrumenter.test.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/code/addons/a11y/src/manager.test.tsx b/code/addons/a11y/src/manager.test.tsx index 25729475f15..ff6c90a4452 100644 --- a/code/addons/a11y/src/manager.test.tsx +++ b/code/addons/a11y/src/manager.test.tsx @@ -1,10 +1,10 @@ -import { addons } from '@storybook/preview-api'; +import { addons } from '@storybook/addons'; import * as api from '@storybook/api'; import { PANEL_ID } from './constants'; import './manager'; jest.mock('@storybook/api'); -jest.mock('@storybook/preview-api'); +jest.mock('@storybook/addons'); const mockedApi = api as unknown as jest.Mocked; mockedApi.getAddonState = jest.fn(); const mockedAddons = addons as jest.Mocked; diff --git a/code/lib/codemod/src/transforms/__testfixtures__/update-organisation-name/update-organisation-name.output.snapshot b/code/lib/codemod/src/transforms/__testfixtures__/update-organisation-name/update-organisation-name.output.snapshot index df9ded66f42..5d16d1cc572 100644 --- a/code/lib/codemod/src/transforms/__testfixtures__/update-organisation-name/update-organisation-name.output.snapshot +++ b/code/lib/codemod/src/transforms/__testfixtures__/update-organisation-name/update-organisation-name.output.snapshot @@ -2,7 +2,7 @@ exports[`update-organisation-name transforms correctly using "update-organisation-name.input.js" data 1`] = ` "/* eslint-disable */ -import '@storybook/addons'; +import '@storybook/preview-api'; import '@storybook/addon-comments'; import '@storybook/addon-centered'; import '@storybook/addon-graphql'; diff --git a/code/lib/instrumenter/src/instrumenter.test.ts b/code/lib/instrumenter/src/instrumenter.test.ts index 6ac0827c851..647dbedb148 100644 --- a/code/lib/instrumenter/src/instrumenter.test.ts +++ b/code/lib/instrumenter/src/instrumenter.test.ts @@ -1,7 +1,7 @@ /// ; /* eslint-disable no-underscore-dangle */ -import { addons, mockChannel } from '@storybook/preview-api'; +import { addons, mockChannel } from '@storybook/addons'; import { logger } from '@storybook/client-logger'; import { FORCE_REMOUNT, From 4d50120516d336583cc720715e23d63c44e685ab Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Fri, 4 Nov 2022 09:34:27 +0100 Subject: [PATCH 18/47] fixes --- code/lib/preview-api/package.json | 6 ++++-- code/lib/preview-api/src/modules/preview-web/WebView.ts | 1 + code/lib/preview/src/client-api.ts | 1 + code/lib/preview/src/core-client.ts | 1 + code/lib/preview/src/global/client-api.ts | 1 + code/lib/preview/src/global/core-client.ts | 1 + code/lib/preview/src/global/preview-web.ts | 1 + code/lib/preview/src/global/store.ts | 1 + code/lib/preview/src/index.ts | 1 + code/lib/preview/src/preview-web.ts | 1 + code/lib/preview/src/store.ts | 1 + code/yarn.lock | 4 +++- scripts/prepare/facade.ts | 4 ++-- 13 files changed, 19 insertions(+), 5 deletions(-) diff --git a/code/lib/preview-api/package.json b/code/lib/preview-api/package.json index 0b5f9c2e665..76b63f80d42 100644 --- a/code/lib/preview-api/package.json +++ b/code/lib/preview-api/package.json @@ -63,7 +63,8 @@ }, "dependencies": { "@storybook/addons": "7.0.0-alpha.47", - "@storybook/channels": "next", + "@storybook/channel-postmessage": "7.0.0-alpha.47", + "@storybook/channels": "7.0.0-alpha.47", "@storybook/client-logger": "7.0.0-alpha.47", "@storybook/core-events": "7.0.0-alpha.47", "@storybook/csf": "next", @@ -81,7 +82,8 @@ "util-deprecate": "^1.0.2" }, "devDependencies": { - "@jest/globals": "^26.6.2" + "@jest/globals": "^26.6.2", + "ansi-to-html": "^0.6.11" }, "publishConfig": { "access": "public" diff --git a/code/lib/preview-api/src/modules/preview-web/WebView.ts b/code/lib/preview-api/src/modules/preview-web/WebView.ts index 1f009c058b7..b52b1602b7e 100644 --- a/code/lib/preview-api/src/modules/preview-web/WebView.ts +++ b/code/lib/preview-api/src/modules/preview-web/WebView.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/no-extraneous-dependencies */ import global from 'global'; import { logger } from '@storybook/client-logger'; import AnsiToHtml from 'ansi-to-html'; diff --git a/code/lib/preview/src/client-api.ts b/code/lib/preview/src/client-api.ts index f7fa2dedcc6..8214e18c1d3 100644 --- a/code/lib/preview/src/client-api.ts +++ b/code/lib/preview/src/client-api.ts @@ -1,2 +1,3 @@ +/* eslint-disable import/export */ /* eslint-disable import/no-extraneous-dependencies */ export * from '@storybook/client-api'; diff --git a/code/lib/preview/src/core-client.ts b/code/lib/preview/src/core-client.ts index 97d155a2969..44c7079f399 100644 --- a/code/lib/preview/src/core-client.ts +++ b/code/lib/preview/src/core-client.ts @@ -1,2 +1,3 @@ +/* eslint-disable import/export */ /* eslint-disable import/no-extraneous-dependencies */ export * from '@storybook/core-client'; diff --git a/code/lib/preview/src/global/client-api.ts b/code/lib/preview/src/global/client-api.ts index f7e17e5d142..1f7ff27176d 100644 --- a/code/lib/preview/src/global/client-api.ts +++ b/code/lib/preview/src/global/client-api.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/namespace */ /* eslint-disable no-underscore-dangle */ import type * as MODULE from '../client-api'; diff --git a/code/lib/preview/src/global/core-client.ts b/code/lib/preview/src/global/core-client.ts index 26b8d61b2a2..1d997093433 100644 --- a/code/lib/preview/src/global/core-client.ts +++ b/code/lib/preview/src/global/core-client.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/namespace */ /* eslint-disable no-underscore-dangle */ import type * as MODULE from '../core-client'; diff --git a/code/lib/preview/src/global/preview-web.ts b/code/lib/preview/src/global/preview-web.ts index 760bd04cb38..35858a05330 100644 --- a/code/lib/preview/src/global/preview-web.ts +++ b/code/lib/preview/src/global/preview-web.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/namespace */ /* eslint-disable no-underscore-dangle */ import type * as MODULE from '../preview-web'; diff --git a/code/lib/preview/src/global/store.ts b/code/lib/preview/src/global/store.ts index 873b4aa7818..1f181893637 100644 --- a/code/lib/preview/src/global/store.ts +++ b/code/lib/preview/src/global/store.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/namespace */ /* eslint-disable no-underscore-dangle */ import type * as MODULE from '../store'; diff --git a/code/lib/preview/src/index.ts b/code/lib/preview/src/index.ts index c03e1d5faa0..bad52ae825b 100644 --- a/code/lib/preview/src/index.ts +++ b/code/lib/preview/src/index.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/namespace */ /* eslint-disable no-underscore-dangle */ import * as ADDONS from './addons'; diff --git a/code/lib/preview/src/preview-web.ts b/code/lib/preview/src/preview-web.ts index d044c8dea7c..5ad59743ada 100644 --- a/code/lib/preview/src/preview-web.ts +++ b/code/lib/preview/src/preview-web.ts @@ -1,2 +1,3 @@ +/* eslint-disable import/export */ /* eslint-disable import/no-extraneous-dependencies */ export * from '@storybook/preview-web'; diff --git a/code/lib/preview/src/store.ts b/code/lib/preview/src/store.ts index ae79f8208a7..9a5bbd7de43 100644 --- a/code/lib/preview/src/store.ts +++ b/code/lib/preview/src/store.ts @@ -1,2 +1,3 @@ +/* eslint-disable import/export */ /* eslint-disable import/no-extraneous-dependencies */ export * from '@storybook/store'; diff --git a/code/yarn.lock b/code/yarn.lock index ae6796cc6a0..897952458bd 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -7239,13 +7239,15 @@ __metadata: dependencies: "@jest/globals": ^26.6.2 "@storybook/addons": 7.0.0-alpha.47 - "@storybook/channels": next + "@storybook/channel-postmessage": 7.0.0-alpha.47 + "@storybook/channels": 7.0.0-alpha.47 "@storybook/client-logger": 7.0.0-alpha.47 "@storybook/core-events": 7.0.0-alpha.47 "@storybook/csf": next "@storybook/types": 7.0.0-alpha.47 "@types/qs": ^6.9.5 "@types/webpack-env": ^1.16.4 + ansi-to-html: ^0.6.11 dequal: ^2.0.2 global: ^4.4.0 lodash: ^4.17.21 diff --git a/scripts/prepare/facade.ts b/scripts/prepare/facade.ts index 6c96103c0f7..d43d47ef89a 100755 --- a/scripts/prepare/facade.ts +++ b/scripts/prepare/facade.ts @@ -37,7 +37,7 @@ const run = async ({ cwd, flags }: { cwd: string; flags: string[] }) => { dtsPathName, dedent` // shim-mmode - export * from '${shim}' + export * from '${shim}'; ` ) ), @@ -46,7 +46,7 @@ const run = async ({ cwd, flags }: { cwd: string; flags: string[] }) => { mjsPathName, dedent` // shim-mmode - export * from '${shim}' + export * from '${shim}'; ` ) ), From 7fb553b7628d2203db37f2966416ea9167c31c14 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Fri, 4 Nov 2022 09:41:55 +0100 Subject: [PATCH 19/47] fixes --- code/ui/manager/src/components/preview/preview.mockdata.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/ui/manager/src/components/preview/preview.mockdata.tsx b/code/ui/manager/src/components/preview/preview.mockdata.tsx index 639a6026ce6..e0699aa5f8f 100644 --- a/code/ui/manager/src/components/preview/preview.mockdata.tsx +++ b/code/ui/manager/src/components/preview/preview.mockdata.tsx @@ -1,4 +1,4 @@ -import { types, type Addon } from '@storybook/preview-api'; +import { types, type Addon } from '@storybook/addons'; import type { API, State } from '@storybook/api'; import type { PreviewProps } from './utils/types'; @@ -24,6 +24,7 @@ export const previewProps: PreviewProps = { : []) as API['getElements'], } as any as API, entry: { + tags: [], type: 'story', id: 'story--id', parent: 'root', From 0b2da29514c2b849f1ad5daaae70a2924d87567c Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Fri, 4 Nov 2022 10:22:30 +0100 Subject: [PATCH 20/47] fixes --- code/lib/preview-api/src/modules/core-client/start.test.ts | 4 +--- .../preview-api/src/modules/preview-web/PreviewWeb.test.ts | 3 ++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/code/lib/preview-api/src/modules/core-client/start.test.ts b/code/lib/preview-api/src/modules/core-client/start.test.ts index 61e9e45ab72..007deb213a1 100644 --- a/code/lib/preview-api/src/modules/core-client/start.test.ts +++ b/code/lib/preview-api/src/modules/core-client/start.test.ts @@ -1319,9 +1319,7 @@ describe('start', () => { }); await waitForRender(); - const setIndexData = mockChannel.emit.mock.calls.find( - (call: [string, any]) => call[0] === SET_INDEX - )[1]; + const setIndexData = mockChannel.emit.mock.calls.find((call) => call[0] === SET_INDEX)?.[1]; expect(Object.keys(setIndexData.entries)).toMatchInlineSnapshot(` Array [ "component-a--docs", diff --git a/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts b/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts index e6dd033fe8a..d519e5c0655 100644 --- a/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts +++ b/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts @@ -1106,7 +1106,7 @@ describe('PreviewWeb', () => { mockChannel.emit.mockClear(); const story = await preview.storyStore.loadStory({ storyId: 'component-one--a' }); - preview.renderStoryToElement(story, 'story-element' as any); + preview.renderStoryToElement(story, 'story-element' as any, {}); await waitForRender(); expect(projectAnnotations.renderToDOM).toHaveBeenCalledWith( @@ -3353,6 +3353,7 @@ describe('PreviewWeb', () => { componentOneExports.b.play.mockImplementationOnce(async () => gate); preview.renderStoryToElement( await preview.storyStore.loadStory({ storyId: 'component-one--b' }), + 'story-element' as any, {} as any ); await waitForRenderPhase('playing'); From 7239afa266d5e4263acbe3e66a5f56a8367775aa Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Fri, 4 Nov 2022 10:50:28 +0100 Subject: [PATCH 21/47] fix -question mark- --- code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts b/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts index d519e5c0655..7d029172f6a 100644 --- a/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts +++ b/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts @@ -3351,9 +3351,9 @@ describe('PreviewWeb', () => { mockChannel.emit.mockClear(); const [gate, openGate] = createGate(); componentOneExports.b.play.mockImplementationOnce(async () => gate); + // @ts-expect-error (uhmmm no idea) preview.renderStoryToElement( await preview.storyStore.loadStory({ storyId: 'component-one--b' }), - 'story-element' as any, {} as any ); await waitForRenderPhase('playing'); From 519cca5e47d1bf34e32953906a92ddbd8c9c1c99 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Fri, 11 Nov 2022 14:07:56 +0100 Subject: [PATCH 22/47] wip --- code/lib/builder-vite/src/optimizeDeps.ts | 1 + code/package.json | 1 + 2 files changed, 2 insertions(+) diff --git a/code/lib/builder-vite/src/optimizeDeps.ts b/code/lib/builder-vite/src/optimizeDeps.ts index 3c193368265..6c2aaee218a 100644 --- a/code/lib/builder-vite/src/optimizeDeps.ts +++ b/code/lib/builder-vite/src/optimizeDeps.ts @@ -21,6 +21,7 @@ const INCLUDE_CANDIDATES = [ '@storybook/client-logger', '@storybook/core/client', '@storybook/types', + '@storybook/preview-api', '@storybook/preview-web', '@storybook/react > acorn-jsx', '@storybook/react', diff --git a/code/package.json b/code/package.json index c9d09d8607f..9104aa4d0d3 100644 --- a/code/package.json +++ b/code/package.json @@ -209,6 +209,7 @@ "@storybook/preset-vue-webpack": "workspace:*", "@storybook/preset-vue3-webpack": "workspace:*", "@storybook/preset-web-components-webpack": "workspace:*", + "@storybook/preview": "workspace:*", "@storybook/preview-api": "workspace:*", "@storybook/preview-web": "workspace:*", "@storybook/react": "workspace:*", From 646da1662dd8ed9fa322efbab08b1ff6fbee1b00 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Fri, 11 Nov 2022 14:21:54 +0100 Subject: [PATCH 23/47] lockfile --- code/yarn.lock | 525 +++++++++++++++++++++++++------------------------ 1 file changed, 273 insertions(+), 252 deletions(-) diff --git a/code/yarn.lock b/code/yarn.lock index db4f99924ac..609f632c866 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -332,13 +332,13 @@ __metadata: linkType: hard "@axe-core/puppeteer@npm:^4.2.0": - version: 4.5.0 - resolution: "@axe-core/puppeteer@npm:4.5.0" + version: 4.5.1 + resolution: "@axe-core/puppeteer@npm:4.5.1" dependencies: - axe-core: ^4.5.0 + axe-core: ^4.5.1 peerDependencies: puppeteer: ">=1.10.0 <= 18" - checksum: a93db97b4c096b19e6a2132a255a5699d101b68c77cd4e6395cb039c6432f3a51d59cfef95fd8ac6320906b462293b6a893180dead72362f6f097e0795af204d + checksum: f9b815b4bce727474a60f11f437003a93c68f14b408c04fd3a69fc7582c36817319209934fe24658f11df3910db909924a722e8fce41b5febb87d93f12886d77 languageName: node linkType: hard @@ -466,13 +466,13 @@ __metadata: linkType: hard "@babel/generator@npm:^7.12.11, @babel/generator@npm:^7.16.8, @babel/generator@npm:^7.20.1, @babel/generator@npm:^7.20.2, @babel/generator@npm:^7.4.0, @babel/generator@npm:^7.7.2, @babel/generator@npm:^7.8.7": - version: 7.20.3 - resolution: "@babel/generator@npm:7.20.3" + version: 7.20.4 + resolution: "@babel/generator@npm:7.20.4" dependencies: "@babel/types": ^7.20.2 "@jridgewell/gen-mapping": ^0.3.2 jsesc: ^2.5.1 - checksum: 7287321925d8a451d8f852d5d83f70ac413089a4a91798dbf0037a139750dd1e52ca760c8530f2608a71b82df75a575f9d028ff40f268b5964983184ed226694 + checksum: 48181434693f3348804f01dad53b5fd293319bc71119662bdfa64ccc3c32c5cf1a51b2ea3f7091310c950a894f418e05f3c957ee3f7f1790443487a93608d57e languageName: node linkType: hard @@ -3048,12 +3048,12 @@ __metadata: languageName: node linkType: hard -"@jest/expect-utils@npm:^29.2.2": - version: 29.2.2 - resolution: "@jest/expect-utils@npm:29.2.2" +"@jest/expect-utils@npm:^29.3.1": + version: 29.3.1 + resolution: "@jest/expect-utils@npm:29.3.1" dependencies: jest-get-type: ^29.2.0 - checksum: 1241e80d307724df38668334cecff28c6dce28e5eeda1893b1f8be8b74dcb286ed4f8f40db0b15c32e3fd376563a69a8ffce30189a357fc4bd75a0450ae4e6d9 + checksum: dc58ff9c5c7e893c056f3560cb1445771dcc1555df0b5aeff4808c6425ca9b921eae5b4f92b433b89c401e445694f5484b352f06620bac9e7cb97b8f56ee3e21 languageName: node linkType: hard @@ -3567,9 +3567,9 @@ __metadata: languageName: node linkType: hard -"@jest/types@npm:^29.2.1": - version: 29.2.1 - resolution: "@jest/types@npm:29.2.1" +"@jest/types@npm:^29.3.1": + version: 29.3.1 + resolution: "@jest/types@npm:29.3.1" dependencies: "@jest/schemas": ^29.0.0 "@types/istanbul-lib-coverage": ^2.0.0 @@ -3577,7 +3577,7 @@ __metadata: "@types/node": "*" "@types/yargs": ^17.0.8 chalk: ^4.0.0 - checksum: 4f3ed71cec9bc9511d2bdb3637c587269a3e0f846610bfd085db1b34ae96c37eee805100f4ec094382549802a20327e79d4fcaf91a47a9d4a7d7fb7106b7baa9 + checksum: c1ae1a66fbe403c82578d55cc5a061bffce2426f830c9365d0ab033f48580f3beb378631efe85e420709ff898fca6f7dd8fca9eb412dfed3d88a80c422065188 languageName: node linkType: hard @@ -4537,100 +4537,100 @@ __metadata: languageName: node linkType: hard -"@next/env@npm:12.3.2": - version: 12.3.2 - resolution: "@next/env@npm:12.3.2" - checksum: 99ba0ccbfadc5a5e64ee363e16f08da3313220cc5b571d6fe16cdc67cc366ee48c0cfc5486600120a02dc0d90c9ae1ce504a136830337125e335ad7b46711d95 +"@next/env@npm:12.3.3": + version: 12.3.3 + resolution: "@next/env@npm:12.3.3" + checksum: 3eecf70e002f6f5c608a3e550f07ab1503b87a3d822f5d8435f3857627510e1442bb82f7734398477b2d0b86dda084aa5ffffd4b52c21af97e1da5f225f4d0d5 languageName: node linkType: hard -"@next/swc-android-arm-eabi@npm:12.3.2": - version: 12.3.2 - resolution: "@next/swc-android-arm-eabi@npm:12.3.2" +"@next/swc-android-arm-eabi@npm:12.3.3": + version: 12.3.3 + resolution: "@next/swc-android-arm-eabi@npm:12.3.3" conditions: os=android & cpu=arm languageName: node linkType: hard -"@next/swc-android-arm64@npm:12.3.2": - version: 12.3.2 - resolution: "@next/swc-android-arm64@npm:12.3.2" +"@next/swc-android-arm64@npm:12.3.3": + version: 12.3.3 + resolution: "@next/swc-android-arm64@npm:12.3.3" conditions: os=android & cpu=arm64 languageName: node linkType: hard -"@next/swc-darwin-arm64@npm:12.3.2": - version: 12.3.2 - resolution: "@next/swc-darwin-arm64@npm:12.3.2" +"@next/swc-darwin-arm64@npm:12.3.3": + version: 12.3.3 + resolution: "@next/swc-darwin-arm64@npm:12.3.3" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"@next/swc-darwin-x64@npm:12.3.2": - version: 12.3.2 - resolution: "@next/swc-darwin-x64@npm:12.3.2" +"@next/swc-darwin-x64@npm:12.3.3": + version: 12.3.3 + resolution: "@next/swc-darwin-x64@npm:12.3.3" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"@next/swc-freebsd-x64@npm:12.3.2": - version: 12.3.2 - resolution: "@next/swc-freebsd-x64@npm:12.3.2" +"@next/swc-freebsd-x64@npm:12.3.3": + version: 12.3.3 + resolution: "@next/swc-freebsd-x64@npm:12.3.3" conditions: os=freebsd & cpu=x64 languageName: node linkType: hard -"@next/swc-linux-arm-gnueabihf@npm:12.3.2": - version: 12.3.2 - resolution: "@next/swc-linux-arm-gnueabihf@npm:12.3.2" +"@next/swc-linux-arm-gnueabihf@npm:12.3.3": + version: 12.3.3 + resolution: "@next/swc-linux-arm-gnueabihf@npm:12.3.3" conditions: os=linux & cpu=arm languageName: node linkType: hard -"@next/swc-linux-arm64-gnu@npm:12.3.2": - version: 12.3.2 - resolution: "@next/swc-linux-arm64-gnu@npm:12.3.2" +"@next/swc-linux-arm64-gnu@npm:12.3.3": + version: 12.3.3 + resolution: "@next/swc-linux-arm64-gnu@npm:12.3.3" conditions: os=linux & cpu=arm64 & libc=glibc languageName: node linkType: hard -"@next/swc-linux-arm64-musl@npm:12.3.2": - version: 12.3.2 - resolution: "@next/swc-linux-arm64-musl@npm:12.3.2" +"@next/swc-linux-arm64-musl@npm:12.3.3": + version: 12.3.3 + resolution: "@next/swc-linux-arm64-musl@npm:12.3.3" conditions: os=linux & cpu=arm64 & libc=musl languageName: node linkType: hard -"@next/swc-linux-x64-gnu@npm:12.3.2": - version: 12.3.2 - resolution: "@next/swc-linux-x64-gnu@npm:12.3.2" +"@next/swc-linux-x64-gnu@npm:12.3.3": + version: 12.3.3 + resolution: "@next/swc-linux-x64-gnu@npm:12.3.3" conditions: os=linux & cpu=x64 & libc=glibc languageName: node linkType: hard -"@next/swc-linux-x64-musl@npm:12.3.2": - version: 12.3.2 - resolution: "@next/swc-linux-x64-musl@npm:12.3.2" +"@next/swc-linux-x64-musl@npm:12.3.3": + version: 12.3.3 + resolution: "@next/swc-linux-x64-musl@npm:12.3.3" conditions: os=linux & cpu=x64 & libc=musl languageName: node linkType: hard -"@next/swc-win32-arm64-msvc@npm:12.3.2": - version: 12.3.2 - resolution: "@next/swc-win32-arm64-msvc@npm:12.3.2" +"@next/swc-win32-arm64-msvc@npm:12.3.3": + version: 12.3.3 + resolution: "@next/swc-win32-arm64-msvc@npm:12.3.3" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard -"@next/swc-win32-ia32-msvc@npm:12.3.2": - version: 12.3.2 - resolution: "@next/swc-win32-ia32-msvc@npm:12.3.2" +"@next/swc-win32-ia32-msvc@npm:12.3.3": + version: 12.3.3 + resolution: "@next/swc-win32-ia32-msvc@npm:12.3.3" conditions: os=win32 & cpu=ia32 languageName: node linkType: hard -"@next/swc-win32-x64-msvc@npm:12.3.2": - version: 12.3.2 - resolution: "@next/swc-win32-x64-msvc@npm:12.3.2" +"@next/swc-win32-x64-msvc@npm:12.3.3": + version: 12.3.3 + resolution: "@next/swc-win32-x64-msvc@npm:12.3.3" conditions: os=win32 & cpu=x64 languageName: node linkType: hard @@ -5203,8 +5203,8 @@ __metadata: linkType: hard "@pmmmwh/react-refresh-webpack-plugin@npm:^0.5.5": - version: 0.5.8 - resolution: "@pmmmwh/react-refresh-webpack-plugin@npm:0.5.8" + version: 0.5.9 + resolution: "@pmmmwh/react-refresh-webpack-plugin@npm:0.5.9" dependencies: ansi-html-community: ^0.0.8 common-path-prefix: ^3.0.0 @@ -5212,7 +5212,7 @@ __metadata: error-stack-parser: ^2.0.6 find-up: ^5.0.0 html-entities: ^2.1.0 - loader-utils: ^2.0.0 + loader-utils: ^2.0.3 schema-utils: ^3.0.0 source-map: ^0.7.3 peerDependencies: @@ -5237,7 +5237,7 @@ __metadata: optional: true webpack-plugin-serve: optional: true - checksum: dc304daf9fc7e0d5729fd790434112b5331541b4531f80ed4767ef78b24614cac8efeb51c3047cd4b15ee598fc93ee58b197801019aa1067fd084193877826ea + checksum: 387594d4e5b6f1dd6d8c82da2ce9e878d667c5d6de2bf3659a3b4cd2bb5a0567fb5ddae55372d7cca4c6cb70b546ab386662e0dfbe84b6431589ad3d206137a6 languageName: node linkType: hard @@ -6304,9 +6304,9 @@ __metadata: linkType: hard "@storybook/channels@npm:next": - version: 7.0.0-alpha.47 - resolution: "@storybook/channels@npm:7.0.0-alpha.47" - checksum: 089aac0bb8a3a0fa2d60360adea1342593acb61e1a4faeb48e9c8b82a8ec3e0df721b0720b614fcf9a72cc7868865067ba6fed07df4ccde7c3ca4d8c07651a45 + version: 7.0.0-alpha.48 + resolution: "@storybook/channels@npm:7.0.0-alpha.48" + checksum: 6585f72c77a38e5ea6cce4500af19715ca5c4a689399a8d358f2795e9f57cbb7f93bc2e9e22a93dbaa7a9d4c0a984ae488b872bc27f429ddffe1099123f1e0d3 languageName: node linkType: hard @@ -6648,13 +6648,13 @@ __metadata: linkType: hard "@storybook/csf@npm:next": - version: 0.0.2-next.2 - resolution: "@storybook/csf@npm:0.0.2-next.2" + version: 0.0.2-next.5 + resolution: "@storybook/csf@npm:0.0.2-next.5" dependencies: expect-type: ^0.14.2 lodash: ^4.17.15 type-fest: ^2.19.0 - checksum: 744e701c826826af065faf3ea3d932a761396fc5e348d097dbe66528e8184b2f5ae67dec8432262e0341dba87997c1d77020697803884e2766f29a4d2fc9f90d + checksum: 5be51f30cf91895085ff2a2ab45af086f3a46233c2899b251c0ec04a14636dd58428af0f1ab9fb7a8995011e7fb2498ed6590e57b403d9f0cfefb2685403ca85 languageName: node linkType: hard @@ -7245,7 +7245,7 @@ __metadata: languageName: unknown linkType: soft -"@storybook/preview@7.0.0-alpha.48, @storybook/preview@workspace:lib/preview": +"@storybook/preview@7.0.0-alpha.48, @storybook/preview@workspace:*, @storybook/preview@workspace:lib/preview": version: 0.0.0-use.local resolution: "@storybook/preview@workspace:lib/preview" dependencies: @@ -7481,6 +7481,7 @@ __metadata: "@storybook/preset-vue-webpack": "workspace:*" "@storybook/preset-vue3-webpack": "workspace:*" "@storybook/preset-web-components-webpack": "workspace:*" + "@storybook/preview": "workspace:*" "@storybook/preview-api": "workspace:*" "@storybook/preview-web": "workspace:*" "@storybook/react": "workspace:*" @@ -8148,8 +8149,8 @@ __metadata: linkType: hard "@sveltejs/vite-plugin-svelte@npm:^1.0.0": - version: 1.1.0 - resolution: "@sveltejs/vite-plugin-svelte@npm:1.1.0" + version: 1.1.1 + resolution: "@sveltejs/vite-plugin-svelte@npm:1.1.1" dependencies: debug: ^4.3.4 deepmerge: ^4.2.2 @@ -8163,7 +8164,7 @@ __metadata: peerDependenciesMeta: diff-match-patch: optional: true - checksum: 36cdbcd7dca912623d5c478525f44b3cb4880d9a0260a19f76affbef334715fd0e08ef504b9fbda709e3c463c1d645139c347ab59e1ffdf6e4eb7df002b88b96 + checksum: e7969e151822c49109dd86a67a1d2ed76480526cc096aa5f92f1228a7a78a2e49e85cfff7c980c38018cbcee8e65905d979dea8df1554882935ffbf341dd5b60 languageName: node linkType: hard @@ -9066,7 +9067,18 @@ __metadata: languageName: node linkType: hard -"@types/react@npm:*, @types/react@npm:>=16, @types/react@npm:^16, @types/react@npm:^16.14.23": +"@types/react@npm:*, @types/react@npm:>=16": + version: 18.0.25 + resolution: "@types/react@npm:18.0.25" + dependencies: + "@types/prop-types": "*" + "@types/scheduler": "*" + csstype: ^3.0.2 + checksum: 5d30dbf46124a63ee832864bf38ce42de2e8924dc53470f14742343503a2cf1851b6b4f8b892ef661e1a670561f4c9052d782e419d314912e54626f3296e49b6 + languageName: node + linkType: hard + +"@types/react@npm:^16, @types/react@npm:^16.14.23": version: 16.14.34 resolution: "@types/react@npm:16.14.34" dependencies: @@ -9709,15 +9721,15 @@ __metadata: languageName: node linkType: hard -"@vue/compiler-core@npm:3.2.41": - version: 3.2.41 - resolution: "@vue/compiler-core@npm:3.2.41" +"@vue/compiler-core@npm:3.2.45": + version: 3.2.45 + resolution: "@vue/compiler-core@npm:3.2.45" dependencies: "@babel/parser": ^7.16.4 - "@vue/shared": 3.2.41 + "@vue/shared": 3.2.45 estree-walker: ^2.0.2 source-map: ^0.6.1 - checksum: 9f1023c2f0e8834a8056f5d0a4ac5d751b351d901e8cd03163aca10e317b08c599d326ef5de70a3d2ba1c7ee333e7a2289fc72ce4f6ac0496e750b044689f803 + checksum: 5efbbb4ceca47c34e74b3e40dc68768317c0f15f23f428d72a04d62c27bbb1b37a0d2ba4423dd2d3e7e2a4eda34b730758da2b23dd14b13cc625de3083e55639 languageName: node linkType: hard @@ -9731,24 +9743,24 @@ __metadata: languageName: node linkType: hard -"@vue/compiler-dom@npm:3.2.41, @vue/compiler-dom@npm:^3.2.0, @vue/compiler-dom@npm:^3.2.40": - version: 3.2.41 - resolution: "@vue/compiler-dom@npm:3.2.41" +"@vue/compiler-dom@npm:3.2.45, @vue/compiler-dom@npm:^3.2.0, @vue/compiler-dom@npm:^3.2.40": + version: 3.2.45 + resolution: "@vue/compiler-dom@npm:3.2.45" dependencies: - "@vue/compiler-core": 3.2.41 - "@vue/shared": 3.2.41 - checksum: 5dbbd925d4603668f5edcb134c8e8718e22738b7890e1cd6f2e8621aabf42a96df2f851f722f1176ca1744345fc74000c941b7cf4dc323dbbcd70da87ccdf378 + "@vue/compiler-core": 3.2.45 + "@vue/shared": 3.2.45 + checksum: 3984ff10f3c34c61f036bcd5379525f4ddb3f68e3fc531b265e1de2d5704359e3f16f88e39584e26a1bd8c9e4bc01f60ce67073fe9ca01a4080a77aa97255033 languageName: node linkType: hard -"@vue/compiler-sfc@npm:2.7.13": - version: 2.7.13 - resolution: "@vue/compiler-sfc@npm:2.7.13" +"@vue/compiler-sfc@npm:2.7.14": + version: 2.7.14 + resolution: "@vue/compiler-sfc@npm:2.7.14" dependencies: "@babel/parser": ^7.18.4 postcss: ^8.4.14 source-map: ^0.6.1 - checksum: 3a55e888b7b0b998cdfac6f000f16214efc5a159f41642a76c4de1778f3f8fbafbc3447d2ad78b09c3b90615b23108675119d4359372856c5a51e9169a797da9 + checksum: 29fe06d8da1f8721488468653be671aaa48d63fcd03c47261164cb770b4ecbde1e1455e6affbc9ef062f2729da6988000ba470fc43a2f8a454a61d51af68725d languageName: node linkType: hard @@ -9778,21 +9790,21 @@ __metadata: languageName: node linkType: hard -"@vue/compiler-sfc@npm:3.2.41, @vue/compiler-sfc@npm:^3.2.0, @vue/compiler-sfc@npm:^3.2.33, @vue/compiler-sfc@npm:^3.2.40": - version: 3.2.41 - resolution: "@vue/compiler-sfc@npm:3.2.41" +"@vue/compiler-sfc@npm:3.2.45, @vue/compiler-sfc@npm:^3.2.0, @vue/compiler-sfc@npm:^3.2.33, @vue/compiler-sfc@npm:^3.2.40": + version: 3.2.45 + resolution: "@vue/compiler-sfc@npm:3.2.45" dependencies: "@babel/parser": ^7.16.4 - "@vue/compiler-core": 3.2.41 - "@vue/compiler-dom": 3.2.41 - "@vue/compiler-ssr": 3.2.41 - "@vue/reactivity-transform": 3.2.41 - "@vue/shared": 3.2.41 + "@vue/compiler-core": 3.2.45 + "@vue/compiler-dom": 3.2.45 + "@vue/compiler-ssr": 3.2.45 + "@vue/reactivity-transform": 3.2.45 + "@vue/shared": 3.2.45 estree-walker: ^2.0.2 magic-string: ^0.25.7 postcss: ^8.1.10 source-map: ^0.6.1 - checksum: 327fb7acff404ac007c8eabefe485efb4d070e347bffca2c170232f502021fac01fabeda5f4f91a7b0b175b48cef184e053da9a2ef46b7ab188b8383bef188cb + checksum: 4e277066b3e89e8081a318dfc2aaf2bf8dfd4f14d93b9c868e51d994c45a766091703ba4299a7c83efff3749aee7ce2be67de666e8cc2f73fa23fdd833ad3b2c languageName: node linkType: hard @@ -9806,13 +9818,13 @@ __metadata: languageName: node linkType: hard -"@vue/compiler-ssr@npm:3.2.41": - version: 3.2.41 - resolution: "@vue/compiler-ssr@npm:3.2.41" +"@vue/compiler-ssr@npm:3.2.45": + version: 3.2.45 + resolution: "@vue/compiler-ssr@npm:3.2.45" dependencies: - "@vue/compiler-dom": 3.2.41 - "@vue/shared": 3.2.41 - checksum: 508361b2799097d86abd740548eabf7a20f9a6e1af29cda23dad07ed0b7d72569371492619f80ba2283c3e87c66016985a531cf2110742dabafe5566ca22e6eb + "@vue/compiler-dom": 3.2.45 + "@vue/shared": 3.2.45 + checksum: f7b587eb154d7686b8b92ecc16057cdc5875a4834115429a64343cc71df20e481310166784b24c1caeca15b84e0b761c526fd9438d10b505b5b7c899a47223b1 languageName: node linkType: hard @@ -9836,16 +9848,16 @@ __metadata: languageName: node linkType: hard -"@vue/reactivity-transform@npm:3.2.41": - version: 3.2.41 - resolution: "@vue/reactivity-transform@npm:3.2.41" +"@vue/reactivity-transform@npm:3.2.45": + version: 3.2.45 + resolution: "@vue/reactivity-transform@npm:3.2.45" dependencies: "@babel/parser": ^7.16.4 - "@vue/compiler-core": 3.2.41 - "@vue/shared": 3.2.41 + "@vue/compiler-core": 3.2.45 + "@vue/shared": 3.2.45 estree-walker: ^2.0.2 magic-string: ^0.25.7 - checksum: 8f4350efa220ed3ba8f0c4721a54ae4a2c043a8cff2d8d7227525df59f09145bb76a842f30fd3b0684c083b3e776653b464d737c7c53e43ce0739ac3d958a24a + checksum: 28f74ee0d178c478d67569a7f22748dc0c4423d4e16b8befb2de8641ff8d5f4cb988693bf75951231bfd02a7bdd97a4b525100d282f7453c465ca28cc1d3e7df languageName: node linkType: hard @@ -9858,12 +9870,12 @@ __metadata: languageName: node linkType: hard -"@vue/reactivity@npm:3.2.41, @vue/reactivity@npm:^3.2.40": - version: 3.2.41 - resolution: "@vue/reactivity@npm:3.2.41" +"@vue/reactivity@npm:3.2.45, @vue/reactivity@npm:^3.2.40": + version: 3.2.45 + resolution: "@vue/reactivity@npm:3.2.45" dependencies: - "@vue/shared": 3.2.41 - checksum: f76b7e3f12c441ff018ea1cb8c080365d135d87ddc075a10c87ea440a2c95e5d5ac04bb83dda0ce1f498fb390afff5d3d0c06d0a0fb46ca535df70c66dc3be90 + "@vue/shared": 3.2.45 + checksum: 5a9906292709fc27e48f44ada181be214788d56978efde433aa834bdb05240023fab2aa8b886398a01f3e515c27cd3758f3253d44382064d5c077b89d617719f languageName: node linkType: hard @@ -9877,13 +9889,13 @@ __metadata: languageName: node linkType: hard -"@vue/runtime-core@npm:3.2.41": - version: 3.2.41 - resolution: "@vue/runtime-core@npm:3.2.41" +"@vue/runtime-core@npm:3.2.45": + version: 3.2.45 + resolution: "@vue/runtime-core@npm:3.2.45" dependencies: - "@vue/reactivity": 3.2.41 - "@vue/shared": 3.2.41 - checksum: 9c21632c5a3330283649a9175ae03cebe27776a7615d10b9e8f2a98e4002951a9913be7b2810623c06d6481cb56b62e2f5e6f9a5d29d79f75d66ec10b528cdc2 + "@vue/reactivity": 3.2.45 + "@vue/shared": 3.2.45 + checksum: 29d79e31a9463ab58e33667003aed43b8601942b1df66c451c096ed6f62b3483e94324c5412b6ed2f1154dfec89121d8a40103aac79c10377f34143bf9a8b94a languageName: node linkType: hard @@ -9898,26 +9910,26 @@ __metadata: languageName: node linkType: hard -"@vue/runtime-dom@npm:3.2.41": - version: 3.2.41 - resolution: "@vue/runtime-dom@npm:3.2.41" +"@vue/runtime-dom@npm:3.2.45": + version: 3.2.45 + resolution: "@vue/runtime-dom@npm:3.2.45" dependencies: - "@vue/runtime-core": 3.2.41 - "@vue/shared": 3.2.41 + "@vue/runtime-core": 3.2.45 + "@vue/shared": 3.2.45 csstype: ^2.6.8 - checksum: 744d50eb98b5a00b31ef6c318a04b9d9786f35d9f255689aba7c15e7be927c14f4d4379b704cde97f0ba467b3f36c46efcc7d0b119c9bde3419a966a21081f78 + checksum: fef0d3052f4e8ce573e7dccbaf018dbc7a1485bcc9d7640608e4d4371fd505eeb187ccc47723fd560cec3bf0e2ca1dc998ec5f0d9db2e2f7c2277accc614f9a1 languageName: node linkType: hard -"@vue/server-renderer@npm:3.2.41": - version: 3.2.41 - resolution: "@vue/server-renderer@npm:3.2.41" +"@vue/server-renderer@npm:3.2.45": + version: 3.2.45 + resolution: "@vue/server-renderer@npm:3.2.45" dependencies: - "@vue/compiler-ssr": 3.2.41 - "@vue/shared": 3.2.41 + "@vue/compiler-ssr": 3.2.45 + "@vue/shared": 3.2.45 peerDependencies: - vue: 3.2.41 - checksum: 3aa31b70e46e0171e2c07562aa09bc1e75ccc6c876c146c3d25b4674d9394de46ba9ff338105ae81d7ff679763c9ecfe48e6d7382d52de163319481132cfc55a + vue: 3.2.45 + checksum: 5c0a80e1d5405ea1e83652088a3b30f6763483da3d8df28d140f7578028f96bfbecf4a1761cb6af742b8494fe071f97813c44e7f2b6711a5b82955bba8124f1b languageName: node linkType: hard @@ -9928,10 +9940,10 @@ __metadata: languageName: node linkType: hard -"@vue/shared@npm:3.2.41, @vue/shared@npm:^3.2.40": - version: 3.2.41 - resolution: "@vue/shared@npm:3.2.41" - checksum: bc46bf36e856a10646639561b346a76594e8a1afa992e3394056a6e0b534c6c71b1330e13960ba9788bb36265a5e761ac4c562daad0d168265d496fc3e7d6575 +"@vue/shared@npm:3.2.45, @vue/shared@npm:^3.2.40": + version: 3.2.45 + resolution: "@vue/shared@npm:3.2.45" + checksum: ce80448852705badcd481a93e7701344d3302485e3127e2fa2e69f7a28818bd419326c351d521f882dfaa7ecf711944867e34b1230b7fcc3810ada9c99f014c7 languageName: node linkType: hard @@ -11227,7 +11239,7 @@ __metadata: languageName: node linkType: hard -"axe-core@npm:^4.2.0, axe-core@npm:^4.4.3, axe-core@npm:^4.5.0": +"axe-core@npm:^4.2.0, axe-core@npm:^4.4.3, axe-core@npm:^4.5.1": version: 4.5.1 resolution: "axe-core@npm:4.5.1" checksum: 9b8ecb90329d73d34faea3a6bf3132b9070cc7a8d3fb12e1bf02ded29e4c938276d3435e83d59d844ea62b7069caebf18ec78a6b99754d7f9bbec7eea379bec0 @@ -14831,10 +14843,10 @@ __metadata: languageName: node linkType: hard -"diff-sequences@npm:^29.2.0": - version: 29.2.0 - resolution: "diff-sequences@npm:29.2.0" - checksum: 4b83cda386c251f772c6983e3dfbe36d6d563c6b223e8845c98469417d2f2e35839dc4cf23dbabc3ccecaf30bf8e188481fee6f1660cb3e8fbfa9a27506790ef +"diff-sequences@npm:^29.3.1": + version: 29.3.1 + resolution: "diff-sequences@npm:29.3.1" + checksum: adbacc8d56c42f73c12a90e253c2b7024d2cd52c30bd81a3960a9cfd35164f8ecd3d8dd82ded38b0e48585923b56bd28f9aae942e6d1b23f444213b9d786b925 languageName: node linkType: hard @@ -15077,9 +15089,9 @@ __metadata: linkType: hard "dompurify@npm:^2.2.6": - version: 2.4.0 - resolution: "dompurify@npm:2.4.0" - checksum: b091e8f1a5106a7bcfc9947ea654a91e1c7fc28c9264578c0ccca3527d62f4ec9b6df8cfd91b3c21696d5182950a37b1b79e3c5d669256c7730107cb6d9c64f1 + version: 2.4.1 + resolution: "dompurify@npm:2.4.1" + checksum: 4563459e959f01748d2499bf6afc9e7fd47721df42d93e6f2c04857b7685c112ecafc741877185423b04c1a77b3951c7c8e6c60d9bc283ff55abd7afef36ea48 languageName: node linkType: hard @@ -16124,11 +16136,13 @@ __metadata: linkType: hard "esbuild-register@npm:^3.3.3": - version: 3.3.3 - resolution: "esbuild-register@npm:3.3.3" + version: 3.4.1 + resolution: "esbuild-register@npm:3.4.1" + dependencies: + debug: ^4.3.4 peerDependencies: esbuild: ">=0.12 <1" - checksum: b99e094646e6de94afafd201794e5d2e0250377cabd544cc3d7da5ccf879f38174e26a6530ecd1fa20494842f4af50360769510dbcf57ff1ce4ba6d0e84ae273 + checksum: 6364c96f83fc4720d907d6342605f5891986c2a30fbc0a249047195ea5b02c0f7e4e698aa262875b37088f44ca741331d35c026d2606778d114fe082d560957d languageName: node linkType: hard @@ -17173,15 +17187,15 @@ __metadata: linkType: hard "expect@npm:^29.0.0": - version: 29.3.0 - resolution: "expect@npm:29.3.0" + version: 29.3.1 + resolution: "expect@npm:29.3.1" dependencies: - "@jest/expect-utils": ^29.2.2 + "@jest/expect-utils": ^29.3.1 jest-get-type: ^29.2.0 - jest-matcher-utils: ^29.2.2 - jest-message-util: ^29.2.1 - jest-util: ^29.2.1 - checksum: b18ecfffc9b49afa1702d8ab54cccc63a5a1e2e410afc92c9a104978e397065df00af87a59d0c136e462362f3e6174e963b4a2ff1e7e1efc8217923305c449fc + jest-matcher-utils: ^29.3.1 + jest-message-util: ^29.3.1 + jest-util: ^29.3.1 + checksum: 0662836949648b65ea80c0fc4777818bd384c00d2ad3d442ec1bea69a604097f94673a432245ae750b09bc8d292f381a31dcc59cf0433a9b2adfba501e257d63 languageName: node linkType: hard @@ -21477,15 +21491,15 @@ __metadata: languageName: node linkType: hard -"jest-diff@npm:^29.2.1": - version: 29.2.1 - resolution: "jest-diff@npm:29.2.1" +"jest-diff@npm:^29.3.1": + version: 29.3.1 + resolution: "jest-diff@npm:29.3.1" dependencies: chalk: ^4.0.0 - diff-sequences: ^29.2.0 + diff-sequences: ^29.3.1 jest-get-type: ^29.2.0 - pretty-format: ^29.2.1 - checksum: ce76f24f1ed026cf501c920675a783356e92c5ec69795d3b505c7b2ff09aa3271111524dd24bc185178ce8d7e992f2947a2f3e932efd2bef60215f7cbf9e552e + pretty-format: ^29.3.1 + checksum: 6bbe1fc91f9e7351e995f725029d984392fd0fe2374e64953c2b38a8d857f93b845fcf5d9421cccf2be077f651374f6b7ca6c5970687b2b6521452c15c1e3286 languageName: node linkType: hard @@ -21966,15 +21980,15 @@ __metadata: languageName: node linkType: hard -"jest-matcher-utils@npm:^29.2.2": - version: 29.2.2 - resolution: "jest-matcher-utils@npm:29.2.2" +"jest-matcher-utils@npm:^29.3.1": + version: 29.3.1 + resolution: "jest-matcher-utils@npm:29.3.1" dependencies: chalk: ^4.0.0 - jest-diff: ^29.2.1 + jest-diff: ^29.3.1 jest-get-type: ^29.2.0 - pretty-format: ^29.2.1 - checksum: a554e683bcd18cc11e1e018597771051e88cb3bf79cdbb5896f7550bd4c787e473ba4727336db2049fea6149e21546c8f1cde4b78a76eb595199cfeaba6450b1 + pretty-format: ^29.3.1 + checksum: 4efdcc2fa33a403285e26521f795c9c7ad537a30e5b4183a8d97fd9f05251107ef2ef1397dbb420a2517fa91606655cb1103a0c60a52b1f003d928dbea3963e3 languageName: node linkType: hard @@ -22045,20 +22059,20 @@ __metadata: languageName: node linkType: hard -"jest-message-util@npm:^29.2.1": - version: 29.2.1 - resolution: "jest-message-util@npm:29.2.1" +"jest-message-util@npm:^29.3.1": + version: 29.3.1 + resolution: "jest-message-util@npm:29.3.1" dependencies: "@babel/code-frame": ^7.12.13 - "@jest/types": ^29.2.1 + "@jest/types": ^29.3.1 "@types/stack-utils": ^2.0.0 chalk: ^4.0.0 graceful-fs: ^4.2.9 micromatch: ^4.0.4 - pretty-format: ^29.2.1 + pretty-format: ^29.3.1 slash: ^3.0.0 stack-utils: ^2.0.3 - checksum: 1931a6666b7e650b69f1ee702c8680e7e57becba8be0cb7ac06b35c5a12778338a6702295a39022d975c87a10cc3c7c53f4f3d76b14065ead4a0d4f01ce1f22c + checksum: 09291af22383d14a6ac0e4faea6382e07e38a89b67985ac48fd4604037572c847021d471f11f1866fd696875218996740a10a176acc26fbe072e4394d52129e0 languageName: node linkType: hard @@ -22685,17 +22699,17 @@ __metadata: languageName: node linkType: hard -"jest-util@npm:^29.2.1": - version: 29.2.1 - resolution: "jest-util@npm:29.2.1" +"jest-util@npm:^29.3.1": + version: 29.3.1 + resolution: "jest-util@npm:29.3.1" dependencies: - "@jest/types": ^29.2.1 + "@jest/types": ^29.3.1 "@types/node": "*" chalk: ^4.0.0 ci-info: ^3.2.0 graceful-fs: ^4.2.9 picomatch: ^2.2.3 - checksum: 678ae6089b460156882c0c2f94f46dfcbf9e00d147edee0eb7101a1b38ef36c7a5e7b7c7d8d3aa089a8fa08b2930bf3392c5bb527d229b70a5fd0d48fd091be0 + checksum: c03606c389cf6f454962e4670fcb5d346e0cef166d71a6d70cde2ffaff9a0744fbf7b0651a01ac07e5ade790e95937bcaa604601ebb4c8dbf3e4c641027e61d0 languageName: node linkType: hard @@ -23273,11 +23287,11 @@ __metadata: linkType: hard "json-stable-stringify@npm:^1.0.1": - version: 1.0.1 - resolution: "json-stable-stringify@npm:1.0.1" + version: 1.0.2 + resolution: "json-stable-stringify@npm:1.0.2" dependencies: - jsonify: ~0.0.0 - checksum: 3127db54f6507096645411ad9e15abd6091b8a94d675321d5c28ecefe3ddabd07a255d12f27e140dd8af3eb07198c81e4d9a29a14f1f9342546a3e94881bb4f6 + jsonify: ^0.0.1 + checksum: 502d021c3c59c09587faa40d7693d77c00460fd6c68bae95d6e35804909ec8c4aec71b136d3a09df61a7ebf803eb6e820f23ede76b77e74b8b02c76afb2ada8c languageName: node linkType: hard @@ -23356,7 +23370,7 @@ __metadata: languageName: node linkType: hard -"jsonify@npm:~0.0.0": +"jsonify@npm:^0.0.1": version: 0.0.1 resolution: "jsonify@npm:0.0.1" checksum: 7f5499cdd59a0967ed35bda48b7cec43d850bbc8fb955cdd3a1717bb0efadbe300724d5646de765bb7a99fc1c3ab06eb80d93503c6faaf99b4ff50a3326692f6 @@ -23999,7 +24013,7 @@ __metadata: languageName: node linkType: hard -"loader-utils@npm:3.2.0, loader-utils@npm:^3.2.0": +"loader-utils@npm:3.2.0": version: 3.2.0 resolution: "loader-utils@npm:3.2.0" checksum: 573f7059f283b24b2b68cd230d9f0ba87315da8ecc7885734ea5f108fc83c7882e4eb8f8feab65f7db1661ab540f5aea778f48d18b7aadc24c37be77b2ff70a0 @@ -24007,24 +24021,31 @@ __metadata: linkType: hard "loader-utils@npm:^1.0.2, loader-utils@npm:^1.1.0, loader-utils@npm:^1.2.3": - version: 1.4.1 - resolution: "loader-utils@npm:1.4.1" + version: 1.4.2 + resolution: "loader-utils@npm:1.4.2" dependencies: big.js: ^5.2.2 emojis-list: ^3.0.0 json5: ^1.0.1 - checksum: 38096fc9fba3160eb7b7408eb88658a854a992fed2106fe3972d144035688dc4fcb3767cf353f85513ac0e654efbf1001735bd5a8d8bb5429fdb5a6b0712ce92 + checksum: 2b726088b5526f7605615e3e28043ae9bbd2453f4a85898e1151f3c39dbf7a2b65d09f3996bc588d92ac7e717ded529d3e1ea3ea42c433393be84a58234a2f53 languageName: node linkType: hard -"loader-utils@npm:^2.0.0": - version: 2.0.3 - resolution: "loader-utils@npm:2.0.3" +"loader-utils@npm:^2.0.0, loader-utils@npm:^2.0.3": + version: 2.0.4 + resolution: "loader-utils@npm:2.0.4" dependencies: big.js: ^5.2.2 emojis-list: ^3.0.0 json5: ^2.1.2 - checksum: 6a674996d134ebc267b0bf4b846e99b4b0d53cebc15ecc971ef2ac5977570aae3e6b7d61f4809e135dca76f5e0b29084856e8723b1599762bffd4301e4a28b95 + checksum: d5654a77f9d339ec2a03d88221a5a695f337bf71eb8dea031b3223420bb818964ba8ed0069145c19b095f6c8b8fd386e602a3fc7ca987042bd8bb1dcc90d7100 + languageName: node + linkType: hard + +"loader-utils@npm:^3.2.0": + version: 3.2.1 + resolution: "loader-utils@npm:3.2.1" + checksum: d3e1f217d160e8e894a0385a33500d4ce14065e8ffb250f5a81ae65bc2c3baa50625ec34182ba4417b46b4ac6725aed64429e1104d6401e074af2aa1dd018394 languageName: node linkType: hard @@ -24394,9 +24415,9 @@ __metadata: linkType: hard "loglevel@npm:^1.8.0": - version: 1.8.0 - resolution: "loglevel@npm:1.8.0" - checksum: e67645b38062e73ef72b37664f0cd43e9deea2e9e4a161d67998578f5b758c47740ec976e9dca7d2d05b23414df8004ded8955da50b6ad1dc9628739f645e905 + version: 1.8.1 + resolution: "loglevel@npm:1.8.1" + checksum: 21069436c97448a1801b154a77d19ada212225c513d94f0471bfe299c981ffd4dc0d21e6211f9250bd6209ba9837bfe0d40d9295c673d73e3c543ec6b1c5d9ef languageName: node linkType: hard @@ -26226,23 +26247,23 @@ __metadata: linkType: hard "next@npm:^12.2.4": - version: 12.3.2 - resolution: "next@npm:12.3.2" + version: 12.3.3 + resolution: "next@npm:12.3.3" dependencies: - "@next/env": 12.3.2 - "@next/swc-android-arm-eabi": 12.3.2 - "@next/swc-android-arm64": 12.3.2 - "@next/swc-darwin-arm64": 12.3.2 - "@next/swc-darwin-x64": 12.3.2 - "@next/swc-freebsd-x64": 12.3.2 - "@next/swc-linux-arm-gnueabihf": 12.3.2 - "@next/swc-linux-arm64-gnu": 12.3.2 - "@next/swc-linux-arm64-musl": 12.3.2 - "@next/swc-linux-x64-gnu": 12.3.2 - "@next/swc-linux-x64-musl": 12.3.2 - "@next/swc-win32-arm64-msvc": 12.3.2 - "@next/swc-win32-ia32-msvc": 12.3.2 - "@next/swc-win32-x64-msvc": 12.3.2 + "@next/env": 12.3.3 + "@next/swc-android-arm-eabi": 12.3.3 + "@next/swc-android-arm64": 12.3.3 + "@next/swc-darwin-arm64": 12.3.3 + "@next/swc-darwin-x64": 12.3.3 + "@next/swc-freebsd-x64": 12.3.3 + "@next/swc-linux-arm-gnueabihf": 12.3.3 + "@next/swc-linux-arm64-gnu": 12.3.3 + "@next/swc-linux-arm64-musl": 12.3.3 + "@next/swc-linux-x64-gnu": 12.3.3 + "@next/swc-linux-x64-musl": 12.3.3 + "@next/swc-win32-arm64-msvc": 12.3.3 + "@next/swc-win32-ia32-msvc": 12.3.3 + "@next/swc-win32-x64-msvc": 12.3.3 "@swc/helpers": 0.4.11 caniuse-lite: ^1.0.30001406 postcss: 8.4.14 @@ -26290,7 +26311,7 @@ __metadata: optional: true bin: next: dist/bin/next - checksum: fb55616937867599e257766669eee37119ebb30df3d16a533ea7b7213e80bf403157852d0e189fe027b3dc4dd40fc3eec7866c2b3823214901f3ebbf60a4dd72 + checksum: 7af340ca49cf270e4b37cdd372c16a7ba1a3cadb1124f0a7a65a49d6fe8b4786070b31064c8e0baa1d4fd765788ed5249d6b31d4455962ab9e5657857f5bd15b languageName: node linkType: hard @@ -28662,13 +28683,13 @@ __metadata: linkType: hard "postcss@npm:^8.1.10, postcss@npm:^8.2.14, postcss@npm:^8.2.15, postcss@npm:^8.3.7, postcss@npm:^8.4.14, postcss@npm:^8.4.18, postcss@npm:^8.4.7": - version: 8.4.18 - resolution: "postcss@npm:8.4.18" + version: 8.4.19 + resolution: "postcss@npm:8.4.19" dependencies: nanoid: ^3.3.4 picocolors: ^1.0.0 source-map-js: ^1.0.2 - checksum: df38b43e0cd79b115305fb787f4586d376b38c515692ef7429785af84d00ebe86f2276b98071d3f62848daf8639ee4ef6057618b34c292196dc6af072eeede5e + checksum: f33594fa0a2b629043deada34171744891054255baa49150d77f08f68edec1fa7eb9740e64c3a32e6f476c16e9e592af942fcf55f93051673dd208c0aee1d60b languageName: node linkType: hard @@ -28774,14 +28795,14 @@ __metadata: languageName: node linkType: hard -"pretty-format@npm:^29.0.0, pretty-format@npm:^29.2.1": - version: 29.2.1 - resolution: "pretty-format@npm:29.2.1" +"pretty-format@npm:^29.0.0, pretty-format@npm:^29.3.1": + version: 29.3.1 + resolution: "pretty-format@npm:29.3.1" dependencies: "@jest/schemas": ^29.0.0 ansi-styles: ^5.0.0 react-is: ^18.0.0 - checksum: 35d275a65379fdd52cbf2d984432bca91ca4ebecc6c3459e5d96f653a2855b9aab8147fe303b68435c3d18ec8b80bdbe425ed3b9fc8e4ff112f552f4b949108d + checksum: 8c0b27a7f31c678a382de70217c524b752b14c6aaf56f94098b04208d91965e4b4f92c268e6c1124c20c3cf8de146dd4ba6a4d1f1033ae67c0dcccd4de23e98b languageName: node linkType: hard @@ -29769,15 +29790,15 @@ __metadata: linkType: hard "react-textarea-autosize@npm:^8.3.0": - version: 8.3.4 - resolution: "react-textarea-autosize@npm:8.3.4" + version: 8.4.0 + resolution: "react-textarea-autosize@npm:8.4.0" dependencies: "@babel/runtime": ^7.10.2 use-composed-ref: ^1.3.0 use-latest: ^1.2.1 peerDependencies: react: ^16.8.0 || ^17.0.0 || ^18.0.0 - checksum: 02dd38f6c40c4dd88b6c35370eaddc385c0a417c614b5ecb50d1121e99905da26fea9d5c05b580404b7f8a7d9a4964a8613654882be03963c36005779b96cca5 + checksum: cef5cc06e353c50db19689f4c61260572fea6a48a4b3d7600a1e0b69f20b33b5899db15f272c402c649c999d76834ad11de63f0053c1edab5ae72b05661e22c8 languageName: node linkType: hard @@ -32570,11 +32591,11 @@ __metadata: linkType: hard "stack-utils@npm:^2.0.2, stack-utils@npm:^2.0.3": - version: 2.0.5 - resolution: "stack-utils@npm:2.0.5" + version: 2.0.6 + resolution: "stack-utils@npm:2.0.6" dependencies: escape-string-regexp: ^2.0.0 - checksum: 059f828eed5b03b963e8200529c27bd92b105f2cac9dffc9edcbc739ea8fa108e4ec45d0da257d8e0f7b5ac98db5643a0787e5c25ceab1396f7123e1ee15a086 + checksum: 651c9f87667e077584bbe848acaecc6049bc71979f1e9a46c7b920cad4431c388df0f51b8ad7cfd6eed3db97a2878d0fc8b3122979439ea8bac29c61c95eec8a languageName: node linkType: hard @@ -33243,15 +33264,15 @@ __metadata: linkType: hard "svelte-loader@npm:^3.1.2": - version: 3.1.3 - resolution: "svelte-loader@npm:3.1.3" + version: 3.1.4 + resolution: "svelte-loader@npm:3.1.4" dependencies: - loader-utils: ^2.0.0 + loader-utils: ^2.0.3 svelte-dev-helper: ^1.1.9 svelte-hmr: ^0.14.2 peerDependencies: svelte: ">3.0.0" - checksum: 5c4f91fdfb7760eea29974c11743f73654049cdada16ad2fdca127493f739082c9d5b1cac8438cae2345409b238cc516983e00b96b77b7f10c25150e21bb8884 + checksum: f3f21291c56129a722d686c39e475c1d033868f769fbc01edc2c26cf367c85b5d715fa4358b0e953f4ff00532e10b2dc50c9ed153329123844a0940dffce33f2 languageName: node linkType: hard @@ -33305,9 +33326,9 @@ __metadata: linkType: hard "svelte@npm:^3.0.0, svelte@npm:^3.31.2, svelte@npm:^3.48.0": - version: 3.52.0 - resolution: "svelte@npm:3.52.0" - checksum: 98446c71e598ad5ae2cfdb68e1c8a6c69af36eb89f970bbcfe478f127dbbffb2acf882986c368a81ae5cdf4044c3f4bf0876abe0dd7e66c75707618d8fe70ff9 + version: 3.53.1 + resolution: "svelte@npm:3.53.1" + checksum: 4e0d389acbf4805f5247380f22311151a194532bd1d9742c418d981928a12cd9450220778a563c7c1cae9ef59b05ff0c960d20dae7f73b7057b7d5bd203202fe languageName: node linkType: hard @@ -35738,12 +35759,12 @@ __metadata: linkType: hard "vue-template-compiler@npm:^2.6.14, vue-template-compiler@npm:^2.7.10": - version: 2.7.13 - resolution: "vue-template-compiler@npm:2.7.13" + version: 2.7.14 + resolution: "vue-template-compiler@npm:2.7.14" dependencies: de-indent: ^1.0.2 he: ^1.2.0 - checksum: 6f1b54e74cc5b2a97ccda5335123fc2e9d1b63b934efe67552fbe7a4041ac55fc24b802e5715e7509696c6bcf5d1c6e0c69e4cd0ba85b3e32384df66b452ae82 + checksum: 7f261b40d088c76ce9c66dde29220d0e5df43f974895a0aee97347ac48ed0958c21272dcdf8b163dcc2b9688eca528c1d72d12b3b8b1dcae1dde6a306d7cbb20 languageName: node linkType: hard @@ -35787,25 +35808,25 @@ __metadata: linkType: hard "vue@npm:^2.6.12, vue@npm:^2.7.10": - version: 2.7.13 - resolution: "vue@npm:2.7.13" + version: 2.7.14 + resolution: "vue@npm:2.7.14" dependencies: - "@vue/compiler-sfc": 2.7.13 + "@vue/compiler-sfc": 2.7.14 csstype: ^3.1.0 - checksum: 71ed60ac28721e5e170202ac143bb23332c0cc4223c55b53d7cdb21215c6b98cab6b8e19cf812fac0d4f3a2c0bbdce23c3abaf19d5185d142ebf2c3528be8845 + checksum: 8eb326718c445eb5900d08e2f5a2d86b493d475d3a79f49695066092afa3176d2aad4db98682b3c5432f6fffb92719a124b7e137264e71d5b9be14d5193222c6 languageName: node linkType: hard "vue@npm:^3.2.33, vue@npm:^3.2.41": - version: 3.2.41 - resolution: "vue@npm:3.2.41" + version: 3.2.45 + resolution: "vue@npm:3.2.45" dependencies: - "@vue/compiler-dom": 3.2.41 - "@vue/compiler-sfc": 3.2.41 - "@vue/runtime-dom": 3.2.41 - "@vue/server-renderer": 3.2.41 - "@vue/shared": 3.2.41 - checksum: fac4f47b5ecec8b7b7366eccb6b35866712e11887a12df0f04f989134578de27b69364c1ea1377384b38d048a0c4f604fd096500647f30c0b45cc68cff421d8d + "@vue/compiler-dom": 3.2.45 + "@vue/compiler-sfc": 3.2.45 + "@vue/runtime-dom": 3.2.45 + "@vue/server-renderer": 3.2.45 + "@vue/shared": 3.2.45 + checksum: e00a38edc313faacc7e9269b40c28b77b333869991b1e8095b38a1edae93199168073b3141e9750162a75fdbe259012494ce91e66627cc4ed1b9697324d35a52 languageName: node linkType: hard @@ -36073,13 +36094,13 @@ __metadata: linkType: hard "webpack-hot-middleware@npm:^2.25.1": - version: 2.25.2 - resolution: "webpack-hot-middleware@npm:2.25.2" + version: 2.25.3 + resolution: "webpack-hot-middleware@npm:2.25.3" dependencies: ansi-html-community: 0.0.8 html-entities: ^2.1.0 strip-ansi: ^6.0.0 - checksum: dc7cef3b3b06aeeaa925a3514a8f5ab110ec42c7a423d9f2c3fd31d96ac54e2837647f01f9169e1fddbda64c3ff962bb8b6eda184a53f2d09cd7deaa03c6f422 + checksum: dca26d6d32eb684469830b4074dcd11c298036fe3ec8276ea5a69bc14bc8a53aab2494e02871ada146ec0881965d7018d559683cbcc73bcafcfa4da1184e92b5 languageName: node linkType: hard @@ -36133,8 +36154,8 @@ __metadata: linkType: hard "webpack@npm:5": - version: 5.74.0 - resolution: "webpack@npm:5.74.0" + version: 5.75.0 + resolution: "webpack@npm:5.75.0" dependencies: "@types/eslint-scope": ^3.7.3 "@types/estree": ^0.0.51 @@ -36165,7 +36186,7 @@ __metadata: optional: true bin: webpack: bin/webpack.js - checksum: a5f9eeb36edfa3fe1fc31950706080521fe2ada9706ce8205b817164ab3f6b207cc42023fb61e09687e7f0f252871c6c1a8b0f1a638a4a065c30f6bc460c68f9 + checksum: 0160331d6255bdb8027f2589458514709a4a6555e2868adb6356a309d3f7b2212cb129a00f343fe0f94f54a31b4677507a3adf9ae73badc1216105ac548681ea languageName: node linkType: hard From 455e9ef08d9623adbed01723ffbe2543b6fa4a6e Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Fri, 11 Nov 2022 14:57:01 +0100 Subject: [PATCH 24/47] wip --- code/addons/controls/package.json | 1 - code/addons/docs/package.json | 2 -- code/frameworks/angular/package.json | 1 - code/frameworks/ember/package.json | 1 - code/frameworks/react-vite/package.json | 1 - code/frameworks/svelte-vite/package.json | 1 - code/frameworks/vue-vite/package.json | 1 - code/frameworks/vue3-vite/package.json | 1 - .../web-components-vite/package.json | 1 - code/lib/builder-vite/package.json | 2 +- code/lib/builder-webpack5/package.json | 1 - code/lib/cli/src/versions.ts | 2 ++ code/lib/core-client/typings.d.ts | 2 -- code/lib/docs-tools/package.json | 1 - .../preview-web/PreviewWithSelection.tsx | 4 +-- .../modules/preview-web}/SelectionStore.ts | 0 .../src/modules/preview-web}/View.ts | 0 code/lib/preview/package.json | 2 -- code/lib/preview/src/client-api.ts | 3 +- code/lib/preview/src/core-client.ts | 3 +- code/lib/preview/src/preview-web.ts | 3 +- code/lib/preview/src/store.ts | 3 +- code/renderers/html/package.json | 2 -- code/renderers/preact/package.json | 1 - code/renderers/react/package.json | 1 - .../template/stories/js-argtypes.stories.jsx | 2 +- .../template/stories/ts-argtypes.stories.tsx | 2 +- code/renderers/server/package.json | 2 -- code/renderers/svelte/package.json | 1 - code/renderers/vue/package.json | 1 - code/renderers/vue3/package.json | 1 - code/renderers/web-components/package.json | 2 -- code/ui/.storybook/preview.tsx | 4 +-- code/ui/blocks/package.json | 3 -- code/yarn.lock | 31 ++----------------- 35 files changed, 15 insertions(+), 74 deletions(-) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/SelectionStore.ts (100%) rename code/lib/{preview-web/src => preview-api/src/modules/preview-web}/View.ts (100%) diff --git a/code/addons/controls/package.json b/code/addons/controls/package.json index f3297d27c8b..708f656ed13 100644 --- a/code/addons/controls/package.json +++ b/code/addons/controls/package.json @@ -75,7 +75,6 @@ "@storybook/core-common": "7.0.0-alpha.48", "@storybook/node-logger": "7.0.0-alpha.48", "@storybook/preview-api": "7.0.0-alpha.48", - "@storybook/store": "7.0.0-alpha.48", "@storybook/theming": "7.0.0-alpha.48", "@storybook/types": "7.0.0-alpha.48", "lodash": "^4.17.21", diff --git a/code/addons/docs/package.json b/code/addons/docs/package.json index fcd838d4446..807df9facd8 100644 --- a/code/addons/docs/package.json +++ b/code/addons/docs/package.json @@ -95,8 +95,6 @@ "@storybook/node-logger": "7.0.0-alpha.48", "@storybook/postinstall": "7.0.0-alpha.48", "@storybook/preview-api": "7.0.0-alpha.48", - "@storybook/preview-web": "7.0.0-alpha.48", - "@storybook/store": "7.0.0-alpha.48", "@storybook/theming": "7.0.0-alpha.48", "@storybook/types": "7.0.0-alpha.48", "dequal": "^2.0.2", diff --git a/code/frameworks/angular/package.json b/code/frameworks/angular/package.json index 429feedda11..5ee63cdcf17 100644 --- a/code/frameworks/angular/package.json +++ b/code/frameworks/angular/package.json @@ -46,7 +46,6 @@ "@storybook/docs-tools": "7.0.0-alpha.48", "@storybook/node-logger": "7.0.0-alpha.48", "@storybook/preview-api": "7.0.0-alpha.48", - "@storybook/store": "7.0.0-alpha.48", "@storybook/types": "7.0.0-alpha.48", "@types/node": "^16.0.0", "@types/react": "^16.14.23", diff --git a/code/frameworks/ember/package.json b/code/frameworks/ember/package.json index bb2ae7b4ce4..4633980ce7a 100644 --- a/code/frameworks/ember/package.json +++ b/code/frameworks/ember/package.json @@ -35,7 +35,6 @@ "@storybook/core-client": "7.0.0-alpha.48", "@storybook/core-common": "7.0.0-alpha.48", "@storybook/docs-tools": "7.0.0-alpha.48", - "@storybook/store": "7.0.0-alpha.48", "@storybook/types": "7.0.0-alpha.48", "global": "^4.4.0", "react": "16.14.0", diff --git a/code/frameworks/react-vite/package.json b/code/frameworks/react-vite/package.json index 428cbf45b7e..f16bac9b9f0 100644 --- a/code/frameworks/react-vite/package.json +++ b/code/frameworks/react-vite/package.json @@ -59,7 +59,6 @@ "@storybook/channel-websocket": "7.0.0-alpha.48", "@storybook/client-api": "7.0.0-alpha.48", "@storybook/preview-api": "7.0.0-alpha.48", - "@storybook/preview-web": "7.0.0-alpha.48", "@storybook/react": "7.0.0-alpha.48", "@vitejs/plugin-react": "^2.0.0", "ast-types": "^0.14.2", diff --git a/code/frameworks/svelte-vite/package.json b/code/frameworks/svelte-vite/package.json index 64428f085a4..97ccda2ce02 100644 --- a/code/frameworks/svelte-vite/package.json +++ b/code/frameworks/svelte-vite/package.json @@ -59,7 +59,6 @@ "@storybook/client-api": "7.0.0-alpha.48", "@storybook/node-logger": "7.0.0-alpha.48", "@storybook/preview-api": "7.0.0-alpha.48", - "@storybook/preview-web": "7.0.0-alpha.48", "@storybook/svelte": "7.0.0-alpha.48", "@sveltejs/vite-plugin-svelte": "^1.0.0", "magic-string": "^0.26.1", diff --git a/code/frameworks/vue-vite/package.json b/code/frameworks/vue-vite/package.json index 3678d61a6cb..46e14ad9cfc 100644 --- a/code/frameworks/vue-vite/package.json +++ b/code/frameworks/vue-vite/package.json @@ -58,7 +58,6 @@ "@storybook/core-common": "7.0.0-alpha.48", "@storybook/core-server": "7.0.0-alpha.48", "@storybook/preview-api": "7.0.0-alpha.48", - "@storybook/preview-web": "7.0.0-alpha.48", "@storybook/vue": "7.0.0-alpha.48", "magic-string": "^0.26.1", "vite": "^3.1.3", diff --git a/code/frameworks/vue3-vite/package.json b/code/frameworks/vue3-vite/package.json index 2833ff19d12..1edbfd6d70c 100644 --- a/code/frameworks/vue3-vite/package.json +++ b/code/frameworks/vue3-vite/package.json @@ -58,7 +58,6 @@ "@storybook/client-api": "7.0.0-alpha.48", "@storybook/core-server": "7.0.0-alpha.48", "@storybook/preview-api": "7.0.0-alpha.48", - "@storybook/preview-web": "7.0.0-alpha.48", "@storybook/vue3": "7.0.0-alpha.48", "@vitejs/plugin-vue": "^3.0.0", "magic-string": "^0.26.1", diff --git a/code/frameworks/web-components-vite/package.json b/code/frameworks/web-components-vite/package.json index 19f6194810c..b51613d868c 100644 --- a/code/frameworks/web-components-vite/package.json +++ b/code/frameworks/web-components-vite/package.json @@ -59,7 +59,6 @@ "@storybook/core-server": "7.0.0-alpha.48", "@storybook/node-logger": "7.0.0-alpha.48", "@storybook/preview-api": "7.0.0-alpha.48", - "@storybook/preview-web": "7.0.0-alpha.48", "@storybook/web-components": "7.0.0-alpha.48", "magic-string": "^0.26.1", "vite": "3" diff --git a/code/lib/builder-vite/package.json b/code/lib/builder-vite/package.json index fcb6fed5af6..95c28b768ab 100644 --- a/code/lib/builder-vite/package.json +++ b/code/lib/builder-vite/package.json @@ -25,7 +25,7 @@ "@storybook/mdx2-csf": "next", "@storybook/node-logger": "7.0.0-alpha.48", "@storybook/preview": "7.0.0-alpha.48", - "@storybook/preview-web": "7.0.0-alpha.48", + "@storybook/preview-api": "7.0.0-alpha.48", "@storybook/source-loader": "7.0.0-alpha.48", "@storybook/types": "7.0.0-alpha.48", "@vitejs/plugin-react": "^2.0.0", diff --git a/code/lib/builder-webpack5/package.json b/code/lib/builder-webpack5/package.json index dacd4e58e9f..606e50aae1f 100644 --- a/code/lib/builder-webpack5/package.json +++ b/code/lib/builder-webpack5/package.json @@ -68,7 +68,6 @@ "@storybook/node-logger": "7.0.0-alpha.48", "@storybook/preview": "7.0.0-alpha.48", "@storybook/preview-api": "7.0.0-alpha.48", - "@storybook/preview-web": "7.0.0-alpha.48", "@storybook/router": "7.0.0-alpha.48", "@storybook/store": "7.0.0-alpha.48", "@storybook/theming": "7.0.0-alpha.48", diff --git a/code/lib/cli/src/versions.ts b/code/lib/cli/src/versions.ts index c00a272d65e..fe8718022dc 100644 --- a/code/lib/cli/src/versions.ts +++ b/code/lib/cli/src/versions.ts @@ -56,6 +56,8 @@ export default { '@storybook/preset-vue-webpack': '7.0.0-alpha.48', '@storybook/preset-vue3-webpack': '7.0.0-alpha.48', '@storybook/preset-web-components-webpack': '7.0.0-alpha.48', + '@storybook/preview': '7.0.0-alpha.48', + '@storybook/preview-api': '7.0.0-alpha.48', '@storybook/preview-web': '7.0.0-alpha.48', '@storybook/react': '7.0.0-alpha.48', '@storybook/react-vite': '7.0.0-alpha.48', diff --git a/code/lib/core-client/typings.d.ts b/code/lib/core-client/typings.d.ts index 3da80ea2d99..2a4bb7deb46 100644 --- a/code/lib/core-client/typings.d.ts +++ b/code/lib/core-client/typings.d.ts @@ -1,5 +1,3 @@ -declare module '@storybook/preview-web/dist/cjs/PreviewWeb.mockdata'; - declare class AnsiToHtml { constructor(options: { escapeHtml: boolean }); diff --git a/code/lib/docs-tools/package.json b/code/lib/docs-tools/package.json index cb82f879d83..f37e8f14719 100644 --- a/code/lib/docs-tools/package.json +++ b/code/lib/docs-tools/package.json @@ -45,7 +45,6 @@ "@babel/core": "^7.12.10", "@storybook/core-common": "7.0.0-alpha.48", "@storybook/preview-api": "7.0.0-alpha.48", - "@storybook/store": "7.0.0-alpha.48", "@storybook/types": "7.0.0-alpha.48", "doctrine": "^3.0.0", "lodash": "^4.17.21" diff --git a/code/lib/preview-api/src/modules/preview-web/PreviewWithSelection.tsx b/code/lib/preview-api/src/modules/preview-web/PreviewWithSelection.tsx index 1bb1ebbe11c..e4d1802b9bf 100644 --- a/code/lib/preview-api/src/modules/preview-web/PreviewWithSelection.tsx +++ b/code/lib/preview-api/src/modules/preview-web/PreviewWithSelection.tsx @@ -38,8 +38,8 @@ import { PREPARE_ABORTED } from './render/Render'; import { StoryRender } from './render/StoryRender'; import { TemplateDocsRender } from './render/TemplateDocsRender'; import { StandaloneDocsRender } from './render/StandaloneDocsRender'; -import type { SelectionStore } from '../../../../preview-web/src/SelectionStore'; -import type { View } from '../../../../preview-web/src/View'; +import type { SelectionStore } from './SelectionStore'; +import type { View } from './View'; const { window: globalWindow } = global; diff --git a/code/lib/preview-web/src/SelectionStore.ts b/code/lib/preview-api/src/modules/preview-web/SelectionStore.ts similarity index 100% rename from code/lib/preview-web/src/SelectionStore.ts rename to code/lib/preview-api/src/modules/preview-web/SelectionStore.ts diff --git a/code/lib/preview-web/src/View.ts b/code/lib/preview-api/src/modules/preview-web/View.ts similarity index 100% rename from code/lib/preview-web/src/View.ts rename to code/lib/preview-api/src/modules/preview-web/View.ts diff --git a/code/lib/preview/package.json b/code/lib/preview/package.json index 135bf8e02d8..9772ef53945 100644 --- a/code/lib/preview/package.json +++ b/code/lib/preview/package.json @@ -107,12 +107,10 @@ "@storybook/channel-websocket": "7.0.0-alpha.48", "@storybook/channels": "7.0.0-alpha.48", "@storybook/client-logger": "7.0.0-alpha.48", - "@storybook/core-client": "7.0.0-alpha.48", "@storybook/core-common": "7.0.0-alpha.48", "@storybook/core-events": "7.0.0-alpha.48", "@storybook/csf": "next", "@storybook/preview-api": "7.0.0-alpha.48", - "@storybook/preview-web": "7.0.0-alpha.48", "@storybook/router": "7.0.0-alpha.48", "@storybook/theming": "7.0.0-alpha.48", "@storybook/types": "7.0.0-alpha.48", diff --git a/code/lib/preview/src/client-api.ts b/code/lib/preview/src/client-api.ts index 8214e18c1d3..ddddd074614 100644 --- a/code/lib/preview/src/client-api.ts +++ b/code/lib/preview/src/client-api.ts @@ -1,3 +1,2 @@ -/* eslint-disable import/export */ /* eslint-disable import/no-extraneous-dependencies */ -export * from '@storybook/client-api'; +export * from '@storybook/preview-api/dist/client-api'; diff --git a/code/lib/preview/src/core-client.ts b/code/lib/preview/src/core-client.ts index 44c7079f399..cf281cb16cf 100644 --- a/code/lib/preview/src/core-client.ts +++ b/code/lib/preview/src/core-client.ts @@ -1,3 +1,2 @@ -/* eslint-disable import/export */ /* eslint-disable import/no-extraneous-dependencies */ -export * from '@storybook/core-client'; +export * from '@storybook/preview-api/dist/core-client'; diff --git a/code/lib/preview/src/preview-web.ts b/code/lib/preview/src/preview-web.ts index 5ad59743ada..6acd7785361 100644 --- a/code/lib/preview/src/preview-web.ts +++ b/code/lib/preview/src/preview-web.ts @@ -1,3 +1,2 @@ -/* eslint-disable import/export */ /* eslint-disable import/no-extraneous-dependencies */ -export * from '@storybook/preview-web'; +export * from '@storybook/preview-api/dist/preview-web'; diff --git a/code/lib/preview/src/store.ts b/code/lib/preview/src/store.ts index 9a5bbd7de43..455b6e9fe8e 100644 --- a/code/lib/preview/src/store.ts +++ b/code/lib/preview/src/store.ts @@ -1,3 +1,2 @@ -/* eslint-disable import/export */ /* eslint-disable import/no-extraneous-dependencies */ -export * from '@storybook/store'; +export * from '@storybook/preview-api/dist/store'; diff --git a/code/renderers/html/package.json b/code/renderers/html/package.json index 30b7f76d0fb..04cf95f5c20 100644 --- a/code/renderers/html/package.json +++ b/code/renderers/html/package.json @@ -55,8 +55,6 @@ "@storybook/core-client": "7.0.0-alpha.48", "@storybook/docs-tools": "7.0.0-alpha.48", "@storybook/preview-api": "7.0.0-alpha.48", - "@storybook/preview-web": "7.0.0-alpha.48", - "@storybook/store": "7.0.0-alpha.48", "@storybook/types": "7.0.0-alpha.48", "global": "^4.4.0", "react": "16.14.0", diff --git a/code/renderers/preact/package.json b/code/renderers/preact/package.json index 25b4a79b99c..3b6f8eb9822 100644 --- a/code/renderers/preact/package.json +++ b/code/renderers/preact/package.json @@ -54,7 +54,6 @@ "@storybook/addons": "7.0.0-alpha.48", "@storybook/core-client": "7.0.0-alpha.48", "@storybook/preview-api": "7.0.0-alpha.48", - "@storybook/store": "7.0.0-alpha.48", "@storybook/types": "7.0.0-alpha.48", "global": "^4.4.0", "react": "16.14.0", diff --git a/code/renderers/react/package.json b/code/renderers/react/package.json index 86dead226d1..f1a26b1703b 100644 --- a/code/renderers/react/package.json +++ b/code/renderers/react/package.json @@ -57,7 +57,6 @@ "@storybook/core-client": "7.0.0-alpha.48", "@storybook/docs-tools": "7.0.0-alpha.48", "@storybook/preview-api": "7.0.0-alpha.48", - "@storybook/store": "7.0.0-alpha.48", "@storybook/types": "7.0.0-alpha.48", "@types/estree": "^0.0.51", "@types/node": "^16.0.0", diff --git a/code/renderers/react/template/stories/js-argtypes.stories.jsx b/code/renderers/react/template/stories/js-argtypes.stories.jsx index a3299558886..1fc65b1ecfc 100644 --- a/code/renderers/react/template/stories/js-argtypes.stories.jsx +++ b/code/renderers/react/template/stories/js-argtypes.stories.jsx @@ -2,7 +2,7 @@ import React, { useState } from 'react'; import PropTypes from 'prop-types'; import mapValues from 'lodash/mapValues'; import { PureArgsTable as ArgsTable } from '@storybook/blocks'; -import { inferControls } from '@storybook/store'; +import { inferControls } from '@storybook/preview-api'; import { ThemeProvider, themes, convert } from '@storybook/theming'; import { component as JsClassComponentComponent } from './docgen-components/js-class-component/input.jsx'; diff --git a/code/renderers/react/template/stories/ts-argtypes.stories.tsx b/code/renderers/react/template/stories/ts-argtypes.stories.tsx index fb245443162..7800e3aa735 100644 --- a/code/renderers/react/template/stories/ts-argtypes.stories.tsx +++ b/code/renderers/react/template/stories/ts-argtypes.stories.tsx @@ -2,7 +2,7 @@ import React, { useState } from 'react'; import mapValues from 'lodash/mapValues'; import { PureArgsTable as ArgsTable } from '@storybook/blocks'; import type { Args, Parameters, StoryContext } from '@storybook/types'; -import { inferControls } from '@storybook/store'; +import { inferControls } from '@storybook/preview-api'; import { ThemeProvider, themes, convert } from '@storybook/theming'; import { component as TsFunctionComponentComponent } from './docgen-components/ts-function-component/input'; diff --git a/code/renderers/server/package.json b/code/renderers/server/package.json index 2bbb8f8d21a..adb078508f1 100644 --- a/code/renderers/server/package.json +++ b/code/renderers/server/package.json @@ -54,8 +54,6 @@ "@storybook/addons": "7.0.0-alpha.48", "@storybook/core-client": "7.0.0-alpha.48", "@storybook/preview-api": "7.0.0-alpha.48", - "@storybook/preview-web": "7.0.0-alpha.48", - "@storybook/store": "7.0.0-alpha.48", "@storybook/types": "7.0.0-alpha.48", "global": "^4.4.0", "react": "16.14.0", diff --git a/code/renderers/svelte/package.json b/code/renderers/svelte/package.json index 9c78711b1e5..f93b154e45d 100644 --- a/code/renderers/svelte/package.json +++ b/code/renderers/svelte/package.json @@ -60,7 +60,6 @@ "@storybook/core-client": "7.0.0-alpha.48", "@storybook/docs-tools": "7.0.0-alpha.48", "@storybook/preview-api": "7.0.0-alpha.48", - "@storybook/store": "7.0.0-alpha.48", "@storybook/types": "7.0.0-alpha.48", "global": "^4.4.0", "react": "16.14.0", diff --git a/code/renderers/vue/package.json b/code/renderers/vue/package.json index 5d590c17fbd..2a2f566e9fd 100644 --- a/code/renderers/vue/package.json +++ b/code/renderers/vue/package.json @@ -56,7 +56,6 @@ "@storybook/core-client": "7.0.0-alpha.48", "@storybook/docs-tools": "7.0.0-alpha.48", "@storybook/preview-api": "7.0.0-alpha.48", - "@storybook/store": "7.0.0-alpha.48", "@storybook/types": "7.0.0-alpha.48", "global": "^4.4.0", "react": "16.14.0", diff --git a/code/renderers/vue3/package.json b/code/renderers/vue3/package.json index b86a1517313..9e0b54dbf8f 100644 --- a/code/renderers/vue3/package.json +++ b/code/renderers/vue3/package.json @@ -55,7 +55,6 @@ "@storybook/core-client": "7.0.0-alpha.48", "@storybook/docs-tools": "7.0.0-alpha.48", "@storybook/preview-api": "7.0.0-alpha.48", - "@storybook/store": "7.0.0-alpha.48", "@storybook/types": "7.0.0-alpha.48", "global": "^4.4.0", "react": "16.14.0", diff --git a/code/renderers/web-components/package.json b/code/renderers/web-components/package.json index a85609da5b6..9596a118432 100644 --- a/code/renderers/web-components/package.json +++ b/code/renderers/web-components/package.json @@ -59,8 +59,6 @@ "@storybook/core-client": "7.0.0-alpha.48", "@storybook/docs-tools": "7.0.0-alpha.48", "@storybook/preview-api": "7.0.0-alpha.48", - "@storybook/preview-web": "7.0.0-alpha.48", - "@storybook/store": "7.0.0-alpha.48", "@storybook/types": "7.0.0-alpha.48", "global": "^4.4.0", "react": "16.14.0", diff --git a/code/ui/.storybook/preview.tsx b/code/ui/.storybook/preview.tsx index 4c97aff00fd..72ce5b6d117 100644 --- a/code/ui/.storybook/preview.tsx +++ b/code/ui/.storybook/preview.tsx @@ -12,8 +12,8 @@ import { } from '@storybook/theming'; import { useArgs } from '@storybook/addons'; import { Symbols } from '@storybook/components'; -import type { PreviewWeb } from '@storybook/preview-web'; -import { DocsContext } from '@storybook/preview-web'; +import type { PreviewWeb } from '@storybook/preview-api'; +import { DocsContext } from '@storybook/preview-api'; import type { ReactFramework } from '@storybook/react'; import type { Channel } from '@storybook/channels'; diff --git a/code/ui/blocks/package.json b/code/ui/blocks/package.json index c870ffb1ca9..c6b4a43ceb0 100644 --- a/code/ui/blocks/package.json +++ b/code/ui/blocks/package.json @@ -50,8 +50,6 @@ "@storybook/csf": "next", "@storybook/docs-tools": "7.0.0-alpha.48", "@storybook/preview-api": "7.0.0-alpha.48", - "@storybook/preview-web": "7.0.0-alpha.48", - "@storybook/store": "7.0.0-alpha.48", "@storybook/theming": "7.0.0-alpha.48", "@storybook/types": "7.0.0-alpha.48", "@types/lodash": "^4.14.167", @@ -69,7 +67,6 @@ "devDependencies": { "@storybook/addon-actions": "7.0.0-alpha.48", "@storybook/addons": "7.0.0-alpha.48", - "@storybook/preview-api": "7.0.0-alpha.48", "@types/color-convert": "^2.0.0" }, "peerDependencies": { diff --git a/code/yarn.lock b/code/yarn.lock index 609f632c866..4ac1da97de8 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -5481,7 +5481,6 @@ __metadata: "@storybook/core-common": 7.0.0-alpha.48 "@storybook/node-logger": 7.0.0-alpha.48 "@storybook/preview-api": 7.0.0-alpha.48 - "@storybook/store": 7.0.0-alpha.48 "@storybook/theming": 7.0.0-alpha.48 "@storybook/types": 7.0.0-alpha.48 lodash: ^4.17.21 @@ -5513,8 +5512,6 @@ __metadata: "@storybook/node-logger": 7.0.0-alpha.48 "@storybook/postinstall": 7.0.0-alpha.48 "@storybook/preview-api": 7.0.0-alpha.48 - "@storybook/preview-web": 7.0.0-alpha.48 - "@storybook/store": 7.0.0-alpha.48 "@storybook/theming": 7.0.0-alpha.48 "@storybook/types": 7.0.0-alpha.48 dequal: ^2.0.2 @@ -5985,7 +5982,6 @@ __metadata: "@storybook/docs-tools": 7.0.0-alpha.48 "@storybook/node-logger": 7.0.0-alpha.48 "@storybook/preview-api": 7.0.0-alpha.48 - "@storybook/store": 7.0.0-alpha.48 "@storybook/types": 7.0.0-alpha.48 "@types/node": ^16.0.0 "@types/react": ^16.14.23 @@ -6121,8 +6117,6 @@ __metadata: "@storybook/csf": next "@storybook/docs-tools": 7.0.0-alpha.48 "@storybook/preview-api": 7.0.0-alpha.48 - "@storybook/preview-web": 7.0.0-alpha.48 - "@storybook/store": 7.0.0-alpha.48 "@storybook/theming": 7.0.0-alpha.48 "@storybook/types": 7.0.0-alpha.48 "@types/color-convert": ^2.0.0 @@ -6177,7 +6171,7 @@ __metadata: "@storybook/mdx2-csf": next "@storybook/node-logger": 7.0.0-alpha.48 "@storybook/preview": 7.0.0-alpha.48 - "@storybook/preview-web": 7.0.0-alpha.48 + "@storybook/preview-api": 7.0.0-alpha.48 "@storybook/source-loader": 7.0.0-alpha.48 "@storybook/types": 7.0.0-alpha.48 "@types/express": ^4.17.13 @@ -6215,7 +6209,6 @@ __metadata: "@storybook/node-logger": 7.0.0-alpha.48 "@storybook/preview": 7.0.0-alpha.48 "@storybook/preview-api": 7.0.0-alpha.48 - "@storybook/preview-web": 7.0.0-alpha.48 "@storybook/router": 7.0.0-alpha.48 "@storybook/store": 7.0.0-alpha.48 "@storybook/theming": 7.0.0-alpha.48 @@ -6677,7 +6670,6 @@ __metadata: "@babel/core": ^7.12.10 "@storybook/core-common": 7.0.0-alpha.48 "@storybook/preview-api": 7.0.0-alpha.48 - "@storybook/store": 7.0.0-alpha.48 "@storybook/types": 7.0.0-alpha.48 doctrine: ^3.0.0 jest-specific-snapshot: ^4.0.0 @@ -6695,7 +6687,6 @@ __metadata: "@storybook/core-client": 7.0.0-alpha.48 "@storybook/core-common": 7.0.0-alpha.48 "@storybook/docs-tools": 7.0.0-alpha.48 - "@storybook/store": 7.0.0-alpha.48 "@storybook/types": 7.0.0-alpha.48 ember-source: ~3.28.1 global: ^4.4.0 @@ -6757,8 +6748,6 @@ __metadata: "@storybook/core-client": 7.0.0-alpha.48 "@storybook/docs-tools": 7.0.0-alpha.48 "@storybook/preview-api": 7.0.0-alpha.48 - "@storybook/preview-web": 7.0.0-alpha.48 - "@storybook/store": 7.0.0-alpha.48 "@storybook/types": 7.0.0-alpha.48 global: ^4.4.0 react: 16.14.0 @@ -7015,7 +7004,6 @@ __metadata: "@storybook/addons": 7.0.0-alpha.48 "@storybook/core-client": 7.0.0-alpha.48 "@storybook/preview-api": 7.0.0-alpha.48 - "@storybook/store": 7.0.0-alpha.48 "@storybook/types": 7.0.0-alpha.48 global: ^4.4.0 preact: ^10.5.13 @@ -7237,7 +7225,7 @@ __metadata: languageName: unknown linkType: soft -"@storybook/preview-web@7.0.0-alpha.48, @storybook/preview-web@workspace:*, @storybook/preview-web@workspace:lib/preview-web": +"@storybook/preview-web@workspace:*, @storybook/preview-web@workspace:lib/preview-web": version: 0.0.0-use.local resolution: "@storybook/preview-web@workspace:lib/preview-web" dependencies: @@ -7254,12 +7242,10 @@ __metadata: "@storybook/channel-websocket": 7.0.0-alpha.48 "@storybook/channels": 7.0.0-alpha.48 "@storybook/client-logger": 7.0.0-alpha.48 - "@storybook/core-client": 7.0.0-alpha.48 "@storybook/core-common": 7.0.0-alpha.48 "@storybook/core-events": 7.0.0-alpha.48 "@storybook/csf": next "@storybook/preview-api": 7.0.0-alpha.48 - "@storybook/preview-web": 7.0.0-alpha.48 "@storybook/router": 7.0.0-alpha.48 "@storybook/theming": 7.0.0-alpha.48 "@storybook/types": 7.0.0-alpha.48 @@ -7311,7 +7297,6 @@ __metadata: "@storybook/channel-websocket": 7.0.0-alpha.48 "@storybook/client-api": 7.0.0-alpha.48 "@storybook/preview-api": 7.0.0-alpha.48 - "@storybook/preview-web": 7.0.0-alpha.48 "@storybook/react": 7.0.0-alpha.48 "@types/node": ^16.0.0 "@vitejs/plugin-react": ^2.0.0 @@ -7359,7 +7344,6 @@ __metadata: "@storybook/core-client": 7.0.0-alpha.48 "@storybook/docs-tools": 7.0.0-alpha.48 "@storybook/preview-api": 7.0.0-alpha.48 - "@storybook/store": 7.0.0-alpha.48 "@storybook/types": 7.0.0-alpha.48 "@types/estree": ^0.0.51 "@types/node": ^16.0.0 @@ -7726,8 +7710,6 @@ __metadata: "@storybook/addons": 7.0.0-alpha.48 "@storybook/core-client": 7.0.0-alpha.48 "@storybook/preview-api": 7.0.0-alpha.48 - "@storybook/preview-web": 7.0.0-alpha.48 - "@storybook/store": 7.0.0-alpha.48 "@storybook/types": 7.0.0-alpha.48 global: ^4.4.0 react: 16.14.0 @@ -7774,7 +7756,6 @@ __metadata: "@storybook/client-api": 7.0.0-alpha.48 "@storybook/node-logger": 7.0.0-alpha.48 "@storybook/preview-api": 7.0.0-alpha.48 - "@storybook/preview-web": 7.0.0-alpha.48 "@storybook/svelte": 7.0.0-alpha.48 "@sveltejs/vite-plugin-svelte": ^1.0.0 "@types/node": ^16.0.0 @@ -7820,7 +7801,6 @@ __metadata: "@storybook/core-client": 7.0.0-alpha.48 "@storybook/docs-tools": 7.0.0-alpha.48 "@storybook/preview-api": 7.0.0-alpha.48 - "@storybook/store": 7.0.0-alpha.48 "@storybook/types": 7.0.0-alpha.48 expect-type: ^0.14.2 global: ^4.4.0 @@ -7936,7 +7916,6 @@ __metadata: "@storybook/core-common": 7.0.0-alpha.48 "@storybook/core-server": 7.0.0-alpha.48 "@storybook/preview-api": 7.0.0-alpha.48 - "@storybook/preview-web": 7.0.0-alpha.48 "@storybook/vue": 7.0.0-alpha.48 magic-string: ^0.26.1 typescript: ~4.6.3 @@ -7984,7 +7963,6 @@ __metadata: "@storybook/client-api": 7.0.0-alpha.48 "@storybook/core-server": 7.0.0-alpha.48 "@storybook/preview-api": 7.0.0-alpha.48 - "@storybook/preview-web": 7.0.0-alpha.48 "@storybook/vue3": 7.0.0-alpha.48 "@types/node": ^16.0.0 "@vitejs/plugin-vue": ^3.0.0 @@ -8026,7 +8004,6 @@ __metadata: "@storybook/core-client": 7.0.0-alpha.48 "@storybook/docs-tools": 7.0.0-alpha.48 "@storybook/preview-api": 7.0.0-alpha.48 - "@storybook/store": 7.0.0-alpha.48 "@storybook/types": 7.0.0-alpha.48 global: ^4.4.0 react: 16.14.0 @@ -8055,7 +8032,6 @@ __metadata: "@storybook/core-client": 7.0.0-alpha.48 "@storybook/docs-tools": 7.0.0-alpha.48 "@storybook/preview-api": 7.0.0-alpha.48 - "@storybook/store": 7.0.0-alpha.48 "@storybook/types": 7.0.0-alpha.48 global: ^4.4.0 react: 16.14.0 @@ -8088,7 +8064,6 @@ __metadata: "@storybook/core-server": 7.0.0-alpha.48 "@storybook/node-logger": 7.0.0-alpha.48 "@storybook/preview-api": 7.0.0-alpha.48 - "@storybook/preview-web": 7.0.0-alpha.48 "@storybook/web-components": 7.0.0-alpha.48 "@types/node": ^16.0.0 magic-string: ^0.26.1 @@ -8126,8 +8101,6 @@ __metadata: "@storybook/core-client": 7.0.0-alpha.48 "@storybook/docs-tools": 7.0.0-alpha.48 "@storybook/preview-api": 7.0.0-alpha.48 - "@storybook/preview-web": 7.0.0-alpha.48 - "@storybook/store": 7.0.0-alpha.48 "@storybook/types": 7.0.0-alpha.48 global: ^4.4.0 lit: 2.3.1 From 78f7f9489404f8b25966bca18fc393f8cd24ee45 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Fri, 11 Nov 2022 15:11:17 +0100 Subject: [PATCH 25/47] fix typings --- .../src/modules/preview-web/PreviewWeb.test.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts b/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts index 3db62219c2d..ac34da70dcc 100644 --- a/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts +++ b/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts @@ -29,11 +29,7 @@ import { } from '@storybook/core-events'; import { logger } from '@storybook/client-logger'; import { addons, mockChannel as createMockChannel } from '@storybook/addons'; -import type { - Framework, - Store_ModuleImportFn, - Store_WebProjectAnnotations, -} from '@storybook/types'; +import type { Framework, Store_ModuleImportFn, ProjectAnnotations } from '@storybook/types'; import { mocked } from 'ts-jest/utils'; // import type { ModuleImportFn, WebProjectAnnotations } from '../../store'; @@ -114,7 +110,7 @@ async function createAndRenderPreview({ getProjectAnnotations: inputGetProjectAnnotations = getProjectAnnotations, }: { importFn?: Store_ModuleImportFn; - getProjectAnnotations?: () => Store_WebProjectAnnotations; + getProjectAnnotations?: () => ProjectAnnotations; } = {}) { const preview = new PreviewWeb(); await preview.initialize({ From 6e19f0fe426d58f0f7981a42c3d0b0384fab49b1 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Fri, 11 Nov 2022 15:35:49 +0100 Subject: [PATCH 26/47] fix linting && cleanup --- code/addons/docs/docs/recipes.md | 2 +- code/frameworks/react-vite/package.json | 1 - code/frameworks/react-vite/src/index.ts | 6 ------ code/frameworks/svelte-vite/package.json | 1 - code/frameworks/vue-vite/package.json | 1 - code/frameworks/vue3-vite/package.json | 1 - code/frameworks/web-components-vite/package.json | 1 - 7 files changed, 1 insertion(+), 12 deletions(-) diff --git a/code/addons/docs/docs/recipes.md b/code/addons/docs/docs/recipes.md index 18809715838..df2892df89e 100644 --- a/code/addons/docs/docs/recipes.md +++ b/code/addons/docs/docs/recipes.md @@ -159,7 +159,7 @@ If you're currently using the notes/info addons, you can upgrade to DocsPage by Suppose you've added a `notes` parameter to each component in your library, containing markdown text, and you want that to show up at the top of the page in the `Description` slot. You could do that by adding the following snippet to `.storybook/preview.js`: ```js -import { addParameters } from '@storybook/client-api'; +import { addParameters } from '@storybook/preview-api'; addParameters({ docs: { diff --git a/code/frameworks/react-vite/package.json b/code/frameworks/react-vite/package.json index f16bac9b9f0..a49a17c1083 100644 --- a/code/frameworks/react-vite/package.json +++ b/code/frameworks/react-vite/package.json @@ -57,7 +57,6 @@ "@storybook/builder-vite": "7.0.0-alpha.48", "@storybook/channel-postmessage": "7.0.0-alpha.48", "@storybook/channel-websocket": "7.0.0-alpha.48", - "@storybook/client-api": "7.0.0-alpha.48", "@storybook/preview-api": "7.0.0-alpha.48", "@storybook/react": "7.0.0-alpha.48", "@vitejs/plugin-react": "^2.0.0", diff --git a/code/frameworks/react-vite/src/index.ts b/code/frameworks/react-vite/src/index.ts index d2b5b9e7eb3..1aa9b0bb063 100644 --- a/code/frameworks/react-vite/src/index.ts +++ b/code/frameworks/react-vite/src/index.ts @@ -1,9 +1,3 @@ -// TODO: should move this to preview-api, I guess -// exports for builder-vite -import * as clientApi from '@storybook/client-api'; - -export { clientApi }; - export { createChannel as createPostMessageChannel } from '@storybook/channel-postmessage'; export { createChannel as createWebSocketChannel } from '@storybook/channel-websocket'; diff --git a/code/frameworks/svelte-vite/package.json b/code/frameworks/svelte-vite/package.json index 97ccda2ce02..77eb9e0460e 100644 --- a/code/frameworks/svelte-vite/package.json +++ b/code/frameworks/svelte-vite/package.json @@ -56,7 +56,6 @@ "@storybook/builder-vite": "7.0.0-alpha.48", "@storybook/channel-postmessage": "7.0.0-alpha.48", "@storybook/channel-websocket": "7.0.0-alpha.48", - "@storybook/client-api": "7.0.0-alpha.48", "@storybook/node-logger": "7.0.0-alpha.48", "@storybook/preview-api": "7.0.0-alpha.48", "@storybook/svelte": "7.0.0-alpha.48", diff --git a/code/frameworks/vue-vite/package.json b/code/frameworks/vue-vite/package.json index 46e14ad9cfc..aba50bbed3d 100644 --- a/code/frameworks/vue-vite/package.json +++ b/code/frameworks/vue-vite/package.json @@ -54,7 +54,6 @@ "@storybook/builder-vite": "7.0.0-alpha.48", "@storybook/channel-postmessage": "7.0.0-alpha.48", "@storybook/channel-websocket": "7.0.0-alpha.48", - "@storybook/client-api": "7.0.0-alpha.48", "@storybook/core-common": "7.0.0-alpha.48", "@storybook/core-server": "7.0.0-alpha.48", "@storybook/preview-api": "7.0.0-alpha.48", diff --git a/code/frameworks/vue3-vite/package.json b/code/frameworks/vue3-vite/package.json index 1edbfd6d70c..02c1b5c0916 100644 --- a/code/frameworks/vue3-vite/package.json +++ b/code/frameworks/vue3-vite/package.json @@ -55,7 +55,6 @@ "@storybook/builder-vite": "7.0.0-alpha.48", "@storybook/channel-postmessage": "7.0.0-alpha.48", "@storybook/channel-websocket": "7.0.0-alpha.48", - "@storybook/client-api": "7.0.0-alpha.48", "@storybook/core-server": "7.0.0-alpha.48", "@storybook/preview-api": "7.0.0-alpha.48", "@storybook/vue3": "7.0.0-alpha.48", diff --git a/code/frameworks/web-components-vite/package.json b/code/frameworks/web-components-vite/package.json index b51613d868c..f24758d0033 100644 --- a/code/frameworks/web-components-vite/package.json +++ b/code/frameworks/web-components-vite/package.json @@ -55,7 +55,6 @@ "@storybook/builder-vite": "7.0.0-alpha.48", "@storybook/channel-postmessage": "7.0.0-alpha.48", "@storybook/channel-websocket": "7.0.0-alpha.48", - "@storybook/client-api": "7.0.0-alpha.48", "@storybook/core-server": "7.0.0-alpha.48", "@storybook/node-logger": "7.0.0-alpha.48", "@storybook/preview-api": "7.0.0-alpha.48", From bf6943bec4d49bcf35940f86c7631818e0dd66ba Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Fri, 11 Nov 2022 15:36:24 +0100 Subject: [PATCH 27/47] fixes / cleanup --- code/frameworks/react-vite/src/index.ts | 3 +++ code/yarn.lock | 5 ----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/code/frameworks/react-vite/src/index.ts b/code/frameworks/react-vite/src/index.ts index 1aa9b0bb063..8b0346b167d 100644 --- a/code/frameworks/react-vite/src/index.ts +++ b/code/frameworks/react-vite/src/index.ts @@ -1,3 +1,6 @@ +// TODO: figure out if any of this is required +// possibly make it not required, framework should never be imported directly, except for types in config files + export { createChannel as createPostMessageChannel } from '@storybook/channel-postmessage'; export { createChannel as createWebSocketChannel } from '@storybook/channel-websocket'; diff --git a/code/yarn.lock b/code/yarn.lock index 4ac1da97de8..3dbfa3bf8d3 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -7295,7 +7295,6 @@ __metadata: "@storybook/builder-vite": 7.0.0-alpha.48 "@storybook/channel-postmessage": 7.0.0-alpha.48 "@storybook/channel-websocket": 7.0.0-alpha.48 - "@storybook/client-api": 7.0.0-alpha.48 "@storybook/preview-api": 7.0.0-alpha.48 "@storybook/react": 7.0.0-alpha.48 "@types/node": ^16.0.0 @@ -7753,7 +7752,6 @@ __metadata: "@storybook/builder-vite": 7.0.0-alpha.48 "@storybook/channel-postmessage": 7.0.0-alpha.48 "@storybook/channel-websocket": 7.0.0-alpha.48 - "@storybook/client-api": 7.0.0-alpha.48 "@storybook/node-logger": 7.0.0-alpha.48 "@storybook/preview-api": 7.0.0-alpha.48 "@storybook/svelte": 7.0.0-alpha.48 @@ -7912,7 +7910,6 @@ __metadata: "@storybook/builder-vite": 7.0.0-alpha.48 "@storybook/channel-postmessage": 7.0.0-alpha.48 "@storybook/channel-websocket": 7.0.0-alpha.48 - "@storybook/client-api": 7.0.0-alpha.48 "@storybook/core-common": 7.0.0-alpha.48 "@storybook/core-server": 7.0.0-alpha.48 "@storybook/preview-api": 7.0.0-alpha.48 @@ -7960,7 +7957,6 @@ __metadata: "@storybook/builder-vite": 7.0.0-alpha.48 "@storybook/channel-postmessage": 7.0.0-alpha.48 "@storybook/channel-websocket": 7.0.0-alpha.48 - "@storybook/client-api": 7.0.0-alpha.48 "@storybook/core-server": 7.0.0-alpha.48 "@storybook/preview-api": 7.0.0-alpha.48 "@storybook/vue3": 7.0.0-alpha.48 @@ -8060,7 +8056,6 @@ __metadata: "@storybook/builder-vite": 7.0.0-alpha.48 "@storybook/channel-postmessage": 7.0.0-alpha.48 "@storybook/channel-websocket": 7.0.0-alpha.48 - "@storybook/client-api": 7.0.0-alpha.48 "@storybook/core-server": 7.0.0-alpha.48 "@storybook/node-logger": 7.0.0-alpha.48 "@storybook/preview-api": 7.0.0-alpha.48 From 69ce0728435ed305fc3be40458ee96d9cb1f697b Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Mon, 14 Nov 2022 12:54:50 +0100 Subject: [PATCH 28/47] fixes --- code/lib/types/package.json | 2 +- code/yarn.lock | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/code/lib/types/package.json b/code/lib/types/package.json index 9c6ef1e3da5..b7b444a1515 100644 --- a/code/lib/types/package.json +++ b/code/lib/types/package.json @@ -41,7 +41,7 @@ }, "dependencies": { "@babel/core": "^7.12.10", - "@storybook/channels": "next", + "@storybook/channels": "7.0.0-alpha.49", "@types/babel__core": "^7.0.0", "@types/express": "^4.7.0", "express": "^4.17.1", diff --git a/code/yarn.lock b/code/yarn.lock index b30b67948b5..8abd7578ccf 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -6310,13 +6310,6 @@ __metadata: languageName: node linkType: hard -"@storybook/channels@npm:next": - version: 7.0.0-alpha.48 - resolution: "@storybook/channels@npm:7.0.0-alpha.48" - checksum: 6585f72c77a38e5ea6cce4500af19715ca5c4a689399a8d358f2795e9f57cbb7f93bc2e9e22a93dbaa7a9d4c0a984ae488b872bc27f429ddffe1099123f1e0d3 - languageName: node - linkType: hard - "@storybook/cli@7.0.0-alpha.49, @storybook/cli@workspace:*, @storybook/cli@workspace:lib/cli": version: 0.0.0-use.local resolution: "@storybook/cli@workspace:lib/cli" @@ -7894,7 +7887,7 @@ __metadata: resolution: "@storybook/types@workspace:lib/types" dependencies: "@babel/core": ^7.12.10 - "@storybook/channels": next + "@storybook/channels": 7.0.0-alpha.49 "@storybook/csf": 0.0.2-next.5 "@types/babel__core": ^7.0.0 "@types/express": ^4.7.0 From 4f1bc3b4477b096826edcc2f8c25a2576e336a6d Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Mon, 14 Nov 2022 13:02:38 +0100 Subject: [PATCH 29/47] cleanup --- .../lib/preview-api/src/modules/store/csf/testing-utils/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/code/lib/preview-api/src/modules/store/csf/testing-utils/index.ts b/code/lib/preview-api/src/modules/store/csf/testing-utils/index.ts index 4db39dba0c6..9097679f008 100644 --- a/code/lib/preview-api/src/modules/store/csf/testing-utils/index.ts +++ b/code/lib/preview-api/src/modules/store/csf/testing-utils/index.ts @@ -1,4 +1,3 @@ -import type { AnnotatedStoryFn } from '@storybook/csf'; import { isExportStory } from '@storybook/csf'; import type { Renderer, From 46af7bc7622a9ea5ee77862b476edfaa369a94d8 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Mon, 14 Nov 2022 19:05:38 +0100 Subject: [PATCH 30/47] fixes --- .../PreviewWeb.integration.test.ts | 3 -- .../modules/preview-web/PreviewWeb.test.ts | 29 ------------------- .../src/modules/store/StoryStore.test.ts | 1 - .../src/modules/store/decorators.test.ts | 1 - .../components/preview/preview.mockdata.tsx | 1 - code/yarn.lock | 13 +-------- 6 files changed, 1 insertion(+), 47 deletions(-) diff --git a/code/lib/preview-api/src/modules/preview-web/PreviewWeb.integration.test.ts b/code/lib/preview-api/src/modules/preview-web/PreviewWeb.integration.test.ts index 1347bc4ddf9..d72487a50d3 100644 --- a/code/lib/preview-api/src/modules/preview-web/PreviewWeb.integration.test.ts +++ b/code/lib/preview-api/src/modules/preview-web/PreviewWeb.integration.test.ts @@ -76,7 +76,6 @@ describe('PreviewWeb', () => { ({ storyFn }: Store_RenderContext) => storyFn() ); document.location.search = '?id=component-one--a'; - // @ts-expect-error (not strict) await new PreviewWeb().initialize({ importFn, getProjectAnnotations }); await waitForRender(); @@ -100,7 +99,6 @@ describe('PreviewWeb', () => { React.createElement('div', {}, 'INSIDE') ); - // @ts-expect-error (not strict) await preview.initialize({ importFn, getProjectAnnotations }); await waitForRender(); @@ -131,7 +129,6 @@ describe('PreviewWeb', () => { document.location.search = '?id=component-one--a'; const preview = new PreviewWeb(); - // @ts-expect-error (not strict) await preview.initialize({ importFn, getProjectAnnotations }); await waitForRender(); diff --git a/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts b/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts index 89c55c8cd14..44e3fd06ed2 100644 --- a/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts +++ b/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts @@ -106,7 +106,6 @@ async function waitForSetCurrentStory() { } async function createAndRenderPreview({ - // @ts-expect-error (not strict) importFn: inputImportFn = importFn, getProjectAnnotations: inputGetProjectAnnotations = getProjectAnnotations, }: { @@ -152,7 +151,6 @@ describe('PreviewWeb', () => { const preview = new PreviewWeb(); await expect( preview.initialize({ - // @ts-expect-error (not strict) importFn, getProjectAnnotations: () => { throw err; @@ -169,7 +167,6 @@ describe('PreviewWeb', () => { mockFetchResult = { status: 500, text: async () => err.toString() }; const preview = new PreviewWeb(); - // @ts-expect-error (not strict) await expect(preview.initialize({ importFn, getProjectAnnotations })).rejects.toThrow( 'sort error' ); @@ -240,7 +237,6 @@ describe('PreviewWeb', () => { it('allows async getProjectAnnotations', async () => { const preview = new PreviewWeb(); await preview.initialize({ - // @ts-expect-error (not strict) importFn, getProjectAnnotations: async () => { return getProjectAnnotations(); @@ -523,7 +519,6 @@ describe('PreviewWeb', () => { renderToCanvas: undefined, }); const preview = new PreviewWeb(); - // @ts-expect-error (not strict) await expect(preview.initialize({ importFn, getProjectAnnotations })).rejects.toThrow(); expect(preview.view.showErrorDisplay).toHaveBeenCalled(); @@ -637,7 +632,6 @@ describe('PreviewWeb', () => { }); const preview = new PreviewWeb(); - // @ts-expect-error (not strict) await preview.initialize({ importFn, getProjectAnnotations }); await waitForRender(); @@ -903,7 +897,6 @@ describe('PreviewWeb', () => { document.location.search = '?id=component-one--a'; componentOneExports.default.loaders[0].mockImplementationOnce(async () => gate); - // @ts-expect-error (not strict) await new PreviewWeb().initialize({ importFn, getProjectAnnotations }); await waitForRenderPhase('loading'); @@ -965,7 +958,6 @@ describe('PreviewWeb', () => { document.location.search = '?id=component-one--a'; projectAnnotations.renderToCanvas.mockImplementation(async () => gate); - // @ts-expect-error (not strict) await new PreviewWeb().initialize({ importFn, getProjectAnnotations }); await waitForRenderPhase('rendering'); @@ -1045,7 +1037,6 @@ describe('PreviewWeb', () => { }); document.location.search = '?id=component-one--a'; - // @ts-expect-error (not strict) await new PreviewWeb().initialize({ importFn, getProjectAnnotations }); await waitForRenderPhase('playing'); @@ -1434,7 +1425,6 @@ describe('PreviewWeb', () => { document.location.search = '?id=component-one--a'; projectAnnotations.renderToCanvas.mockImplementation(async () => gate); - // @ts-expect-error (not strict) await new PreviewWeb().initialize({ importFn, getProjectAnnotations }); await waitForRenderPhase('rendering'); @@ -1531,7 +1521,6 @@ describe('PreviewWeb', () => { it('still renders the selected story, once ready', async () => { document.location.search = ''; // We intentionally are *not* awaiting here - // @ts-expect-error (not strict) new PreviewWeb().initialize({ importFn, getProjectAnnotations }); emitter.emit(SET_CURRENT_STORY, { @@ -1642,7 +1631,6 @@ describe('PreviewWeb', () => { const preview = new PreviewWeb(); // We can't wait for the initialize function, as it waits for `renderSelection()` // which prepares, but it does emit `CURRENT_STORY_WAS_SET` right before that - // @ts-expect-error (not strict) preview.initialize({ importFn, getProjectAnnotations }); await waitForEvents([CURRENT_STORY_WAS_SET]); @@ -1692,7 +1680,6 @@ describe('PreviewWeb', () => { const preview = new PreviewWeb(); // We can't wait for the initialize function, as it waits for `renderSelection()` // which prepares, but it does emit `CURRENT_STORY_WAS_SET` right before that - // @ts-expect-error (not strict) preview.initialize({ importFn, getProjectAnnotations }); await waitForEvents([CURRENT_STORY_WAS_SET]); @@ -1741,7 +1728,6 @@ describe('PreviewWeb', () => { const preview = new PreviewWeb(); // We can't wait for the initialize function, as it waits for `renderSelection()` // which prepares, but it does emit `CURRENT_STORY_WAS_SET` right before that - // @ts-expect-error (not strict) preview.initialize({ importFn, getProjectAnnotations }); await waitForEvents([CURRENT_STORY_WAS_SET]); @@ -2050,7 +2036,6 @@ describe('PreviewWeb', () => { componentOneExports.default.loaders[0].mockImplementationOnce(async () => gate); document.location.search = '?id=component-one--a'; - // @ts-expect-error (not strict) await new PreviewWeb().initialize({ importFn, getProjectAnnotations }); await waitForRenderPhase('loading'); @@ -2084,7 +2069,6 @@ describe('PreviewWeb', () => { document.location.search = '?id=component-one--a'; projectAnnotations.renderToCanvas.mockImplementation(async () => gate); - // @ts-expect-error (not strict) await new PreviewWeb().initialize({ importFn, getProjectAnnotations }); await waitForRenderPhase('rendering'); @@ -2119,7 +2103,6 @@ describe('PreviewWeb', () => { componentOneExports.a.play.mockImplementationOnce(async () => gate); document.location.search = '?id=component-one--a'; - // @ts-expect-error (not strict) await new PreviewWeb().initialize({ importFn, getProjectAnnotations }); await waitForRenderPhase('playing'); @@ -2173,7 +2156,6 @@ describe('PreviewWeb', () => { componentOneExports.a.play.mockImplementationOnce(async () => gate); document.location.search = '?id=component-one--a'; - // @ts-expect-error (not strict) await new PreviewWeb().initialize({ importFn, getProjectAnnotations }); await waitForRenderPhase('playing'); @@ -2576,7 +2558,6 @@ describe('PreviewWeb', () => { mockFetchResult = { status: 500, text: async () => err.toString() }; const preview = new PreviewWeb(); - // @ts-expect-error (not strict) await expect(preview.initialize({ importFn, getProjectAnnotations })).rejects.toThrow( 'sort error' ); @@ -2597,7 +2578,6 @@ describe('PreviewWeb', () => { mockFetchResult = { status: 500, text: async () => err.toString() }; const preview = new PreviewWeb(); - // @ts-expect-error (not strict) await expect(preview.initialize({ importFn, getProjectAnnotations })).rejects.toThrow( 'sort error' ); @@ -3101,7 +3081,6 @@ describe('PreviewWeb', () => { await waitForEvents([STORY_MISSING]); mockChannel.emit.mockClear(); - // @ts-expect-error (not strict) preview.onStoriesChanged({ importFn, storyIndex }); await waitForRender(); expect(mockChannel.emit).toHaveBeenCalledWith(STORY_RENDERED, 'component-one--a'); @@ -3122,7 +3101,6 @@ describe('PreviewWeb', () => { mockChannel.emit.mockClear(); docsRenderer.render.mockClear(); - // @ts-expect-error (not strict) preview.onStoriesChanged({ importFn: newImportFn }); await waitForRender(); @@ -3142,7 +3120,6 @@ describe('PreviewWeb', () => { const preview = await createAndRenderPreview(); mockChannel.emit.mockClear(); - // @ts-expect-error (not strict) preview.onStoriesChanged({ importFn: newImportFn }); await waitForRender(); @@ -3160,7 +3137,6 @@ describe('PreviewWeb', () => { const preview = new PreviewWeb(); await expect( preview.initialize({ - // @ts-expect-error (not strict) importFn, getProjectAnnotations: () => { throw err; @@ -3181,7 +3157,6 @@ describe('PreviewWeb', () => { const preview = new PreviewWeb(); await expect( preview.initialize({ - // @ts-expect-error (not strict) importFn, getProjectAnnotations: () => { throw err; @@ -3354,7 +3329,6 @@ describe('PreviewWeb', () => { const [gate, openGate] = createGate(); componentOneExports.a.play.mockImplementationOnce(async () => gate); const preview = new PreviewWeb(); - // @ts-expect-error (not strict) await preview.initialize({ importFn, getProjectAnnotations }); await waitForRenderPhase('playing'); @@ -3410,7 +3384,6 @@ describe('PreviewWeb', () => { const preview = new PreviewWeb(); await expect( preview.initialize({ - // @ts-expect-error (not strict) importFn, getProjectAnnotations: () => { throw err; @@ -3426,7 +3399,6 @@ describe('PreviewWeb', () => { mockFetchResult = { status: 500, text: async () => err.toString() }; const preview = new PreviewWeb(); - // @ts-expect-error (not strict) await expect(preview.initialize({ importFn, getProjectAnnotations })).rejects.toThrow( 'sort error' ); @@ -3442,7 +3414,6 @@ describe('PreviewWeb', () => { return importFn(path); }; - // @ts-expect-error (not strict) const preview = await createAndRenderPreview({ importFn: gatedImportFn }); let extracted = false; diff --git a/code/lib/preview-api/src/modules/store/StoryStore.test.ts b/code/lib/preview-api/src/modules/store/StoryStore.test.ts index 561b3d05d55..f7eda61f324 100644 --- a/code/lib/preview-api/src/modules/store/StoryStore.test.ts +++ b/code/lib/preview-api/src/modules/store/StoryStore.test.ts @@ -634,7 +634,6 @@ describe('StoryStore', () => { v: 4, entries: { ...storyIndex.entries, - // @ts-expect-error (not strict) 'introduction--docs': { standalone: true, type: 'docs', diff --git a/code/lib/preview-api/src/modules/store/decorators.test.ts b/code/lib/preview-api/src/modules/store/decorators.test.ts index 6f0d0a58e41..44ae403e398 100644 --- a/code/lib/preview-api/src/modules/store/decorators.test.ts +++ b/code/lib/preview-api/src/modules/store/decorators.test.ts @@ -110,7 +110,6 @@ describe('client-api.decorators', () => { decoratedOne(makeContext({ value: 1 })); decoratedTwo(makeContext({ value: 2 })); - // @ts-expect-error (not defined) resolve(); await fence; diff --git a/code/ui/manager/src/components/preview/preview.mockdata.tsx b/code/ui/manager/src/components/preview/preview.mockdata.tsx index 1bd3a17f971..e0699aa5f8f 100644 --- a/code/ui/manager/src/components/preview/preview.mockdata.tsx +++ b/code/ui/manager/src/components/preview/preview.mockdata.tsx @@ -26,7 +26,6 @@ export const previewProps: PreviewProps = { entry: { tags: [], type: 'story', - tags: [], id: 'story--id', parent: 'root', depth: 1, diff --git a/code/yarn.lock b/code/yarn.lock index b7670f5b0c3..72b82cf1edb 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -9011,18 +9011,7 @@ __metadata: languageName: node linkType: hard -"@types/react@npm:*, @types/react@npm:>=16": - version: 18.0.25 - resolution: "@types/react@npm:18.0.25" - dependencies: - "@types/prop-types": "*" - "@types/scheduler": "*" - csstype: ^3.0.2 - checksum: 5d30dbf46124a63ee832864bf38ce42de2e8924dc53470f14742343503a2cf1851b6b4f8b892ef661e1a670561f4c9052d782e419d314912e54626f3296e49b6 - languageName: node - linkType: hard - -"@types/react@npm:^16, @types/react@npm:^16.14.23": +"@types/react@npm:*, @types/react@npm:>=16, @types/react@npm:^16, @types/react@npm:^16.14.23": version: 16.14.34 resolution: "@types/react@npm:16.14.34" dependencies: From 7342a44f08c04d4b72243099d7a5d4d36f999200 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Mon, 14 Nov 2022 19:32:43 +0100 Subject: [PATCH 31/47] cleanup workspace --- code/workspace.json | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/code/workspace.json b/code/workspace.json index d803911b371..61d9e2ee892 100644 --- a/code/workspace.json +++ b/code/workspace.json @@ -206,16 +206,6 @@ "root": "frameworks/ember", "type": "library" }, - "@storybook/example-doc-blocks": { - "implicitDependencies": [], - "root": "examples/doc-blocks", - "type": "library" - }, - "@storybook/external-docs": { - "implicitDependencies": [], - "root": "examples/external-docs", - "type": "library" - }, "@storybook/html": { "implicitDependencies": [], "root": "renderers/html", @@ -431,35 +421,15 @@ "root": "frameworks/web-components-webpack5", "type": "library" }, - "ember-example": { - "implicitDependencies": [], - "root": "examples/ember-cli", - "type": "library" - }, "sb": { "implicitDependencies": [], "root": "lib/cli-sb", "type": "library" }, - "server-kitchen-sink": { - "implicitDependencies": [], - "root": "examples/server-kitchen-sink", - "type": "library" - }, - "standalone-preview": { - "implicitDependencies": [], - "root": "examples/standalone-preview", - "type": "library" - }, "storybook": { "implicitDependencies": [], "root": "lib/cli-storybook", "type": "library" - }, - "vue-3-cli-example": { - "implicitDependencies": [], - "root": "examples/vue-3-cli", - "type": "library" } } } From 8f8290c607890c6d7fa983ed28c8f46513a590bd Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Fri, 18 Nov 2022 16:26:28 +0100 Subject: [PATCH 32/47] fixes --- .../src/modules/preview-web/render/StoryRender.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/code/lib/preview-api/src/modules/preview-web/render/StoryRender.test.ts b/code/lib/preview-api/src/modules/preview-web/render/StoryRender.test.ts index d61a46a02cf..589c6d805e3 100644 --- a/code/lib/preview-api/src/modules/preview-web/render/StoryRender.test.ts +++ b/code/lib/preview-api/src/modules/preview-web/render/StoryRender.test.ts @@ -36,7 +36,6 @@ describe('StoryRender', () => { const render = new StoryRender( new Channel(), mockStore as unknown as StoryStore, - // @ts-expect-error jest mock jest.fn(), {} as any, entry.id, From 464bf03cfd5e448e2535c6225eae5bfd253f6677 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Fri, 18 Nov 2022 16:35:38 +0100 Subject: [PATCH 33/47] cleanup --- .../src/modules/preview-web/PreviewWeb.test.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts b/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts index 92c983703a4..f0633a85d68 100644 --- a/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts +++ b/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts @@ -29,13 +29,7 @@ import { } from '@storybook/core-events'; import { logger } from '@storybook/client-logger'; import { addons, mockChannel as createMockChannel } from '@storybook/addons'; -import type { - DecoratorFunction, - Renderer, - Store_ModuleImportFn, - ProjectAnnotations, - WebRenderer, -} from '@storybook/types'; +import type { Renderer, Store_ModuleImportFn, ProjectAnnotations } from '@storybook/types'; import { PreviewWeb } from './PreviewWeb'; import { From 5e70b279d1a1aafbb5ea2b0582bcf2cf52be9d27 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Fri, 18 Nov 2022 16:55:12 +0100 Subject: [PATCH 34/47] fixes --- code/ui/.storybook/manager.ts | 2 +- docs/snippets/common/storybook-config-layout.js.mdx | 2 +- docs/snippets/common/storybook-manager-custom-theme.js.mdx | 2 +- docs/snippets/common/storybook-manager-dark-theme.js.mdx | 2 +- docs/snippets/common/storybook-manager-disable-roots.js.mdx | 2 +- .../common/storybook-manager-render-label-stories.js.mdx | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/code/ui/.storybook/manager.ts b/code/ui/.storybook/manager.ts index 76b9e19f9d7..ece01ccdfae 100644 --- a/code/ui/.storybook/manager.ts +++ b/code/ui/.storybook/manager.ts @@ -1,4 +1,4 @@ -import { addons } from '@storybook/preview-api'; +import { addons } from '@storybook/addons'; import startCase from 'lodash/startCase'; addons.setConfig({ diff --git a/docs/snippets/common/storybook-config-layout.js.mdx b/docs/snippets/common/storybook-config-layout.js.mdx index 73f69aa9334..c36446aebea 100644 --- a/docs/snippets/common/storybook-config-layout.js.mdx +++ b/docs/snippets/common/storybook-config-layout.js.mdx @@ -1,7 +1,7 @@ ```js // .storybook/manager.js -import { addons } from '@storybook/preview-api'; +import { addons } from '@storybook/addons'; addons.setConfig({ isFullscreen: false, diff --git a/docs/snippets/common/storybook-manager-custom-theme.js.mdx b/docs/snippets/common/storybook-manager-custom-theme.js.mdx index 861520ca04c..5affde34171 100644 --- a/docs/snippets/common/storybook-manager-custom-theme.js.mdx +++ b/docs/snippets/common/storybook-manager-custom-theme.js.mdx @@ -1,7 +1,7 @@ ```js // .storybook/manager.js -import { addons } from '@storybook/preview-api'; +import { addons } from '@storybook/addons'; import yourTheme from './YourTheme'; addons.setConfig({ diff --git a/docs/snippets/common/storybook-manager-dark-theme.js.mdx b/docs/snippets/common/storybook-manager-dark-theme.js.mdx index e09f80c059a..2f31e53b757 100644 --- a/docs/snippets/common/storybook-manager-dark-theme.js.mdx +++ b/docs/snippets/common/storybook-manager-dark-theme.js.mdx @@ -1,7 +1,7 @@ ```js // .storybook/manager.js -import { addons } from '@storybook/preview-api'; +import { addons } from '@storybook/addons'; import { themes } from '@storybook/theming'; addons.setConfig({ diff --git a/docs/snippets/common/storybook-manager-disable-roots.js.mdx b/docs/snippets/common/storybook-manager-disable-roots.js.mdx index 537e6b5a455..3297d85d7a1 100644 --- a/docs/snippets/common/storybook-manager-disable-roots.js.mdx +++ b/docs/snippets/common/storybook-manager-disable-roots.js.mdx @@ -1,7 +1,7 @@ ```js // ./storybook/manager.js -import { addons } from '@storybook/preview-api'; +import { addons } from '@storybook/addons'; addons.setConfig({ sidebar: { diff --git a/docs/snippets/common/storybook-manager-render-label-stories.js.mdx b/docs/snippets/common/storybook-manager-render-label-stories.js.mdx index aa763fee409..91538b41595 100644 --- a/docs/snippets/common/storybook-manager-render-label-stories.js.mdx +++ b/docs/snippets/common/storybook-manager-render-label-stories.js.mdx @@ -1,7 +1,7 @@ ```js // .storybook/manager.js -import { addons } from '@storybook/preview-api'; +import { addons } from '@storybook/addons'; import startCase from 'lodash/startCase'; From a0c6a4c3efdb8deaf9f5846b39bea38c5c4c75e7 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Fri, 18 Nov 2022 17:02:13 +0100 Subject: [PATCH 35/47] fix unit-tests --- code/lib/preview-api/jest.config.js | 7 +++++++ code/lib/preview-api/src/modules/core-client/start.test.ts | 4 ++++ .../src/modules/preview-web/PreviewWeb.integration.test.ts | 4 ++++ .../preview-api/src/modules/preview-web/PreviewWeb.test.ts | 5 ++++- .../src/modules/preview-web/simulate-pageload.test.ts | 4 ++++ code/lib/preview/jest.config.js | 7 +++++++ 6 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 code/lib/preview-api/jest.config.js create mode 100644 code/lib/preview/jest.config.js diff --git a/code/lib/preview-api/jest.config.js b/code/lib/preview-api/jest.config.js new file mode 100644 index 00000000000..343e4c7a7f3 --- /dev/null +++ b/code/lib/preview-api/jest.config.js @@ -0,0 +1,7 @@ +const path = require('path'); +const baseConfig = require('../../jest.config.node'); + +module.exports = { + ...baseConfig, + displayName: __dirname.split(path.sep).slice(-2).join(path.posix.sep), +}; diff --git a/code/lib/preview-api/src/modules/core-client/start.test.ts b/code/lib/preview-api/src/modules/core-client/start.test.ts index e7165ffdc34..2f34b348a7f 100644 --- a/code/lib/preview-api/src/modules/core-client/start.test.ts +++ b/code/lib/preview-api/src/modules/core-client/start.test.ts @@ -1,3 +1,7 @@ +/** + * @jest-environment jsdom + */ + /* global window */ import { STORY_RENDERED, STORY_UNCHANGED, SET_INDEX } from '@storybook/core-events'; diff --git a/code/lib/preview-api/src/modules/preview-web/PreviewWeb.integration.test.ts b/code/lib/preview-api/src/modules/preview-web/PreviewWeb.integration.test.ts index 60f2ab54126..ae4dc52f54a 100644 --- a/code/lib/preview-api/src/modules/preview-web/PreviewWeb.integration.test.ts +++ b/code/lib/preview-api/src/modules/preview-web/PreviewWeb.integration.test.ts @@ -1,3 +1,7 @@ +/** + * @jest-environment jsdom + */ + import React from 'react'; import global from 'global'; import type { Store_RenderContext } from '@storybook/types'; diff --git a/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts b/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts index f0633a85d68..46b651379fa 100644 --- a/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts +++ b/code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts @@ -1,4 +1,7 @@ -/// ; +/** + * @jest-environment jsdom + */ + import { jest, jest as mockJest, it, describe, beforeEach, afterEach, expect } from '@jest/globals'; import global from 'global'; import merge from 'lodash/merge'; diff --git a/code/lib/preview-api/src/modules/preview-web/simulate-pageload.test.ts b/code/lib/preview-api/src/modules/preview-web/simulate-pageload.test.ts index 9548dbbf262..12076059cee 100644 --- a/code/lib/preview-api/src/modules/preview-web/simulate-pageload.test.ts +++ b/code/lib/preview-api/src/modules/preview-web/simulate-pageload.test.ts @@ -1,3 +1,7 @@ +/** + * @jest-environment jsdom + */ + import global from 'global'; import { simulatePageLoad } from './simulate-pageload'; diff --git a/code/lib/preview/jest.config.js b/code/lib/preview/jest.config.js new file mode 100644 index 00000000000..343e4c7a7f3 --- /dev/null +++ b/code/lib/preview/jest.config.js @@ -0,0 +1,7 @@ +const path = require('path'); +const baseConfig = require('../../jest.config.node'); + +module.exports = { + ...baseConfig, + displayName: __dirname.split(path.sep).slice(-2).join(path.posix.sep), +}; From f1c0ce9c62ac653b964eb3ab3db9fb21fe479dd5 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 22 Nov 2022 16:51:42 +0100 Subject: [PATCH 36/47] fixes --- code/lib/preview/src/global/preview-api.ts | 108 ------------------ code/lib/preview/src/globals/exports.ts | 66 +++++++++-- code/lib/preview/src/globals/runtime.ts | 3 + code/lib/preview/src/globals/types.ts | 1 + .../preview/src/{ => modules}/preview-api.ts | 0 5 files changed, 63 insertions(+), 115 deletions(-) delete mode 100644 code/lib/preview/src/global/preview-api.ts rename code/lib/preview/src/{ => modules}/preview-api.ts (100%) diff --git a/code/lib/preview/src/global/preview-api.ts b/code/lib/preview/src/global/preview-api.ts deleted file mode 100644 index 8e768cc5fc7..00000000000 --- a/code/lib/preview/src/global/preview-api.ts +++ /dev/null @@ -1,108 +0,0 @@ -/* eslint-disable no-underscore-dangle */ -import type * as MODULE from '../preview-api'; - -const { - DocsContext, - Preview, - PreviewWeb, - composeConfigs, - simulateDOMContentLoaded, - 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, -} = (globalThis as any).__STORYBOOK_MODULE_PREVIEW_API__ as typeof MODULE; - -export { - DocsContext, - Preview, - PreviewWeb, - composeConfigs, - simulateDOMContentLoaded, - 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, -}; diff --git a/code/lib/preview/src/globals/exports.ts b/code/lib/preview/src/globals/exports.ts index 0d621b77e43..8e728bee236 100644 --- a/code/lib/preview/src/globals/exports.ts +++ b/code/lib/preview/src/globals/exports.ts @@ -29,6 +29,10 @@ export default { '@storybook/channels': ['Channel'], '@storybook/client-api': [ 'ClientApi', + 'DEEPLY_EQUAL', + 'HooksContext', + 'NO_TARGET_NAME', + 'StoryStore', 'addArgTypes', 'addArgTypesEnhancer', 'addArgs', @@ -37,13 +41,6 @@ export default { 'addLoader', 'addParameters', 'addStepRunner', - 'getQueryParam', - 'getQueryParams', - 'setGlobalRender', - 'DEEPLY_EQUAL', - 'HooksContext', - 'NO_TARGET_NAME', - 'StoryStore', 'applyHooks', 'combineArgs', 'combineParameters', @@ -58,6 +55,8 @@ export default { 'getArrayField', 'getField', 'getObjectField', + 'getQueryParam', + 'getQueryParams', 'getSingletonField', 'getValuesFromArgTypes', 'groupArgsByTarget', @@ -72,6 +71,7 @@ export default { 'prepareStory', 'processCSFFile', 'sanitizeStoryContextUpdate', + 'setGlobalRender', 'setProjectAnnotations', 'sortStoriesV6', 'sortStoriesV7', @@ -135,6 +135,58 @@ export default { 'UPDATE_QUERY_PARAMS', 'UPDATE_STORY_ARGS', ], + '@storybook/preview-api': [ + 'ClientApi', + 'DocsContext', + 'HooksContext', + 'Preview', + 'PreviewWeb', + 'StoryStore', + 'addArgTypes', + 'addArgTypesEnhancer', + 'addArgs', + 'addArgsEnhancer', + 'addDecorator', + 'addLoader', + 'addParameters', + 'addStepRunner', + 'addons', + 'applyHooks', + 'combineArgs', + 'combineParameters', + 'composeConfigs', + 'composeStepRunners', + 'composeStories', + 'composeStory', + 'decorateStory', + 'defaultDecorateStory', + 'filterArgTypes', + 'getQueryParam', + 'getQueryParams', + 'inferControls', + 'makeDecorator', + 'normalizeStory', + 'prepareStory', + 'sanitizeStoryContextUpdate', + 'setGlobalRender', + 'setProjectAnnotations', + 'simulateDOMContentLoaded', + 'simulatePageLoad', + 'sortStoriesV7', + 'start', + 'useArgs', + 'useCallback', + 'useChannel', + 'useEffect', + 'useGlobals', + 'useMemo', + 'useParameter', + 'useReducer', + 'useRef', + 'useState', + 'useStoryContext', + 'userOrAutoTitleFromSpecifier', + ], '@storybook/preview-web': [ 'DocsContext', 'Preview', diff --git a/code/lib/preview/src/globals/runtime.ts b/code/lib/preview/src/globals/runtime.ts index 360a7e63dd6..c9c9f630f6e 100644 --- a/code/lib/preview/src/globals/runtime.ts +++ b/code/lib/preview/src/globals/runtime.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/namespace */ import * as ADDONS from '../modules/addons'; import * as CHANNEL_POSTMESSAGE from '../modules/channel-postmessage'; import * as CHANNEL_WEBSOCKET from '../modules/channel-websocket'; @@ -6,6 +7,7 @@ import * as CLIENT_API from '../modules/client-api'; import * as CLIENT_LOGGER from '../modules/client-logger'; import * as CORE_CLIENT from '../modules/core-client'; import * as CORE_EVENTS from '../modules/core-events'; +import * as PREVIEW_API from '../modules/preview-api'; import * as PREVIEW_WEB from '../modules/preview-web'; import * as STORE from '../modules/store'; @@ -21,6 +23,7 @@ export const values: Required> = { '@storybook/client-logger': CLIENT_LOGGER, '@storybook/core-client': CORE_CLIENT, '@storybook/core-events': CORE_EVENTS, + '@storybook/preview-api': PREVIEW_API, '@storybook/preview-web': PREVIEW_WEB, '@storybook/store': STORE, }; diff --git a/code/lib/preview/src/globals/types.ts b/code/lib/preview/src/globals/types.ts index aa49fddc2cc..c38e9defff2 100644 --- a/code/lib/preview/src/globals/types.ts +++ b/code/lib/preview/src/globals/types.ts @@ -11,6 +11,7 @@ export enum Keys { '@storybook/core-client' = '__STORYBOOK_MODULE_CORE_CLIENT__', '@storybook/core-events' = '__STORYBOOK_MODULE_CORE_EVENTS__', '@storybook/preview-web' = '__STORYBOOK_MODULE_PREVIEW_WEB__', + '@storybook/preview-api' = '__STORYBOOK_MODULE_PREVIEW_API__', '@storybook/store' = '__STORYBOOK_MODULE_STORE__', } diff --git a/code/lib/preview/src/preview-api.ts b/code/lib/preview/src/modules/preview-api.ts similarity index 100% rename from code/lib/preview/src/preview-api.ts rename to code/lib/preview/src/modules/preview-api.ts From 6ef97f8da2723527162c9d03177a97a41cd7e06b Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 22 Nov 2022 23:37:31 +0100 Subject: [PATCH 37/47] fixes --- code/lib/builder-vite/src/optimizeDeps.ts | 1 + .../src/preview/iframe-webpack.config.ts | 1 + code/lib/core-server/package.json | 2 +- code/yarn.lock | 1043 +---------------- 4 files changed, 17 insertions(+), 1030 deletions(-) diff --git a/code/lib/builder-vite/src/optimizeDeps.ts b/code/lib/builder-vite/src/optimizeDeps.ts index 1dabd50885b..ac5daf80fc7 100644 --- a/code/lib/builder-vite/src/optimizeDeps.ts +++ b/code/lib/builder-vite/src/optimizeDeps.ts @@ -24,6 +24,7 @@ const INCLUDE_CANDIDATES = [ '@storybook/core/client', '@storybook/types', '@storybook/preview-api', + '@storybook/preview-api', '@storybook/preview-web', '@storybook/react > acorn-jsx', '@storybook/react', diff --git a/code/lib/builder-webpack5/src/preview/iframe-webpack.config.ts b/code/lib/builder-webpack5/src/preview/iframe-webpack.config.ts index 41056b78fe3..fed066b7d53 100644 --- a/code/lib/builder-webpack5/src/preview/iframe-webpack.config.ts +++ b/code/lib/builder-webpack5/src/preview/iframe-webpack.config.ts @@ -218,6 +218,7 @@ export default async ( 'addons', 'store', 'preview-web', + 'preview-api', 'client-api', 'core-client', ].reduce( diff --git a/code/lib/core-server/package.json b/code/lib/core-server/package.json index a0c391c3a90..92dd1a1c3db 100644 --- a/code/lib/core-server/package.json +++ b/code/lib/core-server/package.json @@ -40,7 +40,7 @@ "@storybook/core-events": "7.0.0-alpha.52", "@storybook/csf": "next", "@storybook/csf-tools": "7.0.0-alpha.52", - "@storybook/docs-mdx": "0.0.1-canary.12433cf.0", + "@storybook/docs-mdx": "next", "@storybook/node-logger": "7.0.0-alpha.52", "@storybook/preview-api": "7.0.0-alpha.52", "@storybook/telemetry": "7.0.0-alpha.52", diff --git a/code/yarn.lock b/code/yarn.lock index 07b444fb7d7..317027befa8 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -2130,7 +2130,7 @@ __metadata: languageName: node linkType: hard -"@babel/traverse@npm:^7.1.6, @babel/traverse@npm:^7.12.11, @babel/traverse@npm:^7.16.10, @babel/traverse@npm:^7.19.0, @babel/traverse@npm:^7.19.1, @babel/traverse@npm:^7.20.1, @babel/traverse@npm:^7.4.5, @babel/traverse@npm:^7.7.0, @babel/traverse@npm:^7.7.2, @babel/traverse@npm:^7.8.6": +"@babel/traverse@npm:^7.1.6, @babel/traverse@npm:^7.16.10, @babel/traverse@npm:^7.19.0, @babel/traverse@npm:^7.19.1, @babel/traverse@npm:^7.20.1, @babel/traverse@npm:^7.4.5, @babel/traverse@npm:^7.7.0, @babel/traverse@npm:^7.7.2, @babel/traverse@npm:^7.8.6": version: 7.20.1 resolution: "@babel/traverse@npm:7.20.1" dependencies: @@ -4252,31 +4252,6 @@ __metadata: languageName: node linkType: hard -"@mdx-js/mdx@npm:^2.0.0": - version: 2.1.5 - resolution: "@mdx-js/mdx@npm:2.1.5" - dependencies: - "@types/estree-jsx": ^1.0.0 - "@types/mdx": ^2.0.0 - estree-util-build-jsx: ^2.0.0 - estree-util-is-identifier-name: ^2.0.0 - estree-util-to-js: ^1.1.0 - estree-walker: ^3.0.0 - hast-util-to-estree: ^2.0.0 - markdown-extensions: ^1.0.0 - periscopic: ^3.0.0 - remark-mdx: ^2.0.0 - remark-parse: ^10.0.0 - remark-rehype: ^10.0.0 - unified: ^10.0.0 - unist-util-position-from-estree: ^1.0.0 - unist-util-stringify-position: ^3.0.0 - unist-util-visit: ^4.0.0 - vfile: ^5.0.0 - checksum: 364f70656038ea9f9281b867ca4ce9efa7c678621f489711cc293bdd253687704b68303101c2446b1bb6296adda99ef07f601e8278410399438ac8f1dc9311aa - languageName: node - linkType: hard - "@mdx-js/react@npm:^2.1.5": version: 2.1.5 resolution: "@mdx-js/react@npm:2.1.5" @@ -6280,7 +6255,7 @@ __metadata: "@storybook/core-events": 7.0.0-alpha.52 "@storybook/csf": next "@storybook/csf-tools": 7.0.0-alpha.52 - "@storybook/docs-mdx": 0.0.1-canary.12433cf.0 + "@storybook/docs-mdx": next "@storybook/node-logger": 7.0.0-alpha.52 "@storybook/preview-api": 7.0.0-alpha.52 "@storybook/telemetry": 7.0.0-alpha.52 @@ -6404,15 +6379,10 @@ __metadata: languageName: node linkType: hard -"@storybook/docs-mdx@npm:0.0.1-canary.12433cf.0": - version: 0.0.1-canary.12433cf.0 - resolution: "@storybook/docs-mdx@npm:0.0.1-canary.12433cf.0" - dependencies: - "@babel/traverse": ^7.12.11 - "@mdx-js/mdx": ^2.0.0 - estree-to-babel: ^4.9.0 - hast-util-to-estree: ^2.0.2 - checksum: 41ad8df3c898d0eea257ffee4c7a127625ebd95d7af01899b342562254e90c70e4c8f56ae32ad8171c72f1cc0503c8c5967c43fc9ef2b90eaee2506060db898c +"@storybook/docs-mdx@npm:next": + version: 0.0.1-next.4 + resolution: "@storybook/docs-mdx@npm:0.0.1-next.4" + checksum: 111cc2948feb94800b3b245689c6595049f8a0dcc7bcc17d33676cbb48759bee9470980224d8f4a9600c840ae908f2f95f44c79f1b53f4a41990344ab32be545 languageName: node linkType: hard @@ -8033,15 +8003,6 @@ __metadata: languageName: node linkType: hard -"@types/acorn@npm:^4.0.0": - version: 4.0.6 - resolution: "@types/acorn@npm:4.0.6" - dependencies: - "@types/estree": "*" - checksum: 5a65a1d7e91fc95703f0a717897be60fa7ccd34b17f5462056274a246e6690259fe0a1baabc86fd3260354f87245cb3dc483346d7faad2b78fc199763978ede9 - languageName: node - linkType: hard - "@types/aria-query@npm:^4.2.0": version: 4.2.2 resolution: "@types/aria-query@npm:4.2.2" @@ -8178,15 +8139,6 @@ __metadata: languageName: node linkType: hard -"@types/debug@npm:^4.0.0": - version: 4.1.7 - resolution: "@types/debug@npm:4.1.7" - dependencies: - "@types/ms": "*" - checksum: 742b752b60e14a752d9bf172e64f28e172f630b9933e763d2b54c7c8c1f33b99b1ef067d7312665a4d0539d8df7ea3eb664a8039f900e4b8234c647a569d123a - languageName: node - linkType: hard - "@types/detect-port@npm:^1.3.2": version: 1.3.2 resolution: "@types/detect-port@npm:1.3.2" @@ -8245,16 +8197,7 @@ __metadata: languageName: node linkType: hard -"@types/estree-jsx@npm:^1.0.0": - version: 1.0.0 - resolution: "@types/estree-jsx@npm:1.0.0" - dependencies: - "@types/estree": "*" - checksum: faca4c8924cbc36095e11ac7677dce1875583cf8ea99b67911affbbcc2a06ef99e585c02fc7160e55406d3c127b447df5a8ba3b23c211e5bbaad45dd278cde97 - languageName: node - linkType: hard - -"@types/estree@npm:*, @types/estree@npm:^1.0.0": +"@types/estree@npm:*": version: 1.0.0 resolution: "@types/estree@npm:1.0.0" checksum: 4e73ff606bf7c7ccdaa66092de650c410a4ad2ecc388fdbed8242cac9dbcad72407e1ceff041b7da691babb02ff74ab885d6231fb09368fdd1eabbf1b5253d49 @@ -8551,13 +8494,6 @@ __metadata: languageName: node linkType: hard -"@types/ms@npm:*": - version: 0.7.31 - resolution: "@types/ms@npm:0.7.31" - checksum: 19fae4f587651e8761c76a0c72ba8af1700d37054476878d164b758edcc926f4420ed06037a1a7fdddc1dbea25265895d743c8b2ea44f3f3f7ac06c449b9221e - languageName: node - linkType: hard - "@types/node-cleanup@npm:^2.1.1": version: 2.1.2 resolution: "@types/node-cleanup@npm:2.1.2" @@ -9942,7 +9878,7 @@ __metadata: languageName: node linkType: hard -"acorn-jsx@npm:^5.0.0, acorn-jsx@npm:^5.3.1, acorn-jsx@npm:^5.3.2": +"acorn-jsx@npm:^5.3.1, acorn-jsx@npm:^5.3.2": version: 5.3.2 resolution: "acorn-jsx@npm:5.3.2" peerDependencies: @@ -10001,7 +9937,7 @@ __metadata: languageName: node linkType: hard -"acorn@npm:^8.0.0, acorn@npm:^8.1.0, acorn@npm:^8.4.1, acorn@npm:^8.5.0, acorn@npm:^8.6.0, acorn@npm:^8.7.1, acorn@npm:^8.8.0, acorn@npm:^8.8.1": +"acorn@npm:^8.1.0, acorn@npm:^8.4.1, acorn@npm:^8.5.0, acorn@npm:^8.6.0, acorn@npm:^8.7.1, acorn@npm:^8.8.0, acorn@npm:^8.8.1": version: 8.8.1 resolution: "acorn@npm:8.8.1" bin: @@ -10777,15 +10713,6 @@ __metadata: languageName: node linkType: hard -"astring@npm:^1.8.0": - version: 1.8.3 - resolution: "astring@npm:1.8.3" - bin: - astring: bin/astring - checksum: 76e8233ad2586d31f19fac4cdaa5b2d82cb7419dd68d60f8b2641f0dd6dfe0302b2160dae910d5a8cc00e4a381eb4928b6553272f80078ac1ba186d270a745d4 - languageName: node - linkType: hard - "async-disk-cache@npm:^1.2.1": version: 1.3.5 resolution: "async-disk-cache@npm:1.3.5" @@ -11324,13 +11251,6 @@ __metadata: languageName: node linkType: hard -"bail@npm:^2.0.0": - version: 2.0.2 - resolution: "bail@npm:2.0.2" - checksum: 25cbea309ef6a1f56214187004e8f34014eb015713ea01fa5b9b7e9e776ca88d0fdffd64143ac42dc91966c915a4b7b683411b56e14929fad16153fc026ffb8b - languageName: node - linkType: hard - "balanced-match@npm:^1.0.0": version: 1.0.2 resolution: "balanced-match@npm:1.0.2" @@ -12341,13 +12261,6 @@ __metadata: languageName: node linkType: hard -"ccount@npm:^2.0.0": - version: 2.0.1 - resolution: "ccount@npm:2.0.1" - checksum: 3939b1664390174484322bc3f45b798462e6c07ee6384cb3d645e0aa2f318502d174845198c1561930e1d431087f74cf1fe291ae9a4722821a9f4ba67e574350 - languageName: node - linkType: hard - "chalk@npm:4.1.0": version: 4.1.0 resolution: "chalk@npm:4.1.0" @@ -12417,13 +12330,6 @@ __metadata: languageName: node linkType: hard -"character-entities-html4@npm:^2.0.0": - version: 2.1.0 - resolution: "character-entities-html4@npm:2.1.0" - checksum: fe61b553f083400c20c0b0fd65095df30a0b445d960f3bbf271536ae6c3ba676f39cb7af0b4bf2755812f08ab9b88f2feed68f9aebb73bb153f7a115fe5c6e40 - languageName: node - linkType: hard - "character-entities-legacy@npm:^1.0.0": version: 1.1.4 resolution: "character-entities-legacy@npm:1.1.4" @@ -12431,13 +12337,6 @@ __metadata: languageName: node linkType: hard -"character-entities-legacy@npm:^3.0.0": - version: 3.0.0 - resolution: "character-entities-legacy@npm:3.0.0" - checksum: ec4b430af873661aa754a896a2b55af089b4e938d3d010fad5219299a6b6d32ab175142699ee250640678cd64bdecd6db3c9af0b8759ab7b155d970d84c4c7d1 - languageName: node - linkType: hard - "character-entities@npm:^1.0.0": version: 1.2.4 resolution: "character-entities@npm:1.2.4" @@ -12445,13 +12344,6 @@ __metadata: languageName: node linkType: hard -"character-entities@npm:^2.0.0": - version: 2.0.2 - resolution: "character-entities@npm:2.0.2" - checksum: b0c645a45bcc90ff24f0e0140f4875a8436b8ef13b6bcd31ec02cfb2ca502b680362aa95386f7815bdc04b6464d48cf191210b3840d7c04241a149ede591a308 - languageName: node - linkType: hard - "character-parser@npm:^2.2.0": version: 2.2.0 resolution: "character-parser@npm:2.2.0" @@ -12468,13 +12360,6 @@ __metadata: languageName: node linkType: hard -"character-reference-invalid@npm:^2.0.0": - version: 2.0.1 - resolution: "character-reference-invalid@npm:2.0.1" - checksum: 2ae0dec770cd8659d7e8b0ce24392d83b4c2f0eb4a3395c955dce5528edd4cc030a794cfa06600fcdd700b3f2de2f9b8e40e309c0011c4180e3be64a0b42e6a1 - languageName: node - linkType: hard - "chardet@npm:^0.7.0": version: 0.7.0 resolution: "chardet@npm:0.7.0" @@ -12944,13 +12829,6 @@ __metadata: languageName: node linkType: hard -"comma-separated-tokens@npm:^2.0.0": - version: 2.0.3 - resolution: "comma-separated-tokens@npm:2.0.3" - checksum: 91f90f1aae320f1755d6957ef0b864fe4f54737f3313bd95e0802686ee2ca38bff1dd381964d00ae5db42912dd1f4ae5c2709644e82706ffc6f6842a813cdd67 - languageName: node - linkType: hard - "commander@npm:3.0.2": version: 3.0.2 resolution: "commander@npm:3.0.2" @@ -14055,15 +13933,6 @@ __metadata: languageName: node linkType: hard -"decode-named-character-reference@npm:^1.0.0": - version: 1.0.2 - resolution: "decode-named-character-reference@npm:1.0.2" - dependencies: - character-entities: ^2.0.0 - checksum: 66a9fc5d9b5385a2b3675c69ba0d8e893393d64057f7dbbb585265bb4fc05ec513d76943b8e5aac7d8016d20eea4499322cbf4cd6d54b466976b78f3a7587a4c - languageName: node - linkType: hard - "decode-uri-component@npm:^0.2.0": version: 0.2.0 resolution: "decode-uri-component@npm:0.2.0" @@ -14314,7 +14183,7 @@ __metadata: languageName: node linkType: hard -"dequal@npm:^2.0.0, dequal@npm:^2.0.2": +"dequal@npm:^2.0.2": version: 2.0.3 resolution: "dequal@npm:2.0.3" checksum: f98860cdf58b64991ae10205137c0e97d384c3a4edc7f807603887b7c4b850af1224a33d88012009f150861cbee4fa2d322c4cc04b9313bee312e47f6ecaa888 @@ -14430,13 +14299,6 @@ __metadata: languageName: node linkType: hard -"diff@npm:^5.0.0": - version: 5.1.0 - resolution: "diff@npm:5.1.0" - checksum: 77a0d9beb9ed54796154ac2511872288432124ac90a1cabb1878783c9b4d81f1847f3b746a0630b1e836181461d2c76e1e6b95559bef86ed16294d114862e364 - languageName: node - linkType: hard - "diffable-html@npm:^4.1.0": version: 4.1.0 resolution: "diffable-html@npm:4.1.0" @@ -16432,64 +16294,6 @@ __metadata: languageName: node linkType: hard -"estree-to-babel@npm:^4.9.0": - version: 4.9.0 - resolution: "estree-to-babel@npm:4.9.0" - dependencies: - "@babel/traverse": ^7.1.6 - "@babel/types": ^7.2.0 - checksum: b0e396ac7cb19d1fc8c943492b7d5b6584cf89afa6fa947b9185cbee1a313528448bcb0d8a2e04ad110b5eaad20de9f92a28c01137fcf9e3515285b08a52aaef - languageName: node - linkType: hard - -"estree-util-attach-comments@npm:^2.0.0": - version: 2.1.0 - resolution: "estree-util-attach-comments@npm:2.1.0" - dependencies: - "@types/estree": ^1.0.0 - checksum: 168dc114faf40077f5deaa3cc19e8ed2b0e11f257b952a2f1416161c42f2b94735bcf2bdf478985c2f09f790a0f9c82a8a2b49dfd4743197d5b5d89e4aed902c - languageName: node - linkType: hard - -"estree-util-build-jsx@npm:^2.0.0": - version: 2.2.0 - resolution: "estree-util-build-jsx@npm:2.2.0" - dependencies: - "@types/estree-jsx": ^1.0.0 - estree-util-is-identifier-name: ^2.0.0 - estree-walker: ^3.0.0 - checksum: 99dccb857132519001e9fa71e059f2fab6d43b8bebe10f5955da68e2cb0dcac49722091a8638ae8f3af592b4020696a9c440bbab3b5a1ac547cde3fe6d2c2d8b - languageName: node - linkType: hard - -"estree-util-is-identifier-name@npm:^2.0.0": - version: 2.0.1 - resolution: "estree-util-is-identifier-name@npm:2.0.1" - checksum: bf011a97fdc558fd9a2526bda7d6849e9626741b0771fc25a14aa45b9b7f4ef4313189be2555300185bda2874e8d6b5167aabdceda77b57ef82149f2a8ef2aa7 - languageName: node - linkType: hard - -"estree-util-to-js@npm:^1.1.0": - version: 1.1.0 - resolution: "estree-util-to-js@npm:1.1.0" - dependencies: - "@types/estree-jsx": ^1.0.0 - astring: ^1.8.0 - source-map: ^0.7.0 - checksum: be9b1cc609f1d3dc060bbf1ee0162323a1959996919dceedf1235d2dea290d57c3eb349c92d5d84dc91875ce01931f255a735a5847a57c341871a3b482e908aa - languageName: node - linkType: hard - -"estree-util-visit@npm:^1.0.0": - version: 1.2.0 - resolution: "estree-util-visit@npm:1.2.0" - dependencies: - "@types/estree-jsx": ^1.0.0 - "@types/unist": ^2.0.0 - checksum: c0c2331d31ea3eebebc85eea4e556f5ca1bcced1d1005e07b771c9b60e0b93b3c9a7cff28a3c5d9a72eefd4a003ac1fb062bfd71b79992bc261475235bd17518 - languageName: node - linkType: hard - "estree-walker@npm:^2.0.1, estree-walker@npm:^2.0.2": version: 2.0.2 resolution: "estree-walker@npm:2.0.2" @@ -16497,13 +16301,6 @@ __metadata: languageName: node linkType: hard -"estree-walker@npm:^3.0.0": - version: 3.0.1 - resolution: "estree-walker@npm:3.0.1" - checksum: e5a1d45eb83df0e61b11450a1107d9604694b696ee5a54b26ad24449cce4f75614de9efdb9a4a16421c629c9bd241feaa79076ad273d7efa391fd91299f64a9e - languageName: node - linkType: hard - "esutils@npm:^2.0.2": version: 2.0.3 resolution: "esutils@npm:2.0.3" @@ -18770,36 +18567,6 @@ __metadata: languageName: node linkType: hard -"hast-util-to-estree@npm:^2.0.0, hast-util-to-estree@npm:^2.0.2": - version: 2.1.0 - resolution: "hast-util-to-estree@npm:2.1.0" - dependencies: - "@types/estree": ^1.0.0 - "@types/estree-jsx": ^1.0.0 - "@types/hast": ^2.0.0 - "@types/unist": ^2.0.0 - comma-separated-tokens: ^2.0.0 - estree-util-attach-comments: ^2.0.0 - estree-util-is-identifier-name: ^2.0.0 - hast-util-whitespace: ^2.0.0 - mdast-util-mdx-expression: ^1.0.0 - mdast-util-mdxjs-esm: ^1.0.0 - property-information: ^6.0.0 - space-separated-tokens: ^2.0.0 - style-to-object: ^0.3.0 - unist-util-position: ^4.0.0 - zwitch: ^2.0.0 - checksum: 23bff70dd554b2ba29d6c4933621655c5345168c68a6600819c67279316fb1356d8580744d609f2ccbc6ee5d3d6fdedf719b913e112f66b65fe3ccf597d56b92 - languageName: node - linkType: hard - -"hast-util-whitespace@npm:^2.0.0": - version: 2.0.0 - resolution: "hast-util-whitespace@npm:2.0.0" - checksum: 73eb60b5171815461e248a0190af9780a95034f4d95ae2271aa75ac58da505ed84f6493e63538bea3745cd73f0069c524d76fd31701deb41b94600bf2d1b44a8 - languageName: node - linkType: hard - "hastscript@npm:^6.0.0": version: 6.0.0 resolution: "hastscript@npm:6.0.0" @@ -19715,13 +19482,6 @@ __metadata: languageName: node linkType: hard -"inline-style-parser@npm:0.1.1": - version: 0.1.1 - resolution: "inline-style-parser@npm:0.1.1" - checksum: 08832a533f51a1e17619f2eabf2f5ec5e956d6dcba1896351285c65df022c9420de61d73256e1dca8015a52abf96cc84ddc3b73b898b22de6589d3962b5e501b - languageName: node - linkType: hard - "inquirer@npm:8.2.0": version: 8.2.0 resolution: "inquirer@npm:8.2.0" @@ -19873,13 +19633,6 @@ __metadata: languageName: node linkType: hard -"is-alphabetical@npm:^2.0.0": - version: 2.0.1 - resolution: "is-alphabetical@npm:2.0.1" - checksum: 932367456f17237533fd1fc9fe179df77957271020b83ea31da50e5cc472d35ef6b5fb8147453274ffd251134472ce24eb6f8d8398d96dee98237cdb81a6c9a7 - languageName: node - linkType: hard - "is-alphanumeric@npm:^1.0.0": version: 1.0.0 resolution: "is-alphanumeric@npm:1.0.0" @@ -19897,16 +19650,6 @@ __metadata: languageName: node linkType: hard -"is-alphanumerical@npm:^2.0.0": - version: 2.0.1 - resolution: "is-alphanumerical@npm:2.0.1" - dependencies: - is-alphabetical: ^2.0.0 - is-decimal: ^2.0.0 - checksum: 4b35c42b18e40d41378293f82a3ecd9de77049b476f748db5697c297f686e1e05b072a6aaae2d16f54d2a57f85b00cbbe755c75f6d583d1c77d6657bd0feb5a2 - languageName: node - linkType: hard - "is-arguments@npm:^1.0.4, is-arguments@npm:^1.1.0, is-arguments@npm:^1.1.1": version: 1.1.1 resolution: "is-arguments@npm:1.1.1" @@ -20038,13 +19781,6 @@ __metadata: languageName: node linkType: hard -"is-decimal@npm:^2.0.0": - version: 2.0.1 - resolution: "is-decimal@npm:2.0.1" - checksum: 8085dd66f7d82f9de818fba48b9e9c0429cb4291824e6c5f2622e96b9680b54a07a624cfc663b24148b8e853c62a1c987cfe8b0b5a13f5156991afaf6736e334 - languageName: node - linkType: hard - "is-descriptor@npm:^0.1.0": version: 0.1.6 resolution: "is-descriptor@npm:0.1.6" @@ -20201,13 +19937,6 @@ __metadata: languageName: node linkType: hard -"is-hexadecimal@npm:^2.0.0": - version: 2.0.1 - resolution: "is-hexadecimal@npm:2.0.1" - checksum: 3eb60fe2f1e2bbc760b927dcad4d51eaa0c60138cf7fc671803f66353ad90c301605b502c7ea4c6bb0548e1c7e79dfd37b73b632652e3b76030bba603a7e9626 - languageName: node - linkType: hard - "is-installed-globally@npm:^0.4.0": version: 0.4.0 resolution: "is-installed-globally@npm:0.4.0" @@ -20327,13 +20056,6 @@ __metadata: languageName: node linkType: hard -"is-plain-obj@npm:^4.0.0": - version: 4.1.0 - resolution: "is-plain-obj@npm:4.1.0" - checksum: 32130d651d71d9564dc88ba7e6fda0e91a1010a3694648e9f4f47bb6080438140696d3e3e15c741411d712e47ac9edc1a8a9de1fe76f3487b0d90be06ac9975e - languageName: node - linkType: hard - "is-plain-object@npm:5.0.0, is-plain-object@npm:^5.0.0": version: 5.0.0 resolution: "is-plain-object@npm:5.0.0" @@ -20364,15 +20086,6 @@ __metadata: languageName: node linkType: hard -"is-reference@npm:^3.0.0": - version: 3.0.0 - resolution: "is-reference@npm:3.0.0" - dependencies: - "@types/estree": "*" - checksum: a61aa6e659d926af73afb0ba13438fc2ac92fdb8b89a6fae9069ddb3fc0da017fe082f492da6ac8790e17499f5fed2b996e6729cfdd6d8a55cdb23973fb5ebb5 - languageName: node - linkType: hard - "is-regex@npm:^1.0.3, is-regex@npm:^1.0.4, is-regex@npm:^1.0.5, is-regex@npm:^1.1.0, is-regex@npm:^1.1.2, is-regex@npm:^1.1.4": version: 1.1.4 resolution: "is-regex@npm:1.1.4" @@ -22377,7 +22090,7 @@ __metadata: languageName: node linkType: hard -"kleur@npm:^4.0.3, kleur@npm:^4.1.5": +"kleur@npm:^4.1.5": version: 4.1.5 resolution: "kleur@npm:4.1.5" checksum: e9de6cb49657b6fa70ba2d1448fd3d691a5c4370d8f7bbf1c2f64c24d461270f2117e1b0afe8cb3114f13bbd8e51de158c2a224953960331904e636a5e4c0f2a @@ -23189,13 +22902,6 @@ __metadata: languageName: node linkType: hard -"longest-streak@npm:^3.0.0": - version: 3.1.0 - resolution: "longest-streak@npm:3.1.0" - checksum: 7c2f02d0454b52834d1bcedef79c557bd295ee71fdabb02d041ff3aa9da48a90b5df7c0409156dedbc4df9b65da18742652aaea4759d6ece01f08971af6a7eaa - languageName: node - linkType: hard - "loose-envify@npm:^1.0.0, loose-envify@npm:^1.1.0, loose-envify@npm:^1.4.0": version: 1.4.0 resolution: "loose-envify@npm:1.4.0" @@ -23529,7 +23235,7 @@ __metadata: languageName: node linkType: hard -"markdown-extensions@npm:^1.0.0, markdown-extensions@npm:^1.1.0": +"markdown-extensions@npm:^1.1.0": version: 1.1.1 resolution: "markdown-extensions@npm:1.1.1" checksum: eb9154016502ad1fb4477683ddb5cae8ba3ca06451b381b04dc4c34e91d8d168129d50d404b717d6bf7d458e13088c109303fc72d57cee7151a6082b0e7bba71 @@ -23625,17 +23331,6 @@ __metadata: languageName: node linkType: hard -"mdast-util-definitions@npm:^5.0.0": - version: 5.1.1 - resolution: "mdast-util-definitions@npm:5.1.1" - dependencies: - "@types/mdast": ^3.0.0 - "@types/unist": ^2.0.0 - unist-util-visit: ^4.0.0 - checksum: ae70dd500f3dc2d39941344937a56a865ab3b413ca3181309d42cb6b22381924a03dd4702707fc0c3d1aa2ae1bf6e3d5c818af7867c31f593bfb86ca242f0a36 - languageName: node - linkType: hard - "mdast-util-from-markdown@npm:^0.8.0": version: 0.8.5 resolution: "mdast-util-from-markdown@npm:0.8.5" @@ -23649,26 +23344,6 @@ __metadata: languageName: node linkType: hard -"mdast-util-from-markdown@npm:^1.0.0": - version: 1.2.0 - resolution: "mdast-util-from-markdown@npm:1.2.0" - dependencies: - "@types/mdast": ^3.0.0 - "@types/unist": ^2.0.0 - decode-named-character-reference: ^1.0.0 - mdast-util-to-string: ^3.1.0 - micromark: ^3.0.0 - micromark-util-decode-numeric-character-reference: ^1.0.0 - micromark-util-decode-string: ^1.0.0 - micromark-util-normalize-identifier: ^1.0.0 - micromark-util-symbol: ^1.0.0 - micromark-util-types: ^1.0.0 - unist-util-stringify-position: ^3.0.0 - uvu: ^0.5.0 - checksum: f5b295b39edc4eca0894ca8b9aa51e9bf267889b642915fc35a4cda47c177263fcdd9caad844739c68729b640e628160a91792cbbbe80cfbfd91e31ab16a0096 - languageName: node - linkType: hard - "mdast-util-heading-style@npm:^1.0.2": version: 1.0.6 resolution: "mdast-util-heading-style@npm:1.0.6" @@ -23676,78 +23351,6 @@ __metadata: languageName: node linkType: hard -"mdast-util-mdx-expression@npm:^1.0.0": - version: 1.3.1 - resolution: "mdast-util-mdx-expression@npm:1.3.1" - dependencies: - "@types/estree-jsx": ^1.0.0 - "@types/hast": ^2.0.0 - "@types/mdast": ^3.0.0 - mdast-util-from-markdown: ^1.0.0 - mdast-util-to-markdown: ^1.0.0 - checksum: f2cba7b8081a4bee8dc8e96230557ba69ff51a4d8082042babbcf133538f90b09e6875f343b97f1d275ae8204dd035dfd4fe495dfa8497c5dd5d651a69cc63b0 - languageName: node - linkType: hard - -"mdast-util-mdx-jsx@npm:^2.0.0": - version: 2.1.0 - resolution: "mdast-util-mdx-jsx@npm:2.1.0" - dependencies: - "@types/estree-jsx": ^1.0.0 - "@types/hast": ^2.0.0 - "@types/mdast": ^3.0.0 - ccount: ^2.0.0 - mdast-util-to-markdown: ^1.3.0 - parse-entities: ^4.0.0 - stringify-entities: ^4.0.0 - unist-util-remove-position: ^4.0.0 - unist-util-stringify-position: ^3.0.0 - vfile-message: ^3.0.0 - checksum: a6e152a6f3f45e149a4a0047636691e5389c4e7e855503869e1c204e297a201175732b33b816f756d35394463c712af11e33a10e6ee9082115b57c6a931d62e7 - languageName: node - linkType: hard - -"mdast-util-mdx@npm:^2.0.0": - version: 2.0.0 - resolution: "mdast-util-mdx@npm:2.0.0" - dependencies: - mdast-util-mdx-expression: ^1.0.0 - mdast-util-mdx-jsx: ^2.0.0 - mdast-util-mdxjs-esm: ^1.0.0 - checksum: 40c40345a70b1a16afef4aff159ee4a13afe69d2a72a32098868e145ea8a08d406871ee24564dfb3a57552e1c79e78a03d117a9ed9d7c3a4149c8fa5b79bd489 - languageName: node - linkType: hard - -"mdast-util-mdxjs-esm@npm:^1.0.0": - version: 1.3.0 - resolution: "mdast-util-mdxjs-esm@npm:1.3.0" - dependencies: - "@types/estree-jsx": ^1.0.0 - "@types/hast": ^2.0.0 - "@types/mdast": ^3.0.0 - mdast-util-from-markdown: ^1.0.0 - mdast-util-to-markdown: ^1.0.0 - checksum: 55ca3f7fd7b65445107fae2e2c4c539de385ef9db3e0708e8eba5925274523bbeb9883d62e4886f8c68bf78ef3ed122c893eb292095bb8e76b07712d0f73ed22 - languageName: node - linkType: hard - -"mdast-util-to-hast@npm:^12.1.0": - version: 12.2.4 - resolution: "mdast-util-to-hast@npm:12.2.4" - dependencies: - "@types/hast": ^2.0.0 - "@types/mdast": ^3.0.0 - mdast-util-definitions: ^5.0.0 - micromark-util-sanitize-uri: ^1.1.0 - trim-lines: ^3.0.0 - unist-builder: ^3.0.0 - unist-util-generated: ^2.0.0 - unist-util-position: ^4.0.0 - unist-util-visit: ^4.0.0 - checksum: e888f3b894b7cb22eea31940c16bd7d8efe1aa5ed2b3f4e079c8e4edc8b1bf7904f3c8037ec89c561f5b967640337b2c387a60ea2624d8c6cc4b21b5fd95b7e7 - languageName: node - linkType: hard - "mdast-util-to-markdown@npm:^0.6.0": version: 0.6.5 resolution: "mdast-util-to-markdown@npm:0.6.5" @@ -23762,21 +23365,6 @@ __metadata: languageName: node linkType: hard -"mdast-util-to-markdown@npm:^1.0.0, mdast-util-to-markdown@npm:^1.3.0": - version: 1.3.0 - resolution: "mdast-util-to-markdown@npm:1.3.0" - dependencies: - "@types/mdast": ^3.0.0 - "@types/unist": ^2.0.0 - longest-streak: ^3.0.0 - mdast-util-to-string: ^3.0.0 - micromark-util-decode-string: ^1.0.0 - unist-util-visit: ^4.0.0 - zwitch: ^2.0.0 - checksum: 1073dc3f474097616a4bc0c2f22d8782685bbebf37a9c77b4183c979d29bd788688e8a2946df58c2a172df51d3b5b6184513f23011db6e796c6ffda8cc0c95d4 - languageName: node - linkType: hard - "mdast-util-to-string@npm:^1.0.0, mdast-util-to-string@npm:^1.0.2": version: 1.1.0 resolution: "mdast-util-to-string@npm:1.1.0" @@ -23791,13 +23379,6 @@ __metadata: languageName: node linkType: hard -"mdast-util-to-string@npm:^3.0.0, mdast-util-to-string@npm:^3.1.0": - version: 3.1.0 - resolution: "mdast-util-to-string@npm:3.1.0" - checksum: ce329d5da6038fbeaee26873c3ae8b269bfbfc39cd6cf42799ecff21030d6c5853a1013d053c60ed25baf0f03723e77019149ad3cad1c764e3bbd49379fbaba7 - languageName: node - linkType: hard - "mdn-data@npm:2.0.28": version: 2.0.28 resolution: "mdn-data@npm:2.0.28" @@ -23958,347 +23539,6 @@ __metadata: languageName: node linkType: hard -"micromark-core-commonmark@npm:^1.0.0, micromark-core-commonmark@npm:^1.0.1": - version: 1.0.6 - resolution: "micromark-core-commonmark@npm:1.0.6" - dependencies: - decode-named-character-reference: ^1.0.0 - micromark-factory-destination: ^1.0.0 - micromark-factory-label: ^1.0.0 - micromark-factory-space: ^1.0.0 - micromark-factory-title: ^1.0.0 - micromark-factory-whitespace: ^1.0.0 - micromark-util-character: ^1.0.0 - micromark-util-chunked: ^1.0.0 - micromark-util-classify-character: ^1.0.0 - micromark-util-html-tag-name: ^1.0.0 - micromark-util-normalize-identifier: ^1.0.0 - micromark-util-resolve-all: ^1.0.0 - micromark-util-subtokenize: ^1.0.0 - micromark-util-symbol: ^1.0.0 - micromark-util-types: ^1.0.1 - uvu: ^0.5.0 - checksum: 6241047732fe258083fdb7bd764e20bf2a37ab02e233c98d88eac527d2ca18f69b667ec3315faf4ef33a99141259522b1b7cc75fc51f20568c302d74ee86bc2a - languageName: node - linkType: hard - -"micromark-extension-mdx-expression@npm:^1.0.0": - version: 1.0.3 - resolution: "micromark-extension-mdx-expression@npm:1.0.3" - dependencies: - micromark-factory-mdx-expression: ^1.0.0 - micromark-factory-space: ^1.0.0 - micromark-util-character: ^1.0.0 - micromark-util-events-to-acorn: ^1.0.0 - micromark-util-symbol: ^1.0.0 - micromark-util-types: ^1.0.0 - uvu: ^0.5.0 - checksum: 0a79adc1a5396bb1c23d734654f1ec15f074ca006aad0c1c146f05d0a29fd3f2625833764803d9c4b46797f807b15fd1f6a4c4375f06c538e3c531424ec895e5 - languageName: node - linkType: hard - -"micromark-extension-mdx-jsx@npm:^1.0.0": - version: 1.0.3 - resolution: "micromark-extension-mdx-jsx@npm:1.0.3" - dependencies: - "@types/acorn": ^4.0.0 - estree-util-is-identifier-name: ^2.0.0 - micromark-factory-mdx-expression: ^1.0.0 - micromark-factory-space: ^1.0.0 - micromark-util-character: ^1.0.0 - micromark-util-symbol: ^1.0.0 - micromark-util-types: ^1.0.0 - uvu: ^0.5.0 - vfile-message: ^3.0.0 - checksum: 94b606efabb5f62819d05b2e6db09c4735f6e12a9681e7e91ba20beeaf80388e019785159c2a520ba327d593ecb95e96c569b5987629f71f8bf89d7317f97b36 - languageName: node - linkType: hard - -"micromark-extension-mdx-md@npm:^1.0.0": - version: 1.0.0 - resolution: "micromark-extension-mdx-md@npm:1.0.0" - dependencies: - micromark-util-types: ^1.0.0 - checksum: e6362cfd9eed003bfea0dc8a9ec91c222586934461656c50a33aa2efea4e80291eed06e97e77c8cde5007a33f43948aa305dd2178798083e1f77b05f5e80b82c - languageName: node - linkType: hard - -"micromark-extension-mdxjs-esm@npm:^1.0.0": - version: 1.0.3 - resolution: "micromark-extension-mdxjs-esm@npm:1.0.3" - dependencies: - micromark-core-commonmark: ^1.0.0 - micromark-util-character: ^1.0.0 - micromark-util-events-to-acorn: ^1.0.0 - micromark-util-symbol: ^1.0.0 - micromark-util-types: ^1.0.0 - unist-util-position-from-estree: ^1.1.0 - uvu: ^0.5.0 - vfile-message: ^3.0.0 - checksum: 28ffebc7dd4cbcc2359a0ab6e12e201db44589a87e12f2dd60209d2fc895cfb932346a71b466c0ef8f9cd8e136d8ec9582c6902654e4c36cef3f5a13cea48a58 - languageName: node - linkType: hard - -"micromark-extension-mdxjs@npm:^1.0.0": - version: 1.0.0 - resolution: "micromark-extension-mdxjs@npm:1.0.0" - dependencies: - acorn: ^8.0.0 - acorn-jsx: ^5.0.0 - micromark-extension-mdx-expression: ^1.0.0 - micromark-extension-mdx-jsx: ^1.0.0 - micromark-extension-mdx-md: ^1.0.0 - micromark-extension-mdxjs-esm: ^1.0.0 - micromark-util-combine-extensions: ^1.0.0 - micromark-util-types: ^1.0.0 - checksum: 51de1f7e8cadfe601ae4180d7a2402de40a02fec04d5f4deaa65061dbf39d81e3e56f0fcd55a43343c24593e371945a73a0a47fe723d02d99168b08c8945697d - languageName: node - linkType: hard - -"micromark-factory-destination@npm:^1.0.0": - version: 1.0.0 - resolution: "micromark-factory-destination@npm:1.0.0" - dependencies: - micromark-util-character: ^1.0.0 - micromark-util-symbol: ^1.0.0 - micromark-util-types: ^1.0.0 - checksum: f6aed32c80fb947abce5c435e8aed86fb273eb349b162b7fa0a3daeb29f5b857d61e7d1a8bd133b213ee7a13d0b086b0caa4cf6297f6083242d73f1cfa0fe843 - languageName: node - linkType: hard - -"micromark-factory-label@npm:^1.0.0": - version: 1.0.2 - resolution: "micromark-factory-label@npm:1.0.2" - dependencies: - micromark-util-character: ^1.0.0 - micromark-util-symbol: ^1.0.0 - micromark-util-types: ^1.0.0 - uvu: ^0.5.0 - checksum: a0788bf93cb6e770fef410b2389848c07e31d3eddd11baf22cabdbf99ab1cdcacf78b7765db9e86330d077141274713e50112ea4c960d002c57c4f2d96686ce5 - languageName: node - linkType: hard - -"micromark-factory-mdx-expression@npm:^1.0.0": - version: 1.0.6 - resolution: "micromark-factory-mdx-expression@npm:1.0.6" - dependencies: - micromark-factory-space: ^1.0.0 - micromark-util-character: ^1.0.0 - micromark-util-events-to-acorn: ^1.0.0 - micromark-util-symbol: ^1.0.0 - micromark-util-types: ^1.0.0 - unist-util-position-from-estree: ^1.0.0 - uvu: ^0.5.0 - vfile-message: ^3.0.0 - checksum: b671daf6468f2e2aef198aeffca8a808cd076c12474998508761f37cc44056522a6fc4c0069a7fff1ac1ff613d1cfbfe151ff57d0ce6ea96c0d9a6d3dd993830 - languageName: node - linkType: hard - -"micromark-factory-space@npm:^1.0.0": - version: 1.0.0 - resolution: "micromark-factory-space@npm:1.0.0" - dependencies: - micromark-util-character: ^1.0.0 - micromark-util-types: ^1.0.0 - checksum: f28ff6ce111ce0e078a5a8b23437101932591720c29ca782f47bb5e02ff8cae8c5b091310e2347232f3c3627cf28392ed38bc4370a7b3eb331eb1fc8e5f3b53d - languageName: node - linkType: hard - -"micromark-factory-title@npm:^1.0.0": - version: 1.0.2 - resolution: "micromark-factory-title@npm:1.0.2" - dependencies: - micromark-factory-space: ^1.0.0 - micromark-util-character: ^1.0.0 - micromark-util-symbol: ^1.0.0 - micromark-util-types: ^1.0.0 - uvu: ^0.5.0 - checksum: 6af4e2b10eea74b49b49f4708b29f4d24641288aca8c0681fbaed8be9b5a2914d15f85c367bf1eddab28077084511f872a6546493a1fc4d6b127d0cb2066af6c - languageName: node - linkType: hard - -"micromark-factory-whitespace@npm:^1.0.0": - version: 1.0.0 - resolution: "micromark-factory-whitespace@npm:1.0.0" - dependencies: - micromark-factory-space: ^1.0.0 - micromark-util-character: ^1.0.0 - micromark-util-symbol: ^1.0.0 - micromark-util-types: ^1.0.0 - checksum: cf7b2b7e7890c7bb91164c6bf96964f0ee256f7217f669ca581c71109cc33d839782997f9790000dd6b930ee4cc9ab251202ca859641f2d292bca84aef73941b - languageName: node - linkType: hard - -"micromark-util-character@npm:^1.0.0": - version: 1.1.0 - resolution: "micromark-util-character@npm:1.1.0" - dependencies: - micromark-util-symbol: ^1.0.0 - micromark-util-types: ^1.0.0 - checksum: 16810080f710123e236dca1455bcc75d788beb78c276e42720382781daecb437fd13bb762cccc073d8049ab9ebbb0919295344f3105b3c4942c52d0fbe0153e2 - languageName: node - linkType: hard - -"micromark-util-chunked@npm:^1.0.0": - version: 1.0.0 - resolution: "micromark-util-chunked@npm:1.0.0" - dependencies: - micromark-util-symbol: ^1.0.0 - checksum: f64b9cae96d11d43fc9a012253ea35ddf700ff041378aab5aa681f7b95cd6ba898ad9460b930cd12d779ad2d0fc5e08b77d92ce68ca3bf850e13b33af2cbfbd8 - languageName: node - linkType: hard - -"micromark-util-classify-character@npm:^1.0.0": - version: 1.0.0 - resolution: "micromark-util-classify-character@npm:1.0.0" - dependencies: - micromark-util-character: ^1.0.0 - micromark-util-symbol: ^1.0.0 - micromark-util-types: ^1.0.0 - checksum: 942ba5b90c6d50fa9f0be5023db3769c2a840ef1471d2dd69466bdbfc11c2d25a0421c418163b6112845c0a4a27c7e99aab6ca78907b36d087069b2dac15e0cc - languageName: node - linkType: hard - -"micromark-util-combine-extensions@npm:^1.0.0": - version: 1.0.0 - resolution: "micromark-util-combine-extensions@npm:1.0.0" - dependencies: - micromark-util-chunked: ^1.0.0 - micromark-util-types: ^1.0.0 - checksum: b527582e34ef701a258ee31ff7cc5f32be224683147295f4727b6437c05484289f9d117f2f805ac9608649ee538461f4bfb1a5530e55d5448f90b3e3f3047c90 - languageName: node - linkType: hard - -"micromark-util-decode-numeric-character-reference@npm:^1.0.0": - version: 1.0.0 - resolution: "micromark-util-decode-numeric-character-reference@npm:1.0.0" - dependencies: - micromark-util-symbol: ^1.0.0 - checksum: 5d53453876defe7c821ea9af83cef90a261c8cbe7af32dbbd34b5b80eb521f08523bd4632cb73c6fd2b64f7383e28aaa07d227a2e43c7bc0f6659241278b3826 - languageName: node - linkType: hard - -"micromark-util-decode-string@npm:^1.0.0": - version: 1.0.2 - resolution: "micromark-util-decode-string@npm:1.0.2" - dependencies: - decode-named-character-reference: ^1.0.0 - micromark-util-character: ^1.0.0 - micromark-util-decode-numeric-character-reference: ^1.0.0 - micromark-util-symbol: ^1.0.0 - checksum: 325300615d45084c61361c5480269690e2f1c173ee96caa85dcb406d2930be587467510037374fe81dd318d226fefb654e862c45ecf7cc12d9f53354ed3e7d43 - languageName: node - linkType: hard - -"micromark-util-encode@npm:^1.0.0": - version: 1.0.1 - resolution: "micromark-util-encode@npm:1.0.1" - checksum: d00bf397d97a872ce2f8f3e677ff6aecc66fa1d64ef1d67226596c4a9fe0b8c6d321c6edd815826d1896af7ea2c453a88502de4300f8c5dc886d58636f32995f - languageName: node - linkType: hard - -"micromark-util-events-to-acorn@npm:^1.0.0": - version: 1.2.0 - resolution: "micromark-util-events-to-acorn@npm:1.2.0" - dependencies: - "@types/acorn": ^4.0.0 - "@types/estree": ^1.0.0 - estree-util-visit: ^1.0.0 - micromark-util-types: ^1.0.0 - uvu: ^0.5.0 - vfile-location: ^4.0.0 - vfile-message: ^3.0.0 - checksum: 7802cf8db0206a2b55a29e8c933677efb1d190c8c16eb0aaed8e2a4f5aa22bab47095aa2e68bccc66a6eaf3161a9bddac08be4dc3e0069502cb77d2eadf54c90 - languageName: node - linkType: hard - -"micromark-util-html-tag-name@npm:^1.0.0": - version: 1.1.0 - resolution: "micromark-util-html-tag-name@npm:1.1.0" - checksum: 700bebb77a893c93d2b236413c043425dfb068314d8e6aa66090575b86a700d23a64b9e96a343391ce4cf63c40d12df1163f90e92d2d985b125d3315f4601b81 - languageName: node - linkType: hard - -"micromark-util-normalize-identifier@npm:^1.0.0": - version: 1.0.0 - resolution: "micromark-util-normalize-identifier@npm:1.0.0" - dependencies: - micromark-util-symbol: ^1.0.0 - checksum: de4285cbdf1588f0db934e868d78ebd74dfe10802508ed2b0e7a5fec6eddc00f2d496c2d33f2e70707e3f33e31d6c7c1ff59a3841f4c425535c72ea7b6d3a89c - languageName: node - linkType: hard - -"micromark-util-resolve-all@npm:^1.0.0": - version: 1.0.0 - resolution: "micromark-util-resolve-all@npm:1.0.0" - dependencies: - micromark-util-types: ^1.0.0 - checksum: 0373d4fd0dcf340a60e584b1ea0b21d986709378042d39a8790b3086013e3c9e523a2c6fcffb9c8bf0d3ff6f236f6cb5df72044c1a7fffa68fef65daf4ae6ff1 - languageName: node - linkType: hard - -"micromark-util-sanitize-uri@npm:^1.0.0, micromark-util-sanitize-uri@npm:^1.1.0": - version: 1.1.0 - resolution: "micromark-util-sanitize-uri@npm:1.1.0" - dependencies: - micromark-util-character: ^1.0.0 - micromark-util-encode: ^1.0.0 - micromark-util-symbol: ^1.0.0 - checksum: aa7cde6bc8e6a8971b8501c0cfeb4185a77f5b4eba8eb65cfdbdcb29106f29878376b655e8f9942d0090b87785a54ec2b349046cf60759dc44a4c90fcf0eac3e - languageName: node - linkType: hard - -"micromark-util-subtokenize@npm:^1.0.0": - version: 1.0.2 - resolution: "micromark-util-subtokenize@npm:1.0.2" - dependencies: - micromark-util-chunked: ^1.0.0 - micromark-util-symbol: ^1.0.0 - micromark-util-types: ^1.0.0 - uvu: ^0.5.0 - checksum: d4aea094d9040be13ec31b619106a1e19771cbdda88f19011f0f03f73d1ae97771b35a577fdf35d75ce61056394bb4b18cb5edac4c8b851632e86306e0e9838b - languageName: node - linkType: hard - -"micromark-util-symbol@npm:^1.0.0": - version: 1.0.1 - resolution: "micromark-util-symbol@npm:1.0.1" - checksum: 760dbebaf853b8d6e690f911ef5e7bcd52c3b5447c8a99c309dfc874f5c30dc6428bd600669ac8c47a46de54fce337b366474e429f9c2f859f0f59cb1516b22c - languageName: node - linkType: hard - -"micromark-util-types@npm:^1.0.0, micromark-util-types@npm:^1.0.1": - version: 1.0.2 - resolution: "micromark-util-types@npm:1.0.2" - checksum: 850fa76d1ed229e906d16ab91f023f680adf9b3d6adb0332983d2fc0d650dded416aac7846e0a23f154efffb43e36df1f8312831e0ed5e28f059eb50f11f2097 - languageName: node - linkType: hard - -"micromark@npm:^3.0.0": - version: 3.1.0 - resolution: "micromark@npm:3.1.0" - dependencies: - "@types/debug": ^4.0.0 - debug: ^4.0.0 - decode-named-character-reference: ^1.0.0 - micromark-core-commonmark: ^1.0.1 - micromark-factory-space: ^1.0.0 - micromark-util-character: ^1.0.0 - micromark-util-chunked: ^1.0.0 - micromark-util-combine-extensions: ^1.0.0 - micromark-util-decode-numeric-character-reference: ^1.0.0 - micromark-util-encode: ^1.0.0 - micromark-util-normalize-identifier: ^1.0.0 - micromark-util-resolve-all: ^1.0.0 - micromark-util-sanitize-uri: ^1.0.0 - micromark-util-subtokenize: ^1.0.0 - micromark-util-symbol: ^1.0.0 - micromark-util-types: ^1.0.1 - uvu: ^0.5.0 - checksum: b316e5a804039d95794527fc1c7f87dd5fee0c793aff9f2ba1a4ad40dc2c29a541b68c01507f0ae52f91138f560d896f9ea1ad267e183740ec2456caf590ccaf - languageName: node - linkType: hard - "micromark@npm:~2.11.0": version: 2.11.4 resolution: "micromark@npm:2.11.4" @@ -26277,22 +25517,6 @@ __metadata: languageName: node linkType: hard -"parse-entities@npm:^4.0.0": - version: 4.0.0 - resolution: "parse-entities@npm:4.0.0" - dependencies: - "@types/unist": ^2.0.0 - character-entities: ^2.0.0 - character-entities-legacy: ^3.0.0 - character-reference-invalid: ^2.0.0 - decode-named-character-reference: ^1.0.0 - is-alphanumerical: ^2.0.0 - is-decimal: ^2.0.0 - is-hexadecimal: ^2.0.0 - checksum: 9c7e2e956099707238a5d394b12cf65ff5672c592665f7110d7b20b5d446ecd7d926354dff5c40aff0c7953de8c103356b4d01d8e9d7cf2b83d83cb545a12dc2 - languageName: node - linkType: hard - "parse-git-config@npm:^2.0.3": version: 2.0.3 resolution: "parse-git-config@npm:2.0.3" @@ -26662,16 +25886,6 @@ __metadata: languageName: node linkType: hard -"periscopic@npm:^3.0.0": - version: 3.0.4 - resolution: "periscopic@npm:3.0.4" - dependencies: - estree-walker: ^3.0.0 - is-reference: ^3.0.0 - checksum: b70dd2fe52b8d70f439b68f2f7ef9e1a75a0e7b07a01393dea376ecdcbb5a76315c6661457c882c7579c6db41f44acb3d7c93ad7c7716c4c874e23481f04ed2e - languageName: node - linkType: hard - "picocolors@npm:^0.2.1": version: 0.2.1 resolution: "picocolors@npm:0.2.1" @@ -27721,13 +26935,6 @@ __metadata: languageName: node linkType: hard -"property-information@npm:^6.0.0": - version: 6.2.0 - resolution: "property-information@npm:6.2.0" - checksum: daf929ea81354cbbca1e189063cfd606038c11acb30312aa8f8d79a7168163139ff960b6c478542dad6831fa48a3bf3ab8b3dab1b3e34570da32040537b154da - languageName: node - linkType: hard - "proto-list@npm:~1.2.1": version: 1.2.4 resolution: "proto-list@npm:1.2.4" @@ -29331,16 +28538,6 @@ __metadata: languageName: node linkType: hard -"remark-mdx@npm:^2.0.0": - version: 2.1.5 - resolution: "remark-mdx@npm:2.1.5" - dependencies: - mdast-util-mdx: ^2.0.0 - micromark-extension-mdxjs: ^1.0.0 - checksum: f16e21e45fbd5004f361a20e3f4f8ca4cf2cc9c99f7db9aaba9f010cda02c08cf052c5f94d5af798a01c68b1186613fb537a3ef04faf25c292aaba0b7e3d6d7f - languageName: node - linkType: hard - "remark-message-control@npm:^6.0.0": version: 6.0.0 resolution: "remark-message-control@npm:6.0.0" @@ -29351,17 +28548,6 @@ __metadata: languageName: node linkType: hard -"remark-parse@npm:^10.0.0": - version: 10.0.1 - resolution: "remark-parse@npm:10.0.1" - dependencies: - "@types/mdast": ^3.0.0 - mdast-util-from-markdown: ^1.0.0 - unified: ^10.0.0 - checksum: 1ca6e9b2f8e628d260c68a0367cb6dc92f20e6dd70c195a79584d09b237133ddf96e6398733e53bfbf379a3c4ad6168caa5792a6d83870b7cc014b259531f772 - languageName: node - linkType: hard - "remark-parse@npm:^8.0.0": version: 8.0.3 resolution: "remark-parse@npm:8.0.3" @@ -29443,18 +28629,6 @@ __metadata: languageName: node linkType: hard -"remark-rehype@npm:^10.0.0": - version: 10.1.0 - resolution: "remark-rehype@npm:10.1.0" - dependencies: - "@types/hast": ^2.0.0 - "@types/mdast": ^3.0.0 - mdast-util-to-hast: ^12.1.0 - unified: ^10.0.0 - checksum: 803e658c9b51a9b53ee2ada42ff82e8e570444bb97c873e0d602c2d8dcb69a774fd22bd6f26643dfd5ab4c181059ea6c9fb9a99a2d7f9665f3f11bef1a1489bd - languageName: node - linkType: hard - "remark-slug@npm:^6.0.0": version: 6.1.0 resolution: "remark-slug@npm:6.1.0" @@ -30089,7 +29263,7 @@ __metadata: languageName: node linkType: hard -"sade@npm:^1.7.3, sade@npm:^1.7.4": +"sade@npm:^1.7.4": version: 1.8.1 resolution: "sade@npm:1.8.1" dependencies: @@ -31043,7 +30217,7 @@ __metadata: languageName: node linkType: hard -"source-map@npm:^0.7.0, source-map@npm:^0.7.3": +"source-map@npm:^0.7.3": version: 0.7.4 resolution: "source-map@npm:0.7.4" checksum: dc0cf3768fe23c345ea8760487f8c97ef6fca8a73c83cd7c9bf2fde8bc2c34adb9c0824d6feb14bc4f9e37fb522e18af621543f1289038a66ac7586da29aa7dc @@ -31085,13 +30259,6 @@ __metadata: languageName: node linkType: hard -"space-separated-tokens@npm:^2.0.0": - version: 2.0.2 - resolution: "space-separated-tokens@npm:2.0.2" - checksum: 6173e1d903dca41dcab6a2deed8b4caf61bd13b6d7af8374713500570aa929ff9414ae09a0519f4f8772df993300305a395d4871f35bc4ca72b6db57e1f30af8 - languageName: node - linkType: hard - "spawn-command@npm:^0.0.2-1": version: 0.0.2 resolution: "spawn-command@npm:0.0.2" @@ -31608,16 +30775,6 @@ __metadata: languageName: node linkType: hard -"stringify-entities@npm:^4.0.0": - version: 4.0.3 - resolution: "stringify-entities@npm:4.0.3" - dependencies: - character-entities-html4: ^2.0.0 - character-entities-legacy: ^3.0.0 - checksum: e4582cd40b082e95bc2075bed656dcbc24e83538830f15cb5a025f1ba8d341adbdb3c66efb6a5bfd6860a3ea426322135aa666cf128bf03c961553e2f9f2d4ed - languageName: node - linkType: hard - "stringify-object@npm:^3.3.0": version: 3.3.0 resolution: "stringify-object@npm:3.3.0" @@ -31781,15 +30938,6 @@ __metadata: languageName: node linkType: hard -"style-to-object@npm:^0.3.0": - version: 0.3.0 - resolution: "style-to-object@npm:0.3.0" - dependencies: - inline-style-parser: 0.1.1 - checksum: afe9b96ba077a9068baf8887091870f50298157c0ebf5378151792cf2a2ce084fec9b34fc544da0d9f8e6c22ca0c9e23aa6f075bb8eb051aa1d64363e9987600 - languageName: node - linkType: hard - "styled-jsx@npm:5.0.7": version: 5.0.7 resolution: "styled-jsx@npm:5.0.7" @@ -32663,13 +31811,6 @@ __metadata: languageName: node linkType: hard -"trim-lines@npm:^3.0.0": - version: 3.0.1 - resolution: "trim-lines@npm:3.0.1" - checksum: 3a1611fa9e52aa56a94c69951a9ea15b8aaad760eaa26c56a65330dc8adf99cb282fc07cc9d94968b7d4d88003beba220a7278bbe2063328eb23fb56f9509e94 - languageName: node - linkType: hard - "trim-newlines@npm:^1.0.0": version: 1.0.0 resolution: "trim-newlines@npm:1.0.0" @@ -32712,13 +31853,6 @@ __metadata: languageName: node linkType: hard -"trough@npm:^2.0.0": - version: 2.1.0 - resolution: "trough@npm:2.1.0" - checksum: 9a973f0745fa69b9d34f29fe8123599abb6915350a5f4e9e9c9026156219f8774af062d916f4ec327b796149188719170ad87f0d120f1e94271a1843366efcc3 - languageName: node - linkType: hard - "try-catch@npm:^3.0.0": version: 3.0.1 resolution: "try-catch@npm:3.0.1" @@ -33398,21 +32532,6 @@ __metadata: languageName: node linkType: hard -"unified@npm:^10.0.0": - version: 10.1.2 - resolution: "unified@npm:10.1.2" - dependencies: - "@types/unist": ^2.0.0 - bail: ^2.0.0 - extend: ^3.0.0 - is-buffer: ^2.0.0 - is-plain-obj: ^4.0.0 - trough: ^2.0.0 - vfile: ^5.0.0 - checksum: da9195e3375a74ab861a65e1d7b0454225d17a61646697911eb6b3e97de41091930ed3d167eb11881d4097c51deac407091d39ddd1ee8bf1fde3f946844a17a7 - languageName: node - linkType: hard - "unified@npm:^9.0.0, unified@npm:^9.1.0": version: 9.2.2 resolution: "unified@npm:9.2.2" @@ -33493,15 +32612,6 @@ __metadata: languageName: node linkType: hard -"unist-builder@npm:^3.0.0": - version: 3.0.0 - resolution: "unist-builder@npm:3.0.0" - dependencies: - "@types/unist": ^2.0.0 - checksum: 9569c23fa3005bf84d84318285c4acac4d4ff50d763e8f724080da076b99074c419f7436970986aeda7b82bb518aa866c4653e5571a7e08c082e5d0245e5dc96 - languageName: node - linkType: hard - "unist-util-generated@npm:^1.0.0, unist-util-generated@npm:^1.1.0": version: 1.1.6 resolution: "unist-util-generated@npm:1.1.6" @@ -33509,13 +32619,6 @@ __metadata: languageName: node linkType: hard -"unist-util-generated@npm:^2.0.0": - version: 2.0.0 - resolution: "unist-util-generated@npm:2.0.0" - checksum: 00cafe8eb5e1258b994e38997d641a0e4733157217b232d5432cba94ad2a06a37a5e7ef3fd603e056eb401ef525ff02a1de82313fba02b1226a76749cfef9b16 - languageName: node - linkType: hard - "unist-util-inspect@npm:^5.0.0": version: 5.0.1 resolution: "unist-util-inspect@npm:5.0.1" @@ -33532,22 +32635,6 @@ __metadata: languageName: node linkType: hard -"unist-util-is@npm:^5.0.0": - version: 5.1.1 - resolution: "unist-util-is@npm:5.1.1" - checksum: dba33e93d96e42a69d37379aa19d10423d4579a53a81578614741e0d81cc432dca15fe2b16da3bd53650c37007e55f3e2e6124f24ede7cdf036a36154b95e694 - languageName: node - linkType: hard - -"unist-util-position-from-estree@npm:^1.0.0, unist-util-position-from-estree@npm:^1.1.0": - version: 1.1.1 - resolution: "unist-util-position-from-estree@npm:1.1.1" - dependencies: - "@types/unist": ^2.0.0 - checksum: 268984afd136bf4b2a4e6a053e5d64c67a0e84bde9f129e0a977179f3142fe05048481726085b995c0c91d76735f24b173e1fb3c4004b552a59b07c4a44c80c0 - languageName: node - linkType: hard - "unist-util-position@npm:^3.0.0, unist-util-position@npm:^3.1.0": version: 3.1.0 resolution: "unist-util-position@npm:3.1.0" @@ -33555,15 +32642,6 @@ __metadata: languageName: node linkType: hard -"unist-util-position@npm:^4.0.0": - version: 4.0.3 - resolution: "unist-util-position@npm:4.0.3" - dependencies: - "@types/unist": ^2.0.0 - checksum: 485b04b883a4ec17ce7ea0547fb464851fb9482a68200592fae4d19fe9b0802a08f8a3b2c58eaa85b4b2b50689551e44ff5585fe67994815f18a05e85832dc0d - languageName: node - linkType: hard - "unist-util-remove-position@npm:^2.0.0": version: 2.0.1 resolution: "unist-util-remove-position@npm:2.0.1" @@ -33573,16 +32651,6 @@ __metadata: languageName: node linkType: hard -"unist-util-remove-position@npm:^4.0.0": - version: 4.0.1 - resolution: "unist-util-remove-position@npm:4.0.1" - dependencies: - "@types/unist": ^2.0.0 - unist-util-visit: ^4.0.0 - checksum: 4b51ff5175c6b5a7ac96ac72e2cb39bfc928cd7fef2c263604c2b21f8d032d2947dbb1ebb81de285711a474b261f9da4cc60b36130eb8844c74c98ca251cf035 - languageName: node - linkType: hard - "unist-util-stringify-position@npm:^2.0.0": version: 2.0.3 resolution: "unist-util-stringify-position@npm:2.0.3" @@ -33592,15 +32660,6 @@ __metadata: languageName: node linkType: hard -"unist-util-stringify-position@npm:^3.0.0": - version: 3.0.2 - resolution: "unist-util-stringify-position@npm:3.0.2" - dependencies: - "@types/unist": ^2.0.0 - checksum: 0b2812e60d6351578d1e16bfdfc13bf2de139f1c6f6f4e5426fd410d8c62fc3b7b8f2ae5adf00c606e0d34fe5921666c5af921e74b382143c9e275fd71a8459b - languageName: node - linkType: hard - "unist-util-visit-parents@npm:^3.0.0": version: 3.1.1 resolution: "unist-util-visit-parents@npm:3.1.1" @@ -33611,16 +32670,6 @@ __metadata: languageName: node linkType: hard -"unist-util-visit-parents@npm:^5.1.1": - version: 5.1.1 - resolution: "unist-util-visit-parents@npm:5.1.1" - dependencies: - "@types/unist": ^2.0.0 - unist-util-is: ^5.0.0 - checksum: 9d1c7c905a8018d87d85dfd0d98dbbe7f580a3661def247b4c5248b0c4c50c5d9a77d266bc132252379145a133aa4d94b5099c7de93ac27dea5d88447c9f58b1 - languageName: node - linkType: hard - "unist-util-visit@npm:^2.0.0": version: 2.0.3 resolution: "unist-util-visit@npm:2.0.3" @@ -33632,17 +32681,6 @@ __metadata: languageName: node linkType: hard -"unist-util-visit@npm:^4.0.0": - version: 4.1.1 - resolution: "unist-util-visit@npm:4.1.1" - dependencies: - "@types/unist": ^2.0.0 - unist-util-is: ^5.0.0 - unist-util-visit-parents: ^5.1.1 - checksum: 4a32c6c03a0c99bbde289eafda89c2162d42b846f857eef569bceb9e76c71d84e97a3133be10f652e29fd0ff4eab52960d395d1a044ed5235350fd1b71c8790d - languageName: node - linkType: hard - "universal-url@npm:^2.0.0": version: 2.0.0 resolution: "universal-url@npm:2.0.0" @@ -33960,20 +32998,6 @@ __metadata: languageName: node linkType: hard -"uvu@npm:^0.5.0": - version: 0.5.6 - resolution: "uvu@npm:0.5.6" - dependencies: - dequal: ^2.0.0 - diff: ^5.0.0 - kleur: ^4.0.3 - sade: ^1.7.3 - bin: - uvu: bin.js - checksum: ad32eb5f7d94bdeb71f80d073003f0138e24f61ed68cecc8e15d2f30838f44c9670577bb1775c8fac894bf93d1bc1583d470a9195e49bfa6efa14cc6f4942bff - languageName: node - linkType: hard - "v8-compile-cache-lib@npm:^3.0.1": version: 3.0.1 resolution: "v8-compile-cache-lib@npm:3.0.1" @@ -34118,16 +33142,6 @@ __metadata: languageName: node linkType: hard -"vfile-location@npm:^4.0.0": - version: 4.0.1 - resolution: "vfile-location@npm:4.0.1" - dependencies: - "@types/unist": ^2.0.0 - vfile: ^5.0.0 - checksum: b1690417243561fa7b1e23c3a9ed79ca8880738d16db1f8e51f2d09655e9660283bf12d9649e60e692a7461d01d644341fb902b78a15d8aaccca9c163469e6dc - languageName: node - linkType: hard - "vfile-message@npm:^2.0.0": version: 2.0.4 resolution: "vfile-message@npm:2.0.4" @@ -34138,16 +33152,6 @@ __metadata: languageName: node linkType: hard -"vfile-message@npm:^3.0.0": - version: 3.1.3 - resolution: "vfile-message@npm:3.1.3" - dependencies: - "@types/unist": ^2.0.0 - unist-util-stringify-position: ^3.0.0 - checksum: 1bb2387807fb3037ffc1e6f9b15b4ba3bde0341d268786e1841979056d03af751a843c29a70ef819df76fb160702ea1d8373b01053293eab6487507428075dd8 - languageName: node - linkType: hard - "vfile-reporter@npm:^6.0.0": version: 6.0.2 resolution: "vfile-reporter@npm:6.0.2" @@ -34188,18 +33192,6 @@ __metadata: languageName: node linkType: hard -"vfile@npm:^5.0.0": - version: 5.3.6 - resolution: "vfile@npm:5.3.6" - dependencies: - "@types/unist": ^2.0.0 - is-buffer: ^2.0.0 - unist-util-stringify-position: ^3.0.0 - vfile-message: ^3.0.0 - checksum: 44b80d35e384fa86b464a179a80bd57c90d56828cc4b589bd59380ea084ed40a8ad2b40306172731c30c20125b2e8c2d732718ee664baaf12c5c6cf7fe772ac1 - languageName: node - linkType: hard - "vite-plugin-turbosnap@npm:^1.0.1": version: 1.0.1 resolution: "vite-plugin-turbosnap@npm:1.0.1" @@ -35628,13 +34620,6 @@ __metadata: languageName: node linkType: hard -"zwitch@npm:^2.0.0": - version: 2.0.4 - resolution: "zwitch@npm:2.0.4" - checksum: 3c7830cdd3378667e058ffdb4cf2bb78ac5711214e2725900873accb23f3dfe5f9e7e5a06dcdc5f29605da976fc45c26d9a13ca334d6eea2245a15e77b8fc06e - languageName: node - linkType: hard - "zx@npm:^7.0.3": version: 7.1.1 resolution: "zx@npm:7.1.1" From 95358fe854b36d0a10f2f6747a1a63e9691bb62b Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 23 Nov 2022 13:58:02 +0100 Subject: [PATCH 38/47] add deprecation messages --- .../src/preview/iframe-webpack.config.ts | 12 ++++-------- code/lib/client-api/package.json | 1 + code/lib/client-api/src/entry.ts | 6 ++++++ code/lib/core-client/package.json | 1 + code/lib/core-client/src/entry.ts | 6 ++++++ code/lib/preview-web/package.json | 1 + code/lib/preview-web/src/entry.ts | 6 ++++++ code/lib/store/package.json | 1 + code/lib/store/src/entry.ts | 6 ++++++ 9 files changed, 32 insertions(+), 8 deletions(-) diff --git a/code/lib/builder-webpack5/src/preview/iframe-webpack.config.ts b/code/lib/builder-webpack5/src/preview/iframe-webpack.config.ts index fed066b7d53..39edcd35750 100644 --- a/code/lib/builder-webpack5/src/preview/iframe-webpack.config.ts +++ b/code/lib/builder-webpack5/src/preview/iframe-webpack.config.ts @@ -209,18 +209,14 @@ export default async ( externals: { ...[ // these packages are pre-bundled, so they are mapped to global shims - 'channels', + // at some point this should only be a single package: preview-api + 'addons', 'channel-postmessage', 'channel-websocket', + 'channels', + 'client-logger', 'core-events', 'preview-api', - 'client-logger', - 'addons', - 'store', - 'preview-web', - 'preview-api', - 'client-api', - 'core-client', ].reduce( (acc, sbPackage) => ({ ...acc, diff --git a/code/lib/client-api/package.json b/code/lib/client-api/package.json index 0bddc98bc90..9025f11a55b 100644 --- a/code/lib/client-api/package.json +++ b/code/lib/client-api/package.json @@ -42,6 +42,7 @@ "prep": "../../../scripts/prepare/facade.ts" }, "dependencies": { + "@storybook/client-logger": "7.0.0-alpha.52", "@storybook/preview-api": "7.0.0-alpha.52" }, "publishConfig": { diff --git a/code/lib/client-api/src/entry.ts b/code/lib/client-api/src/entry.ts index 7d0286b54ea..c5528bee29d 100644 --- a/code/lib/client-api/src/entry.ts +++ b/code/lib/client-api/src/entry.ts @@ -1 +1,7 @@ +import { deprecate } from '@storybook/client-logger'; + +deprecate( + 'importing from @storybook/client-api is deprecated and will be removed in 8.0, please import canvas related modules from @storybook/preview-api' +); + export * from '@storybook/preview-api/dist/client-api'; diff --git a/code/lib/core-client/package.json b/code/lib/core-client/package.json index a83d2b39139..fce686db72d 100644 --- a/code/lib/core-client/package.json +++ b/code/lib/core-client/package.json @@ -35,6 +35,7 @@ "prep": "../../../scripts/prepare/facade.ts" }, "dependencies": { + "@storybook/client-logger": "7.0.0-alpha.52", "@storybook/preview-api": "7.0.0-alpha.52" }, "publishConfig": { diff --git a/code/lib/core-client/src/entry.ts b/code/lib/core-client/src/entry.ts index ba915a18f53..e838a6bd793 100644 --- a/code/lib/core-client/src/entry.ts +++ b/code/lib/core-client/src/entry.ts @@ -1 +1,7 @@ +import { deprecate } from '@storybook/client-logger'; + +deprecate( + 'importing from @storybook/core-client is deprecated and will be removed in 8.0, please import canvas related modules from @storybook/preview-api' +); + export * from '@storybook/preview-api/dist/core-client'; diff --git a/code/lib/preview-web/package.json b/code/lib/preview-web/package.json index c310135d3d3..8281dc00127 100644 --- a/code/lib/preview-web/package.json +++ b/code/lib/preview-web/package.json @@ -42,6 +42,7 @@ "prep": "../../../scripts/prepare/facade.ts" }, "dependencies": { + "@storybook/client-logger": "7.0.0-alpha.52", "@storybook/preview-api": "7.0.0-alpha.52" }, "publishConfig": { diff --git a/code/lib/preview-web/src/entry.ts b/code/lib/preview-web/src/entry.ts index bc3e97098ac..0e2b07b5379 100644 --- a/code/lib/preview-web/src/entry.ts +++ b/code/lib/preview-web/src/entry.ts @@ -1 +1,7 @@ +import { deprecate } from '@storybook/client-logger'; + +deprecate( + 'importing from @storybook/preview is deprecated and will be removed in 8.0, please import canvas related modules from @storybook/preview-api' +); + export * from '@storybook/preview-api/dist/preview-web'; diff --git a/code/lib/store/package.json b/code/lib/store/package.json index 58c981c0d17..dd5a0369b1f 100644 --- a/code/lib/store/package.json +++ b/code/lib/store/package.json @@ -42,6 +42,7 @@ "prep": "../../../scripts/prepare/facade.ts" }, "dependencies": { + "@storybook/client-logger": "7.0.0-alpha.52", "@storybook/preview-api": "7.0.0-alpha.52" }, "publishConfig": { diff --git a/code/lib/store/src/entry.ts b/code/lib/store/src/entry.ts index 5fb0b87c253..5183f945637 100644 --- a/code/lib/store/src/entry.ts +++ b/code/lib/store/src/entry.ts @@ -1 +1,7 @@ +import { deprecate } from '@storybook/client-logger'; + +deprecate( + 'importing from @storybook/store is deprecated and will be removed in 8.0, please import canvas related modules from @storybook/preview-api' +); + export * from '@storybook/preview-api/dist/store'; From c2deac18408a4667f6c3ca93c16f981736726d11 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 23 Nov 2022 15:59:40 +0100 Subject: [PATCH 39/47] fix lockfile --- code/yarn.lock | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code/yarn.lock b/code/yarn.lock index 317027befa8..3e76625e6f9 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -6100,6 +6100,7 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/client-api@workspace:lib/client-api" dependencies: + "@storybook/client-logger": 7.0.0-alpha.52 "@storybook/preview-api": 7.0.0-alpha.52 languageName: unknown linkType: soft @@ -6179,6 +6180,7 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/core-client@workspace:lib/core-client" dependencies: + "@storybook/client-logger": 7.0.0-alpha.52 "@storybook/preview-api": 7.0.0-alpha.52 languageName: unknown linkType: soft @@ -6951,6 +6953,7 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/preview-web@workspace:lib/preview-web" dependencies: + "@storybook/client-logger": 7.0.0-alpha.52 "@storybook/preview-api": 7.0.0-alpha.52 languageName: unknown linkType: soft @@ -7459,6 +7462,7 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/store@workspace:lib/store" dependencies: + "@storybook/client-logger": 7.0.0-alpha.52 "@storybook/preview-api": 7.0.0-alpha.52 languageName: unknown linkType: soft From 4ca17dd7bf38e8e1266b7e7ed57cfe25b51adfe4 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 23 Nov 2022 16:00:33 +0100 Subject: [PATCH 40/47] keep variable names recognizable --- scripts/prepare/bundle.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/prepare/bundle.ts b/scripts/prepare/bundle.ts index 9da70c78d03..17aaf16ac29 100755 --- a/scripts/prepare/bundle.ts +++ b/scripts/prepare/bundle.ts @@ -92,7 +92,7 @@ const run = async ({ cwd, flags }: { cwd: string; flags: string[] }) => { c.platform = platform || 'browser'; c.legalComments = 'none'; c.minifyWhitespace = optimized; - c.minifyIdentifiers = optimized; + c.minifyIdentifiers = false; c.minifySyntax = optimized; /* eslint-enable no-param-reassign */ }, From 80fdba5aa88e53fb1834c160099ebd488a85ab89 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 23 Nov 2022 16:55:12 +0100 Subject: [PATCH 41/47] use preview-api everywhere --- code/addons/storyshots/storyshots-core/package.json | 1 - .../storyshots/storyshots-core/src/frameworks/Loader.ts | 2 +- .../storyshots-core/src/frameworks/angular/loader.ts | 4 ++-- .../storyshots/storyshots-core/src/frameworks/html/loader.ts | 4 ++-- .../storyshots-core/src/frameworks/preact/loader.ts | 4 ++-- .../storyshots/storyshots-core/src/frameworks/rax/loader.ts | 4 ++-- .../storyshots/storyshots-core/src/frameworks/react/loader.ts | 4 ++-- .../storyshots/storyshots-core/src/frameworks/riot/loader.ts | 4 ++-- .../storyshots-core/src/frameworks/svelte/loader.ts | 4 ++-- .../storyshots/storyshots-core/src/frameworks/vue/loader.ts | 4 ++-- .../storyshots/storyshots-core/src/frameworks/vue3/loader.ts | 4 ++-- .../storyshots-core/src/frameworks/web-components/loader.ts | 4 ++-- code/frameworks/ember/package.json | 2 +- code/frameworks/ember/src/client/preview/index.ts | 2 +- code/renderers/html/src/public-api.ts | 2 +- code/renderers/preact/src/public-api.ts | 2 +- code/renderers/react/src/public-api.tsx | 2 +- code/renderers/server/src/public-api.ts | 2 +- code/renderers/svelte/src/public-api.ts | 2 +- code/renderers/vue/src/public-api.ts | 2 +- code/renderers/vue3/src/public-api.ts | 2 +- code/renderers/web-components/src/public-api.ts | 2 +- 22 files changed, 31 insertions(+), 32 deletions(-) diff --git a/code/addons/storyshots/storyshots-core/package.json b/code/addons/storyshots/storyshots-core/package.json index ae9753a8259..2b5bfb24c46 100644 --- a/code/addons/storyshots/storyshots-core/package.json +++ b/code/addons/storyshots/storyshots-core/package.json @@ -41,7 +41,6 @@ "@storybook/addons": "7.0.0-alpha.52", "@storybook/babel-plugin-require-context-hook": "1.0.1", "@storybook/client-api": "7.0.0-alpha.52", - "@storybook/core-client": "7.0.0-alpha.52", "@storybook/core-common": "7.0.0-alpha.52", "@storybook/core-webpack": "7.0.0-alpha.52", "@storybook/preview-api": "7.0.0-alpha.52", diff --git a/code/addons/storyshots/storyshots-core/src/frameworks/Loader.ts b/code/addons/storyshots/storyshots-core/src/frameworks/Loader.ts index 80b863c5110..b7d93898aa1 100644 --- a/code/addons/storyshots/storyshots-core/src/frameworks/Loader.ts +++ b/code/addons/storyshots/storyshots-core/src/frameworks/Loader.ts @@ -1,5 +1,5 @@ import type { Renderer, Addon_Loadable } from '@storybook/types'; -import type { ClientApi as ClientApiClass } from '@storybook/client-api'; +import type { ClientApi as ClientApiClass } from '@storybook/preview-api'; import type { StoryshotsOptions } from '../api/StoryshotsOptions'; import type { SupportedFramework } from './SupportedFramework'; diff --git a/code/addons/storyshots/storyshots-core/src/frameworks/angular/loader.ts b/code/addons/storyshots/storyshots-core/src/frameworks/angular/loader.ts index 40a7def7ffa..9f08d57fc9c 100644 --- a/code/addons/storyshots/storyshots-core/src/frameworks/angular/loader.ts +++ b/code/addons/storyshots/storyshots-core/src/frameworks/angular/loader.ts @@ -35,8 +35,8 @@ function load(options: StoryshotsOptions) { let mockStartedAPI: any; - jest.mock('@storybook/core-client', () => { - const coreClientAPI = jest.requireActual('@storybook/core-client'); + jest.mock('@storybook/preview-api', () => { + const coreClientAPI = jest.requireActual('@storybook/preview-api'); return { ...coreClientAPI, diff --git a/code/addons/storyshots/storyshots-core/src/frameworks/html/loader.ts b/code/addons/storyshots/storyshots-core/src/frameworks/html/loader.ts index 55a8dfdd6b1..f4efc668319 100644 --- a/code/addons/storyshots/storyshots-core/src/frameworks/html/loader.ts +++ b/code/addons/storyshots/storyshots-core/src/frameworks/html/loader.ts @@ -12,8 +12,8 @@ function load(options: StoryshotsOptions) { let mockStartedAPI: any; - jest.mock('@storybook/core-client', () => { - const coreClientAPI = jest.requireActual('@storybook/core-client'); + jest.mock('@storybook/preview-api', () => { + const coreClientAPI = jest.requireActual('@storybook/preview-api'); return { ...coreClientAPI, diff --git a/code/addons/storyshots/storyshots-core/src/frameworks/preact/loader.ts b/code/addons/storyshots/storyshots-core/src/frameworks/preact/loader.ts index 986dcf5f911..09212270d3b 100644 --- a/code/addons/storyshots/storyshots-core/src/frameworks/preact/loader.ts +++ b/code/addons/storyshots/storyshots-core/src/frameworks/preact/loader.ts @@ -18,8 +18,8 @@ function load(options: StoryshotsOptions) { let mockStartedAPI: any; - jest.mock('@storybook/core-client', () => { - const coreClientAPI = jest.requireActual('@storybook/core-client'); + jest.mock('@storybook/preview-api', () => { + const coreClientAPI = jest.requireActual('@storybook/preview-api'); return { ...coreClientAPI, diff --git a/code/addons/storyshots/storyshots-core/src/frameworks/rax/loader.ts b/code/addons/storyshots/storyshots-core/src/frameworks/rax/loader.ts index 2d14593fd09..8cd3f8cc66d 100644 --- a/code/addons/storyshots/storyshots-core/src/frameworks/rax/loader.ts +++ b/code/addons/storyshots/storyshots-core/src/frameworks/rax/loader.ts @@ -13,8 +13,8 @@ function load(options: StoryshotsOptions) { let mockStartedAPI: any; - jest.mock('@storybook/core-client', () => { - const coreClientAPI = jest.requireActual('@storybook/core-client'); + jest.mock('@storybook/preview-api', () => { + const coreClientAPI = jest.requireActual('@storybook/preview-api'); return { ...coreClientAPI, diff --git a/code/addons/storyshots/storyshots-core/src/frameworks/react/loader.ts b/code/addons/storyshots/storyshots-core/src/frameworks/react/loader.ts index bc6f9153f10..eff037eed6f 100644 --- a/code/addons/storyshots/storyshots-core/src/frameworks/react/loader.ts +++ b/code/addons/storyshots/storyshots-core/src/frameworks/react/loader.ts @@ -10,8 +10,8 @@ function test(options: StoryshotsOptions): boolean { function load(options: StoryshotsOptions) { let mockStartedAPI: any; - jest.mock('@storybook/core-client', () => { - const coreClientAPI = jest.requireActual('@storybook/core-client'); + jest.mock('@storybook/preview-api', () => { + const coreClientAPI = jest.requireActual('@storybook/preview-api'); return { ...coreClientAPI, diff --git a/code/addons/storyshots/storyshots-core/src/frameworks/riot/loader.ts b/code/addons/storyshots/storyshots-core/src/frameworks/riot/loader.ts index bd131ba1f80..8b2dc347381 100644 --- a/code/addons/storyshots/storyshots-core/src/frameworks/riot/loader.ts +++ b/code/addons/storyshots/storyshots-core/src/frameworks/riot/loader.ts @@ -18,8 +18,8 @@ function load(options: StoryshotsOptions) { let mockStartedAPI: any; - jest.mock('@storybook/core-client', () => { - const coreClientAPI = jest.requireActual('@storybook/core-client'); + jest.mock('@storybook/preview-api', () => { + const coreClientAPI = jest.requireActual('@storybook/preview-api'); return { ...coreClientAPI, diff --git a/code/addons/storyshots/storyshots-core/src/frameworks/svelte/loader.ts b/code/addons/storyshots/storyshots-core/src/frameworks/svelte/loader.ts index d7a45bc5846..6e97c5db541 100644 --- a/code/addons/storyshots/storyshots-core/src/frameworks/svelte/loader.ts +++ b/code/addons/storyshots/storyshots-core/src/frameworks/svelte/loader.ts @@ -15,8 +15,8 @@ function load(options: StoryshotsOptions) { let mockStartedAPI: any; - jest.mock('@storybook/core-client', () => { - const coreClientAPI = jest.requireActual('@storybook/core-client'); + jest.mock('@storybook/preview-api', () => { + const coreClientAPI = jest.requireActual('@storybook/preview-api'); return { ...coreClientAPI, diff --git a/code/addons/storyshots/storyshots-core/src/frameworks/vue/loader.ts b/code/addons/storyshots/storyshots-core/src/frameworks/vue/loader.ts index bb97cd1560b..7e16d3644ca 100644 --- a/code/addons/storyshots/storyshots-core/src/frameworks/vue/loader.ts +++ b/code/addons/storyshots/storyshots-core/src/frameworks/vue/loader.ts @@ -18,8 +18,8 @@ function load(options: StoryshotsOptions) { let mockStartedAPI: any; - jest.mock('@storybook/core-client', () => { - const coreClientAPI = jest.requireActual('@storybook/core-client'); + jest.mock('@storybook/preview-api', () => { + const coreClientAPI = jest.requireActual('@storybook/preview-api'); return { ...coreClientAPI, diff --git a/code/addons/storyshots/storyshots-core/src/frameworks/vue3/loader.ts b/code/addons/storyshots/storyshots-core/src/frameworks/vue3/loader.ts index 01de29fa01c..93f9390aa50 100644 --- a/code/addons/storyshots/storyshots-core/src/frameworks/vue3/loader.ts +++ b/code/addons/storyshots/storyshots-core/src/frameworks/vue3/loader.ts @@ -13,8 +13,8 @@ function load(options: StoryshotsOptions) { let mockStartedAPI: any; - jest.mock('@storybook/core-client', () => { - const coreClientAPI = jest.requireActual('@storybook/core-client'); + jest.mock('@storybook/preview-api', () => { + const coreClientAPI = jest.requireActual('@storybook/preview-api'); return { ...coreClientAPI, diff --git a/code/addons/storyshots/storyshots-core/src/frameworks/web-components/loader.ts b/code/addons/storyshots/storyshots-core/src/frameworks/web-components/loader.ts index b17cd8f4474..de920d91a95 100644 --- a/code/addons/storyshots/storyshots-core/src/frameworks/web-components/loader.ts +++ b/code/addons/storyshots/storyshots-core/src/frameworks/web-components/loader.ts @@ -12,8 +12,8 @@ function load(options: StoryshotsOptions) { let mockStartedAPI: any; - jest.mock('@storybook/core-client', () => { - const coreClientAPI = jest.requireActual('@storybook/core-client'); + jest.mock('@storybook/preview-api', () => { + const coreClientAPI = jest.requireActual('@storybook/preview-api'); return { ...coreClientAPI, diff --git a/code/frameworks/ember/package.json b/code/frameworks/ember/package.json index 9d5cfa8bd5d..72243dbccef 100644 --- a/code/frameworks/ember/package.json +++ b/code/frameworks/ember/package.json @@ -32,9 +32,9 @@ }, "dependencies": { "@storybook/builder-webpack5": "7.0.0-alpha.52", - "@storybook/core-client": "7.0.0-alpha.52", "@storybook/core-common": "7.0.0-alpha.52", "@storybook/docs-tools": "7.0.0-alpha.52", + "@storybook/preview-api": "7.0.0-alpha.52", "@storybook/types": "7.0.0-alpha.52", "global": "^4.4.0", "react": "16.14.0", diff --git a/code/frameworks/ember/src/client/preview/index.ts b/code/frameworks/ember/src/client/preview/index.ts index 96a58ede904..091e84e7c3f 100644 --- a/code/frameworks/ember/src/client/preview/index.ts +++ b/code/frameworks/ember/src/client/preview/index.ts @@ -1,4 +1,4 @@ -import { start } from '@storybook/core-client'; +import { start } from '@storybook/preview-api'; import './globals'; import type { EmberRenderer } from './types'; diff --git a/code/renderers/html/src/public-api.ts b/code/renderers/html/src/public-api.ts index bc813beb093..6e96adcaa93 100644 --- a/code/renderers/html/src/public-api.ts +++ b/code/renderers/html/src/public-api.ts @@ -1,6 +1,6 @@ /* eslint-disable prefer-destructuring */ import type { Addon_ClientStoryApi, Addon_Loadable } from '@storybook/types'; -import { start } from '@storybook/core-client'; +import { start } from '@storybook/preview-api'; import type { HtmlRenderer } from './types'; import { renderToCanvas, render } from './render'; diff --git a/code/renderers/preact/src/public-api.ts b/code/renderers/preact/src/public-api.ts index 81298c96277..3b6f7801f39 100644 --- a/code/renderers/preact/src/public-api.ts +++ b/code/renderers/preact/src/public-api.ts @@ -1,6 +1,6 @@ /* eslint-disable prefer-destructuring */ import type { Addon_ClientStoryApi, Addon_Loadable } from '@storybook/types'; -import { start } from '@storybook/core-client'; +import { start } from '@storybook/preview-api'; import { renderToCanvas } from './render'; import type { PreactRenderer } from './types'; diff --git a/code/renderers/react/src/public-api.tsx b/code/renderers/react/src/public-api.tsx index ca761e807b0..05540a0fb82 100644 --- a/code/renderers/react/src/public-api.tsx +++ b/code/renderers/react/src/public-api.tsx @@ -1,5 +1,5 @@ /* eslint-disable prefer-destructuring */ -import { start } from '@storybook/core-client'; +import { start } from '@storybook/preview-api'; import type { Addon_ClientStoryApi, Addon_Loadable } from '@storybook/types'; import { render, renderToCanvas } from './render'; diff --git a/code/renderers/server/src/public-api.ts b/code/renderers/server/src/public-api.ts index c55854ffc5a..a3d9a6cec76 100644 --- a/code/renderers/server/src/public-api.ts +++ b/code/renderers/server/src/public-api.ts @@ -1,5 +1,5 @@ import type { Addon_ClientStoryApi, Addon_Loadable } from '@storybook/types'; -import { start } from '@storybook/core-client'; +import { start } from '@storybook/preview-api'; import { renderToCanvas, render } from './render'; import type { ServerRenderer } from './types'; diff --git a/code/renderers/svelte/src/public-api.ts b/code/renderers/svelte/src/public-api.ts index 2a6a63a8245..44eb6e69db4 100644 --- a/code/renderers/svelte/src/public-api.ts +++ b/code/renderers/svelte/src/public-api.ts @@ -1,4 +1,4 @@ -import { start } from '@storybook/core-client'; +import { start } from '@storybook/preview-api'; import { decorateStory } from './decorators'; import type { SvelteRenderer } from './types'; diff --git a/code/renderers/vue/src/public-api.ts b/code/renderers/vue/src/public-api.ts index 553e42b76c3..aa758443b76 100644 --- a/code/renderers/vue/src/public-api.ts +++ b/code/renderers/vue/src/public-api.ts @@ -1,6 +1,6 @@ /* eslint-disable prefer-destructuring */ import type { Addon_ClientStoryApi, Addon_Loadable } from '@storybook/types'; -import { start } from '@storybook/core-client'; +import { start } from '@storybook/preview-api'; import type { VueRenderer } from './types'; import { renderToCanvas, render } from './render'; diff --git a/code/renderers/vue3/src/public-api.ts b/code/renderers/vue3/src/public-api.ts index f7a0220a0d0..e34b848f3bc 100644 --- a/code/renderers/vue3/src/public-api.ts +++ b/code/renderers/vue3/src/public-api.ts @@ -1,6 +1,6 @@ import type { Addon_ClientStoryApi, Addon_Loadable } from '@storybook/types'; import type { App } from 'vue'; -import { start } from '@storybook/core-client'; +import { start } from '@storybook/preview-api'; import type { VueRenderer } from './types'; import { decorateStory } from './decorateStory'; diff --git a/code/renderers/web-components/src/public-api.ts b/code/renderers/web-components/src/public-api.ts index 3d5590fbf73..719defb4006 100644 --- a/code/renderers/web-components/src/public-api.ts +++ b/code/renderers/web-components/src/public-api.ts @@ -1,6 +1,6 @@ /* eslint-disable prefer-destructuring */ import type { Addon_ClientStoryApi, Addon_Loadable } from '@storybook/types'; -import { start } from '@storybook/core-client'; +import { start } from '@storybook/preview-api'; import { renderToCanvas } from './render'; import type { WebComponentsRenderer } from './types'; From 26c9f258c7c88729a132d5fb0218c85e445714b8 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 23 Nov 2022 17:27:05 +0100 Subject: [PATCH 42/47] fix lockfile --- code/yarn.lock | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/code/yarn.lock b/code/yarn.lock index 3e76625e6f9..957a0413f18 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -5483,7 +5483,6 @@ __metadata: "@storybook/angular": 7.0.0-alpha.52 "@storybook/babel-plugin-require-context-hook": 1.0.1 "@storybook/client-api": 7.0.0-alpha.52 - "@storybook/core-client": 7.0.0-alpha.52 "@storybook/core-common": 7.0.0-alpha.52 "@storybook/core-webpack": 7.0.0-alpha.52 "@storybook/preview-api": 7.0.0-alpha.52 @@ -6409,9 +6408,9 @@ __metadata: resolution: "@storybook/ember@workspace:frameworks/ember" dependencies: "@storybook/builder-webpack5": 7.0.0-alpha.52 - "@storybook/core-client": 7.0.0-alpha.52 "@storybook/core-common": 7.0.0-alpha.52 "@storybook/docs-tools": 7.0.0-alpha.52 + "@storybook/preview-api": 7.0.0-alpha.52 "@storybook/types": 7.0.0-alpha.52 ember-source: ~3.28.1 global: ^4.4.0 From bf5f7831d14f48546c24548ebfc14d434ae842bc Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Thu, 24 Nov 2022 13:00:11 +0100 Subject: [PATCH 43/47] Apply suggestions from code review Co-authored-by: Valentin Palkovic --- .../storyshots-core/src/frameworks/angular/loader.ts | 4 ++-- .../storyshots/storyshots-core/src/frameworks/html/loader.ts | 4 ++-- .../storyshots-core/src/frameworks/preact/loader.ts | 4 ++-- .../storyshots/storyshots-core/src/frameworks/rax/loader.ts | 2 +- .../storyshots/storyshots-core/src/frameworks/react/loader.ts | 4 ++-- .../storyshots/storyshots-core/src/frameworks/riot/loader.ts | 4 ++-- .../storyshots-core/src/frameworks/svelte/loader.ts | 4 ++-- .../storyshots/storyshots-core/src/frameworks/vue/loader.ts | 4 ++-- .../storyshots/storyshots-core/src/frameworks/vue3/loader.ts | 4 ++-- .../storyshots-core/src/frameworks/web-components/loader.ts | 4 ++-- code/frameworks/nextjs/package.json | 1 - .../src/modules/preview-web/docs-context/DocsContextProps.ts | 4 +--- .../modules/preview-web/docs-context/DocsRenderFunction.ts | 4 +--- code/lib/preview-api/src/modules/store/decorators.test.ts | 2 +- 14 files changed, 22 insertions(+), 27 deletions(-) diff --git a/code/addons/storyshots/storyshots-core/src/frameworks/angular/loader.ts b/code/addons/storyshots/storyshots-core/src/frameworks/angular/loader.ts index 9f08d57fc9c..17601530775 100644 --- a/code/addons/storyshots/storyshots-core/src/frameworks/angular/loader.ts +++ b/code/addons/storyshots/storyshots-core/src/frameworks/angular/loader.ts @@ -36,10 +36,10 @@ function load(options: StoryshotsOptions) { let mockStartedAPI: any; jest.mock('@storybook/preview-api', () => { - const coreClientAPI = jest.requireActual('@storybook/preview-api'); + const previewAPI = jest.requireActual('@storybook/preview-api'); return { - ...coreClientAPI, + ...previewAPI, start: (...args: any[]) => { mockStartedAPI = coreClientAPI.start(...args); return mockStartedAPI; diff --git a/code/addons/storyshots/storyshots-core/src/frameworks/html/loader.ts b/code/addons/storyshots/storyshots-core/src/frameworks/html/loader.ts index f4efc668319..d2d14657fc4 100644 --- a/code/addons/storyshots/storyshots-core/src/frameworks/html/loader.ts +++ b/code/addons/storyshots/storyshots-core/src/frameworks/html/loader.ts @@ -13,10 +13,10 @@ function load(options: StoryshotsOptions) { let mockStartedAPI: any; jest.mock('@storybook/preview-api', () => { - const coreClientAPI = jest.requireActual('@storybook/preview-api'); + const previewAPI = jest.requireActual('@storybook/preview-api'); return { - ...coreClientAPI, + ...previewAPI, start: (...args: any[]) => { mockStartedAPI = coreClientAPI.start(...args); return mockStartedAPI; diff --git a/code/addons/storyshots/storyshots-core/src/frameworks/preact/loader.ts b/code/addons/storyshots/storyshots-core/src/frameworks/preact/loader.ts index 09212270d3b..91b98c44ee9 100644 --- a/code/addons/storyshots/storyshots-core/src/frameworks/preact/loader.ts +++ b/code/addons/storyshots/storyshots-core/src/frameworks/preact/loader.ts @@ -19,10 +19,10 @@ function load(options: StoryshotsOptions) { let mockStartedAPI: any; jest.mock('@storybook/preview-api', () => { - const coreClientAPI = jest.requireActual('@storybook/preview-api'); + const previewAPI = jest.requireActual('@storybook/preview-api'); return { - ...coreClientAPI, + ...previewAPI, start: (...args: any[]) => { mockStartedAPI = coreClientAPI.start(...args); return mockStartedAPI; diff --git a/code/addons/storyshots/storyshots-core/src/frameworks/rax/loader.ts b/code/addons/storyshots/storyshots-core/src/frameworks/rax/loader.ts index 8cd3f8cc66d..b28dbdac9a5 100644 --- a/code/addons/storyshots/storyshots-core/src/frameworks/rax/loader.ts +++ b/code/addons/storyshots/storyshots-core/src/frameworks/rax/loader.ts @@ -14,7 +14,7 @@ function load(options: StoryshotsOptions) { let mockStartedAPI: any; jest.mock('@storybook/preview-api', () => { - const coreClientAPI = jest.requireActual('@storybook/preview-api'); + const previewAPI = jest.requireActual('@storybook/preview-api'); return { ...coreClientAPI, diff --git a/code/addons/storyshots/storyshots-core/src/frameworks/react/loader.ts b/code/addons/storyshots/storyshots-core/src/frameworks/react/loader.ts index eff037eed6f..132a6925c4a 100644 --- a/code/addons/storyshots/storyshots-core/src/frameworks/react/loader.ts +++ b/code/addons/storyshots/storyshots-core/src/frameworks/react/loader.ts @@ -11,10 +11,10 @@ function load(options: StoryshotsOptions) { let mockStartedAPI: any; jest.mock('@storybook/preview-api', () => { - const coreClientAPI = jest.requireActual('@storybook/preview-api'); + const previewAPI = jest.requireActual('@storybook/preview-api'); return { - ...coreClientAPI, + ...previewAPI, start: (...args: any[]) => { mockStartedAPI = coreClientAPI.start(...args); return mockStartedAPI; diff --git a/code/addons/storyshots/storyshots-core/src/frameworks/riot/loader.ts b/code/addons/storyshots/storyshots-core/src/frameworks/riot/loader.ts index 8b2dc347381..2565fa5bea4 100644 --- a/code/addons/storyshots/storyshots-core/src/frameworks/riot/loader.ts +++ b/code/addons/storyshots/storyshots-core/src/frameworks/riot/loader.ts @@ -19,10 +19,10 @@ function load(options: StoryshotsOptions) { let mockStartedAPI: any; jest.mock('@storybook/preview-api', () => { - const coreClientAPI = jest.requireActual('@storybook/preview-api'); + const previewAPI = jest.requireActual('@storybook/preview-api'); return { - ...coreClientAPI, + ...previewAPI, start: (...args: any[]) => { mockStartedAPI = coreClientAPI.start(...args); return mockStartedAPI; diff --git a/code/addons/storyshots/storyshots-core/src/frameworks/svelte/loader.ts b/code/addons/storyshots/storyshots-core/src/frameworks/svelte/loader.ts index 6e97c5db541..484075f9fc9 100644 --- a/code/addons/storyshots/storyshots-core/src/frameworks/svelte/loader.ts +++ b/code/addons/storyshots/storyshots-core/src/frameworks/svelte/loader.ts @@ -16,10 +16,10 @@ function load(options: StoryshotsOptions) { let mockStartedAPI: any; jest.mock('@storybook/preview-api', () => { - const coreClientAPI = jest.requireActual('@storybook/preview-api'); + const previewAPI = jest.requireActual('@storybook/preview-api'); return { - ...coreClientAPI, + ...previewAPI, start: (...args: any[]) => { mockStartedAPI = coreClientAPI.start(...args); return mockStartedAPI; diff --git a/code/addons/storyshots/storyshots-core/src/frameworks/vue/loader.ts b/code/addons/storyshots/storyshots-core/src/frameworks/vue/loader.ts index 7e16d3644ca..9ae516e4597 100644 --- a/code/addons/storyshots/storyshots-core/src/frameworks/vue/loader.ts +++ b/code/addons/storyshots/storyshots-core/src/frameworks/vue/loader.ts @@ -19,10 +19,10 @@ function load(options: StoryshotsOptions) { let mockStartedAPI: any; jest.mock('@storybook/preview-api', () => { - const coreClientAPI = jest.requireActual('@storybook/preview-api'); + const previewAPI = jest.requireActual('@storybook/preview-api'); return { - ...coreClientAPI, + ...previewAPI, start: (...args: any[]) => { mockStartedAPI = coreClientAPI.start(...args); return mockStartedAPI; diff --git a/code/addons/storyshots/storyshots-core/src/frameworks/vue3/loader.ts b/code/addons/storyshots/storyshots-core/src/frameworks/vue3/loader.ts index 93f9390aa50..399396af521 100644 --- a/code/addons/storyshots/storyshots-core/src/frameworks/vue3/loader.ts +++ b/code/addons/storyshots/storyshots-core/src/frameworks/vue3/loader.ts @@ -14,10 +14,10 @@ function load(options: StoryshotsOptions) { let mockStartedAPI: any; jest.mock('@storybook/preview-api', () => { - const coreClientAPI = jest.requireActual('@storybook/preview-api'); + const previewAPI = jest.requireActual('@storybook/preview-api'); return { - ...coreClientAPI, + ...previewAPI, start: (...args: any[]) => { mockStartedAPI = coreClientAPI.start(...args); return mockStartedAPI; diff --git a/code/addons/storyshots/storyshots-core/src/frameworks/web-components/loader.ts b/code/addons/storyshots/storyshots-core/src/frameworks/web-components/loader.ts index de920d91a95..5ddaddb4556 100644 --- a/code/addons/storyshots/storyshots-core/src/frameworks/web-components/loader.ts +++ b/code/addons/storyshots/storyshots-core/src/frameworks/web-components/loader.ts @@ -13,10 +13,10 @@ function load(options: StoryshotsOptions) { let mockStartedAPI: any; jest.mock('@storybook/preview-api', () => { - const coreClientAPI = jest.requireActual('@storybook/preview-api'); + const previewAPI = jest.requireActual('@storybook/preview-api'); return { - ...coreClientAPI, + ...previewAPI, start: (...args: any[]) => { mockStartedAPI = coreClientAPI.start(...args); return mockStartedAPI; diff --git a/code/frameworks/nextjs/package.json b/code/frameworks/nextjs/package.json index 77aed8fdf04..2d989efb6db 100644 --- a/code/frameworks/nextjs/package.json +++ b/code/frameworks/nextjs/package.json @@ -59,7 +59,6 @@ "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { - "@babel/preset-typescript": "^7.18.6", "@storybook/addons": "7.0.0-alpha.52", "@storybook/builder-webpack5": "7.0.0-alpha.52", "@storybook/core-common": "7.0.0-alpha.52", diff --git a/code/lib/preview-api/src/modules/preview-web/docs-context/DocsContextProps.ts b/code/lib/preview-api/src/modules/preview-web/docs-context/DocsContextProps.ts index 52c9b1498e0..c73df45e223 100644 --- a/code/lib/preview-api/src/modules/preview-web/docs-context/DocsContextProps.ts +++ b/code/lib/preview-api/src/modules/preview-web/docs-context/DocsContextProps.ts @@ -1,3 +1 @@ -import type { DocsContextProps } from '@storybook/types'; - -export { DocsContextProps }; +export type { DocsContextProps } from '@storybook/types'; diff --git a/code/lib/preview-api/src/modules/preview-web/docs-context/DocsRenderFunction.ts b/code/lib/preview-api/src/modules/preview-web/docs-context/DocsRenderFunction.ts index 819b7e8607e..d7533154a2c 100644 --- a/code/lib/preview-api/src/modules/preview-web/docs-context/DocsRenderFunction.ts +++ b/code/lib/preview-api/src/modules/preview-web/docs-context/DocsRenderFunction.ts @@ -1,3 +1 @@ -import type { DocsRenderFunction } from '@storybook/types'; - -export type { DocsRenderFunction }; +export type { DocsRenderFunction } from '@storybook/types'; diff --git a/code/lib/preview-api/src/modules/store/decorators.test.ts b/code/lib/preview-api/src/modules/store/decorators.test.ts index 44ae403e398..d8e6b3fb247 100644 --- a/code/lib/preview-api/src/modules/store/decorators.test.ts +++ b/code/lib/preview-api/src/modules/store/decorators.test.ts @@ -92,7 +92,7 @@ describe('client-api.decorators', () => { // the same story twice at the same time. it('does not interleave contexts if two decorated stories are call simultaneously', async () => { const contexts: StoryContext[] = []; - let resolve: any; + let resolve: (value: unknown) => void; const fence = new Promise((r) => { resolve = r; }); From 95bf5c156536261878a49c8ee03eeac4d8333542 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Thu, 24 Nov 2022 13:01:31 +0100 Subject: [PATCH 44/47] fixes --- .../storyshots-core/src/frameworks/angular/loader.ts | 2 +- .../storyshots/storyshots-core/src/frameworks/html/loader.ts | 2 +- .../storyshots-core/src/frameworks/preact/loader.ts | 2 +- .../storyshots/storyshots-core/src/frameworks/rax/loader.ts | 4 ++-- .../storyshots/storyshots-core/src/frameworks/react/loader.ts | 2 +- .../storyshots/storyshots-core/src/frameworks/riot/loader.ts | 2 +- .../storyshots-core/src/frameworks/svelte/loader.ts | 2 +- .../storyshots/storyshots-core/src/frameworks/vue/loader.ts | 2 +- .../storyshots/storyshots-core/src/frameworks/vue3/loader.ts | 2 +- .../storyshots-core/src/frameworks/web-components/loader.ts | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/code/addons/storyshots/storyshots-core/src/frameworks/angular/loader.ts b/code/addons/storyshots/storyshots-core/src/frameworks/angular/loader.ts index 17601530775..7b2406c3c92 100644 --- a/code/addons/storyshots/storyshots-core/src/frameworks/angular/loader.ts +++ b/code/addons/storyshots/storyshots-core/src/frameworks/angular/loader.ts @@ -41,7 +41,7 @@ function load(options: StoryshotsOptions) { return { ...previewAPI, start: (...args: any[]) => { - mockStartedAPI = coreClientAPI.start(...args); + mockStartedAPI = previewAPI.start(...args); return mockStartedAPI; }, }; diff --git a/code/addons/storyshots/storyshots-core/src/frameworks/html/loader.ts b/code/addons/storyshots/storyshots-core/src/frameworks/html/loader.ts index d2d14657fc4..d75c563eef2 100644 --- a/code/addons/storyshots/storyshots-core/src/frameworks/html/loader.ts +++ b/code/addons/storyshots/storyshots-core/src/frameworks/html/loader.ts @@ -18,7 +18,7 @@ function load(options: StoryshotsOptions) { return { ...previewAPI, start: (...args: any[]) => { - mockStartedAPI = coreClientAPI.start(...args); + mockStartedAPI = previewAPI.start(...args); return mockStartedAPI; }, }; diff --git a/code/addons/storyshots/storyshots-core/src/frameworks/preact/loader.ts b/code/addons/storyshots/storyshots-core/src/frameworks/preact/loader.ts index 91b98c44ee9..b02ccaf3041 100644 --- a/code/addons/storyshots/storyshots-core/src/frameworks/preact/loader.ts +++ b/code/addons/storyshots/storyshots-core/src/frameworks/preact/loader.ts @@ -24,7 +24,7 @@ function load(options: StoryshotsOptions) { return { ...previewAPI, start: (...args: any[]) => { - mockStartedAPI = coreClientAPI.start(...args); + mockStartedAPI = previewAPI.start(...args); return mockStartedAPI; }, }; diff --git a/code/addons/storyshots/storyshots-core/src/frameworks/rax/loader.ts b/code/addons/storyshots/storyshots-core/src/frameworks/rax/loader.ts index b28dbdac9a5..ffe67f77154 100644 --- a/code/addons/storyshots/storyshots-core/src/frameworks/rax/loader.ts +++ b/code/addons/storyshots/storyshots-core/src/frameworks/rax/loader.ts @@ -17,9 +17,9 @@ function load(options: StoryshotsOptions) { const previewAPI = jest.requireActual('@storybook/preview-api'); return { - ...coreClientAPI, + ...previewAPI, start: (...args: any[]) => { - mockStartedAPI = coreClientAPI.start(...args); + mockStartedAPI = previewAPI.start(...args); return mockStartedAPI; }, }; diff --git a/code/addons/storyshots/storyshots-core/src/frameworks/react/loader.ts b/code/addons/storyshots/storyshots-core/src/frameworks/react/loader.ts index 132a6925c4a..35d62098d18 100644 --- a/code/addons/storyshots/storyshots-core/src/frameworks/react/loader.ts +++ b/code/addons/storyshots/storyshots-core/src/frameworks/react/loader.ts @@ -16,7 +16,7 @@ function load(options: StoryshotsOptions) { return { ...previewAPI, start: (...args: any[]) => { - mockStartedAPI = coreClientAPI.start(...args); + mockStartedAPI = previewAPI.start(...args); return mockStartedAPI; }, }; diff --git a/code/addons/storyshots/storyshots-core/src/frameworks/riot/loader.ts b/code/addons/storyshots/storyshots-core/src/frameworks/riot/loader.ts index 2565fa5bea4..8a174ee11af 100644 --- a/code/addons/storyshots/storyshots-core/src/frameworks/riot/loader.ts +++ b/code/addons/storyshots/storyshots-core/src/frameworks/riot/loader.ts @@ -24,7 +24,7 @@ function load(options: StoryshotsOptions) { return { ...previewAPI, start: (...args: any[]) => { - mockStartedAPI = coreClientAPI.start(...args); + mockStartedAPI = previewAPI.start(...args); return mockStartedAPI; }, }; diff --git a/code/addons/storyshots/storyshots-core/src/frameworks/svelte/loader.ts b/code/addons/storyshots/storyshots-core/src/frameworks/svelte/loader.ts index 484075f9fc9..0135af40b64 100644 --- a/code/addons/storyshots/storyshots-core/src/frameworks/svelte/loader.ts +++ b/code/addons/storyshots/storyshots-core/src/frameworks/svelte/loader.ts @@ -21,7 +21,7 @@ function load(options: StoryshotsOptions) { return { ...previewAPI, start: (...args: any[]) => { - mockStartedAPI = coreClientAPI.start(...args); + mockStartedAPI = previewAPI.start(...args); return mockStartedAPI; }, }; diff --git a/code/addons/storyshots/storyshots-core/src/frameworks/vue/loader.ts b/code/addons/storyshots/storyshots-core/src/frameworks/vue/loader.ts index 9ae516e4597..02ef63c066d 100644 --- a/code/addons/storyshots/storyshots-core/src/frameworks/vue/loader.ts +++ b/code/addons/storyshots/storyshots-core/src/frameworks/vue/loader.ts @@ -24,7 +24,7 @@ function load(options: StoryshotsOptions) { return { ...previewAPI, start: (...args: any[]) => { - mockStartedAPI = coreClientAPI.start(...args); + mockStartedAPI = previewAPI.start(...args); return mockStartedAPI; }, }; diff --git a/code/addons/storyshots/storyshots-core/src/frameworks/vue3/loader.ts b/code/addons/storyshots/storyshots-core/src/frameworks/vue3/loader.ts index 399396af521..91d40dd35d7 100644 --- a/code/addons/storyshots/storyshots-core/src/frameworks/vue3/loader.ts +++ b/code/addons/storyshots/storyshots-core/src/frameworks/vue3/loader.ts @@ -19,7 +19,7 @@ function load(options: StoryshotsOptions) { return { ...previewAPI, start: (...args: any[]) => { - mockStartedAPI = coreClientAPI.start(...args); + mockStartedAPI = previewAPI.start(...args); return mockStartedAPI; }, }; diff --git a/code/addons/storyshots/storyshots-core/src/frameworks/web-components/loader.ts b/code/addons/storyshots/storyshots-core/src/frameworks/web-components/loader.ts index 5ddaddb4556..41ac97a7511 100644 --- a/code/addons/storyshots/storyshots-core/src/frameworks/web-components/loader.ts +++ b/code/addons/storyshots/storyshots-core/src/frameworks/web-components/loader.ts @@ -18,7 +18,7 @@ function load(options: StoryshotsOptions) { return { ...previewAPI, start: (...args: any[]) => { - mockStartedAPI = coreClientAPI.start(...args); + mockStartedAPI = previewAPI.start(...args); return mockStartedAPI; }, }; From 092eb8937dafd0a3827918f3943173c8c513edd1 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Thu, 24 Nov 2022 13:21:46 +0100 Subject: [PATCH 45/47] move / update readme files --- code/lib/client-api/README.md | 17 +-- code/lib/core-client/README.md | 15 +-- code/lib/preview-api/README-client-api.md | 16 +++ code/lib/preview-api/README-core-client.md | 14 +++ code/lib/preview-api/README-preview-web.md | 94 ++++++++++++++ code/lib/preview-api/README-store.md | 136 ++++++++++++++++++++ code/lib/preview-api/README.md | 98 ++------------- code/lib/preview-web/README.md | 95 +------------- code/lib/store/README.md | 137 +-------------------- 9 files changed, 276 insertions(+), 346 deletions(-) create mode 100644 code/lib/preview-api/README-client-api.md create mode 100644 code/lib/preview-api/README-core-client.md create mode 100644 code/lib/preview-api/README-preview-web.md create mode 100644 code/lib/preview-api/README-store.md diff --git a/code/lib/client-api/README.md b/code/lib/client-api/README.md index fddccb2823d..2220a03cb98 100644 --- a/code/lib/client-api/README.md +++ b/code/lib/client-api/README.md @@ -1,16 +1,3 @@ -# `@storybook/client-api` -- Deprecated Story APIs (`storiesOf`) +The contents of this package have moved to `@storybook/preview-api`. Please update your import. -**NOTE** This API is deprecated, and the CSF format is preferred for all stories. - -## `storiesOf` API - -The `@storybook/client` API provides the [`storiesOf()` API](../core/docs/storiesOf.md), which is proxied through to the CSF API. - -### Internals - -In order to appear to the store like the CSF API, a call to `storiesOf().add()` does the following: - -- Tracks the story added in a synthetic `StoryIndex` data structure -- Constructs a `moduleExports` object that is equivalent to the exports from a CSF file that produced the same stories. - -In order to achieve the old `storySort` functionality, the client API also needs access to the project annotations. +This package will no longer be released as part of the 8.0 release of storybook. diff --git a/code/lib/core-client/README.md b/code/lib/core-client/README.md index e7a5c89882c..2220a03cb98 100644 --- a/code/lib/core-client/README.md +++ b/code/lib/core-client/README.md @@ -1,14 +1,3 @@ -# Storybook Core-Client +The contents of this package have moved to `@storybook/preview-api`. Please update your import. -This package contains browser-side functionality shared amongst all the frameworks (React, RN, Vue, Ember, Angular, etc) in the old "v6" story store back-compatibility layer. - -A framework calls the `start(renderToCanvas, { render, decorateStory })` function and provides: - -- The `renderToCanvas` function, which tells Storybook how to render the result of a story function to the DOM -- The `render` function, which is a default mapping of `args` to a story result in CSFv3 -- The `decorateStory` function, which tells Storybook how to combine decorators in the framework. - -The `start` function will return a `configure()` function, which can be re-exported to be used in `preview.js` (deprecated), or automatically by the `main.js:stories` field to: - -- return a list of CSF files -- [deprecated] make calls to the `storiesOf` API. +This package will no longer be released as part of the 8.0 release of storybook. diff --git a/code/lib/preview-api/README-client-api.md b/code/lib/preview-api/README-client-api.md new file mode 100644 index 00000000000..fddccb2823d --- /dev/null +++ b/code/lib/preview-api/README-client-api.md @@ -0,0 +1,16 @@ +# `@storybook/client-api` -- Deprecated Story APIs (`storiesOf`) + +**NOTE** This API is deprecated, and the CSF format is preferred for all stories. + +## `storiesOf` API + +The `@storybook/client` API provides the [`storiesOf()` API](../core/docs/storiesOf.md), which is proxied through to the CSF API. + +### Internals + +In order to appear to the store like the CSF API, a call to `storiesOf().add()` does the following: + +- Tracks the story added in a synthetic `StoryIndex` data structure +- Constructs a `moduleExports` object that is equivalent to the exports from a CSF file that produced the same stories. + +In order to achieve the old `storySort` functionality, the client API also needs access to the project annotations. diff --git a/code/lib/preview-api/README-core-client.md b/code/lib/preview-api/README-core-client.md new file mode 100644 index 00000000000..e7a5c89882c --- /dev/null +++ b/code/lib/preview-api/README-core-client.md @@ -0,0 +1,14 @@ +# Storybook Core-Client + +This package contains browser-side functionality shared amongst all the frameworks (React, RN, Vue, Ember, Angular, etc) in the old "v6" story store back-compatibility layer. + +A framework calls the `start(renderToCanvas, { render, decorateStory })` function and provides: + +- The `renderToCanvas` function, which tells Storybook how to render the result of a story function to the DOM +- The `render` function, which is a default mapping of `args` to a story result in CSFv3 +- The `decorateStory` function, which tells Storybook how to combine decorators in the framework. + +The `start` function will return a `configure()` function, which can be re-exported to be used in `preview.js` (deprecated), or automatically by the `main.js:stories` field to: + +- return a list of CSF files +- [deprecated] make calls to the `storiesOf` API. diff --git a/code/lib/preview-api/README-preview-web.md b/code/lib/preview-api/README-preview-web.md new file mode 100644 index 00000000000..cb44e3b4b07 --- /dev/null +++ b/code/lib/preview-api/README-preview-web.md @@ -0,0 +1,94 @@ +# Preview (Web) + +This is the main API for the (web) version of the Storybook Preview. + +The preview's job is: + +1. Read and update the URL (via the URL Store) + +2. Listen to instructions on the channel and emit events as things occur. + +3. Render the current selection to the web view in either story or docs mode. + +## V7 Store vs Legacy (V6) + +The story store is designed to load stories 'on demand', and will operate in this fashion if the `storyStoreV7` feature is enabled. + +However, for back-compat reasons, in v6 mode, we need to load all stories, synchronously on bootup, emitting the `SET_STORIES` event. + +In V7 mode we do not emit that event, instead preferring the `STORY_PREPARED` event, with the data for the single story being rendered. + +## Initialization + +The preview is `initialized` in two ways. + +### V7 Mode: + +- `importFn` - is an async `import()` function + +- `getProjectAnnotations` - is a simple function that evaluations `preview.js` and addon config files and combines them. If it errors, the Preview will show the error. + +- No `getStoryIndex` function is passed, instead the preview creates a `StoryIndexClient` that pulls `stories.json` from node and watches the event stream for invalidation events. + +### V6 Mode + +- `importFn` - is a simulated `import()` function, that is synchronous, see `client-api` for details. +- `getProjectAnnotations` - also evaluates `preview.js` et al, but watches for calls to `setStories`, and passes them to the `ClientApi` +- `getStoryIndex` is a local function (that must be called _after_ `getProjectAnnotations`) that gets the list of stories added. + +See `client-api` for more details on this process. + +## Story Rendering and interruptions + +The Preview is split into three parts responsible for state management: + +- `PreviewWeb` - which story is rendered, receives events and (maybe) changes/re-renders stories +- `StoryRender` - (imports +) prepares the story, renders it through the various phases +- `DocsRender` - if a story renders in docs mode, it is "transformed" into a `DocsRender` once we know. + +A rendering story goes through these phases: + +- `preparing` - (maybe async) import the story file and prepare the story function. +- `loading` - async loaders are running +- `rendering` - the `renderToDOM` function for the framework is running +- `playing` - the `play` function is running +- `completed` - the story is done. + +It also has two error states: + +- `aborted` - the story was stopped midway (see below) +- `errored` - there was an error thrown somewhere along the way. + +### Re-rendering and aborting + +A story may re-render due to various events, which can have implications if the story is not in the `completed` phase: + +- `UPDATE_STORY_ARGS` / `UPDATE_GLOBALS` -- change of inputs +- `FORCE_RE_RENDER` - re-render unchanged + +If these events happen during a render: + +- if the story is `preparing` or `loading`, leave thing unchanged and let the new `args`/`globals` be picked up by the render phase +- otherwise, use the result of the previous `loaders` run, and simply re-render over the top + +- `FORCE_REMOUNT` - remount (or equivalent) the component and re-render. + +If this happens during a render, treat `loading` similarly, but: + +- if the story is `rendering`, start a new render and abort the previous render immediately afterwards +- if the story is `playing`, attempt to abort the previous play function, and start a new render. + +### Changing story + +Also the `SET_CURRENT_STORY` event may change the current story. We need to check: + +- If the `storyId` changed +- If the `viewMode` changed +- If the story implementation changed (i.e if HMR occurred). + +If the _previous_ story is still `preparing`, we cannot know if the implementation changed, so we +abort the preparing immediately, and let the new story take over. + +Otherwise, if all of the above are the same, we do nothing. + +If they are different, and the old story is not `completed`, we try to abort it immediately. If that fails (e.g. the `play` function doesn't respond to the `abort` event), then we reload the window. diff --git a/code/lib/preview-api/README-store.md b/code/lib/preview-api/README-store.md new file mode 100644 index 00000000000..83e9b9b4b51 --- /dev/null +++ b/code/lib/preview-api/README-store.md @@ -0,0 +1,136 @@ +# Storybook Store + +The store is reponsible for loading a story from a CSF file and preparing into a `Story` type, which is our internal format. + +## Story vs StoryContext + +Story functions and decorators recieve a `StoryContext` object (parameterized by their framework). + +The `Story` type that we pass around in our code includes all of those fields apart from the `args`, `globals`, `hooks` and `viewMode`, which are mutable and stored separately in the store. + +## Identification + +The first set of fields on a `Story` are the identifying fields for a story: + +- `componentId` - the URL "id" of the component +- `title` - the title of the component, which generates the sidebar entry +- `id` - the story "id" (in the URL) +- `name` - the name of the story + +## Annotations + +The main fields on a `Story` are the various annotations. Annotations can be set: + +- At the project level in `preview.js` (or via addons) +- At the component level via `export default { ... }` in a CSF file +- At the story level via `export const Story = {...}` in a CSF file. + +Not all annotations can be set at every level but most can. + +## Parameters + +The story parameters is a static, serializable object of data that provides details about the story. Those details can be used by addons or Storybook itself to render UI or provide defaults about the story rendering. + +Parameters _cannot change_ and are synchronized to the manager once when the story is loaded (note over the lifetime of a development Storybook a story can be loaded several times due to hot module reload, so the parameters technically can change for that reason). + +Usually addons will read from a single key of `parameters` namespaced by the name of that addon. For instance the configuration of the `backgrounds` addon is driven by the `parameters.backgrounds` namespace. + +Parameters are inheritable -- you can set project parameters via `export parameters = {}`, at the component level by the `parameters` key of the component (default) export in CSF, and on a single story via the `parameters` key on the story data. + +Some notable parameters: + +- `parameters.fileName` - the file that the story was defined in, when available + +## Args + +Args are "inputs" to stories. + +You can think of them equivalently to React props, Angular inputs and outputs, etc. + +Changing the args cause the story to be re-rendered with the new set of args. + +### Using args in a story + +By default (starting in 6.0) the args will be passed to the story as first argument and the context as second: + +```js +const YourStory = ({ x, y } /*, context*/) => /* render your story using `x` and `y` */ +``` + +If you set the `parameters.options.passArgsFirst` option on a story to false, args are passed to a story in the context, preserving the pre-6.0 story API; like parameters, they are available as `context.args`. + +```js +const YourStory = ({ args: { x, y }}) => /* render your story using `x` and `y` */ +``` + +### Arg types and values + +Arg types are used by the docs addon to populate the props table and are documented there. They are controlled by `argTypes` and can (sometimes) be automatically inferred from type information about the story or the component rendered by the story. + +A story can set initial values of its args with the `args` annotation. If you set an initial value for an arg that doesn't have a type a simple type will be inferred from the value. + +If an arg doesn't have an initial value, it will start unset, although it can still be set later via user interaction. + +Args can be set at the project, component and story level. + +### Using args in an addon + +Args values are automatically synchronized (via the `changeStoryArgs` and `storyArgsChanged` events) between the preview and manager; APIs exist in `lib/api` to read and set args in the manager. + +Args need to be serializable -- so currently cannot include callbacks (this may change in a future version). + +Note that arg values are passed directly to a story -- you should only store the actual value that the story needs to render in the arg. If you need more complex information supporting that, use parameters or addon state. + +Both `@storybook/client-api` (preview) and `@storybook/api` (manager) export a `useArgs()` hook that you can use to access args in decorators or addon panels. The API is as follows: + +```js +import { useArgs } from '@storybook/client-api'; // or '@storybook/api' + +// `args` is the args of the currently rendered story +// `updateArgs` will update its args. You can pass a subset of the args; other args will not be changed. +const [args, updateArgs] = useArgs(); +``` + +## ArgTypes + +Arg types add type information and metadata about args that are used to control the docs and controls addons. + +### ArgTypes enhancement + +To add a argTypes enhancer, `export const argTypesEnhancers = []` from `preview.js` or and addon + +There is a default enhancer that ensures that each `arg` in a story has a baseline `argType`. This value can be improved by subsequent enhancers, e.g. those provided by `@storybook/addon-docs`. + +## Globals + +Globals are rendering information that is global across stories. They are used for things like themes and internationalization (i18n) in stories, where you want Storybook to "remember" your setting as you browse between stories. + +They can be accessed in stories and decorators in the `context.globals` key. + +### Initial values of globals + +To set initial values of globals, `export const globals = {...}` from `preview.js` + +### Using globals in an addon + +Similar to args, globals are synchronized to the manager and can be accessed via the `useGlobals` hook. + +```js +import { useGlobals } from '@storybook/addons'; // or '@storybook/api' + +const [globals, updateGlobals] = useGlobals(); +``` + +## Technical details + +### Initialization + +- The store is created "uninitialized". +- It is assumed at some later time it will be initialized with the Story Index, the set of stories (this may be loaded async). +- You _can_ call `loadStory` prior to that time, in which case it will wait for initialization. + +### Caching + +- "All story" APIs like `extract()` require all stories to be loaded. +- For backwards-compatibility, these APIs are _not_ async, so it is required that `store.cacheAllCSFFiles()` is called first +- In v6 mode, this will be called on initialization but `start.ts`. diff --git a/code/lib/preview-api/README.md b/code/lib/preview-api/README.md index cb44e3b4b07..d2dbbf7ab4c 100644 --- a/code/lib/preview-api/README.md +++ b/code/lib/preview-api/README.md @@ -1,94 +1,12 @@ -# Preview (Web) +# Preview API -This is the main API for the (web) version of the Storybook Preview. +TODO write proper documentation of this package -The preview's job is: +# "Sub packages" README documents -1. Read and update the URL (via the URL Store) +This package used to be multiple packages (they have been combined into this one): -2. Listen to instructions on the channel and emit events as things occur. - -3. Render the current selection to the web view in either story or docs mode. - -## V7 Store vs Legacy (V6) - -The story store is designed to load stories 'on demand', and will operate in this fashion if the `storyStoreV7` feature is enabled. - -However, for back-compat reasons, in v6 mode, we need to load all stories, synchronously on bootup, emitting the `SET_STORIES` event. - -In V7 mode we do not emit that event, instead preferring the `STORY_PREPARED` event, with the data for the single story being rendered. - -## Initialization - -The preview is `initialized` in two ways. - -### V7 Mode: - -- `importFn` - is an async `import()` function - -- `getProjectAnnotations` - is a simple function that evaluations `preview.js` and addon config files and combines them. If it errors, the Preview will show the error. - -- No `getStoryIndex` function is passed, instead the preview creates a `StoryIndexClient` that pulls `stories.json` from node and watches the event stream for invalidation events. - -### V6 Mode - -- `importFn` - is a simulated `import()` function, that is synchronous, see `client-api` for details. -- `getProjectAnnotations` - also evaluates `preview.js` et al, but watches for calls to `setStories`, and passes them to the `ClientApi` -- `getStoryIndex` is a local function (that must be called _after_ `getProjectAnnotations`) that gets the list of stories added. - -See `client-api` for more details on this process. - -## Story Rendering and interruptions - -The Preview is split into three parts responsible for state management: - -- `PreviewWeb` - which story is rendered, receives events and (maybe) changes/re-renders stories -- `StoryRender` - (imports +) prepares the story, renders it through the various phases -- `DocsRender` - if a story renders in docs mode, it is "transformed" into a `DocsRender` once we know. - -A rendering story goes through these phases: - -- `preparing` - (maybe async) import the story file and prepare the story function. -- `loading` - async loaders are running -- `rendering` - the `renderToDOM` function for the framework is running -- `playing` - the `play` function is running -- `completed` - the story is done. - -It also has two error states: - -- `aborted` - the story was stopped midway (see below) -- `errored` - there was an error thrown somewhere along the way. - -### Re-rendering and aborting - -A story may re-render due to various events, which can have implications if the story is not in the `completed` phase: - -- `UPDATE_STORY_ARGS` / `UPDATE_GLOBALS` -- change of inputs -- `FORCE_RE_RENDER` - re-render unchanged - -If these events happen during a render: - -- if the story is `preparing` or `loading`, leave thing unchanged and let the new `args`/`globals` be picked up by the render phase -- otherwise, use the result of the previous `loaders` run, and simply re-render over the top - -- `FORCE_REMOUNT` - remount (or equivalent) the component and re-render. - -If this happens during a render, treat `loading` similarly, but: - -- if the story is `rendering`, start a new render and abort the previous render immediately afterwards -- if the story is `playing`, attempt to abort the previous play function, and start a new render. - -### Changing story - -Also the `SET_CURRENT_STORY` event may change the current story. We need to check: - -- If the `storyId` changed -- If the `viewMode` changed -- If the story implementation changed (i.e if HMR occurred). - -If the _previous_ story is still `preparing`, we cannot know if the implementation changed, so we -abort the preparing immediately, and let the new story take over. - -Otherwise, if all of the above are the same, we do nothing. - -If they are different, and the old story is not `completed`, we try to abort it immediately. If that fails (e.g. the `play` function doesn't respond to the `abort` event), then we reload the window. +- `@storybook/client-api` [read (old) docs](./README-client-api.md) +- `@storybook/core-client` [read (old) docs](./README-core-client.md) +- `@storybook/preview-web` [read (old) docs](./README-preview-web.md) +- `@storybook/store` [read (old) docs](./README-store.md) diff --git a/code/lib/preview-web/README.md b/code/lib/preview-web/README.md index 5de7c8b4315..2220a03cb98 100644 --- a/code/lib/preview-web/README.md +++ b/code/lib/preview-web/README.md @@ -1,94 +1,3 @@ -# Preview (Web) +The contents of this package have moved to `@storybook/preview-api`. Please update your import. -This is the main API for the (web) version of the Storybook Preview. - -The preview's job is: - -1. Read and update the URL (via the URL Store) - -2. Listen to instructions on the channel and emit events as things occur. - -3. Render the current selection to the web view in either story or docs mode. - -## V7 Store vs Legacy (V6) - -The story store is designed to load stories 'on demand', and will operate in this fashion if the `storyStoreV7` feature is enabled. - -However, for back-compat reasons, in v6 mode, we need to load all stories, synchronously on bootup, emitting the `SET_STORIES` event. - -In V7 mode we do not emit that event, instead preferring the `STORY_PREPARED` event, with the data for the single story being rendered. - -## Initialization - -The preview is `initialized` in two ways. - -### V7 Mode: - -- `importFn` - is an async `import()` function - -- `getProjectAnnotations` - is a simple function that evaluations `preview.js` and addon config files and combines them. If it errors, the Preview will show the error. - -- No `getStoryIndex` function is passed, instead the preview creates a `StoryIndexClient` that pulls `stories.json` from node and watches the event stream for invalidation events. - -### V6 Mode - -- `importFn` - is a simulated `import()` function, that is synchronous, see `client-api` for details. -- `getProjectAnnotations` - also evaluates `preview.js` et al, but watches for calls to `setStories`, and passes them to the `ClientApi` -- `getStoryIndex` is a local function (that must be called _after_ `getProjectAnnotations`) that gets the list of stories added. - -See `client-api` for more details on this process. - -## Story Rendering and interruptions - -The Preview is split into three parts responsible for state management: - -- `PreviewWeb` - which story is rendered, receives events and (maybe) changes/re-renders stories -- `StoryRender` - (imports +) prepares the story, renders it through the various phases -- `DocsRender` - if a story renders in docs mode, it is "transformed" into a `DocsRender` once we know. - -A rendering story goes through these phases: - -- `preparing` - (maybe async) import the story file and prepare the story function. -- `loading` - async loaders are running -- `rendering` - the `renderToCanvas` function for the framework is running -- `playing` - the `play` function is running -- `completed` - the story is done. - -It also has two error states: - -- `aborted` - the story was stopped midway (see below) -- `errored` - there was an error thrown somewhere along the way. - -### Re-rendering and aborting - -A story may re-render due to various events, which can have implications if the story is not in the `completed` phase: - -- `UPDATE_STORY_ARGS` / `UPDATE_GLOBALS` -- change of inputs -- `FORCE_RE_RENDER` - re-render unchanged - -If these events happen during a render: - -- if the story is `preparing` or `loading`, leave thing unchanged and let the new `args`/`globals` be picked up by the render phase -- otherwise, use the result of the previous `loaders` run, and simply re-render over the top - -- `FORCE_REMOUNT` - remount (or equivalent) the component and re-render. - -If this happens during a render, treat `loading` similarly, but: - -- if the story is `rendering`, start a new render and abort the previous render immediately afterwards -- if the story is `playing`, attempt to abort the previous play function, and start a new render. - -### Changing story - -Also the `SET_CURRENT_STORY` event may change the current story. We need to check: - -- If the `storyId` changed -- If the `viewMode` changed -- If the story implementation changed (i.e if HMR occurred). - -If the _previous_ story is still `preparing`, we cannot know if the implementation changed, so we -abort the preparing immediately, and let the new story take over. - -Otherwise, if all of the above are the same, we do nothing. - -If they are different, and the old story is not `completed`, we try to abort it immediately. If that fails (e.g. the `play` function doesn't respond to the `abort` event), then we reload the window. +This package will no longer be released as part of the 8.0 release of storybook. diff --git a/code/lib/store/README.md b/code/lib/store/README.md index 83e9b9b4b51..2220a03cb98 100644 --- a/code/lib/store/README.md +++ b/code/lib/store/README.md @@ -1,136 +1,3 @@ -# Storybook Store +The contents of this package have moved to `@storybook/preview-api`. Please update your import. -The store is reponsible for loading a story from a CSF file and preparing into a `Story` type, which is our internal format. - -## Story vs StoryContext - -Story functions and decorators recieve a `StoryContext` object (parameterized by their framework). - -The `Story` type that we pass around in our code includes all of those fields apart from the `args`, `globals`, `hooks` and `viewMode`, which are mutable and stored separately in the store. - -## Identification - -The first set of fields on a `Story` are the identifying fields for a story: - -- `componentId` - the URL "id" of the component -- `title` - the title of the component, which generates the sidebar entry -- `id` - the story "id" (in the URL) -- `name` - the name of the story - -## Annotations - -The main fields on a `Story` are the various annotations. Annotations can be set: - -- At the project level in `preview.js` (or via addons) -- At the component level via `export default { ... }` in a CSF file -- At the story level via `export const Story = {...}` in a CSF file. - -Not all annotations can be set at every level but most can. - -## Parameters - -The story parameters is a static, serializable object of data that provides details about the story. Those details can be used by addons or Storybook itself to render UI or provide defaults about the story rendering. - -Parameters _cannot change_ and are synchronized to the manager once when the story is loaded (note over the lifetime of a development Storybook a story can be loaded several times due to hot module reload, so the parameters technically can change for that reason). - -Usually addons will read from a single key of `parameters` namespaced by the name of that addon. For instance the configuration of the `backgrounds` addon is driven by the `parameters.backgrounds` namespace. - -Parameters are inheritable -- you can set project parameters via `export parameters = {}`, at the component level by the `parameters` key of the component (default) export in CSF, and on a single story via the `parameters` key on the story data. - -Some notable parameters: - -- `parameters.fileName` - the file that the story was defined in, when available - -## Args - -Args are "inputs" to stories. - -You can think of them equivalently to React props, Angular inputs and outputs, etc. - -Changing the args cause the story to be re-rendered with the new set of args. - -### Using args in a story - -By default (starting in 6.0) the args will be passed to the story as first argument and the context as second: - -```js -const YourStory = ({ x, y } /*, context*/) => /* render your story using `x` and `y` */ -``` - -If you set the `parameters.options.passArgsFirst` option on a story to false, args are passed to a story in the context, preserving the pre-6.0 story API; like parameters, they are available as `context.args`. - -```js -const YourStory = ({ args: { x, y }}) => /* render your story using `x` and `y` */ -``` - -### Arg types and values - -Arg types are used by the docs addon to populate the props table and are documented there. They are controlled by `argTypes` and can (sometimes) be automatically inferred from type information about the story or the component rendered by the story. - -A story can set initial values of its args with the `args` annotation. If you set an initial value for an arg that doesn't have a type a simple type will be inferred from the value. - -If an arg doesn't have an initial value, it will start unset, although it can still be set later via user interaction. - -Args can be set at the project, component and story level. - -### Using args in an addon - -Args values are automatically synchronized (via the `changeStoryArgs` and `storyArgsChanged` events) between the preview and manager; APIs exist in `lib/api` to read and set args in the manager. - -Args need to be serializable -- so currently cannot include callbacks (this may change in a future version). - -Note that arg values are passed directly to a story -- you should only store the actual value that the story needs to render in the arg. If you need more complex information supporting that, use parameters or addon state. - -Both `@storybook/client-api` (preview) and `@storybook/api` (manager) export a `useArgs()` hook that you can use to access args in decorators or addon panels. The API is as follows: - -```js -import { useArgs } from '@storybook/client-api'; // or '@storybook/api' - -// `args` is the args of the currently rendered story -// `updateArgs` will update its args. You can pass a subset of the args; other args will not be changed. -const [args, updateArgs] = useArgs(); -``` - -## ArgTypes - -Arg types add type information and metadata about args that are used to control the docs and controls addons. - -### ArgTypes enhancement - -To add a argTypes enhancer, `export const argTypesEnhancers = []` from `preview.js` or and addon - -There is a default enhancer that ensures that each `arg` in a story has a baseline `argType`. This value can be improved by subsequent enhancers, e.g. those provided by `@storybook/addon-docs`. - -## Globals - -Globals are rendering information that is global across stories. They are used for things like themes and internationalization (i18n) in stories, where you want Storybook to "remember" your setting as you browse between stories. - -They can be accessed in stories and decorators in the `context.globals` key. - -### Initial values of globals - -To set initial values of globals, `export const globals = {...}` from `preview.js` - -### Using globals in an addon - -Similar to args, globals are synchronized to the manager and can be accessed via the `useGlobals` hook. - -```js -import { useGlobals } from '@storybook/addons'; // or '@storybook/api' - -const [globals, updateGlobals] = useGlobals(); -``` - -## Technical details - -### Initialization - -- The store is created "uninitialized". -- It is assumed at some later time it will be initialized with the Story Index, the set of stories (this may be loaded async). -- You _can_ call `loadStory` prior to that time, in which case it will wait for initialization. - -### Caching - -- "All story" APIs like `extract()` require all stories to be loaded. -- For backwards-compatibility, these APIs are _not_ async, so it is required that `store.cacheAllCSFFiles()` is called first -- In v6 mode, this will be called on initialization but `start.ts`. +This package will no longer be released as part of the 8.0 release of storybook. From 53d7426c1aef0dcf2ed0c40ca82b16b96f68eea9 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Thu, 24 Nov 2022 13:35:47 +0100 Subject: [PATCH 46/47] lockfile fix --- code/yarn.lock | 71 ++++++++++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 31 deletions(-) diff --git a/code/yarn.lock b/code/yarn.lock index 14f55e8cee3..29ce6779093 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -7840,15 +7840,15 @@ __metadata: linkType: hard "@sveltejs/vite-plugin-svelte@npm:^1.0.0": - version: 1.2.0 - resolution: "@sveltejs/vite-plugin-svelte@npm:1.2.0" + version: 1.3.1 + resolution: "@sveltejs/vite-plugin-svelte@npm:1.3.1" dependencies: debug: ^4.3.4 deepmerge: ^4.2.2 kleur: ^4.1.5 magic-string: ^0.26.7 svelte-hmr: ^0.15.1 - vitefu: ^0.2.1 + vitefu: ^0.2.2 peerDependencies: diff-match-patch: ^1.0.5 svelte: ^3.44.0 @@ -7856,7 +7856,7 @@ __metadata: peerDependenciesMeta: diff-match-patch: optional: true - checksum: 48611772657a77c9f762bc6712d343f090e407178a114d144b76b90cad6073dcd7c4f247eac4586306e15caa7ff6a0bcf0a7423e3ec7f211634f43a7282ed453 + checksum: c10695e84a057d96d056082cd77f2c0ae0e88b309cce38fcab76f807674bf0b8b982d805f0c0c5b9dd29996336750c2d414d89cc173de46f6e023384423aaee0 languageName: node linkType: hard @@ -8430,9 +8430,9 @@ __metadata: linkType: hard "@types/lodash@npm:^4.14.167": - version: 4.14.189 - resolution: "@types/lodash@npm:4.14.189" - checksum: af4a0178e52e55682c7fc5b7376eed1e64ce3879800940b1e608e14e97566fcdc9c830bf0db3c19052bfdf17129062fa02044ed4b8a30381fe16384de6ca307e + version: 4.14.190 + resolution: "@types/lodash@npm:4.14.190" + checksum: 512ce560e96bf1090c80bacfcb1b472311a549283efd6009b96c7b9284d8cfaed3950489d0e6ea136930d590dcef65869fe4e9ea94437b2753502fa77fcfd2e6 languageName: node linkType: hard @@ -9015,11 +9015,11 @@ __metadata: linkType: hard "@types/yargs@npm:^17.0.8": - version: 17.0.13 - resolution: "@types/yargs@npm:17.0.13" + version: 17.0.14 + resolution: "@types/yargs@npm:17.0.14" dependencies: "@types/yargs-parser": "*" - checksum: 5005e1e7408b9fea96c356becf19256f1a9bca02120852d3c0089ba7123528b0b6891185e9c92bac25cb5c04090a7a714b201523a6bf4a8a226852205c631208 + checksum: e7a5980bfcee2087a81af7e1dd0b561fe7837051c579aa644e09abc798c6a7456a56062d52cf3217d30e715156ce696b6eaf66539ea56d276e15ee7522a4bf40 languageName: node linkType: hard @@ -12075,17 +12075,17 @@ __metadata: linkType: hard "cacheable-request@npm:^10.2.1": - version: 10.2.2 - resolution: "cacheable-request@npm:10.2.2" + version: 10.2.3 + resolution: "cacheable-request@npm:10.2.3" dependencies: "@types/http-cache-semantics": ^4.0.1 get-stream: ^6.0.1 http-cache-semantics: ^4.1.0 - keyv: ^4.5.0 + keyv: ^4.5.2 mimic-response: ^4.0.0 - normalize-url: ^7.2.0 + normalize-url: ^8.0.0 responselike: ^3.0.0 - checksum: 52ee7cb316b05a03a5e959d26bff724c1b669351a7386bf31603467d3e57b60be9716347b327c8ae1860fcdf40d88377d0af99ef536dfb732a0b1bafebd83ee9 + checksum: 437570efb4fdc511497a6379d801c003ab6aa7e10605fec425177c95fb597c43ceb5fb3614d1f2f56bbe5d7d0467ada7ebbe0f39b4c174f27f1ac296f0db1e46 languageName: node linkType: hard @@ -12467,9 +12467,9 @@ __metadata: linkType: hard "ci-info@npm:^3.2.0": - version: 3.6.1 - resolution: "ci-info@npm:3.6.1" - checksum: 7d5147d627590157b340a795e97b23e20b9633ea34ccc943ef4dfae4ab5cc50b9a83b7e6c513b99f864dc5cca60b4d5fdbfc063381a02730b2bf6cd514af3949 + version: 3.6.2 + resolution: "ci-info@npm:3.6.2" + checksum: 1ed4294b0a02f69622d32247c833db73e5562776d50fda20f9a9c76fe023bf8f428f1dbddb8fe29a17cefd8eccb5a66d4c6fa762b6b0a9414af0f676d051c1ef languageName: node linkType: hard @@ -15032,12 +15032,12 @@ __metadata: linkType: hard "enhanced-resolve@npm:^5.0.0, enhanced-resolve@npm:^5.10.0, enhanced-resolve@npm:^5.7.0": - version: 5.10.0 - resolution: "enhanced-resolve@npm:5.10.0" + version: 5.12.0 + resolution: "enhanced-resolve@npm:5.12.0" dependencies: graceful-fs: ^4.2.4 tapable: ^2.2.0 - checksum: 697c066552dadde9ea8ec7068677711dd5d6c49434b5ff96b2de2068a65060ffca32629abb899a86cca5fcb6b067d88119d1a69c7c2082e3a09c1165f760ad87 + checksum: 5738924cfe3641d04b89c2856fee3d109d7bd71bbe234fb7f54843dda65f293e5f3eee6d5970ced70dbb09016085b961e60d1eb26cac72a21044479954b6cdfd languageName: node linkType: hard @@ -22037,7 +22037,7 @@ __metadata: languageName: node linkType: hard -"keyv@npm:^4.5.0": +"keyv@npm:^4.5.2": version: 4.5.2 resolution: "keyv@npm:4.5.2" dependencies: @@ -24625,10 +24625,10 @@ __metadata: languageName: node linkType: hard -"normalize-url@npm:^7.2.0": - version: 7.2.0 - resolution: "normalize-url@npm:7.2.0" - checksum: d7f76bdd2b9a2ad06036a591cee2ca68794a0cfdc466b0be36f1b26c16963a6fa1627f97c852ef1d933c4ec3361473ea2a37cb8695a930e43f8b443953a2e415 +"normalize-url@npm:^8.0.0": + version: 8.0.0 + resolution: "normalize-url@npm:8.0.0" + checksum: 09582d56acd562d89849d9239852c2aff225c72be726556d6883ff36de50006803d32a023c10e917bcc1c55f73f3bb16434f67992fe9b61906a3db882192753c languageName: node linkType: hard @@ -26695,7 +26695,7 @@ __metadata: languageName: node linkType: hard -"prettier@npm:2.7.1, prettier@npm:^1.18.2 || ^2.0.0, prettier@npm:^2.7.1": +"prettier@npm:2.7.1": version: 2.7.1 resolution: "prettier@npm:2.7.1" bin: @@ -26704,6 +26704,15 @@ __metadata: languageName: node linkType: hard +"prettier@npm:^1.18.2 || ^2.0.0, prettier@npm:^2.7.1": + version: 2.8.0 + resolution: "prettier@npm:2.8.0" + bin: + prettier: bin-prettier.js + checksum: bfb843c82d74e4f79945b7f29c9d5de483bc0f1de8c9f41bbafd7e08dbe71f81e446cbe293681edea60ebec6609d8d0c7e7b7dff52972b54e77784eb687dad1a + languageName: node + linkType: hard + "pretty-bytes@npm:^5.3.0": version: 5.6.0 resolution: "pretty-bytes@npm:5.6.0" @@ -33239,15 +33248,15 @@ __metadata: languageName: node linkType: hard -"vitefu@npm:^0.2.1": - version: 0.2.1 - resolution: "vitefu@npm:0.2.1" +"vitefu@npm:^0.2.2": + version: 0.2.2 + resolution: "vitefu@npm:0.2.2" peerDependencies: vite: ^3.0.0 peerDependenciesMeta: vite: optional: true - checksum: 0258962eecf8261129ad8b6323b96a87f1d9c088715a9c8ecc1fbacdc5539d7b0f1d37548c1bb120c01dd8d49d450524bbfdd97b2fe4b115e04f1c4aecd20a66 + checksum: 0016b133eb78eea71004c4848260848d5c95ec57deba0264f7a49df97753d1850f6ce6846586acb1b1ac3e8dfbd52f5cb6ed42b38fe98293dc0dda7f71242d05 languageName: node linkType: hard From 5091c3a8749088969b8a6f35abacd51500458cd5 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Thu, 24 Nov 2022 13:40:43 +0100 Subject: [PATCH 47/47] fix typing in a test --- code/lib/preview-api/src/modules/store/decorators.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/lib/preview-api/src/modules/store/decorators.test.ts b/code/lib/preview-api/src/modules/store/decorators.test.ts index d8e6b3fb247..889b16fff8a 100644 --- a/code/lib/preview-api/src/modules/store/decorators.test.ts +++ b/code/lib/preview-api/src/modules/store/decorators.test.ts @@ -92,7 +92,7 @@ describe('client-api.decorators', () => { // the same story twice at the same time. it('does not interleave contexts if two decorated stories are call simultaneously', async () => { const contexts: StoryContext[] = []; - let resolve: (value: unknown) => void; + let resolve: (value?: unknown) => void = () => {}; const fence = new Promise((r) => { resolve = r; });