From aab78536e82cf2228f9e260735687e2a2ac9c7c1 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 23 Nov 2022 23:23:10 +0100 Subject: [PATCH 1/6] rename api to manager-api --- code/lib/manager-api-shim/README.md | 16 +++++ code/lib/manager-api-shim/jest.config.js | 7 +++ code/lib/manager-api-shim/package.json | 58 ++++++++++++++++++ code/lib/manager-api-shim/src/entry.ts | 7 +++ code/lib/manager-api-shim/tsconfig.json | 4 ++ code/lib/{api => manager-api}/jest.config.js | 0 code/lib/{api => manager-api}/package.json | 7 ++- code/lib/{api => manager-api}/src/context.ts | 0 code/lib/{api => manager-api}/src/index.tsx | 0 .../{api => manager-api}/src/initial-state.ts | 0 .../{api => manager-api}/src/lib/events.ts | 0 .../lib/{api => manager-api}/src/lib/merge.ts | 0 .../{api => manager-api}/src/lib/shortcut.ts | 0 .../src/lib/store-setup.ts | 0 .../{api => manager-api}/src/lib/stories.ts | 0 .../src/modules/addons.ts | 0 .../src/modules/channel.ts | 0 .../src/modules/globals.ts | 0 .../src/modules/layout.ts | 0 .../src/modules/notifications.ts | 0 .../src/modules/provider.ts | 0 .../{api => manager-api}/src/modules/refs.ts | 0 .../src/modules/release-notes.ts | 0 .../src/modules/settings.ts | 0 .../src/modules/shortcuts.ts | 0 .../src/modules/stories.ts | 0 .../{api => manager-api}/src/modules/url.ts | 0 .../src/modules/versions.ts | 0 code/lib/{api => manager-api}/src/shortcut.ts | 0 code/lib/{api => manager-api}/src/store.ts | 0 .../src/tests/addons.test.js | 0 .../src/tests/events.test.ts | 0 .../src/tests/globals.test.ts | 0 .../src/tests/layout.test.js | 0 .../src/tests/notifications.test.js | 0 .../tests/ref-mockdata.login-required.json | 0 .../src/tests/ref-mockdata.success.json | 0 .../src/tests/refs.test.js | 0 .../src/tests/shortcut.test.js | 0 .../src/tests/shortcuts.test.js | 0 .../src/tests/store.test.js | 0 .../src/tests/stories.test.ts | 0 .../src/tests/url.test.js | 0 .../src/tests/versions.test.js | 0 .../lib/{api => manager-api}/src/typings.d.ts | 0 code/lib/{api => manager-api}/src/version.ts | 0 code/lib/{api => manager-api}/tsconfig.json | 0 code/workspace.json | 7 ++- code/yarn.lock | 61 +++++++++++-------- 49 files changed, 137 insertions(+), 30 deletions(-) create mode 100644 code/lib/manager-api-shim/README.md create mode 100644 code/lib/manager-api-shim/jest.config.js create mode 100644 code/lib/manager-api-shim/package.json create mode 100644 code/lib/manager-api-shim/src/entry.ts create mode 100644 code/lib/manager-api-shim/tsconfig.json rename code/lib/{api => manager-api}/jest.config.js (100%) rename code/lib/{api => manager-api}/package.json (92%) rename code/lib/{api => manager-api}/src/context.ts (100%) rename code/lib/{api => manager-api}/src/index.tsx (100%) rename code/lib/{api => manager-api}/src/initial-state.ts (100%) rename code/lib/{api => manager-api}/src/lib/events.ts (100%) rename code/lib/{api => manager-api}/src/lib/merge.ts (100%) rename code/lib/{api => manager-api}/src/lib/shortcut.ts (100%) rename code/lib/{api => manager-api}/src/lib/store-setup.ts (100%) rename code/lib/{api => manager-api}/src/lib/stories.ts (100%) rename code/lib/{api => manager-api}/src/modules/addons.ts (100%) rename code/lib/{api => manager-api}/src/modules/channel.ts (100%) rename code/lib/{api => manager-api}/src/modules/globals.ts (100%) rename code/lib/{api => manager-api}/src/modules/layout.ts (100%) rename code/lib/{api => manager-api}/src/modules/notifications.ts (100%) rename code/lib/{api => manager-api}/src/modules/provider.ts (100%) rename code/lib/{api => manager-api}/src/modules/refs.ts (100%) rename code/lib/{api => manager-api}/src/modules/release-notes.ts (100%) rename code/lib/{api => manager-api}/src/modules/settings.ts (100%) rename code/lib/{api => manager-api}/src/modules/shortcuts.ts (100%) rename code/lib/{api => manager-api}/src/modules/stories.ts (100%) rename code/lib/{api => manager-api}/src/modules/url.ts (100%) rename code/lib/{api => manager-api}/src/modules/versions.ts (100%) rename code/lib/{api => manager-api}/src/shortcut.ts (100%) rename code/lib/{api => manager-api}/src/store.ts (100%) rename code/lib/{api => manager-api}/src/tests/addons.test.js (100%) rename code/lib/{api => manager-api}/src/tests/events.test.ts (100%) rename code/lib/{api => manager-api}/src/tests/globals.test.ts (100%) rename code/lib/{api => manager-api}/src/tests/layout.test.js (100%) rename code/lib/{api => manager-api}/src/tests/notifications.test.js (100%) rename code/lib/{api => manager-api}/src/tests/ref-mockdata.login-required.json (100%) rename code/lib/{api => manager-api}/src/tests/ref-mockdata.success.json (100%) rename code/lib/{api => manager-api}/src/tests/refs.test.js (100%) rename code/lib/{api => manager-api}/src/tests/shortcut.test.js (100%) rename code/lib/{api => manager-api}/src/tests/shortcuts.test.js (100%) rename code/lib/{api => manager-api}/src/tests/store.test.js (100%) rename code/lib/{api => manager-api}/src/tests/stories.test.ts (100%) rename code/lib/{api => manager-api}/src/tests/url.test.js (100%) rename code/lib/{api => manager-api}/src/tests/versions.test.js (100%) rename code/lib/{api => manager-api}/src/typings.d.ts (100%) rename code/lib/{api => manager-api}/src/version.ts (100%) rename code/lib/{api => manager-api}/tsconfig.json (100%) diff --git a/code/lib/manager-api-shim/README.md b/code/lib/manager-api-shim/README.md new file mode 100644 index 000000000000..fddccb2823db --- /dev/null +++ b/code/lib/manager-api-shim/README.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/manager-api-shim/jest.config.js b/code/lib/manager-api-shim/jest.config.js new file mode 100644 index 000000000000..4396fbc7010d --- /dev/null +++ b/code/lib/manager-api-shim/jest.config.js @@ -0,0 +1,7 @@ +const path = require('path'); +const baseConfig = require('../../jest.config.browser'); + +module.exports = { + ...baseConfig, + displayName: __dirname.split(path.sep).slice(-2).join(path.posix.sep), +}; diff --git a/code/lib/manager-api-shim/package.json b/code/lib/manager-api-shim/package.json new file mode 100644 index 000000000000..e2800fe6d475 --- /dev/null +++ b/code/lib/manager-api-shim/package.json @@ -0,0 +1,58 @@ +{ + "name": "@storybook/api", + "version": "7.0.0-alpha.52", + "description": "Storybook Manager API (facade)", + "keywords": [ + "storybook" + ], + "homepage": "https://github.com/storybookjs/storybook/tree/main/lib/api", + "bugs": { + "url": "https://github.com/storybookjs/storybook/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/storybookjs/storybook.git", + "directory": "code/lib/manager-api-shim" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/storybook" + }, + "license": "MIT", + "sideEffects": false, + "exports": { + ".": { + "require": "./dist/entry.js", + "import": "./dist/entry.mjs", + "types": "./dist/entry.d.ts" + }, + "./package.json": "./package.json" + }, + "main": "dist/entry.js", + "module": "dist/entry.mjs", + "types": "dist/entry.d.ts", + "files": [ + "dist/**/*", + "README.md", + "*.js", + "*.d.ts" + ], + "scripts": { + "check": "../../../scripts/node_modules/.bin/tsc --noEmit", + "prep": "../../../scripts/prepare/facade.ts" + }, + "dependencies": { + "@storybook/client-logger": "7.0.0-alpha.52", + "@storybook/manager-api": "7.0.0-alpha.52" + }, + "publishConfig": { + "access": "public" + }, + "bundler": { + "entries": [ + "./src/entry.ts" + ], + "shim": "@storybook/manager-api" + }, + "gitHead": "d2494e3f51ce0f55bcb1ef693a6477c669fbe666" +} diff --git a/code/lib/manager-api-shim/src/entry.ts b/code/lib/manager-api-shim/src/entry.ts new file mode 100644 index 000000000000..c5528bee29db --- /dev/null +++ b/code/lib/manager-api-shim/src/entry.ts @@ -0,0 +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/manager-api-shim/tsconfig.json b/code/lib/manager-api-shim/tsconfig.json new file mode 100644 index 000000000000..52d43eaaa9b9 --- /dev/null +++ b/code/lib/manager-api-shim/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../../tsconfig.json", + "include": ["src/**/*"] +} diff --git a/code/lib/api/jest.config.js b/code/lib/manager-api/jest.config.js similarity index 100% rename from code/lib/api/jest.config.js rename to code/lib/manager-api/jest.config.js diff --git a/code/lib/api/package.json b/code/lib/manager-api/package.json similarity index 92% rename from code/lib/api/package.json rename to code/lib/manager-api/package.json index 45177466b690..73d7990474f6 100644 --- a/code/lib/api/package.json +++ b/code/lib/manager-api/package.json @@ -1,17 +1,18 @@ { - "name": "@storybook/api", + "name": "@storybook/manager-api", "version": "7.0.0-alpha.52", "description": "Core Storybook API & Context", "keywords": [ "storybook" ], - "homepage": "https://github.com/storybookjs/storybook/tree/main/lib/api", + "homepage": "https://github.com/storybookjs/storybook/tree/main/lib/manager-api", "bugs": { "url": "https://github.com/storybookjs/storybook/issues" }, "repository": { "type": "git", - "url": "https://github.com/storybookjs/storybook.git" + "url": "https://github.com/storybookjs/storybook.git", + "directory": "code/lib/manager-api" }, "funding": { "type": "opencollective", diff --git a/code/lib/api/src/context.ts b/code/lib/manager-api/src/context.ts similarity index 100% rename from code/lib/api/src/context.ts rename to code/lib/manager-api/src/context.ts diff --git a/code/lib/api/src/index.tsx b/code/lib/manager-api/src/index.tsx similarity index 100% rename from code/lib/api/src/index.tsx rename to code/lib/manager-api/src/index.tsx diff --git a/code/lib/api/src/initial-state.ts b/code/lib/manager-api/src/initial-state.ts similarity index 100% rename from code/lib/api/src/initial-state.ts rename to code/lib/manager-api/src/initial-state.ts diff --git a/code/lib/api/src/lib/events.ts b/code/lib/manager-api/src/lib/events.ts similarity index 100% rename from code/lib/api/src/lib/events.ts rename to code/lib/manager-api/src/lib/events.ts diff --git a/code/lib/api/src/lib/merge.ts b/code/lib/manager-api/src/lib/merge.ts similarity index 100% rename from code/lib/api/src/lib/merge.ts rename to code/lib/manager-api/src/lib/merge.ts diff --git a/code/lib/api/src/lib/shortcut.ts b/code/lib/manager-api/src/lib/shortcut.ts similarity index 100% rename from code/lib/api/src/lib/shortcut.ts rename to code/lib/manager-api/src/lib/shortcut.ts diff --git a/code/lib/api/src/lib/store-setup.ts b/code/lib/manager-api/src/lib/store-setup.ts similarity index 100% rename from code/lib/api/src/lib/store-setup.ts rename to code/lib/manager-api/src/lib/store-setup.ts diff --git a/code/lib/api/src/lib/stories.ts b/code/lib/manager-api/src/lib/stories.ts similarity index 100% rename from code/lib/api/src/lib/stories.ts rename to code/lib/manager-api/src/lib/stories.ts diff --git a/code/lib/api/src/modules/addons.ts b/code/lib/manager-api/src/modules/addons.ts similarity index 100% rename from code/lib/api/src/modules/addons.ts rename to code/lib/manager-api/src/modules/addons.ts diff --git a/code/lib/api/src/modules/channel.ts b/code/lib/manager-api/src/modules/channel.ts similarity index 100% rename from code/lib/api/src/modules/channel.ts rename to code/lib/manager-api/src/modules/channel.ts diff --git a/code/lib/api/src/modules/globals.ts b/code/lib/manager-api/src/modules/globals.ts similarity index 100% rename from code/lib/api/src/modules/globals.ts rename to code/lib/manager-api/src/modules/globals.ts diff --git a/code/lib/api/src/modules/layout.ts b/code/lib/manager-api/src/modules/layout.ts similarity index 100% rename from code/lib/api/src/modules/layout.ts rename to code/lib/manager-api/src/modules/layout.ts diff --git a/code/lib/api/src/modules/notifications.ts b/code/lib/manager-api/src/modules/notifications.ts similarity index 100% rename from code/lib/api/src/modules/notifications.ts rename to code/lib/manager-api/src/modules/notifications.ts diff --git a/code/lib/api/src/modules/provider.ts b/code/lib/manager-api/src/modules/provider.ts similarity index 100% rename from code/lib/api/src/modules/provider.ts rename to code/lib/manager-api/src/modules/provider.ts diff --git a/code/lib/api/src/modules/refs.ts b/code/lib/manager-api/src/modules/refs.ts similarity index 100% rename from code/lib/api/src/modules/refs.ts rename to code/lib/manager-api/src/modules/refs.ts diff --git a/code/lib/api/src/modules/release-notes.ts b/code/lib/manager-api/src/modules/release-notes.ts similarity index 100% rename from code/lib/api/src/modules/release-notes.ts rename to code/lib/manager-api/src/modules/release-notes.ts diff --git a/code/lib/api/src/modules/settings.ts b/code/lib/manager-api/src/modules/settings.ts similarity index 100% rename from code/lib/api/src/modules/settings.ts rename to code/lib/manager-api/src/modules/settings.ts diff --git a/code/lib/api/src/modules/shortcuts.ts b/code/lib/manager-api/src/modules/shortcuts.ts similarity index 100% rename from code/lib/api/src/modules/shortcuts.ts rename to code/lib/manager-api/src/modules/shortcuts.ts diff --git a/code/lib/api/src/modules/stories.ts b/code/lib/manager-api/src/modules/stories.ts similarity index 100% rename from code/lib/api/src/modules/stories.ts rename to code/lib/manager-api/src/modules/stories.ts diff --git a/code/lib/api/src/modules/url.ts b/code/lib/manager-api/src/modules/url.ts similarity index 100% rename from code/lib/api/src/modules/url.ts rename to code/lib/manager-api/src/modules/url.ts diff --git a/code/lib/api/src/modules/versions.ts b/code/lib/manager-api/src/modules/versions.ts similarity index 100% rename from code/lib/api/src/modules/versions.ts rename to code/lib/manager-api/src/modules/versions.ts diff --git a/code/lib/api/src/shortcut.ts b/code/lib/manager-api/src/shortcut.ts similarity index 100% rename from code/lib/api/src/shortcut.ts rename to code/lib/manager-api/src/shortcut.ts diff --git a/code/lib/api/src/store.ts b/code/lib/manager-api/src/store.ts similarity index 100% rename from code/lib/api/src/store.ts rename to code/lib/manager-api/src/store.ts diff --git a/code/lib/api/src/tests/addons.test.js b/code/lib/manager-api/src/tests/addons.test.js similarity index 100% rename from code/lib/api/src/tests/addons.test.js rename to code/lib/manager-api/src/tests/addons.test.js diff --git a/code/lib/api/src/tests/events.test.ts b/code/lib/manager-api/src/tests/events.test.ts similarity index 100% rename from code/lib/api/src/tests/events.test.ts rename to code/lib/manager-api/src/tests/events.test.ts diff --git a/code/lib/api/src/tests/globals.test.ts b/code/lib/manager-api/src/tests/globals.test.ts similarity index 100% rename from code/lib/api/src/tests/globals.test.ts rename to code/lib/manager-api/src/tests/globals.test.ts diff --git a/code/lib/api/src/tests/layout.test.js b/code/lib/manager-api/src/tests/layout.test.js similarity index 100% rename from code/lib/api/src/tests/layout.test.js rename to code/lib/manager-api/src/tests/layout.test.js diff --git a/code/lib/api/src/tests/notifications.test.js b/code/lib/manager-api/src/tests/notifications.test.js similarity index 100% rename from code/lib/api/src/tests/notifications.test.js rename to code/lib/manager-api/src/tests/notifications.test.js diff --git a/code/lib/api/src/tests/ref-mockdata.login-required.json b/code/lib/manager-api/src/tests/ref-mockdata.login-required.json similarity index 100% rename from code/lib/api/src/tests/ref-mockdata.login-required.json rename to code/lib/manager-api/src/tests/ref-mockdata.login-required.json diff --git a/code/lib/api/src/tests/ref-mockdata.success.json b/code/lib/manager-api/src/tests/ref-mockdata.success.json similarity index 100% rename from code/lib/api/src/tests/ref-mockdata.success.json rename to code/lib/manager-api/src/tests/ref-mockdata.success.json diff --git a/code/lib/api/src/tests/refs.test.js b/code/lib/manager-api/src/tests/refs.test.js similarity index 100% rename from code/lib/api/src/tests/refs.test.js rename to code/lib/manager-api/src/tests/refs.test.js diff --git a/code/lib/api/src/tests/shortcut.test.js b/code/lib/manager-api/src/tests/shortcut.test.js similarity index 100% rename from code/lib/api/src/tests/shortcut.test.js rename to code/lib/manager-api/src/tests/shortcut.test.js diff --git a/code/lib/api/src/tests/shortcuts.test.js b/code/lib/manager-api/src/tests/shortcuts.test.js similarity index 100% rename from code/lib/api/src/tests/shortcuts.test.js rename to code/lib/manager-api/src/tests/shortcuts.test.js diff --git a/code/lib/api/src/tests/store.test.js b/code/lib/manager-api/src/tests/store.test.js similarity index 100% rename from code/lib/api/src/tests/store.test.js rename to code/lib/manager-api/src/tests/store.test.js diff --git a/code/lib/api/src/tests/stories.test.ts b/code/lib/manager-api/src/tests/stories.test.ts similarity index 100% rename from code/lib/api/src/tests/stories.test.ts rename to code/lib/manager-api/src/tests/stories.test.ts diff --git a/code/lib/api/src/tests/url.test.js b/code/lib/manager-api/src/tests/url.test.js similarity index 100% rename from code/lib/api/src/tests/url.test.js rename to code/lib/manager-api/src/tests/url.test.js diff --git a/code/lib/api/src/tests/versions.test.js b/code/lib/manager-api/src/tests/versions.test.js similarity index 100% rename from code/lib/api/src/tests/versions.test.js rename to code/lib/manager-api/src/tests/versions.test.js diff --git a/code/lib/api/src/typings.d.ts b/code/lib/manager-api/src/typings.d.ts similarity index 100% rename from code/lib/api/src/typings.d.ts rename to code/lib/manager-api/src/typings.d.ts diff --git a/code/lib/api/src/version.ts b/code/lib/manager-api/src/version.ts similarity index 100% rename from code/lib/api/src/version.ts rename to code/lib/manager-api/src/version.ts diff --git a/code/lib/api/tsconfig.json b/code/lib/manager-api/tsconfig.json similarity index 100% rename from code/lib/api/tsconfig.json rename to code/lib/manager-api/tsconfig.json diff --git a/code/workspace.json b/code/workspace.json index 61d9e2ee8920..bcc70e04edaf 100644 --- a/code/workspace.json +++ b/code/workspace.json @@ -96,9 +96,14 @@ "root": "frameworks/angular", "type": "library" }, + "@storybook/manager-api": { + "implicitDependencies": [], + "root": "lib/manager-api", + "type": "library" + }, "@storybook/api": { "implicitDependencies": [], - "root": "lib/api", + "root": "lib/manager-api-shim", "type": "library" }, "@storybook/blocks": { diff --git a/code/yarn.lock b/code/yarn.lock index 957a0413f181..fb23c799b444 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -5773,35 +5773,12 @@ __metadata: languageName: unknown linkType: soft -"@storybook/api@7.0.0-alpha.52, @storybook/api@workspace:*, @storybook/api@workspace:lib/api": +"@storybook/api@7.0.0-alpha.52, @storybook/api@workspace:*, @storybook/api@workspace:lib/manager-api-shim": version: 0.0.0-use.local - resolution: "@storybook/api@workspace:lib/api" + resolution: "@storybook/api@workspace:lib/manager-api-shim" dependencies: - "@storybook/channels": 7.0.0-alpha.52 "@storybook/client-logger": 7.0.0-alpha.52 - "@storybook/core-common": 7.0.0-alpha.52 - "@storybook/core-events": 7.0.0-alpha.52 - "@storybook/csf": next - "@storybook/router": 7.0.0-alpha.52 - "@storybook/theming": 7.0.0-alpha.52 - "@storybook/types": 7.0.0-alpha.52 - "@types/lodash": ^4.14.167 - "@types/qs": ^6 - dequal: ^2.0.2 - flush-promises: ^1.0.2 - global: ^4.4.0 - lodash: ^4.17.21 - memoizerific: ^1.11.3 - qs: ^6.10.1 - semver: ^7.3.7 - store2: ^2.12.0 - telejson: ^6.0.8 - ts-dedent: ^2.0.0 - typescript: ^4.9.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/manager-api": 7.0.0-alpha.52 languageName: unknown linkType: soft @@ -6578,6 +6555,38 @@ __metadata: languageName: node linkType: hard +"@storybook/manager-api@7.0.0-alpha.52, @storybook/manager-api@workspace:lib/manager-api": + version: 0.0.0-use.local + resolution: "@storybook/manager-api@workspace:lib/manager-api" + dependencies: + "@storybook/channels": 7.0.0-alpha.52 + "@storybook/client-logger": 7.0.0-alpha.52 + "@storybook/core-common": 7.0.0-alpha.52 + "@storybook/core-events": 7.0.0-alpha.52 + "@storybook/csf": next + "@storybook/router": 7.0.0-alpha.52 + "@storybook/theming": 7.0.0-alpha.52 + "@storybook/types": 7.0.0-alpha.52 + "@types/lodash": ^4.14.167 + "@types/qs": ^6 + dequal: ^2.0.2 + flush-promises: ^1.0.2 + global: ^4.4.0 + lodash: ^4.17.21 + memoizerific: ^1.11.3 + qs: ^6.10.1 + semver: ^7.3.7 + store2: ^2.12.0 + telejson: ^6.0.8 + ts-dedent: ^2.0.0 + typescript: ^4.9.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 + languageName: unknown + linkType: soft + "@storybook/manager@7.0.0-alpha.52, @storybook/manager@workspace:*, @storybook/manager@workspace:ui/manager": version: 0.0.0-use.local resolution: "@storybook/manager@workspace:ui/manager" From bed649b127a4e48e9ccf6385b40b2603fdf90632 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Wed, 23 Nov 2022 23:29:03 +0100 Subject: [PATCH 2/6] ensure the implementation is actually shimming manager-api, make deprecation message correct --- code/lib/manager-api-shim/src/entry.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/lib/manager-api-shim/src/entry.ts b/code/lib/manager-api-shim/src/entry.ts index c5528bee29db..4f5ca704c1bc 100644 --- a/code/lib/manager-api-shim/src/entry.ts +++ b/code/lib/manager-api-shim/src/entry.ts @@ -1,7 +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' + 'importing from @storybook/api is deprecated and will be removed in 8.0, please import canvas related modules from @storybook/manager-api' ); -export * from '@storybook/preview-api/dist/client-api'; +export * from '@storybook/manager-api'; From adf4799fd4b39c8868d13f3fe26b9e4aabe41dc8 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Thu, 24 Nov 2022 00:02:56 +0100 Subject: [PATCH 3/6] change usage --- code/addons/a11y/package.json | 2 +- .../a11y/src/components/A11YPanel.test.tsx | 4 +- code/addons/a11y/src/components/A11YPanel.tsx | 2 +- .../a11y/src/components/A11yContext.test.tsx | 4 +- .../a11y/src/components/A11yContext.tsx | 2 +- code/addons/a11y/src/manager.test.tsx | 4 +- code/addons/actions/package.json | 2 +- .../src/containers/ActionLogger/index.tsx | 2 +- code/addons/backgrounds/package.json | 2 +- .../src/containers/BackgroundSelector.tsx | 2 +- .../src/containers/GridSelector.tsx | 2 +- code/addons/controls/package.json | 2 +- code/addons/controls/src/ControlsPanel.tsx | 8 ++- code/addons/controls/src/manager.tsx | 2 +- code/addons/essentials/package.json | 2 +- code/addons/interactions/package.json | 2 +- code/addons/interactions/src/Panel.tsx | 2 +- code/addons/jest/package.json | 2 +- .../addons/jest/src/hoc/provideJestResult.tsx | 2 +- code/addons/measure/package.json | 2 +- code/addons/measure/src/Tool.tsx | 2 +- code/addons/outline/package.json | 2 +- code/addons/outline/src/OutlineSelector.tsx | 2 +- code/addons/storysource/package.json | 2 +- code/addons/storysource/src/StoryPanel.tsx | 2 +- code/addons/toolbars/package.json | 2 +- .../src/components/ToolbarManager.tsx | 2 +- .../src/components/ToolbarMenuList.tsx | 2 +- .../toolbars/src/hoc/withKeyboardCycle.tsx | 2 +- .../toolbars/src/utils/register-shortcuts.ts | 2 +- code/addons/viewport/package.json | 2 +- code/addons/viewport/src/Tool.tsx | 2 +- code/addons/viewport/src/shortcuts.ts | 2 +- code/frameworks/angular/package.json | 2 +- .../framework-preset-angular-cli.test.ts | 2 +- code/lib/addons/package.json | 2 +- code/lib/addons/src/main.ts | 2 +- code/lib/builder-webpack5/package.json | 2 +- code/lib/cli/src/versions.ts | 2 +- code/lib/manager-api-shim/src/entry.ts | 2 +- code/lib/preview/package.json | 2 +- code/lib/store/README.md | 6 +- code/package.json | 1 + code/renderers/web-components/package.json | 2 +- code/ui/blocks/package.json | 2 +- code/ui/manager/package.json | 2 +- code/ui/manager/paths.js | 2 +- code/ui/manager/src/app.stories.tsx | 2 +- code/ui/manager/src/app.tsx | 2 +- .../src/components/layout/app.mockdata.tsx | 2 +- .../src/components/layout/container.tsx | 2 +- .../manager/src/components/layout/desktop.tsx | 2 +- .../src/components/layout/mobile.stories.tsx | 2 +- .../manager/src/components/layout/mobile.tsx | 2 +- .../notifications/NotificationItem.tsx | 2 +- .../notifications/NotificationList.tsx | 2 +- .../ui/manager/src/components/panel/panel.tsx | 4 +- .../src/components/preview/FramesRenderer.tsx | 4 +- .../components/preview/preview.mockdata.tsx | 2 +- .../components/preview/preview.stories.tsx | 4 +- .../src/components/preview/preview.tsx | 2 +- .../src/components/preview/toolbar.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/utils/types.tsx | 2 +- .../src/components/sidebar/RefIndicator.tsx | 2 +- .../src/components/sidebar/Refs.stories.tsx | 2 +- .../manager/src/components/sidebar/Refs.tsx | 2 +- .../manager/src/components/sidebar/Search.tsx | 2 +- .../sidebar/SearchResults.stories.tsx | 2 +- .../src/components/sidebar/SearchResults.tsx | 2 +- .../src/components/sidebar/Sidebar.tsx | 2 +- .../src/components/sidebar/Tree.stories.tsx | 2 +- .../manager/src/components/sidebar/Tree.tsx | 4 +- .../sidebar/__tests__/Sidebar.test.tsx | 2 +- .../src/components/sidebar/mockdata.ts | 2 +- .../manager/src/components/sidebar/types.ts | 2 +- .../src/components/sidebar/useExpanded.ts | 4 +- .../src/components/sidebar/useHighlighted.ts | 2 +- .../manager/src/components/sidebar/utils.ts | 2 +- code/ui/manager/src/containers/menu.tsx | 4 +- .../manager/src/containers/notifications.tsx | 4 +- code/ui/manager/src/containers/panel.tsx | 2 +- code/ui/manager/src/containers/preview.tsx | 4 +- code/ui/manager/src/containers/sidebar.tsx | 4 +- code/ui/manager/src/globals/exports.ts | 2 +- code/ui/manager/src/globals/runtime.ts | 4 +- code/ui/manager/src/globals/types.ts | 2 +- code/ui/manager/src/index.tsx | 4 +- code/ui/manager/src/settings/about.tsx | 2 +- code/ui/manager/src/settings/about_page.tsx | 2 +- code/ui/manager/src/settings/index.tsx | 2 +- .../src/settings/release_notes_page.tsx | 2 +- code/ui/manager/src/settings/shortcuts.tsx | 6 +- .../manager/src/settings/shortcuts_page.tsx | 2 +- code/yarn.lock | 59 ++++++++++--------- docs/api/argtypes.md | 2 +- docs/essentials/toolbars-and-globals.md | 4 +- ...addon-consume-and-update-globaltype.js.mdx | 2 +- .../common/addon-consume-globaltype.js.mdx | 2 +- .../common/args-usage-with-addons.js.mdx | 2 +- .../storybook-addon-change-panel.js.mdx | 2 +- .../storybook-addon-panel-example.js.mdx | 2 +- .../storybook-addons-api-useaddonstate.js.mdx | 2 +- .../common/storybook-addons-api-useapi.js.mdx | 2 +- .../storybook-addons-api-useglobal.js.mdx | 2 +- .../storybook-addons-api-useparameter.js.mdx | 2 +- ...rybook-addons-api-usestorybookstate.js.mdx | 2 +- .../storybook-argtypes-with-addon.js.mdx | 2 +- docs/writing-stories/args.md | 2 +- 113 files changed, 169 insertions(+), 157 deletions(-) diff --git a/code/addons/a11y/package.json b/code/addons/a11y/package.json index 2b33b953acbd..1e77f2853e7b 100644 --- a/code/addons/a11y/package.json +++ b/code/addons/a11y/package.json @@ -64,11 +64,11 @@ "dependencies": { "@storybook/addon-highlight": "7.0.0-alpha.52", "@storybook/addons": "7.0.0-alpha.52", - "@storybook/api": "7.0.0-alpha.52", "@storybook/channels": "7.0.0-alpha.52", "@storybook/client-logger": "7.0.0-alpha.52", "@storybook/components": "7.0.0-alpha.52", "@storybook/core-events": "7.0.0-alpha.52", + "@storybook/manager-api": "7.0.0-alpha.52", "@storybook/preview-api": "7.0.0-alpha.52", "@storybook/theming": "7.0.0-alpha.52", "@storybook/types": "7.0.0-alpha.52", diff --git a/code/addons/a11y/src/components/A11YPanel.test.tsx b/code/addons/a11y/src/components/A11YPanel.test.tsx index 395e727f8f5e..4aa43f866eb5 100644 --- a/code/addons/a11y/src/components/A11YPanel.test.tsx +++ b/code/addons/a11y/src/components/A11YPanel.test.tsx @@ -2,12 +2,12 @@ import React from 'react'; import { render, waitFor, fireEvent, act } from '@testing-library/react'; import { ThemeProvider, themes, convert } from '@storybook/theming'; -import * as api from '@storybook/api'; +import * as api from '@storybook/manager-api'; import { A11YPanel } from './A11YPanel'; import { EVENTS } from '../constants'; -jest.mock('@storybook/api'); +jest.mock('@storybook/manager-api'); const mockedApi = api as jest.Mocked; const axeResult = { diff --git a/code/addons/a11y/src/components/A11YPanel.tsx b/code/addons/a11y/src/components/A11YPanel.tsx index 328131e6d59a..7855cd9396ac 100644 --- a/code/addons/a11y/src/components/A11YPanel.tsx +++ b/code/addons/a11y/src/components/A11YPanel.tsx @@ -5,7 +5,7 @@ import { styled } from '@storybook/theming'; import { ActionBar, Icons, ScrollArea } from '@storybook/components'; import type { AxeResults } from 'axe-core'; -import { useChannel, useParameter, useStorybookState } from '@storybook/api'; +import { useChannel, useParameter, useStorybookState } from '@storybook/manager-api'; import { Report } from './Report'; diff --git a/code/addons/a11y/src/components/A11yContext.test.tsx b/code/addons/a11y/src/components/A11yContext.test.tsx index 57d11593f39d..0d7db6e8de46 100644 --- a/code/addons/a11y/src/components/A11yContext.test.tsx +++ b/code/addons/a11y/src/components/A11yContext.test.tsx @@ -1,14 +1,14 @@ import * as React from 'react'; import type { AxeResults } from 'axe-core'; import { render, act } from '@testing-library/react'; -import * as api from '@storybook/api'; +import * as api from '@storybook/manager-api'; import { STORY_CHANGED } from '@storybook/core-events'; import { HIGHLIGHT } from '@storybook/addon-highlight'; import { A11yContextProvider, useA11yContext } from './A11yContext'; import { EVENTS } from '../constants'; -jest.mock('@storybook/api'); +jest.mock('@storybook/manager-api'); const mockedApi = api as jest.Mocked; const storyId = 'jest'; diff --git a/code/addons/a11y/src/components/A11yContext.tsx b/code/addons/a11y/src/components/A11yContext.tsx index a92f9199f13e..fcd2523164bd 100644 --- a/code/addons/a11y/src/components/A11yContext.tsx +++ b/code/addons/a11y/src/components/A11yContext.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { themes, convert } from '@storybook/theming'; import type { Result } from 'axe-core'; -import { useChannel, useAddonState, useStorybookApi } from '@storybook/api'; +import { useChannel, useAddonState, useStorybookApi } from '@storybook/manager-api'; import { STORY_CHANGED, STORY_RENDERED } from '@storybook/core-events'; import { HIGHLIGHT } from '@storybook/addon-highlight'; import { ADDON_ID, EVENTS } from '../constants'; diff --git a/code/addons/a11y/src/manager.test.tsx b/code/addons/a11y/src/manager.test.tsx index ff6c90a44528..241bfbd19697 100644 --- a/code/addons/a11y/src/manager.test.tsx +++ b/code/addons/a11y/src/manager.test.tsx @@ -1,9 +1,9 @@ import { addons } from '@storybook/addons'; -import * as api from '@storybook/api'; +import * as api from '@storybook/manager-api'; import { PANEL_ID } from './constants'; import './manager'; -jest.mock('@storybook/api'); +jest.mock('@storybook/manager-api'); jest.mock('@storybook/addons'); const mockedApi = api as unknown as jest.Mocked; mockedApi.getAddonState = jest.fn(); diff --git a/code/addons/actions/package.json b/code/addons/actions/package.json index bd2d278b8d49..23f7c17fbcbe 100644 --- a/code/addons/actions/package.json +++ b/code/addons/actions/package.json @@ -77,10 +77,10 @@ }, "dependencies": { "@storybook/addons": "7.0.0-alpha.52", - "@storybook/api": "7.0.0-alpha.52", "@storybook/client-logger": "7.0.0-alpha.52", "@storybook/components": "7.0.0-alpha.52", "@storybook/core-events": "7.0.0-alpha.52", + "@storybook/manager-api": "7.0.0-alpha.52", "@storybook/preview-api": "7.0.0-alpha.52", "@storybook/theming": "7.0.0-alpha.52", "@storybook/types": "7.0.0-alpha.52", diff --git a/code/addons/actions/src/containers/ActionLogger/index.tsx b/code/addons/actions/src/containers/ActionLogger/index.tsx index 3cf1cc3d05dc..4c193972ef73 100644 --- a/code/addons/actions/src/containers/ActionLogger/index.tsx +++ b/code/addons/actions/src/containers/ActionLogger/index.tsx @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import { dequal as deepEqual } from 'dequal'; -import type { API } from '@storybook/api'; +import type { API } from '@storybook/manager-api'; import { STORY_CHANGED } from '@storybook/core-events'; import { ActionLogger as ActionLoggerComponent } from '../../components/ActionLogger'; diff --git a/code/addons/backgrounds/package.json b/code/addons/backgrounds/package.json index a5f98ca7f5ce..af5845acd4fd 100644 --- a/code/addons/backgrounds/package.json +++ b/code/addons/backgrounds/package.json @@ -76,10 +76,10 @@ }, "dependencies": { "@storybook/addons": "7.0.0-alpha.52", - "@storybook/api": "7.0.0-alpha.52", "@storybook/client-logger": "7.0.0-alpha.52", "@storybook/components": "7.0.0-alpha.52", "@storybook/core-events": "7.0.0-alpha.52", + "@storybook/manager-api": "7.0.0-alpha.52", "@storybook/preview-api": "7.0.0-alpha.52", "@storybook/theming": "7.0.0-alpha.52", "@storybook/types": "7.0.0-alpha.52", diff --git a/code/addons/backgrounds/src/containers/BackgroundSelector.tsx b/code/addons/backgrounds/src/containers/BackgroundSelector.tsx index a9814f0e8353..ef1d9c1caed5 100644 --- a/code/addons/backgrounds/src/containers/BackgroundSelector.tsx +++ b/code/addons/backgrounds/src/containers/BackgroundSelector.tsx @@ -2,7 +2,7 @@ import type { FC } from 'react'; import React, { Fragment, useCallback, useMemo, memo } from 'react'; import memoize from 'memoizerific'; -import { useParameter, useGlobals } from '@storybook/api'; +import { useParameter, useGlobals } from '@storybook/manager-api'; import { logger } from '@storybook/client-logger'; import { Icons, IconButton, WithTooltip, TooltipLinkList } from '@storybook/components'; diff --git a/code/addons/backgrounds/src/containers/GridSelector.tsx b/code/addons/backgrounds/src/containers/GridSelector.tsx index ef3aaaf48b45..80d6477884b4 100644 --- a/code/addons/backgrounds/src/containers/GridSelector.tsx +++ b/code/addons/backgrounds/src/containers/GridSelector.tsx @@ -1,7 +1,7 @@ import type { FC } from 'react'; import React, { memo } from 'react'; -import { useGlobals, useParameter } from '@storybook/api'; +import { useGlobals, useParameter } from '@storybook/manager-api'; import { Icons, IconButton } from '@storybook/components'; import { PARAM_KEY as BACKGROUNDS_PARAM_KEY } from '../constants'; diff --git a/code/addons/controls/package.json b/code/addons/controls/package.json index 728a77a91581..2c5685e145a2 100644 --- a/code/addons/controls/package.json +++ b/code/addons/controls/package.json @@ -68,11 +68,11 @@ }, "dependencies": { "@storybook/addons": "7.0.0-alpha.52", - "@storybook/api": "7.0.0-alpha.52", "@storybook/blocks": "7.0.0-alpha.52", "@storybook/client-logger": "7.0.0-alpha.52", "@storybook/components": "7.0.0-alpha.52", "@storybook/core-common": "7.0.0-alpha.52", + "@storybook/manager-api": "7.0.0-alpha.52", "@storybook/node-logger": "7.0.0-alpha.52", "@storybook/preview-api": "7.0.0-alpha.52", "@storybook/theming": "7.0.0-alpha.52", diff --git a/code/addons/controls/src/ControlsPanel.tsx b/code/addons/controls/src/ControlsPanel.tsx index 802ec94c5373..06c4e9bbbd24 100644 --- a/code/addons/controls/src/ControlsPanel.tsx +++ b/code/addons/controls/src/ControlsPanel.tsx @@ -1,6 +1,12 @@ import type { FC } from 'react'; import React from 'react'; -import { useArgs, useGlobals, useArgTypes, useParameter, useStorybookState } from '@storybook/api'; +import { + useArgs, + useGlobals, + useArgTypes, + useParameter, + useStorybookState, +} from '@storybook/manager-api'; import { PureArgsTable as ArgsTable, NoControlsWarning, diff --git a/code/addons/controls/src/manager.tsx b/code/addons/controls/src/manager.tsx index 38a3b31314f5..430dadd56432 100644 --- a/code/addons/controls/src/manager.tsx +++ b/code/addons/controls/src/manager.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { addons, types } from '@storybook/addons'; import { AddonPanel } from '@storybook/components'; -import { type API, useArgTypes } from '@storybook/api'; +import { type API, useArgTypes } from '@storybook/manager-api'; import { ControlsPanel } from './ControlsPanel'; import { ADDON_ID, PARAM_KEY } from './constants'; diff --git a/code/addons/essentials/package.json b/code/addons/essentials/package.json index 0ae26e5cdfa1..375ee318efc8 100644 --- a/code/addons/essentials/package.json +++ b/code/addons/essentials/package.json @@ -121,8 +121,8 @@ "@storybook/addon-toolbars": "7.0.0-alpha.52", "@storybook/addon-viewport": "7.0.0-alpha.52", "@storybook/addons": "7.0.0-alpha.52", - "@storybook/api": "7.0.0-alpha.52", "@storybook/core-common": "7.0.0-alpha.52", + "@storybook/manager-api": "7.0.0-alpha.52", "@storybook/node-logger": "7.0.0-alpha.52", "@storybook/preview-api": "7.0.0-alpha.52", "ts-dedent": "^2.0.0" diff --git a/code/addons/interactions/package.json b/code/addons/interactions/package.json index aa925427d6b5..22cf382a56eb 100644 --- a/code/addons/interactions/package.json +++ b/code/addons/interactions/package.json @@ -73,12 +73,12 @@ "dependencies": { "@devtools-ds/object-inspector": "^1.1.2", "@storybook/addons": "7.0.0-alpha.52", - "@storybook/api": "7.0.0-alpha.52", "@storybook/client-logger": "7.0.0-alpha.52", "@storybook/components": "7.0.0-alpha.52", "@storybook/core-common": "7.0.0-alpha.52", "@storybook/core-events": "7.0.0-alpha.52", "@storybook/instrumenter": "7.0.0-alpha.52", + "@storybook/manager-api": "7.0.0-alpha.52", "@storybook/preview-api": "7.0.0-alpha.52", "@storybook/theming": "7.0.0-alpha.52", "@storybook/types": "7.0.0-alpha.52", diff --git a/code/addons/interactions/src/Panel.tsx b/code/addons/interactions/src/Panel.tsx index 1130de8f59f4..e4df36d5474c 100644 --- a/code/addons/interactions/src/Panel.tsx +++ b/code/addons/interactions/src/Panel.tsx @@ -1,6 +1,6 @@ import global from 'global'; import * as React from 'react'; -import { useChannel, useParameter } from '@storybook/api'; +import { useChannel, useParameter } from '@storybook/manager-api'; import { FORCE_REMOUNT, IGNORED_EXCEPTION, diff --git a/code/addons/jest/package.json b/code/addons/jest/package.json index 76af42737353..35decb9b7b83 100644 --- a/code/addons/jest/package.json +++ b/code/addons/jest/package.json @@ -70,10 +70,10 @@ }, "dependencies": { "@storybook/addons": "7.0.0-alpha.52", - "@storybook/api": "7.0.0-alpha.52", "@storybook/client-logger": "7.0.0-alpha.52", "@storybook/components": "7.0.0-alpha.52", "@storybook/core-events": "7.0.0-alpha.52", + "@storybook/manager-api": "7.0.0-alpha.52", "@storybook/preview-api": "7.0.0-alpha.52", "@storybook/theming": "7.0.0-alpha.52", "global": "^4.4.0", diff --git a/code/addons/jest/src/hoc/provideJestResult.tsx b/code/addons/jest/src/hoc/provideJestResult.tsx index a992c898598d..d74f100c7acb 100644 --- a/code/addons/jest/src/hoc/provideJestResult.tsx +++ b/code/addons/jest/src/hoc/provideJestResult.tsx @@ -1,7 +1,7 @@ import type { ComponentType } from 'react'; import React, { Component as ReactComponent } from 'react'; import { STORY_CHANGED } from '@storybook/core-events'; -import type { API } from '@storybook/api'; +import type { API } from '@storybook/manager-api'; import { ADD_TESTS } from '../shared'; // TODO: import type from @types/jest diff --git a/code/addons/measure/package.json b/code/addons/measure/package.json index acdc5c5d9f7b..7f3fa2ca2201 100644 --- a/code/addons/measure/package.json +++ b/code/addons/measure/package.json @@ -75,10 +75,10 @@ }, "dependencies": { "@storybook/addons": "7.0.0-alpha.52", - "@storybook/api": "7.0.0-alpha.52", "@storybook/client-logger": "7.0.0-alpha.52", "@storybook/components": "7.0.0-alpha.52", "@storybook/core-events": "7.0.0-alpha.52", + "@storybook/manager-api": "7.0.0-alpha.52", "@storybook/preview-api": "7.0.0-alpha.52", "@storybook/types": "7.0.0-alpha.52", "global": "^4.4.0" diff --git a/code/addons/measure/src/Tool.tsx b/code/addons/measure/src/Tool.tsx index 86edabf47e46..2e68078aa06b 100644 --- a/code/addons/measure/src/Tool.tsx +++ b/code/addons/measure/src/Tool.tsx @@ -1,5 +1,5 @@ import React, { useCallback, useEffect } from 'react'; -import { useGlobals, useStorybookApi } from '@storybook/api'; +import { useGlobals, useStorybookApi } from '@storybook/manager-api'; import { Icons, IconButton } from '@storybook/components'; import { TOOL_ID, ADDON_ID } from './constants'; diff --git a/code/addons/outline/package.json b/code/addons/outline/package.json index fdc6728f2216..7df54616d88b 100644 --- a/code/addons/outline/package.json +++ b/code/addons/outline/package.json @@ -78,10 +78,10 @@ }, "dependencies": { "@storybook/addons": "7.0.0-alpha.52", - "@storybook/api": "7.0.0-alpha.52", "@storybook/client-logger": "7.0.0-alpha.52", "@storybook/components": "7.0.0-alpha.52", "@storybook/core-events": "7.0.0-alpha.52", + "@storybook/manager-api": "7.0.0-alpha.52", "@storybook/preview-api": "7.0.0-alpha.52", "@storybook/types": "7.0.0-alpha.52", "global": "^4.4.0", diff --git a/code/addons/outline/src/OutlineSelector.tsx b/code/addons/outline/src/OutlineSelector.tsx index e8d6ac3f483a..cf597ec2b2f4 100644 --- a/code/addons/outline/src/OutlineSelector.tsx +++ b/code/addons/outline/src/OutlineSelector.tsx @@ -1,5 +1,5 @@ import React, { memo, useCallback, useEffect } from 'react'; -import { useGlobals, useStorybookApi } from '@storybook/api'; +import { useGlobals, useStorybookApi } from '@storybook/manager-api'; import { Icons, IconButton } from '@storybook/components'; import { ADDON_ID, PARAM_KEY } from './constants'; diff --git a/code/addons/storysource/package.json b/code/addons/storysource/package.json index f23ebeb66574..698b3cce7336 100644 --- a/code/addons/storysource/package.json +++ b/code/addons/storysource/package.json @@ -54,9 +54,9 @@ }, "dependencies": { "@storybook/addons": "7.0.0-alpha.52", - "@storybook/api": "7.0.0-alpha.52", "@storybook/client-logger": "7.0.0-alpha.52", "@storybook/components": "7.0.0-alpha.52", + "@storybook/manager-api": "7.0.0-alpha.52", "@storybook/preview-api": "7.0.0-alpha.52", "@storybook/router": "7.0.0-alpha.52", "@storybook/source-loader": "7.0.0-alpha.52", diff --git a/code/addons/storysource/src/StoryPanel.tsx b/code/addons/storysource/src/StoryPanel.tsx index cab19ad176a5..33356fb735ef 100644 --- a/code/addons/storysource/src/StoryPanel.tsx +++ b/code/addons/storysource/src/StoryPanel.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { type API, useParameter } from '@storybook/api'; +import { type API, useParameter } from '@storybook/manager-api'; import { styled } from '@storybook/theming'; import { Link } from '@storybook/router'; import { diff --git a/code/addons/toolbars/package.json b/code/addons/toolbars/package.json index 5a06d7b6f609..6d28fa1e9386 100644 --- a/code/addons/toolbars/package.json +++ b/code/addons/toolbars/package.json @@ -68,9 +68,9 @@ }, "dependencies": { "@storybook/addons": "7.0.0-alpha.52", - "@storybook/api": "7.0.0-alpha.52", "@storybook/client-logger": "7.0.0-alpha.52", "@storybook/components": "7.0.0-alpha.52", + "@storybook/manager-api": "7.0.0-alpha.52", "@storybook/preview-api": "7.0.0-alpha.52", "@storybook/theming": "7.0.0-alpha.52" }, diff --git a/code/addons/toolbars/src/components/ToolbarManager.tsx b/code/addons/toolbars/src/components/ToolbarManager.tsx index a02673ba32e2..f5a6d8e0aba4 100644 --- a/code/addons/toolbars/src/components/ToolbarManager.tsx +++ b/code/addons/toolbars/src/components/ToolbarManager.tsx @@ -1,6 +1,6 @@ import type { FC } from 'react'; import React from 'react'; -import { useGlobalTypes } from '@storybook/api'; +import { useGlobalTypes } from '@storybook/manager-api'; import { Separator } from '@storybook/components'; import { ToolbarMenuList } from './ToolbarMenuList'; import { normalizeArgType } from '../utils/normalize-toolbar-arg-type'; diff --git a/code/addons/toolbars/src/components/ToolbarMenuList.tsx b/code/addons/toolbars/src/components/ToolbarMenuList.tsx index bc7561c15797..55a3d4358d14 100644 --- a/code/addons/toolbars/src/components/ToolbarMenuList.tsx +++ b/code/addons/toolbars/src/components/ToolbarMenuList.tsx @@ -1,6 +1,6 @@ import type { FC, ReactNode } from 'react'; import React, { useCallback } from 'react'; -import { useGlobals } from '@storybook/api'; +import { useGlobals } from '@storybook/manager-api'; import { deprecate } from '@storybook/client-logger'; import { WithTooltip, TooltipLinkList } from '@storybook/components'; import { ToolbarMenuButton } from './ToolbarMenuButton'; diff --git a/code/addons/toolbars/src/hoc/withKeyboardCycle.tsx b/code/addons/toolbars/src/hoc/withKeyboardCycle.tsx index d95676018683..9ddb37f0df1b 100644 --- a/code/addons/toolbars/src/hoc/withKeyboardCycle.tsx +++ b/code/addons/toolbars/src/hoc/withKeyboardCycle.tsx @@ -1,5 +1,5 @@ import React, { useRef, useEffect, useCallback } from 'react'; -import { useGlobals, useStorybookApi } from '@storybook/api'; +import { useGlobals, useStorybookApi } from '@storybook/manager-api'; import { createCycleValueArray } from '../utils/create-cycle-value-array'; import { registerShortcuts } from '../utils/register-shortcuts'; import type { ToolbarMenuProps } from '../types'; diff --git a/code/addons/toolbars/src/utils/register-shortcuts.ts b/code/addons/toolbars/src/utils/register-shortcuts.ts index c7db90a441c2..2b91e2dae74a 100644 --- a/code/addons/toolbars/src/utils/register-shortcuts.ts +++ b/code/addons/toolbars/src/utils/register-shortcuts.ts @@ -1,4 +1,4 @@ -import type { API } from '@storybook/api'; +import type { API } from '@storybook/manager-api'; import { ADDON_ID } from '../constants'; import type { ToolbarShortcutConfig } from '../types'; diff --git a/code/addons/viewport/package.json b/code/addons/viewport/package.json index f700d133ae0f..3a4f1d433d8c 100644 --- a/code/addons/viewport/package.json +++ b/code/addons/viewport/package.json @@ -73,10 +73,10 @@ }, "dependencies": { "@storybook/addons": "7.0.0-alpha.52", - "@storybook/api": "7.0.0-alpha.52", "@storybook/client-logger": "7.0.0-alpha.52", "@storybook/components": "7.0.0-alpha.52", "@storybook/core-events": "7.0.0-alpha.52", + "@storybook/manager-api": "7.0.0-alpha.52", "@storybook/preview-api": "7.0.0-alpha.52", "@storybook/theming": "7.0.0-alpha.52", "global": "^4.4.0", diff --git a/code/addons/viewport/src/Tool.tsx b/code/addons/viewport/src/Tool.tsx index 19544abb3b01..10c2a4dfadd0 100644 --- a/code/addons/viewport/src/Tool.tsx +++ b/code/addons/viewport/src/Tool.tsx @@ -7,7 +7,7 @@ import { styled, Global, type Theme, withTheme } from '@storybook/theming'; import { Icons, IconButton, WithTooltip, TooltipLinkList } from '@storybook/components'; -import { useStorybookApi, useParameter, useAddonState } from '@storybook/api'; +import { useStorybookApi, useParameter, useAddonState } from '@storybook/manager-api'; import { registerShortcuts } from './shortcuts'; import { PARAM_KEY, ADDON_ID } from './constants'; import { MINIMAL_VIEWPORTS } from './defaults'; diff --git a/code/addons/viewport/src/shortcuts.ts b/code/addons/viewport/src/shortcuts.ts index 6e9b7302b1c1..39cff92af12b 100644 --- a/code/addons/viewport/src/shortcuts.ts +++ b/code/addons/viewport/src/shortcuts.ts @@ -1,4 +1,4 @@ -import type { API } from '@storybook/api'; +import type { API } from '@storybook/manager-api'; import { ADDON_ID } from './constants'; type State = { diff --git a/code/frameworks/angular/package.json b/code/frameworks/angular/package.json index bc9f9e2bcbd3..84c7e86fa6bf 100644 --- a/code/frameworks/angular/package.json +++ b/code/frameworks/angular/package.json @@ -35,7 +35,6 @@ }, "dependencies": { "@storybook/addons": "7.0.0-alpha.52", - "@storybook/api": "7.0.0-alpha.52", "@storybook/builder-webpack5": "7.0.0-alpha.52", "@storybook/client-logger": "7.0.0-alpha.52", "@storybook/core-client": "7.0.0-alpha.52", @@ -44,6 +43,7 @@ "@storybook/core-server": "7.0.0-alpha.52", "@storybook/core-webpack": "7.0.0-alpha.52", "@storybook/docs-tools": "7.0.0-alpha.52", + "@storybook/manager-api": "7.0.0-alpha.52", "@storybook/node-logger": "7.0.0-alpha.52", "@storybook/preview-api": "7.0.0-alpha.52", "@storybook/types": "7.0.0-alpha.52", 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 c7b933627f66..6dfbdd7123bd 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 @@ -816,7 +816,7 @@ const newWebpackConfiguration = ( mainFields: ['browser', 'main'], alias: { '@storybook/preview-api': '/Users/joe/storybook/lib/addons', - '@storybook/api': '/Users/joe/storybook/lib/api', + '@storybook/manager-api': '/Users/joe/storybook/lib/api', '@storybook/channels': '/Users/joe/storybook/lib/channels', '@storybook/channel-postmessage': '/Users/joe/storybook/lib/channel-postmessage', '@storybook/components': '/Users/joe/storybook/ui/components', diff --git a/code/lib/addons/package.json b/code/lib/addons/package.json index 6c16a0e7208a..225e981c0f85 100644 --- a/code/lib/addons/package.json +++ b/code/lib/addons/package.json @@ -42,10 +42,10 @@ "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { - "@storybook/api": "7.0.0-alpha.52", "@storybook/channels": "7.0.0-alpha.52", "@storybook/client-logger": "7.0.0-alpha.52", "@storybook/core-events": "7.0.0-alpha.52", + "@storybook/manager-api": "7.0.0-alpha.52", "@storybook/router": "7.0.0-alpha.52", "@storybook/theming": "7.0.0-alpha.52", "@storybook/types": "7.0.0-alpha.52", diff --git a/code/lib/addons/src/main.ts b/code/lib/addons/src/main.ts index d2d5a6145c38..a4f4e8d06bd8 100644 --- a/code/lib/addons/src/main.ts +++ b/code/lib/addons/src/main.ts @@ -2,7 +2,7 @@ import global from 'global'; import type { Channel } from '@storybook/channels'; import { SET_CONFIG } from '@storybook/core-events'; -import type { API } from '@storybook/api'; +import type { API } from '@storybook/manager-api'; import type { Addon_Collection, Addon_Config, diff --git a/code/lib/builder-webpack5/package.json b/code/lib/builder-webpack5/package.json index bab7c898787c..69607a4e950a 100644 --- a/code/lib/builder-webpack5/package.json +++ b/code/lib/builder-webpack5/package.json @@ -55,7 +55,6 @@ "dependencies": { "@babel/core": "^7.12.10", "@storybook/addons": "7.0.0-alpha.52", - "@storybook/api": "7.0.0-alpha.52", "@storybook/channel-postmessage": "7.0.0-alpha.52", "@storybook/channel-websocket": "7.0.0-alpha.52", "@storybook/channels": "7.0.0-alpha.52", @@ -65,6 +64,7 @@ "@storybook/core-common": "7.0.0-alpha.52", "@storybook/core-events": "7.0.0-alpha.52", "@storybook/core-webpack": "7.0.0-alpha.52", + "@storybook/manager-api": "7.0.0-alpha.52", "@storybook/node-logger": "7.0.0-alpha.52", "@storybook/preview": "7.0.0-alpha.52", "@storybook/preview-api": "7.0.0-alpha.52", diff --git a/code/lib/cli/src/versions.ts b/code/lib/cli/src/versions.ts index 56428f6786e9..f4e7ccb75d33 100644 --- a/code/lib/cli/src/versions.ts +++ b/code/lib/cli/src/versions.ts @@ -19,7 +19,7 @@ export default { '@storybook/addon-viewport': '7.0.0-alpha.52', '@storybook/addons': '7.0.0-alpha.52', '@storybook/angular': '7.0.0-alpha.52', - '@storybook/api': '7.0.0-alpha.52', + '@storybook/manager-api': '7.0.0-alpha.52', '@storybook/blocks': '7.0.0-alpha.52', '@storybook/builder-manager': '7.0.0-alpha.52', '@storybook/builder-vite': '7.0.0-alpha.52', diff --git a/code/lib/manager-api-shim/src/entry.ts b/code/lib/manager-api-shim/src/entry.ts index 4f5ca704c1bc..aa1313db0d8e 100644 --- a/code/lib/manager-api-shim/src/entry.ts +++ b/code/lib/manager-api-shim/src/entry.ts @@ -1,7 +1,7 @@ import { deprecate } from '@storybook/client-logger'; deprecate( - 'importing from @storybook/api is deprecated and will be removed in 8.0, please import canvas related modules from @storybook/manager-api' + 'importing from @storybook/manager-api is deprecated and will be removed in 8.0, please import canvas related modules from @storybook/manager-api' ); export * from '@storybook/manager-api'; diff --git a/code/lib/preview/package.json b/code/lib/preview/package.json index 4a78360ebd79..6de20d60faa1 100644 --- a/code/lib/preview/package.json +++ b/code/lib/preview/package.json @@ -62,7 +62,6 @@ "shelljs": "^0.8.5" }, "devDependencies": { - "@storybook/api": "7.0.0-alpha.52", "@storybook/channel-postmessage": "7.0.0-alpha.52", "@storybook/channel-websocket": "7.0.0-alpha.52", "@storybook/channels": "7.0.0-alpha.52", @@ -70,6 +69,7 @@ "@storybook/core-common": "7.0.0-alpha.52", "@storybook/core-events": "7.0.0-alpha.52", "@storybook/csf": "next", + "@storybook/manager-api": "7.0.0-alpha.52", "@storybook/preview-api": "7.0.0-alpha.52", "@storybook/router": "7.0.0-alpha.52", "@storybook/theming": "7.0.0-alpha.52", diff --git a/code/lib/store/README.md b/code/lib/store/README.md index 83e9b9b4b513..bcd39ae8a940 100644 --- a/code/lib/store/README.md +++ b/code/lib/store/README.md @@ -81,10 +81,10 @@ Args need to be serializable -- so currently cannot include callbacks (this may 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: +Both `@storybook/client-api` (preview) and `@storybook/manager-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' +import { useArgs } from '@storybook/client-api'; // or '@storybook/manager-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. @@ -116,7 +116,7 @@ To set initial values of globals, `export const globals = {...}` from `preview.j 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' +import { useGlobals } from '@storybook/addons'; // or '@storybook/manager-api' const [globals, updateGlobals] = useGlobals(); ``` diff --git a/code/package.json b/code/package.json index 369938eaa658..6eccea188da9 100644 --- a/code/package.json +++ b/code/package.json @@ -196,6 +196,7 @@ "@storybook/jest": "^0.0.10", "@storybook/linter-config": "^2.5.0", "@storybook/manager": "workspace:*", + "@storybook/manager-api": "workspace:*", "@storybook/nextjs": "workspace:*", "@storybook/node-logger": "workspace:*", "@storybook/postinstall": "workspace:*", diff --git a/code/renderers/web-components/package.json b/code/renderers/web-components/package.json index 7134a21bef81..7dbbd7d0fdef 100644 --- a/code/renderers/web-components/package.json +++ b/code/renderers/web-components/package.json @@ -54,10 +54,10 @@ }, "dependencies": { "@storybook/addons": "7.0.0-alpha.52", - "@storybook/api": "7.0.0-alpha.52", "@storybook/client-logger": "7.0.0-alpha.52", "@storybook/core-client": "7.0.0-alpha.52", "@storybook/docs-tools": "7.0.0-alpha.52", + "@storybook/manager-api": "7.0.0-alpha.52", "@storybook/preview-api": "7.0.0-alpha.52", "@storybook/types": "7.0.0-alpha.52", "global": "^4.4.0", diff --git a/code/ui/blocks/package.json b/code/ui/blocks/package.json index 46e7f69be8f9..619381e65185 100644 --- a/code/ui/blocks/package.json +++ b/code/ui/blocks/package.json @@ -42,13 +42,13 @@ "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { - "@storybook/api": "7.0.0-alpha.52", "@storybook/channels": "7.0.0-alpha.52", "@storybook/client-logger": "7.0.0-alpha.52", "@storybook/components": "7.0.0-alpha.52", "@storybook/core-events": "7.0.0-alpha.52", "@storybook/csf": "next", "@storybook/docs-tools": "7.0.0-alpha.52", + "@storybook/manager-api": "7.0.0-alpha.52", "@storybook/preview-api": "7.0.0-alpha.52", "@storybook/theming": "7.0.0-alpha.52", "@storybook/types": "7.0.0-alpha.52", diff --git a/code/ui/manager/package.json b/code/ui/manager/package.json index c90d41852866..7f82a212d832 100644 --- a/code/ui/manager/package.json +++ b/code/ui/manager/package.json @@ -54,13 +54,13 @@ "devDependencies": { "@fal-works/esbuild-plugin-global-externals": "^2.1.2", "@storybook/addons": "7.0.0-alpha.52", - "@storybook/api": "7.0.0-alpha.52", "@storybook/channel-postmessage": "7.0.0-alpha.52", "@storybook/channel-websocket": "7.0.0-alpha.52", "@storybook/channels": "7.0.0-alpha.52", "@storybook/client-logger": "7.0.0-alpha.52", "@storybook/components": "7.0.0-alpha.52", "@storybook/core-events": "7.0.0-alpha.52", + "@storybook/manager-api": "7.0.0-alpha.52", "@storybook/preview-api": "7.0.0-alpha.52", "@storybook/router": "7.0.0-alpha.52", "@storybook/theming": "7.0.0-alpha.52", diff --git a/code/ui/manager/paths.js b/code/ui/manager/paths.js index 2e5037b0301c..099ee75a6cad 100644 --- a/code/ui/manager/paths.js +++ b/code/ui/manager/paths.js @@ -7,7 +7,7 @@ const resolve = resolveFrom.bind(null, __dirname); // code running inside the manager uses the *same* version of react[-dom] that we use. module.exports = { '@storybook/preview-api': dirname(resolve('@storybook/preview-api/package.json')), - '@storybook/api': dirname(resolve('@storybook/api/package.json')), + '@storybook/manager-api': dirname(resolve('@storybook/manager-api/package.json')), '@storybook/channels': dirname(resolve('@storybook/channels/package.json')), '@storybook/components': dirname(resolve('@storybook/components/package.json')), '@storybook/core-events': dirname(resolve('@storybook/core-events/package.json')), diff --git a/code/ui/manager/src/app.stories.tsx b/code/ui/manager/src/app.stories.tsx index bd2e737eb26a..f55af04a6560 100644 --- a/code/ui/manager/src/app.stories.tsx +++ b/code/ui/manager/src/app.stories.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import { Provider as ManagerProvider } from '@storybook/api'; +import { Provider as ManagerProvider } from '@storybook/manager-api'; import { LocationProvider } from '@storybook/router'; import { HelmetProvider } from 'react-helmet-async'; import { styled } from '@storybook/theming'; diff --git a/code/ui/manager/src/app.tsx b/code/ui/manager/src/app.tsx index 312560a33ac1..3efac0841ee8 100644 --- a/code/ui/manager/src/app.tsx +++ b/code/ui/manager/src/app.tsx @@ -2,7 +2,7 @@ import type { FC } from 'react'; import React, { useMemo } from 'react'; import sizeMe from 'react-sizeme'; -import { type State } from '@storybook/api'; +import { type State } from '@storybook/manager-api'; import { Symbols } from '@storybook/components'; import { Route } from '@storybook/router'; import { Global, createGlobal, styled } from '@storybook/theming'; diff --git a/code/ui/manager/src/components/layout/app.mockdata.tsx b/code/ui/manager/src/components/layout/app.mockdata.tsx index 8cb1a9605516..cb40a43eb1d2 100644 --- a/code/ui/manager/src/components/layout/app.mockdata.tsx +++ b/code/ui/manager/src/components/layout/app.mockdata.tsx @@ -3,7 +3,7 @@ import type { FC } from 'react'; import React, { Component } from 'react'; import { styled } from '@storybook/theming'; import type { Addon_Collection } from '@storybook/types'; -import type { State } from '@storybook/api'; +import type { State } from '@storybook/manager-api'; import type { SidebarProps } from '../sidebar/Sidebar'; import { Sidebar } from '../sidebar/Sidebar'; import Panel from '../panel/panel'; diff --git a/code/ui/manager/src/components/layout/container.tsx b/code/ui/manager/src/components/layout/container.tsx index 30a7673cad97..e65de7bd71fe 100644 --- a/code/ui/manager/src/components/layout/container.tsx +++ b/code/ui/manager/src/components/layout/container.tsx @@ -2,7 +2,7 @@ import type { FC, CSSProperties, ReactNode } from 'react'; import React, { Component, Fragment } from 'react'; import { styled, withTheme } from '@storybook/theming'; import type { Theme } from '@storybook/theming'; -import type { State } from '@storybook/api'; +import type { State } from '@storybook/manager-api'; import * as persistence from './persist'; import type { DraggableData, DraggableEvent } from './draggers'; diff --git a/code/ui/manager/src/components/layout/desktop.tsx b/code/ui/manager/src/components/layout/desktop.tsx index 722d55fea442..2ff78c25d149 100644 --- a/code/ui/manager/src/components/layout/desktop.tsx +++ b/code/ui/manager/src/components/layout/desktop.tsx @@ -1,7 +1,7 @@ import type { ComponentType, FC } from 'react'; import React, { Fragment } from 'react'; -import type { State } from '@storybook/api'; +import type { State } from '@storybook/manager-api'; import * as S from './container'; export interface DesktopProps { diff --git a/code/ui/manager/src/components/layout/mobile.stories.tsx b/code/ui/manager/src/components/layout/mobile.stories.tsx index 1a9121a8cc91..e1a1942a7c62 100644 --- a/code/ui/manager/src/components/layout/mobile.stories.tsx +++ b/code/ui/manager/src/components/layout/mobile.stories.tsx @@ -1,5 +1,5 @@ import React, { Fragment } from 'react'; -import { ActiveTabs } from '@storybook/api'; +import { ActiveTabs } from '@storybook/manager-api'; import type { DecoratorFn } from '@storybook/react'; import type { MobileProps } from './mobile'; diff --git a/code/ui/manager/src/components/layout/mobile.tsx b/code/ui/manager/src/components/layout/mobile.tsx index f74f8369ff73..6b14ebad793b 100644 --- a/code/ui/manager/src/components/layout/mobile.tsx +++ b/code/ui/manager/src/components/layout/mobile.tsx @@ -1,6 +1,6 @@ import type { ComponentType, FC, ReactNode } from 'react'; import React, { Component, Children } from 'react'; -import { type State, ActiveTabs } from '@storybook/api'; +import { type State, ActiveTabs } from '@storybook/manager-api'; import { styled } from '@storybook/theming'; import { TabButton } from '@storybook/components'; diff --git a/code/ui/manager/src/components/notifications/NotificationItem.tsx b/code/ui/manager/src/components/notifications/NotificationItem.tsx index ef51a825be3e..a595012de53e 100644 --- a/code/ui/manager/src/components/notifications/NotificationItem.tsx +++ b/code/ui/manager/src/components/notifications/NotificationItem.tsx @@ -1,6 +1,6 @@ import type { FC, SyntheticEvent } from 'react'; import React from 'react'; -import { type State } from '@storybook/api'; +import { type State } from '@storybook/manager-api'; import { Link } from '@storybook/router'; import { styled } from '@storybook/theming'; import { Icons, IconButton, type IconsProps } from '@storybook/components'; diff --git a/code/ui/manager/src/components/notifications/NotificationList.tsx b/code/ui/manager/src/components/notifications/NotificationList.tsx index 56449f9e0969..b1d3cf6584f9 100644 --- a/code/ui/manager/src/components/notifications/NotificationList.tsx +++ b/code/ui/manager/src/components/notifications/NotificationList.tsx @@ -1,6 +1,6 @@ import type { FC } from 'react'; import React from 'react'; -import type { State } from '@storybook/api'; +import type { State } from '@storybook/manager-api'; import { styled } from '@storybook/theming'; import type { CSSObject } from '@storybook/theming'; import NotificationItem from './NotificationItem'; diff --git a/code/ui/manager/src/components/panel/panel.tsx b/code/ui/manager/src/components/panel/panel.tsx index c90e44f7676c..f91237ab5333 100644 --- a/code/ui/manager/src/components/panel/panel.tsx +++ b/code/ui/manager/src/components/panel/panel.tsx @@ -2,8 +2,8 @@ import type { ReactElement } from 'react'; import React, { Component, Fragment } from 'react'; import { styled } from '@storybook/theming'; import { Tabs, Icons, IconButton } from '@storybook/components'; -import type { State } from '@storybook/api'; -import { shortcutToHumanString } from '@storybook/api'; +import type { State } from '@storybook/manager-api'; +import { shortcutToHumanString } from '@storybook/manager-api'; const DesktopOnlyIconButton = styled(IconButton)({ // Hides full screen icon at mobile breakpoint defined in app.js diff --git a/code/ui/manager/src/components/preview/FramesRenderer.tsx b/code/ui/manager/src/components/preview/FramesRenderer.tsx index 21ca40879d47..bf2ff9b916d8 100644 --- a/code/ui/manager/src/components/preview/FramesRenderer.tsx +++ b/code/ui/manager/src/components/preview/FramesRenderer.tsx @@ -1,7 +1,7 @@ import type { FC } from 'react'; import React, { Fragment, useMemo, useEffect, useState } from 'react'; -import type { Combo } from '@storybook/api'; -import { Consumer } from '@storybook/api'; +import type { Combo } from '@storybook/manager-api'; +import { Consumer } from '@storybook/manager-api'; import { Button, getStoryHref } from '@storybook/components'; import { Global, styled } from '@storybook/theming'; import type { CSSObject } from '@storybook/theming'; diff --git a/code/ui/manager/src/components/preview/preview.mockdata.tsx b/code/ui/manager/src/components/preview/preview.mockdata.tsx index e0699aa5f8f8..73c368fa1836 100644 --- a/code/ui/manager/src/components/preview/preview.mockdata.tsx +++ b/code/ui/manager/src/components/preview/preview.mockdata.tsx @@ -1,5 +1,5 @@ import { types, type Addon } from '@storybook/addons'; -import type { API, State } from '@storybook/api'; +import type { API, State } from '@storybook/manager-api'; import type { PreviewProps } from './utils/types'; export const previewProps: PreviewProps = { diff --git a/code/ui/manager/src/components/preview/preview.stories.tsx b/code/ui/manager/src/components/preview/preview.stories.tsx index dba22a1fd4ca..ca4c5036988f 100644 --- a/code/ui/manager/src/components/preview/preview.stories.tsx +++ b/code/ui/manager/src/components/preview/preview.stories.tsx @@ -1,8 +1,8 @@ import React from 'react'; import { parsePath, createPath } from 'history'; -import type { Combo, StoryEntry } from '@storybook/api'; -import { Provider as ManagerProvider, Consumer } from '@storybook/api'; +import type { Combo, StoryEntry } from '@storybook/manager-api'; +import { Provider as ManagerProvider, Consumer } from '@storybook/manager-api'; import { Location, BaseLocationProvider } from '@storybook/router'; import { ThemeProvider, ensure as ensureTheme, themes } from '@storybook/theming'; diff --git a/code/ui/manager/src/components/preview/preview.tsx b/code/ui/manager/src/components/preview/preview.tsx index df5c926cb146..3373dca0f19d 100644 --- a/code/ui/manager/src/components/preview/preview.tsx +++ b/code/ui/manager/src/components/preview/preview.tsx @@ -2,7 +2,7 @@ import React, { Fragment, useMemo, useEffect, useRef, useState } from 'react'; import { Helmet } from 'react-helmet-async'; import global from 'global'; -import { type API, Consumer, type Combo, merge } from '@storybook/api'; +import { type API, Consumer, type Combo, merge } from '@storybook/manager-api'; import { PREVIEW_BUILDER_PROGRESS, SET_CURRENT_STORY } from '@storybook/core-events'; import { addons, types, type Addon } from '@storybook/addons'; diff --git a/code/ui/manager/src/components/preview/toolbar.tsx b/code/ui/manager/src/components/preview/toolbar.tsx index c7212c968952..ce34f19fbba3 100644 --- a/code/ui/manager/src/components/preview/toolbar.tsx +++ b/code/ui/manager/src/components/preview/toolbar.tsx @@ -12,7 +12,7 @@ import { type State, merge, type LeafEntry, -} from '@storybook/api'; +} from '@storybook/manager-api'; import { addons, type Addon, types } from '@storybook/addons'; import { Location, type RenderData } from '@storybook/router'; diff --git a/code/ui/manager/src/components/preview/tools/addons.tsx b/code/ui/manager/src/components/preview/tools/addons.tsx index 1bd66a22ac83..5a3fff2382b7 100644 --- a/code/ui/manager/src/components/preview/tools/addons.tsx +++ b/code/ui/manager/src/components/preview/tools/addons.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { IconButton, Icons } from '@storybook/components'; -import { Consumer, type Combo } from '@storybook/api'; +import { Consumer, type Combo } from '@storybook/manager-api'; import type { Addon } from '@storybook/addons'; const menuMapper = ({ api, state }: Combo) => ({ diff --git a/code/ui/manager/src/components/preview/tools/copy.tsx b/code/ui/manager/src/components/preview/tools/copy.tsx index aa8c48f8d337..69959f67cc36 100644 --- a/code/ui/manager/src/components/preview/tools/copy.tsx +++ b/code/ui/manager/src/components/preview/tools/copy.tsx @@ -2,7 +2,7 @@ import global from 'global'; 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 { Consumer, type Combo } from '@storybook/manager-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 1a28a84c16b9..152637183338 100644 --- a/code/ui/manager/src/components/preview/tools/eject.tsx +++ b/code/ui/manager/src/components/preview/tools/eject.tsx @@ -1,7 +1,7 @@ import global from 'global'; import React from 'react'; import { getStoryHref, IconButton, Icons } from '@storybook/components'; -import { Consumer, type Combo } from '@storybook/api'; +import { Consumer, type Combo } from '@storybook/manager-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 d5f4daea381e..5c1fd5b7472e 100644 --- a/code/ui/manager/src/components/preview/tools/menu.tsx +++ b/code/ui/manager/src/components/preview/tools/menu.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { IconButton, Icons, Separator } from '@storybook/components'; -import { Consumer, type Combo } from '@storybook/api'; +import { Consumer, type Combo } from '@storybook/manager-api'; import type { Addon } from '@storybook/addons'; const menuMapper = ({ api, state }: Combo) => ({ diff --git a/code/ui/manager/src/components/preview/tools/remount.tsx b/code/ui/manager/src/components/preview/tools/remount.tsx index d56616bcdd50..437adab4c1a8 100644 --- a/code/ui/manager/src/components/preview/tools/remount.tsx +++ b/code/ui/manager/src/components/preview/tools/remount.tsx @@ -1,7 +1,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 { Consumer, type Combo } from '@storybook/manager-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/utils/types.tsx b/code/ui/manager/src/components/preview/utils/types.tsx index 3801c921fb8c..efe259cc61b1 100644 --- a/code/ui/manager/src/components/preview/utils/types.tsx +++ b/code/ui/manager/src/components/preview/utils/types.tsx @@ -1,5 +1,5 @@ import type { FunctionComponent, ReactNode } from 'react'; -import type { State, API, LeafEntry } from '@storybook/api'; +import type { State, API, LeafEntry } from '@storybook/manager-api'; import type { StoryId } from '@storybook/types'; export type ViewMode = State['viewMode']; diff --git a/code/ui/manager/src/components/sidebar/RefIndicator.tsx b/code/ui/manager/src/components/sidebar/RefIndicator.tsx index 40775bd31393..bb06fa3d4f6d 100644 --- a/code/ui/manager/src/components/sidebar/RefIndicator.tsx +++ b/code/ui/manager/src/components/sidebar/RefIndicator.tsx @@ -5,7 +5,7 @@ import React, { useMemo, useCallback, forwardRef } from 'react'; import { Icons, WithTooltip, Spaced, TooltipLinkList } from '@storybook/components'; import { styled } from '@storybook/theming'; import { transparentize } from 'polished'; -import { useStorybookApi } from '@storybook/api'; +import { useStorybookApi } from '@storybook/manager-api'; import { MenuItemIcon } from './Menu'; import type { RefType } from './types'; diff --git a/code/ui/manager/src/components/sidebar/Refs.stories.tsx b/code/ui/manager/src/components/sidebar/Refs.stories.tsx index 1727b323c465..4bc6c6a5e362 100644 --- a/code/ui/manager/src/components/sidebar/Refs.stories.tsx +++ b/code/ui/manager/src/components/sidebar/Refs.stories.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { ManagerContext } from '@storybook/api'; +import { ManagerContext } from '@storybook/manager-api'; import { Ref } from './Refs'; import { standardData as standardHeaderData } from './Heading.stories'; diff --git a/code/ui/manager/src/components/sidebar/Refs.tsx b/code/ui/manager/src/components/sidebar/Refs.tsx index 3ef12230f327..793244517fb9 100644 --- a/code/ui/manager/src/components/sidebar/Refs.tsx +++ b/code/ui/manager/src/components/sidebar/Refs.tsx @@ -1,6 +1,6 @@ import type { FC, MutableRefObject } from 'react'; import React, { useMemo, useState, useRef, useCallback } from 'react'; -import { useStorybookApi, useStorybookState } from '@storybook/api'; +import { useStorybookApi, useStorybookState } from '@storybook/manager-api'; import { styled } from '@storybook/theming'; import { transparentize } from 'polished'; diff --git a/code/ui/manager/src/components/sidebar/Search.tsx b/code/ui/manager/src/components/sidebar/Search.tsx index 5f9df0e8a381..3206745634b7 100644 --- a/code/ui/manager/src/components/sidebar/Search.tsx +++ b/code/ui/manager/src/components/sidebar/Search.tsx @@ -1,4 +1,4 @@ -import { useStorybookApi } from '@storybook/api'; +import { useStorybookApi } from '@storybook/manager-api'; import { styled } from '@storybook/theming'; import { Icons } from '@storybook/components'; import type { DownshiftState, StateChangeOptions } from 'downshift'; diff --git a/code/ui/manager/src/components/sidebar/SearchResults.stories.tsx b/code/ui/manager/src/components/sidebar/SearchResults.stories.tsx index ff5dba200ba8..ed56a86f4742 100644 --- a/code/ui/manager/src/components/sidebar/SearchResults.stories.tsx +++ b/code/ui/manager/src/components/sidebar/SearchResults.stories.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import type { StoriesHash } from '@storybook/api'; +import type { StoriesHash } from '@storybook/manager-api'; import { mockDataset } from './mockdata'; import { SearchResults } from './SearchResults'; diff --git a/code/ui/manager/src/components/sidebar/SearchResults.tsx b/code/ui/manager/src/components/sidebar/SearchResults.tsx index ba951e899eff..709001340953 100644 --- a/code/ui/manager/src/components/sidebar/SearchResults.tsx +++ b/code/ui/manager/src/components/sidebar/SearchResults.tsx @@ -5,7 +5,7 @@ import type { FC, MouseEventHandler, ReactNode } from 'react'; import React, { useCallback, useEffect } from 'react'; import type { ControllerStateAndHelpers } from 'downshift'; -import { useStorybookApi } from '@storybook/api'; +import { useStorybookApi } from '@storybook/manager-api'; import { PRELOAD_ENTRIES } from '@storybook/core-events'; import { ComponentNode, DocumentNode, Path, RootNode, StoryNode } from './TreeNode'; import type { Match, DownshiftItem, SearchResult } from './types'; diff --git a/code/ui/manager/src/components/sidebar/Sidebar.tsx b/code/ui/manager/src/components/sidebar/Sidebar.tsx index fe161f0d6e0b..b3ba9d26e51d 100644 --- a/code/ui/manager/src/components/sidebar/Sidebar.tsx +++ b/code/ui/manager/src/components/sidebar/Sidebar.tsx @@ -2,7 +2,7 @@ import React, { useMemo } from 'react'; import { styled } from '@storybook/theming'; import { ScrollArea, Spaced } from '@storybook/components'; -import type { StoriesHash, State } from '@storybook/api'; +import type { StoriesHash, State } from '@storybook/manager-api'; import { Heading } from './Heading'; diff --git a/code/ui/manager/src/components/sidebar/Tree.stories.tsx b/code/ui/manager/src/components/sidebar/Tree.stories.tsx index f80ef84945c1..1e796e76de9d 100644 --- a/code/ui/manager/src/components/sidebar/Tree.stories.tsx +++ b/code/ui/manager/src/components/sidebar/Tree.stories.tsx @@ -1,7 +1,7 @@ /* eslint-disable storybook/use-storybook-testing-library */ // @TODO: use addon-interactions and remove the rule disable above import React from 'react'; -import type { ComponentEntry, StoriesHash } from '@storybook/api'; +import type { ComponentEntry, StoriesHash } from '@storybook/manager-api'; import { screen } from '@testing-library/dom'; import { Tree } from './Tree'; diff --git a/code/ui/manager/src/components/sidebar/Tree.tsx b/code/ui/manager/src/components/sidebar/Tree.tsx index d281adf3bd10..4eb19382eee2 100644 --- a/code/ui/manager/src/components/sidebar/Tree.tsx +++ b/code/ui/manager/src/components/sidebar/Tree.tsx @@ -1,5 +1,5 @@ -import { useStorybookApi } from '@storybook/api'; -import type { StoriesHash, GroupEntry, ComponentEntry, StoryEntry } from '@storybook/api'; +import { useStorybookApi } from '@storybook/manager-api'; +import type { StoriesHash, GroupEntry, ComponentEntry, StoryEntry } from '@storybook/manager-api'; import { styled } from '@storybook/theming'; import { Button, Icons } from '@storybook/components'; import { transparentize } from 'polished'; diff --git a/code/ui/manager/src/components/sidebar/__tests__/Sidebar.test.tsx b/code/ui/manager/src/components/sidebar/__tests__/Sidebar.test.tsx index 8bfc55087389..3744b5890b66 100644 --- a/code/ui/manager/src/components/sidebar/__tests__/Sidebar.test.tsx +++ b/code/ui/manager/src/components/sidebar/__tests__/Sidebar.test.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { render, screen, fireEvent } from '@testing-library/react'; import { ThemeProvider, ensure, themes } from '@storybook/theming'; -import type { HashEntry, StoriesHash, Refs } from '@storybook/api'; +import type { HashEntry, StoriesHash, Refs } from '@storybook/manager-api'; import type { Theme } from '@storybook/theming'; import type { RenderResult } from '@testing-library/react'; import { Sidebar } from '../Sidebar'; diff --git a/code/ui/manager/src/components/sidebar/mockdata.ts b/code/ui/manager/src/components/sidebar/mockdata.ts index e7772a457699..6aa339ca7198 100644 --- a/code/ui/manager/src/components/sidebar/mockdata.ts +++ b/code/ui/manager/src/components/sidebar/mockdata.ts @@ -1,4 +1,4 @@ -import type { StoriesHash } from '@storybook/api'; +import type { StoriesHash } from '@storybook/manager-api'; export type MockDataSet = Record>>; diff --git a/code/ui/manager/src/components/sidebar/types.ts b/code/ui/manager/src/components/sidebar/types.ts index 80ca4725601c..c050d30e860c 100644 --- a/code/ui/manager/src/components/sidebar/types.ts +++ b/code/ui/manager/src/components/sidebar/types.ts @@ -1,4 +1,4 @@ -import type { StoriesHash, State } from '@storybook/api'; +import type { StoriesHash, State } from '@storybook/manager-api'; import type { ControllerStateAndHelpers } from 'downshift'; export type Refs = State['refs']; diff --git a/code/ui/manager/src/components/sidebar/useExpanded.ts b/code/ui/manager/src/components/sidebar/useExpanded.ts index 765ccd30bdb6..eaded1d38fc2 100644 --- a/code/ui/manager/src/components/sidebar/useExpanded.ts +++ b/code/ui/manager/src/components/sidebar/useExpanded.ts @@ -1,5 +1,5 @@ -import type { StoriesHash } from '@storybook/api'; -import { useStorybookApi } from '@storybook/api'; +import type { StoriesHash } from '@storybook/manager-api'; +import { useStorybookApi } from '@storybook/manager-api'; import { STORIES_COLLAPSE_ALL, STORIES_EXPAND_ALL } from '@storybook/core-events'; import global from 'global'; import throttle from 'lodash/throttle'; diff --git a/code/ui/manager/src/components/sidebar/useHighlighted.ts b/code/ui/manager/src/components/sidebar/useHighlighted.ts index a8d9986638ab..5455ca25edf6 100644 --- a/code/ui/manager/src/components/sidebar/useHighlighted.ts +++ b/code/ui/manager/src/components/sidebar/useHighlighted.ts @@ -1,7 +1,7 @@ import global from 'global'; import type { Dispatch, MutableRefObject, SetStateAction } from 'react'; import { useCallback, useEffect, useRef, useState } from 'react'; -import { useStorybookApi } from '@storybook/api'; +import { useStorybookApi } from '@storybook/manager-api'; import { PRELOAD_ENTRIES } from '@storybook/core-events'; import { matchesKeyCode, matchesModifiers } from '../../keybinding'; diff --git a/code/ui/manager/src/components/sidebar/utils.ts b/code/ui/manager/src/components/sidebar/utils.ts index a748d84e1d52..ea1d250cfe84 100644 --- a/code/ui/manager/src/components/sidebar/utils.ts +++ b/code/ui/manager/src/components/sidebar/utils.ts @@ -1,7 +1,7 @@ import memoize from 'memoizerific'; import global from 'global'; import type { SyntheticEvent } from 'react'; -import type { HashEntry, StoriesHash } from '@storybook/api'; +import type { HashEntry, StoriesHash } from '@storybook/manager-api'; // eslint-disable-next-line import/no-cycle import { DEFAULT_REF_ID } from './Sidebar'; diff --git a/code/ui/manager/src/containers/menu.tsx b/code/ui/manager/src/containers/menu.tsx index 61d678674aff..9e7bc34e04ef 100644 --- a/code/ui/manager/src/containers/menu.tsx +++ b/code/ui/manager/src/containers/menu.tsx @@ -2,10 +2,10 @@ import type { FC } from 'react'; import React, { useMemo } from 'react'; import { Badge } from '@storybook/components'; -import type { API } from '@storybook/api'; +import type { API } from '@storybook/manager-api'; import { styled, useTheme } from '@storybook/theming'; -import { shortcutToHumanString } from '@storybook/api'; +import { shortcutToHumanString } from '@storybook/manager-api'; import { MenuItemIcon } from '../components/sidebar/Menu'; const focusableUIElements = { diff --git a/code/ui/manager/src/containers/notifications.tsx b/code/ui/manager/src/containers/notifications.tsx index b2bfef141c48..ddea3edb588e 100644 --- a/code/ui/manager/src/containers/notifications.tsx +++ b/code/ui/manager/src/containers/notifications.tsx @@ -1,8 +1,8 @@ import type { FC } from 'react'; import React from 'react'; -import type { Combo } from '@storybook/api'; -import { Consumer } from '@storybook/api'; +import type { Combo } from '@storybook/manager-api'; +import { Consumer } from '@storybook/manager-api'; import NotificationList from '../components/notifications/NotificationList'; diff --git a/code/ui/manager/src/containers/panel.tsx b/code/ui/manager/src/containers/panel.tsx index c016f83b6b14..a5273a3515fe 100644 --- a/code/ui/manager/src/containers/panel.tsx +++ b/code/ui/manager/src/containers/panel.tsx @@ -1,7 +1,7 @@ import type { FC } from 'react'; import React from 'react'; import memoize from 'memoizerific'; -import { Consumer, type Combo } from '@storybook/api'; +import { Consumer, type Combo } from '@storybook/manager-api'; import AddonPanel from '../components/panel/panel'; diff --git a/code/ui/manager/src/containers/preview.tsx b/code/ui/manager/src/containers/preview.tsx index a9ba8a95f2b3..54e6a978ca0c 100644 --- a/code/ui/manager/src/containers/preview.tsx +++ b/code/ui/manager/src/containers/preview.tsx @@ -1,8 +1,8 @@ import global from 'global'; import React from 'react'; -import type { Combo, StoriesHash } from '@storybook/api'; -import { Consumer } from '@storybook/api'; +import type { Combo, StoriesHash } from '@storybook/manager-api'; +import { Consumer } from '@storybook/manager-api'; import { Preview } from '../components/preview/preview'; diff --git a/code/ui/manager/src/containers/sidebar.tsx b/code/ui/manager/src/containers/sidebar.tsx index 96dd5e746b10..4d5b29352be1 100755 --- a/code/ui/manager/src/containers/sidebar.tsx +++ b/code/ui/manager/src/containers/sidebar.tsx @@ -1,7 +1,7 @@ import React from 'react'; -import type { Combo, StoriesHash } from '@storybook/api'; -import { Consumer } from '@storybook/api'; +import type { Combo, StoriesHash } from '@storybook/manager-api'; +import { Consumer } from '@storybook/manager-api'; import { Sidebar as SidebarComponent } from '../components/sidebar/Sidebar'; import { useMenu } from './menu'; diff --git a/code/ui/manager/src/globals/exports.ts b/code/ui/manager/src/globals/exports.ts index ed0e7d14c3c9..2578e4a25d10 100644 --- a/code/ui/manager/src/globals/exports.ts +++ b/code/ui/manager/src/globals/exports.ts @@ -195,7 +195,7 @@ export default { 'useTheme', 'withTheme', ], - '@storybook/api': [ + '@storybook/manager-api': [ 'ActiveTabs', 'Consumer', 'ManagerContext', diff --git a/code/ui/manager/src/globals/runtime.ts b/code/ui/manager/src/globals/runtime.ts index e41240a3ce8b..d83f92754859 100644 --- a/code/ui/manager/src/globals/runtime.ts +++ b/code/ui/manager/src/globals/runtime.ts @@ -6,7 +6,7 @@ import * as STORYBOOKCHANNELS from '@storybook/channels'; 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 STORYBOOKAPI from '@storybook/manager-api'; import * as STORYBOOKADDONS from '@storybook/preview-api'; import * as STORYBOOKCLIENTLOGGER from '@storybook/client-logger'; @@ -21,7 +21,7 @@ export const values: Required> = { '@storybook/core-events': STORYBOOKEVENTS, '@storybook/router': STORYBOOKROUTER, '@storybook/theming': STORYBOOKTHEMING, - '@storybook/api': STORYBOOKAPI, + '@storybook/manager-api': STORYBOOKAPI, '@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 0c3a8bb56a7d..238f4c2dc8f4 100644 --- a/code/ui/manager/src/globals/types.ts +++ b/code/ui/manager/src/globals/types.ts @@ -9,7 +9,7 @@ export enum Keys { '@storybook/core-events' = '__STORYBOOKCOREEVENTS__', '@storybook/router' = '__STORYBOOKROUTER__', '@storybook/theming' = '__STORYBOOKTHEMING__', - '@storybook/api' = '__STORYBOOKAPI__', + '@storybook/manager-api' = '__STORYBOOKAPI__', '@storybook/preview-api' = '__STORYBOOKADDONS__', '@storybook/client-logger' = '__STORYBOOKCLIENTLOGGER__', } diff --git a/code/ui/manager/src/index.tsx b/code/ui/manager/src/index.tsx index 46d0f4a30795..dff5953f68a1 100644 --- a/code/ui/manager/src/index.tsx +++ b/code/ui/manager/src/index.tsx @@ -4,8 +4,8 @@ import React from 'react'; import ReactDOM from 'react-dom'; import { Location, LocationProvider, useNavigate } from '@storybook/router'; -import { Provider as ManagerProvider } from '@storybook/api'; -import type { Combo } from '@storybook/api'; +import { Provider as ManagerProvider } from '@storybook/manager-api'; +import type { Combo } from '@storybook/manager-api'; import { ThemeProvider, ensure as ensureTheme, diff --git a/code/ui/manager/src/settings/about.tsx b/code/ui/manager/src/settings/about.tsx index 6d2b728ea32e..fd595366166c 100644 --- a/code/ui/manager/src/settings/about.tsx +++ b/code/ui/manager/src/settings/about.tsx @@ -2,7 +2,7 @@ import type { FC } from 'react'; import React, { Fragment } from 'react'; import semver from 'semver'; import { styled } from '@storybook/theming'; -import type { State } from '@storybook/api'; +import type { State } from '@storybook/manager-api'; import Markdown from 'markdown-to-jsx'; import { StorybookIcon, SyntaxHighlighter, Link, DocumentWrapper } from '@storybook/components'; diff --git a/code/ui/manager/src/settings/about_page.tsx b/code/ui/manager/src/settings/about_page.tsx index 9c611078d9c2..34640957ad18 100644 --- a/code/ui/manager/src/settings/about_page.tsx +++ b/code/ui/manager/src/settings/about_page.tsx @@ -1,7 +1,7 @@ import type { FC } from 'react'; import React, { Component } from 'react'; -import { type API, useStorybookApi } from '@storybook/api'; +import { type API, useStorybookApi } from '@storybook/manager-api'; import { AboutScreen } from './about'; diff --git a/code/ui/manager/src/settings/index.tsx b/code/ui/manager/src/settings/index.tsx index e6e7c898f84e..6af005aa3c56 100644 --- a/code/ui/manager/src/settings/index.tsx +++ b/code/ui/manager/src/settings/index.tsx @@ -1,4 +1,4 @@ -import { useStorybookApi, useStorybookState } from '@storybook/api'; +import { useStorybookApi, useStorybookState } from '@storybook/manager-api'; import { IconButton, Icons, FlexBar, TabBar, TabButton, ScrollArea } from '@storybook/components'; import { Location, Route } from '@storybook/router'; import { styled } from '@storybook/theming'; diff --git a/code/ui/manager/src/settings/release_notes_page.tsx b/code/ui/manager/src/settings/release_notes_page.tsx index 30263106abb0..536954bce484 100644 --- a/code/ui/manager/src/settings/release_notes_page.tsx +++ b/code/ui/manager/src/settings/release_notes_page.tsx @@ -1,4 +1,4 @@ -import { useStorybookApi } from '@storybook/api'; +import { useStorybookApi } from '@storybook/manager-api'; import type { FC } from 'react'; import React, { useEffect } from 'react'; diff --git a/code/ui/manager/src/settings/shortcuts.tsx b/code/ui/manager/src/settings/shortcuts.tsx index 38968f2d0403..f9e8add419a7 100644 --- a/code/ui/manager/src/settings/shortcuts.tsx +++ b/code/ui/manager/src/settings/shortcuts.tsx @@ -2,7 +2,11 @@ import type { ComponentProps, FC } from 'react'; import React, { Component } from 'react'; import { styled, keyframes } from '@storybook/theming'; -import { eventToShortcut, shortcutToHumanString, shortcutMatchesShortcut } from '@storybook/api'; +import { + eventToShortcut, + shortcutToHumanString, + shortcutMatchesShortcut, +} from '@storybook/manager-api'; import { Form, Icons } from '@storybook/components'; import SettingsFooter from './SettingsFooter'; diff --git a/code/ui/manager/src/settings/shortcuts_page.tsx b/code/ui/manager/src/settings/shortcuts_page.tsx index bff27ec672b1..9475f5e229c1 100644 --- a/code/ui/manager/src/settings/shortcuts_page.tsx +++ b/code/ui/manager/src/settings/shortcuts_page.tsx @@ -1,7 +1,7 @@ import type { FC } from 'react'; import React from 'react'; -import { Consumer } from '@storybook/api'; +import { Consumer } from '@storybook/manager-api'; import { ShortcutsScreen } from './shortcuts'; diff --git a/code/yarn.lock b/code/yarn.lock index fb23c799b444..52b14a7905b5 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -5125,11 +5125,11 @@ __metadata: dependencies: "@storybook/addon-highlight": 7.0.0-alpha.52 "@storybook/addons": 7.0.0-alpha.52 - "@storybook/api": 7.0.0-alpha.52 "@storybook/channels": 7.0.0-alpha.52 "@storybook/client-logger": 7.0.0-alpha.52 "@storybook/components": 7.0.0-alpha.52 "@storybook/core-events": 7.0.0-alpha.52 + "@storybook/manager-api": 7.0.0-alpha.52 "@storybook/preview-api": 7.0.0-alpha.52 "@storybook/theming": 7.0.0-alpha.52 "@storybook/types": 7.0.0-alpha.52 @@ -5155,10 +5155,10 @@ __metadata: resolution: "@storybook/addon-actions@workspace:addons/actions" dependencies: "@storybook/addons": 7.0.0-alpha.52 - "@storybook/api": 7.0.0-alpha.52 "@storybook/client-logger": 7.0.0-alpha.52 "@storybook/components": 7.0.0-alpha.52 "@storybook/core-events": 7.0.0-alpha.52 + "@storybook/manager-api": 7.0.0-alpha.52 "@storybook/preview-api": 7.0.0-alpha.52 "@storybook/theming": 7.0.0-alpha.52 "@storybook/types": 7.0.0-alpha.52 @@ -5189,10 +5189,10 @@ __metadata: resolution: "@storybook/addon-backgrounds@workspace:addons/backgrounds" dependencies: "@storybook/addons": 7.0.0-alpha.52 - "@storybook/api": 7.0.0-alpha.52 "@storybook/client-logger": 7.0.0-alpha.52 "@storybook/components": 7.0.0-alpha.52 "@storybook/core-events": 7.0.0-alpha.52 + "@storybook/manager-api": 7.0.0-alpha.52 "@storybook/preview-api": 7.0.0-alpha.52 "@storybook/theming": 7.0.0-alpha.52 "@storybook/types": 7.0.0-alpha.52 @@ -5216,11 +5216,11 @@ __metadata: resolution: "@storybook/addon-controls@workspace:addons/controls" dependencies: "@storybook/addons": 7.0.0-alpha.52 - "@storybook/api": 7.0.0-alpha.52 "@storybook/blocks": 7.0.0-alpha.52 "@storybook/client-logger": 7.0.0-alpha.52 "@storybook/components": 7.0.0-alpha.52 "@storybook/core-common": 7.0.0-alpha.52 + "@storybook/manager-api": 7.0.0-alpha.52 "@storybook/node-logger": 7.0.0-alpha.52 "@storybook/preview-api": 7.0.0-alpha.52 "@storybook/theming": 7.0.0-alpha.52 @@ -5288,8 +5288,8 @@ __metadata: "@storybook/addon-toolbars": 7.0.0-alpha.52 "@storybook/addon-viewport": 7.0.0-alpha.52 "@storybook/addons": 7.0.0-alpha.52 - "@storybook/api": 7.0.0-alpha.52 "@storybook/core-common": 7.0.0-alpha.52 + "@storybook/manager-api": 7.0.0-alpha.52 "@storybook/node-logger": 7.0.0-alpha.52 "@storybook/preview-api": 7.0.0-alpha.52 "@storybook/vue": 7.0.0-alpha.52 @@ -5319,13 +5319,13 @@ __metadata: dependencies: "@devtools-ds/object-inspector": ^1.1.2 "@storybook/addons": 7.0.0-alpha.52 - "@storybook/api": 7.0.0-alpha.52 "@storybook/client-logger": 7.0.0-alpha.52 "@storybook/components": 7.0.0-alpha.52 "@storybook/core-common": 7.0.0-alpha.52 "@storybook/core-events": 7.0.0-alpha.52 "@storybook/instrumenter": 7.0.0-alpha.52 "@storybook/jest": ^0.0.10 + "@storybook/manager-api": 7.0.0-alpha.52 "@storybook/preview-api": 7.0.0-alpha.52 "@storybook/testing-library": 0.0.14-next.0 "@storybook/theming": 7.0.0-alpha.52 @@ -5353,10 +5353,10 @@ __metadata: resolution: "@storybook/addon-jest@workspace:addons/jest" dependencies: "@storybook/addons": 7.0.0-alpha.52 - "@storybook/api": 7.0.0-alpha.52 "@storybook/client-logger": 7.0.0-alpha.52 "@storybook/components": 7.0.0-alpha.52 "@storybook/core-events": 7.0.0-alpha.52 + "@storybook/manager-api": 7.0.0-alpha.52 "@storybook/preview-api": 7.0.0-alpha.52 "@storybook/theming": 7.0.0-alpha.52 global: ^4.4.0 @@ -5405,10 +5405,10 @@ __metadata: resolution: "@storybook/addon-measure@workspace:addons/measure" dependencies: "@storybook/addons": 7.0.0-alpha.52 - "@storybook/api": 7.0.0-alpha.52 "@storybook/client-logger": 7.0.0-alpha.52 "@storybook/components": 7.0.0-alpha.52 "@storybook/core-events": 7.0.0-alpha.52 + "@storybook/manager-api": 7.0.0-alpha.52 "@storybook/preview-api": 7.0.0-alpha.52 "@storybook/types": 7.0.0-alpha.52 global: ^4.4.0 @@ -5429,10 +5429,10 @@ __metadata: resolution: "@storybook/addon-outline@workspace:addons/outline" dependencies: "@storybook/addons": 7.0.0-alpha.52 - "@storybook/api": 7.0.0-alpha.52 "@storybook/client-logger": 7.0.0-alpha.52 "@storybook/components": 7.0.0-alpha.52 "@storybook/core-events": 7.0.0-alpha.52 + "@storybook/manager-api": 7.0.0-alpha.52 "@storybook/preview-api": 7.0.0-alpha.52 "@storybook/types": 7.0.0-alpha.52 global: ^4.4.0 @@ -5564,9 +5564,9 @@ __metadata: resolution: "@storybook/addon-storysource@workspace:addons/storysource" dependencies: "@storybook/addons": 7.0.0-alpha.52 - "@storybook/api": 7.0.0-alpha.52 "@storybook/client-logger": 7.0.0-alpha.52 "@storybook/components": 7.0.0-alpha.52 + "@storybook/manager-api": 7.0.0-alpha.52 "@storybook/preview-api": 7.0.0-alpha.52 "@storybook/router": 7.0.0-alpha.52 "@storybook/source-loader": 7.0.0-alpha.52 @@ -5609,9 +5609,9 @@ __metadata: resolution: "@storybook/addon-toolbars@workspace:addons/toolbars" dependencies: "@storybook/addons": 7.0.0-alpha.52 - "@storybook/api": 7.0.0-alpha.52 "@storybook/client-logger": 7.0.0-alpha.52 "@storybook/components": 7.0.0-alpha.52 + "@storybook/manager-api": 7.0.0-alpha.52 "@storybook/preview-api": 7.0.0-alpha.52 "@storybook/theming": 7.0.0-alpha.52 typescript: ^4.9.3 @@ -5631,10 +5631,10 @@ __metadata: resolution: "@storybook/addon-viewport@workspace:addons/viewport" dependencies: "@storybook/addons": 7.0.0-alpha.52 - "@storybook/api": 7.0.0-alpha.52 "@storybook/client-logger": 7.0.0-alpha.52 "@storybook/components": 7.0.0-alpha.52 "@storybook/core-events": 7.0.0-alpha.52 + "@storybook/manager-api": 7.0.0-alpha.52 "@storybook/preview-api": 7.0.0-alpha.52 "@storybook/theming": 7.0.0-alpha.52 global: ^4.4.0 @@ -5656,10 +5656,10 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/addons@workspace:lib/addons" dependencies: - "@storybook/api": 7.0.0-alpha.52 "@storybook/channels": 7.0.0-alpha.52 "@storybook/client-logger": 7.0.0-alpha.52 "@storybook/core-events": 7.0.0-alpha.52 + "@storybook/manager-api": 7.0.0-alpha.52 "@storybook/router": 7.0.0-alpha.52 "@storybook/theming": 7.0.0-alpha.52 "@storybook/types": 7.0.0-alpha.52 @@ -5709,7 +5709,6 @@ __metadata: "@angular/platform-browser-dynamic": ^13.3.6 "@nrwl/workspace": 14.6.1 "@storybook/addons": 7.0.0-alpha.52 - "@storybook/api": 7.0.0-alpha.52 "@storybook/builder-webpack5": 7.0.0-alpha.52 "@storybook/client-logger": 7.0.0-alpha.52 "@storybook/core-client": 7.0.0-alpha.52 @@ -5718,6 +5717,7 @@ __metadata: "@storybook/core-server": 7.0.0-alpha.52 "@storybook/core-webpack": 7.0.0-alpha.52 "@storybook/docs-tools": 7.0.0-alpha.52 + "@storybook/manager-api": 7.0.0-alpha.52 "@storybook/node-logger": 7.0.0-alpha.52 "@storybook/preview-api": 7.0.0-alpha.52 "@storybook/types": 7.0.0-alpha.52 @@ -5773,15 +5773,6 @@ __metadata: languageName: unknown linkType: soft -"@storybook/api@7.0.0-alpha.52, @storybook/api@workspace:*, @storybook/api@workspace:lib/manager-api-shim": - version: 0.0.0-use.local - resolution: "@storybook/api@workspace:lib/manager-api-shim" - dependencies: - "@storybook/client-logger": 7.0.0-alpha.52 - "@storybook/manager-api": 7.0.0-alpha.52 - languageName: unknown - linkType: soft - "@storybook/api@npm:6.5.13": version: 6.5.13 resolution: "@storybook/api@npm:6.5.13" @@ -5810,6 +5801,15 @@ __metadata: languageName: node linkType: hard +"@storybook/api@workspace:*, @storybook/api@workspace:lib/manager-api-shim": + version: 0.0.0-use.local + resolution: "@storybook/api@workspace:lib/manager-api-shim" + dependencies: + "@storybook/client-logger": 7.0.0-alpha.52 + "@storybook/manager-api": 7.0.0-alpha.52 + languageName: unknown + linkType: soft + "@storybook/babel-plugin-require-context-hook@npm:1.0.1": version: 1.0.1 resolution: "@storybook/babel-plugin-require-context-hook@npm:1.0.1" @@ -5823,13 +5823,13 @@ __metadata: dependencies: "@storybook/addon-actions": 7.0.0-alpha.52 "@storybook/addons": 7.0.0-alpha.52 - "@storybook/api": 7.0.0-alpha.52 "@storybook/channels": 7.0.0-alpha.52 "@storybook/client-logger": 7.0.0-alpha.52 "@storybook/components": 7.0.0-alpha.52 "@storybook/core-events": 7.0.0-alpha.52 "@storybook/csf": next "@storybook/docs-tools": 7.0.0-alpha.52 + "@storybook/manager-api": 7.0.0-alpha.52 "@storybook/preview-api": 7.0.0-alpha.52 "@storybook/theming": 7.0.0-alpha.52 "@storybook/types": 7.0.0-alpha.52 @@ -5919,7 +5919,6 @@ __metadata: dependencies: "@babel/core": ^7.12.10 "@storybook/addons": 7.0.0-alpha.52 - "@storybook/api": 7.0.0-alpha.52 "@storybook/channel-postmessage": 7.0.0-alpha.52 "@storybook/channel-websocket": 7.0.0-alpha.52 "@storybook/channels": 7.0.0-alpha.52 @@ -5929,6 +5928,7 @@ __metadata: "@storybook/core-common": 7.0.0-alpha.52 "@storybook/core-events": 7.0.0-alpha.52 "@storybook/core-webpack": 7.0.0-alpha.52 + "@storybook/manager-api": 7.0.0-alpha.52 "@storybook/node-logger": 7.0.0-alpha.52 "@storybook/preview": 7.0.0-alpha.52 "@storybook/preview-api": 7.0.0-alpha.52 @@ -6555,7 +6555,7 @@ __metadata: languageName: node linkType: hard -"@storybook/manager-api@7.0.0-alpha.52, @storybook/manager-api@workspace:lib/manager-api": +"@storybook/manager-api@7.0.0-alpha.52, @storybook/manager-api@workspace:*, @storybook/manager-api@workspace:lib/manager-api": version: 0.0.0-use.local resolution: "@storybook/manager-api@workspace:lib/manager-api" dependencies: @@ -6593,13 +6593,13 @@ __metadata: dependencies: "@fal-works/esbuild-plugin-global-externals": ^2.1.2 "@storybook/addons": 7.0.0-alpha.52 - "@storybook/api": 7.0.0-alpha.52 "@storybook/channel-postmessage": 7.0.0-alpha.52 "@storybook/channel-websocket": 7.0.0-alpha.52 "@storybook/channels": 7.0.0-alpha.52 "@storybook/client-logger": 7.0.0-alpha.52 "@storybook/components": 7.0.0-alpha.52 "@storybook/core-events": 7.0.0-alpha.52 + "@storybook/manager-api": 7.0.0-alpha.52 "@storybook/preview-api": 7.0.0-alpha.52 "@storybook/router": 7.0.0-alpha.52 "@storybook/theming": 7.0.0-alpha.52 @@ -6970,7 +6970,6 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/preview@workspace:lib/preview" dependencies: - "@storybook/api": 7.0.0-alpha.52 "@storybook/channel-postmessage": 7.0.0-alpha.52 "@storybook/channel-websocket": 7.0.0-alpha.52 "@storybook/channels": 7.0.0-alpha.52 @@ -6978,6 +6977,7 @@ __metadata: "@storybook/core-common": 7.0.0-alpha.52 "@storybook/core-events": 7.0.0-alpha.52 "@storybook/csf": next + "@storybook/manager-api": 7.0.0-alpha.52 "@storybook/preview-api": 7.0.0-alpha.52 "@storybook/router": 7.0.0-alpha.52 "@storybook/theming": 7.0.0-alpha.52 @@ -7187,6 +7187,7 @@ __metadata: "@storybook/jest": ^0.0.10 "@storybook/linter-config": ^2.5.0 "@storybook/manager": "workspace:*" + "@storybook/manager-api": "workspace:*" "@storybook/nextjs": "workspace:*" "@storybook/node-logger": "workspace:*" "@storybook/postinstall": "workspace:*" @@ -7824,10 +7825,10 @@ __metadata: resolution: "@storybook/web-components@workspace:renderers/web-components" dependencies: "@storybook/addons": 7.0.0-alpha.52 - "@storybook/api": 7.0.0-alpha.52 "@storybook/client-logger": 7.0.0-alpha.52 "@storybook/core-client": 7.0.0-alpha.52 "@storybook/docs-tools": 7.0.0-alpha.52 + "@storybook/manager-api": 7.0.0-alpha.52 "@storybook/preview-api": 7.0.0-alpha.52 "@storybook/types": 7.0.0-alpha.52 global: ^4.4.0 diff --git a/docs/api/argtypes.md b/docs/api/argtypes.md index 75031481bc78..2771c73dc4b2 100644 --- a/docs/api/argtypes.md +++ b/docs/api/argtypes.md @@ -109,7 +109,7 @@ You can also define arg types at the global level; they will apply to every comp #### Using argTypes in addons -If you want to access the argTypes of the current component inside an addon, you can use the `useArgTypes` hook from the `@storybook/api` package: +If you want to access the argTypes of the current component inside an addon, you can use the `useArgTypes` hook from the `@storybook/manager-api` package: diff --git a/docs/essentials/toolbars-and-globals.md b/docs/essentials/toolbars-and-globals.md index 393fc44ddbf8..e0fc3b6526d2 100644 --- a/docs/essentials/toolbars-and-globals.md +++ b/docs/essentials/toolbars-and-globals.md @@ -132,7 +132,7 @@ Using the example above, you can modify any story to retrieve the **Locale** `gl ## Consuming globals from within an addon -If you're working on a Storybook addon and need to retrieve globals, you can do so. The `@storybook/api` package provides a hook for this scenario. You can use the [`useGlobals()`](../addons/addons-api.md#useglobals) hook to retrieve any globals you want. +If you're working on a Storybook addon and need to retrieve globals, you can do so. The `@storybook/manager-api` package provides a hook for this scenario. You can use the [`useGlobals()`](../addons/addons-api.md#useglobals) hook to retrieve any globals you want. Using the ThemeProvider example above, you could expand it to display which theme is active inside a panel as such: @@ -148,7 +148,7 @@ Using the ThemeProvider example above, you could expand it to display which them ## Updating globals from within an addon -If you're working on a Storybook addon that needs to update the global and refreshes the UI, you can do so. As mentioned previously, the `@storybook/api` package provides the necessary hook for this scenario. You can use the `updateGlobals` function to update any global values you need. +If you're working on a Storybook addon that needs to update the global and refreshes the UI, you can do so. As mentioned previously, the `@storybook/manager-api` package provides the necessary hook for this scenario. You can use the `updateGlobals` function to update any global values you need. Also, you can use both `@storybook/addons` and `@storybook/core-events` packages together to trigger the refresh. 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 c3df6931a919..bc9e562e9b78 100644 --- a/docs/snippets/common/addon-consume-and-update-globaltype.js.mdx +++ b/docs/snippets/common/addon-consume-and-update-globaltype.js.mdx @@ -4,7 +4,7 @@ import React, { useCallback } from 'react'; import { FORCE_RE_RENDER } from '@storybook/core-events'; -import { useGlobals } from '@storybook/api'; +import { useGlobals } from '@storybook/manager-api'; import { IconButton, Icons } from '@storybook/components'; diff --git a/docs/snippets/common/addon-consume-globaltype.js.mdx b/docs/snippets/common/addon-consume-globaltype.js.mdx index 97707ed3e107..e027726a7e6c 100644 --- a/docs/snippets/common/addon-consume-globaltype.js.mdx +++ b/docs/snippets/common/addon-consume-globaltype.js.mdx @@ -3,7 +3,7 @@ import React from 'react'; -import { useGlobals } from '@storybook/api'; +import { useGlobals } from '@storybook/manager-api'; import { AddonPanel, Placeholder, Separator, Source, Spaced, Title } from '@storybook/components'; diff --git a/docs/snippets/common/args-usage-with-addons.js.mdx b/docs/snippets/common/args-usage-with-addons.js.mdx index ef267c7f0a69..3a5f6b34c006 100644 --- a/docs/snippets/common/args-usage-with-addons.js.mdx +++ b/docs/snippets/common/args-usage-with-addons.js.mdx @@ -1,7 +1,7 @@ ```js // your-addon/manager.js -import { useArgs } from '@storybook/api'; +import { useArgs } from '@storybook/manager-api'; const [args, updateArgs, resetArgs] = useArgs(); diff --git a/docs/snippets/common/storybook-addon-change-panel.js.mdx b/docs/snippets/common/storybook-addon-change-panel.js.mdx index b9c2826e1da0..0ffef55d741d 100644 --- a/docs/snippets/common/storybook-addon-change-panel.js.mdx +++ b/docs/snippets/common/storybook-addon-change-panel.js.mdx @@ -1,7 +1,7 @@ ```js // /my-addon/src/manager.js -import { useParameter } from '@storybook/api'; +import { useParameter } from '@storybook/manager-api'; const PARAM_KEY = 'myAddon'; diff --git a/docs/snippets/common/storybook-addon-panel-example.js.mdx b/docs/snippets/common/storybook-addon-panel-example.js.mdx index 9a23eed04666..218c532244d5 100644 --- a/docs/snippets/common/storybook-addon-panel-example.js.mdx +++ b/docs/snippets/common/storybook-addon-panel-example.js.mdx @@ -7,7 +7,7 @@ import { AddonPanel } from '@storybook/components'; import { addons, types } from '@storybook/preview-api'; -import { useGlobals } from '@storybook/api'; +import { useGlobals } from '@storybook/manager-api'; addons.register('my/panel', () => { addons.add('my-panel-addon/panel', { diff --git a/docs/snippets/common/storybook-addons-api-useaddonstate.js.mdx b/docs/snippets/common/storybook-addons-api-useaddonstate.js.mdx index 034c8949ab55..f9581809456c 100644 --- a/docs/snippets/common/storybook-addons-api-useaddonstate.js.mdx +++ b/docs/snippets/common/storybook-addons-api-useaddonstate.js.mdx @@ -3,7 +3,7 @@ import React from 'react'; -import { useAddonState } from '@storybook/api'; +import { useAddonState } from '@storybook/manager-api'; export const Panel = () => { const [state, setState] = useAddonState('my/addon-id', 'initial state'); diff --git a/docs/snippets/common/storybook-addons-api-useapi.js.mdx b/docs/snippets/common/storybook-addons-api-useapi.js.mdx index 267b45b8c005..fed18884d9ca 100644 --- a/docs/snippets/common/storybook-addons-api-useapi.js.mdx +++ b/docs/snippets/common/storybook-addons-api-useapi.js.mdx @@ -3,7 +3,7 @@ import React from 'react'; -import { useStorybookApi } from '@storybook/api'; +import { useStorybookApi } from '@storybook/manager-api'; export const Panel = () => { const state = useStorybookApi(); diff --git a/docs/snippets/common/storybook-addons-api-useglobal.js.mdx b/docs/snippets/common/storybook-addons-api-useglobal.js.mdx index fa5a1eae3f79..b3189929161f 100644 --- a/docs/snippets/common/storybook-addons-api-useglobal.js.mdx +++ b/docs/snippets/common/storybook-addons-api-useglobal.js.mdx @@ -3,7 +3,7 @@ import React from 'react'; -import { useGlobals } from '@storybook/api'; +import { useGlobals } from '@storybook/manager-api'; export const Panel = () => { const [globals, updateGlobals] = useGlobals(); diff --git a/docs/snippets/common/storybook-addons-api-useparameter.js.mdx b/docs/snippets/common/storybook-addons-api-useparameter.js.mdx index 71bd3527ca36..2ea5ade4f211 100644 --- a/docs/snippets/common/storybook-addons-api-useparameter.js.mdx +++ b/docs/snippets/common/storybook-addons-api-useparameter.js.mdx @@ -3,7 +3,7 @@ import React from 'react'; -import { useParameter } from '@storybook/api'; +import { useParameter } from '@storybook/manager-api'; export const Panel = () => { const value = useParameter('parameter-key', 'default value'); diff --git a/docs/snippets/common/storybook-addons-api-usestorybookstate.js.mdx b/docs/snippets/common/storybook-addons-api-usestorybookstate.js.mdx index 72b60fbf809f..2ee507410a6f 100644 --- a/docs/snippets/common/storybook-addons-api-usestorybookstate.js.mdx +++ b/docs/snippets/common/storybook-addons-api-usestorybookstate.js.mdx @@ -3,7 +3,7 @@ import React from 'react'; -import { useStorybookState } from '@storybook/api'; +import { useStorybookState } from '@storybook/manager-api'; export const Panel = () => { const state = useStorybookState(); diff --git a/docs/snippets/common/storybook-argtypes-with-addon.js.mdx b/docs/snippets/common/storybook-argtypes-with-addon.js.mdx index ac5c85ca5c4b..279a8c601df5 100644 --- a/docs/snippets/common/storybook-argtypes-with-addon.js.mdx +++ b/docs/snippets/common/storybook-argtypes-with-addon.js.mdx @@ -1,7 +1,7 @@ ```js // .storybook/my-addon/manager.js -import { useArgTypes } from '@storybook/api'; +import { useArgTypes } from '@storybook/manager-api'; // inside your panel const { argTypes } = useArgTypes(); diff --git a/docs/writing-stories/args.md b/docs/writing-stories/args.md index fdcfd48e1daf..7f0f24137fb7 100644 --- a/docs/writing-stories/args.md +++ b/docs/writing-stories/args.md @@ -181,7 +181,7 @@ Note that `mapping` does not have to be exhaustive. If the arg value is not a pr
Using args in addons -If you are [writing an addon](../addons/writing-addons.md) that wants to read or update args, use the `useArgs` hook exported by `@storybook/api`: +If you are [writing an addon](../addons/writing-addons.md) that wants to read or update args, use the `useArgs` hook exported by `@storybook/manager-api`: From cf3b511e750895acbe4bc66a945a7259fe46f376 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Thu, 24 Nov 2022 00:15:21 +0100 Subject: [PATCH 4/6] small fixes --- code/lib/manager-api-shim/src/entry.ts | 2 +- code/lib/store/README.md | 6 +++--- code/workspace.json | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/code/lib/manager-api-shim/src/entry.ts b/code/lib/manager-api-shim/src/entry.ts index aa1313db0d8e..c0174219dd33 100644 --- a/code/lib/manager-api-shim/src/entry.ts +++ b/code/lib/manager-api-shim/src/entry.ts @@ -1,7 +1,7 @@ import { deprecate } from '@storybook/client-logger'; deprecate( - 'importing from @storybook/manager-api is deprecated and will be removed in 8.0, please import canvas related modules from @storybook/manager-api' + 'importing from @storybook/api is deprecated and will be removed in 8.0, please import manager related modules from @storybook/manager-api' ); export * from '@storybook/manager-api'; diff --git a/code/lib/store/README.md b/code/lib/store/README.md index bcd39ae8a940..dd2f5ac9b057 100644 --- a/code/lib/store/README.md +++ b/code/lib/store/README.md @@ -81,10 +81,10 @@ Args need to be serializable -- so currently cannot include callbacks (this may 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/manager-api` (manager) export a `useArgs()` hook that you can use to access args in decorators or addon panels. The API is as follows: +Both `@storybook/preview-api` and `@storybook/manager-api` 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/manager-api' +import { useArgs } from '@storybook/preview-api'; // or '@storybook/manager-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. @@ -116,7 +116,7 @@ To set initial values of globals, `export const globals = {...}` from `preview.j 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/manager-api' +import { useGlobals } from '@storybook/preview-api'; // or '@storybook/manager-api' const [globals, updateGlobals] = useGlobals(); ``` diff --git a/code/workspace.json b/code/workspace.json index bcc70e04edaf..ad82327b6ada 100644 --- a/code/workspace.json +++ b/code/workspace.json @@ -96,11 +96,6 @@ "root": "frameworks/angular", "type": "library" }, - "@storybook/manager-api": { - "implicitDependencies": [], - "root": "lib/manager-api", - "type": "library" - }, "@storybook/api": { "implicitDependencies": [], "root": "lib/manager-api-shim", @@ -231,6 +226,11 @@ "root": "ui/manager", "type": "library" }, + "@storybook/manager-api": { + "implicitDependencies": [], + "root": "lib/manager-api", + "type": "library" + }, "@storybook/nextjs": { "implicitDependencies": [], "root": "frameworks/nextjs", From d0e431233daed5e72d7142259651ac0fae853e38 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Thu, 24 Nov 2022 09:22:51 +0100 Subject: [PATCH 5/6] add legacy api package as a dep and alias for preview for backward compatibility --- code/lib/builder-webpack5/package.json | 1 + .../src/preview/iframe-webpack.config.ts | 1 + code/yarn.lock | 19 ++++++++++--------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/code/lib/builder-webpack5/package.json b/code/lib/builder-webpack5/package.json index 69607a4e950a..e30fc2617df0 100644 --- a/code/lib/builder-webpack5/package.json +++ b/code/lib/builder-webpack5/package.json @@ -55,6 +55,7 @@ "dependencies": { "@babel/core": "^7.12.10", "@storybook/addons": "7.0.0-alpha.52", + "@storybook/api": "7.0.0-alpha.52", "@storybook/channel-postmessage": "7.0.0-alpha.52", "@storybook/channel-websocket": "7.0.0-alpha.52", "@storybook/channels": "7.0.0-alpha.52", 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 39edcd357502..c9e8555413ab 100644 --- a/code/lib/builder-webpack5/src/preview/iframe-webpack.config.ts +++ b/code/lib/builder-webpack5/src/preview/iframe-webpack.config.ts @@ -28,6 +28,7 @@ const storybookPaths: Record = { ...[ // these packages are not pre-bundled because of react dependencies 'api', + 'manager-api', 'components', 'router', 'theming', diff --git a/code/yarn.lock b/code/yarn.lock index 52b14a7905b5..6597b65fbdf5 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -5773,6 +5773,15 @@ __metadata: languageName: unknown linkType: soft +"@storybook/api@7.0.0-alpha.52, @storybook/api@workspace:*, @storybook/api@workspace:lib/manager-api-shim": + version: 0.0.0-use.local + resolution: "@storybook/api@workspace:lib/manager-api-shim" + dependencies: + "@storybook/client-logger": 7.0.0-alpha.52 + "@storybook/manager-api": 7.0.0-alpha.52 + languageName: unknown + linkType: soft + "@storybook/api@npm:6.5.13": version: 6.5.13 resolution: "@storybook/api@npm:6.5.13" @@ -5801,15 +5810,6 @@ __metadata: languageName: node linkType: hard -"@storybook/api@workspace:*, @storybook/api@workspace:lib/manager-api-shim": - version: 0.0.0-use.local - resolution: "@storybook/api@workspace:lib/manager-api-shim" - dependencies: - "@storybook/client-logger": 7.0.0-alpha.52 - "@storybook/manager-api": 7.0.0-alpha.52 - languageName: unknown - linkType: soft - "@storybook/babel-plugin-require-context-hook@npm:1.0.1": version: 1.0.1 resolution: "@storybook/babel-plugin-require-context-hook@npm:1.0.1" @@ -5919,6 +5919,7 @@ __metadata: dependencies: "@babel/core": ^7.12.10 "@storybook/addons": 7.0.0-alpha.52 + "@storybook/api": 7.0.0-alpha.52 "@storybook/channel-postmessage": 7.0.0-alpha.52 "@storybook/channel-websocket": 7.0.0-alpha.52 "@storybook/channels": 7.0.0-alpha.52 From acdcef312b3208c152e394bd946d4a24bff4e95c Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Thu, 24 Nov 2022 13:31:42 +0100 Subject: [PATCH 6/6] improve readme of shim package --- code/lib/manager-api-shim/README.md | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/code/lib/manager-api-shim/README.md b/code/lib/manager-api-shim/README.md index fddccb2823db..21130d9a30f1 100644 --- a/code/lib/manager-api-shim/README.md +++ b/code/lib/manager-api-shim/README.md @@ -1,16 +1,3 @@ -# `@storybook/client-api` -- Deprecated Story APIs (`storiesOf`) +The contents of this package have moved to `@storybook/manager-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.