View Source PhxLiveStorybook.BackendBehaviour behaviour (phx_live_storybook v0.2.0)
Behaviour implemented by your backend module. Most of it is precompiled through macros.
Link to this section Summary
Callbacks
Returns a configuration value from your config.exs storybook settings.
Returns the first leaf of the storybook content tree (ie. whichever entry which is not a folder)
Renders code snippet of a specific variation for a given component entry. Returns rendered HEEx template.
Renders source of a component entry. Returns rendered HEEx template.
Renders a specific variation for a given component entry. Can be a single variation or a variation group. Returns rendered HEEx template.
Returns a precompiled tree of your storybook entries.
Link to this section Callbacks
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 path_to_first_leaf_entry() :: %PhxLiveStorybook.ComponentEntry{ module: term(), module_name: term(), name: term(), path: term(), relative_path: term() } | %PhxLiveStorybook.PageEntry{ module: term(), module_name: term(), name: term(), path: term(), relative_path: term() }
Returns the first leaf of the storybook content tree (ie. whichever entry which is not a folder)
@callback render_code(entry_module :: atom(), variation_id :: atom()) :: %Phoenix.LiveView.Rendered{ dynamic: term(), fingerprint: term(), root: term(), static: term() }
Renders code snippet of a specific variation for a given component 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_variation(entry_module :: atom(), variation_id :: atom()) :: %Phoenix.LiveView.Rendered{ dynamic: term(), fingerprint: term(), root: term(), static: term() }
Renders a specific variation for a given component entry. Can be a single variation or a variation group. Returns rendered HEEx template.
@callback storybook_entries() :: [ %PhxLiveStorybook.ComponentEntry{ module: term(), module_name: term(), name: term(), path: term(), relative_path: term() } | %PhxLiveStorybook.FolderEntry{ name: term(), relative_path: term(), sub_entries: term() } | %PhxLiveStorybook.PageEntry{ module: term(), module_name: term(), name: term(), path: term(), relative_path: term() } ]
Returns a precompiled tree of your storybook entries.