Skip to content

feat(motion-presets): export param schemas for presets (without the #330 refactor) - #340

Open
ameerf-wix wants to merge 5 commits into
masterfrom
named-effects-schema-only
Open

ameerf-wix wants to merge 5 commits into
masterfrom
named-effects-schema-only

Conversation

@ameerf-wix

@ameerf-wix ameerf-wix commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Description

Takes the per-preset schema exports out of #330 so a version of #331 (validating namedEffect params against the registered effect's schema) can merge without the big base-presets refactor. Type: feature with breaking param changes.

What's included

Making every accepted param take effect (second commit)

  • Lengths and angles: every length param accepts calc(). GlideIn/ExpandIn from accepts rad/grad/turn/calc() angles and computes those through CSS cos()/sin(). Plain values produce the same output as before.
  • Cross: it now moves toward its direction. Its keyframes used to be frozen before the element was measured. The wrap offsets for three of the diagonals are also fixed.
  • StretchScroll: the CSS fade now matches WAAPI.
  • PanScroll: prepare measures when startFromOffScreen is left at its default.
  • SpinIn: the fade lasts at most the animation's duration.
  • Keyframe names: two effects share a name only when their keyframes are identical. Before, they could collide:
    • BounceIn, Bounce, Poke: the travel unit was written into the keyframes. It is now a custom property.
    • Fold: angle/perspective were written into the keyframes. They are now custom properties.
    • ParallaxScroll: the center ratio was written into the keyframes. It is now a custom property.
    • Breathe, Swing, Fold: the keyframe shape is now chosen from the same rounded timing factor the name uses.
    • ShuttersScroll: names now include the range, plus -staggered for continuous.
    • GlideIn, ShuttersIn: their step-start fades are now motion-fadeInStep.
    • A new test samples every preset's params and fails if a name maps to different keyframes. var() fallbacks are ignored, since every animation declares its properties.
  • suffix: custom properties now carry the suffix too (as in refactor(motion-presets): consolidate entrance, scroll and ongoing presets on shared base presets with schemas #330), so keyframe-slotted effects on one element don't override each other. A contract test checks that every declared property is suffixed and every var() used is declared. The only exceptions are --motion-rotate and the measured --motion-left.
  • ShuttersIn/ShuttersScroll: the shutter count is rounded and clamped to a positive integer; non-integer counts used to loop forever. feat(interact-validate): validate namedEffect params against their registered schema #331 doesn't check int yet.
  • CurveIn: the vertical curve (from: 'top'/'bottom') is covered by tests. On master, pseudoLeft/pseudoRight were lowercased by the parser and never matched.

Exact amounts, parallax speed and loop delays (third commit)

Defaults

With no params, every preset produces master's output, with these exceptions:

Equivalence was checked by comparing old and new style/web output, at defaults and with converted non-default values.

Remaining differences from #330

Breaking changes

#330's param renames, for example direction → from on entrance presets, intensity → explicit amounts on ongoing presets, and parallaxFactor → speed. The full list is in the updated rules/presets/*.

Tests

  • src/test/presets.spec.ts: refactor(motion-presets): consolidate entrance, scroll and ongoing presets on shared base presets with schemas #330's generic contract test (implicit defaults equal explicit schema defaults, getNames matches the animation names, web and style agree, schema defaults are valid). Presets without style, such as Cross, are rendered with web. Mouse presets get the defaults and validity checks.
  • Preset specs: test inputs were converted to the new params, so master's expected outputs still hold, except for the default changes and Fold/SkewPanScroll above. Suffix tests were added.
  • motion-presets: 3041 tests pass; motion: 344 (adds persist tests). All package test suites, the build, eslint and prettier pass. The tsc -p tsconfig.json errors in WinkIn.spec.ts already exist on master.

Checklist

  • I have read the Contributing Guide
  • I have added/updated tests for my changes (if applicable)
  • I have updated documentation/rules/skills (if applicable)

Additional Notes

🤖 Generated with Claude Code

ameerf-wix and others added 3 commits October 20, 2026 02:04
Port the per-preset `schema` exports from #330 onto the current preset
implementations, without the base-presets refactor:

- entrance, scroll and ongoing presets export #330's schemas and accept
  its param names; defaults are read from the schema
- mouse presets export schemas for their current params (also attached
  to the create function, which is what gets registered)
- getNames appends `options.suffix` to every keyframe name
- generic contract test: implicit defaults equal schema defaults
- docs/rules/skill references updated to the new param names

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- calc() lengths for every length param and rad/grad/turn/calc() angles
  for GlideIn/ExpandIn `from` (CSS cos()/sin() path)
- Cross moves toward its direction (keyframes were frozen before measuring)
- StretchScroll CSS fade matches WAAPI; PanScroll prepare measures by default
- SpinIn fade capped at the animation duration
- keyframe names collide only when keyframes are identical: units and
  per-param values moved into custom properties, timing-based shapes keyed
  on the rounded timing factor, ShuttersScroll names per range/stagger,
  step-start fades renamed to motion-fadeInStep
- custom properties carry the suffix, so keyframe slots don't override
  each other
- shutter count clamped to a positive integer (non-integers looped forever)
- CurveIn vertical curves (top/bottom) covered by tests

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…elays

- ongoing amounts are the peaks the keyframes reach (Pulse, Rubber,
  Wiggle, Bounce, Poke, Jello), as in #330
- iterationDelay holds at rest after an unchanged motion (holdAtRest)
- getScrollParallax: visual speed relative to the scroll for GrowScroll,
  ShrinkScroll, Spin3dScroll, TiltScroll and ParallaxScroll (speed/center),
  by translating and widening the scroll range
- Cross supports CSS (style + prepare); Pulse keeps the layout rotation;
  Spin no longer rotates rotated elements twice; Swing's CSS easings are
  real values
- keyframe names include the easing where keyframes use it
- motion: persist the animations of layered effects so finished layers
  are not auto-removed
- remove the unused transitionDelay option everywhere

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Generated llms.txt preview

llms.txt
# @wix/interact

> Declarative, configuration-driven interaction library — web-native, AI-ready, and framework-agnostic.

- Install: `npm install @wix/interact @wix/motion-presets`
- Three entry points: vanilla JS (`@wix/interact`), React (`@wix/interact/react`), Web Components (`@wix/interact/web`)
- Five trigger types: hover, click, viewEnter, viewProgress, pointerMove
- Effects via named presets (`@wix/motion-presets`), keyframes, CSS transitions, or custom JS callbacks
- Configs are JSON-serializable -- designed for LLM generation

## Docs

- [Full Reference](https://wix.github.io/interact/rules/full-lean.md): Declarative configuration-driven interaction library. Binds animations to triggers via JSON config. (788 lines)
- [Integration Guide](https://wix.github.io/interact/rules/integration.md): Rules for integrating `@wix/interact` into a webpage — binding animations and effects to user-driven triggers via declarative configuration. (364 lines)
- [Validation Guide](https://wix.github.io/interact/rules/validate.md): Rules for using `@wix/interact-validate` — validate an `InteractConfig` before it reaches the runtime. (315 lines)

## Optional

- [Click Trigger Rules for @wix/interact](https://wix.github.io/interact/rules/click.md): This document contains rules for generating click-triggered interactions in `@wix/interact`. (197 lines)
- [Hover Trigger Rules for @wix/interact](https://wix.github.io/interact/rules/hover.md): This document contains rules for generating hover-triggered interactions in `@wix/interact`. (199 lines)
- [PointerMove Trigger Rules for @wix/interact](https://wix.github.io/interact/rules/pointermove.md): These rules help generate pointer-driven interactions using `@wix/interact`. (271 lines)
- [ViewEnter Trigger Rules for @wix/interact](https://wix.github.io/interact/rules/viewenter.md): This document contains rules for generating interactions that respond to elements entering the viewport using the `@wix/interact`. (232 lines)
- [ViewProgress Trigger Rules for @wix/interact](https://wix.github.io/interact/rules/viewprogress.md): These rules help generate scroll-driven interactions using `@wix/interact`. (233 lines)
- [@wix/interact Plugin Rules](https://wix.github.io/interact/rules/plugins.md): Rules for extending `@wix/interact` with external plugins via `Interact.use()` and `$`-prefixed config fields. (122 lines)
- [All rules in one file](https://wix.github.io/interact/llms-full.txt): Complete concatenation (2721 lines)
llms-full.txt header
# @wix/interact v2.5.19 -- AI Rules Reference
# https://wix.github.io/interact/llms.txt
# 9 files, 2721 lines

Download full files from workflow artifacts, or run node scripts/generate-llms.mjs locally.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant