lustre_hx
Types
Event
Used by the trigger function.
A trigger can also have additional modifiers that change its behavior, represented as a List(EventModifier).
pub type Event {
  Event(event: String, modifiers: List(EventModifier))
}Constructors
- 
          Event(event: String, modifiers: List(EventModifier))
pub type EventModifier {
  Once
  Changed
  Delay(Timing)
  Throttle(Timing)
  From(extended_css_selector: ExtendedCssSelector)
  Target(css_selector: String)
  Consume
  QueueEvent(Option(Queue))
}Constructors
- 
          Once
- 
          Changed
- 
          Delay(Timing)
- 
          Throttle(Timing)
- 
          From(extended_css_selector: ExtendedCssSelector)
- 
          Target(css_selector: String)
- 
          Consume
- 
          QueueEvent(Option(Queue))
pub type ExtendedCssSelector {
  CssSelector(css_selector: String)
  Document
  Window
  Closest(css_selector: String)
  Find(css_selector: String)
  Next(css_selector: Option(String))
  Previous(css_selector: Option(String))
  This
}Constructors
- 
          CssSelector(css_selector: String)
- 
          Document
- 
          Window
- 
          Closest(css_selector: String)
- 
          Find(css_selector: String)
- 
          Next(css_selector: Option(String))
- 
          Previous(css_selector: Option(String))
- 
          This
pub type Swap {
  InnerHTML
  OuterHTML
  After
  Afterbegin
  Beforebegin
  Beforeend
  Afterend
  Delete
  SwapNone
}Constructors
- 
          InnerHTML
- 
          OuterHTML
- 
          After
- 
          Afterbegin
- 
          Beforebegin
- 
          Beforeend
- 
          Afterend
- 
          Delete
- 
          SwapNone
pub type SwapOption {
  Transition(Bool)
  Swap(Timing)
  Settle(Timing)
  IgnoreTitle(Bool)
  Scroll(Scroll)
  Show(Scroll)
  FocusScroll(Bool)
}Constructors
- 
          Transition(Bool)
- 
          Swap(Timing)
- 
          Settle(Timing)
- 
          IgnoreTitle(Bool)
- 
          Scroll(Scroll)
- 
          Show(Scroll)
- 
          FocusScroll(Bool)
pub type SyncOption {
  Default(css_selector: String)
  Drop(css_selector: String)
  Abort(css_selector: String)
  Replace(css_selector: String)
  SyncQueue(css_selector: String, queue: Queue)
}Constructors
- 
          Default(css_selector: String)
- 
          Drop(css_selector: String)
- 
          Abort(css_selector: String)
- 
          Replace(css_selector: String)
- 
          SyncQueue(css_selector: String, queue: Queue)
Functions
pub fn delete(url url: String) -> Attribute(a)hx-delete
Issues a DELETE request to the given URL when the element is triggered. By default, AJAX requests are triggered by the “natural” event of an element:
- input, textarea & select are triggered on the change event
- form is triggered on the submit event
- everything else is triggered by the click event
If you want different behavior you can use the hx-trigger attribute, provided by lustre_hx.trigger, to specify which event will cause the request.
pub fn get(url url: String) -> Attribute(a)hx-get
Issues a GET request to the given URL when the element is triggered. By default, AJAX requests are triggered by the “natural” event of an element:
- input, textarea & select are triggered on the change event
- form is triggered on the submit event
- everything else is triggered by the click event
If you want different behavior you can use the hx-trigger attribute, provided by lustre_hx.trigger, to specify which event will cause the request.
pub fn hyper_script(script: String) -> Attribute(a)pub fn indicator(
  css_selector_or_closest css_selector_or_closest: String,
) -> Attribute(a)pub fn patch(url url: String) -> Attribute(a)hx-patch
Issues a PATCH request to the given URL when the element is triggered. By default, AJAX requests are triggered by the “natural” event of an element:
- input, textarea & select are triggered on the change event
- form is triggered on the submit event
- everything else is triggered by the click event
If you want different behavior you can use the hx-trigger attribute, provided by lustre_hx.trigger, to specify which event will cause the request.
pub fn post(url url: String) -> Attribute(a)hx-post
Issues a POST request to the given URL when the element is triggered. By default, AJAX requests are triggered by the “natural” event of an element:
- input, textarea & select are triggered on the change event
- form is triggered on the submit event
- everything else is triggered by the click event
If you want different behavior you can use the hx-trigger attribute, provided by lustre_hx.trigger, to specify which event will cause the request.
pub fn put(url url: String) -> Attribute(a)hx-put
Issues a PUT request to the given URL when the element is triggered. By default, AJAX requests are triggered by the “natural” event of an element:
- input, textarea & select are triggered on the change event
- form is triggered on the submit event
- everything else is triggered by the click event
If you want different behavior you can use the hx-trigger attribute, provided by lustre_hx.trigger, to specify which event will cause the request.
pub fn target(
  extended_css_selector extended_css_selector: ExtendedCssSelector,
) -> Attribute(a)pub fn trigger(events: List(Event)) -> Attribute(a)hx-trigger
By default, AJAX requests are triggered by the “natural” event of an element:
- input, textarea & select are triggered on the change event
- form is triggered on the submit event
- everything else is triggered by the click event
If you want different behavior you can use the hx-trigger attribute to specify which event will cause the request.
pub fn trigger_load_polling(
  timing_declaration timing: Timing,
  filters filters: String,
) -> Attribute(a)pub fn trigger_polling(
  timing_declaration timing: Timing,
  filters filters: Option(String),
) -> Attribute(a)