@storybook/preview 8.0.0-alpha.8 → 8.0.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -20
- package/dist/runtime.js +12 -31
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -10,34 +10,14 @@ The preview's job is:
|
|
|
10
10
|
|
|
11
11
|
3. Render the current selection to the web view in either story or docs mode.
|
|
12
12
|
|
|
13
|
-
## V7 Store vs Legacy (V6)
|
|
14
|
-
|
|
15
|
-
The story store is designed to load stories 'on demand', and will operate in this fashion if the `storyStoreV7` feature is enabled.
|
|
16
|
-
|
|
17
|
-
However, for back-compat reasons, in v6 mode, we need to load all stories, synchronously on bootup, emitting the `SET_STORIES` event.
|
|
18
|
-
|
|
19
|
-
In V7 mode we do not emit that event, instead preferring the `STORY_PREPARED` event, with the data for the single story being rendered.
|
|
20
|
-
|
|
21
13
|
## Initialization
|
|
22
14
|
|
|
23
|
-
The preview is `initialized` in two ways.
|
|
24
|
-
|
|
25
|
-
### V7 Mode:
|
|
26
|
-
|
|
27
15
|
- `importFn` - is an async `import()` function
|
|
28
16
|
|
|
29
17
|
- `getProjectAnnotations` - is a simple function that evaluations `preview.js` and addon config files and combines them. If it errors, the Preview will show the error.
|
|
30
18
|
|
|
31
19
|
- No `getStoryIndex` function is passed, instead the preview creates a `StoryIndexClient` that pulls `stories.json` from node and watches the event stream for invalidation events.
|
|
32
20
|
|
|
33
|
-
### V6 Mode
|
|
34
|
-
|
|
35
|
-
- `importFn` - is a simulated `import()` function, that is synchronous, see `client-api` for details.
|
|
36
|
-
- `getProjectAnnotations` - also evaluates `preview.js` et al, but watches for calls to `setStories`, and passes them to the `ClientApi`
|
|
37
|
-
- `getStoryIndex` is a local function (that must be called _after_ `getProjectAnnotations`) that gets the list of stories added.
|
|
38
|
-
|
|
39
|
-
See `client-api` for more details on this process.
|
|
40
|
-
|
|
41
21
|
## Story Rendering and interruptions
|
|
42
22
|
|
|
43
23
|
The Preview is split into three parts responsible for state management:
|