@wix/interact 2.0.0-rc.7 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -82,7 +82,7 @@ const config: InteractConfig = {
82
82
 
83
83
  ### Selector vs ListContainer
84
84
 
85
- - **`selector`**: Selects a single element using CSS selector
85
+ - **`selector`**: Selects all matching elements using CSS selector (`querySelectorAll`)
86
86
  - **`listContainer`**: Selects a container for targeting its child elements for list-based interactions
87
87
  - **Combined**: Use both to select elements within list items
88
88
 
@@ -90,14 +90,14 @@ const config: InteractConfig = {
90
90
  // Using selector with listContainer
91
91
  {
92
92
  key: 'product-grid',
93
- listContainer: '.product-item', // Each product item
94
- selector: '.product-image', // Image within each item
93
+ listContainer: '.products', // Container holding all product items
94
+ selector: '.product-image', // querySelectorAll finds all images as list items
95
95
  trigger: 'hover',
96
96
  effects: [
97
97
  {
98
98
  key: 'product-grid',
99
- listContainer: '.product-item',
100
- selector: '.product-overlay', // Overlay within each item
99
+ listContainer: '.products',
100
+ selector: '.product-overlay', // querySelectorAll finds all overlays as list items
101
101
  namedEffect: {
102
102
  type: 'FadeIn'
103
103
  },
@@ -676,14 +676,14 @@ const galleryConfig: InteractConfig = {
676
676
  // Gallery items with list container and selector
677
677
  {
678
678
  key: 'image-gallery',
679
- listContainer: '.gallery-grid', // Container with multiple items
680
- selector: '.gallery-item img', // Image within each item
679
+ listContainer: '.gallery-grid', // Container holding all gallery items
680
+ selector: '.gallery-item img', // querySelectorAll finds all matching images as list items
681
681
  trigger: 'hover',
682
682
  effects: [
683
683
  {
684
684
  key: 'image-gallery',
685
685
  listContainer: '.gallery-grid',
686
- selector: '.gallery-item .overlay', // Overlay within each item
686
+ selector: '.gallery-item .overlay', // querySelectorAll finds all matching overlays as list items
687
687
  effectId: 'image-overlay',
688
688
  },
689
689
  ],
@@ -108,8 +108,8 @@ Scrub effects are progress-based animations that respond to scroll position or p
108
108
  },
109
109
  // No duration - controlled by scroll/pointer progress
110
110
  easing: 'linear',
111
- rangeStart: { name: 'cover', offset: { type: 'percentage', value: 0 } },
112
- rangeEnd: { name: 'cover', offset: { type: 'percentage', value: 100 } }
111
+ rangeStart: { name: 'cover', offset: { unit: 'percentage', value: 0 } },
112
+ rangeEnd: { name: 'cover', offset: { unit: 'percentage', value: 100 } }
113
113
  }
114
114
  ```
115
115
 
@@ -127,8 +127,8 @@ Control when the animation starts and stops:
127
127
  { opacity: '0' }
128
128
  ]
129
129
  },
130
- rangeStart: { name: 'cover', offset: { type: 'percentage', value: 30 } }, // Start at 30% scroll
131
- rangeEnd: { name: 'cover', offset: { type: 'percentage', value: 80 } } // End at 80% scroll
130
+ rangeStart: { name: 'cover', offset: { unit: 'percentage', value: 30 } }, // Start at 30% scroll
131
+ rangeEnd: { name: 'cover', offset: { unit: 'percentage', value: 80 } } // End at 80% scroll
132
132
  }
133
133
  ```
134
134
 
@@ -153,8 +153,8 @@ TBD
153
153
  { transform: 'translateY(-150px)' }
154
154
  ]
155
155
  },
156
- rangeStart: { name: 'cover', offset: { type: 'percentage', value: 0 } },
157
- rangeEnd: { name: 'cover', offset: { type: 'percentage', value: 100 } }
156
+ rangeStart: { name: 'cover', offset: { unit: 'percentage', value: 0 } },
157
+ rangeEnd: { name: 'cover', offset: { unit: 'percentage', value: 100 } }
158
158
  },
159
159
  // Text fades out faster
160
160
  {
@@ -166,8 +166,8 @@ TBD
166
166
  { opacity: '0', transform: 'translateY(-50px)' }
167
167
  ]
168
168
  },
169
- rangeStart: { name: 'cover', offset: { type: 'percentage', value: 20 } },
170
- rangeEnd: { name: 'cover', offset: { type: 'percentage', value: 60 } }
169
+ rangeStart: { name: 'cover', offset: { unit: 'percentage', value: 20 } },
170
+ rangeEnd: { name: 'cover', offset: { unit: 'percentage', value: 60 } }
171
171
  }
172
172
  ]
173
173
  }
@@ -450,7 +450,7 @@ Avoid animating:
450
450
  ### Named Effects vs Keyframes
451
451
 
452
452
  ```typescript
453
- // Preferred - optimized by @wix/motion
453
+ // Preferred - optimized; from @wix/motion-presets
454
454
  {
455
455
  namedEffect: {
456
456
  type: 'FadeIn'
@@ -302,6 +302,7 @@ The `viewEnter` trigger uses Intersection Observer to detect when elements enter
302
302
  - **`once`** (recommended): Triggers only when element first enters viewport
303
303
  - **`repeat`**: Triggers every time element enters viewport
304
304
  - **`alternate`**: Plays forward on enter, reverses on exit
305
+ - **`state`**: Plays on enter, pauses on exit
305
306
 
306
307
  ### Real-World Example: Staggered Card Animation
307
308
 
@@ -393,8 +394,8 @@ The `viewProgress` trigger creates scroll-driven animations as elements move thr
393
394
  { filter: 'grayscale(100%)' }
394
395
  ]
395
396
  },
396
- rangeStart: { name: 'exit', offset: { type: 'percentage', value: 0 } },
397
- rangeEnd: { name: 'exit', offset: { type: 'percentage', value: 100 } }
397
+ rangeStart: { name: 'exit', offset: { unit: 'percentage', value: 0 } },
398
+ rangeEnd: { name: 'exit', offset: { unit: 'percentage', value: 100 } }
398
399
  },
399
400
  {
400
401
  key: 'foreground-text',
@@ -405,8 +406,8 @@ The `viewProgress` trigger creates scroll-driven animations as elements move thr
405
406
  { opacity: '0', transform: 'scale(0.8)' }
406
407
  ]
407
408
  },
408
- rangeStart: { name: 'exit', offset: { type: 'percentage', value: 0 } },
409
- rangeEnd: { name: 'exit', offset: { type: 'percentage', value: 100 } }
409
+ rangeStart: { name: 'exit', offset: { unit: 'percentage', value: 0 } },
410
+ rangeEnd: { name: 'exit', offset: { unit: 'percentage', value: 100 } }
410
411
  }
411
412
  ]
412
413
  }
@@ -428,14 +429,14 @@ The `viewProgress` trigger creates scroll-driven animations as elements move thr
428
429
  { transform: 'scaleX(1)' }
429
430
  ]
430
431
  },
431
- rangeStart: { name: 'cover', offset: { type: 'percentage', value: 0 } },
432
- rangeEnd: { name: 'cover', offset: { type: 'percentage', value: 100 } }
432
+ rangeStart: { name: 'cover', offset: { unit: 'percentage', value: 0 } },
433
+ rangeEnd: { name: 'cover', offset: { unit: 'percentage', value: 100 } }
433
434
  }
434
435
  ]
435
436
  }
436
437
  ```
437
438
 
438
- ## 8. PointerMove Trigger
439
+ ## 7. PointerMove Trigger
439
440
 
440
441
  The `pointerMove` trigger creates mouse-following effects and 3D interactions.
441
442
 
@@ -467,7 +468,8 @@ The `pointerMove` trigger creates mouse-following effects and 3D interactions.
467
468
  key: 'card-section',
468
469
  trigger: 'pointerMove',
469
470
  params: {
470
- hitArea: 'self' // 'self' | 'root'
471
+ hitArea: 'self', // 'self' | 'root'
472
+ axis: 'y' // 'x' | 'y' – scrub axis (default 'y')
471
473
  },
472
474
  effects: [
473
475
  {
@@ -508,7 +510,7 @@ The `pointerMove` trigger creates mouse-following effects and 3D interactions.
508
510
  }
509
511
  ```
510
512
 
511
- ## 9. AnimationEnd Trigger
513
+ ## 8. AnimationEnd Trigger
512
514
 
513
515
  The `animationEnd` trigger allows you to chain animations by waiting for a previous animation to complete.
514
516
 
@@ -64,13 +64,14 @@ The `Interaction` component is a wrapper that automatically manages interaction
64
64
 
65
65
  ### Props
66
66
 
67
- | Prop | Type | Required | Description |
68
- | ------------- | ----------------------------- | -------- | ---------------------------------------------------------------- |
69
- | `tagName` | `keyof JSX.IntrinsicElements` | Yes | The HTML element to render (e.g., `'div'`, `'button'`, `'span'`) |
70
- | `interactKey` | `string` | Yes | Unique identifier matching the interaction configuration |
71
- | `children` | `React.ReactNode` | No | Child elements to render |
72
- | `ref` | `React.Ref<any>` | No | Forwarded ref to the underlying DOM element |
73
- | `...rest` | `JSX.IntrinsicElements[T]` | No | Any valid props for the specified `tagName` |
67
+ | Prop | Type | Required | Description |
68
+ | ------------- | ----------------------------- | -------- | --------------------------------------------------------------------------------------------- |
69
+ | `tagName` | `keyof JSX.IntrinsicElements` | Yes | The HTML element to render (e.g., `'div'`, `'button'`, `'span'`) |
70
+ | `interactKey` | `string` | Yes | Unique identifier matching the interaction configuration |
71
+ | `initial` | `boolean` | No | When `true`, sets `data-interact-initial="true"` for FOUC prevention with entrance animations |
72
+ | `children` | `React.ReactNode` | No | Child elements to render |
73
+ | `ref` | `React.Ref<any>` | No | Forwarded ref to the underlying DOM element |
74
+ | `...rest` | `JSX.IntrinsicElements[T]` | No | Any valid props for the specified `tagName` |
74
75
 
75
76
  ### Basic Usage
76
77
 
@@ -385,12 +386,14 @@ import { Interact, Interaction, InteractConfig } from '@wix/interact/react';
385
386
  const config: InteractConfig = {
386
387
  effects: {
387
388
  expanded: {
388
- transitionEffect: {
389
- properties: ['max-height', 'padding'],
390
- from: { maxHeight: '0px', padding: '0' },
391
- to: { maxHeight: '200px', padding: '16px' },
389
+ transition: {
390
+ duration: 300,
391
+ easing: 'ease-out',
392
+ styleProperties: [
393
+ { name: 'max-height', value: '200px' },
394
+ { name: 'padding', value: '16px' },
395
+ ],
392
396
  },
393
- duration: 300,
394
397
  },
395
398
  },
396
399
  interactions: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/interact",
3
- "version": "2.0.0-rc.7",
3
+ "version": "2.0.0",
4
4
  "description": "A powerful, declarative interaction library for creating engaging web apps.",
5
5
  "license": "MIT",
6
6
  "main": "dist/cjs/index.js",
@@ -55,7 +55,7 @@
55
55
  "url": "https://github.com/wix-incubator/interact/issues"
56
56
  },
57
57
  "dependencies": {
58
- "@wix/motion": "^2.0.0-rc.3",
58
+ "@wix/motion": "^2.0.0",
59
59
  "fastdom": "^1.0.12",
60
60
  "fizban": "^0.7.2",
61
61
  "kuliso": "^0.4.13"
@@ -86,6 +86,5 @@
86
86
  "typescript": "^5.9.3",
87
87
  "vite": "^7.2.2",
88
88
  "vitest": "^4.0.14"
89
- },
90
- "stableVersion": "2.0.0-rc.6"
89
+ }
91
90
  }
package/rules/click.md CHANGED
@@ -119,14 +119,14 @@ These rules help generate click-based interactions using the `@wix/interact` lib
119
119
 
120
120
  ```typescript
121
121
  {
122
- source: '[SOURCE_IDENTIFIER]',
122
+ key: '[SOURCE_IDENTIFIER]',
123
123
  trigger: 'click',
124
124
  params: {
125
125
  type: 'state'
126
126
  },
127
127
  effects: [
128
128
  {
129
- target: '[TARGET_IDENTIFIER]',
129
+ key: '[TARGET_IDENTIFIER]',
130
130
  [EFFECT_TYPE]: [EFFECT_DEFINITION],
131
131
  fill: 'both',
132
132
  reversed: [INITIAL_REVERSED_BOOL],
@@ -309,7 +309,7 @@ These rules help generate click-based interactions using the `@wix/interact` lib
309
309
  key: '[SOURCE_IDENTIFIER]',
310
310
  trigger: 'click',
311
311
  params: {
312
- type: 'alternate'
312
+ method: 'toggle'
313
313
  },
314
314
  effects: [
315
315
  {
@@ -342,7 +342,7 @@ These rules help generate click-based interactions using the `@wix/interact` lib
342
342
  key: 'theme-switcher',
343
343
  trigger: 'click',
344
344
  params: {
345
- type: 'alternate'
345
+ method: 'toggle'
346
346
  },
347
347
  effects: [
348
348
  {
@@ -370,7 +370,7 @@ These rules help generate click-based interactions using the `@wix/interact` lib
370
370
  key: 'style-toggle',
371
371
  trigger: 'click',
372
372
  params: {
373
- type: 'alternate'
373
+ method: 'toggle'
374
374
  },
375
375
  effects: [
376
376
  {
@@ -397,7 +397,7 @@ These rules help generate click-based interactions using the `@wix/interact` lib
397
397
  key: 'interactive-card',
398
398
  trigger: 'click',
399
399
  params: {
400
- type: 'alternate'
400
+ method: 'toggle'
401
401
  },
402
402
  effects: [
403
403
  {
@@ -34,7 +34,7 @@ Interact.create(config);
34
34
 
35
35
  ```html
36
36
  <script type="module">
37
- import { Interact } from 'https://esm.sh/@wix/interact@2.0.0-rc.4';
37
+ import { Interact } from 'https://esm.sh/@wix/interact';
38
38
 
39
39
  const config = {
40
40
  // config-props
@@ -48,7 +48,7 @@ Interact.create(config);
48
48
 
49
49
  - Use `generate(config)` to create critical CSS that hides elements until their `viewEnter` entrance animation plays.
50
50
  - Add `data-interact-initial="true"` to the `<interact-element>` that should have its first child hidden initially.
51
- - Only use `data-interact-initial="true"` for `<interact-element>` with `viewEnter` trigger.
51
+ - Only use `data-interact-initial="true"` for `<interact-element>` with `viewEnter` trigger and `type: 'once'`, where the source and target elements are the same.
52
52
  - Do NOT use for `hover` or `click` interactions.
53
53
 
54
54
  **Usage:**
@@ -115,9 +115,10 @@ This configuration declares what user/system triggers occur on which source elem
115
115
  - **Purpose**: Named predicates that gate interactions/effects by runtime context.
116
116
  - **Key (string)**: The condition id. MUST be unique across the registry.
117
117
  - **Value (Condition)**:
118
- - **type**: `'media' | 'container'`
118
+ - **type**: `'media' | 'container' | 'selector'`
119
119
  - `'media'`: The predicate MUST be a valid CSS media query expression without the outer `@media` keyword (e.g., `'(min-width: 768px)'`).
120
120
  - `'container'`: The predicate SHOULD be a valid CSS container query condition string relative to the relevant container context.
121
+ - `'selector'`: The predicate is a CSS selector pattern. If it contains `&`, the `&` is replaced with the base element selector; otherwise the predicate is appended to the base selector. Used for conditional styling (e.g., `:nth-of-type(odd)`, `.active`).
121
122
  - **predicate?**: OPTIONAL textual predicate for the given type. If omitted, the condition is treated as always-true (i.e., a no-op guard).
122
123
 
123
124
  - **interactions: Interaction[]**
@@ -131,13 +132,13 @@ This configuration declares what user/system triggers occur on which source elem
131
132
  - OPTIONAL. A CSS selector used to select items within `listContainer`.
132
133
  - **trigger: TriggerType**
133
134
  - REQUIRED. One of:
134
- - `'hover' | 'click'`: Pointer interactions.
135
+ - `'hover' | 'click' | 'activate' | 'interest'`: Pointer interactions (`activate` = click with keyboard Space/Enter; `interest` = hover with focus).
135
136
  - `'viewEnter' | 'pageVisible' | 'viewProgress'`: Viewport visibility/progress triggers.
136
137
  - `'animationEnd'`: Fires when a specific effect completes on the source element.
137
138
  - `'pointerMove'`: Continuous pointer motion over an area.
138
139
  - **params?: TriggerParams**
139
140
  - OPTIONAL. Parameter object that MUST match the trigger:
140
- - hover/click: `StateParams | PointerTriggerParams`
141
+ - hover/click/activate/interest: `StateParams | PointerTriggerParams` (activate uses same params as click; interest uses same params as hover).
141
142
  - `StateParams.method`: `'add' | 'remove' | 'toggle' | 'clear'`
142
143
  - `PointerTriggerParams.type?`: `'once' | 'repeat' | 'alternate' | 'state'`
143
144
  - Usage:
@@ -153,13 +154,14 @@ This configuration declares what user/system triggers occur on which source elem
153
154
  - `'once'`: Play once and remove the listener (hover attaches only the enter listener; no leave).
154
155
  - `'state'`: Hover — play on enter if idle/paused, pause on leave if running. Click — toggle play/pause on successive clicks until finished.
155
156
  - viewEnter/pageVisible/viewProgress: `ViewEnterParams`
156
- - `type?`: `'once' | 'repeat' | 'alternate'`
157
+ - `type?`: `'once' | 'repeat' | 'alternate' | 'state'`
157
158
  - `threshold?`: number in [0,1] describing intersection threshold
158
159
  - `inset?`: string CSS-style inset for rootMargin/observer geometry
159
160
  - Usage:
160
161
  - `'once'`: Play on first visibility and unobserve the element.
161
162
  - `'repeat'`: Play each time the element re‑enters visibility according to `threshold`/`inset`.
162
163
  - `'alternate'`: Triggers on re‑entries; if you need alternating direction, set it on the effect (e.g., `alternate: true`) rather than relying on the trigger.
164
+ - `'state'`: Play on entry, pause on exit (for looping/continuous animations).
163
165
  - `threshold`: Passed to `IntersectionObserver.threshold` — typical values are 0.1–0.6 for entrances.
164
166
  - `inset`: Applied as vertical `rootMargin` (`top/bottom`), e.g., `'-100px'` to trigger earlier/later; left/right remain 0.
165
167
  - Note: For `viewProgress`, `threshold` and `inset` are ignored; progress is driven by ViewTimeline/scroll scenes. Control the range via `ScrubEffect.rangeStart/rangeEnd` and `namedEffect.range`.
@@ -168,10 +170,11 @@ This configuration declares what user/system triggers occur on which source elem
168
170
  - Usage: Fire when the specified effect (by `effectId`) on the source element finishes, useful for chaining sequences.
169
171
  - pointerMove: `PointerMoveParams`
170
172
  - `hitArea?`: `'root' | 'self'` (default `'self'`)
173
+ - `axis?`: `'x' | 'y'` - when using `keyframeEffect` with `pointerMove`, selects which pointer coordinate maps to linear 0-1 progress; defaults to `'y'`. Ignored for `namedEffect` and `customEffect`.
171
174
  - Usage:
172
175
  - `'self'`: Track pointer within the source element’s bounds.
173
176
  - `'root'`: Track pointer anywhere in the viewport (document root).
174
- - Only use with `ScrubEffect` mouse presets (`namedEffect`) or `customEffect` that consumes pointer progress; avoid `keyframeEffect` with `pointerMove`.
177
+ - Only use with `ScrubEffect` mouse presets (`namedEffect`) or `customEffect` that consumes pointer progress; avoid `keyframeEffect` with `pointerMove` unless mapping a single axis via `axis`.
175
178
  - When using `customEffect` with `pointerMove`, the progress parameter is an object:
176
179
  - ```typescript
177
180
  type Progress = {
@@ -189,7 +192,9 @@ This configuration declares what user/system triggers occur on which source elem
189
192
  - **conditions?: string[]**
190
193
  - OPTIONAL. Array of condition ids that MUST all pass for this trigger to be active.
191
194
  - **selector?: string**
192
- - OPTIONAL. Additional CSS selector to refine the source element's descendants when attaching/observing the trigger (e.g., delegate a click to a child button).
195
+ - OPTIONAL. Additional CSS selector to refine element selection:
196
+ - Without `listContainer`: Uses `querySelectorAll` to match all elements within the root element as separate items.
197
+ - With `listContainer`: Uses `querySelectorAll` within the container to find matching elements as list items. For dynamically added list items, uses `querySelector` within each item to find a single matching element.
193
198
  - **effects: Array<Effect | EffectRef>**
194
199
  - REQUIRED. The effects to apply when the trigger fires. Ordering is significant: the first array entry is applied first. The system may reverse internal storage to preserve this application order.
195
200
 
@@ -309,7 +314,9 @@ The config remains the same for both integrations—only the HTML/JSX setup diff
309
314
  - **conditions?: string[]**
310
315
  - OPTIONAL. All conditions MUST pass for the effect to run (in addition to interaction conditions).
311
316
  - **selector?: string**
312
- - OPTIONAL. Additional CSS selector to refine the target element's descendants.
317
+ - OPTIONAL. Additional CSS selector to refine target element selection:
318
+ - Without `listContainer`: Uses `querySelectorAll` to match all elements within the target root as separate items.
319
+ - With `listContainer`: Uses `querySelectorAll` within the container to find matching elements as list items. For dynamically added list items, uses `querySelector` within each item to find a single matching element.
313
320
  - **effectId?: string**
314
321
  - For `EffectRef` this field is REQUIRED and MUST reference an entry in `effects`.
315
322
 
@@ -339,7 +346,7 @@ The config remains the same for both integrations—only the HTML/JSX setup diff
339
346
  - `delay?`: number (ms)
340
347
  - One of:
341
348
  - `keyframeEffect`: `{ name: string; keyframes: Keyframe[] }`
342
- - `namedEffect`: `NamedEffect` (from `@wix/motion`)
349
+ - `namedEffect`: `NamedEffect` (from `@wix/motion-presets`)
343
350
  - `customEffect`: `(element: Element, progress: any) => void`
344
351
 
345
352
  2. **ScrubEffect** (animation driven by scroll/progress)
@@ -387,15 +394,10 @@ The config remains the same for both integrations—only the HTML/JSX setup diff
387
394
 
388
395
  ### Authoring rules for animation payloads (`namedEffect`, `keyframeEffect`, `customEffect`):
389
396
 
390
- - **namedEffect (Preferred)**: Use first for best performance. These are pre-built presets from `@wix/motion` that are GPU-friendly and tuned.
391
- - Structure: `namedEffect: { type: '<PresetName>', /* optional preset options like direction (bottom|top|left|right), power ('soft'|'medium'|'hard'), etc. do not use those without having proper documentation of which options exist and of what types. */ }`
392
- - Short list of common preset names:
393
- - Entrance: `FadeIn`, `BounceIn`, `SlideIn`, `FlipIn`, `ArcIn`
394
- - Ongoing: `Pulse`, `Spin`, `Wiggle`, `Bounce`
395
- - Scroll: `ParallaxScroll`, `FadeScroll`, `RevealScroll`, `TiltScroll`
396
- - For scroll-effects used with the `viewProgress` trigger, the `namedEffect` options MUST include `range: 'in' | 'out' | 'continuous'`. Prefer `range: 'continuous'` for simplicity.
397
- - Mouse: For `pointerMove` (mouse-effects), prefer `namedEffect` presets (e.g., `TrackMouse`, `Tilt3DMouse`, `ScaleMouse`, `BlurMouse`); avoid `keyframeEffect` with `pointerMove` since progress is two‑dimensional.
398
- - Mouse: `TrackMouse`, `Tilt3DMouse`, `ScaleMouse`, `BlurMouse`
397
+ - **namedEffect (Preferred)**: Use first for best performance. These are pre-built presets from `@wix/motion-presets` that are GPU-friendly and tuned.
398
+ - Structure: `namedEffect: { type: '<PresetName>', /* optional preset options like direction (bottom|top|left|right), etc. do not use those without having proper documentation of which options exist and of what types. */ }`
399
+ - Short list of common preset names: - Entrance: `FadeIn`, `BounceIn`, `SlideIn`, `F
400
+ lipIn`, `ArcIn` - Ongoing: `Pulse`, `Spin`, `Wiggle`, `Bounce` - Scroll: `ParallaxScroll`, `FadeScroll`, `RevealScroll`, `TiltScroll` - For scroll-effects used with the `viewProgress` trigger, the `namedEffect` options MUST include `range: 'in' | 'out' | 'continuous'`. Prefer `range: 'continuous'` for simplicity. - Mouse: For `pointerMove` (mouse-effects), prefer `namedEffect` presets (e.g., `TrackMouse`, `Tilt3DMouse`, `ScaleMouse`, `BlurMouse`); avoid `keyframeEffect` with `pointerMove` since progress is two‑dimensional. - Mouse: `TrackMouse`, `Tilt3DMouse`, `ScaleMouse`, `BlurMouse`
399
401
  - **keyframeEffect (Default for custom animations)**: Prefer this when you need a custom-made animation.
400
402
  - Structure: `keyframeEffect: { name: string; keyframes: Keyframe[] }` (keyframes use standard CSS/WAAPI properties).
401
403
  - Not compatible with `pointerMove` (mouse-effects) because pointer progress is two‑dimensional; use `customEffect` for custom pointer‑driven animations.
package/rules/hover.md CHANGED
@@ -95,7 +95,7 @@ This document contains rules for generating hover trigger interactions in `@wix/
95
95
 
96
96
  ## Rule 2: Hover Enter/Leave Animations with Named Effects
97
97
 
98
- **Purpose**: Generate hover interactions using pre-built named effects from @wix/motion
98
+ **Purpose**: Generate hover interactions using pre-built named effects from @wix/motion-presets
99
99
 
100
100
  **Pattern**:
101
101
 
@@ -125,7 +125,7 @@ This document contains rules for generating hover trigger interactions in `@wix/
125
125
  **Variables**:
126
126
 
127
127
  - `[REVERSED_BOOL]`: Optional boolean value indicating whether the mouse enter animation is reversed (and mouse leave is forwards).
128
- - `[NAMED_EFFECT_TYPE]`: Name of the pre-built named effect from @wix/motion to use.
128
+ - `[NAMED_EFFECT_TYPE]`: Name of the pre-built named effect from @wix/motion-presets to use.
129
129
  - `[EFFECT_PROPERTIES]`: Named effect specific properties (distance, angle, perspective, etc.)
130
130
  - Other variables same as Rule 1
131
131
 
@@ -120,9 +120,10 @@ type InteractConfig = {
120
120
 
121
121
  ### Element Selection Hierarchy
122
122
 
123
- 1. **`listContainer`**: If present, selects a container to target its immediate children as list items.
124
- 2. **`selector`**: Matches elements within the root, or within each list item.
125
- 3. **Fallback**: If neither is provided, targets the **first child** of `<interact-element>` in `web` or the root element in `react`.
123
+ 1. **`listContainer` + `selector`**: If both are present, uses `querySelectorAll(selector)` within the container to find all matching elements as list items.
124
+ 2. **`listContainer` only**: If present without `selector`, targets the immediate children of the container as list items.
125
+ 3. **`selector` only**: If present without `listContainer`, matches all elements within the root element (using `querySelectorAll`).
126
+ 4. **Fallback**: If neither is provided, targets the **first child** of `<interact-element>` in `web` or the root element in `react`.
126
127
 
127
128
  ## 4. Generating Critical CSS for Entrance Animations
128
129
 
@@ -168,20 +169,22 @@ const html = `
168
169
 
169
170
  **When to Use:**
170
171
 
171
- - For elements with an entrance efffect that is triggered a with `viewEnter`
172
+ - For elements with an entrance effect that is triggered with `viewEnter`
172
173
  - To prevent elements from being visible before their entrance animation plays
173
174
  - For server-side rendering (SSR) or static site generation (SSG) scenarios
174
175
 
175
176
  ## 5. Triggers & Behaviors
176
177
 
177
- | Trigger | Description | Key Parameters | Rules File |
178
- | :------------- | :------------------------------- | :------------------------------------------------------------------------------------------------------------------------ | :------------------ |
179
- | `hover` | Mouse enter/leave | `type`: 'once', 'alternate', 'repeat', 'state' for animations, or `method`: 'add', 'remove', 'toggle', 'clear' for states | `./hover.md` |
180
- | `click` | Mouse click | `type`: 'once', 'alternate', 'repeat', 'state' for animations, or `method`: 'add', 'remove', 'toggle', 'clear' for states | `./click.md` |
181
- | `viewEnter` | Element enters viewport | `type`: 'once', 'alternate', 'repeat', 'state'; `threshold` (0-1) | `./viewEnter.md` |
182
- | `viewProgress` | Scroll-driven using ViewTimeline | (No specific params, uses effect ranges) | `./viewprogress.md` |
183
- | `pointerMove` | Mouse movement | `hitArea`: 'self' (default) or 'root' | `./pointermove.md` |
184
- | `animationEnd` | Chaining animations | `effectId`: ID of the previous effect | -- |
178
+ | Trigger | Description | Key Parameters | Rules File |
179
+ | :------------- | :---------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------ | :------------------ |
180
+ | `hover` | Mouse enter/leave | `type`: 'once', 'alternate', 'repeat', 'state' for animations, or `method`: 'add', 'remove', 'toggle', 'clear' for states | `./hover.md` |
181
+ | `click` | Mouse click | `type`: 'once', 'alternate', 'repeat', 'state' for animations, or `method`: 'add', 'remove', 'toggle', 'clear' for states | `./click.md` |
182
+ | `activate` | Accessible click (click + keyboard Space/Enter) | Same as `click` with keyboard support | `./click.md` |
183
+ | `interest` | Accessible hover (hover + focus) | Same as `hover` with focus support | `./hover.md` |
184
+ | `viewEnter` | Element enters viewport | `type`: 'once', 'alternate', 'repeat', 'state'; `threshold` (0-1) | `./viewenter.md` |
185
+ | `viewProgress` | Scroll-driven using ViewTimeline | (No specific params, uses effect ranges) | `./viewprogress.md` |
186
+ | `pointerMove` | Mouse movement | `hitArea`: 'self' (default) or 'root'; `axis`: 'x' or 'y' for keyframeEffect | `./pointermove.md` |
187
+ | `animationEnd` | Chaining animations | `effectId`: ID of the previous effect | -- |
185
188
 
186
189
  ## 6. Effects & Animations
187
190