Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
run: pnpm install

- name: Build Docs
run: pnpm docs:build
run: pnpm build -F docs

- name: Deploy (push to main)
uses: JamesIves/github-pages-deploy-action@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-routine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ jobs:
run: pnpm check

- name: Run test build
run: pnpm build
run: pnpm build -F "!docs"
6 changes: 2 additions & 4 deletions .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ on:
branches: [main]
types: [opened, synchronize, reopened, ready_for_review]
paths:
- src/**
- test/**
- packages/**
push:
branches: [main]
paths:
- src/**
- test/**
- packages/**
workflow_dispatch:

concurrency:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
run: pnpm install

- name: Build
run: pnpm build
run: pnpm build -F "!docs"

- name: Publish to npm
run: pnpm publish --no-git-checks
run: pnpm publish -r --no-git-checks
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
node_modules

# dot files
.cursor
.continue
.vscode

# generated files
Expand All @@ -20,6 +18,7 @@ coverage

# cache
.cache
.turbo
docs/.vitepress/cache

# dist
Expand Down
3 changes: 2 additions & 1 deletion .oxfmtrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@
"useTabs": false
}
}
]
],
"ignorePatterns": ["**/node_modules/**", "**/dist/**"]
}
2 changes: 1 addition & 1 deletion .oxlintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,5 @@
"builtin": true
},
"globals": {},
"ignorePatterns": []
"ignorePatterns": ["**/node_modules/**", "**/dist/**"]
}
10 changes: 3 additions & 7 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { resolve } from 'node:path';
import { createP } from '@repo/shared';
import { defineConfig } from 'vitepress';
import { groupIconMdPlugin, groupIconVitePlugin } from 'vitepress-plugin-group-icons';
import { ThemeConfig } from 'vitepress-theme-trito';

const inDev = process.env.MODE === 'dev';
const p = createP(import.meta.url);

export default defineConfig<ThemeConfig>({
cleanUrls: true,
Expand Down Expand Up @@ -115,12 +116,7 @@ export default defineConfig<ThemeConfig>({
},
vite: {
plugins: [groupIconVitePlugin() as never], // legacy plugin cannot adapt vite 8
publicDir: resolve(__dirname, '../public'),
resolve: {
alias: {
'@': resolve(__dirname, '..', '..', 'src/'),
},
},
publicDir: p('../public'),
ssr: {
noExternal: ['vitepress-theme-trito'],
},
Expand Down
8 changes: 6 additions & 2 deletions docs/components/playground.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@ import {
lubricatorDragPreset as drag,
lubricatorPanPreset as pan,
lubricatorZoomPreset as zoom,
} from '@';
} from 'pointeract';
import { onMounted, reactive, useTemplateRef, onBeforeUnmount } from 'vue';
import { Coordinates } from '@/types';

type Coordinates = {
x: number;
y: number;
};

function C2C(coords: Coordinates) {
return {
Expand Down
4 changes: 2 additions & 2 deletions docs/en/development/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ Pointeract obeys the test requirements as follows:

## Monkey Test

One great feature of Pointeract that we are proud of is its robustness which exceeds most competitors. The following test is an example:
Here's the proof why Pointeract claims itself robust:

<<< ../../../tests/integration.test.ts#monkey-test
<<< ../../../packages/core/tests/integration.test.ts#monkey-test

The interaction denoted by the code is visualized as follows:

Expand Down
25 changes: 25 additions & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "docs",
"version": "0.0.1",
"private": true,
"type": "module",
"scripts": {
"lint": "oxlint --type-aware --fix && oxfmt",
"check": "vue-tsc && oxfmt --check && oxlint --type-aware",
"dev": "MODE=dev vitepress dev",
"build": "MODE=prod vitepress build",
"preview": "MODE=prod vitepress preview"
},
"dependencies": {
"pointeract": "workspace:*",
"vitepress": "2.0.0-alpha.17",
"vitepress-plugin-group-icons": "^1.7.3",
"vitepress-theme-trito": "^1.1.1",
"vue": "^3.5.31"
},
"devDependencies": {
"@repo/shared": "workspace:*",
"vue-tsc": "^3.2.6"
},
"packageManager": "pnpm@10.29.3"
}
7 changes: 7 additions & 0 deletions docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"types": ["node"]
},
"include": ["./**/*.ts", "./**/*.vue"]
}
64 changes: 11 additions & 53 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,51 +1,14 @@
{
"name": "pointeract",
"version": "1.2.0",
"description": "A 3KB, tree-shakable, TypeScript-native human interaction library for robust tap/pan/zoom gestures — runtime-flexible and extensible.",
"keywords": [
"frontend",
"gesture-detection",
"lightweight",
"pan-zoom",
"typescript"
],
"homepage": "https://pointeract.consensia.cc",
"bugs": {
"url": "https://github.com/hesprs/pointeract/issues"
},
"license": "Apache-2.0",
"author": {
"name": "Hēsperus",
"email": "hesprs@outlook.com"
},
"repository": {
"type": "git",
"url": "git+https://github.com/hesprs/pointeract.git"
},
"files": [
"dist"
],
"name": "monorepo-pointeract",
"private": true,
"type": "module",
"sideEffects": false,
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"unpkg": "./dist/index.js",
"jsdelivr": "./dist/index.js",
"publishConfig": {
"access": "public",
"provenance": true
},
"scripts": {
"build": "vite build && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
"test": "vitest run",
"lint": "oxlint --type-aware --fix && oxfmt",
"test:coverage": "vitest run --coverage",
"check": "vue-tsc && oxfmt --check && oxlint --type-aware",
"dev": "vite",
"docs:dev": "MODE=dev vitepress dev docs",
"docs:build": "MODE=prod vitepress build docs",
"docs:preview": "MODE=prod vitepress preview docs"
"build": "turbo run build",
"test": "turbo run test",
"lint": "turbo run lint",
"test:coverage": "turbo run test:coverage",
"check": "turbo run check",
"dev": "turbo run dev"
},
"devDependencies": {
"@types/node": "^25.5.0",
Expand All @@ -54,16 +17,11 @@
"oxfmt": "^0.43.0",
"oxlint": "^1.58.0",
"oxlint-tsgolint": "^0.19.0",
"terser": "^5.46.1",
"tsc-alias": "^1.8.16",
"tsdown": "^0.21.7",
"turbo": "^2.9.3",
"typescript": "^6.0.2",
"vite": "^8.0.3",
"vitepress": "2.0.0-alpha.17",
"vitepress-plugin-group-icons": "^1.7.3",
"vitepress-theme-trito": "^1.1.1",
"vitest": "^4.1.2",
"vue": "^3.5.31",
"vue-tsc": "^3.2.6"
"vitest": "^4.1.2"
},
"packageManager": "pnpm@10.29.3"
}
78 changes: 78 additions & 0 deletions packages/core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<h1 align="center">
Pointeract
<br>
</h1>

<h4 align="center"> 🖱️🤏 lightweight, robust and extensible human gesture detector </h4>

<p align="center">
<a href="https://pointeract.consensia.cc/playground">
<strong>Demo</strong>
</a> •
<a href="https://pointeract.consensia.cc">
<strong>Documentation</strong>
</a> •
<a href="https://www.npmjs.com/package/pointeract">
<strong>npm</strong>
</a>
</p>

## Get Started

Install Pointeract using your favorite package manager:

```sh
# 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:

```html
<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:

```TypeScript
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](https://pointeract.consensia.cc/basic/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](https://pointeract.consensia.cc/development/custom-modules)!

## Copyright and License

Copyright ©️ 2025-2026 Hesprs (Hēsperus) | [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0.html)
51 changes: 51 additions & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"name": "pointeract",
"version": "1.2.0",
"description": "A 3KB, tree-shakable, TypeScript-native human interaction library for robust tap/pan/zoom gestures — runtime-flexible and extensible.",
"keywords": [
"frontend",
"gesture-detection",
"lightweight",
"pan-zoom",
"typescript"
],
"homepage": "https://pointeract.consensia.cc",
"bugs": {
"url": "https://github.com/hesprs/pointeract/issues"
},
"license": "Apache-2.0",
"author": {
"name": "Hēsperus",
"email": "hesprs@outlook.com"
},
"repository": {
"type": "git",
"url": "git+https://github.com/hesprs/pointeract.git"
},
"files": [
"dist"
],
"type": "module",
"sideEffects": false,
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"unpkg": "./dist/index.js",
"jsdelivr": "./dist/index.js",
"publishConfig": {
"access": "public",
"provenance": true
},
"scripts": {
"build": "tsdown",
"test": "vitest run",
"lint": "oxlint --type-aware --fix && oxfmt",
"test:coverage": "vitest run --coverage",
"check": "oxfmt --check && oxlint --type-aware",
"dev": "vite"
},
"devDependencies": {
"@repo/shared": "workspace:*"
},
"packageManager": "pnpm@10.29.3"
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions packages/core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"paths": {
"@/*": ["./src/*"],
"@": ["./src"]
}
},
"include": ["./**/*.ts"]
}
14 changes: 14 additions & 0 deletions packages/core/tsdown.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { defineConfig } from 'tsdown';

export default defineConfig({
entry: 'src/index.ts',
dts: {
eager: true,
},
minify: true,
sourcemap: true,
outExtensions: () => ({
js: '.js',
dts: '.d.ts',
}),
});
Loading
Loading