feat(html): animation dialect (anim attribute)#34
Merged
Conversation
Animations are now expressible in HTML — the dialect's biggest gap:
- JSON form: anim='[{"name":"fade_in_up","delay":0.3}]' (object
auto-wrapped), inserted into style.animation
- compact DSL: anim="fade-in-up delay:0.3 duration:0.8; pulse
loop:true" — ;-separated effects, kebab->snake on names and keys,
numbers/bools coerced
- malformed input (empty effect, pair without ':', missing preset
name, bad JSON) is an explicit transpile error; unknown preset names
are rejected downstream by the typed deserialization made blocking
in #33, with a readable unknown-variant message
- anim is consumed on rm-* elements (never leaked as component field)
and survives the studio round-trip (set_inline_style/set_text_content)
18 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #19.
Goal: declare animations in HTML — the biggest authoring barrier of the dialect, which forced a JSON round-trip for any entrance.
Two frozen forms, on any scene element (HTML tags and
rm-*):anim='[{"name":"fade_in_up","delay":0.3}]'(single object auto-wrapped) →style.animationverbatimanim="fade-in-up delay:0.3 duration:0.8; pulse delay:2 loop:true"—;-separated effects,name key:value…, kebab→snake on names and keys, numbers/bools coercedMalformed DSL/JSON → dedicated transpile errors (
InvalidAnimDsl/InvalidAnimJson), including the forgot-the-preset-name case (anim="delay:0.3"). Unknown preset names are deliberately not validated in the transpiler (no schema dependency): the typedAnimationEffectdeserialization — blocking since #33 — rejects them atvalidatewithunknown variant 'not_a_preset', expected one of 'fade_in', ….Tests: 15 new (TDD): both forms, multi-effect DSL, case conversions, five malformed-input errors, style coexistence, rm-* non-leakage, studio round-trip preservation, and the CLI-level unknown-preset blocking error.
showcase.htmlnow exercises DSL entrances, a staggered card (composing with #31), and a JSON-form continuous pulse — validates green end-to-end.Verify:
cargo test --workspace→ 174 passed ✓ ·cargo fmt --check✓ · clippy 0 warnings ✓ ·rustmotion validateon showcase + manual DSL sample ✓