Skip to content

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

License

Notifications You must be signed in to change notification settings

hesprs/pointeract

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

44 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

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

CI Status Test Coverage Code Quality Documentation npm package library security package size 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
  • 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!

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 2

  •  
  •