Skip to main content

Crate gpui_storybook_core

Crate gpui_storybook_core 

Source
Expand description

Runtime shell for GPUI Storybook. gpui-storybook-core owns the UI runtime used by the public facade crate: window creation, the searchable gallery layout, story container panel behavior, title-bar composition, local preference resolution and persistence, embedded localization/assets, and shared registry entry types.

Most applications should start with gpui-storybook. Use this crate directly only when you need runtime-level control over the shell.

Important module boundaries:

  • story: the story::Story contract, story::StoryContainer, duplicate-title variant groups whose members remain concrete previews, section helpers with stable sub-story capture metadata, runtime startup, and standard window helpers
  • gallery: searchable sidebar plus active-story display
  • controls, workbench, and presentation: typed live field editing, per-window selection and preview state, theme editing, story source details, focus-scoped actions and key bindings, optional GPUI profiler telemetry and Inspector integration, grouped-story selection, viewport presets, and canvas settings
  • theme_workbench: deterministic session drafts layered over the selected base theme, including token rebuilding and external-reload rebasing
  • automation: shared controller and command types for live story listing, story opening, control reads/edits/resets, serialized capture controls, screenshot capture, runtime action discovery, route-local structured value reads, closed in-process interaction batches, and the optional default automation global consumed by the base gallery constructor. The gallery uses one frame-aware executor and one exclusive mutation/capture guard.
  • capture_region: story-view and sub-story capture bounds, semantic interaction targets, and structured values used by automation
  • storybook_window_ui: customization hooks for application menu and title-bar additions
  • language, preferences, and i18n: typed locale abstraction, saved/resolved runtime state, and bridge into es-fluent, gpui-es-fluent, and gpui-component
  • assets: embedded Storybook assets plus delegated component assets
  • registry: typed inventory entry definitions shared with the facade and macro crates, plus registration metadata copied into runtime story containers
  • catalog: static story registration autodocs and deterministic JSON export for tooling that must inspect stories without constructing a GPUI window

The preference runtime treats saved intent and resolved presentation as separate state. Standard windows feed appearance and activation events into resolution, selecting a named theme activates its matching appearance while preserving the opposite light/dark slot, and locale changes fan out to Storybook, the consumer adapter, CurrentLanguage, and GPUI Component. PersistenceStatus reports storage activity only; locale failures remain retryable diagnostics.

Modulesยง

actions
app_menus
assets
automation
Live-window automation shared by gallery, dock, and MCP integrations.
capture_region
catalog
Static Storybook catalog and registration autodocumentation.
controls
Typed story controls shared by the workbench and automation surfaces.
gallery
i18n
language
preferences
GPUI-owned resolved preference state and runtime orchestration.
presentation
Window-local preview presentation settings.
registry
story
storybook_window_ui
theme_workbench
Session-scoped theme drafts used by the Storybook workbench.
title_bar
tokio_bridge
Tokio runtime shared by one Storybook GPUI app context.
workbench
Window-scoped Storybook workbench state and UI.