You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .agents/skills/jaws/SKILL.md
+6-3Lines changed: 6 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -79,6 +79,7 @@ These are the two usual building blocks for widget handlers passed to `$.Button`
79
79
## Template-dot and tag rules
80
80
81
81
-`ui.Template` expands `Dot` into tags via `tag.TagExpand` (package `github.com/linkdata/jaws/lib/tag`, imported as `tag`); the root dot is part of identity/tag behavior.
82
+
-`ui.Template` is for partial templates only; full document/page templates should be rendered through `ui.Handler`.
82
83
- Prefer comparable root dots (pointers or small comparable structs).
83
84
- If root dot is non-comparable, implement `JawsGetTag(tag.Context) any` and return a comparable tag.
84
85
- Do not use plain `string`, numeric, `bool`, `template.HTML`, or `template.HTMLAttr` as tags; `tag.TagExpand` rejects them.
@@ -94,7 +95,8 @@ JaWS parses template params as:
94
95
Implications:
95
96
- Non-comparable handlers are not auto-tagged unless they implement `tag.TagGetter`.
96
97
- Pass explicit tags when dirty targeting depends on them.
97
-
- Include wrapper markup attributes via `{{$.Attrs}}`.
98
+
- HTML attributes passed to `$.Template(...)` are applied to the generated template wrapper.
99
+
- Template bodies used with `$.Template(...)` must be partials, not full documents.
98
100
- For dynamic button text, avoid passing plain static strings if the value must change after render; use getter-based values so updates reflect new state.
99
101
100
102
## Event handling model
@@ -110,13 +112,14 @@ The handler candidate is asked via `JawsClick` / `JawsContextMenu` / `JawsInput`
110
112
For clickable content rendering:
111
113
- Prefer a template dot with `JawsClick` over passing redundant explicit click handlers.
112
114
- Use explicit click handler params only when dot-owned handling is not viable.
113
-
-Wrapper template root should include `id="{{$.Jid}}" {{$.Attrs}}`.
114
-
- Add interaction semantics where needed, for example `role="button"tabindex="0"`.
115
+
-`ui.Template` creates the outer JaWS wrapper; template roots should not declare the JaWS ID or carry forwarded wrapper attributes.
116
+
- Add interaction semantics where needed through Template params, for example `role="button"` and `tabindex="0"`.
115
117
- Keep body partials presentational; attach behavior at wrapper/dot level.
116
118
117
119
## Rendering and update rules
118
120
119
121
- Keep HTML structure in templates; avoid manual HTML string assembly in Go.
122
+
-`ui.Template.JawsUpdate` re-renders the template data into the generated wrapper; custom `Dot.JawsUpdate` methods are not called by Template.
120
123
- HTML getter paths must not mutate domain state, but they may call element update methods (`SetClass`, `RemoveClass`, `SetAttr`, `RemoveAttr`, etc.) on the passed-in `*Element` to co-ordinate wrapper class/attribute changes with the inner-HTML refresh. No custom `JawsUpdate` is needed for that case — the queued wrapper updates flush alongside the `SetInner` from `HTMLInner.JawsUpdate`.
121
124
- Use a custom `JawsUpdate` only when the widget's update logic diverges from "render the getter again" — e.g. to compare against a stored last-value and skip the update (as the input widgets do).
122
125
-`Element.SetAttr/RemoveAttr/SetClass/RemoveClass/SetInner/SetValue/Append/Order/Remove/Replace` are update-time operations; call them only from render/update processing.
0 commit comments