Selection

Selection - A simple and lightweight library to realize visual DOM Selections. No jQuery. Supports any CSS library
GitHub
2.51k
Created 6 years ago, last commit 15 days ago
26 contributors
503 commits
Stars added on GitHub, month by month
10
11
12
1
2
3
4
5
6
7
8
9
2023
2024
Stars added on GitHub, per day, on average
Yesterday
=
Last week
+0.4
/day
Last month
+0.5
/day
Last 12 months
+0.8
/day
Package on NPM
Monthly downloads on NPM
10
11
12
1
2
3
4
5
6
7
8
9
2023
2024
No dependencies
README

Logo

Visual dom-selection library

License MIT No dependencies Support me version Buy me a coffee Build Status gzip size brotli size Vue support Preact support React support Svelte support

Features 🤘

  • 🌟 Modern bundle
  • 🔩 Ultra tiny (~4kb)
  • 👌 Simple usage
  • âš¡ Highly optimized
  • ✔ Zero dependencies
  • 📱 Mobile / touch support
  • 🖱 Vertical and horizontal scroll support
  • 💪 Hardened (over 3 years old and used in many apps)
  • 🖼 Support for major frameworks (WIP)

Getting started

Check out the documentation for the package you want to use:

Check out recipes for commonly asked questions and how to solve them using the standard library! For information about events and more check out the vanilla readme!

Browser support

This library will always produce an ESNext bundle. If you want to support legacy browsers, please use the feature of your bundler to transpile dependencies. In case of webpack and babel (give vite a try, it's awesome) you'll have to install corresponding plugins such as babel-plugin-proposal-optional-chaining and include the dependency from node_modules which is normally entirely excluded from being processed.

I do this to provide maximum flexibility and give those who target ESNext a chance to make full use of how this library is bundled. Everything else is just a matter of configuration :)

Is this library the right choice for me?

Viselect primarily focuses on being a high-performant engine to select elements with various boundaries, behaviors, and modes in your browser. Viselect is to "full-blown libraries" what is popper.js to tippy.js - the core of your feature.

Development

Use the following commands to work on this locally (we use lerna to manage this):

  • npm run dev - Spawns a dev-server for all packages. Every framework-dependent package is bundled with the vanilla version.
  • npm run build - Builds all packages in parallel.
  • npm run lint:fix - Lints and fixes all errors in all packages.

For the development servers vite is used. It's superb, you should give it a try. To bundle it, we use rollup (which is btw also used by vite behind the scenes) to have full control over how the bundle looks like.

Releasing a new version

This project is managed via lerna. To bump the version and publish a new one run the following commands:

  • lerna version
  • lerna publish from-package

You want to contribute?

That's awesome! Check out the contribution guidelines to get started :)