Claude-skill-registry jsgui3-ssr-activation-data-bridge
Understand and debug how jsgui3 SSR markup becomes activated client-side, including persisted fields (data-jsgui-fields) and ctrl_fields (data-jsgui-ctrl-fields), and where to patch/plugin.
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/jsgui3-ssr-activation-data-bridge" ~/.claude/skills/majiayu000-claude-skill-registry-jsgui3-ssr-activation-data-bridge && rm -rf "$T"
manifest:
skills/data/jsgui3-ssr-activation-data-bridge/SKILL.mdsource content
jsgui3 SSR → Activation Data Bridge
Scope
- Explain the real runtime path from server-rendered HTML → client reconstruction (
) → event binding (pre_activate
).activate - Use the built-in DOM-attribute “data bridge”:
→ persisted fields hydration (data-jsgui-fields
)_persisted_fields
→ named child control wiring (data-jsgui-ctrl-fields
,this.status
, …)this.btn
- Identify high-leverage patch points (plugins / monkeypatch wrappers) for:
- noisy console warnings
- missing
registrationscontext.map_Controls - text-node alignment issues (
)&&& no corresponding control
Non-goals:
- Rewriting the bundler/publisher.
- Large refactors of upstream
packages without a minimal repro + regression guard.jsgui3-*
Inputs
- Which surface is failing?
- “SSR renders but clicks don’t work”
- “Persisted fields didn’t hydrate”
- “ctrl_fields not bound”
- “Missing context.map_Controls …” warnings
- The minimal repro (prefer an existing lab experiment).
Procedure
- Start from a lab repro (preferred)
- Use experiment 020 as the known-good baseline:
node src/ui/lab/experiments/020-jsgui3-server-activation/check.js
- Confirm SSR emits the bridge attributes
- In SSR HTML, find:
(identity)data-jsgui-id
(constructor key; may be absent for exempt tags)data-jsgui-type
(persisted fields payload)data-jsgui-fields
(named child ids payload)data-jsgui-ctrl-fields
- Understand activation sequence (client)
- Browser boot (from
) does:jsgui3-client- create
Client_Page_Context - update standard controls
(reconstruct controls from DOM)pre_activate(context)
(callactivate(context)
depth-first)ctrl.activate()
- create
- Persisted fields hydration (data-jsgui-fields)
- During control construction,
readsjsgui3-html
from the DOM element and stores it asdata-jsgui-fields
._persisted_fields - Controls typically consume
in_persisted_fields
to restore state.activate()
- ctrl_fields hydration (data-jsgui-ctrl-fields)
- During
,pre_activate_content_controls
parsesjsgui3-html
(key→id) and binds:data-jsgui-ctrl-fieldsthis[key] = context.map_controls[id]
- This enables patterns like
orthis.btn.on('click', ...)
.this.status.dom.el.textContent = ...
- Interpret the common warnings
-
Missing context.map_Controls for type <X>- Means SSR (or DOM) said the element is type
, but the client context doesn’t have a constructor registered at<X>
.context.map_Controls[X] - Client falls back to generic
, so activation may still work (but you lose the intended class).Control
- Means SSR (or DOM) said the element is type
-
Missing context.map_Controls for type undefined- Often corresponds to tags where
is intentionally not emitted (notablydata-jsgui-type
in upstream control-core).html/head/body - This is usually log noise unless it breaks reconstruction.
- Often corresponds to tags where
-
&&& no corresponding control- Emitted during pre-activation content linking when the DOM contains text nodes (often whitespace/newlines) that don’t correspond to a control entry in
.content._arr - Often benign, but it is a good signal that DOM↔control-array alignment is fragile.
- Emitted during pre-activation content linking when the DOM contains text nodes (often whitespace/newlines) that don’t correspond to a control entry in
Patch / plugin strategies
Strategy A: Silence known-noise logs (safe)
- Wrap/monkeypatch the client-side
logger to skip warning output for exempt tag names (pre_activate
,HTML
,HEAD
) when type is missing.BODY
Strategy B: Fill context.map_Controls
for common tags (safe)
context.map_Controls- Ensure common typed tags are registered (or mapped) so
,style
, etc. don’t warn.main - Prefer adding registrations in a single place near client startup rather than scattered per-control.
Strategy C: Make pre_activate_content_controls
robust to whitespace text nodes (medium risk)
pre_activate_content_controls- Ignore text nodes where
andnodeType === 3
during the alignment walk.nodeValue.trim() === '' - Keep a deterministic repro (experiment 020) and add a regression assertion on console output if/when you implement this.
Validation
- Primary:
node src/ui/lab/experiments/020-jsgui3-server-activation/check.js - If you modify client-side controls/bundles:
npm run ui:client-build
References
- Experiment repro:
src/ui/lab/experiments/020-jsgui3-server-activation/ - Guide:
(Client-Side Activation Flow)docs/guides/JSGUI3_UI_ARCHITECTURE_GUIDE.md - Upstream runtime (read-only reference in installed packages):
node_modules/jsgui3-client/client.jsnode_modules/jsgui3-html/html-core/html-core.jsnode_modules/jsgui3-html/html-core/control-enh.jsnode_modules/jsgui3-html/html-core/control-core.js