vue-composable
Introduction
vue-composable
is out-of-box ready to use composition-api generic components.
100% typescript based composable components and full type support out-of-box.
Built for vue-next and composition-api
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 3
Vue3 aka vue-next is supported on the @next
Installing
# @vue/composition-api
# install with yarn
yarn add @vue/composition-api vue-composable
# install with npm
npm install @vue/composition-api vue-composable
# vue-next / [email protected]
# install with yarn
yarn add [email protected]
# install with npm
npm install [email protected]
Documentation
Check our documentation
Composable
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
Format
Breakpoint
- MatchMedia - reactive
MatchMedia
- Breakpoint - reactive
breakpoints
based onwindow.innerWidth
- Chrome - reactive chrome breakpoints
- TailwindCSS - reactive TailwindCSS breakpoints
MISC
- sharedRef - cross-tab reactive
ref
- VModel - helper to wrap model update into a
ref
[vue3 only]
- injectFactory - same as inject but allows you to have a factory as default value
Storage
- WebStorage - Reactive access to
Storage API
,useLocalStorage
anduseSessionStorage
use this - storage - uses
localStorage
or on safari private it usessessionStorage
- localStorage - Reactive access to a
localStorage
- sessionStorage - Reactive access to a
sessionStorage
Pagination
- Pagination - Generic reactive pagination controls
- Array Pagination - Array pagination
Validation
- Validation - model based validation inspired by vuelidate
i18n
Intl
- numberFormat - Intl.NumberFormat
- currencyFormat - CurrencyFormat with Intl.NumberFormat
Promise
- Promise -
Promise
reactive resolve and reject - promiseLazy - Sugar for usePromise
lazy:true
- Cancellable Promise - Allow to cancel promises
- Retry - Provides functionality to retry
promise
Meta
- Title - reactive
document.title
Web
- Fetch - reactive
fetch
wrapper - WebSocket - reactive
WebSocket
wrapper - IntersectionObserver - reactive
IntersectionObserver
- NetworkInformation - reactive
NetworkInformation
wrapper - Online - reactive
navigator.onLine
wrapper - PageVisibility - reactive
Page Visibility API
- Language - reactive
NavigatorLanguage
- BroadcastChannel - reactive
BroadcastChannel API
- Geolocation API
- CSS variables - reactive
CSS variables
- Worker -
Web Worker API
- WorkerFunction - Webworker Function, offload a function to webworker
- share - WebShare API
External
New packages needed
- Axios - @vue-composable/axios reactive
axios
wrapper client - makeAxios - @vue-composable/makeAxios wrap your
axios
instance
Information
This is a monorepo project, please check packages
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
Twitter: @pikax_dev
Build
# install packages
yarn
# build and test for v2
yarn build --version=2
yarn test:vue2
# build and test for v3
yarn build
yarn test
New composable
- Fork it!
- Create your feature branch:
git checkout -b feat/new-composable
- Commit your changes:
git commit -am 'feat(composable): add a new composable'
- Push to the branch:
git push origin feat/new-composable
- Submit a pull request