Saving all progress

This commit is contained in:
Luke Hagar
2025-03-19 22:47:50 -05:00
parent 5c6e8a1e4f
commit 00593b402b
14988 changed files with 2598505 additions and 1 deletions

21
node_modules/@vueuse/core/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019-PRESENT Anthony Fu<https://github.com/antfu>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

124
node_modules/@vueuse/core/README.md generated vendored Normal file
View File

@@ -0,0 +1,124 @@
<p align="center">
<a href="https://github.com/vueuse/vueuse#gh-light-mode-only">
<img src="https://raw.githubusercontent.com/vueuse/vueuse/main/packages/public/logo-vertical.png#gh-light-mode-only" alt="VueUse - Collection of essential Vue Composition Utilities" width="300">
</a>
<a href="https://github.com/vueuse/vueuse#gh-dark-mode-only">
<img src="https://raw.githubusercontent.com/vueuse/vueuse/main/packages/public/logo-vertical-dark.png#gh-dark-mode-only" alt="VueUse - Collection of essential Vue Composition Utilities" width="300">
</a>
<br>
Collection of essential Vue Composition Utilities
</p>
<p align="center">
<a href="https://www.npmjs.com/package/@vueuse/core" target="__blank"><img src="https://img.shields.io/npm/v/@vueuse/core?color=a1b858&label=" alt="NPM version"></a>
<a href="https://www.npmjs.com/package/@vueuse/core" target="__blank"><img alt="NPM Downloads" src="https://img.shields.io/npm/dm/@vueuse/core?color=50a36f&label="></a>
<a href="https://vueuse.org" target="__blank"><img src="https://img.shields.io/static/v1?label=&message=docs%20%26%20demos&color=1e8a7a" alt="Docs & Demos"></a>
<img alt="Function Count" src="https://vueuse.org/badge-function-count.svg">
<br>
<a href="https://github.com/vueuse/vueuse" target="__blank"><img alt="GitHub stars" src="https://img.shields.io/github/stars/vueuse/vueuse?style=social"></a>
</p>
<p align="center">
<a href="https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg">
<img src='https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg'>
</a>
</p>
## 🚀 Features
- 🎪 [**Interactive docs & demos**](https://vueuse.org)
- 🕶 **Seamless migration**: Works for **both** Vue 3 and 2
-**Fully tree shakeable**: Only take what you want, [bundle size](https://vueuse.org/export-size)
- 🦾 **Type Strong**: Written in [TypeScript](https://www.typescriptlang.org/), with [TS Docs](https://github.com/microsoft/tsdoc)
- 🔋 **SSR Friendly**
- 🌎 **No bundler required**: Usable via CDN
- 🔩 **Flexible**: Configurable event filters and targets
- 🔌 **Optional [Add-ons](https://vueuse.org/add-ons)**: Router, Firebase, RxJS, etc.
## 🦄 Usage
```ts
import { useLocalStorage, useMouse, usePreferredDark } from '@vueuse/core'
export default {
setup() {
// tracks mouse position
const { x, y } = useMouse()
// if user prefers dark theme
const isDark = usePreferredDark()
// persist state in localStorage
const store = useLocalStorage(
'my-storage',
{
name: 'Apple',
color: 'red',
},
)
return { x, y, isDark, store }
},
}
```
Refer to [functions list](https://vueuse.org/functions) or [documentations](https://vueuse.org/) for more details.
## 📦 Install
> 🎩 From v4.0, it works for Vue 2 & 3 **within a single package** by the power of [vue-demi](https://github.com/vueuse/vue-demi)!
```bash
npm i @vueuse/core
```
[Add ons](https://vueuse.org/add-ons.html) | [Nuxt Module](https://vueuse.org/guide/index.html#nuxt)
> From v6.0, VueUse requires `vue` >= v3.2 or `@vue/composition-api` >= v1.1
###### Demos
- [Vite + Vue 3](https://github.com/vueuse/vueuse-vite-starter)
- [Nuxt 3 + Vue 3](https://github.com/antfu/vitesse-nuxt3)
- [Webpack + Vue 3](https://github.com/vueuse/vueuse-vue3-example)
- [Nuxt 2 + Vue 2](https://github.com/antfu/vitesse-nuxt-bridge)
- [Vue CLI + Vue 2](https://github.com/vueuse/vueuse-vue2-example)
### CDN
```vue
<script src="https://unpkg.com/@vueuse/shared"></script>
<script src="https://unpkg.com/@vueuse/core"></script>
```
It will be exposed to global as `window.VueUse`
## 🪴 Project Activity
![Alt](https://repobeats.axiom.co/api/embed/a406ba7461a6a087dbdb14d4395046c948d44c51.svg 'Repobeats analytics image')
## 🧱 Contribute
See the [**Contributing Guide**](https://vueuse.org/contributing)
## 🌸 Thanks
This project is heavily inspired by the following awesome projects.
- [streamich/react-use](https://github.com/streamich/react-use)
- [u3u/vue-hooks](https://github.com/u3u/vue-hooks)
- [logaretm/vue-use-web](https://github.com/logaretm/vue-use-web)
- [kripod/react-hooks](https://github.com/kripod/react-hooks)
And thanks to [all the contributors on GitHub](https://github.com/vueuse/vueuse/graphs/contributors)!
## 👨‍🚀 Contributors
### Financial Contributors on Open Collective
<a href="https://opencollective.com/vueuse"><img src="https://opencollective.com/vueuse/individuals.svg?width=890"></a>
## 📄 License
[MIT License](https://github.com/vueuse/vueuse/blob/main/LICENSE) © 2019-PRESENT [Anthony Fu](https://github.com/antfu)

7660
node_modules/@vueuse/core/index.cjs generated vendored Normal file

File diff suppressed because it is too large Load Diff

5382
node_modules/@vueuse/core/index.d.cts generated vendored Normal file

File diff suppressed because one or more lines are too long

5382
node_modules/@vueuse/core/index.d.mts generated vendored Normal file

File diff suppressed because one or more lines are too long

5382
node_modules/@vueuse/core/index.d.ts generated vendored Normal file

File diff suppressed because one or more lines are too long

7780
node_modules/@vueuse/core/index.iife.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

1
node_modules/@vueuse/core/index.iife.min.js generated vendored Normal file

File diff suppressed because one or more lines are too long

7486
node_modules/@vueuse/core/index.mjs generated vendored Normal file

File diff suppressed because it is too large Load Diff

1
node_modules/@vueuse/core/metadata.cjs generated vendored Normal file
View File

@@ -0,0 +1 @@
module.exports = require('@vueuse/metadata')

1
node_modules/@vueuse/core/metadata.d.cts generated vendored Normal file
View File

@@ -0,0 +1 @@
export * from '@vueuse/metadata'

1
node_modules/@vueuse/core/metadata.d.mts generated vendored Normal file
View File

@@ -0,0 +1 @@
export * from '@vueuse/metadata'

1
node_modules/@vueuse/core/metadata.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export * from '@vueuse/metadata'

1
node_modules/@vueuse/core/metadata.mjs generated vendored Normal file
View File

@@ -0,0 +1 @@
export * from '@vueuse/metadata'

View File

@@ -0,0 +1 @@
../vue-demi/bin/vue-demi-fix.js

View File

@@ -0,0 +1 @@
../vue-demi/bin/vue-demi-switch.js

View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020-present, Anthony Fu
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,229 @@
<p align="center">
<img src="https://github.com/vueuse/vue-demi/blob/main/assets/banner.png?raw=true" width="600"/>
<br>
<a href='https://www.npmjs.com/package/vue-demi'><img src='https://img.shields.io/npm/v/vue-demi?color=42b883' alt='npm'></a>
</p>
<p align="center">
<b>Vue Demi</b> (<i>half</i> in French) is a developing utility<br> allows you to write <b>Universal Vue Libraries</b> for Vue 2 & 3<br>
<i>See more details in <a href='https://antfu.me/posts/make-libraries-working-with-vue-2-and-3'>this blog post</a></i>
</p>
<br>
<br>
## Strategies
- `<=2.6`: exports from `vue` + `@vue/composition-api` with plugin auto installing.
- `2.7`: exports from `vue` (Composition API is built-in in Vue 2.7).
- `>=3.0`: exports from `vue`, with polyfill of Vue 2's `set` and `del` API.
## Usage
Install this as your plugin's dependency:
```bash
npm i vue-demi
# or
yarn add vue-demi
# or
pnpm i vue-demi
```
Add `vue` and `@vue/composition-api` to your plugin's peer dependencies to specify what versions you support.
```jsonc
{
"dependencies": {
"vue-demi": "latest"
},
"peerDependencies": {
"@vue/composition-api": "^1.0.0-rc.1",
"vue": "^2.0.0 || >=3.0.0"
},
"peerDependenciesMeta": {
"@vue/composition-api": {
"optional": true
}
},
"devDependencies": {
"vue": "^3.0.0" // or "^2.6.0" base on your preferred working environment
},
}
```
Import everything related to Vue from it, it will redirect to `vue@2` + `@vue/composition-api` or `vue@3` based on users' environments.
```ts
import { ref, reactive, defineComponent } from 'vue-demi'
```
Publish your plugin and all is done!
> When using with [Vite](https://vitejs.dev), you will need to opt-out the pre-bundling to get `vue-demi` work properly by
> ```js
> // vite.config.js
> export default defineConfig({
> optimizeDeps: {
> exclude: ['vue-demi']
> }
> })
> ```
### Extra APIs
`Vue Demi` provides extra APIs to help distinguish users' environments and to do some version-specific logic.
### `isVue2` `isVue3`
```ts
import { isVue2, isVue3 } from 'vue-demi'
if (isVue2) {
// Vue 2 only
} else {
// Vue 3 only
}
```
### `Vue2`
To avoid bringing in all the tree-shakable modules, we provide a `Vue2` export to support access to Vue 2's global API. (See [#41](https://github.com/vueuse/vue-demi/issues/41).)
```ts
import { Vue2 } from 'vue-demi'
if (Vue2) {
Vue2.config.ignoredElements.push('x-foo')
}
```
### `install()`
Composition API in Vue 2 is provided as a plugin and needs to be installed on the Vue instance before using. Normally, `vue-demi` will try to install it automatically. For some usages where you might need to ensure the plugin gets installed correctly, the `install()` API is exposed to as a safe version of `Vue.use(CompositionAPI)`. `install()` in the Vue 3 environment will be an empty function (no-op).
```ts
import { install } from 'vue-demi'
install()
```
## CLI
### Manually Switch Versions
To explicitly switch the redirecting version, you can use these commands in your project's root.
```bash
npx vue-demi-switch 2
# or
npx vue-demi-switch 3
```
### Package Aliasing
If you would like to import `vue` under an alias, you can use the following command
```bash
npx vue-demi-switch 2 vue2
# or
npx vue-demi-switch 3 vue3
```
Then `vue-demi` will redirect APIs from the alias name you specified, for example:
```ts
import * as Vue from 'vue3'
var isVue2 = false
var isVue3 = true
var Vue2 = undefined
export * from 'vue3'
export {
Vue,
Vue2,
isVue2,
isVue3,
}
```
### Auto Fix
If the `postinstall` hook doesn't get triggered or you have updated the Vue version, try to run the following command to resolve the redirecting.
```bash
npx vue-demi-fix
```
### Isomorphic Testings
You can support testing for both versions by adding npm alias in your dev dependencies. For example:
```json
{
"scripts": {
"test:2": "vue-demi-switch 2 vue2 && jest",
"test:3": "vue-demi-switch 3 && jest",
},
"devDependencies": {
"vue": "^3.0.0",
"vue2": "npm:vue@2"
},
}
```
or
```json
{
"scripts": {
"test:2": "vue-demi-switch 2 && jest",
"test:3": "vue-demi-switch 3 vue3 && jest",
},
"devDependencies": {
"vue": "^2.6.0",
"vue3": "npm:vue@3"
},
}
```
## Examples
See [examples](./examples).
## Who is using this?
- [VueUse](https://github.com/vueuse/vueuse) - Collection of Composition API utils
- [@vue/apollo-composable](https://github.com/vuejs/vue-apollo/tree/v4/packages/vue-apollo-composable) - Apollo GraphQL functions for Vue Composition API
- [vuelidate](https://github.com/vuelidate/vuelidate) - Simple, lightweight model-based validation
- [vue-composition-test-utils](https://github.com/ariesjia/vue-composition-test-utils) - Simple vue composition api unit test utilities
- [vue-use-stripe](https://github.com/frandiox/vue-use-stripe) - Stripe Elements wrapper for Vue.js
- [@opd/g2plot-vue](https://github.com/open-data-plan/g2plot-vue) - G2plot for vue
- [vue-echarts](https://github.com/ecomfe/vue-echarts) - Vue.js component for Apache ECharts.
- [fluent-vue](https://github.com/Demivan/fluent-vue) - Vue.js integration for [Fluent.js](https://github.com/projectfluent/fluent.js) - JavaScript implementation of [Project Fluent](https://projectfluent.org)
- [vue-datatable-url-sync](https://github.com/socotecio/vue-datatable-url-sync) - Synchronize datatable options and filters with the url to keep user preference even after refresh or navigation
- [vue-insta-stories](https://github.com/UnevenSoftware/vue-insta-stories) - Instagram stories in your vue projects.
- [vue-tiny-validate](https://github.com/FrontLabsOfficial/vue-tiny-validate) - Tiny Vue Validate Composition
- [v-perfect-signature](https://github.com/wobsoriano/v-perfect-signature) - Pressure-sensitive signature drawing for Vue 2 and 3
- [vue-winbox](https://github.com/wobsoriano/vue-winbox) - A wrapper component for WinBox.js that adds the ability to mount Vue components.
- [vue-word-highlighter](https://github.com/kawamataryo/vue-word-highlighter) - The word highlighter library for Vue 2 and Vue 3
- [vue-chart-3](https://github.com/victorgarciaesgi/vue-chart-3) - Vue.js component for Chart.js
- [json-editor-vue](https://github.com/cloydlau/json-editor-vue) - JSON editor & viewer for Vue 2 and 3.
- [kidar-echarts](https://github.com/kidarjs/kidar-echarts) - A simpler echarts component for Vue 2 and 3.
- [vue3-sketch-ruler](https://github.com/kakajun/vue3-sketch-ruler) - The zoom operation used for page presentation for Vue 2 and 3( Replace render function with template )
- [vue-rough-notation](https://github.com/Leecason/vue-rough-notation) - RoughNotation wrapper component for Vue 2 and 3.
- [vue-request](https://github.com/AttoJS/vue-request) - Vue composition API for data fetching, supports SWR, polling, error retry, cache request, pagination, etc.
- [vue3-lazyload](https://github.com/murongg/vue3-lazyload) - A vue3.x image lazyload plugin.
- [vue-codemirror6](https://github.com/logue/vue-codemirror6) - CodeMirror6 component for Vue2 and 3.
- [@tanstack/vue-query](https://github.com/TanStack/query) - TanStack Query for Vue.
> open a PR to add your library ;)
## Underhood
See [the blog post](https://antfu.me/posts/make-libraries-working-with-vue-2-and-3/#-introducing-vue-demi).
## License
MIT License © 2020 [Anthony Fu](https://github.com/antfu)

View File

@@ -0,0 +1,3 @@
#!/usr/bin/env node
'use strict'
require('../scripts/postinstall')

View File

@@ -0,0 +1,3 @@
#!/usr/bin/env node
'use strict'
require('../scripts/switch-cli')

View File

@@ -0,0 +1,29 @@
var Vue = require('vue')
Object.keys(Vue).forEach(function(key) {
exports[key] = Vue[key]
})
exports.set = function(target, key, val) {
if (Array.isArray(target)) {
target.length = Math.max(target.length, key)
target.splice(key, 1, val)
return val
}
target[key] = val
return val
}
exports.del = function(target, key) {
if (Array.isArray(target)) {
target.splice(key, 1)
return
}
delete target[key]
}
exports.Vue = Vue
exports.Vue2 = undefined
exports.isVue2 = false
exports.isVue3 = true
exports.install = function(){}

View File

@@ -0,0 +1,22 @@
import * as Vue from 'vue'
declare const isVue2: boolean
declare const isVue3: boolean
declare const Vue2: any
declare const install: (vue?: any) => void
/**
* @deprecated To avoid bringing in all the tree-shakable modules, this API has been deprecated. Use `Vue2` or named exports instead.
* Refer to https://github.com/vueuse/vue-demi/issues/41
*/
declare const V: typeof Vue
export function set<T>(target: any, key: any, val: T): T
export function del(target: any, key: any): void
export * from 'vue'
export {
V as Vue,
Vue2,
isVue2,
isVue3,
install,
}

View File

@@ -0,0 +1,126 @@
var _VueDemiGlobal = typeof globalThis !== 'undefined'
? globalThis
: typeof global !== 'undefined'
? global
: typeof self !== 'undefined'
? self
: this
var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
if (VueDemi.install) {
return VueDemi
}
if (!Vue) {
console.error('[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`.')
return VueDemi
}
// Vue 2.7
if (Vue.version.slice(0, 4) === '2.7.') {
for (var key in Vue) {
VueDemi[key] = Vue[key]
}
VueDemi.isVue2 = true
VueDemi.isVue3 = false
VueDemi.install = function () {}
VueDemi.Vue = Vue
VueDemi.Vue2 = Vue
VueDemi.version = Vue.version
VueDemi.warn = Vue.util.warn
VueDemi.hasInjectionContext = function() {
return !!VueDemi.getCurrentInstance()
}
function createApp(rootComponent, rootProps) {
var vm
var provide = {}
var app = {
config: Vue.config,
use: Vue.use.bind(Vue),
mixin: Vue.mixin.bind(Vue),
component: Vue.component.bind(Vue),
provide: function (key, value) {
provide[key] = value
return this
},
directive: function (name, dir) {
if (dir) {
Vue.directive(name, dir)
return app
} else {
return Vue.directive(name)
}
},
mount: function (el, hydrating) {
if (!vm) {
vm = new Vue(Object.assign({ propsData: rootProps }, rootComponent, { provide: Object.assign(provide, rootComponent.provide) }))
vm.$mount(el, hydrating)
return vm
} else {
return vm
}
},
unmount: function () {
if (vm) {
vm.$destroy()
vm = undefined
}
},
}
return app
}
VueDemi.createApp = createApp
}
// Vue 2.6.x
else if (Vue.version.slice(0, 2) === '2.') {
if (VueCompositionAPI) {
for (var key in VueCompositionAPI) {
VueDemi[key] = VueCompositionAPI[key]
}
VueDemi.isVue2 = true
VueDemi.isVue3 = false
VueDemi.install = function () {}
VueDemi.Vue = Vue
VueDemi.Vue2 = Vue
VueDemi.version = Vue.version
VueDemi.hasInjectionContext = function() {
return !!VueDemi.getCurrentInstance()
}
} else {
console.error('[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.')
}
}
// Vue 3
else if (Vue.version.slice(0, 2) === '3.') {
for (var key in Vue) {
VueDemi[key] = Vue[key]
}
VueDemi.isVue2 = false
VueDemi.isVue3 = true
VueDemi.install = function () {}
VueDemi.Vue = Vue
VueDemi.Vue2 = undefined
VueDemi.version = Vue.version
VueDemi.set = function (target, key, val) {
if (Array.isArray(target)) {
target.length = Math.max(target.length, key)
target.splice(key, 1, val)
return val
}
target[key] = val
return val
}
VueDemi.del = function (target, key) {
if (Array.isArray(target)) {
target.splice(key, 1)
return
}
delete target[key]
}
} else {
console.error('[vue-demi] Vue version ' + Vue.version + ' is unsupported.')
}
return VueDemi
})(
(_VueDemiGlobal.VueDemi = _VueDemiGlobal.VueDemi || (typeof VueDemi !== 'undefined' ? VueDemi : {})),
_VueDemiGlobal.Vue || (typeof Vue !== 'undefined' ? Vue : undefined),
_VueDemiGlobal.VueCompositionAPI || (typeof VueCompositionAPI !== 'undefined' ? VueCompositionAPI : undefined)
);

View File

@@ -0,0 +1,34 @@
import * as Vue from 'vue'
var isVue2 = false
var isVue3 = true
var Vue2 = undefined
function install() {}
export function set(target, key, val) {
if (Array.isArray(target)) {
target.length = Math.max(target.length, key)
target.splice(key, 1, val)
return val
}
target[key] = val
return val
}
export function del(target, key) {
if (Array.isArray(target)) {
target.splice(key, 1)
return
}
delete target[key]
}
export * from 'vue'
export {
Vue,
Vue2,
isVue2,
isVue3,
install,
}

View File

@@ -0,0 +1,60 @@
var VueModule = require('vue')
// get the real Vue https://github.com/vueuse/vue-demi/issues/192
var Vue = VueModule.default || VueModule
exports.Vue = Vue
exports.Vue2 = Vue
exports.isVue2 = true
exports.isVue3 = false
exports.install = function () {}
exports.warn = Vue.util.warn
// createApp polyfill
exports.createApp = function (rootComponent, rootProps) {
var vm
var provide = {}
var app = {
config: Vue.config,
use: Vue.use.bind(Vue),
mixin: Vue.mixin.bind(Vue),
component: Vue.component.bind(Vue),
provide: function (key, value) {
provide[key] = value
return this
},
directive: function (name, dir) {
if (dir) {
Vue.directive(name, dir)
return app
} else {
return Vue.directive(name)
}
},
mount: function (el, hydrating) {
if (!vm) {
vm = new Vue(Object.assign({ propsData: rootProps }, rootComponent, { provide: Object.assign(provide, rootComponent.provide) }))
vm.$mount(el, hydrating)
return vm
} else {
return vm
}
},
unmount: function () {
if (vm) {
vm.$destroy()
vm = undefined
}
},
}
return app
}
Object.keys(VueModule).forEach(function (key) {
exports[key] = VueModule[key]
})
// Not implemented https://github.com/vuejs/core/pull/8111, falls back to getCurrentInstance()
exports.hasInjectionContext = function() {
return !!VueModule.getCurrentInstance()
}

View File

@@ -0,0 +1,38 @@
import Vue from 'vue'
import type { PluginFunction, PluginObject, VueConstructor, Directive, InjectionKey, Component } from 'vue'
declare const isVue2: boolean
declare const isVue3: boolean
declare const Vue2: typeof Vue | undefined
declare const version: string
declare const install: (vue?: typeof Vue) => void
export declare function warn(msg: string, vm?: Component | null): void
/**
* @deprecated To avoid bringing in all the tree-shakable modules, this API has been deprecated. Use `Vue2` or named exports instead.
* Refer to https://github.com/vueuse/vue-demi/issues/41
*/
declare const V: typeof Vue
// accept no generic because Vue 3 doesn't accept any
// https://github.com/vuejs/vue-next/pull/2758/
export declare type Plugin = PluginObject<any> | PluginFunction<any>
export type { VNode } from 'vue'
export * from 'vue'
export { V as Vue, Vue2, isVue2, isVue3, version, install }
// #region createApp polyfill
export interface App<T = any> {
config: VueConstructor['config']
use: VueConstructor['use']
mixin: VueConstructor['mixin']
component: VueConstructor['component']
directive(name: string): Directive | undefined
directive(name: string, directive: Directive): this
provide<T>(key: InjectionKey<T> | string, value: T): this
mount: Vue['$mount']
unmount: Vue['$destroy']
}
export declare function createApp(rootComponent: any, rootProps?: any): App
// #endregion
export declare function hasInjectionContext(): boolean

View File

@@ -0,0 +1,80 @@
import Vue from 'vue'
import { getCurrentInstance } from 'vue'
var isVue2 = true
var isVue3 = false
var Vue2 = Vue
var warn = Vue.util.warn
function install() {}
// createApp polyfill
export function createApp(rootComponent, rootProps) {
var vm
var provide = {}
var app = {
config: Vue.config,
use: Vue.use.bind(Vue),
mixin: Vue.mixin.bind(Vue),
component: Vue.component.bind(Vue),
provide: function (key, value) {
provide[key] = value
return this
},
directive: function (name, dir) {
if (dir) {
Vue.directive(name, dir)
return app
} else {
return Vue.directive(name)
}
},
mount: function (el, hydrating) {
if (!vm) {
vm = new Vue(Object.assign({ propsData: rootProps }, rootComponent, { provide: Object.assign(provide, rootComponent.provide) }))
vm.$mount(el, hydrating)
return vm
} else {
return vm
}
},
unmount: function () {
if (vm) {
vm.$destroy()
vm = undefined
}
},
}
return app
}
export {
Vue,
Vue2,
isVue2,
isVue3,
install,
warn
}
// Vue 3 components mock
function createMockComponent(name) {
return {
setup() {
throw new Error('[vue-demi] ' + name + ' is not supported in Vue 2. It\'s provided to avoid compiler errors.')
}
}
}
export var Fragment = /*#__PURE__*/ createMockComponent('Fragment')
export var Transition = /*#__PURE__*/ createMockComponent('Transition')
export var TransitionGroup = /*#__PURE__*/ createMockComponent('TransitionGroup')
export var Teleport = /*#__PURE__*/ createMockComponent('Teleport')
export var Suspense = /*#__PURE__*/ createMockComponent('Suspense')
export var KeepAlive = /*#__PURE__*/ createMockComponent('KeepAlive')
export * from 'vue'
// Not implemented https://github.com/vuejs/core/pull/8111, falls back to getCurrentInstance()
export function hasInjectionContext() {
return !!getCurrentInstance()
}

View File

@@ -0,0 +1,34 @@
var Vue = require('vue')
var VueCompositionAPI = require('@vue/composition-api')
function install(_vue) {
var vueLib = _vue || Vue
if (vueLib && 'default' in vueLib) {
vueLib = vueLib.default
}
if (vueLib && !vueLib['__composition_api_installed__']) {
if (VueCompositionAPI && 'default' in VueCompositionAPI)
vueLib.use(VueCompositionAPI.default)
else if (VueCompositionAPI)
vueLib.use(VueCompositionAPI)
}
}
install(Vue)
Object.keys(VueCompositionAPI).forEach(function(key) {
exports[key] = VueCompositionAPI[key]
})
exports.Vue = Vue
exports.Vue2 = Vue
exports.isVue2 = true
exports.isVue3 = false
exports.install = install
exports.version = Vue.version
// Not implemented https://github.com/vuejs/core/pull/8111, falls back to getCurrentInstance()
exports.hasInjectionContext = function () {
return !!VueCompositionAPI.getCurrentInstance()
}

View File

@@ -0,0 +1,33 @@
import Vue from 'vue'
import type { PluginFunction, PluginObject } from 'vue'
declare const isVue2: boolean
declare const isVue3: boolean
declare const Vue2: typeof Vue | undefined
declare const version: string
declare const install: (vue?: typeof Vue) => void
/**
* @deprecated To avoid bringing in all the tree-shakable modules, this API has been deprecated. Use `Vue2` or named exports instead.
* Refer to https://github.com/vueuse/vue-demi/issues/41
*/
declare const V: typeof Vue
/**
* DebuggerEvent is a Vue 3 development only feature. This type cannot exist in Vue 2.
*/
export declare type DebuggerEvent = never
// accept no generic because Vue 3 doesn't accept any
// https://github.com/vuejs/vue-next/pull/2758/
export declare type Plugin = PluginObject<any> | PluginFunction<any>
export type { VNode } from 'vue'
export * from '@vue/composition-api'
export {
V as Vue,
Vue2,
isVue2,
isVue3,
version,
install,
}
export declare function hasInjectionContext(): boolean

View File

@@ -0,0 +1,49 @@
import Vue from 'vue'
import VueCompositionAPI, { getCurrentInstance } from '@vue/composition-api/dist/vue-composition-api.mjs'
function install(_vue) {
_vue = _vue || Vue
if (_vue && !_vue['__composition_api_installed__'])
_vue.use(VueCompositionAPI)
}
install(Vue)
var isVue2 = true
var isVue3 = false
var Vue2 = Vue
var version = Vue.version
/**VCA-EXPORTS**/
export * from '@vue/composition-api/dist/vue-composition-api.mjs'
/**VCA-EXPORTS**/
export {
Vue,
Vue2,
isVue2,
isVue3,
version,
install,
}
// Vue 3 components mock
function createMockComponent(name) {
return {
setup() {
throw new Error('[vue-demi] ' + name + ' is not supported in Vue 2. It\'s provided to avoid compiler errors.')
}
}
}
export var Fragment = /*#__PURE__*/ createMockComponent('Fragment')
export var Transition = /*#__PURE__*/ createMockComponent('Transition')
export var TransitionGroup = /*#__PURE__*/ createMockComponent('TransitionGroup')
export var Teleport = /*#__PURE__*/ createMockComponent('Teleport')
export var Suspense = /*#__PURE__*/ createMockComponent('Suspense')
export var KeepAlive = /*#__PURE__*/ createMockComponent('KeepAlive')
// Not implemented https://github.com/vuejs/core/pull/8111, falls back to getCurrentInstance()
export function hasInjectionContext() {
return !!getCurrentInstance()
}

View File

@@ -0,0 +1,29 @@
var Vue = require('vue')
Object.keys(Vue).forEach(function(key) {
exports[key] = Vue[key]
})
exports.set = function(target, key, val) {
if (Array.isArray(target)) {
target.length = Math.max(target.length, key)
target.splice(key, 1, val)
return val
}
target[key] = val
return val
}
exports.del = function(target, key) {
if (Array.isArray(target)) {
target.splice(key, 1)
return
}
delete target[key]
}
exports.Vue = Vue
exports.Vue2 = undefined
exports.isVue2 = false
exports.isVue3 = true
exports.install = function(){}

View File

@@ -0,0 +1,22 @@
import * as Vue from 'vue'
declare const isVue2: boolean
declare const isVue3: boolean
declare const Vue2: any
declare const install: (vue?: any) => void
/**
* @deprecated To avoid bringing in all the tree-shakable modules, this API has been deprecated. Use `Vue2` or named exports instead.
* Refer to https://github.com/vueuse/vue-demi/issues/41
*/
declare const V: typeof Vue
export function set<T>(target: any, key: any, val: T): T
export function del(target: any, key: any): void
export * from 'vue'
export {
V as Vue,
Vue2,
isVue2,
isVue3,
install,
}

View File

@@ -0,0 +1,34 @@
import * as Vue from 'vue'
var isVue2 = false
var isVue3 = true
var Vue2 = undefined
function install() {}
export function set(target, key, val) {
if (Array.isArray(target)) {
target.length = Math.max(target.length, key)
target.splice(key, 1, val)
return val
}
target[key] = val
return val
}
export function del(target, key) {
if (Array.isArray(target)) {
target.splice(key, 1)
return
}
delete target[key]
}
export * from 'vue'
export {
Vue,
Vue2,
isVue2,
isVue3,
install,
}

View File

@@ -0,0 +1,47 @@
{
"name": "vue-demi",
"version": "0.14.10",
"engines": {
"node": ">=12"
},
"repository": "https://github.com/antfu/vue-demi.git",
"funding": "https://github.com/sponsors/antfu",
"license": "MIT",
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
"main": "lib/index.cjs",
"jsdelivr": "lib/index.iife.js",
"unpkg": "lib/index.iife.js",
"module": "lib/index.mjs",
"types": "lib/index.d.ts",
"exports": {
".": {
"types": "./lib/index.d.ts",
"require": "./lib/index.cjs",
"import": "./lib/index.mjs",
"browser": "./lib/index.mjs"
},
"./*": "./*"
},
"bin": {
"vue-demi-fix": "bin/vue-demi-fix.js",
"vue-demi-switch": "bin/vue-demi-switch.js"
},
"files": [
"lib",
"bin",
"scripts"
],
"scripts": {
"postinstall": "node -e \"try{require('./scripts/postinstall.js')}catch(e){}\"",
"release": "npx bumpp --tag --commit --push && npm publish"
},
"peerDependencies": {
"@vue/composition-api": "^1.0.0-rc.1",
"vue": "^3.0.0-0 || ^2.6.0"
},
"peerDependenciesMeta": {
"@vue/composition-api": {
"optional": true
}
}
}

View File

@@ -0,0 +1,19 @@
const { switchVersion, loadModule } = require('./utils')
const Vue = loadModule('vue')
if (!Vue || typeof Vue.version !== 'string') {
console.warn('[vue-demi] Vue is not found. Please run "npm install vue" to install.')
}
else if (Vue.version.startsWith('2.7.')) {
switchVersion(2.7)
}
else if (Vue.version.startsWith('2.')) {
switchVersion(2)
}
else if (Vue.version.startsWith('3.')) {
switchVersion(3)
}
else {
console.warn(`[vue-demi] Vue version v${Vue.version} is not supported.`)
}

View File

@@ -0,0 +1,18 @@
const { switchVersion } = require('./utils')
const version = process.argv[2]
const vueEntry = process.argv[3] || 'vue'
if (version === '2.7') {
switchVersion(2.7, vueEntry)
console.log(`[vue-demi] Switched for Vue 2.7 (entry: "${vueEntry}")`)
} else if (version === '2') {
switchVersion(2, vueEntry)
console.log(`[vue-demi] Switched for Vue 2 (entry: "${vueEntry}")`)
} else if (version === '3') {
switchVersion(3, vueEntry)
console.log(`[vue-demi] Switched for Vue 3 (entry: "${vueEntry}")`)
} else {
console.warn(`[vue-demi] expecting version "2" or "2.7" or "3" but got "${version}"`)
process.exit(1)
}

View File

@@ -0,0 +1,62 @@
const fs = require('fs')
const path = require('path')
const dir = path.resolve(__dirname, '..', 'lib')
function loadModule(name) {
try {
return require(name)
} catch (e) {
return undefined
}
}
function copy(name, version, vue) {
vue = vue || 'vue'
const src = path.join(dir, `v${version}`, name)
const dest = path.join(dir, name)
let content = fs.readFileSync(src, 'utf-8')
content = content.replace(/'vue'/g, `'${vue}'`)
// unlink for pnpm, #92
try {
fs.unlinkSync(dest)
} catch (error) { }
fs.writeFileSync(dest, content, 'utf-8')
}
function updateVue2API() {
const ignoreList = ['version', 'default']
const VCA = loadModule('@vue/composition-api')
if (!VCA) {
console.warn('[vue-demi] Composition API plugin is not found. Please run "npm install @vue/composition-api" to install.')
return
}
const exports = Object.keys(VCA).filter(i => !ignoreList.includes(i))
const esmPath = path.join(dir, 'index.mjs')
let content = fs.readFileSync(esmPath, 'utf-8')
content = content.replace(
/\/\*\*VCA-EXPORTS\*\*\/[\s\S]+\/\*\*VCA-EXPORTS\*\*\//m,
`/**VCA-EXPORTS**/
export { ${exports.join(', ')} } from '@vue/composition-api/dist/vue-composition-api.mjs'
/**VCA-EXPORTS**/`
)
fs.writeFileSync(esmPath, content, 'utf-8')
}
function switchVersion(version, vue) {
copy('index.cjs', version, vue)
copy('index.mjs', version, vue)
copy('index.d.ts', version, vue)
if (version === 2)
updateVue2API()
}
module.exports.loadModule = loadModule
module.exports.switchVersion = switchVersion

45
node_modules/@vueuse/core/package.json generated vendored Normal file
View File

@@ -0,0 +1,45 @@
{
"name": "@vueuse/core",
"version": "10.11.1",
"description": "Collection of essential Vue Composition Utilities",
"author": "Anthony Fu <https://github.com/antfu>",
"license": "MIT",
"funding": "https://github.com/sponsors/antfu",
"homepage": "https://github.com/vueuse/vueuse#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/vueuse/vueuse.git",
"directory": "packages/core"
},
"bugs": {
"url": "https://github.com/vueuse/vueuse/issues"
},
"keywords": [
"vue",
"vue-use",
"utils"
],
"sideEffects": false,
"exports": {
".": {
"import": "./index.mjs",
"require": "./index.cjs"
},
"./*": "./*",
"./metadata": {
"import": "./metadata.mjs",
"require": "./metadata.cjs"
}
},
"main": "./index.cjs",
"module": "./index.mjs",
"unpkg": "./index.iife.min.js",
"jsdelivr": "./index.iife.min.js",
"types": "./index.d.cts",
"dependencies": {
"@types/web-bluetooth": "^0.0.20",
"@vueuse/metadata": "10.11.1",
"@vueuse/shared": "10.11.1",
"vue-demi": ">=0.14.8"
}
}

21
node_modules/@vueuse/integrations/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019-PRESENT Anthony Fu<https://github.com/antfu>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

46
node_modules/@vueuse/integrations/README.md generated vendored Normal file
View File

@@ -0,0 +1,46 @@
# @vueuse/integrations
[![NPM version](https://img.shields.io/npm/v/@vueuse/integrations?color=a1b858)](https://www.npmjs.com/package/@vueuse/integrations)
> This is an add-on of [VueUse](https://github.com/vueuse/vueuse), providing integration wrappers for utility libraries.
## Install
```bash
npm i @vueuse/integrations
```
## Functions
<!--GENERATED LIST, DO NOT MODIFY MANUALLY-->
<!--FUNCTIONS_LIST_STARTS-->
- [`useAsyncValidator`](https://vueuse.org/integrations/useAsyncValidator/) — wrapper for [`async-validator`](https://github.com/yiminghe/async-validator)
- [`useAxios`](https://vueuse.org/integrations/useAxios/) — wrapper for [`axios`](https://github.com/axios/axios)
- [`useChangeCase`](https://vueuse.org/integrations/useChangeCase/) — reactive wrapper for [`change-case`](https://github.com/blakeembrey/change-case)
- [`useCookies`](https://vueuse.org/integrations/useCookies/) — wrapper for [`universal-cookie`](https://www.npmjs.com/package/universal-cookie)
- [`useDrauu`](https://vueuse.org/integrations/useDrauu/) — reactive instance for [drauu](https://github.com/antfu/drauu)
- [`useFocusTrap`](https://vueuse.org/integrations/useFocusTrap/) — reactive wrapper for [`focus-trap`](https://github.com/focus-trap/focus-trap)
- [`useFuse`](https://vueuse.org/integrations/useFuse/) — easily implement fuzzy search using a composable with [Fuse.js](https://github.com/krisk/fuse)
- [`useIDBKeyval`](https://vueuse.org/integrations/useIDBKeyval/) — wrapper for [`idb-keyval`](https://www.npmjs.com/package/idb-keyval)
- [`useJwt`](https://vueuse.org/integrations/useJwt/) — wrapper for [`jwt-decode`](https://github.com/auth0/jwt-decode)
- [`useNProgress`](https://vueuse.org/integrations/useNProgress/) — reactive wrapper for [`nprogress`](https://github.com/rstacruz/nprogress)
- [`useQRCode`](https://vueuse.org/integrations/useQRCode/) — wrapper for [`qrcode`](https://github.com/soldair/node-qrcode)
- [`useSortable`](https://vueuse.org/integrations/useSortable/) — wrapper for [`sortable`](https://github.com/SortableJS/Sortable)
<!--FUNCTIONS_LIST_ENDS-->
## Tree-shaking
For better tree-shaking result, import functions from submodules, for example:
```ts
import { useAxios } from '@vueuse/integrations/useAxios'
// Don't
import { useAxios } from '@vueuse/integrations'
```
## License
[MIT License](https://github.com/vueuse/vueuse/blob/master/LICENSE) © 2019-PRESENT [Anthony Fu](https://github.com/antfu)

703
node_modules/@vueuse/integrations/index.cjs generated vendored Normal file
View File

@@ -0,0 +1,703 @@
'use strict';
var shared = require('@vueuse/shared');
var Schema = require('async-validator');
var vueDemi = require('vue-demi');
var axios = require('axios');
var changeCase = require('change-case');
var Cookie = require('universal-cookie');
var core = require('@vueuse/core');
var drauu = require('drauu');
var focusTrap = require('focus-trap');
var Fuse = require('fuse.js');
var idbKeyval = require('idb-keyval');
var jwtDecode = require('jwt-decode');
var nprogress = require('nprogress');
var QRCode = require('qrcode');
var Sortable = require('sortablejs');
function _interopNamespaceDefault(e) {
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n.default = e;
return Object.freeze(n);
}
var changeCase__namespace = /*#__PURE__*/_interopNamespaceDefault(changeCase);
const AsyncValidatorSchema = Schema.default || Schema;
function useAsyncValidator(value, rules, options = {}) {
const {
validateOption = {},
immediate = true,
manual = false
} = options;
const valueRef = shared.toRef(value);
const errorInfo = vueDemi.shallowRef(null);
const isFinished = vueDemi.ref(true);
const pass = vueDemi.ref(!immediate || manual);
const errors = vueDemi.computed(() => {
var _a;
return ((_a = errorInfo.value) == null ? void 0 : _a.errors) || [];
});
const errorFields = vueDemi.computed(() => {
var _a;
return ((_a = errorInfo.value) == null ? void 0 : _a.fields) || {};
});
const validator = vueDemi.computed(() => new AsyncValidatorSchema(shared.toValue(rules)));
const execute = async () => {
isFinished.value = false;
pass.value = false;
try {
await validator.value.validate(valueRef.value, validateOption);
pass.value = true;
errorInfo.value = null;
} catch (err) {
errorInfo.value = err;
} finally {
isFinished.value = true;
}
return {
pass: pass.value,
errorInfo: errorInfo.value,
errors: errors.value,
errorFields: errorFields.value
};
};
if (!manual) {
vueDemi.watch(
[valueRef, validator],
() => execute(),
{ immediate, deep: true }
);
}
const shell = {
isFinished,
pass,
errors,
errorInfo,
errorFields,
execute
};
function waitUntilFinished() {
return new Promise((resolve, reject) => {
shared.until(isFinished).toBe(true).then(() => resolve(shell)).catch((error) => reject(error));
});
}
return {
...shell,
then(onFulfilled, onRejected) {
return waitUntilFinished().then(onFulfilled, onRejected);
}
};
}
function useAxios(...args) {
const url = typeof args[0] === "string" ? args[0] : void 0;
const argsPlaceholder = typeof url === "string" ? 1 : 0;
const defaultOptions = {
immediate: !!argsPlaceholder,
shallow: true,
abortPrevious: true
};
let defaultConfig = {};
let instance = axios;
let options = defaultOptions;
const isAxiosInstance = (val) => !!(val == null ? void 0 : val.request);
if (args.length > 0 + argsPlaceholder) {
if (isAxiosInstance(args[0 + argsPlaceholder]))
instance = args[0 + argsPlaceholder];
else
defaultConfig = args[0 + argsPlaceholder];
}
if (args.length > 1 + argsPlaceholder) {
if (isAxiosInstance(args[1 + argsPlaceholder]))
instance = args[1 + argsPlaceholder];
}
if (args.length === 2 + argsPlaceholder && !isAxiosInstance(args[1 + argsPlaceholder]) || args.length === 3 + argsPlaceholder) {
options = args[args.length - 1] || defaultOptions;
}
const {
initialData,
shallow,
onSuccess = shared.noop,
onError = shared.noop,
immediate,
resetOnExecute = false
} = options;
const response = vueDemi.shallowRef();
const data = (shallow ? vueDemi.shallowRef : vueDemi.ref)(initialData);
const isFinished = vueDemi.ref(false);
const isLoading = vueDemi.ref(false);
const isAborted = vueDemi.ref(false);
const error = vueDemi.shallowRef();
let abortController = new AbortController();
const abort = (message) => {
if (isFinished.value || !isLoading.value)
return;
abortController.abort(message);
abortController = new AbortController();
isAborted.value = true;
isLoading.value = false;
isFinished.value = false;
};
const loading = (loading2) => {
isLoading.value = loading2;
isFinished.value = !loading2;
};
const resetData = () => {
if (resetOnExecute)
data.value = initialData;
};
const waitUntilFinished = () => new Promise((resolve, reject) => {
shared.until(isFinished).toBe(true).then(() => error.value ? reject(error.value) : resolve(result));
});
const promise = {
then: (...args2) => waitUntilFinished().then(...args2),
catch: (...args2) => waitUntilFinished().catch(...args2)
};
let executeCounter = 0;
const execute = (executeUrl = url, config = {}) => {
error.value = void 0;
const _url = typeof executeUrl === "string" ? executeUrl : url != null ? url : config.url;
if (_url === void 0) {
error.value = new axios.AxiosError(axios.AxiosError.ERR_INVALID_URL);
isFinished.value = true;
return promise;
}
resetData();
if (options.abortPrevious !== false)
abort();
loading(true);
executeCounter += 1;
const currentExecuteCounter = executeCounter;
isAborted.value = false;
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, signal: abortController.signal }).then((r) => {
if (isAborted.value)
return;
response.value = r;
const result2 = r.data;
data.value = result2;
onSuccess(result2);
}).catch((e) => {
error.value = e;
onError(e);
}).finally(() => {
var _a;
(_a = options.onFinish) == null ? void 0 : _a.call(options);
if (currentExecuteCounter === executeCounter)
loading(false);
});
return promise;
};
if (immediate && url)
execute();
const result = {
response,
data,
error,
isFinished,
isLoading,
cancel: abort,
isAborted,
isCanceled: isAborted,
abort,
execute
};
return {
...result,
...promise
};
}
const changeCaseTransforms = /* @__PURE__ */ Object.entries(changeCase__namespace).filter(([name, fn]) => typeof fn === "function" && name.endsWith("Case")).reduce((acc, [name, fn]) => {
acc[name] = fn;
return acc;
}, {});
function useChangeCase(input, type, options) {
const typeRef = vueDemi.computed(() => {
const t = shared.toValue(type);
if (!changeCaseTransforms[t])
throw new Error(`Invalid change case type "${t}"`);
return t;
});
if (typeof input === "function")
return vueDemi.computed(() => changeCaseTransforms[typeRef.value](shared.toValue(input), shared.toValue(options)));
const text = vueDemi.ref(input);
return vueDemi.computed({
get() {
return changeCaseTransforms[typeRef.value](text.value, shared.toValue(options));
},
set(value) {
text.value = value;
}
});
}
function createCookies(req) {
const universalCookie = new Cookie(req ? req.headers.cookie : null);
return (dependencies, { doNotParse = false, autoUpdateDependencies = false } = {}) => useCookies(dependencies, { doNotParse, autoUpdateDependencies }, universalCookie);
}
function useCookies(dependencies, { doNotParse = false, autoUpdateDependencies = false } = {}, cookies = new Cookie()) {
const watchingDependencies = autoUpdateDependencies ? [...dependencies || []] : dependencies;
let previousCookies = cookies.getAll({ doNotParse: true });
const touches = vueDemi.ref(0);
const onChange = () => {
const newCookies = cookies.getAll({ doNotParse: true });
if (shouldUpdate(
watchingDependencies || null,
newCookies,
previousCookies
)) {
touches.value++;
}
previousCookies = newCookies;
};
cookies.addChangeListener(onChange);
shared.tryOnScopeDispose(() => {
cookies.removeChangeListener(onChange);
});
return {
/**
* Reactive get cookie by name. If **autoUpdateDependencies = true** then it will update watching dependencies
*/
get: (...args) => {
if (autoUpdateDependencies && watchingDependencies && !watchingDependencies.includes(args[0]))
watchingDependencies.push(args[0]);
touches.value;
return cookies.get(args[0], { doNotParse, ...args[1] });
},
/**
* Reactive get all cookies
*/
getAll: (...args) => {
touches.value;
return cookies.getAll({ doNotParse, ...args[0] });
},
set: (...args) => cookies.set(...args),
remove: (...args) => cookies.remove(...args),
addChangeListener: (...args) => cookies.addChangeListener(...args),
removeChangeListener: (...args) => cookies.removeChangeListener(...args)
};
}
function shouldUpdate(dependencies, newCookies, oldCookies) {
if (!dependencies)
return true;
for (const dependency of dependencies) {
if (newCookies[dependency] !== oldCookies[dependency])
return true;
}
return false;
}
function useDrauu(target, options) {
const drauuInstance = vueDemi.ref();
let disposables = [];
const onChangedHook = core.createEventHook();
const onCanceledHook = core.createEventHook();
const onCommittedHook = core.createEventHook();
const onStartHook = core.createEventHook();
const onEndHook = core.createEventHook();
const canUndo = vueDemi.ref(false);
const canRedo = vueDemi.ref(false);
const altPressed = vueDemi.ref(false);
const shiftPressed = vueDemi.ref(false);
const brush = vueDemi.ref({
color: "black",
size: 3,
arrowEnd: false,
cornerRadius: 0,
dasharray: void 0,
fill: "transparent",
mode: "draw",
...options == null ? void 0 : options.brush
});
vueDemi.watch(brush, () => {
const instance = drauuInstance.value;
if (instance) {
instance.brush = brush.value;
instance.mode = brush.value.mode;
}
}, { deep: true });
const undo = () => {
var _a;
return (_a = drauuInstance.value) == null ? void 0 : _a.undo();
};
const redo = () => {
var _a;
return (_a = drauuInstance.value) == null ? void 0 : _a.redo();
};
const clear = () => {
var _a;
return (_a = drauuInstance.value) == null ? void 0 : _a.clear();
};
const cancel = () => {
var _a;
return (_a = drauuInstance.value) == null ? void 0 : _a.cancel();
};
const load = (svg) => {
var _a;
return (_a = drauuInstance.value) == null ? void 0 : _a.load(svg);
};
const dump = () => {
var _a;
return (_a = drauuInstance.value) == null ? void 0 : _a.dump();
};
const cleanup = () => {
var _a;
disposables.forEach((dispose) => dispose());
(_a = drauuInstance.value) == null ? void 0 : _a.unmount();
};
const syncStatus = () => {
if (drauuInstance.value) {
canUndo.value = drauuInstance.value.canUndo();
canRedo.value = drauuInstance.value.canRedo();
altPressed.value = drauuInstance.value.altPressed;
shiftPressed.value = drauuInstance.value.shiftPressed;
}
};
vueDemi.watch(
() => core.unrefElement(target),
(el) => {
if (!el || typeof SVGSVGElement === "undefined" || !(el instanceof SVGSVGElement))
return;
if (drauuInstance.value)
cleanup();
drauuInstance.value = drauu.createDrauu({ el, ...options });
syncStatus();
disposables = [
drauuInstance.value.on("canceled", () => onCanceledHook.trigger()),
drauuInstance.value.on("committed", (node) => onCommittedHook.trigger(node)),
drauuInstance.value.on("start", () => onStartHook.trigger()),
drauuInstance.value.on("end", () => onEndHook.trigger()),
drauuInstance.value.on("changed", () => {
syncStatus();
onChangedHook.trigger();
})
];
},
{ flush: "post" }
);
shared.tryOnScopeDispose(() => cleanup());
return {
drauuInstance,
load,
dump,
clear,
cancel,
undo,
redo,
canUndo,
canRedo,
brush,
onChanged: onChangedHook.on,
onCommitted: onCommittedHook.on,
onStart: onStartHook.on,
onEnd: onEndHook.on,
onCanceled: onCanceledHook.on
};
}
function useFocusTrap(target, options = {}) {
let trap;
const { immediate, ...focusTrapOptions } = options;
const hasFocus = vueDemi.ref(false);
const isPaused = vueDemi.ref(false);
const activate = (opts) => trap && trap.activate(opts);
const deactivate = (opts) => trap && trap.deactivate(opts);
const pause = () => {
if (trap) {
trap.pause();
isPaused.value = true;
}
};
const unpause = () => {
if (trap) {
trap.unpause();
isPaused.value = false;
}
};
const targets = vueDemi.computed(() => {
const _targets = shared.toValue(target);
return (Array.isArray(_targets) ? _targets : [_targets]).map((el) => {
const _el = shared.toValue(el);
return typeof _el === "string" ? _el : core.unrefElement(_el);
}).filter(shared.notNullish);
});
vueDemi.watch(
targets,
(els) => {
if (!els.length)
return;
trap = focusTrap.createFocusTrap(els, {
...focusTrapOptions,
onActivate() {
hasFocus.value = true;
if (options.onActivate)
options.onActivate();
},
onDeactivate() {
hasFocus.value = false;
if (options.onDeactivate)
options.onDeactivate();
}
});
if (immediate)
activate();
},
{ flush: "post" }
);
core.tryOnScopeDispose(() => deactivate());
return {
hasFocus,
isPaused,
activate,
deactivate,
pause,
unpause
};
}
function useFuse(search, data, options) {
const createFuse = () => {
var _a, _b;
return new Fuse(
(_a = shared.toValue(data)) != null ? _a : [],
(_b = shared.toValue(options)) == null ? void 0 : _b.fuseOptions
);
};
const fuse = vueDemi.ref(createFuse());
vueDemi.watch(
() => {
var _a;
return (_a = shared.toValue(options)) == null ? void 0 : _a.fuseOptions;
},
() => {
fuse.value = createFuse();
},
{ deep: true }
);
vueDemi.watch(
() => shared.toValue(data),
(newData) => {
fuse.value.setCollection(newData);
},
{ deep: true }
);
const results = vueDemi.computed(() => {
const resolved = shared.toValue(options);
if ((resolved == null ? void 0 : resolved.matchAllWhenSearchEmpty) && !shared.toValue(search))
return shared.toValue(data).map((item, index) => ({ item, refIndex: index }));
const limit = resolved == null ? void 0 : resolved.resultLimit;
return fuse.value.search(shared.toValue(search), limit ? { limit } : void 0);
});
return {
fuse,
results
};
}
function useIDBKeyval(key, initialValue, options = {}) {
const {
flush = "pre",
deep = true,
shallow = false,
onError = (e) => {
console.error(e);
},
writeDefaults = true
} = options;
const isFinished = vueDemi.ref(false);
const data = (shallow ? vueDemi.shallowRef : vueDemi.ref)(initialValue);
const rawInit = shared.toValue(initialValue);
async function read() {
try {
const rawValue = await idbKeyval.get(key);
if (rawValue === void 0) {
if (rawInit !== void 0 && rawInit !== null && writeDefaults)
await idbKeyval.set(key, rawInit);
} else {
data.value = rawValue;
}
} catch (e) {
onError(e);
}
isFinished.value = true;
}
read();
async function write() {
try {
if (data.value == null) {
await idbKeyval.del(key);
} else {
await idbKeyval.update(key, () => vueDemi.toRaw(data.value));
}
} catch (e) {
onError(e);
}
}
const {
pause: pauseWatch,
resume: resumeWatch
} = core.watchPausable(data, () => write(), { flush, deep });
async function setData(value) {
pauseWatch();
data.value = value;
await write();
resumeWatch();
}
return {
set: setData,
isFinished,
data
};
}
function useJwt(encodedJwt, options = {}) {
const {
onError,
fallbackValue = null
} = options;
const decodeWithFallback = (encodedJwt2, options2) => {
try {
return jwtDecode.jwtDecode(encodedJwt2, options2);
} catch (err) {
onError == null ? void 0 : onError(err);
return fallbackValue;
}
};
const header = vueDemi.computed(() => decodeWithFallback(shared.toValue(encodedJwt), { header: true }));
const payload = vueDemi.computed(() => decodeWithFallback(shared.toValue(encodedJwt)));
return {
header,
payload
};
}
function useNProgress(currentProgress = null, options) {
const progress = vueDemi.ref(currentProgress);
const isLoading = vueDemi.computed({
set: (load) => load ? nprogress.start() : nprogress.done(),
get: () => typeof progress.value === "number" && progress.value < 1
});
if (options)
nprogress.configure(options);
const setProgress = nprogress.set;
nprogress.set = (n) => {
progress.value = n;
return setProgress.call(nprogress, n);
};
vueDemi.watchEffect(() => {
if (typeof progress.value === "number" && shared.isClient)
setProgress.call(nprogress, progress.value);
});
shared.tryOnScopeDispose(nprogress.remove);
return {
isLoading,
progress,
start: nprogress.start,
done: nprogress.done,
remove: () => {
progress.value = null;
nprogress.remove();
}
};
}
function useQRCode(text, options) {
const src = shared.toRef(text);
const result = vueDemi.ref("");
vueDemi.watch(
src,
async (value) => {
if (src.value && shared.isClient)
result.value = await QRCode.toDataURL(value, options);
},
{ immediate: true }
);
return result;
}
function useSortable(el, list, options = {}) {
let sortable;
const { document = core.defaultDocument, ...resetOptions } = options;
const defaultOptions = {
onUpdate: (e) => {
moveArrayElement(list, e.oldIndex, e.newIndex, e);
}
};
const start = () => {
const target = typeof el === "string" ? document == null ? void 0 : document.querySelector(el) : core.unrefElement(el);
if (!target || sortable !== void 0)
return;
sortable = new Sortable(target, { ...defaultOptions, ...resetOptions });
};
const stop = () => {
sortable == null ? void 0 : sortable.destroy();
sortable = void 0;
};
const option = (name, value) => {
if (value !== void 0)
sortable == null ? void 0 : sortable.option(name, value);
else
return sortable == null ? void 0 : sortable.option(name);
};
core.tryOnMounted(start);
core.tryOnScopeDispose(stop);
return {
stop,
start,
option
};
}
function insertNodeAt(parentElement, element, index) {
const refElement = parentElement.children[index];
parentElement.insertBefore(element, refElement);
}
function removeNode(node) {
if (node.parentNode)
node.parentNode.removeChild(node);
}
function moveArrayElement(list, from, to, e = null) {
if (e != null) {
removeNode(e.item);
insertNodeAt(e.from, e.item, from);
}
const _valueIsRef = vueDemi.isRef(list);
const array = _valueIsRef ? [...core.toValue(list)] : core.toValue(list);
if (to >= 0 && to < array.length) {
const element = array.splice(from, 1)[0];
vueDemi.nextTick(() => {
array.splice(to, 0, element);
if (_valueIsRef)
list.value = array;
});
}
}
exports.createCookies = createCookies;
exports.insertNodeAt = insertNodeAt;
exports.moveArrayElement = moveArrayElement;
exports.removeNode = removeNode;
exports.useAsyncValidator = useAsyncValidator;
exports.useAxios = useAxios;
exports.useChangeCase = useChangeCase;
exports.useCookies = useCookies;
exports.useDrauu = useDrauu;
exports.useFocusTrap = useFocusTrap;
exports.useFuse = useFuse;
exports.useIDBKeyval = useIDBKeyval;
exports.useJwt = useJwt;
exports.useNProgress = useNProgress;
exports.useQRCode = useQRCode;
exports.useSortable = useSortable;

441
node_modules/@vueuse/integrations/index.d.cts generated vendored Normal file
View File

@@ -0,0 +1,441 @@
import { MaybeRefOrGetter, MaybeRef, ConfigurableFlush, RemovableRef } from '@vueuse/shared';
import { ValidateError, ValidateOption, Rules } from 'async-validator';
import { Ref, ShallowRef, WritableComputedRef, ComputedRef } from 'vue-demi';
import { AxiosResponse, AxiosRequestConfig, AxiosInstance } from 'axios';
import * as changeCase from 'change-case';
import { Options } from 'change-case';
import * as universal_cookie from 'universal-cookie';
import universal_cookie__default from 'universal-cookie';
import { IncomingMessage } from 'node:http';
import { EventHookOn, MaybeComputedElementRef, Fn, Arrayable, ConfigurableDocument, MaybeRefOrGetter as MaybeRefOrGetter$1 } from '@vueuse/core';
import { Options as Options$1, Drauu, Brush } from 'drauu';
import { Options as Options$2, ActivateOptions, DeactivateOptions } from 'focus-trap';
import * as vue from 'vue-demi';
import * as fuse_js from 'fuse.js';
import fuse_js__default, { IFuseOptions, FuseResult } from 'fuse.js';
import { JwtPayload, JwtHeader } from 'jwt-decode';
import nprogress, { NProgressOptions } from 'nprogress';
import QRCode from 'qrcode';
import Sortable, { Options as Options$3 } from 'sortablejs';
type AsyncValidatorError = Error & {
errors: ValidateError[];
fields: Record<string, ValidateError[]>;
};
interface UseAsyncValidatorExecuteReturn {
pass: boolean;
errors: AsyncValidatorError['errors'] | undefined;
errorInfo: AsyncValidatorError | null;
errorFields: AsyncValidatorError['fields'] | undefined;
}
interface UseAsyncValidatorReturn {
pass: Ref<boolean>;
isFinished: Ref<boolean>;
errors: Ref<AsyncValidatorError['errors'] | undefined>;
errorInfo: Ref<AsyncValidatorError | null>;
errorFields: Ref<AsyncValidatorError['fields'] | undefined>;
execute: () => Promise<UseAsyncValidatorExecuteReturn>;
}
interface UseAsyncValidatorOptions {
/**
* @see https://github.com/yiminghe/async-validator#options
*/
validateOption?: ValidateOption;
/**
* The validation will be triggered right away for the first time.
* Only works when `manual` is not set to true.
*
* @default true
*/
immediate?: boolean;
/**
* If set to true, the validation will not be triggered automatically.
*/
manual?: boolean;
}
/**
* Wrapper for async-validator.
*
* @see https://vueuse.org/useAsyncValidator
* @see https://github.com/yiminghe/async-validator
*/
declare function useAsyncValidator(value: MaybeRefOrGetter<Record<string, any>>, rules: MaybeRefOrGetter<Rules>, options?: UseAsyncValidatorOptions): UseAsyncValidatorReturn & PromiseLike<UseAsyncValidatorReturn>;
interface UseAxiosReturn<T, R = AxiosResponse<T>, _D = any> {
/**
* Axios Response
*/
response: ShallowRef<R | undefined>;
/**
* Axios response data
*/
data: Ref<T | undefined>;
/**
* Indicates if the request has finished
*/
isFinished: Ref<boolean>;
/**
* Indicates if the request is currently loading
*/
isLoading: Ref<boolean>;
/**
* Indicates if the request was canceled
*/
isAborted: Ref<boolean>;
/**
* Any errors that may have occurred
*/
error: ShallowRef<unknown | undefined>;
/**
* Aborts the current request
*/
abort: (message?: string | undefined) => void;
/**
* Alias to `abort`
*/
cancel: (message?: string | undefined) => void;
/**
* Alias to `isAborted`
*/
isCanceled: Ref<boolean>;
}
interface StrictUseAxiosReturn<T, R, D> extends UseAxiosReturn<T, R, D> {
/**
* Manually call the axios request
*/
execute: (url?: string | AxiosRequestConfig<D>, config?: AxiosRequestConfig<D>) => Promise<StrictUseAxiosReturn<T, R, D>>;
}
interface EasyUseAxiosReturn<T, R, D> extends UseAxiosReturn<T, R, D> {
/**
* Manually call the axios request
*/
execute: (url: string, config?: AxiosRequestConfig<D>) => Promise<EasyUseAxiosReturn<T, R, D>>;
}
interface UseAxiosOptions<T = any> {
/**
* Will automatically run axios request when `useAxios` is used
*
*/
immediate?: boolean;
/**
* Use shallowRef.
*
* @default true
*/
shallow?: boolean;
/**
* Abort previous request when a new request is made.
*
* @default true
*/
abortPrevious?: boolean;
/**
* Callback when error is caught.
*/
onError?: (e: unknown) => void;
/**
* Callback when success is caught.
*/
onSuccess?: (data: T) => void;
/**
* Initial data to use
*/
initialData?: T;
/**
* Sets the state to initialState before executing the promise.
*/
resetOnExecute?: boolean;
/**
* Callback when request is finished.
*/
onFinish?: () => void;
}
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>, options?: UseAxiosOptions): StrictUseAxiosReturn<T, R, D> & Promise<StrictUseAxiosReturn<T, R, D>>;
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(url: string, instance?: AxiosInstance, options?: UseAxiosOptions): StrictUseAxiosReturn<T, R, D> & Promise<StrictUseAxiosReturn<T, R, D>>;
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(url: string, config: AxiosRequestConfig<D>, instance: AxiosInstance, options?: UseAxiosOptions): StrictUseAxiosReturn<T, R, D> & Promise<StrictUseAxiosReturn<T, R, D>>;
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: AxiosRequestConfig<D>): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: AxiosRequestConfig<D>, instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
type EndsWithCase<T> = T extends `${infer _}Case` ? T : never;
type FilterKeys<T> = {
[K in keyof T as K extends string ? K : never]: EndsWithCase<K>;
};
type ChangeCaseKeys = FilterKeys<typeof changeCase>;
type ChangeCaseType = ChangeCaseKeys[keyof ChangeCaseKeys];
declare function useChangeCase(input: MaybeRef<string>, type: MaybeRefOrGetter<ChangeCaseType>, options?: MaybeRefOrGetter<Options> | undefined): WritableComputedRef<string>;
declare function useChangeCase(input: MaybeRefOrGetter<string>, type: MaybeRefOrGetter<ChangeCaseType>, options?: MaybeRefOrGetter<Options> | undefined): ComputedRef<string>;
/**
* Creates a new {@link useCookies} function
* @param req - incoming http request (for SSR)
* @see https://github.com/reactivestack/cookies/tree/master/packages/universal-cookie universal-cookie
* @description Creates universal-cookie instance using request (default is window.document.cookie) and returns {@link useCookies} function with provided universal-cookie instance
*/
declare function createCookies(req?: IncomingMessage): (dependencies?: string[] | null, { doNotParse, autoUpdateDependencies }?: {
doNotParse?: boolean | undefined;
autoUpdateDependencies?: boolean | undefined;
}) => {
/**
* Reactive get cookie by name. If **autoUpdateDependencies = true** then it will update watching dependencies
*/
get: <T = any>(name: string, options?: universal_cookie.CookieGetOptions | undefined) => T;
/**
* Reactive get all cookies
*/
getAll: <T = any>(options?: universal_cookie.CookieGetOptions | undefined) => T;
set: (name: string, value: any, options?: universal_cookie.CookieSetOptions | undefined) => void;
remove: (name: string, options?: universal_cookie.CookieSetOptions | undefined) => void;
addChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
removeChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
};
/**
* Reactive methods to work with cookies (use {@link createCookies} method instead if you are using SSR)
* @param dependencies - array of watching cookie's names. Pass empty array if don't want to watch cookies changes.
* @param options
* @param options.doNotParse - don't try parse value as JSON
* @param options.autoUpdateDependencies - automatically update watching dependencies
* @param cookies - universal-cookie instance
*/
declare function useCookies(dependencies?: string[] | null, { doNotParse, autoUpdateDependencies }?: {
doNotParse?: boolean | undefined;
autoUpdateDependencies?: boolean | undefined;
}, cookies?: universal_cookie__default): {
/**
* Reactive get cookie by name. If **autoUpdateDependencies = true** then it will update watching dependencies
*/
get: <T = any>(name: string, options?: universal_cookie.CookieGetOptions | undefined) => T;
/**
* Reactive get all cookies
*/
getAll: <T = any>(options?: universal_cookie.CookieGetOptions | undefined) => T;
set: (name: string, value: any, options?: universal_cookie.CookieSetOptions | undefined) => void;
remove: (name: string, options?: universal_cookie.CookieSetOptions | undefined) => void;
addChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
removeChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
};
type UseDrauuOptions = Omit<Options$1, 'el'>;
interface UseDrauuReturn {
drauuInstance: Ref<Drauu | undefined>;
load: (svg: string) => void;
dump: () => string | undefined;
clear: () => void;
cancel: () => void;
undo: () => boolean | undefined;
redo: () => boolean | undefined;
canUndo: Ref<boolean>;
canRedo: Ref<boolean>;
brush: Ref<Brush>;
onChanged: EventHookOn;
onCommitted: EventHookOn;
onStart: EventHookOn;
onEnd: EventHookOn;
onCanceled: EventHookOn;
}
/**
* Reactive drauu
*
* @see https://vueuse.org/useDrauu
* @param target The target svg element
* @param options Drauu Options
*/
declare function useDrauu(target: MaybeComputedElementRef, options?: UseDrauuOptions): UseDrauuReturn;
interface UseFocusTrapOptions extends Options$2 {
/**
* Immediately activate the trap
*/
immediate?: boolean;
}
interface UseFocusTrapReturn {
/**
* Indicates if the focus trap is currently active
*/
hasFocus: Ref<boolean>;
/**
* Indicates if the focus trap is currently paused
*/
isPaused: Ref<boolean>;
/**
* Activate the focus trap
*
* @see https://github.com/focus-trap/focus-trap#trapactivateactivateoptions
* @param opts Activate focus trap options
*/
activate: (opts?: ActivateOptions) => void;
/**
* Deactivate the focus trap
*
* @see https://github.com/focus-trap/focus-trap#trapdeactivatedeactivateoptions
* @param opts Deactivate focus trap options
*/
deactivate: (opts?: DeactivateOptions) => void;
/**
* Pause the focus trap
*
* @see https://github.com/focus-trap/focus-trap#trappause
*/
pause: Fn;
/**
* Unpauses the focus trap
*
* @see https://github.com/focus-trap/focus-trap#trapunpause
*/
unpause: Fn;
}
/**
* Reactive focus-trap
*
* @see https://vueuse.org/useFocusTrap
*/
declare function useFocusTrap(target: Arrayable<MaybeRefOrGetter<string> | MaybeComputedElementRef>, options?: UseFocusTrapOptions): UseFocusTrapReturn;
type FuseOptions<T> = IFuseOptions<T>;
interface UseFuseOptions<T> {
fuseOptions?: FuseOptions<T>;
resultLimit?: number;
matchAllWhenSearchEmpty?: boolean;
}
declare function useFuse<DataItem>(search: MaybeRefOrGetter<string>, data: MaybeRefOrGetter<DataItem[]>, options?: MaybeRefOrGetter<UseFuseOptions<DataItem>>): {
fuse: vue.Ref<{
search: <R = DataItem>(pattern: string | fuse_js.Expression, options?: fuse_js.FuseSearchOptions) => FuseResult<R>[];
setCollection: (docs: readonly DataItem[], index?: fuse_js.FuseIndex<DataItem> | undefined) => void;
add: (doc: DataItem) => void;
remove: (predicate: (doc: DataItem, idx: number) => boolean) => DataItem[];
removeAt: (idx: number) => void;
getIndex: () => fuse_js.FuseIndex<DataItem>;
}, fuse_js__default<DataItem> | {
search: <R = DataItem>(pattern: string | fuse_js.Expression, options?: fuse_js.FuseSearchOptions) => FuseResult<R>[];
setCollection: (docs: readonly DataItem[], index?: fuse_js.FuseIndex<DataItem> | undefined) => void;
add: (doc: DataItem) => void;
remove: (predicate: (doc: DataItem, idx: number) => boolean) => DataItem[];
removeAt: (idx: number) => void;
getIndex: () => fuse_js.FuseIndex<DataItem>;
}>;
results: ComputedRef<FuseResult<DataItem>[]>;
};
type UseFuseReturn = ReturnType<typeof useFuse>;
interface UseIDBOptions extends ConfigurableFlush {
/**
* Watch for deep changes
*
* @default true
*/
deep?: boolean;
/**
* On error callback
*
* Default log error to `console.error`
*/
onError?: (error: unknown) => void;
/**
* Use shallow ref as reference
*
* @default false
*/
shallow?: boolean;
/**
* Write the default value to the storage when it does not exist
*
* @default true
*/
writeDefaults?: boolean;
}
interface UseIDBKeyvalReturn<T> {
data: RemovableRef<T>;
isFinished: Ref<boolean>;
set: (value: T) => Promise<void>;
}
/**
*
* @param key
* @param initialValue
* @param options
*/
declare function useIDBKeyval<T>(key: IDBValidKey, initialValue: MaybeRefOrGetter<T>, options?: UseIDBOptions): UseIDBKeyvalReturn<T>;
interface UseJwtOptions<Fallback> {
/**
* Value returned when encounter error on decoding
*
* @default null
*/
fallbackValue?: Fallback;
/**
* Error callback for decoding
*/
onError?: (error: unknown) => void;
}
interface UseJwtReturn<Payload, Header, Fallback> {
header: ComputedRef<Header | Fallback>;
payload: ComputedRef<Payload | Fallback>;
}
/**
* Reactive decoded jwt token.
*
* @see https://vueuse.org/useJwt
*/
declare function useJwt<Payload extends object = JwtPayload, Header extends object = JwtHeader, Fallback = null>(encodedJwt: MaybeRefOrGetter<string>, options?: UseJwtOptions<Fallback>): UseJwtReturn<Payload, Header, Fallback>;
type UseNProgressOptions = Partial<NProgressOptions>;
/**
* Reactive progress bar.
*
* @see https://vueuse.org/useNProgress
*/
declare function useNProgress(currentProgress?: MaybeRefOrGetter<number | null | undefined>, options?: UseNProgressOptions): {
isLoading: vue.WritableComputedRef<boolean, boolean>;
progress: vue.Ref<number | (() => number | null | undefined) | null | undefined, number | vue.Ref<number | null | undefined, number | null | undefined> | vue.ShallowRef<number | null | undefined> | vue.WritableComputedRef<number | null | undefined, number | null | undefined> | vue.ComputedRef<number | null | undefined> | (() => number | null | undefined) | null | undefined>;
start: () => nprogress.NProgress;
done: (force?: boolean) => nprogress.NProgress;
remove: () => void;
};
type UseNProgressReturn = ReturnType<typeof useNProgress>;
/**
* Wrapper for qrcode.
*
* @see https://vueuse.org/useQRCode
* @param text
* @param options
*/
declare function useQRCode(text: MaybeRefOrGetter<string>, options?: QRCode.QRCodeToDataURLOptions): vue.Ref<string, string>;
interface UseSortableReturn {
/**
* start sortable instance
*/
start: () => void;
/**
* destroy sortable instance
*/
stop: () => void;
/**
* Options getter/setter
* @param name a Sortable.Options property.
* @param value a value.
*/
option: (<K extends keyof Sortable.Options>(name: K, value: Sortable.Options[K]) => void) & (<K extends keyof Sortable.Options>(name: K) => Sortable.Options[K]);
}
type UseSortableOptions = Options$3 & ConfigurableDocument;
declare function useSortable<T>(selector: string, list: MaybeRefOrGetter$1<T[]>, options?: UseSortableOptions): UseSortableReturn;
declare function useSortable<T>(el: MaybeRefOrGetter$1<HTMLElement | null | undefined>, list: MaybeRefOrGetter$1<T[]>, options?: UseSortableOptions): UseSortableReturn;
/**
* Inserts a element into the DOM at a given index.
* @param parentElement
* @param element
* @param {number} index
* @see https://github.com/Alfred-Skyblue/vue-draggable-plus/blob/a3829222095e1949bf2c9a20979d7b5930e66f14/src/utils/index.ts#L81C1-L94C2
*/
declare function insertNodeAt(parentElement: Element, element: Element, index: number): void;
/**
* Removes a node from the DOM.
* @param {Node} node
* @see https://github.com/Alfred-Skyblue/vue-draggable-plus/blob/a3829222095e1949bf2c9a20979d7b5930e66f14/src/utils/index.ts#L96C1-L102C2
*/
declare function removeNode(node: Node): void;
declare function moveArrayElement<T>(list: MaybeRefOrGetter$1<T[]>, from: number, to: number, e?: Sortable.SortableEvent | null): void;
export { type AsyncValidatorError, type ChangeCaseType, type EasyUseAxiosReturn, type FuseOptions, type StrictUseAxiosReturn, type UseAsyncValidatorExecuteReturn, type UseAsyncValidatorOptions, type UseAsyncValidatorReturn, type UseAxiosOptions, type UseAxiosReturn, type UseDrauuOptions, type UseDrauuReturn, type UseFocusTrapOptions, type UseFocusTrapReturn, type UseFuseOptions, type UseFuseReturn, type UseIDBKeyvalReturn, type UseIDBOptions, type UseJwtOptions, type UseJwtReturn, type UseNProgressOptions, type UseNProgressReturn, type UseSortableOptions, type UseSortableReturn, createCookies, insertNodeAt, moveArrayElement, removeNode, useAsyncValidator, useAxios, useChangeCase, useCookies, useDrauu, useFocusTrap, useFuse, useIDBKeyval, useJwt, useNProgress, useQRCode, useSortable };

441
node_modules/@vueuse/integrations/index.d.mts generated vendored Normal file
View File

@@ -0,0 +1,441 @@
import { MaybeRefOrGetter, MaybeRef, ConfigurableFlush, RemovableRef } from '@vueuse/shared';
import { ValidateError, ValidateOption, Rules } from 'async-validator';
import { Ref, ShallowRef, WritableComputedRef, ComputedRef } from 'vue-demi';
import { AxiosResponse, AxiosRequestConfig, AxiosInstance } from 'axios';
import * as changeCase from 'change-case';
import { Options } from 'change-case';
import * as universal_cookie from 'universal-cookie';
import universal_cookie__default from 'universal-cookie';
import { IncomingMessage } from 'node:http';
import { EventHookOn, MaybeComputedElementRef, Fn, Arrayable, ConfigurableDocument, MaybeRefOrGetter as MaybeRefOrGetter$1 } from '@vueuse/core';
import { Options as Options$1, Drauu, Brush } from 'drauu';
import { Options as Options$2, ActivateOptions, DeactivateOptions } from 'focus-trap';
import * as vue from 'vue-demi';
import * as fuse_js from 'fuse.js';
import fuse_js__default, { IFuseOptions, FuseResult } from 'fuse.js';
import { JwtPayload, JwtHeader } from 'jwt-decode';
import nprogress, { NProgressOptions } from 'nprogress';
import QRCode from 'qrcode';
import Sortable, { Options as Options$3 } from 'sortablejs';
type AsyncValidatorError = Error & {
errors: ValidateError[];
fields: Record<string, ValidateError[]>;
};
interface UseAsyncValidatorExecuteReturn {
pass: boolean;
errors: AsyncValidatorError['errors'] | undefined;
errorInfo: AsyncValidatorError | null;
errorFields: AsyncValidatorError['fields'] | undefined;
}
interface UseAsyncValidatorReturn {
pass: Ref<boolean>;
isFinished: Ref<boolean>;
errors: Ref<AsyncValidatorError['errors'] | undefined>;
errorInfo: Ref<AsyncValidatorError | null>;
errorFields: Ref<AsyncValidatorError['fields'] | undefined>;
execute: () => Promise<UseAsyncValidatorExecuteReturn>;
}
interface UseAsyncValidatorOptions {
/**
* @see https://github.com/yiminghe/async-validator#options
*/
validateOption?: ValidateOption;
/**
* The validation will be triggered right away for the first time.
* Only works when `manual` is not set to true.
*
* @default true
*/
immediate?: boolean;
/**
* If set to true, the validation will not be triggered automatically.
*/
manual?: boolean;
}
/**
* Wrapper for async-validator.
*
* @see https://vueuse.org/useAsyncValidator
* @see https://github.com/yiminghe/async-validator
*/
declare function useAsyncValidator(value: MaybeRefOrGetter<Record<string, any>>, rules: MaybeRefOrGetter<Rules>, options?: UseAsyncValidatorOptions): UseAsyncValidatorReturn & PromiseLike<UseAsyncValidatorReturn>;
interface UseAxiosReturn<T, R = AxiosResponse<T>, _D = any> {
/**
* Axios Response
*/
response: ShallowRef<R | undefined>;
/**
* Axios response data
*/
data: Ref<T | undefined>;
/**
* Indicates if the request has finished
*/
isFinished: Ref<boolean>;
/**
* Indicates if the request is currently loading
*/
isLoading: Ref<boolean>;
/**
* Indicates if the request was canceled
*/
isAborted: Ref<boolean>;
/**
* Any errors that may have occurred
*/
error: ShallowRef<unknown | undefined>;
/**
* Aborts the current request
*/
abort: (message?: string | undefined) => void;
/**
* Alias to `abort`
*/
cancel: (message?: string | undefined) => void;
/**
* Alias to `isAborted`
*/
isCanceled: Ref<boolean>;
}
interface StrictUseAxiosReturn<T, R, D> extends UseAxiosReturn<T, R, D> {
/**
* Manually call the axios request
*/
execute: (url?: string | AxiosRequestConfig<D>, config?: AxiosRequestConfig<D>) => Promise<StrictUseAxiosReturn<T, R, D>>;
}
interface EasyUseAxiosReturn<T, R, D> extends UseAxiosReturn<T, R, D> {
/**
* Manually call the axios request
*/
execute: (url: string, config?: AxiosRequestConfig<D>) => Promise<EasyUseAxiosReturn<T, R, D>>;
}
interface UseAxiosOptions<T = any> {
/**
* Will automatically run axios request when `useAxios` is used
*
*/
immediate?: boolean;
/**
* Use shallowRef.
*
* @default true
*/
shallow?: boolean;
/**
* Abort previous request when a new request is made.
*
* @default true
*/
abortPrevious?: boolean;
/**
* Callback when error is caught.
*/
onError?: (e: unknown) => void;
/**
* Callback when success is caught.
*/
onSuccess?: (data: T) => void;
/**
* Initial data to use
*/
initialData?: T;
/**
* Sets the state to initialState before executing the promise.
*/
resetOnExecute?: boolean;
/**
* Callback when request is finished.
*/
onFinish?: () => void;
}
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>, options?: UseAxiosOptions): StrictUseAxiosReturn<T, R, D> & Promise<StrictUseAxiosReturn<T, R, D>>;
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(url: string, instance?: AxiosInstance, options?: UseAxiosOptions): StrictUseAxiosReturn<T, R, D> & Promise<StrictUseAxiosReturn<T, R, D>>;
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(url: string, config: AxiosRequestConfig<D>, instance: AxiosInstance, options?: UseAxiosOptions): StrictUseAxiosReturn<T, R, D> & Promise<StrictUseAxiosReturn<T, R, D>>;
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: AxiosRequestConfig<D>): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: AxiosRequestConfig<D>, instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
type EndsWithCase<T> = T extends `${infer _}Case` ? T : never;
type FilterKeys<T> = {
[K in keyof T as K extends string ? K : never]: EndsWithCase<K>;
};
type ChangeCaseKeys = FilterKeys<typeof changeCase>;
type ChangeCaseType = ChangeCaseKeys[keyof ChangeCaseKeys];
declare function useChangeCase(input: MaybeRef<string>, type: MaybeRefOrGetter<ChangeCaseType>, options?: MaybeRefOrGetter<Options> | undefined): WritableComputedRef<string>;
declare function useChangeCase(input: MaybeRefOrGetter<string>, type: MaybeRefOrGetter<ChangeCaseType>, options?: MaybeRefOrGetter<Options> | undefined): ComputedRef<string>;
/**
* Creates a new {@link useCookies} function
* @param req - incoming http request (for SSR)
* @see https://github.com/reactivestack/cookies/tree/master/packages/universal-cookie universal-cookie
* @description Creates universal-cookie instance using request (default is window.document.cookie) and returns {@link useCookies} function with provided universal-cookie instance
*/
declare function createCookies(req?: IncomingMessage): (dependencies?: string[] | null, { doNotParse, autoUpdateDependencies }?: {
doNotParse?: boolean | undefined;
autoUpdateDependencies?: boolean | undefined;
}) => {
/**
* Reactive get cookie by name. If **autoUpdateDependencies = true** then it will update watching dependencies
*/
get: <T = any>(name: string, options?: universal_cookie.CookieGetOptions | undefined) => T;
/**
* Reactive get all cookies
*/
getAll: <T = any>(options?: universal_cookie.CookieGetOptions | undefined) => T;
set: (name: string, value: any, options?: universal_cookie.CookieSetOptions | undefined) => void;
remove: (name: string, options?: universal_cookie.CookieSetOptions | undefined) => void;
addChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
removeChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
};
/**
* Reactive methods to work with cookies (use {@link createCookies} method instead if you are using SSR)
* @param dependencies - array of watching cookie's names. Pass empty array if don't want to watch cookies changes.
* @param options
* @param options.doNotParse - don't try parse value as JSON
* @param options.autoUpdateDependencies - automatically update watching dependencies
* @param cookies - universal-cookie instance
*/
declare function useCookies(dependencies?: string[] | null, { doNotParse, autoUpdateDependencies }?: {
doNotParse?: boolean | undefined;
autoUpdateDependencies?: boolean | undefined;
}, cookies?: universal_cookie__default): {
/**
* Reactive get cookie by name. If **autoUpdateDependencies = true** then it will update watching dependencies
*/
get: <T = any>(name: string, options?: universal_cookie.CookieGetOptions | undefined) => T;
/**
* Reactive get all cookies
*/
getAll: <T = any>(options?: universal_cookie.CookieGetOptions | undefined) => T;
set: (name: string, value: any, options?: universal_cookie.CookieSetOptions | undefined) => void;
remove: (name: string, options?: universal_cookie.CookieSetOptions | undefined) => void;
addChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
removeChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
};
type UseDrauuOptions = Omit<Options$1, 'el'>;
interface UseDrauuReturn {
drauuInstance: Ref<Drauu | undefined>;
load: (svg: string) => void;
dump: () => string | undefined;
clear: () => void;
cancel: () => void;
undo: () => boolean | undefined;
redo: () => boolean | undefined;
canUndo: Ref<boolean>;
canRedo: Ref<boolean>;
brush: Ref<Brush>;
onChanged: EventHookOn;
onCommitted: EventHookOn;
onStart: EventHookOn;
onEnd: EventHookOn;
onCanceled: EventHookOn;
}
/**
* Reactive drauu
*
* @see https://vueuse.org/useDrauu
* @param target The target svg element
* @param options Drauu Options
*/
declare function useDrauu(target: MaybeComputedElementRef, options?: UseDrauuOptions): UseDrauuReturn;
interface UseFocusTrapOptions extends Options$2 {
/**
* Immediately activate the trap
*/
immediate?: boolean;
}
interface UseFocusTrapReturn {
/**
* Indicates if the focus trap is currently active
*/
hasFocus: Ref<boolean>;
/**
* Indicates if the focus trap is currently paused
*/
isPaused: Ref<boolean>;
/**
* Activate the focus trap
*
* @see https://github.com/focus-trap/focus-trap#trapactivateactivateoptions
* @param opts Activate focus trap options
*/
activate: (opts?: ActivateOptions) => void;
/**
* Deactivate the focus trap
*
* @see https://github.com/focus-trap/focus-trap#trapdeactivatedeactivateoptions
* @param opts Deactivate focus trap options
*/
deactivate: (opts?: DeactivateOptions) => void;
/**
* Pause the focus trap
*
* @see https://github.com/focus-trap/focus-trap#trappause
*/
pause: Fn;
/**
* Unpauses the focus trap
*
* @see https://github.com/focus-trap/focus-trap#trapunpause
*/
unpause: Fn;
}
/**
* Reactive focus-trap
*
* @see https://vueuse.org/useFocusTrap
*/
declare function useFocusTrap(target: Arrayable<MaybeRefOrGetter<string> | MaybeComputedElementRef>, options?: UseFocusTrapOptions): UseFocusTrapReturn;
type FuseOptions<T> = IFuseOptions<T>;
interface UseFuseOptions<T> {
fuseOptions?: FuseOptions<T>;
resultLimit?: number;
matchAllWhenSearchEmpty?: boolean;
}
declare function useFuse<DataItem>(search: MaybeRefOrGetter<string>, data: MaybeRefOrGetter<DataItem[]>, options?: MaybeRefOrGetter<UseFuseOptions<DataItem>>): {
fuse: vue.Ref<{
search: <R = DataItem>(pattern: string | fuse_js.Expression, options?: fuse_js.FuseSearchOptions) => FuseResult<R>[];
setCollection: (docs: readonly DataItem[], index?: fuse_js.FuseIndex<DataItem> | undefined) => void;
add: (doc: DataItem) => void;
remove: (predicate: (doc: DataItem, idx: number) => boolean) => DataItem[];
removeAt: (idx: number) => void;
getIndex: () => fuse_js.FuseIndex<DataItem>;
}, fuse_js__default<DataItem> | {
search: <R = DataItem>(pattern: string | fuse_js.Expression, options?: fuse_js.FuseSearchOptions) => FuseResult<R>[];
setCollection: (docs: readonly DataItem[], index?: fuse_js.FuseIndex<DataItem> | undefined) => void;
add: (doc: DataItem) => void;
remove: (predicate: (doc: DataItem, idx: number) => boolean) => DataItem[];
removeAt: (idx: number) => void;
getIndex: () => fuse_js.FuseIndex<DataItem>;
}>;
results: ComputedRef<FuseResult<DataItem>[]>;
};
type UseFuseReturn = ReturnType<typeof useFuse>;
interface UseIDBOptions extends ConfigurableFlush {
/**
* Watch for deep changes
*
* @default true
*/
deep?: boolean;
/**
* On error callback
*
* Default log error to `console.error`
*/
onError?: (error: unknown) => void;
/**
* Use shallow ref as reference
*
* @default false
*/
shallow?: boolean;
/**
* Write the default value to the storage when it does not exist
*
* @default true
*/
writeDefaults?: boolean;
}
interface UseIDBKeyvalReturn<T> {
data: RemovableRef<T>;
isFinished: Ref<boolean>;
set: (value: T) => Promise<void>;
}
/**
*
* @param key
* @param initialValue
* @param options
*/
declare function useIDBKeyval<T>(key: IDBValidKey, initialValue: MaybeRefOrGetter<T>, options?: UseIDBOptions): UseIDBKeyvalReturn<T>;
interface UseJwtOptions<Fallback> {
/**
* Value returned when encounter error on decoding
*
* @default null
*/
fallbackValue?: Fallback;
/**
* Error callback for decoding
*/
onError?: (error: unknown) => void;
}
interface UseJwtReturn<Payload, Header, Fallback> {
header: ComputedRef<Header | Fallback>;
payload: ComputedRef<Payload | Fallback>;
}
/**
* Reactive decoded jwt token.
*
* @see https://vueuse.org/useJwt
*/
declare function useJwt<Payload extends object = JwtPayload, Header extends object = JwtHeader, Fallback = null>(encodedJwt: MaybeRefOrGetter<string>, options?: UseJwtOptions<Fallback>): UseJwtReturn<Payload, Header, Fallback>;
type UseNProgressOptions = Partial<NProgressOptions>;
/**
* Reactive progress bar.
*
* @see https://vueuse.org/useNProgress
*/
declare function useNProgress(currentProgress?: MaybeRefOrGetter<number | null | undefined>, options?: UseNProgressOptions): {
isLoading: vue.WritableComputedRef<boolean, boolean>;
progress: vue.Ref<number | (() => number | null | undefined) | null | undefined, number | vue.Ref<number | null | undefined, number | null | undefined> | vue.ShallowRef<number | null | undefined> | vue.WritableComputedRef<number | null | undefined, number | null | undefined> | vue.ComputedRef<number | null | undefined> | (() => number | null | undefined) | null | undefined>;
start: () => nprogress.NProgress;
done: (force?: boolean) => nprogress.NProgress;
remove: () => void;
};
type UseNProgressReturn = ReturnType<typeof useNProgress>;
/**
* Wrapper for qrcode.
*
* @see https://vueuse.org/useQRCode
* @param text
* @param options
*/
declare function useQRCode(text: MaybeRefOrGetter<string>, options?: QRCode.QRCodeToDataURLOptions): vue.Ref<string, string>;
interface UseSortableReturn {
/**
* start sortable instance
*/
start: () => void;
/**
* destroy sortable instance
*/
stop: () => void;
/**
* Options getter/setter
* @param name a Sortable.Options property.
* @param value a value.
*/
option: (<K extends keyof Sortable.Options>(name: K, value: Sortable.Options[K]) => void) & (<K extends keyof Sortable.Options>(name: K) => Sortable.Options[K]);
}
type UseSortableOptions = Options$3 & ConfigurableDocument;
declare function useSortable<T>(selector: string, list: MaybeRefOrGetter$1<T[]>, options?: UseSortableOptions): UseSortableReturn;
declare function useSortable<T>(el: MaybeRefOrGetter$1<HTMLElement | null | undefined>, list: MaybeRefOrGetter$1<T[]>, options?: UseSortableOptions): UseSortableReturn;
/**
* Inserts a element into the DOM at a given index.
* @param parentElement
* @param element
* @param {number} index
* @see https://github.com/Alfred-Skyblue/vue-draggable-plus/blob/a3829222095e1949bf2c9a20979d7b5930e66f14/src/utils/index.ts#L81C1-L94C2
*/
declare function insertNodeAt(parentElement: Element, element: Element, index: number): void;
/**
* Removes a node from the DOM.
* @param {Node} node
* @see https://github.com/Alfred-Skyblue/vue-draggable-plus/blob/a3829222095e1949bf2c9a20979d7b5930e66f14/src/utils/index.ts#L96C1-L102C2
*/
declare function removeNode(node: Node): void;
declare function moveArrayElement<T>(list: MaybeRefOrGetter$1<T[]>, from: number, to: number, e?: Sortable.SortableEvent | null): void;
export { type AsyncValidatorError, type ChangeCaseType, type EasyUseAxiosReturn, type FuseOptions, type StrictUseAxiosReturn, type UseAsyncValidatorExecuteReturn, type UseAsyncValidatorOptions, type UseAsyncValidatorReturn, type UseAxiosOptions, type UseAxiosReturn, type UseDrauuOptions, type UseDrauuReturn, type UseFocusTrapOptions, type UseFocusTrapReturn, type UseFuseOptions, type UseFuseReturn, type UseIDBKeyvalReturn, type UseIDBOptions, type UseJwtOptions, type UseJwtReturn, type UseNProgressOptions, type UseNProgressReturn, type UseSortableOptions, type UseSortableReturn, createCookies, insertNodeAt, moveArrayElement, removeNode, useAsyncValidator, useAxios, useChangeCase, useCookies, useDrauu, useFocusTrap, useFuse, useIDBKeyval, useJwt, useNProgress, useQRCode, useSortable };

441
node_modules/@vueuse/integrations/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,441 @@
import { MaybeRefOrGetter, MaybeRef, ConfigurableFlush, RemovableRef } from '@vueuse/shared';
import { ValidateError, ValidateOption, Rules } from 'async-validator';
import { Ref, ShallowRef, WritableComputedRef, ComputedRef } from 'vue-demi';
import { AxiosResponse, AxiosRequestConfig, AxiosInstance } from 'axios';
import * as changeCase from 'change-case';
import { Options } from 'change-case';
import * as universal_cookie from 'universal-cookie';
import universal_cookie__default from 'universal-cookie';
import { IncomingMessage } from 'node:http';
import { EventHookOn, MaybeComputedElementRef, Fn, Arrayable, ConfigurableDocument, MaybeRefOrGetter as MaybeRefOrGetter$1 } from '@vueuse/core';
import { Options as Options$1, Drauu, Brush } from 'drauu';
import { Options as Options$2, ActivateOptions, DeactivateOptions } from 'focus-trap';
import * as vue from 'vue-demi';
import * as fuse_js from 'fuse.js';
import fuse_js__default, { IFuseOptions, FuseResult } from 'fuse.js';
import { JwtPayload, JwtHeader } from 'jwt-decode';
import nprogress, { NProgressOptions } from 'nprogress';
import QRCode from 'qrcode';
import Sortable, { Options as Options$3 } from 'sortablejs';
type AsyncValidatorError = Error & {
errors: ValidateError[];
fields: Record<string, ValidateError[]>;
};
interface UseAsyncValidatorExecuteReturn {
pass: boolean;
errors: AsyncValidatorError['errors'] | undefined;
errorInfo: AsyncValidatorError | null;
errorFields: AsyncValidatorError['fields'] | undefined;
}
interface UseAsyncValidatorReturn {
pass: Ref<boolean>;
isFinished: Ref<boolean>;
errors: Ref<AsyncValidatorError['errors'] | undefined>;
errorInfo: Ref<AsyncValidatorError | null>;
errorFields: Ref<AsyncValidatorError['fields'] | undefined>;
execute: () => Promise<UseAsyncValidatorExecuteReturn>;
}
interface UseAsyncValidatorOptions {
/**
* @see https://github.com/yiminghe/async-validator#options
*/
validateOption?: ValidateOption;
/**
* The validation will be triggered right away for the first time.
* Only works when `manual` is not set to true.
*
* @default true
*/
immediate?: boolean;
/**
* If set to true, the validation will not be triggered automatically.
*/
manual?: boolean;
}
/**
* Wrapper for async-validator.
*
* @see https://vueuse.org/useAsyncValidator
* @see https://github.com/yiminghe/async-validator
*/
declare function useAsyncValidator(value: MaybeRefOrGetter<Record<string, any>>, rules: MaybeRefOrGetter<Rules>, options?: UseAsyncValidatorOptions): UseAsyncValidatorReturn & PromiseLike<UseAsyncValidatorReturn>;
interface UseAxiosReturn<T, R = AxiosResponse<T>, _D = any> {
/**
* Axios Response
*/
response: ShallowRef<R | undefined>;
/**
* Axios response data
*/
data: Ref<T | undefined>;
/**
* Indicates if the request has finished
*/
isFinished: Ref<boolean>;
/**
* Indicates if the request is currently loading
*/
isLoading: Ref<boolean>;
/**
* Indicates if the request was canceled
*/
isAborted: Ref<boolean>;
/**
* Any errors that may have occurred
*/
error: ShallowRef<unknown | undefined>;
/**
* Aborts the current request
*/
abort: (message?: string | undefined) => void;
/**
* Alias to `abort`
*/
cancel: (message?: string | undefined) => void;
/**
* Alias to `isAborted`
*/
isCanceled: Ref<boolean>;
}
interface StrictUseAxiosReturn<T, R, D> extends UseAxiosReturn<T, R, D> {
/**
* Manually call the axios request
*/
execute: (url?: string | AxiosRequestConfig<D>, config?: AxiosRequestConfig<D>) => Promise<StrictUseAxiosReturn<T, R, D>>;
}
interface EasyUseAxiosReturn<T, R, D> extends UseAxiosReturn<T, R, D> {
/**
* Manually call the axios request
*/
execute: (url: string, config?: AxiosRequestConfig<D>) => Promise<EasyUseAxiosReturn<T, R, D>>;
}
interface UseAxiosOptions<T = any> {
/**
* Will automatically run axios request when `useAxios` is used
*
*/
immediate?: boolean;
/**
* Use shallowRef.
*
* @default true
*/
shallow?: boolean;
/**
* Abort previous request when a new request is made.
*
* @default true
*/
abortPrevious?: boolean;
/**
* Callback when error is caught.
*/
onError?: (e: unknown) => void;
/**
* Callback when success is caught.
*/
onSuccess?: (data: T) => void;
/**
* Initial data to use
*/
initialData?: T;
/**
* Sets the state to initialState before executing the promise.
*/
resetOnExecute?: boolean;
/**
* Callback when request is finished.
*/
onFinish?: () => void;
}
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>, options?: UseAxiosOptions): StrictUseAxiosReturn<T, R, D> & Promise<StrictUseAxiosReturn<T, R, D>>;
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(url: string, instance?: AxiosInstance, options?: UseAxiosOptions): StrictUseAxiosReturn<T, R, D> & Promise<StrictUseAxiosReturn<T, R, D>>;
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(url: string, config: AxiosRequestConfig<D>, instance: AxiosInstance, options?: UseAxiosOptions): StrictUseAxiosReturn<T, R, D> & Promise<StrictUseAxiosReturn<T, R, D>>;
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: AxiosRequestConfig<D>): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: AxiosRequestConfig<D>, instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
type EndsWithCase<T> = T extends `${infer _}Case` ? T : never;
type FilterKeys<T> = {
[K in keyof T as K extends string ? K : never]: EndsWithCase<K>;
};
type ChangeCaseKeys = FilterKeys<typeof changeCase>;
type ChangeCaseType = ChangeCaseKeys[keyof ChangeCaseKeys];
declare function useChangeCase(input: MaybeRef<string>, type: MaybeRefOrGetter<ChangeCaseType>, options?: MaybeRefOrGetter<Options> | undefined): WritableComputedRef<string>;
declare function useChangeCase(input: MaybeRefOrGetter<string>, type: MaybeRefOrGetter<ChangeCaseType>, options?: MaybeRefOrGetter<Options> | undefined): ComputedRef<string>;
/**
* Creates a new {@link useCookies} function
* @param req - incoming http request (for SSR)
* @see https://github.com/reactivestack/cookies/tree/master/packages/universal-cookie universal-cookie
* @description Creates universal-cookie instance using request (default is window.document.cookie) and returns {@link useCookies} function with provided universal-cookie instance
*/
declare function createCookies(req?: IncomingMessage): (dependencies?: string[] | null, { doNotParse, autoUpdateDependencies }?: {
doNotParse?: boolean | undefined;
autoUpdateDependencies?: boolean | undefined;
}) => {
/**
* Reactive get cookie by name. If **autoUpdateDependencies = true** then it will update watching dependencies
*/
get: <T = any>(name: string, options?: universal_cookie.CookieGetOptions | undefined) => T;
/**
* Reactive get all cookies
*/
getAll: <T = any>(options?: universal_cookie.CookieGetOptions | undefined) => T;
set: (name: string, value: any, options?: universal_cookie.CookieSetOptions | undefined) => void;
remove: (name: string, options?: universal_cookie.CookieSetOptions | undefined) => void;
addChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
removeChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
};
/**
* Reactive methods to work with cookies (use {@link createCookies} method instead if you are using SSR)
* @param dependencies - array of watching cookie's names. Pass empty array if don't want to watch cookies changes.
* @param options
* @param options.doNotParse - don't try parse value as JSON
* @param options.autoUpdateDependencies - automatically update watching dependencies
* @param cookies - universal-cookie instance
*/
declare function useCookies(dependencies?: string[] | null, { doNotParse, autoUpdateDependencies }?: {
doNotParse?: boolean | undefined;
autoUpdateDependencies?: boolean | undefined;
}, cookies?: universal_cookie__default): {
/**
* Reactive get cookie by name. If **autoUpdateDependencies = true** then it will update watching dependencies
*/
get: <T = any>(name: string, options?: universal_cookie.CookieGetOptions | undefined) => T;
/**
* Reactive get all cookies
*/
getAll: <T = any>(options?: universal_cookie.CookieGetOptions | undefined) => T;
set: (name: string, value: any, options?: universal_cookie.CookieSetOptions | undefined) => void;
remove: (name: string, options?: universal_cookie.CookieSetOptions | undefined) => void;
addChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
removeChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
};
type UseDrauuOptions = Omit<Options$1, 'el'>;
interface UseDrauuReturn {
drauuInstance: Ref<Drauu | undefined>;
load: (svg: string) => void;
dump: () => string | undefined;
clear: () => void;
cancel: () => void;
undo: () => boolean | undefined;
redo: () => boolean | undefined;
canUndo: Ref<boolean>;
canRedo: Ref<boolean>;
brush: Ref<Brush>;
onChanged: EventHookOn;
onCommitted: EventHookOn;
onStart: EventHookOn;
onEnd: EventHookOn;
onCanceled: EventHookOn;
}
/**
* Reactive drauu
*
* @see https://vueuse.org/useDrauu
* @param target The target svg element
* @param options Drauu Options
*/
declare function useDrauu(target: MaybeComputedElementRef, options?: UseDrauuOptions): UseDrauuReturn;
interface UseFocusTrapOptions extends Options$2 {
/**
* Immediately activate the trap
*/
immediate?: boolean;
}
interface UseFocusTrapReturn {
/**
* Indicates if the focus trap is currently active
*/
hasFocus: Ref<boolean>;
/**
* Indicates if the focus trap is currently paused
*/
isPaused: Ref<boolean>;
/**
* Activate the focus trap
*
* @see https://github.com/focus-trap/focus-trap#trapactivateactivateoptions
* @param opts Activate focus trap options
*/
activate: (opts?: ActivateOptions) => void;
/**
* Deactivate the focus trap
*
* @see https://github.com/focus-trap/focus-trap#trapdeactivatedeactivateoptions
* @param opts Deactivate focus trap options
*/
deactivate: (opts?: DeactivateOptions) => void;
/**
* Pause the focus trap
*
* @see https://github.com/focus-trap/focus-trap#trappause
*/
pause: Fn;
/**
* Unpauses the focus trap
*
* @see https://github.com/focus-trap/focus-trap#trapunpause
*/
unpause: Fn;
}
/**
* Reactive focus-trap
*
* @see https://vueuse.org/useFocusTrap
*/
declare function useFocusTrap(target: Arrayable<MaybeRefOrGetter<string> | MaybeComputedElementRef>, options?: UseFocusTrapOptions): UseFocusTrapReturn;
type FuseOptions<T> = IFuseOptions<T>;
interface UseFuseOptions<T> {
fuseOptions?: FuseOptions<T>;
resultLimit?: number;
matchAllWhenSearchEmpty?: boolean;
}
declare function useFuse<DataItem>(search: MaybeRefOrGetter<string>, data: MaybeRefOrGetter<DataItem[]>, options?: MaybeRefOrGetter<UseFuseOptions<DataItem>>): {
fuse: vue.Ref<{
search: <R = DataItem>(pattern: string | fuse_js.Expression, options?: fuse_js.FuseSearchOptions) => FuseResult<R>[];
setCollection: (docs: readonly DataItem[], index?: fuse_js.FuseIndex<DataItem> | undefined) => void;
add: (doc: DataItem) => void;
remove: (predicate: (doc: DataItem, idx: number) => boolean) => DataItem[];
removeAt: (idx: number) => void;
getIndex: () => fuse_js.FuseIndex<DataItem>;
}, fuse_js__default<DataItem> | {
search: <R = DataItem>(pattern: string | fuse_js.Expression, options?: fuse_js.FuseSearchOptions) => FuseResult<R>[];
setCollection: (docs: readonly DataItem[], index?: fuse_js.FuseIndex<DataItem> | undefined) => void;
add: (doc: DataItem) => void;
remove: (predicate: (doc: DataItem, idx: number) => boolean) => DataItem[];
removeAt: (idx: number) => void;
getIndex: () => fuse_js.FuseIndex<DataItem>;
}>;
results: ComputedRef<FuseResult<DataItem>[]>;
};
type UseFuseReturn = ReturnType<typeof useFuse>;
interface UseIDBOptions extends ConfigurableFlush {
/**
* Watch for deep changes
*
* @default true
*/
deep?: boolean;
/**
* On error callback
*
* Default log error to `console.error`
*/
onError?: (error: unknown) => void;
/**
* Use shallow ref as reference
*
* @default false
*/
shallow?: boolean;
/**
* Write the default value to the storage when it does not exist
*
* @default true
*/
writeDefaults?: boolean;
}
interface UseIDBKeyvalReturn<T> {
data: RemovableRef<T>;
isFinished: Ref<boolean>;
set: (value: T) => Promise<void>;
}
/**
*
* @param key
* @param initialValue
* @param options
*/
declare function useIDBKeyval<T>(key: IDBValidKey, initialValue: MaybeRefOrGetter<T>, options?: UseIDBOptions): UseIDBKeyvalReturn<T>;
interface UseJwtOptions<Fallback> {
/**
* Value returned when encounter error on decoding
*
* @default null
*/
fallbackValue?: Fallback;
/**
* Error callback for decoding
*/
onError?: (error: unknown) => void;
}
interface UseJwtReturn<Payload, Header, Fallback> {
header: ComputedRef<Header | Fallback>;
payload: ComputedRef<Payload | Fallback>;
}
/**
* Reactive decoded jwt token.
*
* @see https://vueuse.org/useJwt
*/
declare function useJwt<Payload extends object = JwtPayload, Header extends object = JwtHeader, Fallback = null>(encodedJwt: MaybeRefOrGetter<string>, options?: UseJwtOptions<Fallback>): UseJwtReturn<Payload, Header, Fallback>;
type UseNProgressOptions = Partial<NProgressOptions>;
/**
* Reactive progress bar.
*
* @see https://vueuse.org/useNProgress
*/
declare function useNProgress(currentProgress?: MaybeRefOrGetter<number | null | undefined>, options?: UseNProgressOptions): {
isLoading: vue.WritableComputedRef<boolean, boolean>;
progress: vue.Ref<number | (() => number | null | undefined) | null | undefined, number | vue.Ref<number | null | undefined, number | null | undefined> | vue.ShallowRef<number | null | undefined> | vue.WritableComputedRef<number | null | undefined, number | null | undefined> | vue.ComputedRef<number | null | undefined> | (() => number | null | undefined) | null | undefined>;
start: () => nprogress.NProgress;
done: (force?: boolean) => nprogress.NProgress;
remove: () => void;
};
type UseNProgressReturn = ReturnType<typeof useNProgress>;
/**
* Wrapper for qrcode.
*
* @see https://vueuse.org/useQRCode
* @param text
* @param options
*/
declare function useQRCode(text: MaybeRefOrGetter<string>, options?: QRCode.QRCodeToDataURLOptions): vue.Ref<string, string>;
interface UseSortableReturn {
/**
* start sortable instance
*/
start: () => void;
/**
* destroy sortable instance
*/
stop: () => void;
/**
* Options getter/setter
* @param name a Sortable.Options property.
* @param value a value.
*/
option: (<K extends keyof Sortable.Options>(name: K, value: Sortable.Options[K]) => void) & (<K extends keyof Sortable.Options>(name: K) => Sortable.Options[K]);
}
type UseSortableOptions = Options$3 & ConfigurableDocument;
declare function useSortable<T>(selector: string, list: MaybeRefOrGetter$1<T[]>, options?: UseSortableOptions): UseSortableReturn;
declare function useSortable<T>(el: MaybeRefOrGetter$1<HTMLElement | null | undefined>, list: MaybeRefOrGetter$1<T[]>, options?: UseSortableOptions): UseSortableReturn;
/**
* Inserts a element into the DOM at a given index.
* @param parentElement
* @param element
* @param {number} index
* @see https://github.com/Alfred-Skyblue/vue-draggable-plus/blob/a3829222095e1949bf2c9a20979d7b5930e66f14/src/utils/index.ts#L81C1-L94C2
*/
declare function insertNodeAt(parentElement: Element, element: Element, index: number): void;
/**
* Removes a node from the DOM.
* @param {Node} node
* @see https://github.com/Alfred-Skyblue/vue-draggable-plus/blob/a3829222095e1949bf2c9a20979d7b5930e66f14/src/utils/index.ts#L96C1-L102C2
*/
declare function removeNode(node: Node): void;
declare function moveArrayElement<T>(list: MaybeRefOrGetter$1<T[]>, from: number, to: number, e?: Sortable.SortableEvent | null): void;
export { type AsyncValidatorError, type ChangeCaseType, type EasyUseAxiosReturn, type FuseOptions, type StrictUseAxiosReturn, type UseAsyncValidatorExecuteReturn, type UseAsyncValidatorOptions, type UseAsyncValidatorReturn, type UseAxiosOptions, type UseAxiosReturn, type UseDrauuOptions, type UseDrauuReturn, type UseFocusTrapOptions, type UseFocusTrapReturn, type UseFuseOptions, type UseFuseReturn, type UseIDBKeyvalReturn, type UseIDBOptions, type UseJwtOptions, type UseJwtReturn, type UseNProgressOptions, type UseNProgressReturn, type UseSortableOptions, type UseSortableReturn, createCookies, insertNodeAt, moveArrayElement, removeNode, useAsyncValidator, useAxios, useChangeCase, useCookies, useDrauu, useFocusTrap, useFuse, useIDBKeyval, useJwt, useNProgress, useQRCode, useSortable };

817
node_modules/@vueuse/integrations/index.iife.js generated vendored Normal file
View File

@@ -0,0 +1,817 @@
var _VueDemiGlobal = typeof globalThis !== 'undefined'
? globalThis
: typeof global !== 'undefined'
? global
: typeof self !== 'undefined'
? self
: this
var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
if (VueDemi.install) {
return VueDemi
}
if (!Vue) {
console.error('[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`.')
return VueDemi
}
// Vue 2.7
if (Vue.version.slice(0, 4) === '2.7.') {
for (var key in Vue) {
VueDemi[key] = Vue[key]
}
VueDemi.isVue2 = true
VueDemi.isVue3 = false
VueDemi.install = function () {}
VueDemi.Vue = Vue
VueDemi.Vue2 = Vue
VueDemi.version = Vue.version
VueDemi.warn = Vue.util.warn
VueDemi.hasInjectionContext = function() {
return !!VueDemi.getCurrentInstance()
}
function createApp(rootComponent, rootProps) {
var vm
var provide = {}
var app = {
config: Vue.config,
use: Vue.use.bind(Vue),
mixin: Vue.mixin.bind(Vue),
component: Vue.component.bind(Vue),
provide: function (key, value) {
provide[key] = value
return this
},
directive: function (name, dir) {
if (dir) {
Vue.directive(name, dir)
return app
} else {
return Vue.directive(name)
}
},
mount: function (el, hydrating) {
if (!vm) {
vm = new Vue(Object.assign({ propsData: rootProps }, rootComponent, { provide: Object.assign(provide, rootComponent.provide) }))
vm.$mount(el, hydrating)
return vm
} else {
return vm
}
},
unmount: function () {
if (vm) {
vm.$destroy()
vm = undefined
}
},
}
return app
}
VueDemi.createApp = createApp
}
// Vue 2.6.x
else if (Vue.version.slice(0, 2) === '2.') {
if (VueCompositionAPI) {
for (var key in VueCompositionAPI) {
VueDemi[key] = VueCompositionAPI[key]
}
VueDemi.isVue2 = true
VueDemi.isVue3 = false
VueDemi.install = function () {}
VueDemi.Vue = Vue
VueDemi.Vue2 = Vue
VueDemi.version = Vue.version
VueDemi.hasInjectionContext = function() {
return !!VueDemi.getCurrentInstance()
}
} else {
console.error('[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.')
}
}
// Vue 3
else if (Vue.version.slice(0, 2) === '3.') {
for (var key in Vue) {
VueDemi[key] = Vue[key]
}
VueDemi.isVue2 = false
VueDemi.isVue3 = true
VueDemi.install = function () {}
VueDemi.Vue = Vue
VueDemi.Vue2 = undefined
VueDemi.version = Vue.version
VueDemi.set = function (target, key, val) {
if (Array.isArray(target)) {
target.length = Math.max(target.length, key)
target.splice(key, 1, val)
return val
}
target[key] = val
return val
}
VueDemi.del = function (target, key) {
if (Array.isArray(target)) {
target.splice(key, 1)
return
}
delete target[key]
}
} else {
console.error('[vue-demi] Vue version ' + Vue.version + ' is unsupported.')
}
return VueDemi
})(
(_VueDemiGlobal.VueDemi = _VueDemiGlobal.VueDemi || (typeof VueDemi !== 'undefined' ? VueDemi : {})),
_VueDemiGlobal.Vue || (typeof Vue !== 'undefined' ? Vue : undefined),
_VueDemiGlobal.VueCompositionAPI || (typeof VueCompositionAPI !== 'undefined' ? VueCompositionAPI : undefined)
);
;
;(function (exports, shared, Schema, vueDemi, axios, changeCase, Cookie, core, drauu, focusTrap, Fuse, idbKeyval, jwtDecode, nprogress, QRCode, Sortable) {
'use strict';
function _interopNamespaceDefault(e) {
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n.default = e;
return Object.freeze(n);
}
var changeCase__namespace = /*#__PURE__*/_interopNamespaceDefault(changeCase);
const AsyncValidatorSchema = Schema.default || Schema;
function useAsyncValidator(value, rules, options = {}) {
const {
validateOption = {},
immediate = true,
manual = false
} = options;
const valueRef = shared.toRef(value);
const errorInfo = vueDemi.shallowRef(null);
const isFinished = vueDemi.ref(true);
const pass = vueDemi.ref(!immediate || manual);
const errors = vueDemi.computed(() => {
var _a;
return ((_a = errorInfo.value) == null ? void 0 : _a.errors) || [];
});
const errorFields = vueDemi.computed(() => {
var _a;
return ((_a = errorInfo.value) == null ? void 0 : _a.fields) || {};
});
const validator = vueDemi.computed(() => new AsyncValidatorSchema(shared.toValue(rules)));
const execute = async () => {
isFinished.value = false;
pass.value = false;
try {
await validator.value.validate(valueRef.value, validateOption);
pass.value = true;
errorInfo.value = null;
} catch (err) {
errorInfo.value = err;
} finally {
isFinished.value = true;
}
return {
pass: pass.value,
errorInfo: errorInfo.value,
errors: errors.value,
errorFields: errorFields.value
};
};
if (!manual) {
vueDemi.watch(
[valueRef, validator],
() => execute(),
{ immediate, deep: true }
);
}
const shell = {
isFinished,
pass,
errors,
errorInfo,
errorFields,
execute
};
function waitUntilFinished() {
return new Promise((resolve, reject) => {
shared.until(isFinished).toBe(true).then(() => resolve(shell)).catch((error) => reject(error));
});
}
return {
...shell,
then(onFulfilled, onRejected) {
return waitUntilFinished().then(onFulfilled, onRejected);
}
};
}
function useAxios(...args) {
const url = typeof args[0] === "string" ? args[0] : void 0;
const argsPlaceholder = typeof url === "string" ? 1 : 0;
const defaultOptions = {
immediate: !!argsPlaceholder,
shallow: true,
abortPrevious: true
};
let defaultConfig = {};
let instance = axios;
let options = defaultOptions;
const isAxiosInstance = (val) => !!(val == null ? void 0 : val.request);
if (args.length > 0 + argsPlaceholder) {
if (isAxiosInstance(args[0 + argsPlaceholder]))
instance = args[0 + argsPlaceholder];
else
defaultConfig = args[0 + argsPlaceholder];
}
if (args.length > 1 + argsPlaceholder) {
if (isAxiosInstance(args[1 + argsPlaceholder]))
instance = args[1 + argsPlaceholder];
}
if (args.length === 2 + argsPlaceholder && !isAxiosInstance(args[1 + argsPlaceholder]) || args.length === 3 + argsPlaceholder) {
options = args[args.length - 1] || defaultOptions;
}
const {
initialData,
shallow,
onSuccess = shared.noop,
onError = shared.noop,
immediate,
resetOnExecute = false
} = options;
const response = vueDemi.shallowRef();
const data = (shallow ? vueDemi.shallowRef : vueDemi.ref)(initialData);
const isFinished = vueDemi.ref(false);
const isLoading = vueDemi.ref(false);
const isAborted = vueDemi.ref(false);
const error = vueDemi.shallowRef();
let abortController = new AbortController();
const abort = (message) => {
if (isFinished.value || !isLoading.value)
return;
abortController.abort(message);
abortController = new AbortController();
isAborted.value = true;
isLoading.value = false;
isFinished.value = false;
};
const loading = (loading2) => {
isLoading.value = loading2;
isFinished.value = !loading2;
};
const resetData = () => {
if (resetOnExecute)
data.value = initialData;
};
const waitUntilFinished = () => new Promise((resolve, reject) => {
shared.until(isFinished).toBe(true).then(() => error.value ? reject(error.value) : resolve(result));
});
const promise = {
then: (...args2) => waitUntilFinished().then(...args2),
catch: (...args2) => waitUntilFinished().catch(...args2)
};
let executeCounter = 0;
const execute = (executeUrl = url, config = {}) => {
error.value = void 0;
const _url = typeof executeUrl === "string" ? executeUrl : url != null ? url : config.url;
if (_url === void 0) {
error.value = new axios.AxiosError(axios.AxiosError.ERR_INVALID_URL);
isFinished.value = true;
return promise;
}
resetData();
if (options.abortPrevious !== false)
abort();
loading(true);
executeCounter += 1;
const currentExecuteCounter = executeCounter;
isAborted.value = false;
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, signal: abortController.signal }).then((r) => {
if (isAborted.value)
return;
response.value = r;
const result2 = r.data;
data.value = result2;
onSuccess(result2);
}).catch((e) => {
error.value = e;
onError(e);
}).finally(() => {
var _a;
(_a = options.onFinish) == null ? void 0 : _a.call(options);
if (currentExecuteCounter === executeCounter)
loading(false);
});
return promise;
};
if (immediate && url)
execute();
const result = {
response,
data,
error,
isFinished,
isLoading,
cancel: abort,
isAborted,
isCanceled: isAborted,
abort,
execute
};
return {
...result,
...promise
};
}
const changeCaseTransforms = /* @__PURE__ */ Object.entries(changeCase__namespace).filter(([name, fn]) => typeof fn === "function" && name.endsWith("Case")).reduce((acc, [name, fn]) => {
acc[name] = fn;
return acc;
}, {});
function useChangeCase(input, type, options) {
const typeRef = vueDemi.computed(() => {
const t = shared.toValue(type);
if (!changeCaseTransforms[t])
throw new Error(`Invalid change case type "${t}"`);
return t;
});
if (typeof input === "function")
return vueDemi.computed(() => changeCaseTransforms[typeRef.value](shared.toValue(input), shared.toValue(options)));
const text = vueDemi.ref(input);
return vueDemi.computed({
get() {
return changeCaseTransforms[typeRef.value](text.value, shared.toValue(options));
},
set(value) {
text.value = value;
}
});
}
function createCookies(req) {
const universalCookie = new Cookie(req ? req.headers.cookie : null);
return (dependencies, { doNotParse = false, autoUpdateDependencies = false } = {}) => useCookies(dependencies, { doNotParse, autoUpdateDependencies }, universalCookie);
}
function useCookies(dependencies, { doNotParse = false, autoUpdateDependencies = false } = {}, cookies = new Cookie()) {
const watchingDependencies = autoUpdateDependencies ? [...dependencies || []] : dependencies;
let previousCookies = cookies.getAll({ doNotParse: true });
const touches = vueDemi.ref(0);
const onChange = () => {
const newCookies = cookies.getAll({ doNotParse: true });
if (shouldUpdate(
watchingDependencies || null,
newCookies,
previousCookies
)) {
touches.value++;
}
previousCookies = newCookies;
};
cookies.addChangeListener(onChange);
shared.tryOnScopeDispose(() => {
cookies.removeChangeListener(onChange);
});
return {
/**
* Reactive get cookie by name. If **autoUpdateDependencies = true** then it will update watching dependencies
*/
get: (...args) => {
if (autoUpdateDependencies && watchingDependencies && !watchingDependencies.includes(args[0]))
watchingDependencies.push(args[0]);
touches.value;
return cookies.get(args[0], { doNotParse, ...args[1] });
},
/**
* Reactive get all cookies
*/
getAll: (...args) => {
touches.value;
return cookies.getAll({ doNotParse, ...args[0] });
},
set: (...args) => cookies.set(...args),
remove: (...args) => cookies.remove(...args),
addChangeListener: (...args) => cookies.addChangeListener(...args),
removeChangeListener: (...args) => cookies.removeChangeListener(...args)
};
}
function shouldUpdate(dependencies, newCookies, oldCookies) {
if (!dependencies)
return true;
for (const dependency of dependencies) {
if (newCookies[dependency] !== oldCookies[dependency])
return true;
}
return false;
}
function useDrauu(target, options) {
const drauuInstance = vueDemi.ref();
let disposables = [];
const onChangedHook = core.createEventHook();
const onCanceledHook = core.createEventHook();
const onCommittedHook = core.createEventHook();
const onStartHook = core.createEventHook();
const onEndHook = core.createEventHook();
const canUndo = vueDemi.ref(false);
const canRedo = vueDemi.ref(false);
const altPressed = vueDemi.ref(false);
const shiftPressed = vueDemi.ref(false);
const brush = vueDemi.ref({
color: "black",
size: 3,
arrowEnd: false,
cornerRadius: 0,
dasharray: void 0,
fill: "transparent",
mode: "draw",
...options == null ? void 0 : options.brush
});
vueDemi.watch(brush, () => {
const instance = drauuInstance.value;
if (instance) {
instance.brush = brush.value;
instance.mode = brush.value.mode;
}
}, { deep: true });
const undo = () => {
var _a;
return (_a = drauuInstance.value) == null ? void 0 : _a.undo();
};
const redo = () => {
var _a;
return (_a = drauuInstance.value) == null ? void 0 : _a.redo();
};
const clear = () => {
var _a;
return (_a = drauuInstance.value) == null ? void 0 : _a.clear();
};
const cancel = () => {
var _a;
return (_a = drauuInstance.value) == null ? void 0 : _a.cancel();
};
const load = (svg) => {
var _a;
return (_a = drauuInstance.value) == null ? void 0 : _a.load(svg);
};
const dump = () => {
var _a;
return (_a = drauuInstance.value) == null ? void 0 : _a.dump();
};
const cleanup = () => {
var _a;
disposables.forEach((dispose) => dispose());
(_a = drauuInstance.value) == null ? void 0 : _a.unmount();
};
const syncStatus = () => {
if (drauuInstance.value) {
canUndo.value = drauuInstance.value.canUndo();
canRedo.value = drauuInstance.value.canRedo();
altPressed.value = drauuInstance.value.altPressed;
shiftPressed.value = drauuInstance.value.shiftPressed;
}
};
vueDemi.watch(
() => core.unrefElement(target),
(el) => {
if (!el || typeof SVGSVGElement === "undefined" || !(el instanceof SVGSVGElement))
return;
if (drauuInstance.value)
cleanup();
drauuInstance.value = drauu.createDrauu({ el, ...options });
syncStatus();
disposables = [
drauuInstance.value.on("canceled", () => onCanceledHook.trigger()),
drauuInstance.value.on("committed", (node) => onCommittedHook.trigger(node)),
drauuInstance.value.on("start", () => onStartHook.trigger()),
drauuInstance.value.on("end", () => onEndHook.trigger()),
drauuInstance.value.on("changed", () => {
syncStatus();
onChangedHook.trigger();
})
];
},
{ flush: "post" }
);
shared.tryOnScopeDispose(() => cleanup());
return {
drauuInstance,
load,
dump,
clear,
cancel,
undo,
redo,
canUndo,
canRedo,
brush,
onChanged: onChangedHook.on,
onCommitted: onCommittedHook.on,
onStart: onStartHook.on,
onEnd: onEndHook.on,
onCanceled: onCanceledHook.on
};
}
function useFocusTrap(target, options = {}) {
let trap;
const { immediate, ...focusTrapOptions } = options;
const hasFocus = vueDemi.ref(false);
const isPaused = vueDemi.ref(false);
const activate = (opts) => trap && trap.activate(opts);
const deactivate = (opts) => trap && trap.deactivate(opts);
const pause = () => {
if (trap) {
trap.pause();
isPaused.value = true;
}
};
const unpause = () => {
if (trap) {
trap.unpause();
isPaused.value = false;
}
};
const targets = vueDemi.computed(() => {
const _targets = shared.toValue(target);
return (Array.isArray(_targets) ? _targets : [_targets]).map((el) => {
const _el = shared.toValue(el);
return typeof _el === "string" ? _el : core.unrefElement(_el);
}).filter(shared.notNullish);
});
vueDemi.watch(
targets,
(els) => {
if (!els.length)
return;
trap = focusTrap.createFocusTrap(els, {
...focusTrapOptions,
onActivate() {
hasFocus.value = true;
if (options.onActivate)
options.onActivate();
},
onDeactivate() {
hasFocus.value = false;
if (options.onDeactivate)
options.onDeactivate();
}
});
if (immediate)
activate();
},
{ flush: "post" }
);
core.tryOnScopeDispose(() => deactivate());
return {
hasFocus,
isPaused,
activate,
deactivate,
pause,
unpause
};
}
function useFuse(search, data, options) {
const createFuse = () => {
var _a, _b;
return new Fuse(
(_a = shared.toValue(data)) != null ? _a : [],
(_b = shared.toValue(options)) == null ? void 0 : _b.fuseOptions
);
};
const fuse = vueDemi.ref(createFuse());
vueDemi.watch(
() => {
var _a;
return (_a = shared.toValue(options)) == null ? void 0 : _a.fuseOptions;
},
() => {
fuse.value = createFuse();
},
{ deep: true }
);
vueDemi.watch(
() => shared.toValue(data),
(newData) => {
fuse.value.setCollection(newData);
},
{ deep: true }
);
const results = vueDemi.computed(() => {
const resolved = shared.toValue(options);
if ((resolved == null ? void 0 : resolved.matchAllWhenSearchEmpty) && !shared.toValue(search))
return shared.toValue(data).map((item, index) => ({ item, refIndex: index }));
const limit = resolved == null ? void 0 : resolved.resultLimit;
return fuse.value.search(shared.toValue(search), limit ? { limit } : void 0);
});
return {
fuse,
results
};
}
function useIDBKeyval(key, initialValue, options = {}) {
const {
flush = "pre",
deep = true,
shallow = false,
onError = (e) => {
console.error(e);
},
writeDefaults = true
} = options;
const isFinished = vueDemi.ref(false);
const data = (shallow ? vueDemi.shallowRef : vueDemi.ref)(initialValue);
const rawInit = shared.toValue(initialValue);
async function read() {
try {
const rawValue = await idbKeyval.get(key);
if (rawValue === void 0) {
if (rawInit !== void 0 && rawInit !== null && writeDefaults)
await idbKeyval.set(key, rawInit);
} else {
data.value = rawValue;
}
} catch (e) {
onError(e);
}
isFinished.value = true;
}
read();
async function write() {
try {
if (data.value == null) {
await idbKeyval.del(key);
} else {
await idbKeyval.update(key, () => vueDemi.toRaw(data.value));
}
} catch (e) {
onError(e);
}
}
const {
pause: pauseWatch,
resume: resumeWatch
} = core.watchPausable(data, () => write(), { flush, deep });
async function setData(value) {
pauseWatch();
data.value = value;
await write();
resumeWatch();
}
return {
set: setData,
isFinished,
data
};
}
function useJwt(encodedJwt, options = {}) {
const {
onError,
fallbackValue = null
} = options;
const decodeWithFallback = (encodedJwt2, options2) => {
try {
return jwtDecode.jwtDecode(encodedJwt2, options2);
} catch (err) {
onError == null ? void 0 : onError(err);
return fallbackValue;
}
};
const header = vueDemi.computed(() => decodeWithFallback(shared.toValue(encodedJwt), { header: true }));
const payload = vueDemi.computed(() => decodeWithFallback(shared.toValue(encodedJwt)));
return {
header,
payload
};
}
function useNProgress(currentProgress = null, options) {
const progress = vueDemi.ref(currentProgress);
const isLoading = vueDemi.computed({
set: (load) => load ? nprogress.start() : nprogress.done(),
get: () => typeof progress.value === "number" && progress.value < 1
});
if (options)
nprogress.configure(options);
const setProgress = nprogress.set;
nprogress.set = (n) => {
progress.value = n;
return setProgress.call(nprogress, n);
};
vueDemi.watchEffect(() => {
if (typeof progress.value === "number" && shared.isClient)
setProgress.call(nprogress, progress.value);
});
shared.tryOnScopeDispose(nprogress.remove);
return {
isLoading,
progress,
start: nprogress.start,
done: nprogress.done,
remove: () => {
progress.value = null;
nprogress.remove();
}
};
}
function useQRCode(text, options) {
const src = shared.toRef(text);
const result = vueDemi.ref("");
vueDemi.watch(
src,
async (value) => {
if (src.value && shared.isClient)
result.value = await QRCode.toDataURL(value, options);
},
{ immediate: true }
);
return result;
}
function useSortable(el, list, options = {}) {
let sortable;
const { document = core.defaultDocument, ...resetOptions } = options;
const defaultOptions = {
onUpdate: (e) => {
moveArrayElement(list, e.oldIndex, e.newIndex, e);
}
};
const start = () => {
const target = typeof el === "string" ? document == null ? void 0 : document.querySelector(el) : core.unrefElement(el);
if (!target || sortable !== void 0)
return;
sortable = new Sortable(target, { ...defaultOptions, ...resetOptions });
};
const stop = () => {
sortable == null ? void 0 : sortable.destroy();
sortable = void 0;
};
const option = (name, value) => {
if (value !== void 0)
sortable == null ? void 0 : sortable.option(name, value);
else
return sortable == null ? void 0 : sortable.option(name);
};
core.tryOnMounted(start);
core.tryOnScopeDispose(stop);
return {
stop,
start,
option
};
}
function insertNodeAt(parentElement, element, index) {
const refElement = parentElement.children[index];
parentElement.insertBefore(element, refElement);
}
function removeNode(node) {
if (node.parentNode)
node.parentNode.removeChild(node);
}
function moveArrayElement(list, from, to, e = null) {
if (e != null) {
removeNode(e.item);
insertNodeAt(e.from, e.item, from);
}
const _valueIsRef = vueDemi.isRef(list);
const array = _valueIsRef ? [...core.toValue(list)] : core.toValue(list);
if (to >= 0 && to < array.length) {
const element = array.splice(from, 1)[0];
vueDemi.nextTick(() => {
array.splice(to, 0, element);
if (_valueIsRef)
list.value = array;
});
}
}
exports.createCookies = createCookies;
exports.insertNodeAt = insertNodeAt;
exports.moveArrayElement = moveArrayElement;
exports.removeNode = removeNode;
exports.useAsyncValidator = useAsyncValidator;
exports.useAxios = useAxios;
exports.useChangeCase = useChangeCase;
exports.useCookies = useCookies;
exports.useDrauu = useDrauu;
exports.useFocusTrap = useFocusTrap;
exports.useFuse = useFuse;
exports.useIDBKeyval = useIDBKeyval;
exports.useJwt = useJwt;
exports.useNProgress = useNProgress;
exports.useQRCode = useQRCode;
exports.useSortable = useSortable;
})(this.VueUse = this.VueUse || {}, VueUse, AsyncValidator, VueDemi, axios, changeCase, UniversalCookie, VueUse, Drauu, focusTrap, Fuse, idbKeyval, jwt_decode, nprogress, QRCode, Sortable);

1
node_modules/@vueuse/integrations/index.iife.min.js generated vendored Normal file

File diff suppressed because one or more lines are too long

667
node_modules/@vueuse/integrations/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,667 @@
import { toRef, toValue, until, noop, tryOnScopeDispose, notNullish, isClient } from '@vueuse/shared';
import Schema from 'async-validator';
import { shallowRef, ref, computed, watch, toRaw, watchEffect, isRef, nextTick } from 'vue-demi';
import axios, { AxiosError } from 'axios';
import * as changeCase from 'change-case';
import Cookie from 'universal-cookie';
import { createEventHook, unrefElement, tryOnScopeDispose as tryOnScopeDispose$1, watchPausable, tryOnMounted, toValue as toValue$1, defaultDocument } from '@vueuse/core';
import { createDrauu } from 'drauu';
import { createFocusTrap } from 'focus-trap';
import Fuse from 'fuse.js';
import { get, set, del, update } from 'idb-keyval';
import { jwtDecode } from 'jwt-decode';
import nprogress from 'nprogress';
import QRCode from 'qrcode';
import Sortable from 'sortablejs';
const AsyncValidatorSchema = Schema.default || Schema;
function useAsyncValidator(value, rules, options = {}) {
const {
validateOption = {},
immediate = true,
manual = false
} = options;
const valueRef = toRef(value);
const errorInfo = shallowRef(null);
const isFinished = ref(true);
const pass = ref(!immediate || manual);
const errors = computed(() => {
var _a;
return ((_a = errorInfo.value) == null ? void 0 : _a.errors) || [];
});
const errorFields = computed(() => {
var _a;
return ((_a = errorInfo.value) == null ? void 0 : _a.fields) || {};
});
const validator = computed(() => new AsyncValidatorSchema(toValue(rules)));
const execute = async () => {
isFinished.value = false;
pass.value = false;
try {
await validator.value.validate(valueRef.value, validateOption);
pass.value = true;
errorInfo.value = null;
} catch (err) {
errorInfo.value = err;
} finally {
isFinished.value = true;
}
return {
pass: pass.value,
errorInfo: errorInfo.value,
errors: errors.value,
errorFields: errorFields.value
};
};
if (!manual) {
watch(
[valueRef, validator],
() => execute(),
{ immediate, deep: true }
);
}
const shell = {
isFinished,
pass,
errors,
errorInfo,
errorFields,
execute
};
function waitUntilFinished() {
return new Promise((resolve, reject) => {
until(isFinished).toBe(true).then(() => resolve(shell)).catch((error) => reject(error));
});
}
return {
...shell,
then(onFulfilled, onRejected) {
return waitUntilFinished().then(onFulfilled, onRejected);
}
};
}
function useAxios(...args) {
const url = typeof args[0] === "string" ? args[0] : void 0;
const argsPlaceholder = typeof url === "string" ? 1 : 0;
const defaultOptions = {
immediate: !!argsPlaceholder,
shallow: true,
abortPrevious: true
};
let defaultConfig = {};
let instance = axios;
let options = defaultOptions;
const isAxiosInstance = (val) => !!(val == null ? void 0 : val.request);
if (args.length > 0 + argsPlaceholder) {
if (isAxiosInstance(args[0 + argsPlaceholder]))
instance = args[0 + argsPlaceholder];
else
defaultConfig = args[0 + argsPlaceholder];
}
if (args.length > 1 + argsPlaceholder) {
if (isAxiosInstance(args[1 + argsPlaceholder]))
instance = args[1 + argsPlaceholder];
}
if (args.length === 2 + argsPlaceholder && !isAxiosInstance(args[1 + argsPlaceholder]) || args.length === 3 + argsPlaceholder) {
options = args[args.length - 1] || defaultOptions;
}
const {
initialData,
shallow,
onSuccess = noop,
onError = noop,
immediate,
resetOnExecute = false
} = options;
const response = shallowRef();
const data = (shallow ? shallowRef : ref)(initialData);
const isFinished = ref(false);
const isLoading = ref(false);
const isAborted = ref(false);
const error = shallowRef();
let abortController = new AbortController();
const abort = (message) => {
if (isFinished.value || !isLoading.value)
return;
abortController.abort(message);
abortController = new AbortController();
isAborted.value = true;
isLoading.value = false;
isFinished.value = false;
};
const loading = (loading2) => {
isLoading.value = loading2;
isFinished.value = !loading2;
};
const resetData = () => {
if (resetOnExecute)
data.value = initialData;
};
const waitUntilFinished = () => new Promise((resolve, reject) => {
until(isFinished).toBe(true).then(() => error.value ? reject(error.value) : resolve(result));
});
const promise = {
then: (...args2) => waitUntilFinished().then(...args2),
catch: (...args2) => waitUntilFinished().catch(...args2)
};
let executeCounter = 0;
const execute = (executeUrl = url, config = {}) => {
error.value = void 0;
const _url = typeof executeUrl === "string" ? executeUrl : url != null ? url : config.url;
if (_url === void 0) {
error.value = new AxiosError(AxiosError.ERR_INVALID_URL);
isFinished.value = true;
return promise;
}
resetData();
if (options.abortPrevious !== false)
abort();
loading(true);
executeCounter += 1;
const currentExecuteCounter = executeCounter;
isAborted.value = false;
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, signal: abortController.signal }).then((r) => {
if (isAborted.value)
return;
response.value = r;
const result2 = r.data;
data.value = result2;
onSuccess(result2);
}).catch((e) => {
error.value = e;
onError(e);
}).finally(() => {
var _a;
(_a = options.onFinish) == null ? void 0 : _a.call(options);
if (currentExecuteCounter === executeCounter)
loading(false);
});
return promise;
};
if (immediate && url)
execute();
const result = {
response,
data,
error,
isFinished,
isLoading,
cancel: abort,
isAborted,
isCanceled: isAborted,
abort,
execute
};
return {
...result,
...promise
};
}
const changeCaseTransforms = /* @__PURE__ */ Object.entries(changeCase).filter(([name, fn]) => typeof fn === "function" && name.endsWith("Case")).reduce((acc, [name, fn]) => {
acc[name] = fn;
return acc;
}, {});
function useChangeCase(input, type, options) {
const typeRef = computed(() => {
const t = toValue(type);
if (!changeCaseTransforms[t])
throw new Error(`Invalid change case type "${t}"`);
return t;
});
if (typeof input === "function")
return computed(() => changeCaseTransforms[typeRef.value](toValue(input), toValue(options)));
const text = ref(input);
return computed({
get() {
return changeCaseTransforms[typeRef.value](text.value, toValue(options));
},
set(value) {
text.value = value;
}
});
}
function createCookies(req) {
const universalCookie = new Cookie(req ? req.headers.cookie : null);
return (dependencies, { doNotParse = false, autoUpdateDependencies = false } = {}) => useCookies(dependencies, { doNotParse, autoUpdateDependencies }, universalCookie);
}
function useCookies(dependencies, { doNotParse = false, autoUpdateDependencies = false } = {}, cookies = new Cookie()) {
const watchingDependencies = autoUpdateDependencies ? [...dependencies || []] : dependencies;
let previousCookies = cookies.getAll({ doNotParse: true });
const touches = ref(0);
const onChange = () => {
const newCookies = cookies.getAll({ doNotParse: true });
if (shouldUpdate(
watchingDependencies || null,
newCookies,
previousCookies
)) {
touches.value++;
}
previousCookies = newCookies;
};
cookies.addChangeListener(onChange);
tryOnScopeDispose(() => {
cookies.removeChangeListener(onChange);
});
return {
/**
* Reactive get cookie by name. If **autoUpdateDependencies = true** then it will update watching dependencies
*/
get: (...args) => {
if (autoUpdateDependencies && watchingDependencies && !watchingDependencies.includes(args[0]))
watchingDependencies.push(args[0]);
touches.value;
return cookies.get(args[0], { doNotParse, ...args[1] });
},
/**
* Reactive get all cookies
*/
getAll: (...args) => {
touches.value;
return cookies.getAll({ doNotParse, ...args[0] });
},
set: (...args) => cookies.set(...args),
remove: (...args) => cookies.remove(...args),
addChangeListener: (...args) => cookies.addChangeListener(...args),
removeChangeListener: (...args) => cookies.removeChangeListener(...args)
};
}
function shouldUpdate(dependencies, newCookies, oldCookies) {
if (!dependencies)
return true;
for (const dependency of dependencies) {
if (newCookies[dependency] !== oldCookies[dependency])
return true;
}
return false;
}
function useDrauu(target, options) {
const drauuInstance = ref();
let disposables = [];
const onChangedHook = createEventHook();
const onCanceledHook = createEventHook();
const onCommittedHook = createEventHook();
const onStartHook = createEventHook();
const onEndHook = createEventHook();
const canUndo = ref(false);
const canRedo = ref(false);
const altPressed = ref(false);
const shiftPressed = ref(false);
const brush = ref({
color: "black",
size: 3,
arrowEnd: false,
cornerRadius: 0,
dasharray: void 0,
fill: "transparent",
mode: "draw",
...options == null ? void 0 : options.brush
});
watch(brush, () => {
const instance = drauuInstance.value;
if (instance) {
instance.brush = brush.value;
instance.mode = brush.value.mode;
}
}, { deep: true });
const undo = () => {
var _a;
return (_a = drauuInstance.value) == null ? void 0 : _a.undo();
};
const redo = () => {
var _a;
return (_a = drauuInstance.value) == null ? void 0 : _a.redo();
};
const clear = () => {
var _a;
return (_a = drauuInstance.value) == null ? void 0 : _a.clear();
};
const cancel = () => {
var _a;
return (_a = drauuInstance.value) == null ? void 0 : _a.cancel();
};
const load = (svg) => {
var _a;
return (_a = drauuInstance.value) == null ? void 0 : _a.load(svg);
};
const dump = () => {
var _a;
return (_a = drauuInstance.value) == null ? void 0 : _a.dump();
};
const cleanup = () => {
var _a;
disposables.forEach((dispose) => dispose());
(_a = drauuInstance.value) == null ? void 0 : _a.unmount();
};
const syncStatus = () => {
if (drauuInstance.value) {
canUndo.value = drauuInstance.value.canUndo();
canRedo.value = drauuInstance.value.canRedo();
altPressed.value = drauuInstance.value.altPressed;
shiftPressed.value = drauuInstance.value.shiftPressed;
}
};
watch(
() => unrefElement(target),
(el) => {
if (!el || typeof SVGSVGElement === "undefined" || !(el instanceof SVGSVGElement))
return;
if (drauuInstance.value)
cleanup();
drauuInstance.value = createDrauu({ el, ...options });
syncStatus();
disposables = [
drauuInstance.value.on("canceled", () => onCanceledHook.trigger()),
drauuInstance.value.on("committed", (node) => onCommittedHook.trigger(node)),
drauuInstance.value.on("start", () => onStartHook.trigger()),
drauuInstance.value.on("end", () => onEndHook.trigger()),
drauuInstance.value.on("changed", () => {
syncStatus();
onChangedHook.trigger();
})
];
},
{ flush: "post" }
);
tryOnScopeDispose(() => cleanup());
return {
drauuInstance,
load,
dump,
clear,
cancel,
undo,
redo,
canUndo,
canRedo,
brush,
onChanged: onChangedHook.on,
onCommitted: onCommittedHook.on,
onStart: onStartHook.on,
onEnd: onEndHook.on,
onCanceled: onCanceledHook.on
};
}
function useFocusTrap(target, options = {}) {
let trap;
const { immediate, ...focusTrapOptions } = options;
const hasFocus = ref(false);
const isPaused = ref(false);
const activate = (opts) => trap && trap.activate(opts);
const deactivate = (opts) => trap && trap.deactivate(opts);
const pause = () => {
if (trap) {
trap.pause();
isPaused.value = true;
}
};
const unpause = () => {
if (trap) {
trap.unpause();
isPaused.value = false;
}
};
const targets = computed(() => {
const _targets = toValue(target);
return (Array.isArray(_targets) ? _targets : [_targets]).map((el) => {
const _el = toValue(el);
return typeof _el === "string" ? _el : unrefElement(_el);
}).filter(notNullish);
});
watch(
targets,
(els) => {
if (!els.length)
return;
trap = createFocusTrap(els, {
...focusTrapOptions,
onActivate() {
hasFocus.value = true;
if (options.onActivate)
options.onActivate();
},
onDeactivate() {
hasFocus.value = false;
if (options.onDeactivate)
options.onDeactivate();
}
});
if (immediate)
activate();
},
{ flush: "post" }
);
tryOnScopeDispose$1(() => deactivate());
return {
hasFocus,
isPaused,
activate,
deactivate,
pause,
unpause
};
}
function useFuse(search, data, options) {
const createFuse = () => {
var _a, _b;
return new Fuse(
(_a = toValue(data)) != null ? _a : [],
(_b = toValue(options)) == null ? void 0 : _b.fuseOptions
);
};
const fuse = ref(createFuse());
watch(
() => {
var _a;
return (_a = toValue(options)) == null ? void 0 : _a.fuseOptions;
},
() => {
fuse.value = createFuse();
},
{ deep: true }
);
watch(
() => toValue(data),
(newData) => {
fuse.value.setCollection(newData);
},
{ deep: true }
);
const results = computed(() => {
const resolved = toValue(options);
if ((resolved == null ? void 0 : resolved.matchAllWhenSearchEmpty) && !toValue(search))
return toValue(data).map((item, index) => ({ item, refIndex: index }));
const limit = resolved == null ? void 0 : resolved.resultLimit;
return fuse.value.search(toValue(search), limit ? { limit } : void 0);
});
return {
fuse,
results
};
}
function useIDBKeyval(key, initialValue, options = {}) {
const {
flush = "pre",
deep = true,
shallow = false,
onError = (e) => {
console.error(e);
},
writeDefaults = true
} = options;
const isFinished = ref(false);
const data = (shallow ? shallowRef : ref)(initialValue);
const rawInit = toValue(initialValue);
async function read() {
try {
const rawValue = await get(key);
if (rawValue === void 0) {
if (rawInit !== void 0 && rawInit !== null && writeDefaults)
await set(key, rawInit);
} else {
data.value = rawValue;
}
} catch (e) {
onError(e);
}
isFinished.value = true;
}
read();
async function write() {
try {
if (data.value == null) {
await del(key);
} else {
await update(key, () => toRaw(data.value));
}
} catch (e) {
onError(e);
}
}
const {
pause: pauseWatch,
resume: resumeWatch
} = watchPausable(data, () => write(), { flush, deep });
async function setData(value) {
pauseWatch();
data.value = value;
await write();
resumeWatch();
}
return {
set: setData,
isFinished,
data
};
}
function useJwt(encodedJwt, options = {}) {
const {
onError,
fallbackValue = null
} = options;
const decodeWithFallback = (encodedJwt2, options2) => {
try {
return jwtDecode(encodedJwt2, options2);
} catch (err) {
onError == null ? void 0 : onError(err);
return fallbackValue;
}
};
const header = computed(() => decodeWithFallback(toValue(encodedJwt), { header: true }));
const payload = computed(() => decodeWithFallback(toValue(encodedJwt)));
return {
header,
payload
};
}
function useNProgress(currentProgress = null, options) {
const progress = ref(currentProgress);
const isLoading = computed({
set: (load) => load ? nprogress.start() : nprogress.done(),
get: () => typeof progress.value === "number" && progress.value < 1
});
if (options)
nprogress.configure(options);
const setProgress = nprogress.set;
nprogress.set = (n) => {
progress.value = n;
return setProgress.call(nprogress, n);
};
watchEffect(() => {
if (typeof progress.value === "number" && isClient)
setProgress.call(nprogress, progress.value);
});
tryOnScopeDispose(nprogress.remove);
return {
isLoading,
progress,
start: nprogress.start,
done: nprogress.done,
remove: () => {
progress.value = null;
nprogress.remove();
}
};
}
function useQRCode(text, options) {
const src = toRef(text);
const result = ref("");
watch(
src,
async (value) => {
if (src.value && isClient)
result.value = await QRCode.toDataURL(value, options);
},
{ immediate: true }
);
return result;
}
function useSortable(el, list, options = {}) {
let sortable;
const { document = defaultDocument, ...resetOptions } = options;
const defaultOptions = {
onUpdate: (e) => {
moveArrayElement(list, e.oldIndex, e.newIndex, e);
}
};
const start = () => {
const target = typeof el === "string" ? document == null ? void 0 : document.querySelector(el) : unrefElement(el);
if (!target || sortable !== void 0)
return;
sortable = new Sortable(target, { ...defaultOptions, ...resetOptions });
};
const stop = () => {
sortable == null ? void 0 : sortable.destroy();
sortable = void 0;
};
const option = (name, value) => {
if (value !== void 0)
sortable == null ? void 0 : sortable.option(name, value);
else
return sortable == null ? void 0 : sortable.option(name);
};
tryOnMounted(start);
tryOnScopeDispose$1(stop);
return {
stop,
start,
option
};
}
function insertNodeAt(parentElement, element, index) {
const refElement = parentElement.children[index];
parentElement.insertBefore(element, refElement);
}
function removeNode(node) {
if (node.parentNode)
node.parentNode.removeChild(node);
}
function moveArrayElement(list, from, to, e = null) {
if (e != null) {
removeNode(e.item);
insertNodeAt(e.from, e.item, from);
}
const _valueIsRef = isRef(list);
const array = _valueIsRef ? [...toValue$1(list)] : toValue$1(list);
if (to >= 0 && to < array.length) {
const element = array.splice(from, 1)[0];
nextTick(() => {
array.splice(to, 0, element);
if (_valueIsRef)
list.value = array;
});
}
}
export { createCookies, insertNodeAt, moveArrayElement, removeNode, useAsyncValidator, useAxios, useChangeCase, useCookies, useDrauu, useFocusTrap, useFuse, useIDBKeyval, useJwt, useNProgress, useQRCode, useSortable };

View File

@@ -0,0 +1 @@
../vue-demi/bin/vue-demi-fix.js

View File

@@ -0,0 +1 @@
../vue-demi/bin/vue-demi-switch.js

View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019-PRESENT Anthony Fu<https://github.com/antfu>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,124 @@
<p align="center">
<a href="https://github.com/vueuse/vueuse#gh-light-mode-only">
<img src="https://raw.githubusercontent.com/vueuse/vueuse/main/packages/public/logo-vertical.png#gh-light-mode-only" alt="VueUse - Collection of essential Vue Composition Utilities" width="300">
</a>
<a href="https://github.com/vueuse/vueuse#gh-dark-mode-only">
<img src="https://raw.githubusercontent.com/vueuse/vueuse/main/packages/public/logo-vertical-dark.png#gh-dark-mode-only" alt="VueUse - Collection of essential Vue Composition Utilities" width="300">
</a>
<br>
Collection of essential Vue Composition Utilities
</p>
<p align="center">
<a href="https://www.npmjs.com/package/@vueuse/core" target="__blank"><img src="https://img.shields.io/npm/v/@vueuse/core?color=a1b858&label=" alt="NPM version"></a>
<a href="https://www.npmjs.com/package/@vueuse/core" target="__blank"><img alt="NPM Downloads" src="https://img.shields.io/npm/dm/@vueuse/core?color=50a36f&label="></a>
<a href="https://vueuse.org" target="__blank"><img src="https://img.shields.io/static/v1?label=&message=docs%20%26%20demos&color=1e8a7a" alt="Docs & Demos"></a>
<img alt="Function Count" src="https://vueuse.org/badge-function-count.svg">
<br>
<a href="https://github.com/vueuse/vueuse" target="__blank"><img alt="GitHub stars" src="https://img.shields.io/github/stars/vueuse/vueuse?style=social"></a>
</p>
<p align="center">
<a href="https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg">
<img src='https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg'>
</a>
</p>
## 🚀 Features
- 🎪 [**Interactive docs & demos**](https://vueuse.org)
- 🕶 **Seamless migration**: Works for **both** Vue 3 and 2
-**Fully tree shakeable**: Only take what you want, [bundle size](https://vueuse.org/export-size)
- 🦾 **Type Strong**: Written in [TypeScript](https://www.typescriptlang.org/), with [TS Docs](https://github.com/microsoft/tsdoc)
- 🔋 **SSR Friendly**
- 🌎 **No bundler required**: Usable via CDN
- 🔩 **Flexible**: Configurable event filters and targets
- 🔌 **Optional [Add-ons](https://vueuse.org/add-ons)**: Router, Firebase, RxJS, etc.
## 🦄 Usage
```ts
import { useLocalStorage, useMouse, usePreferredDark } from '@vueuse/core'
export default {
setup() {
// tracks mouse position
const { x, y } = useMouse()
// if user prefers dark theme
const isDark = usePreferredDark()
// persist state in localStorage
const store = useLocalStorage(
'my-storage',
{
name: 'Apple',
color: 'red',
},
)
return { x, y, isDark, store }
},
}
```
Refer to [functions list](https://vueuse.org/functions) or [documentations](https://vueuse.org/) for more details.
## 📦 Install
> 🎩 From v4.0, it works for Vue 2 & 3 **within a single package** by the power of [vue-demi](https://github.com/vueuse/vue-demi)!
```bash
npm i @vueuse/core
```
[Add ons](https://vueuse.org/add-ons.html) | [Nuxt Module](https://vueuse.org/guide/index.html#nuxt)
> From v6.0, VueUse requires `vue` >= v3.2 or `@vue/composition-api` >= v1.1
###### Demos
- [Vite + Vue 3](https://github.com/vueuse/vueuse-vite-starter)
- [Nuxt 3 + Vue 3](https://github.com/antfu/vitesse-nuxt3)
- [Webpack + Vue 3](https://github.com/vueuse/vueuse-vue3-example)
- [Nuxt 2 + Vue 2](https://github.com/antfu/vitesse-nuxt-bridge)
- [Vue CLI + Vue 2](https://github.com/vueuse/vueuse-vue2-example)
### CDN
```vue
<script src="https://unpkg.com/@vueuse/shared"></script>
<script src="https://unpkg.com/@vueuse/core"></script>
```
It will be exposed to global as `window.VueUse`
## 🪴 Project Activity
![Alt](https://repobeats.axiom.co/api/embed/a406ba7461a6a087dbdb14d4395046c948d44c51.svg 'Repobeats analytics image')
## 🧱 Contribute
See the [**Contributing Guide**](https://vueuse.org/contributing)
## 🌸 Thanks
This project is heavily inspired by the following awesome projects.
- [streamich/react-use](https://github.com/streamich/react-use)
- [u3u/vue-hooks](https://github.com/u3u/vue-hooks)
- [logaretm/vue-use-web](https://github.com/logaretm/vue-use-web)
- [kripod/react-hooks](https://github.com/kripod/react-hooks)
And thanks to [all the contributors on GitHub](https://github.com/vueuse/vueuse/graphs/contributors)!
## 👨‍🚀 Contributors
### Financial Contributors on Open Collective
<a href="https://opencollective.com/vueuse"><img src="https://opencollective.com/vueuse/individuals.svg?width=890"></a>
## 📄 License
[MIT License](https://github.com/vueuse/vueuse/blob/main/LICENSE) © 2019-PRESENT [Anthony Fu](https://github.com/antfu)

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1 @@
module.exports = require('@vueuse/metadata')

View File

@@ -0,0 +1 @@
export * from '@vueuse/metadata'

View File

@@ -0,0 +1 @@
export * from '@vueuse/metadata'

View File

@@ -0,0 +1 @@
export * from '@vueuse/metadata'

View File

@@ -0,0 +1 @@
export * from '@vueuse/metadata'

View File

@@ -0,0 +1,45 @@
{
"name": "@vueuse/core",
"version": "11.3.0",
"description": "Collection of essential Vue Composition Utilities",
"author": "Anthony Fu <https://github.com/antfu>",
"license": "MIT",
"funding": "https://github.com/sponsors/antfu",
"homepage": "https://github.com/vueuse/vueuse#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/vueuse/vueuse.git",
"directory": "packages/core"
},
"bugs": {
"url": "https://github.com/vueuse/vueuse/issues"
},
"keywords": [
"vue",
"vue-use",
"utils"
],
"sideEffects": false,
"exports": {
".": {
"import": "./index.mjs",
"require": "./index.cjs"
},
"./*": "./*",
"./metadata": {
"import": "./metadata.mjs",
"require": "./metadata.cjs"
}
},
"main": "./index.cjs",
"module": "./index.mjs",
"unpkg": "./index.iife.min.js",
"jsdelivr": "./index.iife.min.js",
"types": "./index.d.cts",
"dependencies": {
"@types/web-bluetooth": "^0.0.20",
"@vueuse/metadata": "11.3.0",
"@vueuse/shared": "11.3.0",
"vue-demi": ">=0.14.10"
}
}

View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019-PRESENT Anthony Fu<https://github.com/antfu>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,78 @@
import * as _vueuse_core_metadata_cjs from '@vueuse/core/metadata.cjs';
interface PackageManifest {
name: string;
display: string;
addon?: boolean;
author?: string;
description?: string;
external?: string[];
globals?: Record<string, string>;
manualImport?: boolean;
deprecated?: boolean;
submodules?: boolean;
build?: boolean;
iife?: boolean;
cjs?: boolean;
mjs?: boolean;
dts?: boolean;
target?: string;
utils?: boolean;
copy?: string[];
}
interface VueUseFunction {
name: string;
package: string;
importPath?: string;
lastUpdated?: number;
category?: string;
description?: string;
docs?: string;
deprecated?: boolean;
internal?: boolean;
component?: boolean;
directive?: boolean;
external?: string;
alias?: string[];
related?: string[];
}
interface VueUsePackage extends PackageManifest {
dir: string;
docs?: string;
}
interface PackageIndexes {
packages: Record<string, VueUsePackage>;
categories: string[];
functions: VueUseFunction[];
}
interface CommitInfo {
functions: string[];
version?: string;
hash: string;
date: string;
message: string;
refs?: string;
body?: string;
author_name: string;
author_email: string;
}
interface ContributorInfo {
name: string;
count: number;
hash: string;
}
declare const metadata: PackageIndexes;
declare const functions: PackageIndexes["functions"];
declare const packages: PackageIndexes["packages"];
declare const categories: PackageIndexes["categories"];
declare const functionNames: string[];
declare const categoryNames: string[];
declare const coreCategoryNames: string[];
declare const addonCategoryNames: string[];
declare function getFunction(name: string): _vueuse_core_metadata_cjs.VueUseFunction | undefined;
declare function getCategories(functions: VueUseFunction[]): string[];
declare function uniq<T extends any[]>(a: T): any[];
export { type CommitInfo, type ContributorInfo, type PackageIndexes, type PackageManifest, type VueUseFunction, type VueUsePackage, addonCategoryNames, categories, categoryNames, coreCategoryNames, functionNames, functions, getCategories, getFunction, metadata, packages, uniq };

View File

@@ -0,0 +1,78 @@
import * as _vueuse_core_metadata_cjs from '@vueuse/core/metadata.cjs';
interface PackageManifest {
name: string;
display: string;
addon?: boolean;
author?: string;
description?: string;
external?: string[];
globals?: Record<string, string>;
manualImport?: boolean;
deprecated?: boolean;
submodules?: boolean;
build?: boolean;
iife?: boolean;
cjs?: boolean;
mjs?: boolean;
dts?: boolean;
target?: string;
utils?: boolean;
copy?: string[];
}
interface VueUseFunction {
name: string;
package: string;
importPath?: string;
lastUpdated?: number;
category?: string;
description?: string;
docs?: string;
deprecated?: boolean;
internal?: boolean;
component?: boolean;
directive?: boolean;
external?: string;
alias?: string[];
related?: string[];
}
interface VueUsePackage extends PackageManifest {
dir: string;
docs?: string;
}
interface PackageIndexes {
packages: Record<string, VueUsePackage>;
categories: string[];
functions: VueUseFunction[];
}
interface CommitInfo {
functions: string[];
version?: string;
hash: string;
date: string;
message: string;
refs?: string;
body?: string;
author_name: string;
author_email: string;
}
interface ContributorInfo {
name: string;
count: number;
hash: string;
}
declare const metadata: PackageIndexes;
declare const functions: PackageIndexes["functions"];
declare const packages: PackageIndexes["packages"];
declare const categories: PackageIndexes["categories"];
declare const functionNames: string[];
declare const categoryNames: string[];
declare const coreCategoryNames: string[];
declare const addonCategoryNames: string[];
declare function getFunction(name: string): _vueuse_core_metadata_cjs.VueUseFunction | undefined;
declare function getCategories(functions: VueUseFunction[]): string[];
declare function uniq<T extends any[]>(a: T): any[];
export { type CommitInfo, type ContributorInfo, type PackageIndexes, type PackageManifest, type VueUseFunction, type VueUsePackage, addonCategoryNames, categories, categoryNames, coreCategoryNames, functionNames, functions, getCategories, getFunction, metadata, packages, uniq };

View File

@@ -0,0 +1,78 @@
import * as _vueuse_core_metadata_cjs from '@vueuse/core/metadata.cjs';
interface PackageManifest {
name: string;
display: string;
addon?: boolean;
author?: string;
description?: string;
external?: string[];
globals?: Record<string, string>;
manualImport?: boolean;
deprecated?: boolean;
submodules?: boolean;
build?: boolean;
iife?: boolean;
cjs?: boolean;
mjs?: boolean;
dts?: boolean;
target?: string;
utils?: boolean;
copy?: string[];
}
interface VueUseFunction {
name: string;
package: string;
importPath?: string;
lastUpdated?: number;
category?: string;
description?: string;
docs?: string;
deprecated?: boolean;
internal?: boolean;
component?: boolean;
directive?: boolean;
external?: string;
alias?: string[];
related?: string[];
}
interface VueUsePackage extends PackageManifest {
dir: string;
docs?: string;
}
interface PackageIndexes {
packages: Record<string, VueUsePackage>;
categories: string[];
functions: VueUseFunction[];
}
interface CommitInfo {
functions: string[];
version?: string;
hash: string;
date: string;
message: string;
refs?: string;
body?: string;
author_name: string;
author_email: string;
}
interface ContributorInfo {
name: string;
count: number;
hash: string;
}
declare const metadata: PackageIndexes;
declare const functions: PackageIndexes["functions"];
declare const packages: PackageIndexes["packages"];
declare const categories: PackageIndexes["categories"];
declare const functionNames: string[];
declare const categoryNames: string[];
declare const coreCategoryNames: string[];
declare const addonCategoryNames: string[];
declare function getFunction(name: string): _vueuse_core_metadata_cjs.VueUseFunction | undefined;
declare function getCategories(functions: VueUseFunction[]): string[];
declare function uniq<T extends any[]>(a: T): any[];
export { type CommitInfo, type ContributorInfo, type PackageIndexes, type PackageManifest, type VueUseFunction, type VueUsePackage, addonCategoryNames, categories, categoryNames, coreCategoryNames, functionNames, functions, getCategories, getFunction, metadata, packages, uniq };

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,39 @@
{
"name": "@vueuse/metadata",
"type": "module",
"version": "11.3.0",
"description": "Metadata for VueUse functions",
"author": "Anthony Fu <https://github.com/antfu>",
"license": "MIT",
"funding": "https://github.com/sponsors/antfu",
"homepage": "https://github.com/vueuse/vueuse/tree/main/packages/metadata#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/vueuse/vueuse.git",
"directory": "packages/metadata"
},
"bugs": {
"url": "https://github.com/vueuse/vueuse/issues"
},
"keywords": [
"vue",
"vue-use"
],
"sideEffects": false,
"exports": {
".": {
"import": "./index.mjs",
"require": "./index.cjs"
},
"./*": "./*"
},
"main": "./index.cjs",
"module": "./index.mjs",
"types": "./index.d.ts",
"files": [
"index.*"
],
"scripts": {
"update": "esno scripts/update.ts"
}
}

View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019-PRESENT Anthony Fu<https://github.com/antfu>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,37 @@
{
"name": "@vueuse/shared",
"version": "11.3.0",
"author": "Anthony Fu <https://github.com/antfu>",
"license": "MIT",
"funding": "https://github.com/sponsors/antfu",
"homepage": "https://github.com/vueuse/vueuse/tree/main/packages/shared#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/vueuse/vueuse.git",
"directory": "packages/shared"
},
"bugs": {
"url": "https://github.com/vueuse/vueuse/issues"
},
"keywords": [
"vue",
"vue-use",
"utils"
],
"sideEffects": false,
"exports": {
".": {
"import": "./index.mjs",
"require": "./index.cjs"
},
"./*": "./*"
},
"main": "./index.cjs",
"module": "./index.mjs",
"unpkg": "./index.iife.min.js",
"jsdelivr": "./index.iife.min.js",
"types": "./index.d.cts",
"dependencies": {
"vue-demi": ">=0.14.10"
}
}

View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020-present, Anthony Fu
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,229 @@
<p align="center">
<img src="https://github.com/vueuse/vue-demi/blob/main/assets/banner.png?raw=true" width="600"/>
<br>
<a href='https://www.npmjs.com/package/vue-demi'><img src='https://img.shields.io/npm/v/vue-demi?color=42b883' alt='npm'></a>
</p>
<p align="center">
<b>Vue Demi</b> (<i>half</i> in French) is a developing utility<br> allows you to write <b>Universal Vue Libraries</b> for Vue 2 & 3<br>
<i>See more details in <a href='https://antfu.me/posts/make-libraries-working-with-vue-2-and-3'>this blog post</a></i>
</p>
<br>
<br>
## Strategies
- `<=2.6`: exports from `vue` + `@vue/composition-api` with plugin auto installing.
- `2.7`: exports from `vue` (Composition API is built-in in Vue 2.7).
- `>=3.0`: exports from `vue`, with polyfill of Vue 2's `set` and `del` API.
## Usage
Install this as your plugin's dependency:
```bash
npm i vue-demi
# or
yarn add vue-demi
# or
pnpm i vue-demi
```
Add `vue` and `@vue/composition-api` to your plugin's peer dependencies to specify what versions you support.
```jsonc
{
"dependencies": {
"vue-demi": "latest"
},
"peerDependencies": {
"@vue/composition-api": "^1.0.0-rc.1",
"vue": "^2.0.0 || >=3.0.0"
},
"peerDependenciesMeta": {
"@vue/composition-api": {
"optional": true
}
},
"devDependencies": {
"vue": "^3.0.0" // or "^2.6.0" base on your preferred working environment
},
}
```
Import everything related to Vue from it, it will redirect to `vue@2` + `@vue/composition-api` or `vue@3` based on users' environments.
```ts
import { ref, reactive, defineComponent } from 'vue-demi'
```
Publish your plugin and all is done!
> When using with [Vite](https://vitejs.dev), you will need to opt-out the pre-bundling to get `vue-demi` work properly by
> ```js
> // vite.config.js
> export default defineConfig({
> optimizeDeps: {
> exclude: ['vue-demi']
> }
> })
> ```
### Extra APIs
`Vue Demi` provides extra APIs to help distinguish users' environments and to do some version-specific logic.
### `isVue2` `isVue3`
```ts
import { isVue2, isVue3 } from 'vue-demi'
if (isVue2) {
// Vue 2 only
} else {
// Vue 3 only
}
```
### `Vue2`
To avoid bringing in all the tree-shakable modules, we provide a `Vue2` export to support access to Vue 2's global API. (See [#41](https://github.com/vueuse/vue-demi/issues/41).)
```ts
import { Vue2 } from 'vue-demi'
if (Vue2) {
Vue2.config.ignoredElements.push('x-foo')
}
```
### `install()`
Composition API in Vue 2 is provided as a plugin and needs to be installed on the Vue instance before using. Normally, `vue-demi` will try to install it automatically. For some usages where you might need to ensure the plugin gets installed correctly, the `install()` API is exposed to as a safe version of `Vue.use(CompositionAPI)`. `install()` in the Vue 3 environment will be an empty function (no-op).
```ts
import { install } from 'vue-demi'
install()
```
## CLI
### Manually Switch Versions
To explicitly switch the redirecting version, you can use these commands in your project's root.
```bash
npx vue-demi-switch 2
# or
npx vue-demi-switch 3
```
### Package Aliasing
If you would like to import `vue` under an alias, you can use the following command
```bash
npx vue-demi-switch 2 vue2
# or
npx vue-demi-switch 3 vue3
```
Then `vue-demi` will redirect APIs from the alias name you specified, for example:
```ts
import * as Vue from 'vue3'
var isVue2 = false
var isVue3 = true
var Vue2 = undefined
export * from 'vue3'
export {
Vue,
Vue2,
isVue2,
isVue3,
}
```
### Auto Fix
If the `postinstall` hook doesn't get triggered or you have updated the Vue version, try to run the following command to resolve the redirecting.
```bash
npx vue-demi-fix
```
### Isomorphic Testings
You can support testing for both versions by adding npm alias in your dev dependencies. For example:
```json
{
"scripts": {
"test:2": "vue-demi-switch 2 vue2 && jest",
"test:3": "vue-demi-switch 3 && jest",
},
"devDependencies": {
"vue": "^3.0.0",
"vue2": "npm:vue@2"
},
}
```
or
```json
{
"scripts": {
"test:2": "vue-demi-switch 2 && jest",
"test:3": "vue-demi-switch 3 vue3 && jest",
},
"devDependencies": {
"vue": "^2.6.0",
"vue3": "npm:vue@3"
},
}
```
## Examples
See [examples](./examples).
## Who is using this?
- [VueUse](https://github.com/vueuse/vueuse) - Collection of Composition API utils
- [@vue/apollo-composable](https://github.com/vuejs/vue-apollo/tree/v4/packages/vue-apollo-composable) - Apollo GraphQL functions for Vue Composition API
- [vuelidate](https://github.com/vuelidate/vuelidate) - Simple, lightweight model-based validation
- [vue-composition-test-utils](https://github.com/ariesjia/vue-composition-test-utils) - Simple vue composition api unit test utilities
- [vue-use-stripe](https://github.com/frandiox/vue-use-stripe) - Stripe Elements wrapper for Vue.js
- [@opd/g2plot-vue](https://github.com/open-data-plan/g2plot-vue) - G2plot for vue
- [vue-echarts](https://github.com/ecomfe/vue-echarts) - Vue.js component for Apache ECharts.
- [fluent-vue](https://github.com/Demivan/fluent-vue) - Vue.js integration for [Fluent.js](https://github.com/projectfluent/fluent.js) - JavaScript implementation of [Project Fluent](https://projectfluent.org)
- [vue-datatable-url-sync](https://github.com/socotecio/vue-datatable-url-sync) - Synchronize datatable options and filters with the url to keep user preference even after refresh or navigation
- [vue-insta-stories](https://github.com/UnevenSoftware/vue-insta-stories) - Instagram stories in your vue projects.
- [vue-tiny-validate](https://github.com/FrontLabsOfficial/vue-tiny-validate) - Tiny Vue Validate Composition
- [v-perfect-signature](https://github.com/wobsoriano/v-perfect-signature) - Pressure-sensitive signature drawing for Vue 2 and 3
- [vue-winbox](https://github.com/wobsoriano/vue-winbox) - A wrapper component for WinBox.js that adds the ability to mount Vue components.
- [vue-word-highlighter](https://github.com/kawamataryo/vue-word-highlighter) - The word highlighter library for Vue 2 and Vue 3
- [vue-chart-3](https://github.com/victorgarciaesgi/vue-chart-3) - Vue.js component for Chart.js
- [json-editor-vue](https://github.com/cloydlau/json-editor-vue) - JSON editor & viewer for Vue 2 and 3.
- [kidar-echarts](https://github.com/kidarjs/kidar-echarts) - A simpler echarts component for Vue 2 and 3.
- [vue3-sketch-ruler](https://github.com/kakajun/vue3-sketch-ruler) - The zoom operation used for page presentation for Vue 2 and 3( Replace render function with template )
- [vue-rough-notation](https://github.com/Leecason/vue-rough-notation) - RoughNotation wrapper component for Vue 2 and 3.
- [vue-request](https://github.com/AttoJS/vue-request) - Vue composition API for data fetching, supports SWR, polling, error retry, cache request, pagination, etc.
- [vue3-lazyload](https://github.com/murongg/vue3-lazyload) - A vue3.x image lazyload plugin.
- [vue-codemirror6](https://github.com/logue/vue-codemirror6) - CodeMirror6 component for Vue2 and 3.
- [@tanstack/vue-query](https://github.com/TanStack/query) - TanStack Query for Vue.
> open a PR to add your library ;)
## Underhood
See [the blog post](https://antfu.me/posts/make-libraries-working-with-vue-2-and-3/#-introducing-vue-demi).
## License
MIT License © 2020 [Anthony Fu](https://github.com/antfu)

View File

@@ -0,0 +1,3 @@
#!/usr/bin/env node
'use strict'
require('../scripts/postinstall')

View File

@@ -0,0 +1,3 @@
#!/usr/bin/env node
'use strict'
require('../scripts/switch-cli')

View File

@@ -0,0 +1,29 @@
var Vue = require('vue')
Object.keys(Vue).forEach(function(key) {
exports[key] = Vue[key]
})
exports.set = function(target, key, val) {
if (Array.isArray(target)) {
target.length = Math.max(target.length, key)
target.splice(key, 1, val)
return val
}
target[key] = val
return val
}
exports.del = function(target, key) {
if (Array.isArray(target)) {
target.splice(key, 1)
return
}
delete target[key]
}
exports.Vue = Vue
exports.Vue2 = undefined
exports.isVue2 = false
exports.isVue3 = true
exports.install = function(){}

View File

@@ -0,0 +1,22 @@
import * as Vue from 'vue'
declare const isVue2: boolean
declare const isVue3: boolean
declare const Vue2: any
declare const install: (vue?: any) => void
/**
* @deprecated To avoid bringing in all the tree-shakable modules, this API has been deprecated. Use `Vue2` or named exports instead.
* Refer to https://github.com/vueuse/vue-demi/issues/41
*/
declare const V: typeof Vue
export function set<T>(target: any, key: any, val: T): T
export function del(target: any, key: any): void
export * from 'vue'
export {
V as Vue,
Vue2,
isVue2,
isVue3,
install,
}

View File

@@ -0,0 +1,126 @@
var _VueDemiGlobal = typeof globalThis !== 'undefined'
? globalThis
: typeof global !== 'undefined'
? global
: typeof self !== 'undefined'
? self
: this
var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
if (VueDemi.install) {
return VueDemi
}
if (!Vue) {
console.error('[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`.')
return VueDemi
}
// Vue 2.7
if (Vue.version.slice(0, 4) === '2.7.') {
for (var key in Vue) {
VueDemi[key] = Vue[key]
}
VueDemi.isVue2 = true
VueDemi.isVue3 = false
VueDemi.install = function () {}
VueDemi.Vue = Vue
VueDemi.Vue2 = Vue
VueDemi.version = Vue.version
VueDemi.warn = Vue.util.warn
VueDemi.hasInjectionContext = function() {
return !!VueDemi.getCurrentInstance()
}
function createApp(rootComponent, rootProps) {
var vm
var provide = {}
var app = {
config: Vue.config,
use: Vue.use.bind(Vue),
mixin: Vue.mixin.bind(Vue),
component: Vue.component.bind(Vue),
provide: function (key, value) {
provide[key] = value
return this
},
directive: function (name, dir) {
if (dir) {
Vue.directive(name, dir)
return app
} else {
return Vue.directive(name)
}
},
mount: function (el, hydrating) {
if (!vm) {
vm = new Vue(Object.assign({ propsData: rootProps }, rootComponent, { provide: Object.assign(provide, rootComponent.provide) }))
vm.$mount(el, hydrating)
return vm
} else {
return vm
}
},
unmount: function () {
if (vm) {
vm.$destroy()
vm = undefined
}
},
}
return app
}
VueDemi.createApp = createApp
}
// Vue 2.6.x
else if (Vue.version.slice(0, 2) === '2.') {
if (VueCompositionAPI) {
for (var key in VueCompositionAPI) {
VueDemi[key] = VueCompositionAPI[key]
}
VueDemi.isVue2 = true
VueDemi.isVue3 = false
VueDemi.install = function () {}
VueDemi.Vue = Vue
VueDemi.Vue2 = Vue
VueDemi.version = Vue.version
VueDemi.hasInjectionContext = function() {
return !!VueDemi.getCurrentInstance()
}
} else {
console.error('[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.')
}
}
// Vue 3
else if (Vue.version.slice(0, 2) === '3.') {
for (var key in Vue) {
VueDemi[key] = Vue[key]
}
VueDemi.isVue2 = false
VueDemi.isVue3 = true
VueDemi.install = function () {}
VueDemi.Vue = Vue
VueDemi.Vue2 = undefined
VueDemi.version = Vue.version
VueDemi.set = function (target, key, val) {
if (Array.isArray(target)) {
target.length = Math.max(target.length, key)
target.splice(key, 1, val)
return val
}
target[key] = val
return val
}
VueDemi.del = function (target, key) {
if (Array.isArray(target)) {
target.splice(key, 1)
return
}
delete target[key]
}
} else {
console.error('[vue-demi] Vue version ' + Vue.version + ' is unsupported.')
}
return VueDemi
})(
(_VueDemiGlobal.VueDemi = _VueDemiGlobal.VueDemi || (typeof VueDemi !== 'undefined' ? VueDemi : {})),
_VueDemiGlobal.Vue || (typeof Vue !== 'undefined' ? Vue : undefined),
_VueDemiGlobal.VueCompositionAPI || (typeof VueCompositionAPI !== 'undefined' ? VueCompositionAPI : undefined)
);

View File

@@ -0,0 +1,34 @@
import * as Vue from 'vue'
var isVue2 = false
var isVue3 = true
var Vue2 = undefined
function install() {}
export function set(target, key, val) {
if (Array.isArray(target)) {
target.length = Math.max(target.length, key)
target.splice(key, 1, val)
return val
}
target[key] = val
return val
}
export function del(target, key) {
if (Array.isArray(target)) {
target.splice(key, 1)
return
}
delete target[key]
}
export * from 'vue'
export {
Vue,
Vue2,
isVue2,
isVue3,
install,
}

View File

@@ -0,0 +1,60 @@
var VueModule = require('vue')
// get the real Vue https://github.com/vueuse/vue-demi/issues/192
var Vue = VueModule.default || VueModule
exports.Vue = Vue
exports.Vue2 = Vue
exports.isVue2 = true
exports.isVue3 = false
exports.install = function () {}
exports.warn = Vue.util.warn
// createApp polyfill
exports.createApp = function (rootComponent, rootProps) {
var vm
var provide = {}
var app = {
config: Vue.config,
use: Vue.use.bind(Vue),
mixin: Vue.mixin.bind(Vue),
component: Vue.component.bind(Vue),
provide: function (key, value) {
provide[key] = value
return this
},
directive: function (name, dir) {
if (dir) {
Vue.directive(name, dir)
return app
} else {
return Vue.directive(name)
}
},
mount: function (el, hydrating) {
if (!vm) {
vm = new Vue(Object.assign({ propsData: rootProps }, rootComponent, { provide: Object.assign(provide, rootComponent.provide) }))
vm.$mount(el, hydrating)
return vm
} else {
return vm
}
},
unmount: function () {
if (vm) {
vm.$destroy()
vm = undefined
}
},
}
return app
}
Object.keys(VueModule).forEach(function (key) {
exports[key] = VueModule[key]
})
// Not implemented https://github.com/vuejs/core/pull/8111, falls back to getCurrentInstance()
exports.hasInjectionContext = function() {
return !!VueModule.getCurrentInstance()
}

View File

@@ -0,0 +1,38 @@
import Vue from 'vue'
import type { PluginFunction, PluginObject, VueConstructor, Directive, InjectionKey, Component } from 'vue'
declare const isVue2: boolean
declare const isVue3: boolean
declare const Vue2: typeof Vue | undefined
declare const version: string
declare const install: (vue?: typeof Vue) => void
export declare function warn(msg: string, vm?: Component | null): void
/**
* @deprecated To avoid bringing in all the tree-shakable modules, this API has been deprecated. Use `Vue2` or named exports instead.
* Refer to https://github.com/vueuse/vue-demi/issues/41
*/
declare const V: typeof Vue
// accept no generic because Vue 3 doesn't accept any
// https://github.com/vuejs/vue-next/pull/2758/
export declare type Plugin = PluginObject<any> | PluginFunction<any>
export type { VNode } from 'vue'
export * from 'vue'
export { V as Vue, Vue2, isVue2, isVue3, version, install }
// #region createApp polyfill
export interface App<T = any> {
config: VueConstructor['config']
use: VueConstructor['use']
mixin: VueConstructor['mixin']
component: VueConstructor['component']
directive(name: string): Directive | undefined
directive(name: string, directive: Directive): this
provide<T>(key: InjectionKey<T> | string, value: T): this
mount: Vue['$mount']
unmount: Vue['$destroy']
}
export declare function createApp(rootComponent: any, rootProps?: any): App
// #endregion
export declare function hasInjectionContext(): boolean

View File

@@ -0,0 +1,80 @@
import Vue from 'vue'
import { getCurrentInstance } from 'vue'
var isVue2 = true
var isVue3 = false
var Vue2 = Vue
var warn = Vue.util.warn
function install() {}
// createApp polyfill
export function createApp(rootComponent, rootProps) {
var vm
var provide = {}
var app = {
config: Vue.config,
use: Vue.use.bind(Vue),
mixin: Vue.mixin.bind(Vue),
component: Vue.component.bind(Vue),
provide: function (key, value) {
provide[key] = value
return this
},
directive: function (name, dir) {
if (dir) {
Vue.directive(name, dir)
return app
} else {
return Vue.directive(name)
}
},
mount: function (el, hydrating) {
if (!vm) {
vm = new Vue(Object.assign({ propsData: rootProps }, rootComponent, { provide: Object.assign(provide, rootComponent.provide) }))
vm.$mount(el, hydrating)
return vm
} else {
return vm
}
},
unmount: function () {
if (vm) {
vm.$destroy()
vm = undefined
}
},
}
return app
}
export {
Vue,
Vue2,
isVue2,
isVue3,
install,
warn
}
// Vue 3 components mock
function createMockComponent(name) {
return {
setup() {
throw new Error('[vue-demi] ' + name + ' is not supported in Vue 2. It\'s provided to avoid compiler errors.')
}
}
}
export var Fragment = /*#__PURE__*/ createMockComponent('Fragment')
export var Transition = /*#__PURE__*/ createMockComponent('Transition')
export var TransitionGroup = /*#__PURE__*/ createMockComponent('TransitionGroup')
export var Teleport = /*#__PURE__*/ createMockComponent('Teleport')
export var Suspense = /*#__PURE__*/ createMockComponent('Suspense')
export var KeepAlive = /*#__PURE__*/ createMockComponent('KeepAlive')
export * from 'vue'
// Not implemented https://github.com/vuejs/core/pull/8111, falls back to getCurrentInstance()
export function hasInjectionContext() {
return !!getCurrentInstance()
}

View File

@@ -0,0 +1,34 @@
var Vue = require('vue')
var VueCompositionAPI = require('@vue/composition-api')
function install(_vue) {
var vueLib = _vue || Vue
if (vueLib && 'default' in vueLib) {
vueLib = vueLib.default
}
if (vueLib && !vueLib['__composition_api_installed__']) {
if (VueCompositionAPI && 'default' in VueCompositionAPI)
vueLib.use(VueCompositionAPI.default)
else if (VueCompositionAPI)
vueLib.use(VueCompositionAPI)
}
}
install(Vue)
Object.keys(VueCompositionAPI).forEach(function(key) {
exports[key] = VueCompositionAPI[key]
})
exports.Vue = Vue
exports.Vue2 = Vue
exports.isVue2 = true
exports.isVue3 = false
exports.install = install
exports.version = Vue.version
// Not implemented https://github.com/vuejs/core/pull/8111, falls back to getCurrentInstance()
exports.hasInjectionContext = function () {
return !!VueCompositionAPI.getCurrentInstance()
}

View File

@@ -0,0 +1,33 @@
import Vue from 'vue'
import type { PluginFunction, PluginObject } from 'vue'
declare const isVue2: boolean
declare const isVue3: boolean
declare const Vue2: typeof Vue | undefined
declare const version: string
declare const install: (vue?: typeof Vue) => void
/**
* @deprecated To avoid bringing in all the tree-shakable modules, this API has been deprecated. Use `Vue2` or named exports instead.
* Refer to https://github.com/vueuse/vue-demi/issues/41
*/
declare const V: typeof Vue
/**
* DebuggerEvent is a Vue 3 development only feature. This type cannot exist in Vue 2.
*/
export declare type DebuggerEvent = never
// accept no generic because Vue 3 doesn't accept any
// https://github.com/vuejs/vue-next/pull/2758/
export declare type Plugin = PluginObject<any> | PluginFunction<any>
export type { VNode } from 'vue'
export * from '@vue/composition-api'
export {
V as Vue,
Vue2,
isVue2,
isVue3,
version,
install,
}
export declare function hasInjectionContext(): boolean

View File

@@ -0,0 +1,49 @@
import Vue from 'vue'
import VueCompositionAPI, { getCurrentInstance } from '@vue/composition-api/dist/vue-composition-api.mjs'
function install(_vue) {
_vue = _vue || Vue
if (_vue && !_vue['__composition_api_installed__'])
_vue.use(VueCompositionAPI)
}
install(Vue)
var isVue2 = true
var isVue3 = false
var Vue2 = Vue
var version = Vue.version
/**VCA-EXPORTS**/
export * from '@vue/composition-api/dist/vue-composition-api.mjs'
/**VCA-EXPORTS**/
export {
Vue,
Vue2,
isVue2,
isVue3,
version,
install,
}
// Vue 3 components mock
function createMockComponent(name) {
return {
setup() {
throw new Error('[vue-demi] ' + name + ' is not supported in Vue 2. It\'s provided to avoid compiler errors.')
}
}
}
export var Fragment = /*#__PURE__*/ createMockComponent('Fragment')
export var Transition = /*#__PURE__*/ createMockComponent('Transition')
export var TransitionGroup = /*#__PURE__*/ createMockComponent('TransitionGroup')
export var Teleport = /*#__PURE__*/ createMockComponent('Teleport')
export var Suspense = /*#__PURE__*/ createMockComponent('Suspense')
export var KeepAlive = /*#__PURE__*/ createMockComponent('KeepAlive')
// Not implemented https://github.com/vuejs/core/pull/8111, falls back to getCurrentInstance()
export function hasInjectionContext() {
return !!getCurrentInstance()
}

View File

@@ -0,0 +1,29 @@
var Vue = require('vue')
Object.keys(Vue).forEach(function(key) {
exports[key] = Vue[key]
})
exports.set = function(target, key, val) {
if (Array.isArray(target)) {
target.length = Math.max(target.length, key)
target.splice(key, 1, val)
return val
}
target[key] = val
return val
}
exports.del = function(target, key) {
if (Array.isArray(target)) {
target.splice(key, 1)
return
}
delete target[key]
}
exports.Vue = Vue
exports.Vue2 = undefined
exports.isVue2 = false
exports.isVue3 = true
exports.install = function(){}

View File

@@ -0,0 +1,22 @@
import * as Vue from 'vue'
declare const isVue2: boolean
declare const isVue3: boolean
declare const Vue2: any
declare const install: (vue?: any) => void
/**
* @deprecated To avoid bringing in all the tree-shakable modules, this API has been deprecated. Use `Vue2` or named exports instead.
* Refer to https://github.com/vueuse/vue-demi/issues/41
*/
declare const V: typeof Vue
export function set<T>(target: any, key: any, val: T): T
export function del(target: any, key: any): void
export * from 'vue'
export {
V as Vue,
Vue2,
isVue2,
isVue3,
install,
}

View File

@@ -0,0 +1,34 @@
import * as Vue from 'vue'
var isVue2 = false
var isVue3 = true
var Vue2 = undefined
function install() {}
export function set(target, key, val) {
if (Array.isArray(target)) {
target.length = Math.max(target.length, key)
target.splice(key, 1, val)
return val
}
target[key] = val
return val
}
export function del(target, key) {
if (Array.isArray(target)) {
target.splice(key, 1)
return
}
delete target[key]
}
export * from 'vue'
export {
Vue,
Vue2,
isVue2,
isVue3,
install,
}

View File

@@ -0,0 +1,47 @@
{
"name": "vue-demi",
"version": "0.14.10",
"engines": {
"node": ">=12"
},
"repository": "https://github.com/antfu/vue-demi.git",
"funding": "https://github.com/sponsors/antfu",
"license": "MIT",
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
"main": "lib/index.cjs",
"jsdelivr": "lib/index.iife.js",
"unpkg": "lib/index.iife.js",
"module": "lib/index.mjs",
"types": "lib/index.d.ts",
"exports": {
".": {
"types": "./lib/index.d.ts",
"require": "./lib/index.cjs",
"import": "./lib/index.mjs",
"browser": "./lib/index.mjs"
},
"./*": "./*"
},
"bin": {
"vue-demi-fix": "bin/vue-demi-fix.js",
"vue-demi-switch": "bin/vue-demi-switch.js"
},
"files": [
"lib",
"bin",
"scripts"
],
"scripts": {
"postinstall": "node -e \"try{require('./scripts/postinstall.js')}catch(e){}\"",
"release": "npx bumpp --tag --commit --push && npm publish"
},
"peerDependencies": {
"@vue/composition-api": "^1.0.0-rc.1",
"vue": "^3.0.0-0 || ^2.6.0"
},
"peerDependenciesMeta": {
"@vue/composition-api": {
"optional": true
}
}
}

View File

@@ -0,0 +1,19 @@
const { switchVersion, loadModule } = require('./utils')
const Vue = loadModule('vue')
if (!Vue || typeof Vue.version !== 'string') {
console.warn('[vue-demi] Vue is not found. Please run "npm install vue" to install.')
}
else if (Vue.version.startsWith('2.7.')) {
switchVersion(2.7)
}
else if (Vue.version.startsWith('2.')) {
switchVersion(2)
}
else if (Vue.version.startsWith('3.')) {
switchVersion(3)
}
else {
console.warn(`[vue-demi] Vue version v${Vue.version} is not supported.`)
}

Some files were not shown because too many files have changed in this diff Show More