Expand description
Public facade for building GPUI storybook binaries.
Most applications should depend on this crate rather than the lower-level
runtime, macro, or TOML crates. It re-exports the standard runtime shell,
typed controls and workbench state, story traits, locale helpers, the
gallery window, and, with the default macros
feature, the story registration macros.
The Inspect workbench tab always shows the active story key and source.
Enable the opt-in inspector feature for its GPUI Component Inspector
button and StoryInspectorState story-root metadata.
Story registration flows through inventory: #[story] and
#[derive(ComponentStory)] submit story entries, #[derive(Substory)]
derives stable capture keys for styled section or custom
StorySectionBase regions inside a story, and
#[story_init] submits one-time setup hooks. The hidden __registry and
__inventory re-exports are the stable expansion path used by those
macros.
#[derive(StoryControls)] and field-level #[storybook(control...)]
metadata connect an exact Entity<S> to the Controls tab and MCP
automation. Only marked fields are registered. #[derive(ComponentStory)]
accepts the same field metadata and derives reset defaults from its
configured example.
Explicit stories declare reusable workflows with Story::scenarios; a
component derive accepts scenarios = .... Workbench and automation runs
recreate the concrete story before applying scenario controls,
presentation, named steps, exact postconditions, and optional capture.
StorybookElementExt associates route-local automation targets and JSON
state with rendered children. MCP clients can read semantic values after a
fresh frame without requiring a screenshot; capture remains the
visual-presentation assertion surface.
init and generate_stories load crate-local storybook.toml files for
discovered story crates and select a runtime config by matching the running
binary name against registered story crate names. Initialization applies
launch-only preference overrides; story
generation applies allow and disable_story filtering, then materializes
sorted StoryContainer values. A story crate config’s group becomes the
sidebar’s outer group; a story’s declared section remains the nested label.
Macro-generated stories carry stable StoryKey values in the form
{crate-package-name}-{registered-story-name}. These keys are copied into
generated StoryContainer values as typed RegisteredStoryMetadata for
automation and capture routes.
static_story_catalog and static_story_catalog_json expose the
registration catalog without opening a window or constructing live stories.
The static records include Rustdoc and control shape metadata; localized
titles, descriptions, and control defaults remain runtime values.
Feature boundaries:
macros: re-exports proc macros fromgpui-storybook-macrosinspector: adds GPUI Inspector activation and story-root metadata; the Inspect tab’s story key and source remain part of the base workbenchmcp: serves the live controller installed byinitover MCP and re-exports automation and capture helpers. Generic remote input tools are advertised only whenGPUI_STORYBOOK_MCP_ALLOW_INTERACTION=1; typed controls remain available without that capability. This feature is supported on Linux and macOS; enabling it on Windows or another target produces a compile-time error.performance: enables GPUI window profiler histograms and the debug frame overlay in the Perf workbench tab
Applications with embedded locale assets should call
es_fluent_build::track_i18n_assets() from build.rs. Define the embedded
i18n module and typed language enum in library-reachable code, then pass
typed StorybookOptions to init and await readiness before creating a
story window.
PreferenceState::saved retains durable user intent, including System
choices and independent light/dark theme
slots. Choosing a named theme also activates its matching appearance while
preserving the opposite slot.
PreferenceState::resolved reports effective values and their sources
after live system detection, registry fallback, and deterministic overrides.
PersistenceStatus is storage-only; locale-adapter failures are reported
as diagnostics and are retried on later window activation without falsifying
storage state.
Re-exports§
pub use preferences::LocaleApplicationError;pub use preferences::PreferenceOverrides;pub use preferences::StorybookInitError;pub use preferences::StorybookOptions;
Modules§
- preferences
- Public initialization and preference-state contract for Storybook consumers.
- tokio_
bridge - Tokio runtime shared by one Storybook GPUI app context.
Structs§
- Assets
- Color
Scheme Resolution - Effective light/dark scheme and source.
- Consumer
Id - Stable identifier that isolates one Storybook consumer’s preference document.
- Control
Bounds - Numeric limits applied before a value reaches a story instance.
- Control
Color - A serializable color used by story controls and automation.
- Control
Snapshot - A current control value paired with its metadata.
- Control
Spec - Metadata and default value for one story control.
- Current
Language - GPUI global wrapper for a typed current-language value.
- Gallery
- Searchable gallery host with independently toggled navigation and workbench sidebars around a story canvas centered within the available main pane.
- Language
Resolution - Effective supported language and source.
- Language
Tag - Validated and canonically formatted BCP 47 language tag.
- Preference
State - Saved intent and effective values used by Storybook menus and windows.
- Recovery
Diagnostic - Structured record of invalid-JSON recovery.
- Registered
Story Metadata - Typed registration metadata copied from the inventory registry into runtime story containers.
- Resolved
Preferences - Fully resolved Storybook preferences and structured diagnostics.
- Static
Control Spec - Static metadata for one marked story control.
- Story
Action Snapshot - Runtime-visible GPUI action metadata.
- Story
Autodoc - Documentation and control metadata captured at story registration time.
- Story
Capture Snapshot - Story
Catalog - Deterministic static catalog of all inventory-registered stories.
- Story
Catalog Entry - One story entry exported by the static catalog.
- Story
Catalog Source - Source provenance included in a static story catalog entry.
- Story
Container - Story
Interaction Capture Request - Optional PNG capture performed after the final interaction step.
- Story
Interaction Observation - Dispatch observations for one completed interaction step.
- Story
Interaction Postcondition - Exact semantic-value assertion evaluated after all interaction steps.
- Story
Interaction Postcondition Snapshot - Successful result for one exact semantic-value postcondition.
- Story
Interaction Request - One exclusive interaction batch.
- Story
Interaction Snapshot - Result of an interaction batch executed by the live GPUI host.
- Story
Interaction Target Bounds - Logical bounds of a semantic interaction target relative to its story route.
- Story
Interaction Target Snapshot - One stable semantic interaction target rendered by a story route.
- Story
Interaction Targets Snapshot - Semantic interaction targets currently rendered by the selected route.
- Story
Key - Stable runtime key for a registered story.
- Story
Modifiers - Modifier keys held while dispatching a pointer step.
- Story
Name - Story-local identity for a registered story.
- Story
Point - A point relative to the active story or substory capture region.
- Story
Presentation - Viewport and canvas background applied to the selected story entity.
- Story
Scenario - A reusable story-owned interaction workflow.
- Story
Scenario RunSnapshot - Completed result for one story-owned interaction scenario.
- Story
Scenario Step - One named operation in a story-owned scenario.
- Story
Scenarios Snapshot - Scenario descriptors available for one selected story.
- Story
Section - Story
Section Base - Base capture metadata for a user-defined story section component.
- Story
Section Name - Stable identity for a declared story section.
- Story
Section Title - Input accepted by
sectionandStorySectionBase::newfor visible titles and stable capture keys. - Story
Semantic Value Snapshot - One stable machine-readable value rendered by a story route.
- Story
Semantic Values Snapshot - Machine-readable values currently rendered by the selected story route.
- Story
Workbench - Right-side developer workbench for controls, themes, inspection, actions, fresh story scenarios, and opt-in performance telemetry.
- Storybook
Preferences - One typed Storybook preference aggregate.
- Storybook
Ready - Readiness result returned after initial load and foreground resolution.
- Storybook
Window - Stories and window-level presentation used by
create_storybook_window. - Storybook
Window Ui - Theme
Color Row - One deterministic editable row from
ThemeColor. - Theme
Draft - A session draft layered over the selected base theme.
- Theme
Draft Error - Theme draft serialization or field update failure.
- ThemeId
- Normalized theme registry identifier.
- Theme
Resolution - Effective named theme and source.
- Workbench
State - Per-window active story and variant selection.
Enums§
- Color
Scheme Source - Explanation for the effective light/dark scheme.
- Consumer
IdError - Failure to validate a stable Storybook consumer identifier.
- Control
Error - Structured failures produced while reading or editing story controls.
- Control
Kind - The editor presented for a control.
- Control
Value - A value that can be edited by the Storybook workbench.
- Language
Source - Explanation for the effective language.
- Persistence
Mode - Local persistence behavior selected by a Storybook consumer.
- Persistence
Status - Current state of local preference storage.
- Preference
Diagnostic - Structured, observable startup or preference-application diagnostic.
- Preferred
Color Scheme - Saved appearance intent.
- Preferred
Language - Saved language intent.
- Preferred
Language Mode - Stable persisted language-mode token.
- Preferred
Scrollbar - Saved scrollbar visibility policy.
- Recovery
Reason - Reason a persistent JSON document was archived.
- Resolution
Diagnostic - Non-fatal resolution diagnostic retained for the later public facade.
- Static
Control Kind - The editor kind captured for a control without constructing its story.
- Story
Canvas Background - Background applied behind the active story preview.
- Story
Catalog Export Error - Errors returned while rendering or writing a static story catalog.
- Story
Interaction Dispatch - Dispatch information reported directly by GPUI.
- Story
Interaction Step - One ordered interaction operation.
- Story
Modifier - Keyboard modifiers supported by pointer interaction.
- Story
Mouse Button - Mouse buttons supported by in-process story interaction.
- Story
Point Space - Coordinate space for a point inside the active story route.
- Story
Viewport Preset - Named viewport sizes available in the workbench and capture automation.
- Storybook
Automation Error - Structured live-host, validation, control, interaction, and capture errors.
- System
Color Scheme - Generic light/dark device appearance supplied by the GPUI facade.
- Theme
IdError - Failure to validate a theme registry identifier.
- Theme
Source - Explanation for the effective named theme.
- Unsupported
Value Source - Origin of an unsupported named value retained for diagnostics.
- Workbench
Tab - Tabs available in the Storybook workbench.
Constants§
- STORYBOOK_
THEME_ DIR_ ENV - Native debug environment variable selecting the complete consumer theme directory.
Traits§
- Control
Target - Object-safe runtime boundary used by the workbench and MCP automation.
- Language
- Bounds used by generated language enums that can be stored in GPUI globals.
- Story
- Story
Controls - Typed access generated for a story’s controllable fields.
- Storybook
Element Ext - Fluent Storybook automation metadata for GPUI elements.
- Substory
- Stable descriptor for a capture-addressable section inside a story.
Functions§
- capture_
route_ slug - Convert a section title into the slug used by sub-story capture routes.
- capture_
substory - Wrap a section inside a story so it can be captured as
story-key/section-slug. - capture_
substory_ route_ id - Build the capture route id for a story section title.
- capture_
substory_ route_ id_ with_ key - Build the capture route id for an explicit sub-story key.
- capture_
substory_ with_ key - Wrap a section inside a story with an explicit stable capture key.
- create_
storybook_ window - Opens the standard Storybook window.
- export_
static_ catalog_ json - Renders the process-wide static story catalog as compact JSON.
- export_
static_ catalog_ json_ pretty - Renders the process-wide static story catalog as pretty JSON.
- generate_
stories - Discovers registered stories, applies
storybook.tomlfiltering, and returns runtime story containers. - init
- Initializes Storybook and starts loading one consumer’s local preferences.
- section
- static_
story_ catalog - Collects all statically registered story metadata without constructing a live GPUI story.
- static_
story_ catalog_ json - Exports all statically registered story metadata as compact JSON.
- static_
story_ catalog_ json_ pretty - Exports all statically registered story metadata as pretty JSON.
- theme_
color_ rows - Serialize every upstream color field into deterministic workbench rows.
- try_
localize_ message - Attempts to localize
messagewith the installedI18nglobal. - try_
preference_ state - Returns the read-only saved and resolved preference snapshot after initialization has begun.
- write_
static_ catalog_ json - Writes the process-wide static story catalog as compact JSON to a file.
- write_
static_ catalog_ json_ pretty - Writes the process-wide static story catalog as pretty JSON to a file.
Type Aliases§
- Story
Scenario Snapshot - Snapshot alias used by automation and MCP list/run results.
Attribute Macros§
- story
- Attribute macro to register a story struct
- story_
init - Attribute macro to register an init function
Derive Macros§
- Component
Story - Derive macro that registers a component by generating an internal story wrapper.
- Story
Controls - Derives typed access to fields marked with
#[storybook(control...)]. - Substory
- Derive stable capture metadata for sub-story sections.