# potiah

> Vue wrapper for precious Locomotive Scroll

Latest version **1.0.0-alpha.1** (published 2023-12-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install potiah
pnpm add potiah
yarn add potiah
bun add potiah
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0-alpha.1 |
| Published | 2023-12-06 |
| First published | 2023-12-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 184.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Dmytro Tkachenko |
| Maintainers | somespecialone |
| Keywords | typescript, vue, vue3, component, scroll, locomotive-scroll, lenis |

## Links

- npm: https://www.npmjs.com/package/potiah
- Repository: https://github.com/somespecialone/potiah
- Homepage: https://potiah.somespecial.one
- Issues: https://github.com/somespecialone/potiah/issues
- npm.io page: https://npm.io/package/potiah

## Dependencies (1)

- [locomotive-scroll](https://npm.io/package/locomotive-scroll.md) 5.0.0-beta.11

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.0.0-alpha.1 (latest) — 2023-12-06

## README

<p align="center">
  <a href="https://potiah.somespecial.one" target="_blank" rel="noopener noreferrer">
    <img width="240" src="https://raw.githubusercontent.com/somespecialone/potiah/main/docs/public/logo.svg" alt="potiah logo">
  </a>
  <h1 align="center">Potiah</h1>
</p>

[![Made in Ukraine](https://img.shields.io/badge/made_in-ukraine-ffd700.svg?labelColor=0057b7)](https://stand-with-ukraine.pp.ua)
[![license](https://img.shields.io/github/license/somespecialone/potiah)](https://github.com/somespecialone/potiah/blob/main/LICENSE)
[![npm](https://img.shields.io/npm/v/potiah)](https://www.npmjs.com/package/potiah)
[![npm bundle size](https://img.shields.io/bundlephobia/minzip/potiah)](https://bundlephobia.com/package/potiah)
[![Docs](https://github.com/somespecialone/potiah/actions/workflows/docs.yml/badge.svg)](https://github.com/somespecialone/potiah/actions/workflows/docs.yml)
[![Publish](https://github.com/somespecialone/potiah/actions/workflows/publish.yml/badge.svg)](https://github.com/somespecialone/potiah/actions/workflows/publish.yml)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat)](https://github.com/prettier/prettier)
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz_small.svg)](https://stackblitz.com/github/somespecialone/potiah/tree/main/playground/?file=src%2Fpages%2FHomeRoute.vue&title=Potiah%20Playground)

_Potiah_ (pronounced `/pot'jʌɦ/`, means _train_ in Ukrainian) is a thin [Vue.js](https://vuejs.org) wrapper for
precious [Locomotive Scroll](https://github.com/locomotivemtl/locomotive-scroll) 🚂.

> _"It utilizes native `Vue` features such as components and composables to give maximum control over `LocomotiveScroll`
> API to developer and make it easier to integrate it into a `Vue` app."_
>
> &ndash; ChatGPT

* [Documentation 📖](https://potiah.somespecial.one)

* [Online playground ✨](https://stackblitz.com/github/somespecialone/potiah/tree/main/playground/?file=src%2Fpages%2FHomeRoute.vue&title=Potiah%20Playground)

---

⚠️ The project is unstable and depends
on [Locomotive Scroll v5 beta](https://github.com/locomotivemtl/locomotive-scroll/tree/v5-beta).
So there might be some breaking changes in the future unless stable (first major) version is released. Best regards!

---

## Installation

### Bundler / package manager

```sh
npm install potiah
```

```sh
pnpm add potiah
```

```sh
yarn add potiah
```

### Direct Download / CDN

Specified version

```html
<script src="https://unpkg.com/potiah@1.0.0-alpha.1"></script>
```

Latest

```html
<script src="https://unpkg.com/potiah"></script>
```

❗ Also note, that you need to load [lenis styles](https://github.com/studio-freight/lenis#considerations) from CDN too

```html
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/locomotive-scroll@beta/bundled/locomotive-scroll.css">
```

## Basic usage

### Setup plugin

```js
import 'locomotive-scroll/locomotive-scroll.css' // if you install trough package manager  
import { createPotiah } from 'potiah'

import App from './App.vue'

const app = createApp(App)

app.use(createPotiah())
app.mount('#app')
```

### Create view

```vue
<script setup lang="ts">
import { ScrollView } from 'potiah'
</script>

<template>
  <ScrollView root :duration="1.7">
    <!-- your components/content-->
  </ScrollView>
</template>
```

### Place scroll components

```vue
<script setup lang="ts">
import { ScrollView, ScrollComponent } from 'potiah'
</script>

<template>
  <ScrollView root :duration="1.7">
    <ScrollComponent class="first-scroll-component" :speed="0.2" css-progress>
      <!-- your components/content-->
    </ScrollComponent>
    <!-- your components -->
  </ScrollView>
</template>
```

### Use composable

```vue
<script setup lang="ts">
import { usePotiah } from 'potiah'

const { scrollTo } = usePotiah()

// example
function handleClickOnSomeElement({target}) {
  scrollTo(target)
}
</script>
```

## Core

* `Potiah` - 🚂.
* `<ScrollView />` - wrapper for scrollable scene. It can be whole document or any container element inside the DOM.
* `<ScrollComponent />` - `scroll element` within scroll scene. It gathers all `data-*`
  attributes from [Locomotive Scroll element](https://scroll.locomotive.ca/docs/#/attributes).
* `usePotiah` - composable that returns current `Potiah` instance, `scrollTo` function, refs with scroll data.

> For more information please visit [Documentation 📖](https://potiah.somespecial.one)

## Credits:
* [Locomotive Scroll](https://github.com/locomotivemtl/locomotive-scroll)
* [Lenis](https://github.com/studio-freight/lenis)
* Train from logo - [Aslan Almukhambetov](https://dribbble.com/reggid) CC Attribution License via [SVG Repo](https://www.svgrepo.com/)

---
_Source: https://npm.io/package/potiah · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
