Guppy.Component (guppy v0.1.0)

Copy Markdown View Source

Compile-time Guppy template support.

use Guppy.Component imports the ~GUI sigil and common window assign/update helpers, compiling a restricted HEEx-style template syntax directly to Guppy IR.

The current template vocabulary intentionally matches Guppy's real IR surface:

  • <div>
  • <text>
  • <rich_text />
  • <button>
  • <checkbox />
  • <radio />
  • <scroll>
  • <uniform_list />
  • <list />
  • <data_table />
  • <tree />
  • <canvas />
  • <popover>
  • <select />
  • <image />
  • <icon />
  • <spacer />
  • <text_input />
  • <textarea />

It also supports first-pass function components:

  • dotted local tags like <.my_component> call a function in the current module with an assigns map
  • remote module tags call render/1 on that module
  • nested component content is passed as @children
  • prop/4 can declare required props, defaults, and simple validations

Expressions use {...} syntax. Assign lookups use @name, resolving from an assigns map in scope when it is a map, otherwise from a Guppy.Window value named window.

Summary

Functions

build_component_assigns(entries)

build_events(entries)

build_keyword(entries)

class_to_style!(value)

dynamic_child(value)

fetch_assign!(assigns, key)

flatten_children(children)

maybe_entry(key, value)

merge_styles(class_value, style_value)

normalize_child(children)

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

(macro)

sigil_GUI(arg, modifiers)

(macro)

template_assigns!(binding)

to_text(value)

validate_props!(module, component_name, assigns)