@tikitaki_gagarinbefree/vue

vue rendering adapter for the TikiTaki swipe engine
Install
npm install @tikitaki_gagarinbefree/vue
Latest Version:0.1.14
Vue:3
License:MIT
Last Updated:Oct 26, 2026
Links: GitHub  ·  npm
Maintainer: gagarinbefree

@tikitaki_gagarinbefree/vue

A functional Vue 3 adapter for TikiTaki. ESM, strict TypeScript, MIT licensed. Peer dependencies: the compatible tikitaki version declared in package.json and vue@^3.5.44. The core package has no Vue dependency.

Usage

Create one bridge inside <script setup> and render its cells with <Teleport> in the same application. Teleport preserves provide/inject, application context, and component state. No per-cell applications are created.

<script setup lang="ts">
import { onMounted, onBeforeUnmount, shallowRef, watch } from 'vue';
import type { Grid } from 'tikitaki';
import { createSwipeEngine, type SwipeEngine } from 'tikitaki/dom';
import { createVueCellAdapter } from '@tikitaki_gagarinbefree/vue';

const props = defineProps<{ readonly grid: Grid<string> }>();
const container = shallowRef<HTMLElement | null>(null);
const engine = shallowRef<SwipeEngine<string> | null>(null);
const bridge = createVueCellAdapter<string>();
const cells = bridge.cells;
onMounted(() => {
  if (!container.value) return;
  engine.value = createSwipeEngine({ container: container.value, grid: props.grid, adapter: bridge.adapter });
});
watch(
  () => props.grid,
  (grid) => engine.value?.updateGrid(grid),
);
onBeforeUnmount(() => {
  engine.value?.destroy();
  engine.value = null;
});
</script>

<template>
  <div ref="container" style="height: 100dvh" />
  <Teleport v-for="cell in cells" :key="cell.key" :to="cell.host">
    <button>{{ cell.item }}</button>
  </Teleport>
</template>

Keep the controller in shallowRef; deep proxying a stateful resource is unnecessary. Replace the grid array or call updateGrid explicitly. The bridge uses a readonly shallow ref of immutable snapshots, so hosts and user-owned items do not become proxies. Surviving hosts retain their keys; removed cells release their component lifecycle.

The framework owns host descendants. Keep framework children out of the managed container and render component content inside the template Teleports. Put hooks in child components. Supply container dimensions through application CSS and destroy the controller during cleanup.

Core promises synchronize hosts and adapter snapshots; await nextTick when asserting Vue content. Handle component failures through onErrorCaptured or the application's error handler and controller failures through promises or onError. Create the DOM controller on the client in onMounted. Ownership validation messages are centralized in src/config.ts.

Related Packages

vue-swipe-directive

vue swipe事件的实现, 特点是lock机制, 轻松实现和滚动互斥关系

1,082 6
vue-swipe

A touch slider for vue.js.

22,780 909
vue3-hand-mobile

Vue mobile gesture action event.

5,464
vue3-touch-events

Simple touch events support for vue.js 3

3,210,829 344
vue2-touch-events

Simple touch events support for vueJS2

1,398,605 540

Version History

Version Released Vue License
0.1.14 ^3.5.44 MIT
0.1.13 ^3.5.44 MIT
0.1.12 ^3.5.44 MIT
0.1.11 ^3.5.44 MIT
0.1.10 ^3.5.44 MIT
Pre-releases (1)
Version Released License
0.0.0-stage