Minga.Config.ThemeRegistry (Minga v0.1.0)

Copy Markdown View Source

Layer 0 registry of available themes with source-owned registration.

Stores theme data (opaque to this module) with source ownership tracking so that disabling or reloading an extension pack cleanly removes only that pack's themes. The core minimal theme (:minga_default) is always present in the name list but not stored here; it lives in MingaEditor.UI.Theme.Fallback and is only used when selected explicitly.

Config.Options and Config.Completion query available/0 for validation and tab-completion without importing from MingaEditor.*.

Summary

Types

Source that contributed registry entries.

Duplicate name error tuple.

Functions

Returns the sorted list of available theme name atoms.

Looks up theme data by name.

Registers themes with explicit source ownership. Theme data is opaque to this module.

Seeds the registry with the core fallback theme. Called at application start.

Returns source ownership metadata.

Returns the map of all registered theme data (opaque to callers in this layer).

Removes every theme contributed by a source.

Types

contribution_source()

@type contribution_source() :: :builtin | :config | {:extension, atom()}

Source that contributed registry entries.

register_error()

@type register_error() ::
  {:duplicate_name, atom(), existing_source :: contribution_source(),
   attempted_source :: contribution_source()}

Duplicate name error tuple.

Functions

available()

@spec available() :: [atom()]

Returns the sorted list of available theme name atoms.

get_theme(name)

@spec get_theme(atom()) :: {:ok, term()} | :error

Looks up theme data by name.

register_themes(themes, source)

@spec register_themes(%{required(atom()) => term()}, contribution_source()) ::
  :ok | {:error, register_error()}

Registers themes with explicit source ownership. Theme data is opaque to this module.

seed_builtin()

@spec seed_builtin() :: :ok

Seeds the registry with the core fallback theme. Called at application start.

stored_sources()

@spec stored_sources() :: %{required(atom()) => contribution_source()}

Returns source ownership metadata.

stored_themes()

@spec stored_themes() :: %{required(atom()) => term()}

Returns the map of all registered theme data (opaque to callers in this layer).

unregister_source(source)

@spec unregister_source(contribution_source()) :: :ok

Removes every theme contributed by a source.