View Source PhxLiveStorybook.BackendBehaviour behaviour (phx_live_storybook v0.4.5)

Behaviour implemented by your backend module.

Link to this section Summary

Callbacks

Returns a configuration value from your config.exs storybook settings.

Returns a precompiled tree of your storybook stories.

Returns an entry from its absolute storybook path (not filesystem).

Returns all the nodes (stoires & folders) of the storybook content tree as a flat list.

Returns all the leaves (only stories) of the storybook content tree.

Retuns a storybook path from a story module.

Link to this section Callbacks

@callback config(key :: atom(), default :: any()) :: any()

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 content_tree() :: [
  %PhxLiveStorybook.FolderEntry{
    entries: term(),
    icon: term(),
    name: term(),
    open?: term(),
    path: term()
  }
  | %PhxLiveStorybook.StoryEntry{icon: term(), name: term(), path: term()}
]

Returns a precompiled tree of your storybook stories.

@callback find_entry_by_path(String.t()) ::
  %PhxLiveStorybook.FolderEntry{
    entries: term(),
    icon: term(),
    name: term(),
    open?: term(),
    path: term()
  }
  | %PhxLiveStorybook.StoryEntry{icon: term(), name: term(), path: term()}

Returns an entry from its absolute storybook path (not filesystem).

@callback flat_list() :: [
  %PhxLiveStorybook.FolderEntry{
    entries: term(),
    icon: term(),
    name: term(),
    open?: term(),
    path: term()
  }
  | %PhxLiveStorybook.StoryEntry{icon: term(), name: term(), path: term()}
]

Returns all the nodes (stoires & folders) of the storybook content tree as a flat list.

@callback leaves() :: [
  %PhxLiveStorybook.StoryEntry{icon: term(), name: term(), path: term()}
]

Returns all the leaves (only stories) of the storybook content tree.

@callback storybook_path(atom()) :: String.t()

Retuns a storybook path from a story module.