Repository navigation
Share reduced-motion variant rules in generate() output - #404
Draft
ameerf-wix wants to merge 11 commits into
Draft
ameerf-wix wants to merge 11 commits into
ameerf-wix wants to merge 11 commits into
Conversation
A cascading `reducedMotionHandling` field (`ignore` | `cancel` | `collapse` | effectId) on the config, interactions, sequences and effects. Each effect position yields variants under exclusive reserved prefers-reduced-motion media, which generate() emits and the runtime picks from, so the WAAPI and CSS paths match without adding effects to the config. `Interact.forceReducedMotion` now applies the reduced outcome, with a matching generate() option. Validation, docs and the design doc (docs/reduced-motion-design.md) included. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ation - reducedMotionHandling defaults to 'collapse'; collapse also takes finite iterations to one, and a sequence's stagger collapses unless it's ignored - forceReducedMotion can be set per instance via Interact.create() - handling is resolved from values, not the objects holding them; the time/scrub kind uses effectToAnimationOptions' discriminator - replacement body fields are typed against the effect types; runtime fallback warnings are dropped (the validator reports them) - CSS variants fall back only the entries assigned before their effect; an instant entrance is detected from its own duration - keyframe naming stays where it was in resolveEffectForCSS - validate: reduced-motion checks run inside the existing walks, replacement kinds come from the effect schemas, sequence definitions are reported per reference instead of deduplicated, shared helpers and modes are reused Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nal iterations - reducedMotionHandling is no longer a config field: Interact.setup() sets the default for every instance, Interact.create() options override it per instance, and generate() takes it as an option defaulting to setup()'s - forceReducedMotion is set through Interact.setup() too - collapse keeps the fraction of fractional iterations and flips `reversed` when the last alternate iteration runs backwards, so the collapsed effect ends where the full one does - the validator rejects the field on the config root and assumes the default instance handling Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…gated ones Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Generated
|
…-and-design # Conflicts: # CHANGELOG.md # packages/interact/src/core/Interact.ts # packages/interact/src/core/add.ts
- reducedMotionHandling / ReducedMotionHandling are now reducedMotionPolicy / ReducedMotionPolicy everywhere, docs included - the validator's reduced-motion checks run last in each walk batch - BODY_FIELDS is a plain array again - the resolver's option and FullEffect types live in types/css.ts - keyframe naming is back before the CSS-rules check, with resolveBody at module level Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-dedupe # Conflicts: # CHANGELOG.md # docs/reduced-motion-design.md # packages/interact/docs/api/types.md # packages/interact/rules/full-lean.md
…-and-design # Conflicts: # CHANGELOG.md
This branch has not been deployed
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.
Stacked on #400. With
collapseas the default,generate()emitted every effect twice under exclusiveprefers-reduced-motionmedia. This removes most of that duplication without changing the cascade.mergeVariantRulesincore/css.ts):reducewith only the declarations that differ. A list entry it doesn't write is reset toinitial, its@propertyfallback.prefers-reduced-motionsupport now get the full effect, instead of matching neither gate.printRules,generate()output only):_generate()'scssRulesare unchanged.Size: the website's
generate()configs go from 20.6 KB to 12.8 KB raw (−38%), and from 1057 B to 993 B with brotli.Verification: I diffed computed styles in Chromium / Firefox / WebKit for 1728 states:
data-interact-entertoggled.🤖 Generated with Claude Code