Skip to content

hesprs/pointeract

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

52 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ–±οΈπŸ€ lightweight, robust and extensible human gesture detector

CI Status Test Coverage Code Quality Documentation npm package library security package size LLM Optimization Typescript Made by Humans

Demo β€’ Documentation β€’ npm

What's Pointeract?

Pointeract is a tiny JavaScript/TypeScript utility library focusing on one thing - handling user interactions with DOM elements, e.g. multitouch and touchpad.

Powered by SynthKernel architecture, Pointeract has achieved a highly modular, extensible and efficient architecture. Its core bundle size is only 1KB minified + gzipped, functionalities come from also byte-sized modules. It's fully tree-shakable, the fewer modules you use, the smaller your bundle is.

Advantages

  • 🐣 Tiny: With base 1KB minified and gzipped, 1-2KB for normal usage.
  • πŸ’ͺ Robust: Excels at complex gestures where most interaction libraries fail, Why?
  • 🧩 Extensible: Extend Pointeract effortlessly via our module API.
  • πŸ”Œ Flexible during Runtime: Options are updated reactively. Stop/start any module during runtime.
  • πŸ›‘οΈ Safe: Not modifying the DOM (except the PreventDefault module). Meticulous clean up prevents memory leaks.

Get Started

Install Pointeract using your favorite package manager:

# npm
npm add pointeract

# pnpm
pnpm add pointeract

# yarn
yarn add pointeract

# bun
bun add pointeract

Or include the following lines directly in your HTML file:

<script type="module">
  import { Pointeract } from 'https://unpkg.com/pointeract';
</script>

This link ships the latest ESM version by default.

Then simply grab the core class and a module:

import { Pointeract, Drag } from 'pointeract';

new Pointeract({ element: yourElement }, [Drag])
    .start()
    .on('drag', e => console.log(e));

Congratulations! You can now press your mouse or finger to the element and move, the console will log events like a waterfall.

Read next: dive into the usage of Pointeract in Use Pointeract.

Currently Supported Features

  • Click (Double Click, Triple Click, Quadruple Click, Any Click)
  • Drag
  • Swipe (All directions, single / multiple fingers)
  • Pan and Zoom via Mouse Wheel (ctrl/shift key binding, touchpad support)
  • Pan and Zoom via Multitouch (Pan, Pinch)
  • One-line Prevent Default
  • Smooth Everything (drag / pan / zoom / any interaction involving numbers)

Those interactions are shipped via modules, which can be composed from a single drag-and-drop to a canvas app.

Missing your desired interaction? Write your own module!

It's the Age of Agents

Copy and paste the following prompt to OpenCode, Claude Code, Cursor or even a chat bot, replace the placeholder to your task, let it handle everything for you:

I'm using `pointeract`, a library to detect user gestures, which can be considered as a modern alternative to Hammer.js. Read the documentation and help me with my requirements.

**"Get Started" Page in Documentation Website**: https://pointeract.consensia.cc/get-started (fetch more internal links when needed)

**Requirements**:

<!-- your requirements here -->

JSON Canvas Viewer is also available on Context7 with an exceptionally high score of 94. If you're using it, you can skip the above prompt and simply ask the agent:

Query `pointeract` on Context7.

Or don't care about this at all, the agents are smart enough to search on Context7 themselves.

How Pointeract Stands Out?

There're already plenty of interaction libraries out there, most famous ones are D3 Drag + D3 Zoom, Interact.js and Hammer.js, but Pointeract is different.

Criteria Pointeract D3 Drag + D3 Zoom Hammer.js Interact.js
Written in TypeScript? βœ… ❌ ❌ βœ…
Tree-shakeable? βœ… ❌ ❌ ❌
Total Bundle Size (Minified + Gzipped) πŸ‘‘ 3KB 17KB 7KB 28KB
Last Updated πŸ‘‘ Actively Maintained 2021 2015 2023
Versatility Pointer and Wheel Related + Some Utils πŸ‘‘ Pointer and Wheel Related + Ecosystem Pointer Related Pointer Related + Comprehensive Utils
Support πŸ‘‘ Mouse, Mouse Wheel, Touch, and Touchpad ⚠️ No Touchpad Support ⚠️ No Touchpad or Mouse Wheel Support ⚠️ No Touchpad or Mouse Wheel Support
Robust (Passes Monkey Test) βœ… βœ… ❌ Element Jerks ❌ Element Ignores the Second Touch
Extensible? βœ… ❌ ❌ ❌

Get Involved

This project welcomes anyone that has ideas to improve it.

Copyright and License

Copyright ©️ 2025-2026 Hesprs (HeΜ„sperus) | Apache License 2.0

About

πŸ–±οΈπŸ€ A 3KB, tree-shakable, TypeScript-native human interaction library for robust tap/pan/zoom gestures β€” runtime-flexible and extensible.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Contributors