Source-owned per-workspace UI feature state.
Feature state is for presentation features that need tab-scoped state without adding permanent fields to MingaEditor.Session.State. Values are opaque to the registry. The owning feature decides the value shape and updates it through the helpers here and on MingaEditor.Session.State.
Summary
Types
Feature state registry keyed first by source and then by feature id.
Feature identifier owned by a source.
Source that owns feature state.
Opaque feature-owned value.
Functions
Drops one source-owned feature value.
Drops every extension-owned feature value while preserving built-in and config state.
Drops every feature value owned by source.
Returns true when no feature state is stored.
Registers the source-cleanup callback used by extension unload/reload.
Fetches a source-owned feature value.
Returns the value for a source-owned feature, or nil when missing.
Returns the value for a source-owned feature, or a caller-provided default when missing.
Returns true when the source owns the feature id.
Creates an empty feature-state registry.
Stores a source-owned feature value.
Cleanup callback bridge used by Minga.Extension.ContributionCleanup.
Cleanup callback bridge against an explicit editor server. Useful for tests.
Updates a source-owned feature value. Missing values are initialized with default.
Returns true for supported feature ids.
Returns true for supported contribution source identifiers.
Types
@type entries() :: %{optional(source()) => %{optional(feature_id()) => value()}}
Feature state registry keyed first by source and then by feature id.
@type feature_id() :: atom()
Feature identifier owned by a source.
@type source() :: Minga.Extension.ContributionCleanup.contribution_source()
Source that owns feature state.
@type t() :: %MingaEditor.FeatureState{entries: entries()}
@type value() :: term()
Opaque feature-owned value.
Functions
@spec drop(t(), source(), feature_id()) :: t()
Drops one source-owned feature value.
Drops every extension-owned feature value while preserving built-in and config state.
Drops every feature value owned by source.
Returns true when no feature state is stored.
@spec ensure_cleanup_registered() :: :ok
Registers the source-cleanup callback used by extension unload/reload.
@spec fetch(t(), source(), feature_id()) :: {:ok, value()} | :error
Fetches a source-owned feature value.
@spec get(t(), source(), feature_id()) :: value() | nil
Returns the value for a source-owned feature, or nil when missing.
@spec get(t(), source(), feature_id(), default) :: value() | default when default: var
Returns the value for a source-owned feature, or a caller-provided default when missing.
@spec member?(t(), source(), feature_id()) :: boolean()
Returns true when the source owns the feature id.
@spec new() :: t()
Creates an empty feature-state registry.
@spec put(t(), source(), feature_id(), value()) :: t()
Stores a source-owned feature value.
Cleanup callback bridge used by Minga.Extension.ContributionCleanup.
@spec unregister_source(source(), GenServer.server() | nil) :: :ok | {:error, term()}
Cleanup callback bridge against an explicit editor server. Useful for tests.
Updates a source-owned feature value. Missing values are initialized with default.
Returns true for supported feature ids.
Returns true for supported contribution source identifiers.