zio.http.datastar
Members list
Type members
Classlikes
Modifies how a Datastar attribute key is cased when rendered by the DSL.
Modifies how a Datastar attribute key is cased when rendered by the DSL.
Case modifiers contribute a __case.* suffix to attribute names when the selected case differs from the default case for that attribute builder.
Attributes
- Companion
- object
- Source
- CaseModifier.scala
- Supertypes
- Known subtypes
Attributes
- Companion
- trait
- Source
- CaseModifier.scala
- Supertypes
- Self type
-
CaseModifier.type
Builder for the data-init Datastar attribute.
Builder for the data-init Datastar attribute.
Modifiers such as delay and viewTransition are encoded into the final attribute name and normalized so repeated modifiers collapse to the last effective value. Use := to assign the Datastar expression that should run during initialization.
Attributes
- Source
- DataInit.scala
- Supertypes
A data-on:* attribute builder with optional event modifiers.
A data-on:* attribute builder with optional event modifiers.
Chain modifiers like debounce, throttle, once, prevent, stop, capture, passive, outside, window, document, and viewTransition before assigning a handler with :=. Case modifiers (camel, kebab, snake, pascal) control attribute name casing. Repeated timing or target modifiers are normalized to the last effective value before the final attribute name is rendered.
Attributes
- Source
- DataOn.scala
- Supertypes
Builder for data-on-intersect Datastar attributes.
Builder for data-on-intersect Datastar attributes.
Visibility, timing, and transition modifiers are encoded into the final attribute name. Repeated modifiers are normalized to a single effective suffix. Use once, half, full, exit, threshold, delay, debounce, throttle, and viewTransition to model Datastar's supported intersection semantics.
Attributes
- Source
- DataOnIntersect.scala
- Supertypes
Builder for data-on-interval Datastar attributes.
Builder for data-on-interval Datastar attributes.
Duration modifiers describe how often the interval fires, and durationLeading encodes Datastar's leading-edge interval variant. Repeated modifiers are normalized to the last effective duration. Use := to assign the expression executed on each interval tick.
Attributes
- Source
- DataOnInterval.scala
- Supertypes
Builder for data-on-signal-patch Datastar attributes.
Builder for data-on-signal-patch Datastar attributes.
Delay, debounce, and throttle modifiers are encoded into the final attribute name. Repeated timing modifiers are normalized to the last effective value. Use := to attach the Datastar expression that should run when a signal patch arrives.
Attributes
- Source
- DataOnSignalPatch.scala
- Supertypes
Builds data-signals: attributes for a named signal key.
Builds data-signals: attributes for a named signal key.
The base key uses the kebab-cased signalName. Case modifier methods append a __case.* suffix when a non-default casing is requested. Values assigned with := must be valid Datastar expressions and become the attribute value rendered for that keyed signal.
Attributes
- Source
- DataSignalsBuilder.scala
- Supertypes
Low-level key for constructing Datastar data-* attributes directly.
Low-level key for constructing Datastar data-* attributes directly.
Most callers should prefer higher-level data* helpers from DatastarAttributes. Use DatastarAttrKey when defining a custom Datastar attribute name or when no dedicated helper exists yet. Values assigned with := are rendered through ToDatastarExpr, so expression contexts reject raw Scala String values in favor of explicit Datastar expressions.
Attributes
- Companion
- object
- Source
- DatastarAttrKey.scala
- Supertypes
Attributes
- Companion
- class
- Source
- DatastarAttrKey.scala
- Supertypes
- Self type
-
DatastarAttrKey.type
Mixin providing Datastar data-* attribute constructors for the HTML DSL.
Mixin providing Datastar data-* attribute constructors for the HTML DSL.
Typical usage is through the package object via import zio.http.datastar._. The methods in this trait build the Datastar attribute DSL surface, including signal initialization (dataSignals), bindings (dataBind), event handlers (dataOn), DOM updates (dataText, dataShow, dataClass, dataStyle, dataAttr), and lifecycle hooks (dataInit, dataOnIntersect, dataOnInterval, dataOnSignalPatch).
Attribute values are rendered as Datastar expressions, not as generic HTML string values. In expression positions use typed values such as Signal, SignalUpdate, DatastarRef, or explicit js"..." expressions.
Attributes
- Source
- DatastarAttributes.scala
- Supertypes
A Datastar SSE event that can be sent to the browser.
A Datastar SSE event that can be sent to the browser.
Sealed trait with builder-style constructors in the companion object. Use DatastarEvent.patchElements, DatastarEvent.patchSignals, DatastarEvent.executeScript, or DatastarEvent.removeElements to create events, then call renderSSE to produce the SSE wire format. Builder options map directly to emitted SSE fields such as selector, mode, useViewTransition, namespace, id, and retry.
val sse = DatastarEvent.patchSignals(count := 42).eventId("evt-1").renderSSE
// event: datastar-patch-signals
// id: evt-1
// data: signals {"count":42}
Attributes
- Companion
- object
- Source
- DatastarEvent.scala
- Supertypes
Attributes
- Companion
- trait
- Source
- DatastarEvent.scala
- Supertypes
- Self type
-
DatastarEvent.type
Attributes
- Companion
- class
- Source
- DatastarRef.scala
- Supertypes
- Self type
-
DatastarRef.type
Attributes
- Companion
- object
- Source
- DatastarRef.scala
- Supertypes
Attributes
- Companion
- trait
- Source
- ElementPatchMode.scala
- Supertypes
- Self type
-
ElementPatchMode.type
Describes how Datastar should patch rendered content into the target element.
Describes how Datastar should patch rendered content into the target element.
Outer is the default patch mode and is omitted from SSE rendering.
Attributes
- Companion
- object
- Source
- ElementPatchMode.scala
- Supertypes
- Known subtypes
Attributes
- Companion
- trait
- Source
- EventModifier.scala
- Supertypes
- Self type
-
EventModifier.type
Modifier ADT used by dataOn event bindings.
Modifier ADT used by dataOn event bindings.
Modifiers alter Datastar's event-handling semantics, such as debounce, throttle, delay, capture phase, and propagation/default handling. The rendered form is encoded directly into the attribute name. Composition via EventModifier.And preserves left-to-right ordering of suffixes.
Attributes
- Companion
- object
- Source
- EventModifier.scala
- Supertypes
- Known subtypes
Datastar event types emitted via the SSE event: field.
Datastar event types emitted via the SSE event: field.
The rendered string returned by render is the protocol-level event name sent on the wire.
Attributes
- Companion
- object
- Source
- EventType.scala
- Supertypes
- Known subtypes
-
object PatchElementsobject PatchSignals
Attributes
- Companion
- trait
- Source
- EventType.scala
- Supertypes
- Self type
-
EventType.type
Modifier ADT used by data-init builders.
Modifier ADT used by data-init builders.
Init modifiers are encoded as __... suffixes and normalized so repeated delay or view-transition markers collapse to one effective form.
Attributes
- Companion
- object
- Source
- InitModifier.scala
- Supertypes
- Known subtypes
Attributes
- Companion
- trait
- Source
- InitModifier.scala
- Supertypes
- Self type
-
InitModifier.type
Attributes
- Companion
- trait
- Source
- IntersectModifier.scala
- Supertypes
- Self type
-
IntersectModifier.type
Modifier ADT used by data-on-intersect builders.
Modifier ADT used by data-on-intersect builders.
Intersect modifiers encode visibility thresholds, timing behavior, and view transitions into the attribute name. Composition preserves left-to-right ordering, while normalization collapses conflicting threshold/timing choices.
Attributes
- Companion
- object
- Source
- IntersectModifier.scala
- Supertypes
- Known subtypes
Attributes
- Companion
- trait
- Source
- OnIntervalModifier.scala
- Supertypes
- Self type
-
OnIntervalModifier.type
Modifier ADT used by data-on-interval builders.
Modifier ADT used by data-on-interval builders.
Interval modifiers encode the polling duration and optional view transition. Duration(..., leading = true) represents Datastar's leading-edge interval variant. Composition via OnIntervalModifier.And preserves the order of encoded suffixes before normalization removes redundant duration entries.
Attributes
- Companion
- object
- Source
- OnIntervalModifier.scala
- Supertypes
- Known subtypes
Attributes
- Companion
- trait
- Source
- OnSignalPatchModifier.scala
- Supertypes
- Self type
Modifier ADT used by data-on-signal-patch builders.
Modifier ADT used by data-on-signal-patch builders.
Supported modifiers delay, debounce, or throttle reactions to incoming signal patches. Composition preserves left-to-right ordering and normalization keeps the last effective modifier of each timing family.
Attributes
- Companion
- object
- Source
- OnSignalPatchModifier.scala
- Supertypes
- Known subtypes
Entry point for building data-on:* event handler attributes.
Entry point for building data-on:* event handler attributes.
Obtained via dataOn from DatastarAttributes. Select an event (click, submit, keydown, etc.) to get a DataOn builder, then assign a handler with :=. Use apply for custom event names.
dataOn.click := js"alert('hi')"
dataOn("custom-event").debounce(500) := count.ref
Attributes
- Source
- DataOn.scala
- Supertypes
A named reactive signal for the Datastar frontend framework.
A named reactive signal for the Datastar frontend framework.
Represents a client-side signal identified by name. Signal names are validated at construction time. Literal names are checked at compile time, and dynamic names are checked at runtime. Names must be dot-separated JavaScript identifiers and must not contain __, which Datastar reserves for modifier syntax. Use := to create a SignalUpdate that pairs this signal with a JSON-serialized value.
val count = Signal[Int]("count")
count := 0 // SignalUpdate ready for patchSignals
Attributes
- Companion
- object
- Source
- Signal.scala
- Supertypes
Attributes
- Companion
- class
- Source
- Signal.scala
- Supertypes
- Self type
-
Signal.type
A signal name paired with its JSON-serialized value.
A signal name paired with its JSON-serialized value.
Created via Signal.:=. The name is the signal identifier and serialized is the JSON string produced by the signal's schema codec. Used by DatastarEvent.patchSignals to build SSE payloads and by the ToJs instance to render inline JavaScript object literals.
serialized is inserted verbatim into the final object expression, so it must already be valid JSON for the value being assigned.
Attributes
- Companion
- object
- Source
- SignalUpdate.scala
- Supertypes
Attributes
- Companion
- class
- Source
- SignalUpdate.scala
- Supertypes
- Self type
-
SignalUpdate.type
Attributes
- Companion
- object
- Source
- ToDatastarExpr.scala
- Supertypes
Attributes
- Companion
- trait
- Source
- ToDatastarExpr.scala
- Supertypes
- Self type
-
ToDatastarExpr.type
Value members
Inherited methods
Attributes
- Inherited from:
- DatastarAttributes
- Source
- DatastarAttributes.scala
Attributes
- Inherited from:
- DatastarAttributes
- Source
- DatastarAttributes.scala
Attributes
- Inherited from:
- DatastarAttributes
- Source
- DatastarAttributes.scala
Attributes
- Inherited from:
- DatastarAttributes
- Source
- DatastarAttributes.scala
Attributes
- Inherited from:
- DatastarAttributes
- Source
- DatastarAttributes.scala
Attributes
- Inherited from:
- DatastarAttributes
- Source
- DatastarAttributes.scala
Attributes
- Inherited from:
- DatastarAttributes
- Source
- DatastarAttributes.scala
Attributes
- Inherited from:
- DatastarAttributes
- Source
- DatastarAttributes.scala
Attributes
- Inherited from:
- DatastarAttributes
- Source
- DatastarAttributes.scala
Attributes
- Inherited from:
- DatastarAttributes
- Source
- DatastarAttributes.scala
Attributes
- Inherited from:
- DatastarAttributes
- Source
- DatastarAttributes.scala
Attributes
- Inherited from:
- DatastarAttributes
- Source
- DatastarAttributes.scala
Attributes
- Inherited from:
- DatastarAttributes
- Source
- DatastarAttributes.scala
Attributes
- Inherited from:
- DatastarAttributes
- Source
- DatastarAttributes.scala
Attributes
- Inherited from:
- DatastarAttributes
- Source
- DatastarAttributes.scala
Attributes
- Inherited from:
- DatastarAttributes
- Source
- DatastarAttributes.scala
Attributes
- Inherited from:
- DatastarAttributes
- Source
- DatastarAttributes.scala
Attributes
- Inherited from:
- DatastarAttributes
- Source
- DatastarAttributes.scala
Attributes
- Inherited from:
- DatastarAttributes
- Source
- DatastarAttributes.scala
Attributes
- Inherited from:
- DatastarAttributes
- Source
- DatastarAttributes.scala
Attributes
- Inherited from:
- DatastarAttributes
- Source
- DatastarAttributes.scala
Attributes
- Inherited from:
- DatastarAttributes
- Source
- DatastarAttributes.scala