1.0.0-alpha.8 • Published 6 years ago

vue-composable v1.0.0-alpha.8

Weekly downloads
2,197
License
MIT
Repository
github
Last release
6 years ago

vue-composable

Coverage Status

bundle size

Vue 3

This version is alpha with support for the vue3 (vue-next)

Check webpack vue3 example or CodeSandbox

Introduction

vue-composable is out-of-box ready to use the brand new Vue 3 composition-api generic components.

100% typescript based composable components and full type support out-of-box.

This library aim is to be one stop shop for many real-world composable functions, with aggressive tree-shaking to keep it light on your end code.

vue-composable is composed by two package @vue-composable/core and @vue-composable/web.

Installing

# install with yarn
yarn add @vue/composition-api vue-composable

# install with npm
npm install @vue/composition-api vue-composable

Documentation

NOTE documentation might be slightly wrong, because it was built for the v2

Check our documentation

Event

  • Event - Attach event listener to a DOM element
  • Mouse Move - Attach mousemove listener to a DOM element
  • Resize - Attach resize listener to a DOM element
  • Scroll - Attach scroll listener to a DOM element

Date

  • useNow : Return reactive custom timer with specified refresh rate
  • useDateNow : Returns reactive Date.now() with custom refresh rate
  • usePerformanceNow : Returns reactive performance.now() with custom refresh rate

MISC

Storage

  • WebStorage - Reactive access to Storage API, useLocalStorage and useSessionStorage use this
  • storage - uses localStorage or on safari private it uses sessionStorage
  • localStorage - Reactive access to a localStorage
  • sessionStorage - Reactive access to a sessionStorage

Pagination

Promise

Web

External

New packages needed

Examples

Check out the examples folder or start hacking on codesandbox.

Edit Vue Composable Examples

NOTE

Currently only works with composition-api, when Vue3 gets release I will update to use the new reactive system (using @vue/reactivity)

For vue-next support please check @next

Usage

<template>
  <div>
    <p>page {{ currentPage }} of {{ lastPage }}</p>
    <p>
      <button @click="prev">prev</button>
      <button @click="next">next</button>
    </p>
    <ul>
      <li v-for="n in result" :key="n">
        {{ n }}
      </li>
    </ul>
  </div>
</template>

<script>
import { useArrayPagination } from "vue-composable";

export default {
  setup() {
    const array = new Array(1000).fill(0).map((_, i) => i);
    const { result, next, prev, currentPage, lastPage } = useArrayPagination(
      array,
      {
        pageSize: 3
      }
    );

    return { result, next, prev, currentPage, lastPage };
  }
};
</script>

Contributing

You can contribute raising issues and by helping out with code.

Tests and Documentation are the most important things for me, because good documentation is really useful!

I really appreciate some tweaks or changes on how the documentation is displayed and how to make it easier to read.

I really need an logo for this project, if you have a good idea for a logo, please enter in contact with me, you can find me on the Vue discord : @pikax

New composable

  1. Fork it!
  2. Create your feature branch: git checkout -b feat/new-composable
  3. Commit your changes: git commit -am 'feat(composable): add a new composable'
  4. Push to the branch: git push origin feat/new-composable
  5. Submit a pull request

License

MIT

1.0.0-beta.24

4 years ago

1.0.0-beta.23

4 years ago

1.0.0-beta.22

4 years ago

1.0.0-beta.21

4 years ago

1.0.0-beta.20

4 years ago

1.0.0-beta.19

4 years ago

1.0.0-beta.18

4 years ago

1.0.0-beta.17

4 years ago

1.0.0-beta.16

5 years ago

1.0.0-beta.15

5 years ago

1.0.0-beta.14

5 years ago

1.0.0-beta.13

5 years ago

1.0.0-beta.12

5 years ago

1.0.0-beta.11

5 years ago

1.0.0-beta.10

5 years ago

1.0.0-beta.9

5 years ago

1.0.0-beta.8

5 years ago

1.0.0-beta.6

5 years ago

1.0.0-beta.7

5 years ago

1.0.0-beta.5

5 years ago

1.0.0-beta.4

5 years ago

1.0.0-beta.3

5 years ago

1.0.0-beta.2

5 years ago

1.0.0-beta.1

5 years ago

1.0.0-alpha.37

5 years ago

1.0.0-dev.37

5 years ago

1.0.0-dev.36

5 years ago

1.0.0-alpha.36

5 years ago

1.0.0-alpha.35

5 years ago

1.0.0-dev.35

5 years ago

1.0.0-alpha.34

5 years ago

1.0.0-dev.34

5 years ago

1.0.0-dev.33

5 years ago

1.0.0-alpha.33

5 years ago

1.0.0-dev.32

5 years ago

1.0.0-alpha.32

5 years ago

1.0.0-alpha.31

5 years ago

1.0.0-dev.31

5 years ago

1.0.0-alpha.30

5 years ago

1.0.0-dev.30

5 years ago

1.0.0-alpha.29

5 years ago

1.0.0-dev.29

5 years ago

1.0.0-alpha.28

5 years ago

1.0.0-dev.28

5 years ago

1.0.0-alpha.27

5 years ago

1.0.0-dev.27

5 years ago

1.0.0-dev.26

5 years ago

1.0.0-alpha.26

5 years ago

1.0.0-alpha.25

5 years ago

1.0.0-alpha.24

5 years ago

1.0.0-dev.24

5 years ago

1.0.0-dev.23

5 years ago

1.0.0-dev.22

5 years ago

1.0.0-alpha.23

5 years ago

1.0.0-alpha.22

5 years ago

1.0.0-dev.21

5 years ago

1.0.0-dev.20

5 years ago

1.0.0-dev.19

5 years ago

1.0.0-dev.18

5 years ago

1.0.0-dev.17

5 years ago

1.0.0-dev.16

5 years ago

1.0.0-dev.15

5 years ago

1.0.0-dev.14

5 years ago

1.0.0-dev.13

5 years ago

1.0.0-dev.12

5 years ago

1.0.0-dev.11

5 years ago

1.0.0-dev.10

5 years ago

1.0.0-dev.9

6 years ago

1.0.0-alpha.8

6 years ago

1.0.0-dev.8

6 years ago

1.0.0-alpha.7

6 years ago

1.0.0-dev.7

6 years ago

1.0.0-dev.6

6 years ago

1.0.0-dev.4

6 years ago

1.0.0-dev.3

6 years ago

1.0.0-alpha.5

6 years ago

1.0.0-alpha.4

6 years ago

1.0.0-alpha.3

6 years ago

1.0.0-alpha.2

6 years ago

1.0.0-alpha.1

6 years ago

1.0.0-alpha.0

6 years ago

1.0.0-dev.2

6 years ago

1.0.0-dev.1

6 years ago

1.0.0-dev.0

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago