perf(vue): remove wheel gesture dependency
This commit is contained in:
parent
eb393db250
commit
9537f35a27
6
bun.lock
6
bun.lock
|
|
@ -27,7 +27,6 @@
|
|||
"@tauri-apps/plugin-shell": "^2.3.5",
|
||||
"@tauri-apps/plugin-updater": "^2.10.1",
|
||||
"@unhead/vue": "^2.1.10",
|
||||
"@use-gesture/vanilla": "^10.3.1",
|
||||
"@vueuse/core": "^14.2.1",
|
||||
"ai": "^6.0.174",
|
||||
"canvaskit-wasm": "^0.40.0",
|
||||
|
|
@ -172,7 +171,6 @@
|
|||
"dependencies": {
|
||||
"@nanostores/i18n": "^1.2.2",
|
||||
"@nanostores/vue": "^1.1.0",
|
||||
"@use-gesture/vanilla": "^10.3.1",
|
||||
"@vueuse/core": "^14.2.1",
|
||||
"nanostores": "^1.2.0",
|
||||
},
|
||||
|
|
@ -1158,10 +1156,6 @@
|
|||
|
||||
"@unhead/vue": ["@unhead/vue@2.1.12", "", { "dependencies": { "hookable": "^6.0.1", "unhead": "2.1.12" }, "peerDependencies": { "vue": ">=3.5.18" } }, "sha512-zEWqg0nZM8acpuTZE40wkeUl8AhIe0tU0OkilVi1D4fmVjACrwoh5HP6aNqJ8kUnKsoy6D+R3Vi/O+fmdNGO7g=="],
|
||||
|
||||
"@use-gesture/core": ["@use-gesture/core@10.3.1", "", {}, "sha512-WcINiDt8WjqBdUXye25anHiNxPc0VOrlT8F6LLkU6cycrOGUDyY/yyFmsg3k8i5OLvv25llc0QC45GhR/C8llw=="],
|
||||
|
||||
"@use-gesture/vanilla": ["@use-gesture/vanilla@10.3.1", "", { "dependencies": { "@use-gesture/core": "10.3.1" } }, "sha512-lT4scGLu59ovA3zmtUonukAGcA0AdOOh+iwNDS05Bsu7Lq9aZToDHhI6D8Q2qvsVraovtsLLYwPrWdG/noMAKw=="],
|
||||
|
||||
"@valibot/to-json-schema": ["@valibot/to-json-schema@1.6.0", "", { "peerDependencies": { "valibot": "^1.3.0" } }, "sha512-d6rYyK5KVa2XdqamWgZ4/Nr+cXhxjy7lmpe6Iajw15J/jmU+gyxl2IEd1Otg1d7Rl3gOQL5reulnSypzBtYy1A=="],
|
||||
|
||||
"@vercel/oidc": ["@vercel/oidc@3.2.0", "", {}, "sha512-UycprH3T6n3jH0k44NHMa7pnFHGu/N05MjojYr+Mc6I7obkoLIJujSWwin1pCvdy/eOxrI/l3uDLQsmcrOb4ug=="],
|
||||
|
|
|
|||
|
|
@ -56,7 +56,6 @@
|
|||
"@tauri-apps/plugin-shell": "^2.3.5",
|
||||
"@tauri-apps/plugin-updater": "^2.10.1",
|
||||
"@unhead/vue": "^2.1.10",
|
||||
"@use-gesture/vanilla": "^10.3.1",
|
||||
"@vueuse/core": "^14.2.1",
|
||||
"ai": "^6.0.174",
|
||||
"canvaskit-wasm": "^0.40.0",
|
||||
|
|
|
|||
|
|
@ -20,7 +20,10 @@
|
|||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"sideEffects": false,
|
||||
"files": ["dist", "README.md"],
|
||||
"files": [
|
||||
"dist",
|
||||
"README.md"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "bunx tsdown --config tsdown.config.ts",
|
||||
"prepack": "bun run build"
|
||||
|
|
@ -47,7 +50,6 @@
|
|||
"dependencies": {
|
||||
"@nanostores/i18n": "^1.2.2",
|
||||
"@nanostores/vue": "^1.1.0",
|
||||
"@use-gesture/vanilla": "^10.3.1",
|
||||
"@vueuse/core": "^14.2.1",
|
||||
"nanostores": "^1.2.0"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,29 +0,0 @@
|
|||
import { WheelGesture } from '@use-gesture/vanilla'
|
||||
import type { EventTypes, Handler, UserWheelConfig } from '@use-gesture/vanilla'
|
||||
import { watch, shallowRef, onScopeDispose } from 'vue'
|
||||
import type { Ref } from 'vue'
|
||||
|
||||
export function useWheelGesture(
|
||||
target: Ref<EventTarget | null>,
|
||||
handler: Handler<'wheel', EventTypes['wheel']>,
|
||||
config?: UserWheelConfig
|
||||
) {
|
||||
const gesture = shallowRef<WheelGesture | null>(null)
|
||||
|
||||
const stop = watch(
|
||||
target,
|
||||
(element) => {
|
||||
gesture.value?.destroy()
|
||||
gesture.value = element ? new WheelGesture(element, handler, config) : null
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
onScopeDispose(() => {
|
||||
stop()
|
||||
gesture.value?.destroy()
|
||||
gesture.value = null
|
||||
})
|
||||
|
||||
return gesture
|
||||
}
|
||||
|
|
@ -29,7 +29,6 @@ export default defineConfig({
|
|||
'canvaskit-wasm',
|
||||
'opentype.js',
|
||||
'@vueuse/core',
|
||||
'@use-gesture/vanilla',
|
||||
'@nanostores/vue',
|
||||
'@nanostores/i18n',
|
||||
'nanostores',
|
||||
|
|
|
|||
Loading…
Reference in a new issue