Skip to content

Commit 648f993

Browse files
authored
Initial implementation of interactor (#242)
* Initial implementation of interactor * Fixed format * Fixed some issues in SKILL.md * More fixes to SKILL.md * More fixes to docs and rules * Review interactor skill references * Cleanup * Fixed review comments * Plan for adding interact-validate to interactor skill * Implement integration of validation using interact-validate in interactor
1 parent 0959b70 commit 648f993

19 files changed

Lines changed: 2193 additions & 26 deletions

File tree

.cursor/plans/interactor_skill_validation_f7103af3.plan.md

Lines changed: 287 additions & 0 deletions
Large diffs are not rendered by default.

packages/interact/docs/api/interact-class.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ Interact.setup({
153153
}),
154154
});
155155

156-
// Enable accessibility for click and hover triggers
156+
// Enable accessibility for all click and hover triggers
157157
Interact.setup({
158158
allowA11yTriggers: true,
159159
});

packages/interact/docs/guides/custom-elements.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ interact-element.--hover-active .my-element {
103103
}
104104
```
105105

106-
### State Toggle Methods
106+
### State Toggle Actions
107107

108-
The element provides methods to manage states:
108+
The element provides actions to manage states:
109109

110110
1. `add`: adds a state named by `effectId`
111111
2. `remove`: removes a state named by `effectId`
@@ -164,16 +164,16 @@ export default {
164164
```javascript
165165
// Create element programmatically
166166
function createInteractiveElement(id, content) {
167-
const wixElement = document.createElement('interact-element');
168-
wixElement.dataset.wixPath = id;
167+
const interactElement = document.createElement('interact-element');
168+
interactElement.dataset.interactKey = id;
169169

170170
const childElement = document.createElement('div');
171171
childElement.id = id;
172172
childElement.innerHTML = content;
173173

174-
wixElement.appendChild(childElement);
174+
interactElement.appendChild(childElement);
175175

176-
return wixElement;
176+
return interactElement;
177177
}
178178

179179
// Usage
@@ -218,12 +218,12 @@ You can change the key dynamically:
218218
const element = document.querySelector('interact-element');
219219

220220
// Remove old interactions
221-
if (element.dataset.wixPath) {
222-
remove(element.dataset.wixPath);
221+
if (element.dataset.interactKey) {
222+
remove(element.dataset.interactKey);
223223
}
224224

225225
// Update key
226-
element.dataset.wixPath = 'new-target';
226+
element.dataset.interactKey = 'new-target';
227227

228228
// Reconnect with new key
229229
element.connect('new-target');
@@ -303,7 +303,7 @@ console.log('interact-element registered:', customElements.get('interact-element
303303
```javascript
304304
const element = document.querySelector('interact-element');
305305
console.log('Connected:', element.connected);
306-
console.log('Key:', element.dataset.wixPath);
306+
console.log('Key:', element.dataset.interactKey);
307307
console.log('Has child:', element.firstElementChild !== null);
308308
```
309309

packages/interact/docs/integration/react.md

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ const config: InteractConfig = {
400400
key: 'accordion',
401401
trigger: 'click',
402402
selector: '.accordion-header',
403-
effects: [{ effectId: 'expanded', method: 'toggle' }],
403+
effects: [{ effectId: 'expanded', stateAction: 'toggle' }],
404404
},
405405
],
406406
};
@@ -460,20 +460,24 @@ import { Interact, Interaction, InteractConfig } from '@wix/interact/react';
460460
const config: InteractConfig = {
461461
interactions: [
462462
{
463-
key: 'product-list',
463+
key: 'product-list', // single triggering parent
464464
trigger: 'viewEnter',
465-
listContainer: '.products',
466-
effects: [
465+
sequences: [
467466
{
468-
keyframeEffect: {
469-
name: 'slide-up',
470-
keyframes: [
471-
{ opacity: 0, transform: 'translateY(30px)' },
472-
{ opacity: 1, transform: 'translateY(0)' },
473-
],
474-
},
475-
duration: 400,
476-
stagger: 100, // Stagger animation for list items
467+
offset: 100, // Stagger animation for list items
468+
effects: [
469+
{
470+
listContainer: '.products', //multiple target elements
471+
keyframeEffect: {
472+
name: 'slide-up',
473+
keyframes: [
474+
{ opacity: 0, transform: 'translateY(30px)' },
475+
{ opacity: 1, transform: 'translateY(0)' },
476+
],
477+
},
478+
duration: 400,
479+
},
480+
],
477481
},
478482
],
479483
},

packages/interact/rules/full-lean.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ The target element is what the effect animates. Resolved in priority order:
654654
| `Interact.registerEffects(presets)` | Register named effect presets. MUST be called before `create`. |
655655
| `Interact.destroy()` | Tear down all instances. Call on unmount or route change to prevent memory leaks. |
656656
| `Interact.forceReducedMotion` | `boolean` (default: `false`) — force reduced-motion behavior regardless of OS setting. |
657-
| `Interact.allowA11yTriggers` | `boolean` (default: `false`) — enable accessibility trigger variants (`interest`, `activate`). |
657+
| `Interact.allowA11yTriggers` | `boolean` (default: `true`) — enable accessibility trigger variants (`interest`, `activate`). |
658658
| `Interact.setup(options)` | Configure global options for scroll, pointer, and viewEnter systems. Call before `create`. See options below. |
659659

660660
**`Interact.setup(options)`** — optional configuration object:

packages/interact/test/cssUtils.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
CSSRuleToString,
88
buildListsRule,
99
} from '../src/core/cssUtils';
10-
import type { CSSCoordinatedLists, ListCustomProps, CSSRuleData } from '../types';
10+
import type { CSSCoordinatedLists, ListCustomProps, CSSRuleData } from '../src/types/css';
1111

1212
describe('keyframePropertyToCSS', () => {
1313
it('should convert cssFloat to float', () => {

skills/interactor.skill

29.8 KB
Binary file not shown.

0 commit comments

Comments
 (0)