npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@wix/interact

v1.90.0

Published

A powerful, declarative interaction library for creating engaging web animations and effects. Built on top of `@wix/motion`, it provides a configuration-driven approach to adding triggers, animations, and state transitions to web applications.

Readme

@wix/interact

A powerful, declarative interaction library for creating engaging web animations and effects. Built on top of @wix/motion, it provides a configuration-driven approach to adding triggers, animations, and state transitions to web applications.

Features

  • 🎯 Declarative Configuration - Define complex interactions through simple JSON configuration
  • 🎨 Rich Animation Support - Integration with @wix/motion for high-performance animations
  • 🖱️ Multiple Trigger Types - Support for hover, click, scroll, viewport, and custom triggers
  • 📱 Responsive Conditions - Media query and container-based conditional interactions
  • 🔧 Custom Elements - Web Components API for easy framework integration
  • Performance Optimized - Efficient event handling and animation management
  • 🧩 Framework Agnostic - Works with React, vanilla JS, and other frameworks

Installation

npm install @wix/interact

Quick Start

1. Basic Setup

import { Interact } from '@wix/interact';

// Define your interaction configuration
const config = {
  interactions: [
    {
      trigger: 'viewEnter',
      key: '#my-element',
      effects: [
        {
          effectId: 'fade-in',
        }
      ]
    }
  ],
  effects: {
    'fade-in': {
      duration: 1000,
      keyframeEffect: {
        name: 'fade',
        keyframes: {opacity: [0, 1]}
      }
    }
  }
};

// Initialize the interact instance
const interact = Interact.create(config);

2. HTML Setup

<!-- Wrap your target element with interact-element -->
<interact-element data-interact-key="my-element">
  <div>This will fade in when it enters the viewport!</div>
</interact-element>

3. Framework Integration

React

import React from 'react';

function MyComponent() {
  return (
    <interact-element data-interact-key="my-element">
      <div className="animated-content">
        Hello, animated world!
      </div>
    </interact-element>
  );
}

Core Concepts

Triggers

Define when interactions should occur:

  • viewEnter - When element enters viewport
  • click - On element click
  • hover - On element hover
  • viewProgress - Based on scroll progress
  • pointerMove - On pointer/mouse movement
  • pageVisible - When page becomes visible
  • animationEnd - When another animation completes

Effects

Define what should happen:

  • Time-based animations - Duration-based effects with easing
  • Scroll-driven animations - Progress-based effects tied to scroll
  • Pointer-driven animations - Progress-based effects linked to pointer position
  • CSS transitions - Style property transitions
  • Custom effects - Integration with @wix/motion

Configuration Structure

{
  interactions: [    // Define trigger → effect relationships
    {
      trigger: 'viewEnter',
      key: 'source-element',
      effects: [{ effectId: 'my-effect' }]
    }
  ],
  effects: {         // Define reusable effect definitions
    'my-effect': {
      duration: 1000,
      keyframeEffect: {
        name: 'fade',
        keyframes: { opacity: [0, 1] }
      }
    }
  },
  conditions: {      // Define conditional logic
    'mobile-only': {
      type: 'media',
      predicate: '(max-width: 768px)'
    }
  }
}

API Reference

Interact Class

Static Methods

// Create a new instance with configuration
Interact.create(config: InteractConfig): Interact

// Get instance that handles a specific key
Interact.getInstance(key: string): Interact | undefined

// Get cached element by key
Interact.getElement(key: string): IInteractElement | undefined

Standalone Functions

// Add interactions to an element
add(element: IInteractElement, key: string): boolean

// Remove all interactions from an element
remove(key: string): void

Examples

Entrance Animation

{
  interactions: [{
    trigger: 'viewEnter',
    key: 'hero',
    effects: [{ effectId: 'slide-up' }]
  }],
  effects: {
    'slide-up': {
      duration: 800,
      easing: 'ease-out',
      keyframeEffect: {
        name: 'slide-up',
        keyframes: {
          transform: ['translateY(20px)', 'translateY(0)'],
          opacity: [0, 1]
        }
      }
    }
  }
}

Click Interaction

{
  interactions: [{
    trigger: 'click',
    key: 'button',
    effects: [{ effectId: 'bounce' }]
  }],
  effects: {
    'bounce': {
      duration: 600,
      namedEffect: {
        type: 'Bounce'
      }
    }
  }
}

Responsive Interactions

{
  interactions: [{
    trigger: 'hover',
    key: 'card',
    conditions: ['desktop-only'],
    effects: [{ effectId: 'lift' }]
  }],
  conditions: {
    'desktop-only': {
      type: 'media',
      predicate: '(min-width: 1024px)'
    }
  },
  effects: {
    'lift': {
      duration: 200,
      keyframeEffect: {
        name: 'lift',
        keyframes: {
          transform: ['translateY(0)', 'translateY(-8px)'],
          boxShadow: ['0 2px 4px rgb(0 0 0 / 0.1)', '0 8px 16px rgb(0 0 0 / 0.15)']
        }
      }
    }
  }
}

Documentation

AI Support

Development

# Install dependencies
yarn install

# Run tests
yarn test

# Run playground
yarn playground

# Build package
yarn build

Browser Support

  • ✅ Modern browsers with Web Components support
  • ⚠️ If using setting styles via JS in transition or transitionProerties - which use adoptedStyleSheets, browser support is: Chrome 73+, Firefox 101+, Safari 16.4+, Edge 79+

Related Packages

  • @wix/motion - Core animation engine
  • fizban - For polyfilling scroll-driven animations
  • kuliso - For polyfilling pointer-driven animations

Contributing

See CONTRIBUTING.md for guidelines on how to contribute to this package.

License

UNLICENSED - Internal Wix package