watching-you is a free, open source design & prototyping project written in TypeScript and released under ISC. It has 1,706 GitHub stars, 54 forks and 17 open issues, and was last pushed 9 months ago. On this registry it ranks #82 of 110 tracked projects in Design & Prototyping, with 5 head-to-head comparisons available.

What is watching-you?

watching-you is a zero-dependency JavaScript and TypeScript library for building browser animations in which one DOM element continuously follows the mouse, another DOM element, or even an input value, aimed at front-end developers working in vanilla JavaScript, React or Vue.

What it is

watching-you is a client-side animation library that lives in the browser DOM ecosystem. It is written in TypeScript and published under the ISC licence, with a small core and separate framework packages: core for vanilla JavaScript, react and vue. Every framework build is dependency-free, and the core code is only about 3kb after gzip compression.

The concrete problem it solves is the glue code normally required to make an element track something else on the page. Instead of writing custom, framework-specific tracking logic for every project, a developer describes what should be watched โ€” the mouse, another DOM element, or an input value โ€” and the library handles the animation. Because the approach is DOM-based, responsive layouts are supported naturally rather than being a special case, and the library automatically stops watching when the element is not on the screen. That makes it a replacement for hand-rolled, per-framework tracking code in front-end work.

Key capabilities

  • Watches the mouse, another DOM element, or input values, so the thing being followed is not limited to the cursor.
  • Ships matching packages for three targets: core for vanilla JavaScript, react, and vue.
  • Has zero dependencies in every framework build, with core code around 3kb after gzip compression.
  • Is written in TypeScript throughout.
  • Is DOM-based, which the project describes as making responsive web design support easy.
  • Automatically stops watching when the element leaves the screen.
  • Can be used without any compiler through the UMD build watching-you.umd.cjs, available from the jsDelivr CDN.

Who uses it and how

  • Teams running vanilla JavaScript or WordPress sites can import the UMD build from the jsDelivr CDN and use watching-you directly, with no build step at all.
  • React and Vue applications use the dedicated packages, which carry the same concept into each framework's component model.
  • The project's Storybook, built with React, acts as a working reference that other frameworks can reproduce; it demonstrates examples named Login Form, Iron Chain, "Cena is watching you" and Svg Path Watcher.
  • Projects that need older browser coverage can add Babel with polyfills to reach IE11, below the default baseline of Chrome 70+, Firefox 73+, Safari 14.1+, Edge 80+ and Opera 70+.
  • Sites with responsive layouts benefit from the DOM-based design, since the animation follows the rendered element rather than fixed coordinates.

Getting started

Use the core package for vanilla JavaScript or the react and vue packages, or import the UMD build watching-you.umd.cjs straight from the jsDelivr CDN when no compiler is available. Documentation for each package is linked from the project homepage and the Storybook.

How it compares

No comparable or paid products are named in the facts for this entry, so watching-you stands alone in this registry. It is an ISC-licensed, zero-dependency browser library rather than a hosted service, so there is no vendor, subscription or data-handling relationship to weigh against alternatives.

When to use it โ€” and when not to

Because it is a zero-dependency, DOM-based browser library, there is no database, storage or mail service to operate; the trade-off is that everything happens client-side and depends on the browser features listed in the compatibility table. The project warns that the API is still subject to change until version 1.0.0 is released, so teams that need a frozen, long-stable interface should wait. There are also practical constraints: when watching an input or textarea the text-align attribute must be left, inline elements such as span ignore transform unless given a display value, and a transition: transform .1s may be needed depending on the effect.

project readme (upstream, from github) โ€” read inline
watching-you

npm version deploy-page npm-publish-core npm-publish-react npm-publish-vue

watching your mouse watching your input value

Features

  • Be able to watch the mouse or another DOM, or even input values, watch anything you want!
  • Because it is DOM-based, it is easy to support RWD
  • Supports multiple frameworks
  • Zero dependency (every framework is!)
  • Written in typescript
  • The size of the core code is only 3kb after gzip compression
  • If the element is not on the screen, it will automatically stop watching

Example

The source code can be found here

Storybook

watching-you's storybook using react, but every framework can do the same thing!

https://jj811208.github.io/watching-you/storybook

Documents

โš ๏ธ The API is still subject to change until version 1.0.0 is released โš ๏ธ

Compatibility

If you use watching-you directly without any compiler(babel), (e.g. Wordpress project using CDN import watching-you)

Chrome Firefox Safari Edge Opera iOS Safari/Chrome Android Chrome
Supported 70+ 73+ 14.1+ 80+ 70+ 14.1+ โœ”

But if you use a compiler like babel and import polyfill, it can even support IE11

Some references:
https://babeljs.io/
https://github.com/vitejs/vite/tree/main/packages/plugin-legacy

Note

Contributing

see

License

ISC

Frequently asked questions

Is watching-you free to use?

watching-you is open source under the ISC licence. There is no licence fee and no seat count โ€” you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does watching-you do?

watching-you is a javascript library for building animations that watch anything on DOM ๐Ÿ‘€.

What is watching-you written in?

watching-you is primarily written in TypeScript. Its source is publicly available at https://github.com/jj811208/watching-you, and it has 1,706 GitHub stars.