Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
@vueuse/core
Advanced tools
The @vueuse/core package is a collection of essential Vue Composition API utilities that help with a wide range of common application needs, from state management to utilities for handling side effects. It's designed to work seamlessly with Vue 3, leveraging the Composition API to make building and managing Vue applications easier and more intuitive.
State Management
This feature allows you to easily synchronize a reactive state with localStorage, enabling persistent state across page reloads. The example demonstrates how to store and retrieve user settings.
import { ref } from 'vue'
import { useLocalStorage } from '@vueuse/core'
const userSettings = useLocalStorage('user-settings', { theme: 'dark', notifications: true })
Sensor Utilities
Sensor utilities provide reactive access to browser sensors like mouse position. The example shows how to track the mouse position on the screen.
import { useMouse } from '@vueuse/core'
const { x, y } = useMouse()
Animation
This feature enables easy setup of interval-based side effects, useful for animations or regular data fetching. The code sample demonstrates setting up a simple interval that logs a message every second.
import { useIntervalFn } from '@vueuse/core'
const { pause, resume } = useIntervalFn(() => console.log('Tick'), 1000)
Vue-composable is similar to @vueuse/core, offering a set of composable utilities for Vue. While it covers many of the same areas as @vueuse/core, such as state management and sensor utilities, it has its own unique set of composables and might be preferred for certain use cases.
Vuelidate provides Vue applications with model-based validation. While it focuses specifically on form validation, rather than a broad range of utilities like @vueuse/core, it's a powerful tool for ensuring data integrity in user inputs.
Collection of essential Vue Composition API (inspired by react-use)
🚧 Working in progress...
npm i @vueuse/core@next
npm i @vue/composition-api
npm i @vueuse/core
Please register the Composition API Plugin before other using APIs.
<!-- For Vue 3.x -->
<script src="https://unpkg.com/@vueuse/core@next"></script>
<!-- For Vue 2.x -->
<script src="https://unpkg.com/@vueuse/core"></script>
It will be exposed to global variable window.VueUse
You can checkout the documents and live demos in Storybook.
More functions to be added. Please keep turned. (PRs are also welcome!)
For every release, it will release two version of this package. The 3.x.x
is used for Vue 3.x and the 2.x.x
is used for 2.x. We use the major version number to distinguish the different target version will the minor and patch numbers are shared in both packages.
Since the Composition API will be available in 3.x. Using it in 2.x require you use a polyfill. For 3.x build, we use the API from @vue/runtime-dom
, and for 2.x, it's @vue/composition-api
// 3.x build
import { ref } from '@vue/runtime-dom'
// 2.x build
import { ref } from '@vue/composition-api'
This project is heavily inspired by following awesome projects.
Thanks!
MIT License © 2019-2020 Anthony Fu
FAQs
Collection of essential Vue Composition Utilities
The npm package @vueuse/core receives a total of 1,082,852 weekly downloads. As such, @vueuse/core popularity was classified as popular.
We found that @vueuse/core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.