-module(lightspeed@component@template). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]). -define(FILEPATH, "src/lightspeed/component/template.gleam"). -export([function/1, render/3, slot/2, render_slot/1, with_slot_assigns/2, slot_assigns/1, empty_slot/0]). -export_type([slot/1]). -if(?OTP_RELEASE >= 27). -define(MODULEDOC(Str), -moduledoc(Str)). -define(DOC(Str), -doc(Str)). -else. -define(MODULEDOC(Str), -compile([])). -define(DOC(Str), -compile([])). -endif. ?MODULEDOC(" Function-component and slot composition helpers.\n"). -type slot(IHU) :: {slot, IHU, fun((IHU) -> lightspeed@component:rendered())}. -file("src/lightspeed/component/template.gleam", 15). ?DOC(" Build a function component.\n"). -spec function(fun((IHX, IHY) -> lightspeed@component:rendered())) -> fun((IHX, IHY) -> lightspeed@component:rendered()). function(Render) -> Render. -file("src/lightspeed/component/template.gleam", 22). ?DOC(" Render a function component.\n"). -spec render(fun((IIB, IIC) -> lightspeed@component:rendered()), IIB, IIC) -> lightspeed@component:rendered(). render(Function_component, Assigns, Slots) -> Function_component(Assigns, Slots). -file("src/lightspeed/component/template.gleam", 31). ?DOC(" Build one typed slot.\n"). -spec slot(IIF, fun((IIF) -> lightspeed@component:rendered())) -> slot(IIF). slot(Assigns, Render) -> {slot, Assigns, Render}. -file("src/lightspeed/component/template.gleam", 39). ?DOC(" Render one slot value.\n"). -spec render_slot(slot(any())) -> lightspeed@component:rendered(). render_slot(Slot) -> (erlang:element(3, Slot))(erlang:element(2, Slot)). -file("src/lightspeed/component/template.gleam", 44). ?DOC(" Replace slot assigns while preserving slot renderer.\n"). -spec with_slot_assigns(slot(IIJ), IIJ) -> slot(IIJ). with_slot_assigns(Slot, Assigns) -> {slot, Assigns, erlang:element(3, Slot)}. -file("src/lightspeed/component/template.gleam", 52). ?DOC(" Access slot assigns.\n"). -spec slot_assigns(slot(IIM)) -> IIM. slot_assigns(Slot) -> erlang:element(2, Slot). -file("src/lightspeed/component/template.gleam", 57). ?DOC(" Empty slot helper.\n"). -spec empty_slot() -> slot(nil). empty_slot() -> {slot, nil, fun(_) -> lightspeed@component:html(<<""/utf8>>) end}.