Skip to content

Taxonomy

This page provides centralized definitions for KEML-specific terminology.


action

An action in KEML is a global name, loosely similar to CSS class names as used in HTML.

It does not perform any work and is not owned by any element. It simply exists as a declared intent that elements may produce or consume.

For example, on:mouseover="foo bar" vs class="foo bar".
foo and bar are both global identifiers in their respective systems. They are not behavior — just names. In that sense, they are the same kind of thing.

Because actions are so simple, they can be understood by tooling.
They can be statically analyzed and strictly typed.

Actions can be either used as inputs or outputs. You can only input one action at a time into a receiving attribute, but output many.

There are 4* distinct action types in KEML:

  • event actions are generated by browser events
  • result actions are generated by server results
  • state actions are generated by evaluating state conditions
  • reference actions represent references to live computed element attributes
  • * SSE event types could be imagined as being the fifth type, in the sense that they are used as event-like input actions (the output is on the server). They technically are not, though. But, they are also not really events in the same way as DOM events are either (I swear it is not as bad as it sounds, KEML makes them really nice to work with)

You can only consume an action of a compatible type.

Info

All actions are global within the page they are used on.
Use unique action names when needed to prevent collisions.


state

A state in KEML does not represent data.

It is a boolean condition that an element can check on itself and output zero or more actions.

For example, if:loading="spinner".
loading is a state condition and spinner is a state action.


result

Even though this word may appear to be used interchangeably with response, the two are not equal in meaning.

A response is a reply to a request, while a result can also arrive completely unprompted, such as through SSE.

All responses are results, but not all results are responses.


Now that we're done with the formalities, lets see it in action 🎉