@wix/interact 2.5.6 → 2.5.8
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.
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/react.js +1 -1
- package/dist/cjs/web.js +1 -1
- package/dist/es/index.js +1 -1
- package/dist/es/react.js +2 -2
- package/dist/es/web.js +2 -2
- package/dist/index-Bt4pzwx1.js +21 -0
- package/dist/index-Bt4pzwx1.js.map +1 -0
- package/dist/index-C-q7gc5a.mjs +3565 -0
- package/dist/index-C-q7gc5a.mjs.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/core/Interact.d.ts.map +1 -1
- package/dist/types/core/css.d.ts.map +1 -1
- package/dist/types/core/resolvers.d.ts +2 -2
- package/dist/types/core/resolvers.d.ts.map +1 -1
- package/dist/types/types/config.d.ts +1 -1
- package/dist/types/types/config.d.ts.map +1 -1
- package/dist/types/utils.d.ts +0 -3
- package/dist/types/utils.d.ts.map +1 -1
- package/docs/api/types.md +2 -2
- package/docs/examples/list-patterns.md +4 -0
- package/docs/guides/sequences.md +34 -1
- package/package.json +2 -2
- package/rules/full-lean.md +22 -10
- package/rules/integration.md +10 -1
- package/rules/pointermove.md +14 -22
- package/rules/validate.md +4 -2
- package/rules/viewprogress.md +3 -3
- package/dist/index-CEt49C5d.mjs +0 -3457
- package/dist/index-CEt49C5d.mjs.map +0 -1
- package/dist/index-CxaQDD-U.js +0 -21
- package/dist/index-CxaQDD-U.js.map +0 -1
package/rules/pointermove.md
CHANGED
|
@@ -36,9 +36,9 @@ type PointerMoveParams = {
|
|
|
36
36
|
|
|
37
37
|
### Properties
|
|
38
38
|
|
|
39
|
-
- `hitArea` — determines where mouse movement is tracked
|
|
39
|
+
- `hitArea` — determines where mouse movement is tracked. **Omitting it behaves as `'root'`**: only an explicit `'self'` scopes tracking to the source element.
|
|
40
40
|
- `'self'` — tracks pointer within the source element's bounds only. Use for local pointer-tracking effects on a specific element.
|
|
41
|
-
- `'root'` — tracks pointer anywhere in the viewport. Use for global cursor followers, ambient effects.
|
|
41
|
+
- `'root'` (default) — tracks pointer anywhere in the viewport. Use for global cursor followers, ambient effects.
|
|
42
42
|
- `axis` — restricts pointer tracking to a single axis. Used with `keyframeEffect` to map one axis to 0–1 progress; ignored by `namedEffect` and `customEffect` which receive the full 2D progress:
|
|
43
43
|
- `'x'` — maps horizontal pointer position to 0–1 progress for keyframe interpolation.
|
|
44
44
|
- `'y'` — maps vertical pointer position to 0–1 progress for keyframe interpolation. **Default** when `keyframeEffect` is used.
|
|
@@ -69,7 +69,9 @@ type Progress = {
|
|
|
69
69
|
Controls which element's bounds define the 0–1 progress range.
|
|
70
70
|
|
|
71
71
|
- **`false` (default)**: Progress is calculated against the **source element's** (or viewport's) bounds. The `50%` progress of the timeline is at the center of the source element.
|
|
72
|
-
- **`true`**: `50%` progress of the timeline is calculated against the **target element's center**. The edges of the timeline are still calculated against the edges of the source element/viewport depending on `
|
|
72
|
+
- **`true`**: `50%` progress of the timeline is calculated against the **target element's center**. The edges of the timeline are still calculated against the edges of the source element/viewport depending on `hitArea`.
|
|
73
|
+
|
|
74
|
+
**Applies to `namedEffect` and `customEffect` only.** Centering needs a resolved target, and a `keyframeEffect` scrub scene resolves none — set it there and it is silently ignored.
|
|
73
75
|
|
|
74
76
|
---
|
|
75
77
|
|
|
@@ -118,9 +120,7 @@ Use pre-built mouse presets from `@wix/motion-presets` that handle 2D mouse trac
|
|
|
118
120
|
type: '[NAMED_EFFECT_TYPE]',
|
|
119
121
|
[EFFECT_PROPERTIES]
|
|
120
122
|
},
|
|
121
|
-
centeredToTarget: [CENTERED_TO_TARGET]
|
|
122
|
-
transitionDuration: [TRANSITION_DURATION_MS],
|
|
123
|
-
transitionEasing: '[TRANSITION_EASING]'
|
|
123
|
+
centeredToTarget: [CENTERED_TO_TARGET]
|
|
124
124
|
},
|
|
125
125
|
// additional effects targeting other elements can be added here
|
|
126
126
|
]
|
|
@@ -135,8 +135,8 @@ Use pre-built mouse presets from `@wix/motion-presets` that handle 2D mouse trac
|
|
|
135
135
|
- `[NAMED_EFFECT_TYPE]` — a registered effect name, or a preset from `@wix/motion-presets` `mouse` library.
|
|
136
136
|
- `[EFFECT_PROPERTIES]` — preset-specific options. Refer to motion-presets rules for each preset's available options and their value types. Do NOT guess preset option names or types; omit unknown options and rely on defaults.
|
|
137
137
|
- `[CENTERED_TO_TARGET]` — `true` or `false`. See **Centering with `centeredToTarget`** above.
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
|
|
139
|
+
> `transitionDuration` / `transitionEasing` are **not** available here. They are forwarded only for a `customEffect` payload (see Rule 4).
|
|
140
140
|
|
|
141
141
|
---
|
|
142
142
|
|
|
@@ -160,9 +160,6 @@ Use `keyframeEffect` when the pointer position along a single axis should drive
|
|
|
160
160
|
keyframes: [KEYFRAMES]
|
|
161
161
|
},
|
|
162
162
|
fill: 'both',
|
|
163
|
-
centeredToTarget: [CENTERED_TO_TARGET],
|
|
164
|
-
transitionDuration: [TRANSITION_DURATION_MS],
|
|
165
|
-
transitionEasing: '[TRANSITION_EASING]',
|
|
166
163
|
effectId: '[UNIQUE_EFFECT_ID]'
|
|
167
164
|
},
|
|
168
165
|
// additional effects targeting other elements can be added here
|
|
@@ -177,11 +174,10 @@ Use `keyframeEffect` when the pointer position along a single axis should drive
|
|
|
177
174
|
- `[AXIS]` — `'x'` (horizontal) or `'y'` (vertical). Defaults to `'y'` when omitted.
|
|
178
175
|
- `[EFFECT_NAME]` — unique string name for the keyframe effect.
|
|
179
176
|
- `[KEYFRAMES]` — array of CSS keyframe objects (e.g. `[{ transform: 'rotate(-10deg)' }, { transform: 'rotate(0)' }, { transform: 'rotate(10deg)' }]`). Distributed evenly across 0–1 progress: first keyframe = progress 0 (left/top edge), last = progress 1 (right/bottom edge). Any number of keyframes is allowed.
|
|
180
|
-
- `[CENTERED_TO_TARGET]` — optional. `true` or `false`. See **Centering with `centeredToTarget`** above. Defaults to `false`.
|
|
181
|
-
- `[TRANSITION_DURATION_MS]` — optional. Milliseconds for smoothing between progress updates. See Rule 1 for details.
|
|
182
|
-
- `[TRANSITION_EASING]` — optional. CSS easing string or named easing from `@wix/motion`. See Rule 1 for supported values.
|
|
183
177
|
- `[UNIQUE_EFFECT_ID]` — optional string identifier.
|
|
184
178
|
|
|
179
|
+
> A `keyframeEffect` scrub scene resolves no target, so `centeredToTarget` is silently ignored here, and `transitionDuration` / `transitionEasing` are not forwarded either. All three apply only to the payloads noted in Rules 1 and 4. For smoothed, centered pointer motion use a mouse `namedEffect` or a `customEffect`.
|
|
180
|
+
|
|
185
181
|
---
|
|
186
182
|
|
|
187
183
|
## Rule 3: Two keyframeEffects with Two Axes and `composite`
|
|
@@ -211,9 +207,7 @@ Use two separate interactions on the same source/target pair — one for `axis:
|
|
|
211
207
|
keyframes: [X_KEYFRAMES]
|
|
212
208
|
},
|
|
213
209
|
fill: '[FILL_MODE]', // usually 'both'
|
|
214
|
-
composite: '[COMPOSITE_OPERATION]'
|
|
215
|
-
transitionDuration: [TRANSITION_DURATION_MS],
|
|
216
|
-
transitionEasing: '[TRANSITION_EASING]'
|
|
210
|
+
composite: '[COMPOSITE_OPERATION]'
|
|
217
211
|
},
|
|
218
212
|
'[Y_EFFECT_ID]': {
|
|
219
213
|
keyframeEffect: {
|
|
@@ -221,9 +215,7 @@ Use two separate interactions on the same source/target pair — one for `axis:
|
|
|
221
215
|
keyframes: [Y_KEYFRAMES]
|
|
222
216
|
},
|
|
223
217
|
fill: '[FILL_MODE]', // usually 'both'
|
|
224
|
-
composite: '[COMPOSITE_OPERATION]'
|
|
225
|
-
transitionDuration: [TRANSITION_DURATION_MS],
|
|
226
|
-
transitionEasing: '[TRANSITION_EASING]'
|
|
218
|
+
composite: '[COMPOSITE_OPERATION]'
|
|
227
219
|
}
|
|
228
220
|
}
|
|
229
221
|
}
|
|
@@ -238,8 +230,8 @@ Use two separate interactions on the same source/target pair — one for `axis:
|
|
|
238
230
|
- `[X_KEYFRAMES]` / `[Y_KEYFRAMES]` — arrays of WAAPI keyframe objects for the X-axis and Y-axis effects respectively. Each effect can vary in propertise and keyframes.
|
|
239
231
|
- `[COMPOSITE_OPERATION]` — `'add'` or `'accumulate'`. Required when both effects animate `transform` and/or both animate `filter`, so their values combine rather than override. `'add'`: composited transform functions are appended. `'accumulate'`: matching function arguments are summed.
|
|
240
232
|
- `[FILL_MODE]` — typically `'both'` to ensure the effect keeps applying after exiting the effect's active range.
|
|
241
|
-
|
|
242
|
-
|
|
233
|
+
|
|
234
|
+
> As in Rule 2, `transitionDuration` / `transitionEasing` / `centeredToTarget` do not apply to a `keyframeEffect` payload.
|
|
243
235
|
|
|
244
236
|
---
|
|
245
237
|
|
package/rules/validate.md
CHANGED
|
@@ -56,7 +56,7 @@ if (!result.valid) {
|
|
|
56
56
|
- `valid` is `true` when no remaining issue has severity `'error'`. **Warnings alone do not make `valid: false`.**
|
|
57
57
|
- `errors` holds **all** surfaced issues — both `'error'` and `'warning'` severities. Filter on `severity` to separate them.
|
|
58
58
|
- Issues are sorted lexicographically by `path`.
|
|
59
|
-
- Validation runs in two layers: a **structural** zod parse first (produces `SCHEMA_*` and numeric/threshold codes); if that succeeds, **referential + semantic** checks run (dangling references, unused definitions, duplicate keyframe names, media-query syntax, and the rule-derived semantic warnings — same-element re-trigger, hit-area shift, scroll-preset `range`, `animationEnd` graph cycles, element-selection coherence, `fill`/`inset` nudges, CSS property names that are neither camelCase nor kebab-case). If the structural parse fails, the semantic layer is skipped.
|
|
59
|
+
- Validation runs in two layers: a **structural** zod parse first (produces `SCHEMA_*` and numeric/threshold codes); if that succeeds, **referential + semantic** checks run (dangling references, unused definitions, duplicate keyframe names, media-query syntax, and the rule-derived semantic warnings — same-element re-trigger, hit-area shift, scroll-preset `range`, `animationEnd` graph cycles, element-selection coherence, `fill`/`inset` nudges, CSS property names that are neither camelCase nor kebab-case, sequence easings that cannot be compiled to CSS). If the structural parse fails, the semantic layer is skipped.
|
|
60
60
|
|
|
61
61
|
### assertValidInteractConfig
|
|
62
62
|
|
|
@@ -142,6 +142,7 @@ Severity is one of `'error' | 'warning'`. There are exactly two levers:
|
|
|
142
142
|
| `POINTER_AXIS` | `POINTER_AXIS_IGNORED` | warning |
|
|
143
143
|
| `CSS_PROPERTY_NAME` | `INVALID_CSS_PROPERTY_NAME` | warning |
|
|
144
144
|
| `VIEW_INSET` | `INVALID_INSET` | warning |
|
|
145
|
+
| `OFFSET_EASING` | `FUNCTION_OFFSET_EASING` | warning |
|
|
145
146
|
|
|
146
147
|
For each category, set `'off'` to drop those issues entirely, `'warning'` / `'error'` to set their severity:
|
|
147
148
|
|
|
@@ -237,6 +238,7 @@ Statically-detectable authoring pitfalls lifted from the trigger rule files. Eac
|
|
|
237
238
|
| `POINTER_AXIS_IGNORED` | `pointerMove` `params.axis` set on a `namedEffect`/`customEffect` (axis only applies to `keyframeEffect`). | `POINTER_AXIS` |
|
|
238
239
|
| `INVALID_CSS_PROPERTY_NAME` | A keyframe or state-effect property name is neither camelCase nor kebab-case (both casings are accepted; this one cannot be normalized). | `CSS_PROPERTY_NAME` |
|
|
239
240
|
| `INVALID_INSET` | `viewEnter` `params.inset` is not 1–4 whitespace-separated CSS lengths/percentages. | `VIEW_INSET` |
|
|
241
|
+
| `FUNCTION_OFFSET_EASING` | A sequence's `offsetEasing` is a function, so `generate()` omits that sequence from the generated CSS. | `OFFSET_EASING` |
|
|
240
242
|
|
|
241
243
|
---
|
|
242
244
|
|
|
@@ -277,7 +279,7 @@ const ExperienceSchema = z.object({
|
|
|
277
279
|
|
|
278
280
|
- `InteractConfigSchema` is `.strict()` — unrecognized top-level keys produce `SCHEMA_UNRECOGNIZED_KEYS`.
|
|
279
281
|
- `InteractConfigSchema` carries a `.transform()`, so a successful `.parse()` returns the config augmented with an internal `warnings` array; `validateInteractConfig` consumes that for you.
|
|
280
|
-
- `customEffect` and function-valued `offsetEasing` are accepted as opaque functions (`z.custom<Function>`) — they are not deep-validated, so JS-authored configs with function fields validate correctly.
|
|
282
|
+
- `customEffect` and function-valued `offsetEasing` are accepted as opaque functions (`z.custom<Function>`) — they are not deep-validated, so JS-authored configs with function fields validate correctly. A function `offsetEasing` is still structurally valid, but raises the `FUNCTION_OFFSET_EASING` warning because `generate()` cannot compile it to CSS.
|
|
281
283
|
- Interactions and effects accept `$`-prefixed plugin fields (e.g. `$splitText`) — config routed to plugins registered via `Interact.use()`. Interaction/effect schemas use `.catchall(z.unknown())` + a key check instead of `.strict()`: `$`-prefixed fields are accepted with opaque values (validate has no knowledge of any plugin's shape), while any non-prefixed unknown key is still reported as `SCHEMA_UNRECOGNIZED_KEYS` (typo detection preserved). The top-level `InteractConfigSchema` stays `.strict()`.
|
|
282
284
|
|
|
283
285
|
---
|
package/rules/viewprogress.md
CHANGED
|
@@ -60,9 +60,9 @@ For static sites, pre-render CSS via `generate()` at build time — see
|
|
|
60
60
|
- `'cover'` — full visibility span from first pixel entering to last pixel leaving.
|
|
61
61
|
- `'entry'` — the phase while the element is entering the viewport.
|
|
62
62
|
- `'exit'` — the phase while the element is exiting the viewport.
|
|
63
|
-
- `'contain'` — while the element is fully contained
|
|
64
|
-
- `'entry-crossing'` — from the element's leading edge entering to its
|
|
65
|
-
- `'exit-crossing'` — from the element's
|
|
63
|
+
- `'contain'` — while the element is fully contained by the viewport, or — for an element taller than the viewport — while it fully covers it. This is the phase a `position: sticky` child stays pinned, which is why it pairs with a sticky container.
|
|
64
|
+
- `'entry-crossing'` — from the element's leading edge entering to its trailing edge entering.
|
|
65
|
+
- `'exit-crossing'` — from the element's leading edge exiting to its trailing edge exiting.
|
|
66
66
|
- `[START_PERCENTAGE]` — 0–100, starting point within the named range.
|
|
67
67
|
- `[END_PERCENTAGE]` — 0–100, end point within the named range.
|
|
68
68
|
- `[EASING_FUNCTION]` - CSS easing string or named easing from `@wix/motion`. Typically `'linear'` for scrolling effects.
|