@wix/interact 2.0.3 → 2.0.4
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-BZL18ynN.mjs +2750 -0
- package/dist/index-BZL18ynN.mjs.map +1 -0
- package/dist/index-IaOsZpFD.js +18 -0
- package/dist/index-IaOsZpFD.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/core/Interact.d.ts +9 -1
- package/dist/types/core/Interact.d.ts.map +1 -1
- package/dist/types/core/add.d.ts.map +1 -1
- package/dist/types/handlers/animationEnd.d.ts +1 -1
- package/dist/types/handlers/animationEnd.d.ts.map +1 -1
- package/dist/types/handlers/effectHandlers.d.ts +2 -1
- package/dist/types/handlers/effectHandlers.d.ts.map +1 -1
- package/dist/types/handlers/eventTrigger.d.ts +1 -1
- package/dist/types/handlers/eventTrigger.d.ts.map +1 -1
- package/dist/types/handlers/viewEnter.d.ts +1 -1
- package/dist/types/handlers/viewEnter.d.ts.map +1 -1
- package/dist/types/types.d.ts +29 -2
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/rules/MASTER-CLEANUP-PLAN.md +286 -0
- package/rules/click.md +12 -31
- package/rules/full-lean.md +26 -4
- package/rules/hover.md +68 -153
- package/rules/integration.md +17 -85
- package/rules/pointermove.md +32 -57
- package/rules/scroll-list.md +82 -280
- package/rules/viewenter.md +65 -90
- package/rules/viewprogress.md +139 -845
- package/dist/index-BfcN_rkn.mjs +0 -2338
- package/dist/index-BfcN_rkn.mjs.map +0 -1
- package/dist/index-HXLBEIjG.js +0 -18
- package/dist/index-HXLBEIjG.js.map +0 -1
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
# Master Cleanup Plan: `@wix/interact` Rule Files
|
|
2
|
+
|
|
3
|
+
Synthesized from three independent audits. Filtered through current best practices for documentation consumed by LLMs.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Guiding Principles (Why This Matters)
|
|
8
|
+
|
|
9
|
+
These rules are the primary context fed to AI agents generating `@wix/interact` code. Every wasted token, every duplicated section, every drift between files directly degrades output quality. The standards we apply:
|
|
10
|
+
|
|
11
|
+
1. **Token efficiency over completeness.** LLMs have broad web animation knowledge. Rules should focus exclusively on `@wix/interact`-specific contracts, constraints, and non-obvious patterns — not general CSS or animation education.
|
|
12
|
+
2. **Single source of truth, always.** Duplicated content drifts. When it drifts, models get contradictory instructions and hedge or hallucinate.
|
|
13
|
+
3. **Each file must be usable standalone.** The MCP loads one file at a time based on topic. A model fetching `"click"` gets only `click.md` — it will not automatically also receive `full-lean.md`. Each trigger file must therefore contain all `@wix/interact`-specific constraints the model needs for that trigger, including brief inline summaries of schema concepts it depends on.
|
|
14
|
+
4. **Correctness over breadth.** A contradiction is worse than a gap. Fix all confirmed conflicts before any structural changes.
|
|
15
|
+
5. **Describe when/how, not what/why at length.** A rule like `"alternate plays forward on enter, reverses on leave"` is worth keeping. A paragraph re-explaining what `IntersectionObserver` does is not.
|
|
16
|
+
6. **Delete, don't redirect.** Generic web animation advice should be deleted entirely — not moved to a shared file or linked. The model already knows it. Cross-file links are useful for human navigation only; they are not a content delivery mechanism for the MCP.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Current State
|
|
21
|
+
|
|
22
|
+
- 8 files, ~8,000+ lines
|
|
23
|
+
- ~30–40% estimated duplication
|
|
24
|
+
- 5 confirmed typos/errors
|
|
25
|
+
- 2 confirmed correctness contradictions
|
|
26
|
+
- 1 confirmed schema inconsistency between files (`listItemSelector` vs `selector`)
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Phase 1 — Fix Correctness Issues (do first, no structural work yet)
|
|
31
|
+
|
|
32
|
+
These are the highest-risk problems. A model following a contradictory rule produces wrong code.
|
|
33
|
+
|
|
34
|
+
### 1.1 Resolve `keyframeEffect` + `pointerMove` conflict
|
|
35
|
+
|
|
36
|
+
**Conflict:**
|
|
37
|
+
|
|
38
|
+
- `full-lean.md` lines 366 and 403: "do NOT use `keyframeEffect` with `pointerMove` because pointer progress is two-dimensional"
|
|
39
|
+
- `full-lean.md` line 173: documents `axis?: 'x' | 'y'` param that collapses 2D progress to one axis for keyframes
|
|
40
|
+
- `pointermove.md`: Rules 10–11 document `keyframeEffect` + `axis` as a valid first-class pattern
|
|
41
|
+
|
|
42
|
+
**Resolution:** `full-lean.md` lines 366 and 403 are incomplete. The `axis` parameter exists precisely to make single-axis `keyframeEffect` valid. Update both lines to:
|
|
43
|
+
|
|
44
|
+
> Avoid `keyframeEffect` with `pointerMove` unless using `params: { axis: 'x' | 'y' }` to map a single pointer axis to linear 0–1 progress.
|
|
45
|
+
|
|
46
|
+
### 1.2 Resolve `listItemSelector` vs `selector` inconsistency
|
|
47
|
+
|
|
48
|
+
**Conflict:**
|
|
49
|
+
|
|
50
|
+
- `full-lean.md` uses `listItemSelector` as the field name
|
|
51
|
+
- `integration.md` uses `selector` for the same concept
|
|
52
|
+
|
|
53
|
+
**Resolution:** Check the TypeScript type definition. Standardize both files to the correct field name. One of these is currently giving models the wrong API.
|
|
54
|
+
|
|
55
|
+
### 1.3 Align FOUC constraints
|
|
56
|
+
|
|
57
|
+
**Conflict:**
|
|
58
|
+
|
|
59
|
+
- `full-lean.md` correctly restricts `data-interact-initial="true"` to: `viewEnter` trigger + `type: 'once'` + source element = target element
|
|
60
|
+
- `integration.md` gives the same code example but omits the constraints
|
|
61
|
+
|
|
62
|
+
**Resolution:** Add the full constraints explicitly to `integration.md`'s FOUC section.
|
|
63
|
+
|
|
64
|
+
### 1.4 Fix `pointermove.md` undefined reference
|
|
65
|
+
|
|
66
|
+
`pointermove.md` has an example referencing `indicator-effect` which is not defined in the config shown. Fix the example to be self-contained.
|
|
67
|
+
|
|
68
|
+
### 1.5 Fix all confirmed typos
|
|
69
|
+
|
|
70
|
+
| File | Line | Fix |
|
|
71
|
+
| ----------------- | ---- | ------------------------------------------------- |
|
|
72
|
+
| `viewenter.md` | 946 | `Guildelines` → `Guidelines` |
|
|
73
|
+
| `viewenter.md` | 980 | `HUge` → `Huge` |
|
|
74
|
+
| `viewprogress.md` | 43 | `effec` → `effect` |
|
|
75
|
+
| `hover.md` | 515 | `same ass` → `same as` |
|
|
76
|
+
| `integration.md` | 195 | `(Pre-built effect library)>` → remove stray `>` |
|
|
77
|
+
| `scroll-list.md` | 272 | `selector: ' .hero-image'` → remove leading space |
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Phase 2 — Establish Single Source of Truth (via deletion, not links)
|
|
82
|
+
|
|
83
|
+
### 2.1 Define canonical ownership
|
|
84
|
+
|
|
85
|
+
Because the MCP loads one file at a time, the "canonical" column means "most complete definition lives here." The "inline mention needed" column means trigger docs that depend on this concept must include a brief self-contained summary — not a link, not a full re-explanation.
|
|
86
|
+
|
|
87
|
+
| Content | Canonical file | Action in other files | Inline mention needed in |
|
|
88
|
+
| ----------------------------------------------------------------------- | ---------------------------------- | ---------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
89
|
+
| Full type/schema spec (`InteractConfig`, triggers, effects, conditions) | `full-lean.md` | Delete duplicated schema prose from `integration.md` | All trigger docs: keep brief summaries of params they use |
|
|
90
|
+
| Developer setup (install, web, react, CDN, `Interact.create`) | `integration.md` | — | — |
|
|
91
|
+
| FOUC / `generate(config)` | `full-lean.md` + `viewenter.md` | Delete full code block from `integration.md` only | `viewenter.md`: full working example with constraints — it is the most likely file fetched for entrance animations and must be self-contained |
|
|
92
|
+
| `StateParams.method` (`add`/`remove`/`toggle`/`clear`) | `full-lean.md` | — | `click.md`: inline comment on TransitionEffect rule only (`hover.md` has no TransitionEffect rule so no mention needed there) |
|
|
93
|
+
| Target cascade resolution | `full-lean.md` | — | Any trigger doc showing cross-targeting examples |
|
|
94
|
+
| `Progress` type for `customEffect` with `pointerMove` | `pointermove.md` | Delete duplicate definition from `full-lean.md` | — |
|
|
95
|
+
| `fill: 'both'` for `viewProgress` | `full-lean.md` | — | `viewprogress.md`: keep inline (model fetching viewprogress won't have full-lean) |
|
|
96
|
+
| `registerEffects` | currently only in `integration.md` | Add to `full-lean.md` | — |
|
|
97
|
+
| Generic perf/UX/a11y advice | nowhere — delete entirely | Remove from all trigger docs | — |
|
|
98
|
+
|
|
99
|
+
### 2.2 Reduce `integration.md`
|
|
100
|
+
|
|
101
|
+
`integration.md` is a developer-facing onboarding guide — not a schema reference. Effect type syntax belongs in `full-lean.md`; the 3 end-to-end examples at the bottom of `integration.md` already demonstrate effect types in context, which is more useful for onboarding than standalone snippets.
|
|
102
|
+
|
|
103
|
+
- **Keep:** install steps, web/react setup snippets, `Interact.create` usage, HTML/JSX element wrappers, `registerEffects` setup, trigger overview table, 3 working examples (hover, viewEnter, click), FOUC rules
|
|
104
|
+
- **Delete:** full effect type taxonomy (`keyframeEffect`, `TransitionEffect`, scroll/mouse effect snippets) — covered by `full-lean.md` and shown contextually in the examples
|
|
105
|
+
|
|
106
|
+
### 2.3 Strip generic best-practices content from all trigger docs
|
|
107
|
+
|
|
108
|
+
Do **not** create a shared `best-practices.md`. Instead, apply this filter to every trigger doc's Best Practices section:
|
|
109
|
+
|
|
110
|
+
**Delete (model already knows this):**
|
|
111
|
+
|
|
112
|
+
- "Use `transform`, `opacity`, `filter` for hardware acceleration"
|
|
113
|
+
- "Avoid animating layout properties"
|
|
114
|
+
- "`will-change` for complex animations"
|
|
115
|
+
- "Keep animations subtle"
|
|
116
|
+
- "Ensure content remains readable"
|
|
117
|
+
- "Progressive enhancement"
|
|
118
|
+
- Generic "Respect `prefers-reduced-motion`" without `@wix/interact`-specific guidance
|
|
119
|
+
|
|
120
|
+
**Keep (interact-specific, non-obvious):**
|
|
121
|
+
|
|
122
|
+
- `@wix/interact` conditions API for `prefers-reduced-motion`: how to wire it via `conditions` field. **Clarification:** condition IDs are user-defined strings — examples must always show the full `conditions` config map (with `type` and `predicate`) alongside the interaction that references them, not just the ID strings in isolation
|
|
123
|
+
- Trigger-specific timing constraints (e.g. click: 100–500ms, hover: 100–400ms)
|
|
124
|
+
- Trigger-specific gotchas (e.g. viewEnter: don't animate source and target as the same element with `repeat` type)
|
|
125
|
+
- `pointermove`: cache DOM queries outside `customEffect` callbacks
|
|
126
|
+
- `viewprogress`: stacking contexts freeze ViewTimeline — this belongs in `full-lean.md` general guidelines (already there) and should be removed from `viewprogress.md` best practices
|
|
127
|
+
|
|
128
|
+
**Estimated line savings: ~250 lines across trigger docs.**
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Phase 3 — Restructure `viewprogress.md`
|
|
133
|
+
|
|
134
|
+
This is the single largest structural problem. 9 rules are a 3×3 matrix with near-identical patterns:
|
|
135
|
+
|
|
136
|
+
| | `namedEffect` | `keyframeEffect` | `customEffect` |
|
|
137
|
+
| ------------------- | ------------- | ---------------- | -------------- |
|
|
138
|
+
| Parallax/Continuous | Rule 1 | Rule 4 | Rule 7 |
|
|
139
|
+
| Entry | Rule 2 | Rule 5 | Rule 8 |
|
|
140
|
+
| Exit | Rule 3 | Rule 6 | Rule 9 |
|
|
141
|
+
|
|
142
|
+
Every rule repeats the same config skeleton. Variable lists from Rule 5 onward explicitly say "Other variables same as Rule 1" — a direct admission of duplication.
|
|
143
|
+
|
|
144
|
+
**Why tables outperform the 9-rule format for LLM consumption:**
|
|
145
|
+
|
|
146
|
+
The 9-rule matrix looks comprehensive to humans but is inefficient for models. Once a model has seen the config pattern once, repeating it 8 more times with minor substitutions adds no information — it just consumes context tokens. The replacement structure (1 template + 2 lookup tables + 4 examples) performs better because:
|
|
147
|
+
|
|
148
|
+
- **Decision tables are scannable.** A model resolving "I need an entry animation" can map scenario → effect type → range names in one pass through the table, rather than pattern-matching a natural-language rule description to its task.
|
|
149
|
+
- **Fewer examples, correctly chosen, generalize better.** 4 curated examples (one per effect type + one non-obvious multi-range pattern) teach the model to compose, rather than encouraging copy-paste from the closest-matching rule.
|
|
150
|
+
- **Token efficiency directly affects output quality.** Fewer tokens spent on redundant patterns means more context budget for the actual user task.
|
|
151
|
+
|
|
152
|
+
The trade-off: the old format had a safer floor for weaker models that benefit from rote examples. The new format has a higher ceiling for capable models (Claude, GPT-4, Gemini) that generalize well from clean, structured docs — which is the target audience for this library.
|
|
153
|
+
|
|
154
|
+
### Target structure for `viewprogress.md`
|
|
155
|
+
|
|
156
|
+
**Section 1: Core Concept** (~5 lines)
|
|
157
|
+
One sentence on what `viewProgress` does (scroll-driven via `ViewTimeline`). No animation education.
|
|
158
|
+
|
|
159
|
+
**Section 2: Config Template** (1 canonical pattern block)
|
|
160
|
+
Single pattern showing all `viewProgress`-relevant fields with placeholders.
|
|
161
|
+
|
|
162
|
+
**Section 3: Effect Type Selection** (table)
|
|
163
|
+
|
|
164
|
+
| Scenario | Effect type | Notes |
|
|
165
|
+
| -------------------------- | ---------------- | -------------------------------- | ----- | -------------------- |
|
|
166
|
+
| Use a scroll preset | `namedEffect` | Preferred; requires `range: 'in' | 'out' | 'continuous'` option |
|
|
167
|
+
| Custom CSS animation | `keyframeEffect` | Full keyframe control |
|
|
168
|
+
| DOM/canvas/dynamic content | `customEffect` | Last resort; keep callback lean |
|
|
169
|
+
|
|
170
|
+
**Section 4: Range Reference** (table)
|
|
171
|
+
|
|
172
|
+
| Intent | `rangeStart.name` | `rangeEnd.name` | Typical offsets |
|
|
173
|
+
| ------------------------- | ----------------- | --------------- | --------------- |
|
|
174
|
+
| Element entering viewport | `entry` | `entry` | 0–60% |
|
|
175
|
+
| Element exiting viewport | `exit` | `exit` | 0–60% |
|
|
176
|
+
| Full element traversal | `cover` | `cover` | 0–100% |
|
|
177
|
+
| While fully in viewport | `contain` | `contain` | 0–100% |
|
|
178
|
+
|
|
179
|
+
Include the offset semantics note (positive = forward along scroll axis) — once, here only.
|
|
180
|
+
|
|
181
|
+
**Section 5: Named Scroll Effects Reference** (condensed list)
|
|
182
|
+
The scroll preset names currently buried in Rule 1 variables — one list, not repeated across rules.
|
|
183
|
+
|
|
184
|
+
**Section 2 note: Config Template placeholders**
|
|
185
|
+
Do not include a `direction` placeholder. `direction` is a preset-specific option (not a standard field), its valid values differ per preset, and listing generic values would be incomplete and misleading. The template uses `[NAMED_EFFECT]` with a note: only use preset-specific options you have documentation for; omit and rely on defaults otherwise.
|
|
186
|
+
|
|
187
|
+
**Section 6: Examples** (4 total)
|
|
188
|
+
|
|
189
|
+
- `namedEffect` parallax
|
|
190
|
+
- `keyframeEffect` custom entrance
|
|
191
|
+
- `customEffect` scroll counter
|
|
192
|
+
- **Multi-range (entry + exit on the same element)** — non-obvious pattern requiring two effects with the same `key` but different range scopes. Without a dedicated example, models can infer it from the tables but may get the fill/easing direction wrong. The cost (~40 lines) is worth the reliability gain.
|
|
193
|
+
|
|
194
|
+
**Section 7: Advanced Patterns** — keep existing section as-is (genuinely unique content)
|
|
195
|
+
|
|
196
|
+
**Section 8: Best Practices** — interact-specific delta only (per Phase 2.3 filter above)
|
|
197
|
+
|
|
198
|
+
**Estimated line savings: ~~600 lines (~~55% reduction of the file).**
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## Phase 4 — Reduce `scroll-list.md`
|
|
203
|
+
|
|
204
|
+
This file's genuine value is its list-specific patterns. Everything else repeats `viewprogress.md`.
|
|
205
|
+
|
|
206
|
+
### Keep (unique to lists)
|
|
207
|
+
|
|
208
|
+
- Sticky container/item/content hierarchy explanation
|
|
209
|
+
- `listContainer` + `listItemSelector` (or `selector`) setup and rules
|
|
210
|
+
- Why `contain` range fits sticky container animations specifically
|
|
211
|
+
- Stagger pattern using shared `effectId` in the effects registry
|
|
212
|
+
- `customEffect` pattern for per-item dynamic content
|
|
213
|
+
- Responsive list animations section with a full `conditions` config map example (same pattern as other trigger docs — condition IDs are user-defined, must always be shown alongside their `type`/`predicate` definition)
|
|
214
|
+
|
|
215
|
+
### Delete (generic, already in `viewprogress.md` or model already knows it)
|
|
216
|
+
|
|
217
|
+
- Range name semantics — already in `viewprogress.md` after Phase 3
|
|
218
|
+
- Effect type taxonomy — already in `viewprogress.md` after Phase 3
|
|
219
|
+
- Generic `fill: 'both'` explanation
|
|
220
|
+
- Generic performance/UX/a11y best practices (per Phase 2.3 filter)
|
|
221
|
+
|
|
222
|
+
**Estimated line savings: ~200 lines.**
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## Phase 5 — Trigger Doc Standardization
|
|
227
|
+
|
|
228
|
+
Minor but important for model consistency. Models that see consistent structure learn to pattern-match faster across files.
|
|
229
|
+
|
|
230
|
+
### Issues to fix
|
|
231
|
+
|
|
232
|
+
- `hover.md` title: "Hover Trigger Rules" — missing `for @wix/interact` (all others have it)
|
|
233
|
+
- `hover.md` has no Accessibility section (the only trigger doc missing it entirely) — add the interact-specific `conditions`-based reduced motion guidance
|
|
234
|
+
- Variable placeholder naming is inconsistent: `[SOURCE_KEY]` (viewprogress, pointermove) vs `[SOURCE_IDENTIFIER]` (click, hover) for the same concept
|
|
235
|
+
- `hover.md` Rules 2 and 3 overlap heavily (both are `alternate` pattern, one with `namedEffect`, one with `keyframeEffect`) — collapse into one rule with two examples
|
|
236
|
+
- `click.md` shows only `method: 'toggle'` for `TransitionEffect` — add brief mention that `add`, `remove`, `clear` also exist (already defined in `full-lean.md`, but models reading only the trigger doc will miss it)
|
|
237
|
+
- `hover.md` does **not** get a `method` mention — `hover.md` has no `TransitionEffect` rule, so adding a method summary there would be orphaned with no anchor
|
|
238
|
+
|
|
239
|
+
### Fixes
|
|
240
|
+
|
|
241
|
+
- Standardize title format: `# [Trigger] Trigger Rules for @wix/interact`
|
|
242
|
+
- Add Accessibility section to `hover.md` (interact-specific content only)
|
|
243
|
+
- Standardize placeholder names across all trigger docs: use `[SOURCE_KEY]` / `[TARGET_KEY]` everywhere
|
|
244
|
+
- Collapse `hover.md` Rules 2+3 into one rule with two examples
|
|
245
|
+
- Add one-line mention of `add`/`remove`/`clear` methods to `click.md` TransitionEffect rule
|
|
246
|
+
- Remove trailing "These rules provide comprehensive coverage..." footers from `click.md`, `viewenter.md`, `viewprogress.md`, `pointermove.md`
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## Final File Structure
|
|
251
|
+
|
|
252
|
+
```
|
|
253
|
+
packages/interact/rules/
|
|
254
|
+
├── full-lean.md ← canonical spec: schema, types, all trigger params, effect rules, general gotchas
|
|
255
|
+
│ changes: fix keyframeEffect+axis note, add registerEffects, remove duplicate Progress type
|
|
256
|
+
├── integration.md ← onboarding only: setup, 3 working examples, trigger overview table
|
|
257
|
+
│ changes: reduce from ~370 → ~150 lines by deleting schema/effect prose
|
|
258
|
+
├── click.md ← trigger patterns + examples + interact-specific best practices
|
|
259
|
+
├── hover.md ← trigger patterns + examples; add a11y section; collapse rules 2+3
|
|
260
|
+
├── viewenter.md ← trigger patterns + examples; full FOUC example with constraints
|
|
261
|
+
├── viewprogress.md ← 1 template + 2 tables + 4 examples + advanced patterns
|
|
262
|
+
│ changes: remove 9-rule matrix (~600 lines); no direction placeholder in template
|
|
263
|
+
├── scroll-list.md ← list-specific only (sticky hierarchy, stagger, list context)
|
|
264
|
+
│ changes: delete generic scroll/range/effect content (~200 lines)
|
|
265
|
+
└── pointermove.md ← keep Core Concepts (genuine unique value); trim best practices
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## Execution Order
|
|
271
|
+
|
|
272
|
+
| # | Action | Files affected | Est. lines removed | Risk |
|
|
273
|
+
| --- | ------------------------------------------------------------------------------------------------------------- | -------------------------------- | ------------------ | ------------------ |
|
|
274
|
+
| 1 | Fix correctness: `keyframeEffect`/`pointerMove` conflict | `full-lean.md` | — | High if skipped |
|
|
275
|
+
| 2 | Fix correctness: `listItemSelector` vs `selector` | `full-lean.md`, `integration.md` | — | High if skipped |
|
|
276
|
+
| 3 | Fix correctness: FOUC constraints alignment | `integration.md` | — | High if skipped |
|
|
277
|
+
| 4 | Fix 6 typos + undefined `pointermove.md` reference | all | — | Low effort, do now |
|
|
278
|
+
| 5 | Delete generic best-practices content from all trigger docs | all trigger docs | ~250 | Low |
|
|
279
|
+
| 6 | Refactor `viewprogress.md`: 1 template + 2 tables + 4 examples (added multi-range) | `viewprogress.md` | ~600 | Medium |
|
|
280
|
+
| 7 | Reduce `scroll-list.md`: delete generic scroll/range/effect content | `scroll-list.md` | ~200 | Low |
|
|
281
|
+
| 8 | Reduce `integration.md`: delete schema/effect prose | `integration.md` | ~150 | Low |
|
|
282
|
+
| 9 | Add `registerEffects` to `full-lean.md`; remove duplicate `Progress` type | `full-lean.md` | — | Low |
|
|
283
|
+
| 10 | Standardize titles, placeholders, collapse `hover.md` rules 2+3, add missing `method` mention, remove footers | all | ~50 | Very low |
|
|
284
|
+
|
|
285
|
+
**Estimated total reduction: ~~1,250 lines (~~15% of corpus), with zero loss of `@wix/interact`-specific information.**
|
|
286
|
+
The remaining content will be denser, more accurate, and cheaper for models to consume.
|
package/rules/click.md
CHANGED
|
@@ -17,14 +17,14 @@ These rules help generate click-based interactions using the `@wix/interact` lib
|
|
|
17
17
|
|
|
18
18
|
```typescript
|
|
19
19
|
{
|
|
20
|
-
key: '[
|
|
20
|
+
key: '[SOURCE_KEY]',
|
|
21
21
|
trigger: 'click',
|
|
22
22
|
params: {
|
|
23
23
|
type: 'alternate'
|
|
24
24
|
},
|
|
25
25
|
effects: [
|
|
26
26
|
{
|
|
27
|
-
key: '[
|
|
27
|
+
key: '[TARGET_KEY]',
|
|
28
28
|
[EFFECT_TYPE]: [EFFECT_DEFINITION],
|
|
29
29
|
fill: 'both',
|
|
30
30
|
reversed: [INITIAL_REVERSED_BOOL],
|
|
@@ -38,8 +38,8 @@ These rules help generate click-based interactions using the `@wix/interact` lib
|
|
|
38
38
|
|
|
39
39
|
**Variables**:
|
|
40
40
|
|
|
41
|
-
- `[
|
|
42
|
-
- `[
|
|
41
|
+
- `[SOURCE_KEY]`: Unique identifier for clickable element. Should equal the value of the `data-interact-key` attribute on the wrapping `<interact-element>`.
|
|
42
|
+
- `[TARGET_KEY]`: Unique identifier for animated element (can be same as `[SOURCE_KEY]` for self-targeting, or different for cross-targeting).
|
|
43
43
|
- `[EFFECT_TYPE]`: Either `namedEffect` or `keyframeEffect`
|
|
44
44
|
- `[EFFECT_DEFINITION]`: Named effect object (e.g., { type: 'SlideIn', ...params }, { type: 'FadeIn', ...params }) or keyframe object (e.g., { name: 'custom-fade', keyframes: [{ opacity: 0 }, { opacity: 1 }] }, { name: 'custom-slide', keyframes: [{ transform: 'translateX(-100%)' }, { transform: 'translateX(0)' }] })
|
|
45
45
|
- `[INITIAL_REVERSED_BOOL]`: Optional boolean value indicating whether the first toggle should play the reversed animation.
|
|
@@ -118,14 +118,14 @@ These rules help generate click-based interactions using the `@wix/interact` lib
|
|
|
118
118
|
|
|
119
119
|
```typescript
|
|
120
120
|
{
|
|
121
|
-
key: '[
|
|
121
|
+
key: '[SOURCE_KEY]',
|
|
122
122
|
trigger: 'click',
|
|
123
123
|
params: {
|
|
124
124
|
type: 'state'
|
|
125
125
|
},
|
|
126
126
|
effects: [
|
|
127
127
|
{
|
|
128
|
-
key: '[
|
|
128
|
+
key: '[TARGET_KEY]',
|
|
129
129
|
[EFFECT_TYPE]: [EFFECT_DEFINITION],
|
|
130
130
|
fill: 'both',
|
|
131
131
|
reversed: [INITIAL_REVERSED_BOOL],
|
|
@@ -212,14 +212,14 @@ These rules help generate click-based interactions using the `@wix/interact` lib
|
|
|
212
212
|
|
|
213
213
|
```typescript
|
|
214
214
|
{
|
|
215
|
-
key: '[
|
|
215
|
+
key: '[SOURCE_KEY]',
|
|
216
216
|
trigger: 'click',
|
|
217
217
|
params: {
|
|
218
218
|
type: 'repeat'
|
|
219
219
|
},
|
|
220
220
|
effects: [
|
|
221
221
|
{
|
|
222
|
-
key: '[
|
|
222
|
+
key: '[TARGET_KEY]',
|
|
223
223
|
[EFFECT_TYPE]: [EFFECT_DEFINITION],
|
|
224
224
|
duration: [DURATION_MS],
|
|
225
225
|
easing: '[EASING_FUNCTION]',
|
|
@@ -304,14 +304,14 @@ These rules help generate click-based interactions using the `@wix/interact` lib
|
|
|
304
304
|
|
|
305
305
|
```typescript
|
|
306
306
|
{
|
|
307
|
-
key: '[
|
|
307
|
+
key: '[SOURCE_KEY]',
|
|
308
308
|
trigger: 'click',
|
|
309
309
|
params: {
|
|
310
|
-
method: 'toggle'
|
|
310
|
+
method: 'toggle' // also: 'add', 'remove', 'clear' — see full-lean.md StateParams
|
|
311
311
|
},
|
|
312
312
|
effects: [
|
|
313
313
|
{
|
|
314
|
-
key: '[
|
|
314
|
+
key: '[TARGET_KEY]',
|
|
315
315
|
transition: {
|
|
316
316
|
duration: [DURATION_MS],
|
|
317
317
|
delay: [DELAY_MS],
|
|
@@ -501,27 +501,12 @@ Using effectId for sequential animations:
|
|
|
501
501
|
|
|
502
502
|
## Best Practices for Click Interactions
|
|
503
503
|
|
|
504
|
-
###
|
|
504
|
+
### Timing and Pattern Guidelines
|
|
505
505
|
|
|
506
506
|
1. **Keep click animations short** (100-500ms) for immediate feedback
|
|
507
|
-
2. **Use `transform` and `opacity`** for smooth animations
|
|
508
|
-
3. **Avoid animating layout properties** like width/height in clicks
|
|
509
|
-
4. **Consider using `will-change`** for complex click animations
|
|
510
|
-
|
|
511
|
-
### User Experience Guidelines
|
|
512
|
-
|
|
513
|
-
1. **Provide immediate visual feedback** (within 100ms)
|
|
514
507
|
2. **Use alternate pattern** for toggle states
|
|
515
508
|
3. **Use repeat pattern** for confirmation actions
|
|
516
509
|
4. **Use state pattern** for media controls
|
|
517
|
-
5. **Ensure click targets are accessible** (minimum 44px touch target)
|
|
518
|
-
|
|
519
|
-
### Accessibility Considerations
|
|
520
|
-
|
|
521
|
-
1. **Respect `prefers-reduced-motion`** setting
|
|
522
|
-
2. **Provide alternative interaction methods** (keyboard support)
|
|
523
|
-
3. **Ensure sufficient color contrast** during transitions
|
|
524
|
-
4. **Don't rely solely on animation** to convey state changes
|
|
525
510
|
|
|
526
511
|
### Common Use Cases by Pattern
|
|
527
512
|
|
|
@@ -555,7 +540,3 @@ Using effectId for sequential animations:
|
|
|
555
540
|
- Color changes
|
|
556
541
|
- Simple state toggles
|
|
557
542
|
- CSS custom property updates
|
|
558
|
-
|
|
559
|
-
---
|
|
560
|
-
|
|
561
|
-
These rules provide comprehensive coverage for click trigger interactions in `@wix/interact`, supporting the four main behavior patterns and two primary effect types as outlined in the development plan.
|
package/rules/full-lean.md
CHANGED
|
@@ -30,6 +30,25 @@ const config: InteractConfig = {
|
|
|
30
30
|
Interact.create(config);
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
+
### Using `namedEffect` presets (`registerEffects`)
|
|
34
|
+
|
|
35
|
+
Before using `namedEffect`, you must register the presets with the `Interact` instance. Without this, `namedEffect` types will not resolve.
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import { Interact } from '@wix/interact/web'; // or /react
|
|
39
|
+
import * as presets from '@wix/motion-presets';
|
|
40
|
+
|
|
41
|
+
Interact.registerEffects(presets);
|
|
42
|
+
Interact.create(config);
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Or register only what you need:
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
import { FadeIn, ParallaxScroll } from '@wix/motion-presets';
|
|
49
|
+
Interact.registerEffects({ FadeIn, ParallaxScroll });
|
|
50
|
+
```
|
|
51
|
+
|
|
33
52
|
- Without Node/build tools: add a `<script type="module">` and import from the CDN.
|
|
34
53
|
|
|
35
54
|
```html
|
|
@@ -363,7 +382,7 @@ The config remains the same for both integrations—only the HTML/JSX setup diff
|
|
|
363
382
|
- `transitionDelay?`: number
|
|
364
383
|
- `transitionEasing?`: `ScrubTransitionEasing`
|
|
365
384
|
- One of `keyframeEffect | namedEffect | customEffect` (see above)
|
|
366
|
-
- For mouse-effects driven by the `pointerMove` trigger,
|
|
385
|
+
- For mouse-effects driven by the `pointerMove` trigger, avoid `keyframeEffect` unless using `params: { axis: 'x' | 'y' }` to map a single pointer axis to linear 0–1 progress. For 2D effects, use `namedEffect` mouse presets or `customEffect` instead.
|
|
367
386
|
- For scroll `namedEffect` presets (e.g., `*Scroll`) used with a `viewProgress` trigger, include `range: 'in' | 'out' | 'continuous'` in the `namedEffect` options; prefer `'continuous'` for simplicity.
|
|
368
387
|
- RangeOffset (used by `rangeStart`/`rangeEnd`):
|
|
369
388
|
- Type: `{ name: 'entry' | 'exit' | 'contain' | 'cover' | 'entry-crossing' | 'exit-crossing'; offset: LengthPercentage }`
|
|
@@ -396,11 +415,14 @@ The config remains the same for both integrations—only the HTML/JSX setup diff
|
|
|
396
415
|
|
|
397
416
|
- **namedEffect (Preferred)**: Use first for best performance. These are pre-built presets from `@wix/motion-presets` that are GPU-friendly and tuned.
|
|
398
417
|
- 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:
|
|
400
|
-
|
|
418
|
+
- Short list of common preset names:
|
|
419
|
+
- Entrance: `FadeIn`, `BounceIn`, `SlideIn`, `FlipIn`, `ArcIn`
|
|
420
|
+
- Ongoing: `Pulse`, `Spin`, `Wiggle`, `Bounce`
|
|
421
|
+
- Scroll: `ParallaxScroll`, `FadeScroll`, `RevealScroll`, `TiltScroll` — for `viewProgress`, `namedEffect` options MUST include `range: 'in' | 'out' | 'continuous'`; prefer `'continuous'`
|
|
422
|
+
- Mouse: `TrackMouse`, `Tilt3DMouse`, `ScaleMouse`, `BlurMouse` — for `pointerMove`; prefer over `keyframeEffect` for 2D pointer effects
|
|
401
423
|
- **keyframeEffect (Default for custom animations)**: Prefer this when you need a custom-made animation.
|
|
402
424
|
- Structure: `keyframeEffect: { name: string; keyframes: Keyframe[] }` (keyframes use standard CSS/WAAPI properties).
|
|
403
|
-
-
|
|
425
|
+
- When used with `pointerMove`, requires `params: { axis: 'x' | 'y' }` to select which pointer coordinate maps to linear progress. Without `axis`, pointer progress is two-dimensional and cannot drive keyframe animations. For 2D pointer effects, use `namedEffect` or `customEffect`.
|
|
404
426
|
- **customEffect (Last resort)**: Use only when you must perform DOM manipulation or produce randomized/non-deterministic visuals that cannot be expressed as keyframes or presets.
|
|
405
427
|
- Structure: `customEffect: (element: Element, progress: any) => void`
|
|
406
428
|
|