Sercrod AI Directives Reference
This is the HTML-published copy of docs/spec/ai-directives.md. Use it with the current sercrod-current.zip, sercrod.js, and man.json.
For implementation-sensitive behavior, the current runtime remains the source of truth. If this page and sercrod.js disagree, inspect the runtime.
Sercrod AI Directives Reference
This file is an AI-facing directive reference for Sercrod.
Document status:
placement-ready complete version
source file target: docs/spec/ai-directives.md
validated by: ai-directives-test-plan.md result, with Test 14 and Test 52 caution notes resolved
source inspected: dist/sercrod.js
use with: docs/spec/ai-runtime-rules.md and current dist/sercrod.js
This file is prepared from dist/sercrod.js, refined
through directive-family tests, and cleaned as a placement-ready version
for docs/spec/ai-directives.md.
This file is not the implementation source of truth. The current
dist/sercrod.js remains the source of truth for implemented
behavior. If this file and dist/sercrod.js disagree,
dist/sercrod.js wins. If a behavior is not clearly
implemented in dist/sercrod.js, AI must mark it as
uncertain or planned, not implemented.
Use this file as:
AI reading aid for directive meaning, risk, status, and safe edits
Use level:
This file may be placed as docs/spec/ai-directives.md as the current AI-facing directive reference.
It is safe as an AI reading aid.
It is not a replacement for source inspection when editing implementation-sensitive code.
Do not use this file as:
a replacement for dist/sercrod.js
a promise that planned or uncertain behavior is implemented
a reason to add framework-style mechanisms
1. Reading order
Before editing Sercrod behavior, read in this order:
1. project instructions if present
2. docs/spec/ai-runtime-rules.md
3. docs/spec/ai-directives.md
4. the update-path sections in docs/spec/ai-runtime-rules.md when update behavior is involved
5. current dist/sercrod.js
If there is any conflict, current dist/sercrod.js wins
for implemented behavior.
2. Status values
implemented - present in current runtime behavior according to inspected source
implemented pattern - a supported pattern, not one fixed directive name
alias - compatibility or alternate name; do not prefer in new AI examples
helper - works as part of another directive flow
deprecated - avoid unless maintaining old code
internal only - implementation detail, not public guidance
planned - design direction, not implemented unless source confirms it
uncertain - do not guess; inspect source or official samples
Important:
A directive is not implemented merely because it appears in this file.
The status field controls how AI should treat it.
When uncertain, write uncertain rather than filling the gap with common-framework behavior.
3. Global must-not rules
AI must not:
add or search for Proxy-based change detection
add MutationObserver-based change detection
add watcher systems
add virtual DOM reconciliation
rewrite Sercrod HTML into JavaScript components by default
treat Sercrod as a smaller common framework
collapse *for, *each, and *iterate into one loop concept
weaken *dominate to restore normal automatic rerendering
teach aliases as preferred names
expose internal functions as public APIs without explicit instruction
4. Directive index
conditional
| directive | status | purpose |
|---|---|---|
*if |
implemented | Render this element only when its expression is truthy; also participates as the first branch in … |
*elseif |
implemented | Render as a later branch in a preceding *if chain when its expression is truthy and earlier branc… |
*else |
implemented | Render as the fallback branch in a preceding if/elseif chain. |
*condition |
implemented | Evaluate one condition and apply branch fragments from true or false helper attributes to the s… |
*cond |
alias | Alias of *condition. |
*switch |
implemented | Select a switch value and render matching case / default children with fallthrough until break. |
*case |
implemented | Case branch inside *switch. |
*break |
implemented | Stop switch fallthrough when used with a rendered *case. |
*case.break |
implemented | Case branch that also stops switch fallthrough when matched/rendered. |
*default |
implemented | Fallback branch inside *switch. |
*true |
helper | Helper attribute for condition/cond true branch. Not an independent core directive. |
*false |
helper | Helper attribute for condition/cond false branch. Not an independent core directive. |
repetition
| directive | status | purpose |
|---|---|---|
*for |
implemented | Repeat the element itself for each item from a list/object expression. |
*each |
implemented | Keep the container element and repeat its child nodes for each item. |
placement
| directive | status | purpose |
|---|---|---|
*iterate |
implemented | Synchronize a managed placement region by selecting registered
*template names per item; not a simple loop.
|
*unit |
deprecated | v0.1 iterate candidate marker; v0.2 *iterate does not
use it. |
*entry |
deprecated | v0.1 compatibility alias for *unit; v0.2
*iterate does not use it.
|
template
| directive | status | purpose |
|---|---|---|
*template |
implemented | Declare and register a named reusable template source; declaration itself is not ordinary output. |
*include |
implemented | Insert the inner content of a named *template into the current element while keeping the current … |
*import |
implemented | Import external HTML into normal render flow; do not treat as ES module import. |
render-control
| directive | status | purpose |
|---|---|---|
*dominate |
implemented | Avoid normal automatic host full rerender; allow iterate synchronization and explicit update path… |
staged-editing
| directive | status | purpose |
|---|---|---|
*stage |
implemented | Use a staged copy as display/edit scope; edits are not committed until apply. |
*apply |
implemented | Commit staged edits to the real target data. |
*restore |
implemented | Discard staged edits and restore stage from real data. |
input
| directive | status | purpose |
|---|---|---|
*input |
implemented | Bind form control value to an explicit data expression and write input/change values directly. |
input/update
| directive | status | purpose |
|---|---|---|
*lazy |
implemented | Avoid host full rerender for input/update paths where applicable; child updates may still run. |
*eager |
implemented | Force more immediate host update from input/change paths where applicable. |
scope
| directive | status | purpose |
|---|---|---|
*let |
implemented | Evaluate local expression/assignments and continue rendering with a local scope layered over the … |
*global |
implemented | Evaluate assignment-like expressions that write to host data when a key exists, otherwise globalT… |
storage
| directive | status | purpose |
|---|---|---|
*save |
implemented | Save the host data or staged data as JSON through the file save path, with legacy key selection s… |
*save.file |
implemented | Save host data or selected *keys as a JSON file, using
the given filename when provided. |
*save.session |
implemented | Save host data or selected *keys as JSON into
sessionStorage under the resolved storage key.
|
*save.store |
implemented | Save host data or selected *keys as JSON into
persistent browser storage backed by IndexedDB. |
*load |
implemented | Load JSON state through the file-load path, with legacy key selection support. |
*load.file |
implemented | Load JSON from a browser-selected file or file adapter and place it into host data. |
*load.session |
implemented | Load JSON from sessionStorage and place it into host
data according to *keys and *into. |
*load.store |
implemented | Load JSON from persistent browser storage backed by IndexedDB and place it into host data. |
storage/network
| directive | status | purpose |
|---|---|---|
*keys |
implemented | Select whitespace-separated top-level data keys for save, load, and WebSocket send operations. |
*params |
implemented | Add request metadata parameters to supported communication request envelopes. |
*dry-run |
implemented | Mark supported communication request envelopes as dry-run requests; the receiver must honor the marker. |
*response |
implemented | Map parsed communication responses from *post,
*api, and *upload into host data.
|
*into |
implemented | Name the destination key for directives that support direct placement; compatibility alias for communication whole-response placement. |
network
| directive | status | purpose |
|---|---|---|
*post |
implemented | Send selected host data or staged data as a Sercrod JSON request envelope by POST. |
*fetch |
implemented | Fetch JSON and write it into host data, either replacing the root or
writing to a :prop target. |
*api |
implemented | Unified API bridge for GET/non-GET requests and file input uploads,
with optional *response placement. |
websocket
| directive | status | purpose |
|---|---|---|
*websocket |
implemented | Open and manage a WebSocket connection for a host or element, placing incoming messages into WebS… |
*websocket.send |
implemented | Send selected data through a WebSocket connection using the unified WebSocket send form. |
*ws-send |
implemented | Legacy-compatible WebSocket send directive that evaluates its expression as the outgoing payload. |
*ws-to |
implemented | Select the target WebSocket URL for legacy
*ws-send.
|
file-bridge
| directive | status | purpose |
|---|---|---|
*camera |
implemented | Capture a new image through sercrod.camera; default
action is capture. |
*camera.capture |
implemented | Explicit capture form of *camera. |
*camera.pick |
implemented | Pick an existing image through sercrod.camera. |
*clipboard |
implemented | Write text to the clipboard through sercrod.clipboard;
default action is write. |
*clipboard.write |
implemented | Explicit clipboard write action. |
*clipboard.copy |
implemented | Alias of clipboard write. |
*clipboard.read |
implemented | Explicit clipboard read action. |
*audio-capture |
implemented | Start microphone recording through
sercrod.audio_capture; default action is start.
|
*audio-capture.start |
implemented | Explicit audio recording start action. |
*audio-capture.pause |
implemented | Pause the active audio recording. |
*audio-capture.resume |
implemented | Resume a paused audio recording. |
*audio-capture.stop |
implemented | Stop recording and place the final result. |
*audio-capture.cancel |
implemented | Cancel recording without placing a preview result. |
*geolocation |
implemented | Request current foreground position through
sercrod.geolocation; default action is current.
|
*geolocation.current |
implemented | Explicit current-position action. |
*geolocation.watch |
implemented | Start a foreground position watch; clickable elements start on activation, non-clickable elements auto-start once. |
*geolocation.clear |
implemented | Clear the stored or explicit position watch id. |
*geolocation.check-permissions |
implemented | Check location permission status through the adapter. |
*geolocation.request-permissions |
implemented | Request location permission through the adapter. |
*network-status |
implemented | Read current online/offline status through
sercrod.network_status; default action is current.
|
*network-status.current |
implemented | Explicit current network-status action. |
*network-status.watch |
implemented | Start an online/offline and connection information watch. |
*network-status.clear |
implemented | Clear the stored or explicit network-status watch id. |
*share |
implemented | Share text, URLs, or supported files through
sercrod.share from an explicit user action.
|
*notification |
implemented | Show a local notification through sercrod.notification;
default action is show. |
*notification.show |
implemented | Explicit local notification show action. |
*notification.check-permissions |
implemented | Check local notification permission status through the adapter. |
*notification.request-permissions |
implemented | Request local notification permission through the adapter. |
*barcode |
implemented | Scan or detect barcodes and QR codes through
sercrod.barcode; default action is scan.
|
*barcode.scan |
implemented | Explicit barcode/QR scan action. |
*barcode.detect |
implemented | Explicit barcode/QR detection action. |
*upload |
implemented | Bind an upload action to an element, open a hidden file input, and upload selected files to the r… |
*upload.single |
implemented | Explicit single-file form of *upload; it forces single
selection even if legacy multiple is present. |
*upload.multiple |
implemented | Multiple-file form of *upload; creates a multiple file
picker and sends all selected files. |
*download |
implemented | Bind a browser download action to an element using a resolved URL/options object. |
navigation
| directive | status | purpose |
|---|---|---|
*page |
implemented | Mark an explicit navigation target region inside the current host. |
*navigate |
implemented | Send an explicit target to the navigation adapter;
handled navigation activates matching *page. |
output
| directive | status | purpose |
|---|---|---|
*literal |
implemented | Output literal text/HTML content without normal expansion/rendering. |
*rem |
implemented | Remove or skip a Sercrod-only/debug block from rendered output. |
*print |
implemented | Evaluate expression and write plain text to textContent. |
*compose |
implemented | Evaluate expression/source and write HTML-related composed output through html filter path. |
*textContent |
implemented | Alias-style text output directive that writes textContent. |
*innerHTML |
implemented | Evaluate expression and write HTML into innerHTML through html filter path. |
attribute
| directive | status | purpose |
|---|---|---|
:class |
implemented | Bind class from string/array/object expression. |
:style |
implemented | Bind style from style text/object according to implementation. |
:attribute pattern |
implemented pattern | Attributes beginning with : bind evaluated expressions to attributes/properties; :class and :styl… |
event
| directive | status | purpose |
|---|---|---|
*prevent-default |
implemented | Modify browser event behavior to prevent default for selected event/mode. |
*prevent |
implemented | Short prevention helper; used for submit/enter/all-mode and event prevention. |
@event pattern |
implemented pattern | Attributes beginning with @ register event handlers; keyboard modifiers and .window are supported… |
lifecycle
| directive | status | purpose |
|---|---|---|
*updated |
implemented | Run post-update hook after render/update completes; not change detection. |
lifecycle/update
| directive | status | purpose |
|---|---|---|
*update |
implemented | Request an update on resolved target host. |
methods
| directive | status | purpose |
|---|---|---|
*methods |
implemented | Load/expose Sercrod method definitions according to implementation; do not expose internals witho… |
debug
| directive | status | purpose |
|---|---|---|
*log |
implemented | Evaluate an expression and log its value, expression, and host snippet. |
manual
| directive | status | purpose |
|---|---|---|
*man |
implemented | Print built-in or loaded manual entry into the element. |
shadow
| directive | status | purpose |
|---|---|---|
*shadow |
implemented | Declare a named Shadow DOM template on a template element; not rendered as ordinary DOM. |
*host |
implemented | Connect an ordinary host element to a named *shadow template and attach/use open Shadow DOM. |
alias
| directive | status | purpose |
|---|---|---|
*dominant |
alias | Alias of *dominate where implemented. Prefer
*dominate in AI-facing guidance unless the user …
|
*updated-propagate |
alias | Alias of *update where implemented. Prefer
*update in AI-facing guidance unless the user expl…
|
*shadow-host |
alias | Alias of *host where implemented. Prefer
*host in AI-facing guidance unless the user explicit…
|
5. Family contracts
conditional
Conditional directives decide whether a branch is rendered. They are
structural render decisions, not hidden state. *true and
*false are helper attributes for *condition
style flow, not independent primary directives.
repetition
*for and *each are ordinary repetition
flows, but they are not identical. *for repeats the element
itself. *each keeps the container and repeats child nodes.
Do not merge them into one generic loop concept.
placement
*iterate is managed placement synchronization. It
depends on template registration and candidate selection. It may reuse,
move, add, or remove nodes. It must not be reduced to a simple full
rerender loop.
template
Template directives keep visible HTML as the source material. They
are not JavaScript components and not a virtual DOM.
*iterate explanations must include *template
context.
render-control
*dominate protects expensive parent regions from normal
automatic rerendering. If output appears stale, do not remove
*dominate; inspect the explicit update path, child update
path, or iterate sync path.
staged-editing
Staged editing separates draft data from committed data.
*apply commits staged changes and *restore
discards them. Stage must not be treated as a general global state
store.
input
Input directives write directly to explicit targets. The writer already knows the value changed. Do not explain this as observer-based detection.
input/update
*lazy and *eager influence update timing
and scope. They do not create watchers. Use them to control redraw
pressure, not to imitate framework reactivity.
scope
Scope helpers expose values to expression flow. They are not a general application store.
storage
Save and load directives are persistence bridges. They do not make
Sercrod a database. *keys selects top-level keys when used
with these flows.
storage/network
*keys, *params, *dry-run,
*response, and *into are selection, request
metadata, and placement helpers for related action flows. Do not treat
*keys as a nested path language. *params and
*dry-run have meaning only when the caller directive
explicitly reads them. Prefer *response for new
communication response placement.
network
Network directives are external bridges. They should not turn Sercrod into a full network framework. Response placement must follow current implementation.
websocket
WebSocket directives manage an external connection and optional data placement. They are not Sercrod’s update mechanism and must not be used to explain change detection.
file-bridge
Upload and download are browser and server bridge operations. Upload may place response data; download triggers a browser download and should not be described as data merge.
Network status is a read-only capability bridge for online/offline status and connection information. It is not a request retry manager, upload scheduler, WebSocket reconnection manager, app synchronization system, service worker, router, or application policy engine.
navigation
Navigation directives connect explicit page targets to a
navigation adapter. They do not make Sercrod a router, do
not create a route table, do not globally intercept links, and do not
change *import.
output
Output directives write text or HTML to the DOM. *print
and *textContent are text paths. *compose and
*innerHTML are HTML-related paths and must not be silently
substituted for text output.
attribute
Attribute binding writes attributes or related DOM properties directly during render. It is not a virtual DOM patch system.
event
Event directives register handlers and run expressions when the browser event fires. Event dispatch is a trigger or notification, not data-change detection.
lifecycle
Lifecycle directives run after update or request updates. They do not discover changes.
lifecycle/update
Update directives request update paths. Use the current update-path rules and do not force parent redraw as the default fix.
methods
Methods expose callable behavior inside Sercrod expression flow. Do not turn internal helper functions into public APIs.
debug
Debug directives are for inspection. They must not become public behavior contracts unless the implementation documents them.
manual
Manual directives expose documentation text. They describe behavior but do not override the current implementation source.
shadow
Shadow directives bridge visible HTML declarations and browser Shadow DOM. They are not a component framework rewrite.
alias
Alias directives are compatibility forms. AI should not prefer them in new examples unless explicitly asked.
6. High-risk directive notes
These notes are repeated here because AI coding agents often fail at these points.
*iterate
*iterate="rows"is the short form for{ iterable: "rows", variable: "item", template: "item.type" }.- Object-style
*iterateusesiterable,variable, andtemplate. templateis evaluated per item and its result directly selects a registered*templatename.- v0.2
*iteratedoes not use grouped template warehouses,unit,*unit, or*entry. - Inside dominated parents, prefer add/remove/move/reuse semantics over full redraw explanations.
*dominate
- Automatic updates on a dominated host should not be treated as permission to redraw every existing child item.
- When data order changes, the expected path is usually iterate structure sync, not parent full rerender.
*stage
- Inside a repeated child host with no own data and empty
*stage, current repeated object or array item may be the intended stage target. - Primitive repeated items must not be treated as automatic merge targets without explicit index write-back support.
*keys
- Treat as whitespace-separated top-level key selection. Do not invent nested path syntax.
*fetch
- Use
*responsefor new*fetchresponse placement. Treat the older placement suffix as legacy compatibility only.
*post
*postsends a Sercrod request envelope. Use*keysfor outgoing data and*responsefor response placement.
*api
- Mirrors parsed responses to
$response. Use*responsefor response placement.
*websocket
- Maintains
$ws_*state. It is an external bridge, not the update engine.
*network-status
directive: *network-status status: implemented group:
file-bridge syntax_confidence: usable source_basis: - implemented in
dist/sercrod.js through _bind_network_status -
delegates online/offline status and connection information to
sercrod.network_status purpose: Read or watch network
status from explicit user actions. reads: - optional options expression
- *network-status.current /
n-network-status.current -
*network-status.watch / n-network-status.watch
- *network-status.clear /
n-network-status.clear - optional *response /
n-response, with *into / n-into
as compatibility placement writes: - $network_status -
$network_status_watch -
$network_status_watch_id - selected response target for
current/watch status results rerender: - calls explicit update after
action result, watch callback, or clear scope: - nearest Sercrod host
scope at bind time timing: - click or Enter/Space activation only
ai_notes: - Browser support uses navigator.onLine and the
Network Information API when present. - Capacitor/native support is a
bridge concern inside sercrod.network_status. - The status
is diagnostic/input information for app decisions, not the decision
engine itself. must_not: - do not implement request retries, upload
scheduling, WebSocket reconnection, app synchronization, service
workers, routing, or feature policy inside this directive - do not start
watching during initial render related_functions: -
_bind_network_status -
_network_status_directive_names example:
<button type="button" *network-status.current *response="'network'">Check network</button>
*barcode
directive: *barcode status: implemented group:
file-bridge syntax_confidence: usable source_basis: - implemented in
dist/sercrod.js through _bind_barcode -
delegates barcode and QR detection to sercrod.barcode
purpose: Scan or detect barcodes and QR codes from explicit user
actions. reads: - optional scan options expression such as
{ formats: ['qr_code'] } - string expression as
image/source URL - *barcode.scan /
n-barcode.scan - *barcode.detect /
n-barcode.detect - optional *response /
n-response, with *into / n-into
as compatibility placement writes: - $barcode -
$barcode_results - selected response target for successful
scan/detect results rerender: - calls explicit update after action
result or fallback placement scope: - nearest Sercrod host scope at bind
time timing: - click or Enter/Space activation only ai_notes: - Browser
support uses BarcodeDetector when available. - Capacitor/native scanning
is a bridge concern, not camera adapter behavior. - Browser fallback may
scan from an image input/source; it does not become a live camera
component. must_not: - do not merge barcode into the camera adapter - do
not make barcode own image upload, inventory/payment validation,
navigation, or app workflow - do not scan during initial render
related_functions: - _bind_barcode -
_coerce_barcode_options example:
<button type="button" *barcode.scan="{ formats: ['qr_code'] }" *response="'scanResult'">Scan</button>
*upload
- Upload mirrors parsed responses to
$responseand may place a response into data through*responseor communication*into. Do not describe$uploadas the current response store. Do not assume download-like behavior.
*download
- Triggers browser download. Do not describe as automatic data merge.
*page
*pagemarks an explicit target region inside the current host.- The value is evaluated as an expression; the current recommended
syntax is quoted target text such as
*page="'/spa/a.html'". - URL-like same-origin HTML targets may be lazily loaded as partial HTML when activated.
- Matching page activation may use
document.startViewTransition()when available and enabled, but unsupported browsers and opt-out cases use the normal path. - Lazy partial fetches use no Sercrod timeout by default; positive
window.__Sercrod.config.navigation.page_timeout/pageTimeoutvalues add a millisecond timeout. - It does not infer targets from
href,id, hashes, or CSS selectors.
*navigate
*navigateevaluates an explicit target and calls the currentnavigationadapter.- The default navigation adapter path may use the browser Navigation
API,
history.pushState()/popstate, or host-local preview activation depending on available adapter support. - Handled navigation can trigger the same View Transitions progressive
enhancement used by
*pageactivation; this does not make Sercrod own animation semantics. - Adapter return values only signal handled/fallback. They do not define route data loading or host data merge.
- It is not global link interception and not a router.
*template
- Template declarations are source material and should not be rendered as ordinary visible output.
*include
- Include uses templates or partial content. Do not describe as component mount.
*import
- In the inspected source,
*importimports external HTML into the normal Sercrod render flow. - It resolves a URL through expression evaluation or URL-like raw text, loads HTML, places it into the element’s inner content, and then continues normal child rendering.
- Do not treat
*importas JavaScript ES module import. - Do not invent module-loader, component-loader, or general network-framework semantics beyond the current implementation.
*host
- Connects an ordinary element to a shadow template. Use ordinary elements when a child Sercrod host would create timing problems.
@event pattern
- Events trigger expression execution. They are not a data-change detection mechanism.
:attribute pattern
- Attribute binding is direct output. It is not a virtual DOM diff.
7. Use levels
Each directive should be read at one of these use levels:
use normally - preferred public form for new examples
use with caution - implemented, but exact syntax or edge cases should be checked
read only - compatibility or legacy form; understand existing code but do not prefer
do not promote - present as alias, helper, or internal detail; avoid in new AI-facing guidance
General mapping:
implemented official directives -> use normally or use with caution
implemented pattern directives -> use with caution
alias directives -> read only
helper attributes -> do not promote as independent directives
uncertain behavior -> do not write as implemented
8. Implementation boundary notes
This file intentionally separates directive names from exact implementation promises.
implemented means the directive name or pattern exists in the inspected runtime
implemented does not mean every possible syntax form is confirmed
syntax_confidence controls whether an AI may write examples confidently
source_basis explains whether the entry came from static directive registration, render flow, helper functions, or AI-facing interpretation
For implementation-sensitive edits, especially *iterate,
*dominate, *stage, storage, network,
WebSocket, upload/download, and Shadow DOM bridge behavior, inspect
current dist/sercrod.js before changing code.
9. Directive cards
*if
directive: *if status: implemented group: conditional
syntax_confidence: usable with edge-case verification source_basis: -
extracted from dist/sercrod.js static directive set and
related render/action functions - refined for AI-facing interpretation
purpose: Render this element only when its expression is truthy; also
participates as the first branch in an if/elseif/else chain. reads: -
condition / branch expression and current scope writes: - rendered DOM,
managed region, output text/HTML, or registered template/shadow state
rerender: - participates in render flow; exact update behavior follows
current runtime path scope: - nearest Sercrod host scope unless current
runtime explicitly passes child/local scope timing: - during
render/update flow according to current source must_not: - do not infer
Proxy, watcher, MutationObserver, virtual DOM, or common-framework
behavior uncertain: - edge cases and exact syntax should still be
checked against current dist/sercrod.js related_functions: -
renderNode - _apply_condition_branch_fragment
- _normalize_condition_branch_attr_name example:
<div *if="show">Visible</div>
*elseif
directive: *elseif status: implemented group:
conditional syntax_confidence: needs official sample check source_basis:
- extracted from dist/sercrod.js static directive set and
related render/action functions - refined for AI-facing interpretation
purpose: Render as a later branch in a preceding *if chain when its
expression is truthy and earlier branches did not match. reads: -
condition / branch expression and current scope writes: - rendered DOM,
managed region, output text/HTML, or registered template/shadow state
rerender: - participates in render flow; exact update behavior follows
current runtime path scope: - nearest Sercrod host scope unless current
runtime explicitly passes child/local scope timing: - during
render/update flow according to current source must_not: - do not infer
Proxy, watcher, MutationObserver, virtual DOM, or common-framework
behavior uncertain: - edge cases and exact syntax should still be
checked against current dist/sercrod.js related_functions: -
renderNode example:
uncertain - check current dist/sercrod.js and official samples for `*elseif`
*else
directive: *else status: implemented group: conditional
syntax_confidence: needs official sample check source_basis: - extracted
from dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Render as the fallback branch in a preceding if/elseif chain.
reads: - condition / branch expression and current scope writes: -
rendered DOM, managed region, output text/HTML, or registered
template/shadow state rerender: - participates in render flow; exact
update behavior follows current runtime path scope: - nearest Sercrod
host scope unless current runtime explicitly passes child/local scope
timing: - during render/update flow according to current source
must_not: - do not infer Proxy, watcher, MutationObserver, virtual DOM,
or common-framework behavior uncertain: - edge cases and exact syntax
should still be checked against current dist/sercrod.js
related_functions: - renderNode example:
uncertain - check current dist/sercrod.js and official samples for `*else`
*condition
directive: *condition status: implemented group:
conditional syntax_confidence: needs official sample check source_basis:
- extracted from dist/sercrod.js static directive set and
related render/action functions - refined for AI-facing interpretation
purpose: Evaluate one condition and apply branch fragments from true
or false helper attributes to the same element before normal
render. reads: - condition / branch expression and current scope writes:
- rendered DOM, managed region, output text/HTML, or registered
template/shadow state rerender: - participates in render flow; exact
update behavior follows current runtime path scope: - nearest Sercrod
host scope unless current runtime explicitly passes child/local scope
timing: - during render/update flow according to current source
must_not: - do not infer Proxy, watcher, MutationObserver, virtual DOM,
or common-framework behavior uncertain: - edge cases and exact syntax
should still be checked against current dist/sercrod.js
related_functions: - renderNode -
_apply_condition_branch_fragment -
_normalize_condition_branch_attr_name example:
uncertain - check current dist/sercrod.js and official samples for `*condition`
*cond
directive: *cond status: alias group: conditional
syntax_confidence: needs official sample check source_basis: - extracted
from dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Alias of *condition. reads: - condition / branch expression and current
scope writes: - rendered DOM, managed region, output text/HTML, or
registered template/shadow state rerender: - participates in render
flow; exact update behavior follows current runtime path scope: -
nearest Sercrod host scope unless current runtime explicitly passes
child/local scope timing: - during render/update flow according to
current source must_not: - do not infer Proxy, watcher,
MutationObserver, virtual DOM, or common-framework behavior uncertain: -
edge cases and exact syntax should still be checked against current
dist/sercrod.js related_functions: - renderNode -
_apply_condition_branch_fragment example:
uncertain - check current dist/sercrod.js and official samples for `*cond`
*for
directive: *for status: implemented group: repetition
syntax_confidence: usable with edge-case verification source_basis: -
extracted from dist/sercrod.js static directive set and
related render/action functions - refined for AI-facing interpretation
purpose: Repeat the element itself for each item from a list/object
expression. reads: - source list/object, alias names, template/candidate
names, and current scope writes: - rendered DOM, managed region, output
text/HTML, or registered template/shadow state rerender: - participates
in render flow; exact update behavior follows current runtime path -
inside a *dominate host, an existing element-level
*for region may synchronize known object-item
add/remove/move changes during an automatic event path without redrawing
the whole parent host scope: - loop-local scope layered over parent
scope timing: - during render/update flow according to current source
ai_notes: - Do not say that a data-bearing child
<serc-rod> inside a repeated item stops parent
*for remove/move synchronization. It is a safety boundary
for inherited child updates and staged preview propagation. - Preserved
item records keep nested child hosts and their local state. Removed item
records remove their whole DOM range, including nested child hosts.
must_not: - do not infer Proxy, watcher, MutationObserver, virtual DOM,
or common-framework behavior uncertain: - edge cases and exact syntax
should still be checked against current dist/sercrod.js
related_functions: - renderNode -
_sync_for_region - _remove_for_record -
_normalize_pairs example:
<p *for="item in items" *print="item.name"></p>
*each
directive: *each status: implemented group: repetition
syntax_confidence: usable with edge-case verification source_basis: -
extracted from dist/sercrod.js static directive set and
related render/action functions - refined for AI-facing interpretation
purpose: Keep the container element and repeat its child nodes for each
item. reads: - source list/object, alias names, template/candidate
names, and current scope writes: - rendered DOM, managed region, output
text/HTML, or registered template/shadow state rerender: - participates
in render flow; exact update behavior follows current runtime path
scope: - loop-local scope layered over parent scope timing: - during
render/update flow according to current source must_not: - do not infer
Proxy, watcher, MutationObserver, virtual DOM, or common-framework
behavior uncertain: - edge cases and exact syntax should still be
checked against current dist/sercrod.js related_functions: -
renderNode - _normalize_pairs example:
<ul *each="item in items"><li *print="item.name"></li></ul>
*iterate
directive: *iterate status: implemented group: placement
syntax_confidence: usable with edge-case verification source_basis: -
extracted from dist/sercrod.js static directive set and
related render/action functions - refined for AI-facing interpretation
purpose: Synchronize a managed placement region by selecting registered
*template names per item; not a simple loop. reads: -
iterable source, current value variable name, template selector
expression, and current scope writes: - rendered DOM, managed region,
output text/HTML, or registered template/shadow state rerender: -
synchronizes region by add/remove/move/reuse; must not be reduced to
full rerender scope: - loop-local scope layered over parent scope
timing: - after template scanning and during iterate-region
synchronization ai_notes: - *iterate="rows" is the short
form for
{ iterable: "rows", variable: "item", template: "item.type" }.
- Object-style *iterate uses iterable,
variable, and template; the object is
evaluated as a JavaScript expression, not parsed as plain JSON. -
template is evaluated per item and its result directly
selects a registered *template name. - v0.2
*iterate does not use grouped template warehouses,
unit, *unit, or *entry. - Inside
dominated parents, prefer add/remove/move/reuse semantics over full
redraw explanations. must_not: - do not infer Proxy, watcher,
MutationObserver, virtual DOM, or common-framework behavior - do not
treat as for or a simple loop - do not omit template context -
do not write v0.1 { list, as, template, unit } warehouse
syntax for v0.2 examples uncertain: - edge cases and exact syntax should
still be checked against current dist/sercrod.js - object iterate
expression is evaluated as JavaScript expression; template selector
result must match a registered *template name
related_functions: - _renderTemplate -
renderNode - _resolve_iterate_place -
_eval_iterate_template_name -
_get_iterate_template_entry -
_create_iterate_scope - _render_iterate_region
- _sync_iterate_regions - _sync_iterate_region
- _refresh_iterate_record -
_prepare_child_sercrod_scope example:
<template *iterate="items"></template>
<template>
<section *template="'text'">%item.title%</section>
<section *template="'image'">%item.title%</section>
</template>
*switch
directive: *switch status: implemented group:
conditional syntax_confidence: needs official sample check source_basis:
- extracted from dist/sercrod.js static directive set and
related render/action functions - refined for AI-facing interpretation
purpose: Select a switch value and render matching case /
default children with fallthrough until break. reads: - condition /
branch expression and current scope writes: - rendered DOM, managed
region, output text/HTML, or registered template/shadow state rerender:
- participates in render flow; exact update behavior follows current
runtime path scope: - nearest Sercrod host scope unless current runtime
explicitly passes child/local scope timing: - during render/update flow
according to current source must_not: - do not infer Proxy, watcher,
MutationObserver, virtual DOM, or common-framework behavior uncertain: -
edge cases and exact syntax should still be checked against current
dist/sercrod.js related_functions: - renderNode -
_renderSwitchBlock - _matchCase example:
uncertain - check current dist/sercrod.js and official samples for `*switch`
*case
directive: *case status: implemented group: conditional
syntax_confidence: needs official sample check source_basis: - extracted
from dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Case branch inside *switch. reads: - condition / branch expression and
current scope writes: - rendered DOM, managed region, output text/HTML,
or registered template/shadow state rerender: - participates in render
flow; exact update behavior follows current runtime path scope: -
nearest Sercrod host scope unless current runtime explicitly passes
child/local scope timing: - during render/update flow according to
current source must_not: - do not infer Proxy, watcher,
MutationObserver, virtual DOM, or common-framework behavior uncertain: -
edge cases and exact syntax should still be checked against current
dist/sercrod.js related_functions: - _renderSwitchBlock -
_matchCase example:
uncertain - check current dist/sercrod.js and official samples for `*case`
*break
directive: *break status: implemented group: conditional
syntax_confidence: needs official sample check source_basis: - extracted
from dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Stop switch fallthrough when used with a rendered *case. reads: -
condition / branch expression and current scope writes: - rendered DOM,
managed region, output text/HTML, or registered template/shadow state
rerender: - participates in render flow; exact update behavior follows
current runtime path scope: - nearest Sercrod host scope unless current
runtime explicitly passes child/local scope timing: - during
render/update flow according to current source must_not: - do not infer
Proxy, watcher, MutationObserver, virtual DOM, or common-framework
behavior uncertain: - edge cases and exact syntax should still be
checked against current dist/sercrod.js related_functions: -
_renderSwitchBlock example:
uncertain - check current dist/sercrod.js and official samples for `*break`
*case.break
directive: *case.break status: implemented group:
conditional syntax_confidence: needs official sample check source_basis:
- extracted from dist/sercrod.js static directive set and
related render/action functions - refined for AI-facing interpretation
purpose: Case branch that also stops switch fallthrough when
matched/rendered. reads: - condition / branch expression and current
scope writes: - rendered DOM, managed region, output text/HTML, or
registered template/shadow state rerender: - participates in render
flow; exact update behavior follows current runtime path scope: -
nearest Sercrod host scope unless current runtime explicitly passes
child/local scope timing: - during render/update flow according to
current source must_not: - do not infer Proxy, watcher,
MutationObserver, virtual DOM, or common-framework behavior uncertain: -
edge cases and exact syntax should still be checked against current
dist/sercrod.js related_functions: - _renderSwitchBlock -
_matchCase example:
uncertain - check current dist/sercrod.js and official samples for `*case.break`
*default
directive: *default status: implemented group:
conditional syntax_confidence: needs official sample check source_basis:
- extracted from dist/sercrod.js static directive set and
related render/action functions - refined for AI-facing interpretation
purpose: Fallback branch inside *switch. reads: - condition / branch
expression and current scope writes: - rendered DOM, managed region,
output text/HTML, or registered template/shadow state rerender: -
participates in render flow; exact update behavior follows current
runtime path scope: - nearest Sercrod host scope unless current runtime
explicitly passes child/local scope timing: - during render/update flow
according to current source must_not: - do not infer Proxy, watcher,
MutationObserver, virtual DOM, or common-framework behavior uncertain: -
edge cases and exact syntax should still be checked against current
dist/sercrod.js related_functions: - _renderSwitchBlock
example:
uncertain - check current dist/sercrod.js and official samples for `*default`
*let
directive: *let status: implemented group: scope
syntax_confidence: needs official sample check source_basis: - extracted
from dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Evaluate local expression/assignments and continue rendering with a
local scope layered over the current scope. reads: - current scope and
directive expression where applicable writes: - direct effect defined by
current dist/sercrod.js rerender: - participates in render flow; exact
update behavior follows current runtime path scope: - nearest Sercrod
host scope unless current runtime explicitly passes child/local scope
timing: - during render/update flow according to current source
must_not: - do not infer Proxy, watcher, MutationObserver, virtual DOM,
or common-framework behavior uncertain: - edge cases and exact syntax
should still be checked against current dist/sercrod.js
related_functions: - renderNode - eval_let
example:
uncertain - check current dist/sercrod.js and official samples for `*let`
*global
directive: *global status: implemented group: scope
syntax_confidence: needs official sample check source_basis: - extracted
from dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Evaluate assignment-like expressions that write to host data when a key
exists, otherwise globalThis according to implementation. reads: -
current scope and directive expression where applicable writes: - direct
effect defined by current dist/sercrod.js rerender: - participates in
render flow; exact update behavior follows current runtime path scope: -
nearest Sercrod host scope unless current runtime explicitly passes
child/local scope timing: - during render/update flow according to
current source must_not: - do not infer Proxy, watcher,
MutationObserver, virtual DOM, or common-framework behavior uncertain: -
edge cases and exact syntax should still be checked against current
dist/sercrod.js related_functions: - renderNode -
eval_global example:
uncertain - check current dist/sercrod.js and official samples for `*global`
*literal
directive: *literal status: implemented group: output
syntax_confidence: needs official sample check source_basis: - extracted
from dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Output literal text/HTML content without normal expansion/rendering.
reads: - current scope and directive expression where applicable writes:
- rendered DOM, managed region, output text/HTML, or registered
template/shadow state rerender: - participates in render flow; exact
update behavior follows current runtime path scope: - nearest Sercrod
host scope unless current runtime explicitly passes child/local scope
timing: - during render/update flow according to current source
must_not: - do not infer Proxy, watcher, MutationObserver, virtual DOM,
or common-framework behavior uncertain: - edge cases and exact syntax
should still be checked against current dist/sercrod.js
related_functions: - renderNode example:
uncertain - check current dist/sercrod.js and official samples for `*literal`
*rem
directive: *rem status: implemented group: output
syntax_confidence: needs official sample check source_basis: - extracted
from dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Remove or skip a Sercrod-only/debug block from rendered output. reads: -
current scope and directive expression where applicable writes: -
rendered DOM, managed region, output text/HTML, or registered
template/shadow state rerender: - participates in render flow; exact
update behavior follows current runtime path scope: - nearest Sercrod
host scope unless current runtime explicitly passes child/local scope
timing: - during render/update flow according to current source
must_not: - do not infer Proxy, watcher, MutationObserver, virtual DOM,
or common-framework behavior uncertain: - edge cases and exact syntax
should still be checked against current dist/sercrod.js
related_functions: - renderNode -
_renderElement example:
uncertain - check current dist/sercrod.js and official samples for `*rem`
*input
directive: *input status: implemented group: input
syntax_confidence: usable with edge-case verification source_basis: -
extracted from dist/sercrod.js static directive set and
related render/action functions - refined for AI-facing interpretation
purpose: Bind form control value to an explicit data expression and
write input/change values directly. reads: - form value or staged/real
data target expression writes: - explicit data path or staged data
target rerender: - follows the caller/update path selected by current
runtime scope: - nearest Sercrod host scope unless current runtime
explicitly passes child/local scope timing: - during render/update flow
according to current source ai_notes: - Writes values directly to
explicit targets. The update path is selected by the caller path.
must_not: - do not infer Proxy, watcher, MutationObserver, virtual DOM,
or common-framework behavior uncertain: - edge cases and exact syntax
should still be checked against current dist/sercrod.js
related_functions: - _renderElement -
eval_expr - assign_expr -
_updateChildren -
_updateStageInheritedChildren example:
<input *input="form.name">
*lazy
directive: *lazy status: implemented group: input/update
syntax_confidence: needs official sample check source_basis: - extracted
from dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Avoid host full rerender for input/update paths where applicable; child
updates may still run. reads: - form value or staged/real data target
expression writes: - direct effect defined by current dist/sercrod.js
rerender: - may skip parent full rerender and update children path where
applicable scope: - nearest Sercrod host scope unless current runtime
explicitly passes child/local scope timing: - during render/update flow
according to current source ai_notes: - Lazy means parent full refresh
can be avoided. Child output may still update. must_not: - do not infer
Proxy, watcher, MutationObserver, virtual DOM, or common-framework
behavior uncertain: - edge cases and exact syntax should still be
checked against current dist/sercrod.js related_functions: -
update - _renderElement -
_updateChildren example:
uncertain - check current dist/sercrod.js and official samples for `*lazy`
*eager
directive: *eager status: implemented group:
input/update syntax_confidence: needs official sample check
source_basis: - extracted from dist/sercrod.js static
directive set and related render/action functions - refined for
AI-facing interpretation purpose: Force more immediate host update from
input/change paths where applicable. reads: - form value or staged/real
data target expression writes: - direct effect defined by current
dist/sercrod.js rerender: - may force host update sooner from
input/change path scope: - nearest Sercrod host scope unless current
runtime explicitly passes child/local scope timing: - during
render/update flow according to current source ai_notes: - Eager can
force more immediate update. Do not use as a watcher substitute.
must_not: - do not infer Proxy, watcher, MutationObserver, virtual DOM,
or common-framework behavior uncertain: - edge cases and exact syntax
should still be checked against current dist/sercrod.js
related_functions: - _renderElement - update
example:
uncertain - check current dist/sercrod.js and official samples for `*eager`
*dominate
directive: *dominate status: implemented group:
render-control syntax_confidence: usable with edge-case verification
source_basis: - extracted from dist/sercrod.js static
directive set and related render/action functions - refined for
AI-facing interpretation purpose: Avoid normal automatic host full
rerender; allow iterate synchronization and explicit update paths
according to runtime. reads: - current scope and directive expression
where applicable writes: - direct effect defined by current
dist/sercrod.js rerender: - avoids normal automatic full host rerender;
iterate sync or explicit paths may still run scope: - nearest Sercrod
host scope unless current runtime explicitly passes child/local scope
timing: - during render/update flow according to current source
ai_notes: - Automatic updates on a dominated host should not be treated
as permission to redraw every existing child item. - When data order
changes, the expected path is usually iterate structure sync, not parent
full rerender. - Existing element-level *for regions may
also synchronize known add/remove/move changes during suppressed
automatic redraws. - A data-bearing child host is an independent update
world, but it is not a stop condition for parent repeated-item removal
or movement. It is a boundary for inherited child updates and staged
preview propagation. must_not: - do not infer Proxy, watcher,
MutationObserver, virtual DOM, or common-framework behavior - do not
weaken by restoring normal automatic full rerender uncertain: - edge
cases and exact syntax should still be checked against current
dist/sercrod.js related_functions: - _is_dominant -
update - _sync_for_region -
_sync_iterate_regions example:
<serc-rod *dominate>...</serc-rod>
*dominant
directive: *dominant status: alias group: alias
syntax_confidence: needs official sample check source_basis: - extracted
from dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Alias of *dominate where implemented. Prefer
*dominate in AI-facing guidance unless the user explicitly
works with compatibility markup. reads: - current scope and directive
expression where applicable writes: - direct effect defined by current
dist/sercrod.js rerender: - avoids normal automatic full host rerender;
iterate sync or explicit paths may still run scope: - nearest Sercrod
host scope unless current runtime explicitly passes child/local scope
timing: - during render/update flow according to current source
must_not: - do not infer Proxy, watcher, MutationObserver, virtual DOM,
or common-framework behavior - do not weaken by restoring normal
automatic full rerender - do not teach this alias as the official name
uncertain: - edge cases and exact syntax should still be checked against
current dist/sercrod.js related_functions: - _is_dominant -
update - _sync_iterate_regions example:
uncertain - check current dist/sercrod.js and official samples for `*dominant`
*stage
directive: *stage status: implemented group:
staged-editing syntax_confidence: usable with edge-case verification
source_basis: - extracted from dist/sercrod.js static
directive set and related render/action functions - refined for
AI-facing interpretation purpose: Use a staged copy as display/edit
scope; edits are not committed until apply. reads: - form value or
staged/real data target expression writes: - explicit data path or
staged data target rerender: - follows the caller/update path selected
by current runtime scope: - staged display/edit scope and real data
target timing: - during render/update flow according to current source
ai_notes: - Inside a repeated child host with no own data and empty
*stage, current repeated object or array item may be the
intended stage target. - Primitive repeated items must not be treated as
automatic merge targets without explicit index write-back support.
must_not: - do not infer Proxy, watcher, MutationObserver, virtual DOM,
or common-framework behavior uncertain: - edge cases and exact syntax
should still be checked against current dist/sercrod.js - empty *stage
inside repeated child host targets current item only if implemented and
the item is object/array; primitive write-back is uncertain unless
explicit index path exists related_functions: -
connectedCallback - _merge_into_target -
_apply_stage - _restore_stage -
_resolve_stage_action_target -
_run_stage_action -
_updateStageInheritedChildren example:
<serc-rod *stage>...</serc-rod>
*apply
directive: *apply status: implemented group:
staged-editing syntax_confidence: needs official sample check
source_basis: - extracted from dist/sercrod.js static
directive set and related render/action functions - refined for
AI-facing interpretation purpose: Commit staged edits to the real target
data. reads: - form value or staged/real data target expression writes:
- explicit data path or staged data target rerender: - follows the
caller/update path selected by current runtime scope: - staged
display/edit scope and real data target timing: - during render/update
flow according to current source ai_notes: - Applies staged data to real
data. Do not describe it as automatic live commit. must_not: - do not
infer Proxy, watcher, MutationObserver, virtual DOM, or common-framework
behavior uncertain: - edge cases and exact syntax should still be
checked against current dist/sercrod.js related_functions: -
_run_stage_action - _apply_stage -
applyStage - commitStage example:
uncertain - check current dist/sercrod.js and official samples for `*apply`
*restore
directive: *restore status: implemented group:
staged-editing syntax_confidence: needs official sample check
source_basis: - extracted from dist/sercrod.js static
directive set and related render/action functions - refined for
AI-facing interpretation purpose: Discard staged edits and restore stage
from real data. reads: - form value or staged/real data target
expression writes: - explicit data path or staged data target rerender:
- follows the caller/update path selected by current runtime scope: -
staged display/edit scope and real data target timing: - during
render/update flow according to current source ai_notes: - Restores or
discards staged data according to implementation. Do not confuse restore
with undo history. must_not: - do not infer Proxy, watcher,
MutationObserver, virtual DOM, or common-framework behavior uncertain: -
edge cases and exact syntax should still be checked against current
dist/sercrod.js related_functions: - _run_stage_action -
_restore_stage - restoreStage example:
uncertain - check current dist/sercrod.js and official samples for `*restore`
*save
directive: *save status: implemented group: storage
syntax_confidence: usable source_basis: - extracted from
dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Save the host data or staged data as JSON through the file save path,
with legacy key selection support. reads: - current source data:
_stage if present, otherwise _data - optional
*keys / n-keys - legacy key list from
*save value when no storage variant is used writes: -
browser download file by fallback path - file adapter output when a
file adapter handles the save - sercrod-saved
event detail rerender: - does not normally rerender just because save
completed scope: - nearest Sercrod host data or staged data timing: -
click action on the rendered element must_not: - do not treat
*save as database persistence - do not assume
*save writes into Sercrod data - do not infer watcher,
Proxy, or store semantics from save events uncertain: - adapter-specific
behavior is external and must be checked against the active adapter
related_functions: - renderNode -
_parse_keys_attr - _pick_keys -
_resolve_action_string example:
<button *save *keys="profile settings">Save JSON</button>
*save.file
directive: *save.file status: implemented group: storage
syntax_confidence: usable source_basis: - extracted from
dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Save host data or selected *keys as a JSON file, using the
given filename when provided. reads: - current source data:
_stage if present, otherwise _data - optional
*keys / n-keys - filename expression/action
string from *save.file writes: - file adapter output when
handled - browser JSON file download fallback -
sercrod-saved event detail including filename and keys
rerender: - does not normally rerender just because file save started
scope: - nearest Sercrod host data or staged data timing: - click action
on the rendered element must_not: - do not treat file save completion as
guaranteed browser download completion - do not store selected keys back
into Sercrod data uncertain: - exact adapter behavior depends on the
active file adapter related_functions: -
renderNode - _parse_keys_attr -
_pick_keys - _resolve_action_string
example:
<button *save.file="'backup.json'" *keys="profile">Save</button>
*save.session
directive: *save.session status: implemented group:
storage syntax_confidence: usable source_basis: - extracted from
dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Save host data or selected *keys as JSON into
sessionStorage under the resolved storage key. reads: -
current source data: _stage if present, otherwise
_data - required storage key from
*save.session - optional *keys /
n-keys writes: -
window.sessionStorage[storageKey] -
sercrod-saved event detail rerender: - does not normally
rerender just because session save completed scope: - nearest Sercrod
host data or staged data timing: - click action on the rendered element
must_not: - do not treat sessionStorage as a general Sercrod state store
- do not omit the storage key uncertain: - browser storage errors depend
on browser privacy/storage policy related_functions: -
renderNode - _parse_keys_attr -
_pick_keys - _resolve_action_string
example:
<button *save.session="'draft'" *keys="profile">Save session</button>
*save.store
directive: *save.store status: implemented group:
storage syntax_confidence: usable source_basis: - extracted from
dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Save host data or selected *keys as JSON into persistent
browser storage backed by IndexedDB. reads: - current source data:
_stage if present, otherwise _data - required
storage key from *save.store - optional *keys
/ n-keys writes: - IndexedDB object store configured by
Sercrod store config - sercrod-saved event detail rerender:
- does not normally rerender just because store save completed scope: -
nearest Sercrod host data or staged data timing: - click action on the
rendered element must_not: - do not describe this as a business database
- do not assume IndexedDB is always available uncertain: - storage
availability and quota behavior depend on the browser/runtime
related_functions: - renderNode -
_parse_keys_attr - _pick_keys -
_resolve_action_string - _store_available -
_store_put_json example:
<button *save.store="'draft'" *keys="profile settings">Save store</button>
*load
directive: *load status: implemented group: storage
syntax_confidence: usable source_basis: - extracted from
dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Load JSON state through the file-load path, with legacy key selection
support. reads: - selected JSON file or file adapter result - optional
*keys / n-keys - optional *into /
n-into - legacy key list from *load value when
no storage variant is used writes: - _stage if present,
otherwise _data - selected key(s), *into
destination, or merged root data - sercrod-loaded event
detail rerender: - calls explicit update after applying loaded data
scope: - nearest Sercrod host data or staged data timing: - click or
file input change depending on element type must_not: - do not treat
*load as arbitrary file parsing; current path is JSON state
oriented - do not treat *into as required for all load
cases uncertain: - file adapter behavior is external and must be checked
against the active adapter related_functions: - renderNode
- _parse_keys_attr - _pick_keys -
_resolve_action_string example:
<button *load.file *keys="profile" *into="draft">Load</button>
*load.file
directive: *load.file status: implemented group: storage
syntax_confidence: usable source_basis: - extracted from
dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Load JSON from a browser-selected file or file adapter and place it into
host data. reads: - selected JSON file - optional *keys /
n-keys - optional *into / n-into
- load config such as accept type and max JSON size writes: -
_stage if present, otherwise _data -
sercrod-loaded event detail rerender: - calls explicit
update after applying loaded data scope: - nearest Sercrod host data or
staged data timing: - native file input change, or button
click that opens a hidden file input must_not: - do not parse non-JSON
formats through this path unless implementation changes - do not assume
oversized files are accepted uncertain: - active file adapter may
override browser fallback behavior related_functions: -
renderNode - _parse_keys_attr -
_pick_keys example:
<button *load.file *keys="profile" *into="draft">Load</button>
*load.session
directive: *load.session status: implemented group:
storage syntax_confidence: usable source_basis: - extracted from
dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Load JSON from sessionStorage and place it into host data
according to *keys and *into. reads: -
required storage key from *load.session - JSON text from
window.sessionStorage - optional *keys /
n-keys - optional *into / n-into
writes: - _stage if present, otherwise _data -
sercrod-loaded event detail rerender: - calls explicit
update after applying loaded data scope: - nearest Sercrod host data or
staged data timing: - click action on the rendered element must_not: -
do not treat missing storage key as valid empty data - do not treat
sessionStorage as a general application database uncertain: - browser
storage availability and parse errors depend on runtime data
related_functions: - renderNode -
_resolve_action_string - _parse_keys_attr -
_pick_keys example:
<button *load.session="'draft'" *into="profile">Load session</button>
*load.store
directive: *load.store status: implemented group:
storage syntax_confidence: usable source_basis: - extracted from
dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Load JSON from persistent browser storage backed by IndexedDB and place
it into host data. reads: - required storage key from
*load.store - JSON text from configured IndexedDB store -
optional *keys / n-keys - optional
*into / n-into writes: - _stage
if present, otherwise _data - sercrod-loaded
event detail rerender: - calls explicit update after applying loaded
data scope: - nearest Sercrod host data or staged data timing: - click
action on the rendered element must_not: - do not assume IndexedDB is
available - do not promote this as a business database layer uncertain:
- storage quota, availability, and missing-key behavior depend on
browser/runtime related_functions: - renderNode -
_resolve_action_string - _store_get_json -
_parse_keys_attr - _pick_keys example:
<button *load.store="'draft'" *into="profile">Load store</button>
*keys
directive: *keys status: implemented group:
storage/network syntax_confidence: usable source_basis: - extracted from
dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Select whitespace-separated top-level data keys for save, load, and
WebSocket send operations. reads: - whitespace-separated attribute value
- current source data when used by the caller directive writes: - no
direct write by itself - caller directive uses the selected keys
rerender: - no direct rerender by itself scope: - selection applies to
the caller directive’s source object timing: - parsed when the caller
directive action runs or renders ai_notes: - Treat as
whitespace-separated top-level key selection. Do not invent nested path
syntax. must_not: - do not treat *keys as a nested path
expression language - do not treat it as a general query selector for
data - do not assume it affects directives that do not explicitly read
it uncertain: - nested key/path support is not implemented by
_parse_keys_attr / _pick_keys; mark any such
behavior uncertain unless current source changes related_functions: -
_parse_keys_attr - _pick_keys -
renderNode - _ws_send example:
<button *save.file="'backup.json'" *keys="profile settings">Save selected keys</button>
*params
directive: *params status: implemented group:
storage/network syntax_confidence: usable source_basis: - extracted from
dist/sercrod.js request envelope helpers and communication
directive paths - refined for AI-facing interpretation purpose: Add
request metadata parameters to supported communication request
envelopes. reads: - attribute value evaluated in the caller directive’s
scope - object values are used as request params; other
non-empty values are wrapped according to current helper behavior
writes: - no direct write by itself - caller directive includes resolved
params in request metadata when supported rerender: - no direct rerender
by itself scope: - applies to the nearest caller directive that
explicitly reads *params timing: - read when the
communication request is prepared ai_notes: - Supported current
communication callers include *post, non-GET JSON
*api, file-input *api metadata paths, and
*upload. - GET *api cannot send
*params in a JSON request body and warns when params are
present. must_not: - do not treat *params as URL query
construction unless current source implements that path - do not assume
unrelated directives read it related_functions: -
_resolve_params - _build_request_envelope
example:
<button *post="'/api/save'" *params="{mode: 'draft'}">Save</button>
*dry-run
directive: *dry-run status: implemented group:
storage/network syntax_confidence: usable source_basis: - extracted from
dist/sercrod.js request envelope helpers and communication
directive paths - refined for AI-facing interpretation purpose: Mark
supported communication request envelopes as dry-run requests. reads: -
attribute presence writes: - no direct write by itself - caller
directive includes a dry-run marker in request metadata when supported
rerender: - no direct rerender by itself scope: - applies to the nearest
caller directive that explicitly reads *dry-run timing: -
read when the communication request is prepared ai_notes: - Sercrod only
sends the dry-run marker. The receiving API or server must decide
whether and how to honor it. - GET *api cannot send
*dry-run in a JSON request body and warns when the marker
is present. must_not: - do not describe *dry-run as
preventing the browser request by itself - do not assume unrelated
directives read it related_functions: - _has_dry_run -
_build_request_envelope example:
<button *post="'/api/save'" *dry-run>Preview request</button>
*post
directive: *post status: implemented group: network
syntax_confidence: usable source_basis: - extracted from
dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Send selected host data or staged data as a Sercrod JSON request
envelope by POST. reads: - action string resolving to the target URL -
current source data: _stage if present, otherwise
_data - optional *keys / n-keys -
optional *params / n-params - optional
*dry-run / n-dry-run - optional
*response / n-response, with
*into / n-into as a compatibility alias
writes: - $pending, $error,
$response - mapped host data when *response or
communication *into is present -
sercrod-post-start, sercrod-posted, and
sercrod-post-error events rerender: - updates during
pending start/stop; response placement follows *response
scope: - nearest Sercrod host data or staged data timing: - click action
on the rendered element ai_notes: - *post no longer uses
*response response placement. Use *response
for placement and *keys for outgoing data selection.
must_not: - do not treat *post as the same as
*api - do not assume the response replaces or merges host
data when *response is absent - do not treat
*into as the preferred new syntax for communication
responses uncertain: - exact request envelope fields should be checked
against current dist/sercrod.js if this section changes
related_functions: - renderNode -
_pick_request_data - _build_request_envelope -
_resolve_response_target -
_apply_response_target example:
<button type="button" *post="'/api/contact.php'" *keys="form" *response="'result'">Send</button>
*fetch
directive: *fetch status: implemented group: network
syntax_confidence: usable source_basis: - extracted from
dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Fetch JSON and write it into host data, either replacing the root or
writing to a :prop target. reads: - fetch URL spec string and optional *response placement - %expr% placeholders in
the spec - =<expr> form for expression-based spec
resolution writes: - _data[prop],
_data[base][key], or whole _data root -
sercrod-load-start, sercrod-loaded, and
sercrod-load-error events rerender: - schedules update
after successful load scope: - nearest Sercrod host scope when resolving
placeholders or expression specs timing: - clickable elements fetch on
click - non-clickable elements fetch automatically once, with
ts removed from dedup key ai_notes: - Use
*response for new *fetch response placement.
Treat the older placement suffix as legacy compatibility only.
must_not: - do not treat *fetch as a general network
framework - do not introduce the older placement suffix in new *fetch examples
- do not fetch non-JSON unless current source is changed uncertain: -
exact URL parsing for colon-containing URLs must be verified if used
related_functions: - _resolve_fetch_spec -
_do_load - _expand_text example:
<div *fetch="/api/items.json" *response="'items'"></div>
*print
directive: *print status: implemented group: output
syntax_confidence: usable with edge-case verification source_basis: -
extracted from dist/sercrod.js static directive set and
related render/action functions - refined for AI-facing interpretation
purpose: Evaluate expression and write plain text to textContent. reads:
- current scope and directive expression where applicable writes: -
rendered DOM, managed region, output text/HTML, or registered
template/shadow state rerender: - participates in render flow; exact
update behavior follows current runtime path scope: - nearest Sercrod
host scope unless current runtime explicitly passes child/local scope
timing: - during render/update flow according to current source
ai_notes: - Plain text output. Do not convert to HTML output. must_not:
- do not infer Proxy, watcher, MutationObserver, virtual DOM, or
common-framework behavior uncertain: - edge cases and exact syntax
should still be checked against current dist/sercrod.js
related_functions: - _renderElement -
eval_expr example:
<span *print="user.name"></span>
*compose
directive: *compose status: implemented group: output
syntax_confidence: needs official sample check source_basis: - extracted
from dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Evaluate expression/source and write HTML-related composed output
through html filter path. reads: - current scope and directive
expression where applicable writes: - rendered DOM, managed region,
output text/HTML, or registered template/shadow state rerender: -
participates in render flow; exact update behavior follows current
runtime path scope: - nearest Sercrod host scope unless current runtime
explicitly passes child/local scope timing: - during render/update flow
according to current source ai_notes: - HTML-related output path. Must
not be used when plain text output is intended. must_not: - do not infer
Proxy, watcher, MutationObserver, virtual DOM, or common-framework
behavior uncertain: - edge cases and exact syntax should still be
checked against current dist/sercrod.js related_functions: -
_renderElement - eval_expr example:
uncertain - check current dist/sercrod.js and official samples for `*compose`
*textContent
directive: *textContent status: implemented group:
output syntax_confidence: needs official sample check source_basis: -
extracted from dist/sercrod.js static directive set and
related render/action functions - refined for AI-facing interpretation
purpose: Alias-style text output directive that writes textContent.
reads: - current scope and directive expression where applicable writes:
- rendered DOM, managed region, output text/HTML, or registered
template/shadow state rerender: - participates in render flow; exact
update behavior follows current runtime path scope: - nearest Sercrod
host scope unless current runtime explicitly passes child/local scope
timing: - during render/update flow according to current source
ai_notes: - Text write path. Prefer when text output is intended.
must_not: - do not infer Proxy, watcher, MutationObserver, virtual DOM,
or common-framework behavior uncertain: - edge cases and exact syntax
should still be checked against current dist/sercrod.js
related_functions: - _renderElement -
eval_expr example:
uncertain - check current dist/sercrod.js and official samples for `*textContent`
*innerHTML
directive: *innerHTML status: implemented group: output
syntax_confidence: needs official sample check source_basis: - extracted
from dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Evaluate expression and write HTML into innerHTML through html filter
path. reads: - current scope and directive expression where applicable
writes: - rendered DOM, managed region, output text/HTML, or registered
template/shadow state rerender: - participates in render flow; exact
update behavior follows current runtime path scope: - nearest Sercrod
host scope unless current runtime explicitly passes child/local scope
timing: - during render/update flow according to current source
ai_notes: - HTML write path. Confirm safety behavior and filters before
recommending. must_not: - do not infer Proxy, watcher, MutationObserver,
virtual DOM, or common-framework behavior uncertain: - edge cases and
exact syntax should still be checked against current dist/sercrod.js
related_functions: - _renderElement -
eval_expr example:
uncertain - check current dist/sercrod.js and official samples for `*innerHTML`
*api
directive: *api status: implemented group: network
syntax_confidence: usable source_basis: - extracted from
dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Unified API bridge for GET/non-GET requests and file input uploads, with
optional *response placement. reads: - URL expression/text
from *api - method attribute, defaulting to
GET - optional body or payload
expression for non-GET requests - optional *params /
n-params - optional *dry-run /
n-dry-run - optional *response /
n-response, with *into / n-into
as a compatibility alias - file input files when used on
<input type="file"> writes: - $pending,
$error - $response for successful parsed
responses - mapped host data when *response or
communication *into is present - sercrod-api
and sercrod-error events on the rendered element rerender:
- start/stop calls update paths; placed data is available to subsequent
render/update scope: - nearest Sercrod host scope, with local scope
available during rendering timing: - clickable elements run on click -
file inputs run on change - non-clickable elements auto-run once per
normalized request key ai_notes: - Non-GET JSON requests send a Sercrod
request envelope. GET requests do not send *params /
*dry-run markers because they have no JSON body. must_not:
- do not say *into is the preferred new response placement
syntax - do not assume response data changes normal host data when
*response is absent - do not transform API response shape
unless the user explicitly asks - do not collapse *api,
*fetch, and *post into one directive
uncertain: - exact body evaluation and auto-run dedup behavior must be
checked if code changes related_functions: - renderNode -
_expand_text - eval_expr -
_resolve_response_target -
_apply_response_target example:
<button type="button" *api="/api/contact.php" method="POST" body="form" *response="'result'">Send</button>
*response
directive: *response status: implemented group:
storage/network syntax_confidence: usable source_basis: - extracted from
dist/sercrod.js response placement helpers - refined for
AI-facing interpretation purpose: Map a parsed *post,
*api, or *upload response into host data.
reads: - quoted destination key, evaluated destination expression, or
object-style response map writes: - no direct write by itself - caller
directive writes $response and mapped host data when it
supports *response rerender: - no direct rerender by itself
scope: - left side of map is Sercrod data path - right side of map is
evaluated against response scope timing: - read when the caller
directive handles a successful response ai_notes: -
*response="'result'" stores the whole response in
data.result. - *response="target" evaluates
target and uses the result as the destination key. -
*response="{ user: response.user }" maps selected response
values into data. must_not: - do not prefix map left sides with
data. - do not assume *response applies to
*fetch or *download - do not use
bracket/computed/function-call targets on the left side
related_functions: - _resolve_response_target -
_split_response_map - _make_response_scope -
_apply_response_target example:
<button *post="'/api/profile'" *keys="profile" *response="{ user.name: response.profile.name }">Save</button>
*into
directive: *into status: implemented group:
storage/network syntax_confidence: usable source_basis: - extracted from
dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Name the destination key for directives that support direct placement;
compatibility alias for communication whole-response placement. reads: -
raw destination key string from *into / n-into
writes: - no direct write by itself - caller directive writes into the
named key when it supports *into - communication directives
treat it like *response="'name'" rerender: - no direct
rerender by itself scope: - applies to the nearest caller directive that
explicitly reads *into timing: - read when the caller
directive renders, connects, or executes ai_notes: - Destination helper.
Its meaning depends on the directive flow using it. For new
communication examples, prefer *response. must_not: - do
not assume every bridge directive supports *into - do not
use *into as the preferred response mapping syntax for
*post, *api, or *upload - do not
use *into to explain *fetch - do not treat it
as a nested path syntax without source confirmation uncertain: - nested
destination paths are not the *into syntax; use
*response map form for nested response placement
related_functions: - renderNode -
_init_websocket_host - _bind_upload
example:
<div *api="/api/user.json" *into="user"></div>
*websocket
directive: *websocket status: implemented group:
websocket syntax_confidence: usable source_basis: - extracted from
dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Open and manage a WebSocket connection for a host or element, placing
incoming messages into WebSocket state and optional destination data.
reads: - URL string, expression, or object-like spec resolved by
_resolve_ws_spec - optional protocols from
object spec - optional into from object spec or
*into writes: - $ws_ready,
$ws_error, $ws_last,
$ws_messages, close metadata - data[into] when
destination is present - WebSocket lifecycle events such as
sercrod-ws-open, sercrod-ws-message,
sercrod-ws-error, sercrod-ws-close rerender: -
calls update paths on connection open, message, error, and close scope:
- nearest Sercrod host scope for spec resolution timing: - host
attribute auto-connects once after initialization when URL is resolved -
element directive connects on click if clickable, otherwise
auto-connects once ai_notes: - Maintains $ws_* state. It is
an external bridge, not the update engine. must_not: - do not treat
WebSocket as Sercrod’s update mechanism - do not add automatic retry
loops unless explicitly designed - do not infer watcher or Proxy
behavior from WebSocket events uncertain: - connection policy can depend
on websocket.internal_update and current source details
related_functions: - _ensure_ws_state -
_resolve_ws_spec - _init_websocket_host -
_ws_connect - _cleanup_websockets -
_ws_send example:
<div *websocket="wsUrl" *into="last_message"></div>
*websocket.send
directive: *websocket.send status: implemented group:
websocket syntax_confidence: usable source_basis: - extracted from
dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Send selected data through a WebSocket connection using the unified
WebSocket send form. reads: - target URL/spec from
*websocket.send - optional *keys /
n-keys - current source data: _stage if
present, otherwise _data writes: - outgoing WebSocket
message only rerender: - no direct rerender just because send succeeds
scope: - nearest Sercrod host data or staged data timing: - click action
on clickable rendered element ai_notes: - Send path only. Do not
describe it as opening the connection. must_not: - do not prefer legacy
*ws-send for new guidance - do not treat *keys
as nested path syntax - do not assume send success changes Sercrod data
uncertain: - behavior when no URL is supplied falls through
_ws_send target selection and must be checked for the exact
case related_functions: - renderNode -
_resolve_ws_spec - _parse_keys_attr -
_pick_keys - _ws_send example:
<button *websocket.send="wsUrl" *keys="message">Send</button>
*ws-send
directive: *ws-send status: implemented group: websocket
syntax_confidence: usable source_basis: - extracted from
dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Legacy-compatible WebSocket send directive that evaluates its expression
as the outgoing payload. reads: - payload expression from
*ws-send - optional URL/text from *ws-to -
event-aware scope when clicked writes: - outgoing WebSocket message only
rerender: - no direct rerender just because send succeeds scope: -
nearest Sercrod host scope for expression evaluation timing: - click
action on clickable rendered element ai_notes: - Send path alias/style
helper. Confirm exact relationship in source before documenting as
preferred. must_not: - do not teach *ws-send as the
preferred new form - do not confuse it with
*websocket.send + *keys uncertain: - exact legacy
compatibility expectations should be checked before changing behavior
related_functions: - renderNode - _expand_text
- _ws_send example:
<button *ws-send="message" *ws-to="%notifyUrl%">Send</button>
*ws-to
directive: *ws-to status: implemented group: websocket
syntax_confidence: usable source_basis: - extracted from
dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Select the target WebSocket URL for legacy *ws-send. reads:
- raw URL/text with placeholder expansion writes: - no direct write by
itself rerender: - no direct rerender by itself scope: - nearest Sercrod
host scope for placeholder expansion timing: - resolved when the
*ws-send click action runs ai_notes: - Selects the
WebSocket target when multiple targets exist. Do not use it as a general
routing directive. must_not: - do not use *ws-to with
*websocket.send unless current code explicitly supports
that path uncertain: - legacy behavior should be kept stable unless
explicitly changed related_functions: - renderNode -
_expand_text - _ws_send example:
<button *ws-send="message" *ws-to="%notifyUrl%">Send</button>
*camera
directive: *camera status: implemented group:
file-bridge syntax_confidence: usable source_basis: - implemented in
dist/sercrod.js through _bind_camera -
delegates platform capture and selection to sercrod.camera
purpose: Capture a new image or pick an existing image from an explicit
user action. reads: - optional camera options expression -
*camera.capture / n-camera.capture -
*camera.pick / n-camera.pick - element
accept and capture attributes as option
defaults - optional *response / n-response,
with *into / n-into for whole-result placement
writes: - $camera on successful capture or pick -
$response when no explicit response target is present -
mapped host data when *response or *into is
present - camera lifecycle events rerender: - calls explicit update
after successful result placement scope: - nearest Sercrod host scope at
bind time timing: - click or keyboard activation only ai_notes: - Use
*camera.capture for taking a new photo and
*camera.pick for selecting an existing image. - The camera
adapter owns platform details and normalization. - Use
*response for field mapping or *into for
whole-result placement. must_not: - do not say *camera
saves, uploads, or persists images - do not use direct adapter calls as
the only normal sample path - do not add FormData, endpoints, storage,
or upload behavior to the camera directive related_functions: -
_bind_camera - _normalize_camera_opts -
_apply_response_target example:
<button type="button" *camera.capture *into="photo">Take photo</button>
<button type="button" *camera.pick *response="{ preview: response.dataUrl }">Pick image</button>
*clipboard
directive: *clipboard status: implemented group:
file-bridge syntax_confidence: usable source_basis: - implemented in
dist/sercrod.js through _bind_clipboard -
delegates platform clipboard access to sercrod.clipboard
purpose: Read or write system clipboard text from an explicit user
action. reads: - optional expression for write/copy actions -
*clipboard.write / n-clipboard.write -
*clipboard.copy / n-clipboard.copy -
*clipboard.read / n-clipboard.read - optional
format suffixes .text, .raw,
.json, and .lines - optional
*response / n-response, with
*into / n-into for placement writes: -
$clipboard and $clipboard_text -
$response when no explicit response target is present -
mapped host data when *response or *into is
present - clipboard lifecycle events rerender: - calls explicit update
after successful result placement scope: - nearest Sercrod host scope at
bind time timing: - click or keyboard activation only ai_notes: - Use
*clipboard.write or *clipboard.copy for writes
and *clipboard.read for reads. - Clipboard access must stay
user-triggered; do not make it initial-render behavior. - Use
.json only when the clipboard text is contractually JSON
and handle parse failure. - Use ordinary Sercrod data, storage,
save/load, or app state for internal data flow. must_not: - do not use
clipboard as a hidden internal data bus - do not automatically read the
clipboard on render - do not imply legacy fallback can read clipboard
text related_functions: - _bind_clipboard -
_clipboard_encode_value -
_clipboard_decode_value -
_apply_response_target example:
<button type="button" *clipboard.write="message">Copy</button>
<button type="button" *clipboard.read *into="clipboardText">Read</button>
*audio-capture
directive: *audio-capture status: implemented group:
file-bridge syntax_confidence: usable source_basis: - implemented in
dist/sercrod.js through _bind_audio_capture -
delegates microphone recording to sercrod.audio_capture
purpose: Control microphone recording lifecycle actions from explicit
user actions. reads: - optional audio capture options expression -
*audio-capture.start / n-audio-capture.start -
*audio-capture.pause / n-audio-capture.pause -
*audio-capture.resume / n-audio-capture.resume
- *audio-capture.stop / n-audio-capture.stop -
*audio-capture.cancel / n-audio-capture.cancel
- optional *response / n-response, with
*into / n-into as compatibility placement for
stop results writes: - $audio_capture -
$audio_capture_status when adapter status is available -
$response or selected response target for stop
- audio capture lifecycle events rerender: - calls explicit update after
each completed action scope: - nearest Sercrod host scope at bind time
timing: - click or Enter/Space activation only ai_notes: - Use native
<audio> for playback and preview. -
cancel updates $audio_capture but does not
place a preview response. - The adapter owns browser/WebView recording
details and Object URL creation. must_not: - do not say audio capture
plays, saves, uploads, transcribes, mixes, or records in the background
- do not add a custom playback directive when native
<audio> is the correct surface - do not forget that
apps own Object URL release related_functions: -
_bind_audio_capture - _coerce_action_options
example:
<button type="button" *audio-capture.start>Start</button>
<button type="button" *audio-capture.stop *into="recording">Stop</button>
<audio controls :src="recording.url"></audio>
*geolocation
directive: *geolocation status: implemented group:
file-bridge syntax_confidence: usable source_basis: - implemented in
dist/sercrod.js through _bind_geolocation -
delegates foreground position actions to
sercrod.geolocation purpose: Run foreground
current-position, watch, clear, and permission actions through the
adapter. Current, clear, and permission forms are explicit actions.
Watch is a subscription and may auto-start once on non-clickable
elements. reads: - optional geolocation options expression such as
enableHighAccuracy, timeout, and
maximumAge - *geolocation.current /
n-geolocation.current - *geolocation.watch /
n-geolocation.watch - *geolocation.clear /
n-geolocation.clear -
*geolocation.check-permissions /
n-geolocation.check-permissions -
*geolocation.request-permissions /
n-geolocation.request-permissions - optional
*response / n-response, with
*into / n-into as compatibility placement
writes: - $geolocation - $geolocation_position
- $geolocation_watch - $geolocation_watch_id -
$geolocation_permissions - selected response target for
current, watch updates, and permission actions rerender: - calls
explicit update after each action and watch callback placement scope: -
nearest Sercrod host scope at bind time timing: - current, clear,
check-permissions, and request-permissions run from explicit activation
- watch runs from explicit activation on clickable elements - watch
auto-starts once on non-clickable elements - clickable timing is based
on element tag/type, not role or tabindex
ai_notes: - Current position is one-shot and can return before device
accuracy improves. - Watch is for continuing updates and improving
accuracy; clear watches explicitly. - Maps and
Leaflet/OpenStreetMap examples are app UI, not geolocation directive
behavior. - Do not generalize geolocation.watch auto-start to camera,
clipboard, share, notification, barcode, audio-capture, upload, or
download. must_not: - do not make background tracking part of the
directive - do not say the directive owns maps, geocoding, IP
estimation, route history, persistence, or upload - do not expose
browser numeric watch ids as the app contract related_functions: -
_bind_geolocation - _coerce_action_options
example:
<button type="button" *geolocation.current="{ enableHighAccuracy: true }" *response="'position'">Current</button>
<button type="button" *geolocation.watch *response="'position'">Start watch</button>
<p *geolocation.watch *response="'position'"></p>
<button type="button" *geolocation.clear>Stop watch</button>
*notification
directive: *notification status: implemented group:
file-bridge syntax_confidence: usable source_basis: - implemented in
dist/sercrod.js through _bind_notification -
delegates local notification actions to
sercrod.notification purpose: Show local notifications and
handle local notification permissions from explicit user actions. reads:
- payload expression for show, usually { title, body } -
string expression as notification title -
*notification.show / n-notification.show -
*notification.check-permissions /
n-notification.check-permissions -
*notification.request-permissions /
n-notification.request-permissions - optional
*response / n-response, with
*into / n-into as compatibility placement
writes: - $notification -
$notification_permissions - selected response target for
successful show and permission actions rerender: - calls explicit update
after each action result or fallback placement scope: - nearest Sercrod
host scope at bind time timing: - click or Enter/Space activation only
ai_notes: - Browser Notification API requires permission; request
permission explicitly before show when needed. - The adapter may use
browser Notification API, Capacitor LocalNotifications, or a project
bridge. - This directive is local notification behavior only. must_not:
- do not make push notification registration part of the directive - do
not say the directive owns server delivery, background sync,
persistence, sharing, or navigation - do not show notifications during
initial render related_functions: - _bind_notification -
_coerce_notification_payload example:
<button type="button" *notification.request-permissions *response="'permissions'">Allow</button>
<button type="button" *notification.show="{ title, body }" *response="'lastNotification'">Notify</button>
*upload
directive: *upload status: implemented group:
file-bridge syntax_confidence: usable source_basis: - extracted from
dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Bind an upload action to an element, open a hidden file input, and
upload selected files to the resolved endpoint. reads: - upload
expression evaluated in current scope - string value as
{url} or object value such as
{url, method, field, with, headers, credentials} - element
attributes such as accept, name, legacy
multiple, and capture -
*upload.single / n-upload.single -
*upload.multiple / n-upload.multiple -
optional *keys / n-keys - optional
*params / n-params - optional
*dry-run / n-dry-run - optional
*response / n-response, with
*into / n-into as a compatibility alias
writes: - $response for successful parsed upload responses
- mapped host data when *response or communication
*into is present - upload lifecycle events: start,
progress, uploaded, error rerender: - calls explicit update after
successful upload response placement scope: - nearest Sercrod host scope
at bind time timing: - click or keyboard action opens generated file
input - file input change starts upload ai_notes: - Upload sends files
with FormData and may append Sercrod envelope fields. Use
*response for new response placement. -
*upload and *upload.single are single-file
forms. - *upload.multiple is the preferred multiple-file
form. - multiple *upload remains supported as a
compatibility shorthand and behaves like *upload.multiple.
must_not: - do not treat *upload as the same as
*api file upload - do not assume it posts arbitrary data
without selected files - do not say $upload is the response
store in current communication behavior - do not ignore browser
file-selection restrictions - do not recommend
<button multiple *upload> as the preferred spelling
for new examples uncertain: - exact progress and credentials behavior
depends on XHR and browser environment related_functions: -
_bind_upload - _normalize_upload_opts -
_ensure_clickable - _ensure_hidden_file_input
- _xhr_upload example:
<button *upload="'/api/upload'" *response="'upload_result'">Upload</button>
<button *upload.multiple="'/api/upload'" *response="'upload_result'">Upload files</button>
*download
directive: *download status: implemented group:
file-bridge syntax_confidence: usable source_basis: - extracted from
dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Bind a browser download action to an element using a resolved
URL/options object. reads: - download expression evaluated in current
scope - string value as {url} or object value such as
{url, method, headers, credentials, filename, transport}
writes: - browser download side effect through Blob/ObjectURL -
sercrod-download-start, sercrod-downloaded,
and sercrod-error events rerender: - no direct data
rerender just because download completed scope: - nearest Sercrod host
scope at bind time timing: - click or keyboard action starts the
download request ai_notes: - Triggers browser download. Do not describe
as automatic data merge. must_not: - do not treat downloaded data as
automatically merged into Sercrod data - do not treat download as
storage/load uncertain: - transport-specific behavior depends on
fetch/XHR and browser download handling related_functions: -
_bind_download - _normalize_download_opts -
_ensure_clickable - _xhr_download example:
<button *download="{url:'/api/report.csv', filename:'report.csv'}">Download</button>
*page
directive: *page status: implemented group: navigation
syntax_confidence: usable source_basis: - extracted from
dist/sercrod.js navigation target helpers and render flow -
refined for AI-facing interpretation purpose: Mark an explicit
navigation target region inside the current Sercrod host. reads: -
expression value from *page / n-page writes: -
rendered element navigation metadata - element visibility when a
matching target is activated - optional lazily inserted partial HTML for
same-origin HTML targets rerender: - participates in render flow;
activation may render fetched partial content into the page element
scope: - nearest Sercrod host scope at render time timing: - target is
resolved during render - initial activation happens after page elements
are collected - lazy same-origin HTML partial fetch happens on
activation - View Transitions, when supported and enabled, wrap
activation DOM changes only - lazy partial fetch timeout is controlled
by navigation page_timeout / pageTimeout
config and is disabled by default ai_notes: - Use quoted target
expressions such as *page="'/spa/a.html'". - A matching
*navigate target activates the first matching page;
duplicate targets warn and first page wins. - URL-like same-origin HTML
targets may be fetched as partial HTML, inserted, and then processed by
the normal Sercrod rendering path. - View Transitions are skipped for
unsupported browsers, prefers-reduced-motion: reduce,
no-view-transition / n-no-view-transition,
window.__Sercrod.config.navigation.view_transitions = false,
initial activation, and same-page activation. -
page_timeout / pageTimeout applies only to
lazy *page partial fetches. It is a positive millisecond
value; missing, invalid, zero, or negative values mean no Sercrod
timeout. must_not: - do not treat *page as a route table,
route params, nested router, or component mount - do not infer targets
from href, id, hashes, or CSS selectors - do
not describe View Transitions as required behavior or as Sercrod-owned
animation control - do not describe page_timeout as a
global router, adapter, or render timeout - do not change
*import semantics when explaining *page
related_functions: - _resolve_page_name -
_collect_page_elements -
_apply_initial_page_visibility -
_activate_page_target - _load_page_target -
_render_page_fragment example:
<section *page="'/spa/a.html'"></section>
*navigate
directive: *navigate status: implemented group:
navigation syntax_confidence: usable source_basis: - extracted from
dist/sercrod.js navigation binding and adapter call path -
refined for AI-facing interpretation purpose: Send an explicit
navigation target to the navigation adapter. reads: -
expression value from *navigate / n-navigate -
current data or staged data for adapter context writes: - browser event
default prevention only when adapter handles the request - navigation
lifecycle events - page activation through the adapter or preview
fallback rerender: - does not make the whole host into a router;
matching page activation may update page visibility and lazy content
scope: - expression scope of the rendered element timing: - click action
on the rendered element ai_notes: - The default adapter mapping is the
navigation role, normally resolving through
sercrod.navigation.auto. - Adapter context includes
host, el, source_el,
page, target, event,
data, and scope. - Adapter return
false means fallback/no-op for this explicit Sercrod
navigation path. Any other return value counts as handled. - Browser
adapter support may use the Navigation API,
history.pushState() / popstate, and optional
Service Worker shell fallback. - Handled page activation may use View
Transitions when available and enabled, with the same fallback
conditions as *page. must_not: - do not globally intercept
ordinary links when explaining *navigate - do not infer
targets from href - do not describe Sercrod as owning route
tables, route params, or application-level router state - do not
describe *navigate as an animation directive - do not make
adapter async return semantics part of the render pipeline
related_functions: - _bind_navigate -
_navigate_to_page - _dispatch_navigation_event
- Sercrod._install_default_navigation_adapters example:
<button type="button" *navigate="'/spa/a.html'">A</button>
:class
directive: :class status: implemented group: attribute
syntax_confidence: usable with edge-case verification source_basis: -
extracted from dist/sercrod.js static directive set and
related render/action functions - refined for AI-facing interpretation
purpose: Bind dynamic classes from string/array/object expression and
combine them with the static class attribute. reads: -
static class attribute, bound expression, and current scope writes: -
combined DOM className rerender: - participates in render flow; exact
update behavior follows current runtime path scope: - nearest Sercrod
host scope unless current runtime explicitly passes child/local scope
timing: - during render/update flow according to current source
ai_notes: - class="..." is the static base class list. -
:class="..." supplies dynamic class tokens. - The final
class list is static class plus dynamic class, with duplicate tokens
collapsed. - A false, null, undefined, empty, or failing
:class expression should not remove static classes. - Put
classes that may disappear in :class; put permanent classes
in class. must_not: - do not infer Proxy, watcher,
MutationObserver, virtual DOM, or common-framework behavior - do not
describe current :class as replacing the whole className
without preserving static classes uncertain: - edge cases and exact
syntax should still be checked against current dist/sercrod.js
related_functions: - _renderElement example:
<div :class="classList"></div>
:style
directive: :style status: implemented group: attribute
syntax_confidence: usable with edge-case verification source_basis: -
extracted from dist/sercrod.js static directive set and
related render/action functions - refined for AI-facing interpretation
purpose: Bind style from style text/object according to implementation.
reads: - bound expression and current scope writes: - rendered DOM,
managed region, output text/HTML, or registered template/shadow state
rerender: - participates in render flow; exact update behavior follows
current runtime path scope: - nearest Sercrod host scope unless current
runtime explicitly passes child/local scope timing: - during
render/update flow according to current source must_not: - do not infer
Proxy, watcher, MutationObserver, virtual DOM, or common-framework
behavior uncertain: - edge cases and exact syntax should still be
checked against current dist/sercrod.js related_functions: -
_renderElement example:
<div :style="styleText"></div>
*prevent-default
directive: *prevent-default status: implemented group:
event syntax_confidence: needs official sample check source_basis: -
extracted from dist/sercrod.js static directive set and
related render/action functions - refined for AI-facing interpretation
purpose: Modify browser event behavior to prevent default for selected
event/mode. reads: - event object, event modifiers, current scope
writes: - explicit data paths or update requests according to
expression/directive target rerender: - follows the caller/update path
selected by current runtime scope: - nearest Sercrod host scope unless
current runtime explicitly passes child/local scope timing: - when the
browser event fires must_not: - do not infer Proxy, watcher,
MutationObserver, virtual DOM, or common-framework behavior uncertain: -
edge cases and exact syntax should still be checked against current
dist/sercrod.js related_functions: - _renderElement -
_renderEvent example:
uncertain - check current dist/sercrod.js and official samples for `*prevent-default`
*prevent
directive: *prevent status: implemented group: event
syntax_confidence: needs official sample check source_basis: - extracted
from dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Short prevention helper; used for submit/enter/all-mode and event
prevention. reads: - event object, event modifiers, current scope
writes: - explicit data paths or update requests according to
expression/directive target rerender: - follows the caller/update path
selected by current runtime scope: - nearest Sercrod host scope unless
current runtime explicitly passes child/local scope timing: - when the
browser event fires must_not: - do not infer Proxy, watcher,
MutationObserver, virtual DOM, or common-framework behavior uncertain: -
edge cases and exact syntax should still be checked against current
dist/sercrod.js related_functions: - _renderElement -
_renderEvent example:
uncertain - check current dist/sercrod.js and official samples for `*prevent`
*updated
directive: *updated status: implemented group: lifecycle
syntax_confidence: usable with edge-case verification source_basis: -
extracted from dist/sercrod.js static directive set and
related render/action functions - refined for AI-facing interpretation
purpose: Run post-update hook after render/update completes; not change
detection. reads: - current scope and directive expression where
applicable writes: - direct effect defined by current dist/sercrod.js
rerender: - participates in render flow; exact update behavior follows
current runtime path scope: - nearest Sercrod host scope unless current
runtime explicitly passes child/local scope timing: - after update
ai_notes: - Runs after update. It is not change detection. must_not: -
do not infer Proxy, watcher, MutationObserver, virtual DOM, or
common-framework behavior uncertain: - edge cases and exact syntax
should still be checked against current dist/sercrod.js
related_functions: - _call_updated_hooks -
_absorb_child_updated example:
<div *updated="onUpdated"></div>
*update
directive: *update status: implemented group:
lifecycle/update syntax_confidence: usable with edge-case verification
source_basis: - extracted from dist/sercrod.js static
directive set and related render/action functions - refined for
AI-facing interpretation purpose: Request an update on resolved target
host. reads: - current scope and directive expression where applicable
writes: - explicit data paths or update requests according to
expression/directive target rerender: - follows the caller/update path
selected by current runtime scope: - nearest Sercrod host scope unless
current runtime explicitly passes child/local scope timing: - during
render/update flow according to current source ai_notes: - Requests
update. Do not call parent full redraw unless that is the intended
explicit path. must_not: - do not infer Proxy, watcher,
MutationObserver, virtual DOM, or common-framework behavior uncertain: -
edge cases and exact syntax should still be checked against current
dist/sercrod.js related_functions: -
_get_update_directive_attr -
_resolve_update_target -
_apply_update_directive - update example:
<button *update="root">Refresh</button>
*updated-propagate
directive: *updated-propagate status: alias group: alias
syntax_confidence: needs official sample check source_basis: - extracted
from dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Alias of *update where implemented. Prefer
*update in AI-facing guidance unless the user explicitly
works with compatibility markup. reads: - current scope and directive
expression where applicable writes: - direct effect defined by current
dist/sercrod.js rerender: - participates in render flow; exact update
behavior follows current runtime path scope: - nearest Sercrod host
scope unless current runtime explicitly passes child/local scope timing:
- during render/update flow according to current source must_not: - do
not infer Proxy, watcher, MutationObserver, virtual DOM, or
common-framework behavior uncertain: - edge cases and exact syntax
should still be checked against current dist/sercrod.js
related_functions: - _get_update_directive_attr -
_resolve_update_target -
_apply_update_directive - update example:
uncertain - check current dist/sercrod.js and official samples for `*updated-propagate`
*methods
directive: *methods status: implemented group: methods
syntax_confidence: needs official sample check source_basis: - extracted
from dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Load/expose Sercrod method definitions according to implementation; do
not expose internals without instruction. reads: - current scope and
directive expression where applicable writes: - direct effect defined by
current dist/sercrod.js rerender: - participates in render flow; exact
update behavior follows current runtime path scope: - nearest Sercrod
host scope unless current runtime explicitly passes child/local scope
timing: - during render/update flow according to current source
ai_notes: - Expose deliberate callable methods only. Do not expose
internal helper functions. must_not: - do not infer Proxy, watcher,
MutationObserver, virtual DOM, or common-framework behavior uncertain: -
edge cases and exact syntax should still be checked against current
dist/sercrod.js related_functions: - connectedCallback
example:
uncertain - check current dist/sercrod.js and official samples for `*methods`
*log
directive: *log status: implemented group: debug
syntax_confidence: source-confirmed behavior with sample check
recommended source_basis: - extracted from dist/sercrod.js
static directive set and _call_log_hooks - refined for
AI-facing interpretation purpose: Evaluate a *log
expression and output a log record containing the evaluated value, the
expression label, and a short host element snippet. reads: -
*log or n-log expression - current scope when
no expression is provided - host element snippet for context writes: -
console output for ordinary elements - textContent on the
same element when the element is <pre> rerender: -
does not request rerender by itself - runs as a post-render/log hook
according to current update flow scope: - nearest Sercrod host scope
passed to the log hook timing: - after render/update finalization path
where log hooks are called ai_notes: - Object values may be logged as
live objects in the console and stringified for
<pre *log> output. - The current inspected source
logs value/expression/host snippet. It is not a change detector and must
not be described as observer output. must_not: - do not describe
*log as change detection - do not infer Proxy, watcher,
MutationObserver, virtual DOM, or common-framework behavior - do not
claim it outputs diff information unless the current
dist/sercrod.js explicitly implements that uncertain: -
exact formatting, error text, and future log payload changes should be
checked against current dist/sercrod.js related_functions:
- _call_log_hooks example:
<pre *log="data"></pre>
*man
directive: *man status: implemented group: manual
syntax_confidence: needs official sample check source_basis: - extracted
from dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Print built-in or loaded manual entry into the element. reads: - current
scope and directive expression where applicable writes: - direct effect
defined by current dist/sercrod.js rerender: - participates in render
flow; exact update behavior follows current runtime path scope: -
nearest Sercrod host scope unless current runtime explicitly passes
child/local scope timing: - during render/update flow according to
current source must_not: - do not infer Proxy, watcher,
MutationObserver, virtual DOM, or common-framework behavior uncertain: -
edge cases and exact syntax should still be checked against current
dist/sercrod.js related_functions: - _call_man_hooks -
_ensure_man_loaded example:
uncertain - check current dist/sercrod.js and official samples for `*man`
*template
directive: *template status: implemented group: template
syntax_confidence: usable with edge-case verification source_basis: -
extracted from dist/sercrod.js static directive set and
related render/action functions - refined for AI-facing interpretation
purpose: Declare and register a named reusable template source;
declaration itself is not ordinary output. reads: - template name/source
expression and current scope writes: - rendered DOM, managed region,
output text/HTML, or registered template/shadow state rerender: -
participates in render flow; exact update behavior follows current
runtime path scope: - current host template/shadow registry and current
scope timing: - during render/update flow according to current source
ai_notes: - Template declarations are source material and should not be
rendered as ordinary visible output. must_not: - do not infer Proxy,
watcher, MutationObserver, virtual DOM, or common-framework behavior
uncertain: - edge cases and exact syntax should still be checked against
current dist/sercrod.js related_functions: - _renderElement
- _collect_templates_from_light_dom -
_collect_templates_from_roots -
_resolve_template_name - _lookupTemplateNear
example:
<template *template="ss-item-tpl">...</template>
*include
directive: *include status: implemented group: template
syntax_confidence: usable with edge-case verification source_basis: -
extracted from dist/sercrod.js static directive set and
related render/action functions - refined for AI-facing interpretation
purpose: Insert the inner content of a named *template into the current
element while keeping the current element. reads: - template name/source
expression and current scope writes: - rendered DOM, managed region,
output text/HTML, or registered template/shadow state rerender: -
participates in render flow; exact update behavior follows current
runtime path scope: - current host template/shadow registry and current
scope timing: - during render/update flow according to current source
ai_notes: - Include uses templates or partial content. Do not describe
as component mount. must_not: - do not infer Proxy, watcher,
MutationObserver, virtual DOM, or common-framework behavior uncertain: -
edge cases and exact syntax should still be checked against current
dist/sercrod.js related_functions: - _renderElement -
_resolve_template_name - _lookupTemplateNear -
_get_nearest_include_depth example:
<div *include="card"></div>
*import
directive: *import status: implemented group: template
syntax_confidence: source-confirmed behavior with sample check
recommended source_basis: - extracted from dist/sercrod.js
static directive set and the *import branch inside element
rendering - refined for AI-facing interpretation purpose: Import
external HTML into the current element and then continue the normal
Sercrod render flow for that imported content. reads: -
*import or n-import expression - current scope
for URL expression evaluation - URL-like raw text fallback when
expression evaluation does not produce a URL - import/include
configuration such as depth limit, method, credentials, headers, warning
behavior, and cache writes: - imported HTML into the element’s inner
content before continuing child rendering - temporary diagnostic
attributes such as import depth overflow, invalid import, or import
error when configured - class-level import cache for already loaded URLs
rerender: - participates in render flow - after HTML is imported into
the element, normal child rendering continues, so Sercrod directives
inside imported HTML can be processed by the current render path scope:
- current host and current render scope timing: - during element render
when *import or n-import is found ai_notes: -
In the inspected source, the URL is resolved by expression evaluation
first, then by URL-like raw text fallback. - The inspected source uses
an external HTML loading path and cache, then removes the transient
import attribute. - *import is related to template/render
flow, but it is not the same as *include, and it is not
JavaScript module import. must_not: - do not treat *import
as ES module import - do not invent module-loader, component-loader, or
bundler semantics - do not invent general network-framework semantics
beyond the current implementation - do not infer Proxy, watcher,
MutationObserver, virtual DOM, or common-framework behavior uncertain: -
exact request method, credentials, headers, caching, error handling,
warning attributes, and depth behavior must be checked against current
dist/sercrod.js before implementation-sensitive edits
related_functions: - _renderElement -
_get_nearest_include_depth example:
<div *import="/partials/card.html"></div>
*shadow
directive: *shadow status: implemented group: shadow
syntax_confidence: usable with edge-case verification source_basis: -
extracted from dist/sercrod.js static directive set and
related render/action functions - refined for AI-facing interpretation
purpose: Declare a named Shadow DOM template on a template element; not
rendered as ordinary DOM. reads: - template name/source expression and
current scope writes: - rendered DOM, managed region, output text/HTML,
or registered template/shadow state rerender: - participates in render
flow; exact update behavior follows current runtime path scope: -
current host template/shadow registry and current scope timing: - during
render/update flow according to current source ai_notes: - Declares a
shadow template. It is not a component class definition. must_not: - do
not infer Proxy, watcher, MutationObserver, virtual DOM, or
common-framework behavior uncertain: - edge cases and exact syntax
should still be checked against current dist/sercrod.js
related_functions: - _is_shadow_template_node -
_register_shadow_template -
_collect_shadow_templates_from_root -
_collect_shadow_templates_from_roots -
_render_shadow_template_content example:
<template *shadow="'messagebox'">...</template>
*host
directive: *host status: implemented group: shadow
syntax_confidence: usable with edge-case verification source_basis: -
extracted from dist/sercrod.js static directive set and
related render/action functions - refined for AI-facing interpretation
purpose: Connect an ordinary host element to a named *shadow template
and attach/use open Shadow DOM. reads: - template name/source expression
and current scope writes: - rendered DOM, managed region, output
text/HTML, or registered template/shadow state rerender: - participates
in render flow; exact update behavior follows current runtime path
scope: - current host template/shadow registry and current scope timing:
- during render/update flow according to current source ai_notes: -
Connects an ordinary element to a shadow template. Use ordinary elements
when a child Sercrod host would create timing problems. must_not: - do
not infer Proxy, watcher, MutationObserver, virtual DOM, or
common-framework behavior uncertain: - edge cases and exact syntax
should still be checked against current dist/sercrod.js
related_functions: - _get_shadow_host_attr -
_apply_shadow_host_if_needed -
_resolve_shadow_template_name -
_render_shadow_template_content example:
<message-box *host="'messagebox'"></message-box>
*shadow-host
directive: *shadow-host status: alias group: alias
syntax_confidence: needs official sample check source_basis: - extracted
from dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Alias of *host where implemented. Prefer *host
in AI-facing guidance unless the user explicitly works with
compatibility markup. reads: - current scope and directive expression
where applicable writes: - direct effect defined by current
dist/sercrod.js rerender: - participates in render flow; exact update
behavior follows current runtime path scope: - current host
template/shadow registry and current scope timing: - during
render/update flow according to current source ai_notes: - Alias of
*host; do not prefer over *host in AI-facing
guidance. must_not: - do not infer Proxy, watcher, MutationObserver,
virtual DOM, or common-framework behavior uncertain: - edge cases and
exact syntax should still be checked against current dist/sercrod.js
related_functions: - _get_shadow_host_attr -
_apply_shadow_host_if_needed example:
uncertain - check current dist/sercrod.js and official samples for `*shadow-host`
@event pattern
directive: @event pattern status: implemented pattern
group: event syntax_confidence: pattern - confirm exact target in
current source source_basis: - extracted from
dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Attributes beginning with @ register event handlers; keyboard modifiers
and .window are supported for key events. reads: - event object, event
modifiers, current scope writes: - explicit data paths or update
requests according to expression/directive target rerender: - follows
the caller/update path selected by current runtime scope: - nearest
Sercrod host scope unless current runtime explicitly passes child/local
scope timing: - when the browser event fires ai_notes: - Events trigger
expression execution. They are not a data-change detection mechanism.
must_not: - do not infer Proxy, watcher, MutationObserver, virtual DOM,
or common-framework behavior uncertain: - exact syntax and edge cases
must be checked against current dist/sercrod.js and working samples
related_functions: - _bind_event_attrs -
_renderEvent - _parse_keyboard_event_parts -
_matches_keyboard_event -
_register_window_key_handler -
_cleanup_window_key_handlers example:
<button @click="count = count + 1">Add</button>
:attribute pattern
directive: :attribute pattern status: implemented
pattern group: attribute syntax_confidence: pattern - confirm exact
target in current source source_basis: - extracted from
dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Attributes beginning with : bind evaluated expressions to
attributes/properties; :class and :style have special handling. reads: -
bound expression and current scope writes: - rendered DOM, managed
region, output text/HTML, or registered template/shadow state rerender:
- participates in render flow; exact update behavior follows current
runtime path scope: - nearest Sercrod host scope unless current runtime
explicitly passes child/local scope timing: - during render/update flow
according to current source ai_notes: - Attribute binding is direct
output. It is not a virtual DOM diff. must_not: - do not infer Proxy,
watcher, MutationObserver, virtual DOM, or common-framework behavior
uncertain: - exact syntax and edge cases must be checked against current
dist/sercrod.js and working samples related_functions: -
_renderElement - _collect_flags_from
example:
<a :href="url">Link</a>
*true
directive: *true status: helper group: conditional
syntax_confidence: needs official sample check source_basis: - extracted
from dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Helper attribute for condition/cond true branch. Not an
independent core directive. reads: - condition / branch expression and
current scope writes: - rendered DOM, managed region, output text/HTML,
or registered template/shadow state rerender: - participates in render
flow; exact update behavior follows current runtime path scope: -
nearest Sercrod host scope unless current runtime explicitly passes
child/local scope timing: - during render/update flow according to
current source must_not: - do not infer Proxy, watcher,
MutationObserver, virtual DOM, or common-framework behavior uncertain: -
edge cases and exact syntax should still be checked against current
dist/sercrod.js related_functions: - renderNode -
_apply_condition_branch_fragment example:
uncertain - check current dist/sercrod.js and official samples for `*true`
*false
directive: *false status: helper group: conditional
syntax_confidence: needs official sample check source_basis: - extracted
from dist/sercrod.js static directive set and related
render/action functions - refined for AI-facing interpretation purpose:
Helper attribute for condition/cond false branch. Not an
independent core directive. reads: - condition / branch expression and
current scope writes: - rendered DOM, managed region, output text/HTML,
or registered template/shadow state rerender: - participates in render
flow; exact update behavior follows current runtime path scope: -
nearest Sercrod host scope unless current runtime explicitly passes
child/local scope timing: - during render/update flow according to
current source must_not: - do not infer Proxy, watcher,
MutationObserver, virtual DOM, or common-framework behavior uncertain: -
edge cases and exact syntax should still be checked against current
dist/sercrod.js related_functions: - renderNode -
_apply_condition_branch_fragment example:
uncertain - check current dist/sercrod.js and official samples for `*false`
10. Alias appendix
AI should prefer official * names and avoid teaching
n-* aliases as primary syntax. Use aliases only when
reading existing compatibility markup or when the user explicitly asks
about them.
| alias | preferred | status | AI guidance |
|---|---|---|---|
n-if |
*if |
alias | read existing code only |
n-elseif |
*elseif |
alias | read existing code only |
n-else |
*else |
alias | read existing code only |
n-condition |
*condition |
alias | read existing code only |
n-cond |
*cond |
alias | read existing code only |
n-for |
*for |
alias | read existing code only |
n-each |
*each |
alias | read existing code only |
n-iterate |
*iterate |
alias | read existing code only |
n-switch |
*switch |
alias | read existing code only |
n-case |
*case |
alias | read existing code only |
n-break |
*break |
alias | read existing code only |
n-case.break |
*case.break |
alias | read existing code only |
n-default |
*default |
alias | read existing code only |
n-let |
*let |
alias | read existing code only |
n-global |
*global |
alias | read existing code only |
n-literal |
*literal |
alias | read existing code only |
n-rem |
*rem |
alias | read existing code only |
n-input |
*input |
alias | read existing code only |
n-lazy |
*lazy |
alias | read existing code only |
n-eager |
*eager |
alias | read existing code only |
n-dominate |
*dominate |
alias | read existing code only |
n-dominant |
*dominate via *dominant |
alias | do not promote |
n-stage |
*stage |
alias | read existing code only |
n-apply |
*apply |
alias | read existing code only |
n-restore |
*restore |
alias | read existing code only |
n-save |
*save |
alias | read existing code only |
n-save.file |
*save.file |
alias | read existing code only |
n-save.session |
*save.session |
alias | read existing code only |
n-save.store |
*save.store |
alias | read existing code only |
n-load |
*load |
alias | read existing code only |
n-load.file |
*load.file |
alias | read existing code only |
n-load.session |
*load.session |
alias | read existing code only |
n-load.store |
*load.store |
alias | read existing code only |
n-keys |
*keys |
alias | read existing code only |
n-params |
*params |
alias | read existing code only |
n-dry-run |
*dry-run |
alias | read existing code only |
n-post |
*post |
alias | read existing code only |
n-fetch |
*fetch |
alias | read existing code only |
n-print |
*print |
alias | read existing code only |
n-compose |
*compose |
alias | read existing code only |
n-textContent |
*textContent |
alias | read existing code only |
n-innerHTML |
*innerHTML |
alias | read existing code only |
n-api |
*api |
alias | read existing code only |
n-into |
*into |
alias | read existing code only |
n-response |
*response |
alias | read existing code only |
n-websocket |
*websocket |
alias | read existing code only |
n-websocket.send |
*websocket.send |
alias | read existing code only |
n-ws-send |
*ws-send |
alias | legacy read existing code only |
n-ws-to |
*ws-to |
alias | legacy read existing code only |
n-camera |
*camera |
alias | read existing code only |
n-camera.capture |
*camera.capture |
alias | read existing code only |
n-camera.pick |
*camera.pick |
alias | read existing code only |
n-clipboard |
*clipboard |
alias | read existing code only |
n-clipboard.write |
*clipboard.write |
alias | read existing code only |
n-clipboard.copy |
*clipboard.copy |
alias | read existing code only |
n-clipboard.read |
*clipboard.read |
alias | read existing code only |
n-audio-capture |
*audio-capture |
alias | read existing code only |
n-audio-capture.start |
*audio-capture.start |
alias | read existing code only |
n-audio-capture.pause |
*audio-capture.pause |
alias | read existing code only |
n-audio-capture.resume |
*audio-capture.resume |
alias | read existing code only |
n-audio-capture.stop |
*audio-capture.stop |
alias | read existing code only |
n-audio-capture.cancel |
*audio-capture.cancel |
alias | read existing code only |
n-geolocation |
*geolocation |
alias | read existing code only |
n-geolocation.current |
*geolocation.current |
alias | read existing code only |
n-geolocation.watch |
*geolocation.watch |
alias | read existing code only |
n-geolocation.clear |
*geolocation.clear |
alias | read existing code only |
n-geolocation.check-permissions |
*geolocation.check-permissions |
alias | read existing code only |
n-geolocation.request-permissions |
*geolocation.request-permissions |
alias | read existing code only |
n-notification |
*notification |
alias | read existing code only |
n-notification.show |
*notification.show |
alias | read existing code only |
n-notification.check-permissions |
*notification.check-permissions |
alias | read existing code only |
n-notification.request-permissions |
*notification.request-permissions |
alias | read existing code only |
n-barcode |
*barcode |
alias | read existing code only |
n-barcode.scan |
*barcode.scan |
alias | read existing code only |
n-barcode.detect |
*barcode.detect |
alias | read existing code only |
n-upload |
*upload |
alias | read existing code only |
n-upload.single |
*upload.single |
alias | read existing code only |
n-upload.multiple |
*upload.multiple |
alias | read existing code only |
n-download |
*download |
alias | read existing code only |
n-page |
*page |
alias | read existing code only |
n-navigate |
*navigate |
alias | read existing code only |
n-class |
:class |
alias | read existing code only |
n-style |
:style |
alias | read existing code only |
n-prevent-default |
*prevent-default |
alias | read existing code only |
n-prevent |
*prevent |
alias | read existing code only |
n-updated |
*updated |
alias | read existing code only |
n-update |
*update |
alias | read existing code only |
n-updated-propagate |
*update via *updated-propagate |
alias | do not promote |
n-methods |
*methods |
alias | read existing code only |
n-log |
*log |
alias | read existing code only |
n-man |
*man |
alias | read existing code only |
n-template |
*template |
alias | read existing code only |
n-include |
*include |
alias | read existing code only |
n-import |
*import |
alias | read existing code only |
n-host |
*host |
alias | allowed host alias, but do not prefer over documented official form unless project style uses it |
n-shadow-host |
*host |
alias | allowed host alias, but do not invent n-shadow |
*dominant |
*dominate |
alias | read existing code only; do not teach as official |
*updated-propagate |
*update |
alias | read existing code only; do not teach as official |
*shadow-host |
*host |
alias | accepted alias where implemented |
11. Items not to promote
Do not promote these as AI-facing preferred directives or patterns:
*dominant
*dynamic
*static
*class
*style
*unwrap
n-shadow
Use these instead where applicable:
*dominate
:class
:style
*host / *shadow-host / n-host / n-shadow-host where implemented
12. Post-placement verification tasks
Before treating this file as final, verify these against current
dist/sercrod.js, official docs, and working samples:
1. Exact same-element execution order for structural directives.
2. Exact *for and *each syntax variants and local variables.
3. Exact *iterate place object edge cases, region markers, candidate selection, and unit/template evaluation.
4. Exact *stage target rules inside repeated child hosts.
5. Exact save/load storage backend behavior and adapter fallbacks.
6. Exact *keys behavior for save/load/WebSocket send and whether any nested paths are supported.
7. Exact *fetch URL plus *response placement behavior, including legacy compatibility.
8. Exact *post / *api / *upload request envelope fields, $response behavior, and *response / *into behavior.
9. Exact WebSocket state keys, cleanup behavior, and element vs host connection behavior.
10. Exact upload response placement and event names.
11. Exact download behavior and whether any data side effect exists.
12. Exact *page / *navigate target resolution, browser adapter fallback, and lazy partial loading.
13. Exact event modifier syntax, key handling, and .window cleanup.
14. Exact Shadow DOM bridge name resolution.
15. Exact man.json key mapping and fallback behavior.
16. Exact warn messages and undefined/null output behavior.
17. Exact public vs internal method boundary.
13. Final AI decision rule
If the directive behavior is implemented in current dist/sercrod.js, preserve it.
If it is planned, do not present it as implemented.
If it is uncertain, mark it uncertain.
If a common framework would solve the problem differently, do not import that model into Sercrod.
If an edit changes update, stage, iterate, storage, network, WebSocket, upload/download, or Shadow DOM behavior, inspect current source first.
14. Placement note
This version is suitable as the first placed version of
docs/spec/ai-directives.md.
Before calling it final, run it through an AI spec test round that covers:
all directive families
external bridges
storage flows
Shadow DOM bridge
stage and iterate edge cases
update path decisions
alias and do-not-promote rules
After that test round, update only the entries that failed or remained uncertain.