Directives

What you will find: a precise, alphabetical-by-category reference of every directive and shorthand Sercrod recognizes. Each entry states the value form, when it is evaluated, and what side effects it has on data, attributes, DOM, and events. No tutorials or design commentary are included.

Conventions


1) Control flow

*if="expr"

*elseif="expr"

*else

*switch="expr"

*case="valueExpr"

*case.break="valueExpr"

*break


2) Iteration

*each="iterableExpr as item[, index]"

*for="loopExpr"

*iterate="iterableExpr"


3) Variables and scope

*let="assignments"

*global="assignments"

*literal="jsonLike"

*rem="comment"


4) Input and staging

*input="pathExpr"

*lazy

*eager

*stage

*apply

*restore

*save

*load


5) Output

*print="expr"

*compose="expr"

*textContent="expr" / *innerHTML="expr"

Non-structural change path


6) Attributes and shorthands

:class="expr" (alias: n-class="expr")

:style="expr" (alias: n-style="expr")

Attribute change commands


7) Communication (HTTP and API)

*fetch[="urlExpr"]

*post="urlExpr"

*api="expr"

*response="target"

*into="name"


8) Files

*camera, *camera.capture, *camera.pick

*clipboard, *clipboard.write, *clipboard.copy, *clipboard.read

*audio-capture, *audio-capture.start, *audio-capture.pause, *audio-capture.resume, *audio-capture.stop, *audio-capture.cancel

*geolocation, *geolocation.current, *geolocation.watch, *geolocation.clear

*network-status, *network-status.current, *network-status.watch, *network-status.clear

*diagnostics, *diagnostics.send, *diagnostics.clear

*screen-state, *screen-state.current, *screen-state.watch, *screen-state.clear

*wake-lock, *wake-lock.request, *wake-lock.release, *wake-lock.status

*haptics, *haptics.impact, *haptics.selection, *haptics.notification, *haptics.vibrate, *haptics.status

*share

*notification

*push

*background-notification

*foreground-notification

*barcode

*upload="targetExpr"

*download="urlOrBlobExpr"


9) WebSocket

*websocket="urlExpr"

*ws-send="payloadExpr"


10) Events and handlers

@type="expr" (event handler)


11) Lifecycle helpers and methods

*updated="handlers"

*update="target"

*methods="namesOrObjects"

*log="expr"

*strict

*prevent-default


Errors and events


Next page: lifecycle.md