org.getshaka.shaka

Type members

Classlikes

trait Binding[V]

Base trait for Bindings. Since Bindings are hierarchical, they must manage registered child bindings.

Base trait for Bindings. Since Bindings are hierarchical, they must manage registered child bindings.

trait Component

A Shaka Component provides a template for some part of an application, as well as the means to render said template to the DOM.

A Shaka Component provides a template for some part of an application, as well as the means to render said template to the DOM.

object Frag
class LocalStorage[V](key: String)(implicit evidence$1: NativeConverter[V]) extends StorageManager[V]

Persists to LocalStorage
You should not use this StorageManager for types that may be Null or Unit, since localStorage returns only null if the value is undefined. Instead, use an Option type, or create your own StorageManager that uses a marker character when encountering null, like the ancient Linear A character "༗"

Persists to LocalStorage
You should not use this StorageManager for types that may be Null or Unit, since localStorage returns only null if the value is undefined. Instead, use an Option type, or create your own StorageManager that uses a marker character when encountering null, like the ancient Linear A character "༗"

See also
Companion
object
Companion
class
class NoStorage[V] extends StorageManager[V]

A no-op StorageManager

A no-op StorageManager

class NodeBinding[V](state: State[V], parentElement: Element, builder: () => V) extends Binding[V]

Binding subclass specialized for Nodes

Binding subclass specialized for Nodes

Type Params
V

bound value type

Value Params
builder

Function to create the DOM

parentElement

Element to append to

state

State this Binding is bound to

class OpenState[V](initialValue: V) extends State[V]

Open state that must be encapsulated.

Open state that must be encapsulated.

Type Params
V

the value.

Value Params
initialValue

The State's initial value, discarded if the StorageManager can fetch a value.

class PropBinding[V](state: State[V], builder: () => V) extends Binding[V]

Light-weight Binding subclass for binding CSS and JS properties.

Light-weight Binding subclass for binding CSS and JS properties.

Type Params
V

the state value type

Value Params
builder

Function binding the props

state

dependent State

class RootBinding extends Binding[Unit]

Binding at the root of the heirarchy. Operations do nothing.

Binding at the root of the heirarchy. Operations do nothing.

class SessionStorage[V](key: String)(implicit evidence$1: NativeConverter[V]) extends StorageManager[V]

Persists to Session Storage
You should not use this StorageManager for types that may be Null or Unit, since localStorage returns only null if the value is undefined. Instead, use an Option type, or create your own StorageManager that uses a marker character when encountering null, like the ancient Linear A character "༗"

Persists to Session Storage
You should not use this StorageManager for types that may be Null or Unit, since localStorage returns only null if the value is undefined. Instead, use an Option type, or create your own StorageManager that uses a marker character when encountering null, like the ancient Linear A character "༗"

See also
Companion
object
Companion
class
abstract
class State[V](initialValue: => V, storageManager: StorageManager[V])

A State that can be used to bind Nodes and their properties. You can get the current value with myState.value, and update with myState.value = newValue. These two methods are protected, so that state update logic is encapsulated within the object itself. This provides the same benefit as Redux's action - reducer - store trifecta.

A State that can be used to bind Nodes and their properties. You can get the current value with myState.value, and update with myState.value = newValue. These two methods are protected, so that state update logic is encapsulated within the object itself. This provides the same benefit as Redux's action - reducer - store trifecta.

Type Params
V

the value.

Value Params
initialValue

The State's initial value, discarded if the StorageManager can fetch a value.

storageManager

How the State should be persisted, such as in LocalStorage. By default, the State has no storage.

Used for fetching and storing States

Used for fetching and storing States

Type Params
V

the value type

trait WebComponent extends Component

A [[Component]] wrapped in a Custom Element. Custom Elements have useful lifecycle callbacks and can attach shadow-dom.

A [[Component]] wrapped in a Custom Element. Custom Elements have useful lifecycle callbacks and can attach shadow-dom.

See also
Companion
object
Companion
class

Types

opaque type Frag
type NodeBindingBuilder[V] = (Element, Binding[_]) => V => Unit

Given a parent Element and Binding, returns a function from the State value V to Unit.

Given a parent Element and Binding, returns a function from the State value V to Unit.

type PropBindingBuilder[V] = Binding[_] => V => Unit

Given a parent Binding, returns a function from the State value V to Unit

Given a parent Binding, returns a function from the State value V to Unit

Value members

Concrete methods

def render(comp: Component, element: Element): Unit
def render(frag: Frag, element: Element): Unit
def useState[V](initialValue: V): OpenState[V]

Open state that must be encapsulated. Similar in spirit to React's useState Hook.

Open state that must be encapsulated. Similar in spirit to React's useState Hook.

Extensions

Extensions

extension (f: Frag)
def render(using Element, Binding[_]): Unit