@storybook/core
Storybook framework-agnostic API
Last updated 5 years ago by shilman .
MIT · Repository · Bugs · Original npm
$ cnpm install @storybook/core 
SYNC missed versions from official npm registry.

Storybook Core

This package contains common data structures and bootstrapping capabilities used among the different frameworks (React, RN, Vue, Ember, Angular, etc).

Preview

The files in src/client/preview alongside the @storybook/client-api package form the "API" of the preview (iframe) side of Storybook. Here is a brief overview of the architecture:

Each framework (e.g. @storybook/react / @storybook/angular / et al.) initializes the preview by calling into src/client/preview/start.ts, passing a render function that will be used to render stories.

The start module initiaizes all the submodules:

  • StoryStore (from @storybook/client-api) - stores the stories and their state as well as the current selection or error.
  • ClientApi (from @storybook/client-api) - provides the entry point for storiesOf() API calls; re-exported by each framework.
  • ConfigApi (from @storybook/client-api) - provides the configure API (wrapped by loadCsf below).
  • StoryRenderer - controls the HTML that is rendered in the preview (calling the render function with the current story at appropriate times).
  • url.js - controls the URL in the preview and sets the selection based on it.
  • loadCsf - loads CSF files from require.context() calls and uses ClientApi to load them into the store.

Each module uses the channel to communicate with each other and the manager. Each module also has direct access to the story store.

Events on startup

The store can only be changed during "configuration". The ConfigApi will call store.startConfiguration(), then the user code (or loadCsf's loader) which will use client API to load up stories. At the end of the user's code the ConfigApi will call store.finishConfiguration(). At this point the SET_STORIES event is emitted and the stories are transmitted to the manager.

The URL of the preview is a "selection specifier" that controls the initial selection, which is chosen when configuration ends. Also (outside of configuration) the SET_CURRENT_STORY "command" event can be used to set the selection on the store. When the selection is set, a CURRENT_STORY_WAS_SET event is emitted which triggers a rendering.

Current Tags

  • 6.5.16                                ...           latest (3 years ago)
  • 6.5.0-rc.1                                ...           next (3 years ago)
  • 6.5.17-alpha.0                                ...           prerelease (2 years ago)

31 Versions

  • 6.5.17-alpha.0                                ...           2 years ago
  • 6.5.16                                ...           3 years ago
  • 6.5.9-alpha.2                                ...           3 years ago
  • 6.5.9                                ...           3 years ago
  • 6.5.5-alpha.3                                ...           3 years ago
  • 6.5.0-rc.1                                ...           3 years ago
  • 6.5.5                                ...           3 years ago
  • 6.5.0-beta.8                                ...           3 years ago
  • 6.4.22                                ...           3 years ago
  • 6.5.0-alpha.38                                ...           4 years ago
  • 6.4.18                                ...           4 years ago
  • 6.5.0-alpha.23                                ...           4 years ago
  • 6.4.14                                ...           4 years ago
  • 6.5.0-alpha.18                                ...           4 years ago
  • 6.4.13                                ...           4 years ago
  • 6.4.12                                ...           4 years ago
  • 6.4.0-beta.0                                ...           4 years ago
  • 6.4.0-alpha.34                                ...           4 years ago
  • 6.3.8                                ...           4 years ago
  • 6.4.0-alpha.30                                ...           4 years ago
  • 6.3.7                                ...           4 years ago
  • 6.2.0-alpha.10                                ...           5 years ago
  • 6.0.28-alpha.3                                ...           5 years ago
  • 6.1.11                                ...           5 years ago
  • 5.3.21                                ...           5 years ago
  • 6.1.0-alpha.9                                ...           5 years ago
  • 6.1.0-alpha.3                                ...           5 years ago
  • 6.0.21                                ...           5 years ago
  • 5.3.19                                ...           5 years ago
  • 6.0.0-beta.27                                ...           5 years ago
  • 5.3.18                                ...           5 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (97)
Dev Dependencies (1)
Dependents (0)
None

Copyright 2013 - present © cnpmjs.org