From c0f17d75aaf21a20b8ee8f4ef4d2dc1e20a36a9b Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Sun, 21 Jan 2024 21:21:51 +0800 Subject: [PATCH 1/3] Preview-API: Export PreviewWithSelection --- code/lib/preview-api/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/lib/preview-api/src/index.ts b/code/lib/preview-api/src/index.ts index 2abcec8de9e1..c2fcc5bf9640 100644 --- a/code/lib/preview-api/src/index.ts +++ b/code/lib/preview-api/src/index.ts @@ -68,4 +68,4 @@ export type { PropDescriptor } from './store'; * STORIES API */ export { StoryStore } from './store'; -export { Preview, PreviewWeb } from './preview-web'; +export { Preview, PreviewWithSelection, PreviewWeb } from './preview-web'; From 560d41413e7629c7ced3880505ec1c531a46359c Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Mon, 22 Jan 2024 21:13:36 +0800 Subject: [PATCH 2/3] Preview: Add getStoryContext proxy --- code/lib/preview-api/src/modules/preview-web/Preview.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/code/lib/preview-api/src/modules/preview-web/Preview.tsx b/code/lib/preview-api/src/modules/preview-web/Preview.tsx index 7e368f7457f3..af851edfc304 100644 --- a/code/lib/preview-api/src/modules/preview-web/Preview.tsx +++ b/code/lib/preview-api/src/modules/preview-web/Preview.tsx @@ -384,6 +384,13 @@ export class Preview { return this.storyStoreValue.loadStory({ storyId }); } + getStoryContext(story: PreparedStory, { forceInitialArgs = false } = {}) { + if (!this.storyStoreValue) + throw new CalledPreviewMethodBeforeInitializationError({ methodName: 'getStoryContext' }); + + return this.storyStoreValue.getStoryContext(story, { forceInitialArgs }); + } + async extract(options?: { includeDocsOnly: boolean }) { if (!this.storyStoreValue) throw new CalledPreviewMethodBeforeInitializationError({ methodName: 'extract' }); From 283b495887383944d561d9e927b4e08beace4c7c Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Mon, 22 Jan 2024 21:55:47 +0800 Subject: [PATCH 3/3] Add react-native entries for preview-api/manager-api --- code/lib/manager-api/package.json | 1 + code/lib/preview-api/package.json | 1 + 2 files changed, 2 insertions(+) diff --git a/code/lib/manager-api/package.json b/code/lib/manager-api/package.json index ab04b6c851bc..39ff5ddd69d0 100644 --- a/code/lib/manager-api/package.json +++ b/code/lib/manager-api/package.json @@ -30,6 +30,7 @@ }, "main": "dist/index.js", "module": "dist/index.mjs", + "react-native": "dist/index.mjs", "types": "dist/index.d.ts", "files": [ "dist/**/*", diff --git a/code/lib/preview-api/package.json b/code/lib/preview-api/package.json index 3ea9445723b9..1a0e38b4116f 100644 --- a/code/lib/preview-api/package.json +++ b/code/lib/preview-api/package.json @@ -30,6 +30,7 @@ }, "main": "dist/index.js", "module": "dist/index.mjs", + "react-native": "dist/index.mjs", "types": "dist/index.d.ts", "files": [ "dist/**/*",