Represents a single component schema within a plugin.
Contains all metadata needed for code generation, validation, and runtime dispatch. This is the core of the schema-first architecture.
Summary
Functions
Adds a required capability to the component schema.
Adds an event to the component schema.
Adds a native platform mapping to the component schema.
Adds an optional capability to the component schema.
Adds a property to the component schema.
Types
@type event() :: %{ name: Dala.Plugin.event_name(), payload: map(), doc: String.t() | nil }
@type lifecycle_event() :: :create | :update | :layout | :event | :dispose
@type prop() :: %{ name: Dala.Plugin.prop_name(), type: Dala.Plugin.prop_type(), required: boolean(), default: term(), doc: String.t() | nil }
@type t() :: %Dala.Plugin.Component{ capabilities: [Dala.Plugin.capability()], doc: String.t() | nil, event_structs: %{required(atom()) => module()}, events: [event()], lifecycle: [lifecycle_event()], metadata: map(), name: Dala.Plugin.component_name(), natives: %{required(String.t()) => String.t()}, optional_capabilities: [atom()], plugin: Dala.Plugin.plugin_name(), props: [prop()] }
Functions
@spec add_capability(t(), Dala.Plugin.capability()) :: t()
Adds a required capability to the component schema.
@spec add_event(t(), Dala.Plugin.event_name(), keyword()) :: t()
Adds an event to the component schema.
Options:
:payload— map of field names to types (default: %{}):doc— documentation string (default: nil)
Adds a native platform mapping to the component schema.
platform is the platform string (e.g. "ios", "android").
class_name is the native class name to instantiate.
Adds an optional capability to the component schema.
Optional capabilities enhance the component but are not required for basic functionality.
@spec add_prop(t(), Dala.Plugin.prop_name(), Dala.Plugin.prop_type(), keyword()) :: t()
Adds a property to the component schema.
Options:
:required— boolean, whether the prop is required (default: false):default— default value (default: nil):doc— documentation string (default: nil)