View Source PhxLiveStorybook.BackendBehaviour behaviour (phx_live_storybook v0.3.0)
Behaviour implemented by your backend module.
Most of it is precompiled through macros.
Link to this section Summary
Callbacks
Returns the all leaves of the storybook content tree (ie. whichever entries are is not a folder)
Returns a configuration value from your config.exs storybook settings.
Returns a precompiled tree of your storybook entries.
Returns an entry from its absolute path.
Renders code snippet of a specific story for a given component entry. Returns rendered HEEx template.
Renders a tab content for a page entry. Returns rendered HEEx template.
Renders source of a component entry. Returns rendered HEEx template.
Renders a specific story for a given component entry. Can be a single story or a story group. Returns rendered HEEx template.
Link to this section Callbacks
@callback all_leaves() :: [ %PhxLiveStorybook.ComponentEntry{ attributes: term(), component: term(), container: term(), description: term(), function: term(), icon: term(), module: term(), module_name: term(), name: term(), path: term(), stories: term(), storybook_path: term(), type: term() } | %PhxLiveStorybook.PageEntry{ description: term(), icon: term(), module: term(), module_name: term(), name: term(), navigation: term(), path: term(), storybook_path: term() } ]
Returns the all leaves of the storybook content tree (ie. whichever entries are is not a folder)
Returns a configuration value from your config.exs storybook settings.
key
is the config key
default
is an optional default value if no value can be fetched.
@callback entries() :: [ %PhxLiveStorybook.ComponentEntry{ attributes: term(), component: term(), container: term(), description: term(), function: term(), icon: term(), module: term(), module_name: term(), name: term(), path: term(), stories: term(), storybook_path: term(), type: term() } | %PhxLiveStorybook.FolderEntry{ icon: term(), name: term(), nice_name: term(), storybook_path: term(), sub_entries: term() } | %PhxLiveStorybook.PageEntry{ description: term(), icon: term(), module: term(), module_name: term(), name: term(), navigation: term(), path: term(), storybook_path: term() } ]
Returns a precompiled tree of your storybook entries.
@callback find_entry_by_path(String.t()) :: %PhxLiveStorybook.ComponentEntry{ attributes: term(), component: term(), container: term(), description: term(), function: term(), icon: term(), module: term(), module_name: term(), name: term(), path: term(), stories: term(), storybook_path: term(), type: term() } | %PhxLiveStorybook.PageEntry{ description: term(), icon: term(), module: term(), module_name: term(), name: term(), navigation: term(), path: term(), storybook_path: term() }
Returns an entry from its absolute path.
@callback render_code(entry_module :: atom(), story_id :: atom()) :: %Phoenix.LiveView.Rendered{ dynamic: term(), fingerprint: term(), root: term(), static: term() }
Renders code snippet of a specific story for a given component entry. Returns rendered HEEx template.
@callback render_page(entry_module :: atom(), tab :: atom()) :: %Phoenix.LiveView.Rendered{ dynamic: term(), fingerprint: term(), root: term(), static: term() }
Renders a tab content for a page entry. Returns rendered HEEx template.
@callback render_source(entry_module :: atom()) :: %Phoenix.LiveView.Rendered{ dynamic: term(), fingerprint: term(), root: term(), static: term() }
Renders source of a component entry. Returns rendered HEEx template.
@callback render_story(entry_module :: any(), story_id :: atom()) :: %Phoenix.LiveView.Rendered{ dynamic: term(), fingerprint: term(), root: term(), static: term() }
Renders a specific story for a given component entry. Can be a single story or a story group. Returns rendered HEEx template.