Dala.Plugin.ComponentDSL (dala v0.1.1)

Copy Markdown View Source

Evaluates the component definition DSL.

Processes the component "name" do ... end block, building up the component schema with props, events, native mappings, and capabilities.

Summary

Functions

Declares a capability that this component supports.

Evaluates a component definition block.

Defines an event that the component can emit.

Maps a component to a native platform class.

Defines a property for the component.

Functions

capability(capability)

(macro)

Declares a capability that this component supports.

Capabilities inform the runtime about special behaviors:

  • :gestures - handles pan/zoom/rotate gestures
  • :accessibility - provides accessibility tree
  • :animation - supports custom animations
  • :textures - renders to texture (e.g., camera, AR)
  • :overlay - can render above other content
  • :clipping - supports clipping masks
  • :touch - handles raw touch events
  • :keyboard - handles keyboard input
  • :focus - participates in focus navigation

Example

capability :gestures
capability :accessibility
capability :animation

eval(plugin_module, component, block)

Evaluates a component definition block.

event(name, opts \\ [])

(macro)

Defines an event that the component can emit.

Example

event "progress"
event "ended", payload: %{position: :f32, duration: :f32}

native(platform, class_name)

(macro)

Maps a component to a native platform class.

Example

native "ios", "DalaVideoView"
native "android", "com.dala.video.VideoView"

prop(name, type, opts \\ [])

(macro)

Defines a property for the component.

Types

  • :string - UTF-8 string
  • :bool - boolean (true/false)
  • :integer - signed 64-bit integer
  • :float - 64-bit float
  • :f32 - 32-bit float (binary protocol)
  • :f64 - 64-bit float (binary protocol)
  • :color - color token or ARGB integer
  • :binary - binary data
  • :list - list of values
  • :map - map/dictionary

Options

  • :required - if true, prop must be provided (default: false)
  • :default - default value if not provided
  • :doc - documentation string

Example

prop "volume", :f32, required: true
prop "autoplay", :bool, default: false
prop "source", :string