MCPcopy Index your code
hub / github.com/simonwep/viselect

github.com/simonwep/viselect @v3.9.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v3.9.0 ↗ · + Follow
80 symbols 165 edges 26 files 12 documented · 15% updated 4mo agov3.9.0 · 2025-01-16★ 2,9468 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Logo

Visual dom-selection library

<a href="https://choosealicense.com/licenses/mit/"><img
    alt="License MIT"
    src="https://img.shields.io/badge/license-MIT-ae15cc.svg"></a>
<img alt="No dependencies"
    src="https://img.shields.io/badge/dependencies-none-8115cc.svg">
<a href="https://github.com/sponsors/Simonwep"><img
    alt="Support me"
    src="https://img.shields.io/badge/github-support-6a15cc.svg"></a>
<img alt="version" src="https://img.shields.io/github/lerna-json/v/Simonwep/selection?color=%233d24c9&label=version">
<a href="https://www.buymeacoffee.com/aVc3krbXQ"><img
    alt="Buy me a coffee"
    src="https://img.shields.io/badge/%F0%9F%8D%BA-buy%20me%20a%20beer-%23FFDD00"></a>
<a href="https://github.com/Simonwep/selection/actions?query=workflow%3ACI"><img
    alt="Build Status"
    src="https://github.com/Simonwep/selection/workflows/CI/badge.svg"></a>
<img alt="gzip size" src="https://img.badgesize.io/https://cdn.jsdelivr.net/npm/@viselect/vanilla/dist/viselect.umd.js?compression=gzip">
<img alt="brotli size" src="https://img.badgesize.io/https://cdn.jsdelivr.net/npm/@viselect/vanilla/dist/viselect.umd.js?compression=brotli">
<a href="https://v3.vuejs.org"><img
    alt="Vue support"
    src="https://img.shields.io/badge/✔-vue-%2340B581"></a>
<a href="https://preactjs.com/"><img
    alt="Preact support"
    src="https://img.shields.io/badge/✔-preact-%236337B1"></a>
<a href="https://reactjs.org"><img
    alt="React support"
    src="https://img.shields.io/badge/✔-react-%2359D7FF"></a>
<a href="https://svelte.dev"><img
    alt="Svelte support"
    src="https://img.shields.io/badge/%E2%9A%99-svelte-%23F83C00"></a>

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 :)

Extension points exported contracts — how you extend this code

SelectionAreaProps (Interface)
(no doc)
packages/react/src/SelectionArea.tsx
ScrollEvent (Interface)
(no doc)
packages/vanilla/src/types.ts
SelectionAreaProps (Interface)
(no doc)
packages/preact/src/SelectionArea.tsx
ChangedElements (Interface)
(no doc)
packages/vanilla/src/types.ts
SelectionStore (Interface)
(no doc)
packages/vanilla/src/types.ts
SelectionEvent (Interface)
(no doc)
packages/vanilla/src/types.ts
Coordinates (Interface)
(no doc)
packages/vanilla/src/types.ts

Core symbols most depended-on inside this repo

_emitEvent
called by 12
packages/vanilla/src/index.ts
css
called by 8
packages/vanilla/src/utils/css.ts
selectAll
called by 6
packages/vanilla/src/utils/selectAll.ts
clearSelection
called by 5
packages/vanilla/src/index.ts
simplifyEvent
called by 4
packages/vanilla/src/utils/events.ts
_onTapMove
called by 3
packages/vanilla/src/index.ts
resolveSelectables
called by 3
packages/vanilla/src/index.ts
arrayify
called by 3
packages/vanilla/src/utils/arrayify.ts

Shape

Method 37
Function 26
Interface 13
Class 4

Languages

TypeScript100%

Modules by API surface

packages/vanilla/src/index.ts34 symbols
packages/vanilla/src/types.ts10 symbols
packages/vanilla/src/EventEmitter.ts6 symbols
packages/vanilla/src/utils/frames.ts4 symbols
packages/react/demo/index.tsx4 symbols
packages/preact/demo/index.tsx4 symbols
packages/react/src/SelectionArea.tsx3 symbols
packages/preact/src/SelectionArea.tsx3 symbols
packages/vanilla/src/utils/events.ts2 symbols
packages/vanilla/src/utils/domRect.ts2 symbols
packages/vanilla/src/utils/css.ts2 symbols
packages/vanilla/src/utils/browser.ts2 symbols

Dependencies from manifests, versioned

@eslint/js9.17.0 · 1×
@preact/preset-vite2.9.3 · 1×
@types/node22.10.5 · 1×
@types/react19.0.2 · 1×
@types/react-dom19.0.2 · 1×
@typescript-eslint/eslint-plugin8.19.0 · 1×
@viselect/reactworkspace:* · 1×
@viselect/vanillaworkspace:* · 1×
@vitejs/plugin-react4.3.4 · 1×
@vitejs/plugin-vue5.2.1 · 1×
@vue/compiler-sfc3.5.13 · 1×

For agents

$ claude mcp add viselect \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact