Vitepress

This commit is contained in:
Robert Jelic
2025-02-10 06:53:23 +01:00
parent 3818128521
commit b0a4a6da9c
2428 changed files with 1005324 additions and 0 deletions

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
<pre class='language-bash'>
npm i <b>@vueuse/integrations</b>
</pre>
## 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)

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

@@ -0,0 +1,659 @@
'use strict';
var shared = require('@vueuse/shared');
var Schema = require('async-validator');
var vueDemi = require('vue-demi');
var axios = require('axios');
var changeCase$1 = require('change-case');
var Cookie = require('universal-cookie');
var drauu = require('drauu');
var core = require('@vueuse/core');
var focusTrap = require('focus-trap');
var Fuse = require('fuse.js');
var idbKeyval = require('idb-keyval');
var jwt_decode = require('jwt-decode');
var nprogress = require('nprogress');
var QRCode = require('qrcode');
var Sortable = require('sortablejs');
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;
let defaultConfig = {};
let instance = axios;
let options = {
immediate: !!argsPlaceholder,
shallow: true
};
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];
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();
const cancelTokenSource = axios.CancelToken.source;
let cancelToken = cancelTokenSource();
const abort = (message) => {
if (isFinished.value || !isLoading.value)
return;
cancelToken.cancel(message);
cancelToken = cancelTokenSource();
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();
abort();
loading(true);
executeCounter += 1;
const currentExecuteCounter = executeCounter;
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, cancelToken: cancelToken.token }).then((r) => {
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
};
}
var changeCase = /*#__PURE__*/Object.freeze({
__proto__: null,
camelCase: changeCase$1.camelCase,
capitalCase: changeCase$1.capitalCase,
constantCase: changeCase$1.constantCase,
dotCase: changeCase$1.dotCase,
headerCase: changeCase$1.headerCase,
noCase: changeCase$1.noCase,
paramCase: changeCase$1.paramCase,
pascalCase: changeCase$1.pascalCase,
pathCase: changeCase$1.pathCase,
sentenceCase: changeCase$1.sentenceCase,
snakeCase: changeCase$1.snakeCase
});
function useChangeCase(input, type, options) {
if (typeof input === "function")
return vueDemi.computed(() => changeCase[type](shared.toValue(input), options));
const text = vueDemi.ref(input);
return vueDemi.computed({
get() {
return changeCase[type](text.value, 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;
}
};
vueDemi.watch(
() => core.unrefElement(target),
(el) => {
if (!el)
return;
trap = focusTrap.createFocusTrap(el, {
...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 {
if (Array.isArray(data.value))
await idbKeyval.update(key, () => JSON.parse(JSON.stringify(data.value)));
else if (typeof data.value === "object")
await idbKeyval.update(key, () => ({ ...data.value }));
else
await idbKeyval.update(key, () => 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 jwt_decode(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);
}
};
const start = () => {
const target = typeof el === "string" ? document == null ? void 0 : document.querySelector(el) : core.unrefElement(el);
if (!target)
return;
sortable = new Sortable(target, { ...defaultOptions, ...resetOptions });
};
const stop = () => sortable == null ? void 0 : sortable.destroy();
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 moveArrayElement(list, from, to) {
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.moveArrayElement = moveArrayElement;
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;

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

@@ -0,0 +1,423 @@
import { MaybeRefOrGetter, MaybeRef, ConfigurableFlush, RemovableRef } from '@vueuse/shared';
import { ValidateError, ValidateOption, Rules } from 'async-validator';
import * as vue_demi from 'vue-demi';
import { Ref, ShallowRef, WritableComputedRef, ComputedRef } from 'vue-demi';
import { AxiosResponse, AxiosRequestConfig, AxiosInstance } from 'axios';
import { camelCase, capitalCase, constantCase, dotCase, headerCase, noCase, paramCase, pascalCase, pathCase, sentenceCase, snakeCase, Options } from 'change-case';
import * as universal_cookie from 'universal-cookie';
import universal_cookie__default from 'universal-cookie';
import { IncomingMessage } from 'node:http';
import { Options as Options$1, Drauu, Brush } from 'drauu';
import { EventHookOn, MaybeComputedElementRef, Fn, MaybeElementRef, ConfigurableDocument, MaybeRefOrGetter as MaybeRefOrGetter$1 } from '@vueuse/core';
import { Options as Options$2, ActivateOptions, DeactivateOptions } from 'focus-trap';
import Fuse 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;
/**
* 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>>;
declare const changeCase_camelCase: typeof camelCase;
declare const changeCase_capitalCase: typeof capitalCase;
declare const changeCase_constantCase: typeof constantCase;
declare const changeCase_dotCase: typeof dotCase;
declare const changeCase_headerCase: typeof headerCase;
declare const changeCase_noCase: typeof noCase;
declare const changeCase_paramCase: typeof paramCase;
declare const changeCase_pascalCase: typeof pascalCase;
declare const changeCase_pathCase: typeof pathCase;
declare const changeCase_sentenceCase: typeof sentenceCase;
declare const changeCase_snakeCase: typeof snakeCase;
declare namespace changeCase {
export { changeCase_camelCase as camelCase, changeCase_capitalCase as capitalCase, changeCase_constantCase as constantCase, changeCase_dotCase as dotCase, changeCase_headerCase as headerCase, changeCase_noCase as noCase, changeCase_paramCase as paramCase, changeCase_pascalCase as pascalCase, changeCase_pathCase as pathCase, changeCase_sentenceCase as sentenceCase, changeCase_snakeCase as snakeCase };
}
type ChangeCaseType = keyof typeof changeCase;
declare function useChangeCase(input: MaybeRef<string>, type: ChangeCaseType, options?: Options | undefined): WritableComputedRef<string>;
declare function useChangeCase(input: MaybeRefOrGetter<string>, type: ChangeCaseType, options?: 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_1 = any>(options?: universal_cookie.CookieGetOptions | undefined) => T_1;
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_1 = any>(options?: universal_cookie.CookieGetOptions | undefined) => T_1;
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: MaybeElementRef, options?: UseFocusTrapOptions): UseFocusTrapReturn;
type FuseOptions<T> = Fuse.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_demi.Ref<{
search: <R = DataItem>(pattern: string | Fuse.Expression, options?: Fuse.FuseSearchOptions | undefined) => Fuse.FuseResult<R>[];
setCollection: (docs: readonly DataItem[], index?: Fuse.FuseIndex<DataItem> | undefined) => void;
add: (doc: DataItem) => void;
remove: (predicate: (doc: DataItem, idx: number) => boolean) => DataItem[];
removeAt: (idx: number) => void;
getIndex: () => Fuse.FuseIndex<DataItem>;
}>;
results: ComputedRef<Fuse.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_demi.WritableComputedRef<boolean>;
progress: vue_demi.Ref<number | (() => number | null | undefined) | null | undefined>;
start: () => nprogress.NProgress;
done: (force?: boolean | undefined) => 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_demi.Ref<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;
option<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;
declare function moveArrayElement<T>(list: MaybeRefOrGetter$1<T[]>, from: number, to: number): 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, moveArrayElement, useAsyncValidator, useAxios, useChangeCase, useCookies, useDrauu, useFocusTrap, useFuse, useIDBKeyval, useJwt, useNProgress, useQRCode, useSortable };

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

@@ -0,0 +1,423 @@
import { MaybeRefOrGetter, MaybeRef, ConfigurableFlush, RemovableRef } from '@vueuse/shared';
import { ValidateError, ValidateOption, Rules } from 'async-validator';
import * as vue_demi from 'vue-demi';
import { Ref, ShallowRef, WritableComputedRef, ComputedRef } from 'vue-demi';
import { AxiosResponse, AxiosRequestConfig, AxiosInstance } from 'axios';
import { camelCase, capitalCase, constantCase, dotCase, headerCase, noCase, paramCase, pascalCase, pathCase, sentenceCase, snakeCase, Options } from 'change-case';
import * as universal_cookie from 'universal-cookie';
import universal_cookie__default from 'universal-cookie';
import { IncomingMessage } from 'node:http';
import { Options as Options$1, Drauu, Brush } from 'drauu';
import { EventHookOn, MaybeComputedElementRef, Fn, MaybeElementRef, ConfigurableDocument, MaybeRefOrGetter as MaybeRefOrGetter$1 } from '@vueuse/core';
import { Options as Options$2, ActivateOptions, DeactivateOptions } from 'focus-trap';
import Fuse 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;
/**
* 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>>;
declare const changeCase_camelCase: typeof camelCase;
declare const changeCase_capitalCase: typeof capitalCase;
declare const changeCase_constantCase: typeof constantCase;
declare const changeCase_dotCase: typeof dotCase;
declare const changeCase_headerCase: typeof headerCase;
declare const changeCase_noCase: typeof noCase;
declare const changeCase_paramCase: typeof paramCase;
declare const changeCase_pascalCase: typeof pascalCase;
declare const changeCase_pathCase: typeof pathCase;
declare const changeCase_sentenceCase: typeof sentenceCase;
declare const changeCase_snakeCase: typeof snakeCase;
declare namespace changeCase {
export { changeCase_camelCase as camelCase, changeCase_capitalCase as capitalCase, changeCase_constantCase as constantCase, changeCase_dotCase as dotCase, changeCase_headerCase as headerCase, changeCase_noCase as noCase, changeCase_paramCase as paramCase, changeCase_pascalCase as pascalCase, changeCase_pathCase as pathCase, changeCase_sentenceCase as sentenceCase, changeCase_snakeCase as snakeCase };
}
type ChangeCaseType = keyof typeof changeCase;
declare function useChangeCase(input: MaybeRef<string>, type: ChangeCaseType, options?: Options | undefined): WritableComputedRef<string>;
declare function useChangeCase(input: MaybeRefOrGetter<string>, type: ChangeCaseType, options?: 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_1 = any>(options?: universal_cookie.CookieGetOptions | undefined) => T_1;
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_1 = any>(options?: universal_cookie.CookieGetOptions | undefined) => T_1;
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: MaybeElementRef, options?: UseFocusTrapOptions): UseFocusTrapReturn;
type FuseOptions<T> = Fuse.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_demi.Ref<{
search: <R = DataItem>(pattern: string | Fuse.Expression, options?: Fuse.FuseSearchOptions | undefined) => Fuse.FuseResult<R>[];
setCollection: (docs: readonly DataItem[], index?: Fuse.FuseIndex<DataItem> | undefined) => void;
add: (doc: DataItem) => void;
remove: (predicate: (doc: DataItem, idx: number) => boolean) => DataItem[];
removeAt: (idx: number) => void;
getIndex: () => Fuse.FuseIndex<DataItem>;
}>;
results: ComputedRef<Fuse.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_demi.WritableComputedRef<boolean>;
progress: vue_demi.Ref<number | (() => number | null | undefined) | null | undefined>;
start: () => nprogress.NProgress;
done: (force?: boolean | undefined) => 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_demi.Ref<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;
option<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;
declare function moveArrayElement<T>(list: MaybeRefOrGetter$1<T[]>, from: number, to: number): 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, moveArrayElement, useAsyncValidator, useAxios, useChangeCase, useCookies, useDrauu, useFocusTrap, useFuse, useIDBKeyval, useJwt, useNProgress, useQRCode, useSortable };

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

@@ -0,0 +1,423 @@
import { MaybeRefOrGetter, MaybeRef, ConfigurableFlush, RemovableRef } from '@vueuse/shared';
import { ValidateError, ValidateOption, Rules } from 'async-validator';
import * as vue_demi from 'vue-demi';
import { Ref, ShallowRef, WritableComputedRef, ComputedRef } from 'vue-demi';
import { AxiosResponse, AxiosRequestConfig, AxiosInstance } from 'axios';
import { camelCase, capitalCase, constantCase, dotCase, headerCase, noCase, paramCase, pascalCase, pathCase, sentenceCase, snakeCase, Options } from 'change-case';
import * as universal_cookie from 'universal-cookie';
import universal_cookie__default from 'universal-cookie';
import { IncomingMessage } from 'node:http';
import { Options as Options$1, Drauu, Brush } from 'drauu';
import { EventHookOn, MaybeComputedElementRef, Fn, MaybeElementRef, ConfigurableDocument, MaybeRefOrGetter as MaybeRefOrGetter$1 } from '@vueuse/core';
import { Options as Options$2, ActivateOptions, DeactivateOptions } from 'focus-trap';
import Fuse 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;
/**
* 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>>;
declare const changeCase_camelCase: typeof camelCase;
declare const changeCase_capitalCase: typeof capitalCase;
declare const changeCase_constantCase: typeof constantCase;
declare const changeCase_dotCase: typeof dotCase;
declare const changeCase_headerCase: typeof headerCase;
declare const changeCase_noCase: typeof noCase;
declare const changeCase_paramCase: typeof paramCase;
declare const changeCase_pascalCase: typeof pascalCase;
declare const changeCase_pathCase: typeof pathCase;
declare const changeCase_sentenceCase: typeof sentenceCase;
declare const changeCase_snakeCase: typeof snakeCase;
declare namespace changeCase {
export { changeCase_camelCase as camelCase, changeCase_capitalCase as capitalCase, changeCase_constantCase as constantCase, changeCase_dotCase as dotCase, changeCase_headerCase as headerCase, changeCase_noCase as noCase, changeCase_paramCase as paramCase, changeCase_pascalCase as pascalCase, changeCase_pathCase as pathCase, changeCase_sentenceCase as sentenceCase, changeCase_snakeCase as snakeCase };
}
type ChangeCaseType = keyof typeof changeCase;
declare function useChangeCase(input: MaybeRef<string>, type: ChangeCaseType, options?: Options | undefined): WritableComputedRef<string>;
declare function useChangeCase(input: MaybeRefOrGetter<string>, type: ChangeCaseType, options?: 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_1 = any>(options?: universal_cookie.CookieGetOptions | undefined) => T_1;
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_1 = any>(options?: universal_cookie.CookieGetOptions | undefined) => T_1;
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: MaybeElementRef, options?: UseFocusTrapOptions): UseFocusTrapReturn;
type FuseOptions<T> = Fuse.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_demi.Ref<{
search: <R = DataItem>(pattern: string | Fuse.Expression, options?: Fuse.FuseSearchOptions | undefined) => Fuse.FuseResult<R>[];
setCollection: (docs: readonly DataItem[], index?: Fuse.FuseIndex<DataItem> | undefined) => void;
add: (doc: DataItem) => void;
remove: (predicate: (doc: DataItem, idx: number) => boolean) => DataItem[];
removeAt: (idx: number) => void;
getIndex: () => Fuse.FuseIndex<DataItem>;
}>;
results: ComputedRef<Fuse.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_demi.WritableComputedRef<boolean>;
progress: vue_demi.Ref<number | (() => number | null | undefined) | null | undefined>;
start: () => nprogress.NProgress;
done: (force?: boolean | undefined) => 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_demi.Ref<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;
option<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;
declare function moveArrayElement<T>(list: MaybeRefOrGetter$1<T[]>, from: number, to: number): 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, moveArrayElement, useAsyncValidator, useAxios, useChangeCase, useCookies, useDrauu, useFocusTrap, useFuse, useIDBKeyval, useJwt, useNProgress, useQRCode, useSortable };

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

@@ -0,0 +1,762 @@
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 = () => !!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 = () => !!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
})(
(this.VueDemi = this.VueDemi || (typeof VueDemi !== 'undefined' ? VueDemi : {})),
this.Vue || (typeof Vue !== 'undefined' ? Vue : undefined),
this.VueCompositionAPI || (typeof VueCompositionAPI !== 'undefined' ? VueCompositionAPI : undefined)
);
;
;(function (exports, shared, Schema, vueDemi, axios, changeCase$1, Cookie, drauu, core, focusTrap, Fuse, idbKeyval, jwt_decode, nprogress, QRCode, Sortable) {
'use strict';
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;
let defaultConfig = {};
let instance = axios;
let options = {
immediate: !!argsPlaceholder,
shallow: true
};
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];
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();
const cancelTokenSource = axios.CancelToken.source;
let cancelToken = cancelTokenSource();
const abort = (message) => {
if (isFinished.value || !isLoading.value)
return;
cancelToken.cancel(message);
cancelToken = cancelTokenSource();
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();
abort();
loading(true);
executeCounter += 1;
const currentExecuteCounter = executeCounter;
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, cancelToken: cancelToken.token }).then((r) => {
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
};
}
var changeCase = /*#__PURE__*/Object.freeze({
__proto__: null,
camelCase: changeCase$1.camelCase,
capitalCase: changeCase$1.capitalCase,
constantCase: changeCase$1.constantCase,
dotCase: changeCase$1.dotCase,
headerCase: changeCase$1.headerCase,
noCase: changeCase$1.noCase,
paramCase: changeCase$1.paramCase,
pascalCase: changeCase$1.pascalCase,
pathCase: changeCase$1.pathCase,
sentenceCase: changeCase$1.sentenceCase,
snakeCase: changeCase$1.snakeCase
});
function useChangeCase(input, type, options) {
if (typeof input === "function")
return vueDemi.computed(() => changeCase[type](shared.toValue(input), options));
const text = vueDemi.ref(input);
return vueDemi.computed({
get() {
return changeCase[type](text.value, 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;
}
};
vueDemi.watch(
() => core.unrefElement(target),
(el) => {
if (!el)
return;
trap = focusTrap.createFocusTrap(el, {
...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 {
if (Array.isArray(data.value))
await idbKeyval.update(key, () => JSON.parse(JSON.stringify(data.value)));
else if (typeof data.value === "object")
await idbKeyval.update(key, () => ({ ...data.value }));
else
await idbKeyval.update(key, () => 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 jwt_decode(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);
}
};
const start = () => {
const target = typeof el === "string" ? document == null ? void 0 : document.querySelector(el) : core.unrefElement(el);
if (!target)
return;
sortable = new Sortable(target, { ...defaultOptions, ...resetOptions });
};
const stop = () => sortable == null ? void 0 : sortable.destroy();
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 moveArrayElement(list, from, to) {
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.moveArrayElement = moveArrayElement;
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, Drauu, VueUse, 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

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

@@ -0,0 +1,644 @@
import { toRef, toValue, until, noop, tryOnScopeDispose, isClient } from '@vueuse/shared';
import Schema from 'async-validator';
import { shallowRef, ref, computed, watch, watchEffect, isRef, nextTick } from 'vue-demi';
import axios, { AxiosError } from 'axios';
import { camelCase, capitalCase, constantCase, dotCase, headerCase, noCase, paramCase, pascalCase, pathCase, sentenceCase, snakeCase } from 'change-case';
import Cookie from 'universal-cookie';
import { createDrauu } from 'drauu';
import { createEventHook, unrefElement, tryOnScopeDispose as tryOnScopeDispose$1, watchPausable, tryOnMounted, toValue as toValue$1, defaultDocument } from '@vueuse/core';
import { createFocusTrap } from 'focus-trap';
import Fuse from 'fuse.js';
import { get, set, del, update } from 'idb-keyval';
import jwt_decode 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;
let defaultConfig = {};
let instance = axios;
let options = {
immediate: !!argsPlaceholder,
shallow: true
};
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];
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();
const cancelTokenSource = axios.CancelToken.source;
let cancelToken = cancelTokenSource();
const abort = (message) => {
if (isFinished.value || !isLoading.value)
return;
cancelToken.cancel(message);
cancelToken = cancelTokenSource();
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();
abort();
loading(true);
executeCounter += 1;
const currentExecuteCounter = executeCounter;
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, cancelToken: cancelToken.token }).then((r) => {
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
};
}
var changeCase = /*#__PURE__*/Object.freeze({
__proto__: null,
camelCase: camelCase,
capitalCase: capitalCase,
constantCase: constantCase,
dotCase: dotCase,
headerCase: headerCase,
noCase: noCase,
paramCase: paramCase,
pascalCase: pascalCase,
pathCase: pathCase,
sentenceCase: sentenceCase,
snakeCase: snakeCase
});
function useChangeCase(input, type, options) {
if (typeof input === "function")
return computed(() => changeCase[type](toValue(input), options));
const text = ref(input);
return computed({
get() {
return changeCase[type](text.value, 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;
}
};
watch(
() => unrefElement(target),
(el) => {
if (!el)
return;
trap = createFocusTrap(el, {
...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 {
if (Array.isArray(data.value))
await update(key, () => JSON.parse(JSON.stringify(data.value)));
else if (typeof data.value === "object")
await update(key, () => ({ ...data.value }));
else
await update(key, () => 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 jwt_decode(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);
}
};
const start = () => {
const target = typeof el === "string" ? document == null ? void 0 : document.querySelector(el) : unrefElement(el);
if (!target)
return;
sortable = new Sortable(target, { ...defaultOptions, ...resetOptions });
};
const stop = () => sortable == null ? void 0 : sortable.destroy();
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 moveArrayElement(list, from, to) {
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, moveArrayElement, useAsyncValidator, useAxios, useChangeCase, useCookies, useDrauu, useFocusTrap, useFuse, useIDBKeyval, useJwt, useNProgress, useQRCode, useSortable };

View File

@@ -0,0 +1,16 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../vue-demi/bin/vue-demi-fix.js" "$@"
else
exec node "$basedir/../vue-demi/bin/vue-demi-fix.js" "$@"
fi

View File

@@ -0,0 +1,17 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\vue-demi\bin\vue-demi-fix.js" %*

View File

@@ -0,0 +1,28 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../vue-demi/bin/vue-demi-fix.js" $args
} else {
& "$basedir/node$exe" "$basedir/../vue-demi/bin/vue-demi-fix.js" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../vue-demi/bin/vue-demi-fix.js" $args
} else {
& "node$exe" "$basedir/../vue-demi/bin/vue-demi-fix.js" $args
}
$ret=$LASTEXITCODE
}
exit $ret

View File

@@ -0,0 +1,16 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../vue-demi/bin/vue-demi-switch.js" "$@"
else
exec node "$basedir/../vue-demi/bin/vue-demi-switch.js" "$@"
fi

View File

@@ -0,0 +1,17 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\vue-demi\bin\vue-demi-switch.js" %*

View File

@@ -0,0 +1,28 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../vue-demi/bin/vue-demi-switch.js" $args
} else {
& "$basedir/node$exe" "$basedir/../vue-demi/bin/vue-demi-switch.js" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../vue-demi/bin/vue-demi-switch.js" $args
} else {
& "node$exe" "$basedir/../vue-demi/bin/vue-demi-switch.js" $args
}
$ret=$LASTEXITCODE
}
exit $ret

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,228 @@
<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.
> 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,115 @@
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 = () => !!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 = () => !!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
})(
(this.VueDemi = this.VueDemi || (typeof VueDemi !== 'undefined' ? VueDemi : {})),
this.Vue || (typeof Vue !== 'undefined' ? Vue : undefined),
this.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,58 @@
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 = () => !!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,32 @@
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 = () => !!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.6",
"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 ./scripts/postinstall.js",
"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 suppported.`)
}

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

169
node_modules/@vueuse/integrations/package.json generated vendored Normal file
View File

@@ -0,0 +1,169 @@
{
"name": "@vueuse/integrations",
"version": "10.5.0",
"description": "Integration wrappers for utility libraries",
"author": "Anthony Fu <https://github.com/antfu>",
"license": "MIT",
"funding": "https://github.com/sponsors/antfu",
"homepage": "https://github.com/vueuse/vueuse/tree/main/packages/integrations#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/vueuse/vueuse.git",
"directory": "packages/integrations"
},
"bugs": {
"url": "https://github.com/vueuse/vueuse/issues"
},
"keywords": [
"vue",
"vue-use",
"utils"
],
"sideEffects": false,
"exports": {
".": {
"import": "./index.mjs",
"require": "./index.cjs"
},
"./*": "./*",
"./useAsyncValidator": {
"import": "./useAsyncValidator.mjs",
"require": "./useAsyncValidator.cjs"
},
"./useAxios": {
"import": "./useAxios.mjs",
"require": "./useAxios.cjs"
},
"./useCookies": {
"import": "./useCookies.mjs",
"require": "./useCookies.cjs"
},
"./useDrauu": {
"import": "./useDrauu.mjs",
"require": "./useDrauu.cjs"
},
"./useFocusTrap": {
"import": "./useFocusTrap.mjs",
"require": "./useFocusTrap.cjs"
},
"./useFocusTrap/component": {
"import": "./useFocusTrap/component.mjs",
"require": "./useFocusTrap/component.cjs"
},
"./useFuse": {
"import": "./useFuse.mjs",
"require": "./useFuse.cjs"
},
"./useJwt": {
"import": "./useJwt.mjs",
"require": "./useJwt.cjs"
},
"./useNProgress": {
"import": "./useNProgress.mjs",
"require": "./useNProgress.cjs"
},
"./useQRCode": {
"import": "./useQRCode.mjs",
"require": "./useQRCode.cjs"
},
"./useChangeCase": {
"import": "./useChangeCase.mjs",
"require": "./useChangeCase.cjs"
},
"./useAsyncValidator/component": {
"import": "./useAsyncValidator/component.mjs",
"require": "./useAsyncValidator/component.cjs"
},
"./useIDBKeyval": {
"import": "./useIDBKeyval.mjs",
"require": "./useIDBKeyval.cjs"
},
"./useSortable": {
"import": "./useSortable.mjs",
"require": "./useSortable.cjs"
},
"./useSortable/component": {
"import": "./useSortable/component.mjs",
"require": "./useSortable/component.cjs"
}
},
"main": "./index.cjs",
"module": "./index.mjs",
"unpkg": "./index.iife.min.js",
"jsdelivr": "./index.iife.min.js",
"types": "./index.d.cts",
"peerDependencies": {
"async-validator": "*",
"axios": "*",
"change-case": "*",
"drauu": "*",
"focus-trap": "*",
"fuse.js": "*",
"idb-keyval": "*",
"jwt-decode": "*",
"nprogress": "*",
"qrcode": "*",
"sortablejs": "*",
"universal-cookie": "*"
},
"peerDependenciesMeta": {
"axios": {
"optional": true
},
"async-validator": {
"optional": true
},
"change-case": {
"optional": true
},
"drauu": {
"optional": true
},
"focus-trap": {
"optional": true
},
"fuse.js": {
"optional": true
},
"idb-keyval": {
"optional": true
},
"jwt-decode": {
"optional": true
},
"nprogress": {
"optional": true
},
"qrcode": {
"optional": true
},
"universal-cookie": {
"optional": true
},
"sortablejs": {
"optional": true
}
},
"dependencies": {
"@vueuse/core": "10.5.0",
"@vueuse/shared": "10.5.0",
"vue-demi": ">=0.14.6"
},
"devDependencies": {
"@types/nprogress": "^0.2.1",
"@types/qrcode": "^1.5.2",
"@types/sortablejs": "^1.15.3",
"async-validator": "^4.2.5",
"axios": "^1.5.1",
"change-case": "^4.1.2",
"drauu": "^0.3.7",
"focus-trap": "^7.5.3",
"fuse.js": "^6.6.2",
"idb-keyval": "^6.2.1",
"jwt-decode": "^3.1.2",
"nprogress": "^0.2.0",
"qrcode": "^1.5.3",
"sortablejs": "^1.15.0",
"universal-cookie": "^6.1.1"
}
}

View File

@@ -0,0 +1,74 @@
'use strict';
var shared = require('@vueuse/shared');
var Schema = require('async-validator');
var vueDemi = require('vue-demi');
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);
}
};
}
exports.useAsyncValidator = useAsyncValidator;

View File

@@ -0,0 +1,48 @@
import { MaybeRefOrGetter } from '@vueuse/shared';
import { ValidateError, ValidateOption, Rules } from 'async-validator';
import { Ref } from 'vue-demi';
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>;
export { type AsyncValidatorError, type UseAsyncValidatorExecuteReturn, type UseAsyncValidatorOptions, type UseAsyncValidatorReturn, useAsyncValidator };

View File

@@ -0,0 +1,48 @@
import { MaybeRefOrGetter } from '@vueuse/shared';
import { ValidateError, ValidateOption, Rules } from 'async-validator';
import { Ref } from 'vue-demi';
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>;
export { type AsyncValidatorError, type UseAsyncValidatorExecuteReturn, type UseAsyncValidatorOptions, type UseAsyncValidatorReturn, useAsyncValidator };

View File

@@ -0,0 +1,48 @@
import { MaybeRefOrGetter } from '@vueuse/shared';
import { ValidateError, ValidateOption, Rules } from 'async-validator';
import { Ref } from 'vue-demi';
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>;
export { type AsyncValidatorError, type UseAsyncValidatorExecuteReturn, type UseAsyncValidatorOptions, type UseAsyncValidatorReturn, useAsyncValidator };

View File

@@ -0,0 +1,189 @@
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 = () => !!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 = () => !!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
})(
(this.VueDemi = this.VueDemi || (typeof VueDemi !== 'undefined' ? VueDemi : {})),
this.Vue || (typeof Vue !== 'undefined' ? Vue : undefined),
this.VueCompositionAPI || (typeof VueCompositionAPI !== 'undefined' ? VueCompositionAPI : undefined)
);
;
;(function (exports, shared, Schema, vueDemi) {
'use strict';
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);
}
};
}
exports.useAsyncValidator = useAsyncValidator;
})(this.VueUse = this.VueUse || {}, VueUse, AsyncValidator, VueDemi);

View File

@@ -0,0 +1 @@
var VueDemi=function(n,r,f){if(n.install)return n;if(!r)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),n;if(r.version.slice(0,4)==="2.7."){let e=function(o,c){var i,v={},d={config:r.config,use:r.use.bind(r),mixin:r.mixin.bind(r),component:r.component.bind(r),provide:function(a,l){return v[a]=l,this},directive:function(a,l){return l?(r.directive(a,l),d):r.directive(a)},mount:function(a,l){return i||(i=new r(Object.assign({propsData:c},o,{provide:Object.assign(v,o.provide)})),i.$mount(a,l),i)},unmount:function(){i&&(i.$destroy(),i=void 0)}};return d};var A=e;for(var t in r)n[t]=r[t];n.isVue2=!0,n.isVue3=!1,n.install=function(){},n.Vue=r,n.Vue2=r,n.version=r.version,n.warn=r.util.warn,n.hasInjectionContext=()=>!!n.getCurrentInstance(),n.createApp=e}else if(r.version.slice(0,2)==="2.")if(f){for(var t in f)n[t]=f[t];n.isVue2=!0,n.isVue3=!1,n.install=function(){},n.Vue=r,n.Vue2=r,n.version=r.version,n.hasInjectionContext=()=>!!n.getCurrentInstance()}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(r.version.slice(0,2)==="3."){for(var t in r)n[t]=r[t];n.isVue2=!1,n.isVue3=!0,n.install=function(){},n.Vue=r,n.Vue2=void 0,n.version=r.version,n.set=function(e,o,c){return Array.isArray(e)?(e.length=Math.max(e.length,o),e.splice(o,1,c),c):(e[o]=c,c)},n.del=function(e,o){if(Array.isArray(e)){e.splice(o,1);return}delete e[o]}}else console.error("[vue-demi] Vue version "+r.version+" is unsupported.");return n}(this.VueDemi=this.VueDemi||(typeof VueDemi<"u"?VueDemi:{}),this.Vue||(typeof Vue<"u"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI<"u"?VueCompositionAPI:void 0));(function(n,r,f,t){"use strict";const A=f.default||f;function e(o,c,i={}){const{validateOption:v={},immediate:d=!0,manual:a=!1}=i,l=r.toRef(o),u=t.shallowRef(null),p=t.ref(!0),h=t.ref(!d||a),b=t.computed(()=>{var s;return((s=u.value)==null?void 0:s.errors)||[]}),w=t.computed(()=>{var s;return((s=u.value)==null?void 0:s.fields)||{}}),I=t.computed(()=>new A(r.toValue(c))),x=async()=>{p.value=!1,h.value=!1;try{await I.value.validate(l.value,v),h.value=!0,u.value=null}catch(s){u.value=s}finally{p.value=!0}return{pass:h.value,errorInfo:u.value,errors:b.value,errorFields:w.value}};a||t.watch([l,I],()=>x(),{immediate:d,deep:!0});const C={isFinished:p,pass:h,errors:b,errorInfo:u,errorFields:w,execute:x};function j(){return new Promise((s,y)=>{r.until(p).toBe(!0).then(()=>s(C)).catch(F=>y(F))})}return{...C,then(s,y){return j().then(s,y)}}}n.useAsyncValidator=e})(this.VueUse=this.VueUse||{},VueUse,AsyncValidator,VueDemi);

View File

@@ -0,0 +1,72 @@
import { toRef, toValue, until } from '@vueuse/shared';
import Schema from 'async-validator';
import { shallowRef, ref, computed, watch } from 'vue-demi';
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);
}
};
}
export { useAsyncValidator };

View File

@@ -0,0 +1,89 @@
'use strict';
var vueDemi = require('vue-demi');
var shared = require('@vueuse/shared');
var Schema = require('async-validator');
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(() => errorInfo.value?.errors || []);
const errorFields = vueDemi.computed(() => errorInfo.value?.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);
}
};
}
const UseAsyncValidator = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
name: "UseAsyncValidator",
props: {
form: {
type: Object,
required: true
},
rules: {
type: Object,
required: true
}
},
setup(props, { slots }) {
const data = vueDemi.reactive(useAsyncValidator(props.form, props.rules));
return () => {
if (slots.default)
return slots.default(data);
};
}
});
exports.UseAsyncValidator = UseAsyncValidator;

View File

@@ -0,0 +1,27 @@
import * as vue_demi from 'vue-demi';
import { PropType } from 'vue-demi';
import { Rules } from 'async-validator';
declare const UseAsyncValidator: vue_demi.DefineComponent<{
form: {
type: PropType<Record<string, any>>;
required: true;
};
rules: {
type: PropType<Rules>;
required: true;
};
}, () => vue_demi.VNode<vue_demi.RendererNode, vue_demi.RendererElement, {
[key: string]: any;
}>[] | undefined, unknown, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.VNodeProps & vue_demi.AllowedComponentProps & vue_demi.ComponentCustomProps, Readonly<vue_demi.ExtractPropTypes<{
form: {
type: PropType<Record<string, any>>;
required: true;
};
rules: {
type: PropType<Rules>;
required: true;
};
}>>, {}, {}>;
export { UseAsyncValidator };

View File

@@ -0,0 +1,27 @@
import * as vue_demi from 'vue-demi';
import { PropType } from 'vue-demi';
import { Rules } from 'async-validator';
declare const UseAsyncValidator: vue_demi.DefineComponent<{
form: {
type: PropType<Record<string, any>>;
required: true;
};
rules: {
type: PropType<Rules>;
required: true;
};
}, () => vue_demi.VNode<vue_demi.RendererNode, vue_demi.RendererElement, {
[key: string]: any;
}>[] | undefined, unknown, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.VNodeProps & vue_demi.AllowedComponentProps & vue_demi.ComponentCustomProps, Readonly<vue_demi.ExtractPropTypes<{
form: {
type: PropType<Record<string, any>>;
required: true;
};
rules: {
type: PropType<Rules>;
required: true;
};
}>>, {}, {}>;
export { UseAsyncValidator };

View File

@@ -0,0 +1,27 @@
import * as vue_demi from 'vue-demi';
import { PropType } from 'vue-demi';
import { Rules } from 'async-validator';
declare const UseAsyncValidator: vue_demi.DefineComponent<{
form: {
type: PropType<Record<string, any>>;
required: true;
};
rules: {
type: PropType<Rules>;
required: true;
};
}, () => vue_demi.VNode<vue_demi.RendererNode, vue_demi.RendererElement, {
[key: string]: any;
}>[] | undefined, unknown, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.VNodeProps & vue_demi.AllowedComponentProps & vue_demi.ComponentCustomProps, Readonly<vue_demi.ExtractPropTypes<{
form: {
type: PropType<Record<string, any>>;
required: true;
};
rules: {
type: PropType<Rules>;
required: true;
};
}>>, {}, {}>;
export { UseAsyncValidator };

View File

@@ -0,0 +1,87 @@
import { shallowRef, ref, computed, watch, defineComponent, reactive } from 'vue-demi';
import { toRef, toValue, until } from '@vueuse/shared';
import Schema from 'async-validator';
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(() => errorInfo.value?.errors || []);
const errorFields = computed(() => errorInfo.value?.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);
}
};
}
const UseAsyncValidator = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
name: "UseAsyncValidator",
props: {
form: {
type: Object,
required: true
},
rules: {
type: Object,
required: true
}
},
setup(props, { slots }) {
const data = reactive(useAsyncValidator(props.form, props.rules));
return () => {
if (slots.default)
return slots.default(data);
};
}
});
export { UseAsyncValidator };

119
node_modules/@vueuse/integrations/useAxios.cjs generated vendored Normal file
View File

@@ -0,0 +1,119 @@
'use strict';
var vueDemi = require('vue-demi');
var shared = require('@vueuse/shared');
var axios = require('axios');
function useAxios(...args) {
const url = typeof args[0] === "string" ? args[0] : void 0;
const argsPlaceholder = typeof url === "string" ? 1 : 0;
let defaultConfig = {};
let instance = axios;
let options = {
immediate: !!argsPlaceholder,
shallow: true
};
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];
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();
const cancelTokenSource = axios.CancelToken.source;
let cancelToken = cancelTokenSource();
const abort = (message) => {
if (isFinished.value || !isLoading.value)
return;
cancelToken.cancel(message);
cancelToken = cancelTokenSource();
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();
abort();
loading(true);
executeCounter += 1;
const currentExecuteCounter = executeCounter;
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, cancelToken: cancelToken.token }).then((r) => {
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
};
}
exports.useAxios = useAxios;

94
node_modules/@vueuse/integrations/useAxios.d.cts generated vendored Normal file
View File

@@ -0,0 +1,94 @@
import { ShallowRef, Ref } from 'vue-demi';
import { AxiosResponse, AxiosRequestConfig, AxiosInstance } from 'axios';
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;
/**
* 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>>;
export { type EasyUseAxiosReturn, type StrictUseAxiosReturn, type UseAxiosOptions, type UseAxiosReturn, useAxios };

94
node_modules/@vueuse/integrations/useAxios.d.mts generated vendored Normal file
View File

@@ -0,0 +1,94 @@
import { ShallowRef, Ref } from 'vue-demi';
import { AxiosResponse, AxiosRequestConfig, AxiosInstance } from 'axios';
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;
/**
* 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>>;
export { type EasyUseAxiosReturn, type StrictUseAxiosReturn, type UseAxiosOptions, type UseAxiosReturn, useAxios };

94
node_modules/@vueuse/integrations/useAxios.d.ts generated vendored Normal file
View File

@@ -0,0 +1,94 @@
import { ShallowRef, Ref } from 'vue-demi';
import { AxiosResponse, AxiosRequestConfig, AxiosInstance } from 'axios';
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;
/**
* 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>>;
export { type EasyUseAxiosReturn, type StrictUseAxiosReturn, type UseAxiosOptions, type UseAxiosReturn, useAxios };

234
node_modules/@vueuse/integrations/useAxios.iife.js generated vendored Normal file
View File

@@ -0,0 +1,234 @@
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 = () => !!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 = () => !!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
})(
(this.VueDemi = this.VueDemi || (typeof VueDemi !== 'undefined' ? VueDemi : {})),
this.Vue || (typeof Vue !== 'undefined' ? Vue : undefined),
this.VueCompositionAPI || (typeof VueCompositionAPI !== 'undefined' ? VueCompositionAPI : undefined)
);
;
;(function (exports, vueDemi, shared, axios) {
'use strict';
function useAxios(...args) {
const url = typeof args[0] === "string" ? args[0] : void 0;
const argsPlaceholder = typeof url === "string" ? 1 : 0;
let defaultConfig = {};
let instance = axios;
let options = {
immediate: !!argsPlaceholder,
shallow: true
};
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];
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();
const cancelTokenSource = axios.CancelToken.source;
let cancelToken = cancelTokenSource();
const abort = (message) => {
if (isFinished.value || !isLoading.value)
return;
cancelToken.cancel(message);
cancelToken = cancelTokenSource();
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();
abort();
loading(true);
executeCounter += 1;
const currentExecuteCounter = executeCounter;
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, cancelToken: cancelToken.token }).then((r) => {
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
};
}
exports.useAxios = useAxios;
})(this.VueUse = this.VueUse || {}, VueDemi, VueUse, axios);

View File

@@ -0,0 +1 @@
var VueDemi=function(e,n,u){if(e.install)return e;if(!n)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),e;if(n.version.slice(0,4)==="2.7."){let t=function(i,o){var l,v={},d={config:n.config,use:n.use.bind(n),mixin:n.mixin.bind(n),component:n.component.bind(n),provide:function(c,f){return v[c]=f,this},directive:function(c,f){return f?(n.directive(c,f),d):n.directive(c)},mount:function(c,f){return l||(l=new n(Object.assign({propsData:o},i,{provide:Object.assign(v,i.provide)})),l.$mount(c,f),l)},unmount:function(){l&&(l.$destroy(),l=void 0)}};return d};var R=t;for(var r in n)e[r]=n[r];e.isVue2=!0,e.isVue3=!1,e.install=function(){},e.Vue=n,e.Vue2=n,e.version=n.version,e.warn=n.util.warn,e.hasInjectionContext=()=>!!e.getCurrentInstance(),e.createApp=t}else if(n.version.slice(0,2)==="2.")if(u){for(var r in u)e[r]=u[r];e.isVue2=!0,e.isVue3=!1,e.install=function(){},e.Vue=n,e.Vue2=n,e.version=n.version,e.hasInjectionContext=()=>!!e.getCurrentInstance()}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(n.version.slice(0,2)==="3."){for(var r in n)e[r]=n[r];e.isVue2=!1,e.isVue3=!0,e.install=function(){},e.Vue=n,e.Vue2=void 0,e.version=n.version,e.set=function(t,i,o){return Array.isArray(t)?(t.length=Math.max(t.length,i),t.splice(i,1,o),o):(t[i]=o,o)},e.del=function(t,i){if(Array.isArray(t)){t.splice(i,1);return}delete t[i]}}else console.error("[vue-demi] Vue version "+n.version+" is unsupported.");return e}(this.VueDemi=this.VueDemi||(typeof VueDemi<"u"?VueDemi:{}),this.Vue||(typeof Vue<"u"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI<"u"?VueCompositionAPI:void 0));(function(e,n,u,r){"use strict";function R(...t){const i=typeof t[0]=="string"?t[0]:void 0,o=typeof i=="string"?1:0;let l={},v=r,d={immediate:!!o,shallow:!0};const c=s=>!!s?.request;t.length>0+o&&(c(t[0+o])?v=t[0+o]:l=t[0+o]),t.length>1+o&&c(t[1+o])&&(v=t[1+o]),(t.length===2+o&&!c(t[1+o])||t.length===3+o)&&(d=t[t.length-1]);const{initialData:f,shallow:S,onSuccess:U=u.noop,onError:$=u.noop,immediate:q,resetOnExecute:B=!1}=d,j=n.shallowRef(),w=(S?n.shallowRef:n.ref)(f),p=n.ref(!1),A=n.ref(!1),y=n.ref(!1),h=n.shallowRef(),P=r.CancelToken.source;let C=P();const x=s=>{p.value||!A.value||(C.cancel(s),C=P(),y.value=!0,A.value=!1,p.value=!1)},T=s=>{A.value=s,p.value=!s},M=()=>{B&&(w.value=f)},_=()=>new Promise((s,b)=>{u.until(p).toBe(!0).then(()=>h.value?b(h.value):s(F))}),I={then:(...s)=>_().then(...s),catch:(...s)=>_().catch(...s)};let E=0;const k=(s=i,b={})=>{h.value=void 0;const L=typeof s=="string"?s:i??b.url;if(L===void 0)return h.value=new r.AxiosError(r.AxiosError.ERR_INVALID_URL),p.value=!0,I;M(),x(),T(!0),E+=1;const N=E;return v(L,{...l,...typeof s=="object"?s:b,cancelToken:C.token}).then(a=>{j.value=a;const O=a.data;w.value=O,U(O)}).catch(a=>{h.value=a,$(a)}).finally(()=>{var a;(a=d.onFinish)==null||a.call(d),N===E&&T(!1)}),I};q&&i&&k();const F={response:j,data:w,error:h,isFinished:p,isLoading:A,cancel:x,isAborted:y,isCanceled:y,abort:x,execute:k};return{...F,...I}}e.useAxios=R})(this.VueUse=this.VueUse||{},VueDemi,VueUse,axios);

117
node_modules/@vueuse/integrations/useAxios.mjs generated vendored Normal file
View File

@@ -0,0 +1,117 @@
import { shallowRef, ref } from 'vue-demi';
import { noop, until } from '@vueuse/shared';
import axios, { AxiosError } from 'axios';
function useAxios(...args) {
const url = typeof args[0] === "string" ? args[0] : void 0;
const argsPlaceholder = typeof url === "string" ? 1 : 0;
let defaultConfig = {};
let instance = axios;
let options = {
immediate: !!argsPlaceholder,
shallow: true
};
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];
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();
const cancelTokenSource = axios.CancelToken.source;
let cancelToken = cancelTokenSource();
const abort = (message) => {
if (isFinished.value || !isLoading.value)
return;
cancelToken.cancel(message);
cancelToken = cancelTokenSource();
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();
abort();
loading(true);
executeCounter += 1;
const currentExecuteCounter = executeCounter;
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, cancelToken: cancelToken.token }).then((r) => {
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
};
}
export { useAxios };

36
node_modules/@vueuse/integrations/useChangeCase.cjs generated vendored Normal file
View File

@@ -0,0 +1,36 @@
'use strict';
var shared = require('@vueuse/shared');
var vueDemi = require('vue-demi');
var changeCase$1 = require('change-case');
var changeCase = /*#__PURE__*/Object.freeze({
__proto__: null,
camelCase: changeCase$1.camelCase,
capitalCase: changeCase$1.capitalCase,
constantCase: changeCase$1.constantCase,
dotCase: changeCase$1.dotCase,
headerCase: changeCase$1.headerCase,
noCase: changeCase$1.noCase,
paramCase: changeCase$1.paramCase,
pascalCase: changeCase$1.pascalCase,
pathCase: changeCase$1.pathCase,
sentenceCase: changeCase$1.sentenceCase,
snakeCase: changeCase$1.snakeCase
});
function useChangeCase(input, type, options) {
if (typeof input === "function")
return vueDemi.computed(() => changeCase[type](shared.toValue(input), options));
const text = vueDemi.ref(input);
return vueDemi.computed({
get() {
return changeCase[type](text.value, options);
},
set(value) {
text.value = value;
}
});
}
exports.useChangeCase = useChangeCase;

24
node_modules/@vueuse/integrations/useChangeCase.d.cts generated vendored Normal file
View File

@@ -0,0 +1,24 @@
import { camelCase, capitalCase, constantCase, dotCase, headerCase, noCase, paramCase, pascalCase, pathCase, sentenceCase, snakeCase, Options } from 'change-case';
import { MaybeRef, MaybeRefOrGetter } from '@vueuse/shared';
import { WritableComputedRef, ComputedRef } from 'vue-demi';
declare const changeCase_camelCase: typeof camelCase;
declare const changeCase_capitalCase: typeof capitalCase;
declare const changeCase_constantCase: typeof constantCase;
declare const changeCase_dotCase: typeof dotCase;
declare const changeCase_headerCase: typeof headerCase;
declare const changeCase_noCase: typeof noCase;
declare const changeCase_paramCase: typeof paramCase;
declare const changeCase_pascalCase: typeof pascalCase;
declare const changeCase_pathCase: typeof pathCase;
declare const changeCase_sentenceCase: typeof sentenceCase;
declare const changeCase_snakeCase: typeof snakeCase;
declare namespace changeCase {
export { changeCase_camelCase as camelCase, changeCase_capitalCase as capitalCase, changeCase_constantCase as constantCase, changeCase_dotCase as dotCase, changeCase_headerCase as headerCase, changeCase_noCase as noCase, changeCase_paramCase as paramCase, changeCase_pascalCase as pascalCase, changeCase_pathCase as pathCase, changeCase_sentenceCase as sentenceCase, changeCase_snakeCase as snakeCase };
}
type ChangeCaseType = keyof typeof changeCase;
declare function useChangeCase(input: MaybeRef<string>, type: ChangeCaseType, options?: Options | undefined): WritableComputedRef<string>;
declare function useChangeCase(input: MaybeRefOrGetter<string>, type: ChangeCaseType, options?: Options | undefined): ComputedRef<string>;
export { type ChangeCaseType, useChangeCase };

24
node_modules/@vueuse/integrations/useChangeCase.d.mts generated vendored Normal file
View File

@@ -0,0 +1,24 @@
import { camelCase, capitalCase, constantCase, dotCase, headerCase, noCase, paramCase, pascalCase, pathCase, sentenceCase, snakeCase, Options } from 'change-case';
import { MaybeRef, MaybeRefOrGetter } from '@vueuse/shared';
import { WritableComputedRef, ComputedRef } from 'vue-demi';
declare const changeCase_camelCase: typeof camelCase;
declare const changeCase_capitalCase: typeof capitalCase;
declare const changeCase_constantCase: typeof constantCase;
declare const changeCase_dotCase: typeof dotCase;
declare const changeCase_headerCase: typeof headerCase;
declare const changeCase_noCase: typeof noCase;
declare const changeCase_paramCase: typeof paramCase;
declare const changeCase_pascalCase: typeof pascalCase;
declare const changeCase_pathCase: typeof pathCase;
declare const changeCase_sentenceCase: typeof sentenceCase;
declare const changeCase_snakeCase: typeof snakeCase;
declare namespace changeCase {
export { changeCase_camelCase as camelCase, changeCase_capitalCase as capitalCase, changeCase_constantCase as constantCase, changeCase_dotCase as dotCase, changeCase_headerCase as headerCase, changeCase_noCase as noCase, changeCase_paramCase as paramCase, changeCase_pascalCase as pascalCase, changeCase_pathCase as pathCase, changeCase_sentenceCase as sentenceCase, changeCase_snakeCase as snakeCase };
}
type ChangeCaseType = keyof typeof changeCase;
declare function useChangeCase(input: MaybeRef<string>, type: ChangeCaseType, options?: Options | undefined): WritableComputedRef<string>;
declare function useChangeCase(input: MaybeRefOrGetter<string>, type: ChangeCaseType, options?: Options | undefined): ComputedRef<string>;
export { type ChangeCaseType, useChangeCase };

24
node_modules/@vueuse/integrations/useChangeCase.d.ts generated vendored Normal file
View File

@@ -0,0 +1,24 @@
import { camelCase, capitalCase, constantCase, dotCase, headerCase, noCase, paramCase, pascalCase, pathCase, sentenceCase, snakeCase, Options } from 'change-case';
import { MaybeRef, MaybeRefOrGetter } from '@vueuse/shared';
import { WritableComputedRef, ComputedRef } from 'vue-demi';
declare const changeCase_camelCase: typeof camelCase;
declare const changeCase_capitalCase: typeof capitalCase;
declare const changeCase_constantCase: typeof constantCase;
declare const changeCase_dotCase: typeof dotCase;
declare const changeCase_headerCase: typeof headerCase;
declare const changeCase_noCase: typeof noCase;
declare const changeCase_paramCase: typeof paramCase;
declare const changeCase_pascalCase: typeof pascalCase;
declare const changeCase_pathCase: typeof pathCase;
declare const changeCase_sentenceCase: typeof sentenceCase;
declare const changeCase_snakeCase: typeof snakeCase;
declare namespace changeCase {
export { changeCase_camelCase as camelCase, changeCase_capitalCase as capitalCase, changeCase_constantCase as constantCase, changeCase_dotCase as dotCase, changeCase_headerCase as headerCase, changeCase_noCase as noCase, changeCase_paramCase as paramCase, changeCase_pascalCase as pascalCase, changeCase_pathCase as pathCase, changeCase_sentenceCase as sentenceCase, changeCase_snakeCase as snakeCase };
}
type ChangeCaseType = keyof typeof changeCase;
declare function useChangeCase(input: MaybeRef<string>, type: ChangeCaseType, options?: Options | undefined): WritableComputedRef<string>;
declare function useChangeCase(input: MaybeRefOrGetter<string>, type: ChangeCaseType, options?: Options | undefined): ComputedRef<string>;
export { type ChangeCaseType, useChangeCase };

151
node_modules/@vueuse/integrations/useChangeCase.iife.js generated vendored Normal file
View File

@@ -0,0 +1,151 @@
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 = () => !!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 = () => !!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
})(
(this.VueDemi = this.VueDemi || (typeof VueDemi !== 'undefined' ? VueDemi : {})),
this.Vue || (typeof Vue !== 'undefined' ? Vue : undefined),
this.VueCompositionAPI || (typeof VueCompositionAPI !== 'undefined' ? VueCompositionAPI : undefined)
);
;
;(function (exports, shared, vueDemi, changeCase$1) {
'use strict';
var changeCase = /*#__PURE__*/Object.freeze({
__proto__: null,
camelCase: changeCase$1.camelCase,
capitalCase: changeCase$1.capitalCase,
constantCase: changeCase$1.constantCase,
dotCase: changeCase$1.dotCase,
headerCase: changeCase$1.headerCase,
noCase: changeCase$1.noCase,
paramCase: changeCase$1.paramCase,
pascalCase: changeCase$1.pascalCase,
pathCase: changeCase$1.pathCase,
sentenceCase: changeCase$1.sentenceCase,
snakeCase: changeCase$1.snakeCase
});
function useChangeCase(input, type, options) {
if (typeof input === "function")
return vueDemi.computed(() => changeCase[type](shared.toValue(input), options));
const text = vueDemi.ref(input);
return vueDemi.computed({
get() {
return changeCase[type](text.value, options);
},
set(value) {
text.value = value;
}
});
}
exports.useChangeCase = useChangeCase;
})(this.VueUse = this.VueUse || {}, VueUse, VueDemi, changeCase);

View File

@@ -0,0 +1 @@
var VueDemi=function(n,s,a){if(n.install)return n;if(!s)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),n;if(s.version.slice(0,4)==="2.7."){let r=function(t,i){var o,d={},l={config:s.config,use:s.use.bind(s),mixin:s.mixin.bind(s),component:s.component.bind(s),provide:function(f,c){return d[f]=c,this},directive:function(f,c){return c?(s.directive(f,c),l):s.directive(f)},mount:function(f,c){return o||(o=new s(Object.assign({propsData:i},t,{provide:Object.assign(d,t.provide)})),o.$mount(f,c),o)},unmount:function(){o&&(o.$destroy(),o=void 0)}};return l};var p=r;for(var e in s)n[e]=s[e];n.isVue2=!0,n.isVue3=!1,n.install=function(){},n.Vue=s,n.Vue2=s,n.version=s.version,n.warn=s.util.warn,n.hasInjectionContext=()=>!!n.getCurrentInstance(),n.createApp=r}else if(s.version.slice(0,2)==="2.")if(a){for(var e in a)n[e]=a[e];n.isVue2=!0,n.isVue3=!1,n.install=function(){},n.Vue=s,n.Vue2=s,n.version=s.version,n.hasInjectionContext=()=>!!n.getCurrentInstance()}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(s.version.slice(0,2)==="3."){for(var e in s)n[e]=s[e];n.isVue2=!1,n.isVue3=!0,n.install=function(){},n.Vue=s,n.Vue2=void 0,n.version=s.version,n.set=function(r,t,i){return Array.isArray(r)?(r.length=Math.max(r.length,t),r.splice(t,1,i),i):(r[t]=i,i)},n.del=function(r,t){if(Array.isArray(r)){r.splice(t,1);return}delete r[t]}}else console.error("[vue-demi] Vue version "+s.version+" is unsupported.");return n}(this.VueDemi=this.VueDemi||(typeof VueDemi<"u"?VueDemi:{}),this.Vue||(typeof Vue<"u"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI<"u"?VueCompositionAPI:void 0));(function(n,s,a,e){"use strict";var p=Object.freeze({__proto__:null,camelCase:e.camelCase,capitalCase:e.capitalCase,constantCase:e.constantCase,dotCase:e.dotCase,headerCase:e.headerCase,noCase:e.noCase,paramCase:e.paramCase,pascalCase:e.pascalCase,pathCase:e.pathCase,sentenceCase:e.sentenceCase,snakeCase:e.snakeCase});function r(t,i,o){if(typeof t=="function")return a.computed(()=>p[i](s.toValue(t),o));const d=a.ref(t);return a.computed({get(){return p[i](d.value,o)},set(l){d.value=l}})}n.useChangeCase=r})(this.VueUse=this.VueUse||{},VueUse,VueDemi,changeCase);

34
node_modules/@vueuse/integrations/useChangeCase.mjs generated vendored Normal file
View File

@@ -0,0 +1,34 @@
import { toValue } from '@vueuse/shared';
import { computed, ref } from 'vue-demi';
import { camelCase, capitalCase, constantCase, dotCase, headerCase, noCase, paramCase, pascalCase, pathCase, sentenceCase, snakeCase } from 'change-case';
var changeCase = /*#__PURE__*/Object.freeze({
__proto__: null,
camelCase: camelCase,
capitalCase: capitalCase,
constantCase: constantCase,
dotCase: dotCase,
headerCase: headerCase,
noCase: noCase,
paramCase: paramCase,
pascalCase: pascalCase,
pathCase: pathCase,
sentenceCase: sentenceCase,
snakeCase: snakeCase
});
function useChangeCase(input, type, options) {
if (typeof input === "function")
return computed(() => changeCase[type](toValue(input), options));
const text = ref(input);
return computed({
get() {
return changeCase[type](text.value, options);
},
set(value) {
text.value = value;
}
});
}
export { useChangeCase };

63
node_modules/@vueuse/integrations/useCookies.cjs generated vendored Normal file
View File

@@ -0,0 +1,63 @@
'use strict';
var shared = require('@vueuse/shared');
var vueDemi = require('vue-demi');
var Cookie = require('universal-cookie');
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;
}
exports.createCookies = createCookies;
exports.useCookies = useCookies;

54
node_modules/@vueuse/integrations/useCookies.d.cts generated vendored Normal file
View File

@@ -0,0 +1,54 @@
import * as universal_cookie from 'universal-cookie';
import universal_cookie__default from 'universal-cookie';
import { IncomingMessage } from 'node:http';
/**
* 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_1 = any>(options?: universal_cookie.CookieGetOptions | undefined) => T_1;
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_1 = any>(options?: universal_cookie.CookieGetOptions | undefined) => T_1;
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;
};
export { createCookies, useCookies };

54
node_modules/@vueuse/integrations/useCookies.d.mts generated vendored Normal file
View File

@@ -0,0 +1,54 @@
import * as universal_cookie from 'universal-cookie';
import universal_cookie__default from 'universal-cookie';
import { IncomingMessage } from 'node:http';
/**
* 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_1 = any>(options?: universal_cookie.CookieGetOptions | undefined) => T_1;
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_1 = any>(options?: universal_cookie.CookieGetOptions | undefined) => T_1;
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;
};
export { createCookies, useCookies };

54
node_modules/@vueuse/integrations/useCookies.d.ts generated vendored Normal file
View File

@@ -0,0 +1,54 @@
import * as universal_cookie from 'universal-cookie';
import universal_cookie__default from 'universal-cookie';
import { IncomingMessage } from 'node:http';
/**
* 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_1 = any>(options?: universal_cookie.CookieGetOptions | undefined) => T_1;
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_1 = any>(options?: universal_cookie.CookieGetOptions | undefined) => T_1;
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;
};
export { createCookies, useCookies };

178
node_modules/@vueuse/integrations/useCookies.iife.js generated vendored Normal file
View File

@@ -0,0 +1,178 @@
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 = () => !!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 = () => !!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
})(
(this.VueDemi = this.VueDemi || (typeof VueDemi !== 'undefined' ? VueDemi : {})),
this.Vue || (typeof Vue !== 'undefined' ? Vue : undefined),
this.VueCompositionAPI || (typeof VueCompositionAPI !== 'undefined' ? VueCompositionAPI : undefined)
);
;
;(function (exports, shared, vueDemi, Cookie) {
'use strict';
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;
}
exports.createCookies = createCookies;
exports.useCookies = useCookies;
})(this.VueUse = this.VueUse || {}, VueUse, VueDemi, UniversalCookie);

View File

@@ -0,0 +1 @@
var VueDemi=function(n,e,d){if(n.install)return n;if(!e)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),n;if(e.version.slice(0,4)==="2.7."){let s=function(u,i){var o,a={},r={config:e.config,use:e.use.bind(e),mixin:e.mixin.bind(e),component:e.component.bind(e),provide:function(f,c){return a[f]=c,this},directive:function(f,c){return c?(e.directive(f,c),r):e.directive(f)},mount:function(f,c){return o||(o=new e(Object.assign({propsData:i},u,{provide:Object.assign(a,u.provide)})),o.$mount(f,c),o)},unmount:function(){o&&(o.$destroy(),o=void 0)}};return r};var p=s;for(var l in e)n[l]=e[l];n.isVue2=!0,n.isVue3=!1,n.install=function(){},n.Vue=e,n.Vue2=e,n.version=e.version,n.warn=e.util.warn,n.hasInjectionContext=()=>!!n.getCurrentInstance(),n.createApp=s}else if(e.version.slice(0,2)==="2.")if(d){for(var l in d)n[l]=d[l];n.isVue2=!0,n.isVue3=!1,n.install=function(){},n.Vue=e,n.Vue2=e,n.version=e.version,n.hasInjectionContext=()=>!!n.getCurrentInstance()}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(e.version.slice(0,2)==="3."){for(var l in e)n[l]=e[l];n.isVue2=!1,n.isVue3=!0,n.install=function(){},n.Vue=e,n.Vue2=void 0,n.version=e.version,n.set=function(s,u,i){return Array.isArray(s)?(s.length=Math.max(s.length,u),s.splice(u,1,i),i):(s[u]=i,i)},n.del=function(s,u){if(Array.isArray(s)){s.splice(u,1);return}delete s[u]}}else console.error("[vue-demi] Vue version "+e.version+" is unsupported.");return n}(this.VueDemi=this.VueDemi||(typeof VueDemi<"u"?VueDemi:{}),this.Vue||(typeof Vue<"u"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI<"u"?VueCompositionAPI:void 0));(function(n,e,d,l){"use strict";function p(i){const o=new l(i?i.headers.cookie:null);return(a,{doNotParse:r=!1,autoUpdateDependencies:f=!1}={})=>s(a,{doNotParse:r,autoUpdateDependencies:f},o)}function s(i,{doNotParse:o=!1,autoUpdateDependencies:a=!1}={},r=new l){const f=a?[...i||[]]:i;let c=r.getAll({doNotParse:!0});const v=d.ref(0),h=()=>{const t=r.getAll({doNotParse:!0});u(f||null,t,c)&&v.value++,c=t};return r.addChangeListener(h),e.tryOnScopeDispose(()=>{r.removeChangeListener(h)}),{get:(...t)=>(a&&f&&!f.includes(t[0])&&f.push(t[0]),v.value,r.get(t[0],{doNotParse:o,...t[1]})),getAll:(...t)=>(v.value,r.getAll({doNotParse:o,...t[0]})),set:(...t)=>r.set(...t),remove:(...t)=>r.remove(...t),addChangeListener:(...t)=>r.addChangeListener(...t),removeChangeListener:(...t)=>r.removeChangeListener(...t)}}function u(i,o,a){if(!i)return!0;for(const r of i)if(o[r]!==a[r])return!0;return!1}n.createCookies=p,n.useCookies=s})(this.VueUse=this.VueUse||{},VueUse,VueDemi,UniversalCookie);

60
node_modules/@vueuse/integrations/useCookies.mjs generated vendored Normal file
View File

@@ -0,0 +1,60 @@
import { tryOnScopeDispose } from '@vueuse/shared';
import { ref } from 'vue-demi';
import Cookie from 'universal-cookie';
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;
}
export { createCookies, useCookies };

116
node_modules/@vueuse/integrations/useDrauu.cjs generated vendored Normal file
View File

@@ -0,0 +1,116 @@
'use strict';
var vueDemi = require('vue-demi');
var drauu = require('drauu');
var core = require('@vueuse/core');
var shared = require('@vueuse/shared');
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
};
}
exports.useDrauu = useDrauu;

32
node_modules/@vueuse/integrations/useDrauu.d.cts generated vendored Normal file
View File

@@ -0,0 +1,32 @@
import { Ref } from 'vue-demi';
import { Options, Drauu, Brush } from 'drauu';
import { EventHookOn, MaybeComputedElementRef } from '@vueuse/core';
type UseDrauuOptions = Omit<Options, '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;
export { type UseDrauuOptions, type UseDrauuReturn, useDrauu };

32
node_modules/@vueuse/integrations/useDrauu.d.mts generated vendored Normal file
View File

@@ -0,0 +1,32 @@
import { Ref } from 'vue-demi';
import { Options, Drauu, Brush } from 'drauu';
import { EventHookOn, MaybeComputedElementRef } from '@vueuse/core';
type UseDrauuOptions = Omit<Options, '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;
export { type UseDrauuOptions, type UseDrauuReturn, useDrauu };

32
node_modules/@vueuse/integrations/useDrauu.d.ts generated vendored Normal file
View File

@@ -0,0 +1,32 @@
import { Ref } from 'vue-demi';
import { Options, Drauu, Brush } from 'drauu';
import { EventHookOn, MaybeComputedElementRef } from '@vueuse/core';
type UseDrauuOptions = Omit<Options, '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;
export { type UseDrauuOptions, type UseDrauuReturn, useDrauu };

230
node_modules/@vueuse/integrations/useDrauu.iife.js generated vendored Normal file
View File

@@ -0,0 +1,230 @@
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 = () => !!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 = () => !!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
})(
(this.VueDemi = this.VueDemi || (typeof VueDemi !== 'undefined' ? VueDemi : {})),
this.Vue || (typeof Vue !== 'undefined' ? Vue : undefined),
this.VueCompositionAPI || (typeof VueCompositionAPI !== 'undefined' ? VueCompositionAPI : undefined)
);
;
;(function (exports, vueDemi, drauu, core, shared) {
'use strict';
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
};
}
exports.useDrauu = useDrauu;
})(this.VueUse = this.VueUse || {}, VueDemi, Drauu, VueUse, VueUse);

View File

@@ -0,0 +1 @@
var VueDemi=function(e,n,d){if(e.install)return e;if(!n)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),e;if(n.version.slice(0,4)==="2.7."){let s=function(a,i){var o,f={},v={config:n.config,use:n.use.bind(n),mixin:n.mixin.bind(n),component:n.component.bind(n),provide:function(l,c){return f[l]=c,this},directive:function(l,c){return c?(n.directive(l,c),v):n.directive(l)},mount:function(l,c){return o||(o=new n(Object.assign({propsData:i},a,{provide:Object.assign(f,a.provide)})),o.$mount(l,c),o)},unmount:function(){o&&(o.$destroy(),o=void 0)}};return v};var h=s;for(var t in n)e[t]=n[t];e.isVue2=!0,e.isVue3=!1,e.install=function(){},e.Vue=n,e.Vue2=n,e.version=n.version,e.warn=n.util.warn,e.hasInjectionContext=()=>!!e.getCurrentInstance(),e.createApp=s}else if(n.version.slice(0,2)==="2.")if(d){for(var t in d)e[t]=d[t];e.isVue2=!0,e.isVue3=!1,e.install=function(){},e.Vue=n,e.Vue2=n,e.version=n.version,e.hasInjectionContext=()=>!!e.getCurrentInstance()}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(n.version.slice(0,2)==="3."){for(var t in n)e[t]=n[t];e.isVue2=!1,e.isVue3=!0,e.install=function(){},e.Vue=n,e.Vue2=void 0,e.version=n.version,e.set=function(s,a,i){return Array.isArray(s)?(s.length=Math.max(s.length,a),s.splice(a,1,i),i):(s[a]=i,i)},e.del=function(s,a){if(Array.isArray(s)){s.splice(a,1);return}delete s[a]}}else console.error("[vue-demi] Vue version "+n.version+" is unsupported.");return e}(this.VueDemi=this.VueDemi||(typeof VueDemi<"u"?VueDemi:{}),this.Vue||(typeof Vue<"u"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI<"u"?VueCompositionAPI:void 0));(function(e,n,d,t,h){"use strict";function s(a,i){const o=n.ref();let f=[];const v=t.createEventHook(),l=t.createEventHook(),c=t.createEventHook(),g=t.createEventHook(),b=t.createEventHook(),E=n.ref(!1),C=n.ref(!1),k=n.ref(!1),S=n.ref(!1),p=n.ref({color:"black",size:3,arrowEnd:!1,cornerRadius:0,dasharray:void 0,fill:"transparent",mode:"draw",...i?.brush});n.watch(p,()=>{const r=o.value;r&&(r.brush=p.value,r.mode=p.value.mode)},{deep:!0});const w=()=>{var r;return(r=o.value)==null?void 0:r.undo()},A=()=>{var r;return(r=o.value)==null?void 0:r.redo()},I=()=>{var r;return(r=o.value)==null?void 0:r.clear()},_=()=>{var r;return(r=o.value)==null?void 0:r.cancel()},P=r=>{var u;return(u=o.value)==null?void 0:u.load(r)},U=()=>{var r;return(r=o.value)==null?void 0:r.dump()},y=()=>{var r;f.forEach(u=>u()),(r=o.value)==null||r.unmount()},H=()=>{o.value&&(E.value=o.value.canUndo(),C.value=o.value.canRedo(),k.value=o.value.altPressed,S.value=o.value.shiftPressed)};return n.watch(()=>t.unrefElement(a),r=>{!r||typeof SVGSVGElement>"u"||!(r instanceof SVGSVGElement)||(o.value&&y(),o.value=d.createDrauu({el:r,...i}),H(),f=[o.value.on("canceled",()=>l.trigger()),o.value.on("committed",u=>c.trigger(u)),o.value.on("start",()=>g.trigger()),o.value.on("end",()=>b.trigger()),o.value.on("changed",()=>{H(),v.trigger()})])},{flush:"post"}),h.tryOnScopeDispose(()=>y()),{drauuInstance:o,load:P,dump:U,clear:I,cancel:_,undo:w,redo:A,canUndo:E,canRedo:C,brush:p,onChanged:v.on,onCommitted:c.on,onStart:g.on,onEnd:b.on,onCanceled:l.on}}e.useDrauu=s})(this.VueUse=this.VueUse||{},VueDemi,Drauu,VueUse,VueUse);

114
node_modules/@vueuse/integrations/useDrauu.mjs generated vendored Normal file
View File

@@ -0,0 +1,114 @@
import { ref, watch } from 'vue-demi';
import { createDrauu } from 'drauu';
import { createEventHook, unrefElement } from '@vueuse/core';
import { tryOnScopeDispose } from '@vueuse/shared';
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
};
}
export { useDrauu };

60
node_modules/@vueuse/integrations/useFocusTrap.cjs generated vendored Normal file
View File

@@ -0,0 +1,60 @@
'use strict';
var core = require('@vueuse/core');
var vueDemi = require('vue-demi');
var focusTrap = require('focus-trap');
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;
}
};
vueDemi.watch(
() => core.unrefElement(target),
(el) => {
if (!el)
return;
trap = focusTrap.createFocusTrap(el, {
...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
};
}
exports.useFocusTrap = useFocusTrap;

54
node_modules/@vueuse/integrations/useFocusTrap.d.cts generated vendored Normal file
View File

@@ -0,0 +1,54 @@
import { Fn, MaybeElementRef } from '@vueuse/core';
import { Ref } from 'vue-demi';
import { Options, ActivateOptions, DeactivateOptions } from 'focus-trap';
interface UseFocusTrapOptions extends Options {
/**
* 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: MaybeElementRef, options?: UseFocusTrapOptions): UseFocusTrapReturn;
export { type UseFocusTrapOptions, type UseFocusTrapReturn, useFocusTrap };

54
node_modules/@vueuse/integrations/useFocusTrap.d.mts generated vendored Normal file
View File

@@ -0,0 +1,54 @@
import { Fn, MaybeElementRef } from '@vueuse/core';
import { Ref } from 'vue-demi';
import { Options, ActivateOptions, DeactivateOptions } from 'focus-trap';
interface UseFocusTrapOptions extends Options {
/**
* 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: MaybeElementRef, options?: UseFocusTrapOptions): UseFocusTrapReturn;
export { type UseFocusTrapOptions, type UseFocusTrapReturn, useFocusTrap };

54
node_modules/@vueuse/integrations/useFocusTrap.d.ts generated vendored Normal file
View File

@@ -0,0 +1,54 @@
import { Fn, MaybeElementRef } from '@vueuse/core';
import { Ref } from 'vue-demi';
import { Options, ActivateOptions, DeactivateOptions } from 'focus-trap';
interface UseFocusTrapOptions extends Options {
/**
* 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: MaybeElementRef, options?: UseFocusTrapOptions): UseFocusTrapReturn;
export { type UseFocusTrapOptions, type UseFocusTrapReturn, useFocusTrap };

175
node_modules/@vueuse/integrations/useFocusTrap.iife.js generated vendored Normal file
View File

@@ -0,0 +1,175 @@
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 = () => !!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 = () => !!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
})(
(this.VueDemi = this.VueDemi || (typeof VueDemi !== 'undefined' ? VueDemi : {})),
this.Vue || (typeof Vue !== 'undefined' ? Vue : undefined),
this.VueCompositionAPI || (typeof VueCompositionAPI !== 'undefined' ? VueCompositionAPI : undefined)
);
;
;(function (exports, core, vueDemi, focusTrap) {
'use strict';
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;
}
};
vueDemi.watch(
() => core.unrefElement(target),
(el) => {
if (!el)
return;
trap = focusTrap.createFocusTrap(el, {
...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
};
}
exports.useFocusTrap = useFocusTrap;
})(this.VueUse = this.VueUse || {}, VueUse, VueDemi, focusTrap);

View File

@@ -0,0 +1 @@
var VueDemi=function(n,t,f){if(n.install)return n;if(!t)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),n;if(t.version.slice(0,4)==="2.7."){let r=function(s,e){var o,l={},u={config:t.config,use:t.use.bind(t),mixin:t.mixin.bind(t),component:t.component.bind(t),provide:function(a,c){return l[a]=c,this},directive:function(a,c){return c?(t.directive(a,c),u):t.directive(a)},mount:function(a,c){return o||(o=new t(Object.assign({propsData:e},s,{provide:Object.assign(l,s.provide)})),o.$mount(a,c),o)},unmount:function(){o&&(o.$destroy(),o=void 0)}};return u};var d=r;for(var i in t)n[i]=t[i];n.isVue2=!0,n.isVue3=!1,n.install=function(){},n.Vue=t,n.Vue2=t,n.version=t.version,n.warn=t.util.warn,n.hasInjectionContext=()=>!!n.getCurrentInstance(),n.createApp=r}else if(t.version.slice(0,2)==="2.")if(f){for(var i in f)n[i]=f[i];n.isVue2=!0,n.isVue3=!1,n.install=function(){},n.Vue=t,n.Vue2=t,n.version=t.version,n.hasInjectionContext=()=>!!n.getCurrentInstance()}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(t.version.slice(0,2)==="3."){for(var i in t)n[i]=t[i];n.isVue2=!1,n.isVue3=!0,n.install=function(){},n.Vue=t,n.Vue2=void 0,n.version=t.version,n.set=function(r,s,e){return Array.isArray(r)?(r.length=Math.max(r.length,s),r.splice(s,1,e),e):(r[s]=e,e)},n.del=function(r,s){if(Array.isArray(r)){r.splice(s,1);return}delete r[s]}}else console.error("[vue-demi] Vue version "+t.version+" is unsupported.");return n}(this.VueDemi=this.VueDemi||(typeof VueDemi<"u"?VueDemi:{}),this.Vue||(typeof Vue<"u"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI<"u"?VueCompositionAPI:void 0));(function(n,t,f,i){"use strict";function d(r,s={}){let e;const{immediate:o,...l}=s,u=f.ref(!1),a=f.ref(!1),c=v=>e&&e.activate(v),p=v=>e&&e.deactivate(v),h=()=>{e&&(e.pause(),a.value=!0)},A=()=>{e&&(e.unpause(),a.value=!1)};return f.watch(()=>t.unrefElement(r),v=>{v&&(e=i.createFocusTrap(v,{...l,onActivate(){u.value=!0,s.onActivate&&s.onActivate()},onDeactivate(){u.value=!1,s.onDeactivate&&s.onDeactivate()}}),o&&c())},{flush:"post"}),t.tryOnScopeDispose(()=>p()),{hasFocus:u,isPaused:a,activate:c,deactivate:p,pause:h,unpause:A}}n.useFocusTrap=d})(this.VueUse=this.VueUse||{},VueUse,VueDemi,focusTrap);

58
node_modules/@vueuse/integrations/useFocusTrap.mjs generated vendored Normal file
View File

@@ -0,0 +1,58 @@
import { unrefElement, tryOnScopeDispose } from '@vueuse/core';
import { ref, watch } from 'vue-demi';
import { createFocusTrap } from 'focus-trap';
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;
}
};
watch(
() => unrefElement(target),
(el) => {
if (!el)
return;
trap = createFocusTrap(el, {
...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(() => deactivate());
return {
hasFocus,
isPaused,
activate,
deactivate,
pause,
unpause
};
}
export { useFocusTrap };

View File

@@ -0,0 +1,33 @@
'use strict';
var vueDemi = require('vue-demi');
var focusTrap = require('focus-trap');
var core = require('@vueuse/core');
const UseFocusTrap = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
name: "UseFocusTrap",
props: ["as", "options"],
setup(props, { slots }) {
let trap;
const target = vueDemi.ref();
const activate = () => trap && trap.activate();
const deactivate = () => trap && trap.deactivate();
vueDemi.watch(
() => core.unrefElement(target),
(el) => {
if (!el)
return;
trap = focusTrap.createFocusTrap(el, props.options || {});
activate();
},
{ flush: "post" }
);
vueDemi.onScopeDispose(() => deactivate());
return () => {
if (slots.default)
return vueDemi.h(props.as || "div", { ref: target }, slots.default());
};
}
});
exports.UseFocusTrap = UseFocusTrap;

View File

@@ -0,0 +1,17 @@
import * as vue_demi from 'vue-demi';
import { RenderableComponent } from '@vueuse/core';
import { Options } from 'focus-trap';
interface UseFocusTrapOptions extends Options {
/**
* Immediately activate the trap
*/
immediate?: boolean;
}
interface ComponentUseFocusTrapOptions extends RenderableComponent {
options?: UseFocusTrapOptions;
}
declare const UseFocusTrap: vue_demi.DefineComponent<ComponentUseFocusTrapOptions, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.VNodeProps & vue_demi.AllowedComponentProps & vue_demi.ComponentCustomProps, Readonly<ComponentUseFocusTrapOptions>, {}, {}>;
export { type ComponentUseFocusTrapOptions, UseFocusTrap };

View File

@@ -0,0 +1,17 @@
import * as vue_demi from 'vue-demi';
import { RenderableComponent } from '@vueuse/core';
import { Options } from 'focus-trap';
interface UseFocusTrapOptions extends Options {
/**
* Immediately activate the trap
*/
immediate?: boolean;
}
interface ComponentUseFocusTrapOptions extends RenderableComponent {
options?: UseFocusTrapOptions;
}
declare const UseFocusTrap: vue_demi.DefineComponent<ComponentUseFocusTrapOptions, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.VNodeProps & vue_demi.AllowedComponentProps & vue_demi.ComponentCustomProps, Readonly<ComponentUseFocusTrapOptions>, {}, {}>;
export { type ComponentUseFocusTrapOptions, UseFocusTrap };

View File

@@ -0,0 +1,17 @@
import * as vue_demi from 'vue-demi';
import { RenderableComponent } from '@vueuse/core';
import { Options } from 'focus-trap';
interface UseFocusTrapOptions extends Options {
/**
* Immediately activate the trap
*/
immediate?: boolean;
}
interface ComponentUseFocusTrapOptions extends RenderableComponent {
options?: UseFocusTrapOptions;
}
declare const UseFocusTrap: vue_demi.DefineComponent<ComponentUseFocusTrapOptions, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.VNodeProps & vue_demi.AllowedComponentProps & vue_demi.ComponentCustomProps, Readonly<ComponentUseFocusTrapOptions>, {}, {}>;
export { type ComponentUseFocusTrapOptions, UseFocusTrap };

View File

@@ -0,0 +1,31 @@
import { defineComponent, ref, watch, onScopeDispose, h } from 'vue-demi';
import { createFocusTrap } from 'focus-trap';
import { unrefElement } from '@vueuse/core';
const UseFocusTrap = /* @__PURE__ */ /* #__PURE__ */ defineComponent({
name: "UseFocusTrap",
props: ["as", "options"],
setup(props, { slots }) {
let trap;
const target = ref();
const activate = () => trap && trap.activate();
const deactivate = () => trap && trap.deactivate();
watch(
() => unrefElement(target),
(el) => {
if (!el)
return;
trap = createFocusTrap(el, props.options || {});
activate();
},
{ flush: "post" }
);
onScopeDispose(() => deactivate());
return () => {
if (slots.default)
return h(props.as || "div", { ref: target }, slots.default());
};
}
});
export { UseFocusTrap };

46
node_modules/@vueuse/integrations/useFuse.cjs generated vendored Normal file
View File

@@ -0,0 +1,46 @@
'use strict';
var Fuse = require('fuse.js');
var vueDemi = require('vue-demi');
var shared = require('@vueuse/shared');
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
};
}
exports.useFuse = useFuse;

25
node_modules/@vueuse/integrations/useFuse.d.cts generated vendored Normal file
View File

@@ -0,0 +1,25 @@
import * as vue_demi from 'vue-demi';
import { ComputedRef } from 'vue-demi';
import Fuse from 'fuse.js';
import { MaybeRefOrGetter } from '@vueuse/shared';
type FuseOptions<T> = Fuse.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_demi.Ref<{
search: <R = DataItem>(pattern: string | Fuse.Expression, options?: Fuse.FuseSearchOptions | undefined) => Fuse.FuseResult<R>[];
setCollection: (docs: readonly DataItem[], index?: Fuse.FuseIndex<DataItem> | undefined) => void;
add: (doc: DataItem) => void;
remove: (predicate: (doc: DataItem, idx: number) => boolean) => DataItem[];
removeAt: (idx: number) => void;
getIndex: () => Fuse.FuseIndex<DataItem>;
}>;
results: ComputedRef<Fuse.FuseResult<DataItem>[]>;
};
type UseFuseReturn = ReturnType<typeof useFuse>;
export { type FuseOptions, type UseFuseOptions, type UseFuseReturn, useFuse };

25
node_modules/@vueuse/integrations/useFuse.d.mts generated vendored Normal file
View File

@@ -0,0 +1,25 @@
import * as vue_demi from 'vue-demi';
import { ComputedRef } from 'vue-demi';
import Fuse from 'fuse.js';
import { MaybeRefOrGetter } from '@vueuse/shared';
type FuseOptions<T> = Fuse.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_demi.Ref<{
search: <R = DataItem>(pattern: string | Fuse.Expression, options?: Fuse.FuseSearchOptions | undefined) => Fuse.FuseResult<R>[];
setCollection: (docs: readonly DataItem[], index?: Fuse.FuseIndex<DataItem> | undefined) => void;
add: (doc: DataItem) => void;
remove: (predicate: (doc: DataItem, idx: number) => boolean) => DataItem[];
removeAt: (idx: number) => void;
getIndex: () => Fuse.FuseIndex<DataItem>;
}>;
results: ComputedRef<Fuse.FuseResult<DataItem>[]>;
};
type UseFuseReturn = ReturnType<typeof useFuse>;
export { type FuseOptions, type UseFuseOptions, type UseFuseReturn, useFuse };

25
node_modules/@vueuse/integrations/useFuse.d.ts generated vendored Normal file
View File

@@ -0,0 +1,25 @@
import * as vue_demi from 'vue-demi';
import { ComputedRef } from 'vue-demi';
import Fuse from 'fuse.js';
import { MaybeRefOrGetter } from '@vueuse/shared';
type FuseOptions<T> = Fuse.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_demi.Ref<{
search: <R = DataItem>(pattern: string | Fuse.Expression, options?: Fuse.FuseSearchOptions | undefined) => Fuse.FuseResult<R>[];
setCollection: (docs: readonly DataItem[], index?: Fuse.FuseIndex<DataItem> | undefined) => void;
add: (doc: DataItem) => void;
remove: (predicate: (doc: DataItem, idx: number) => boolean) => DataItem[];
removeAt: (idx: number) => void;
getIndex: () => Fuse.FuseIndex<DataItem>;
}>;
results: ComputedRef<Fuse.FuseResult<DataItem>[]>;
};
type UseFuseReturn = ReturnType<typeof useFuse>;
export { type FuseOptions, type UseFuseOptions, type UseFuseReturn, useFuse };

161
node_modules/@vueuse/integrations/useFuse.iife.js generated vendored Normal file
View File

@@ -0,0 +1,161 @@
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 = () => !!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 = () => !!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
})(
(this.VueDemi = this.VueDemi || (typeof VueDemi !== 'undefined' ? VueDemi : {})),
this.Vue || (typeof Vue !== 'undefined' ? Vue : undefined),
this.VueCompositionAPI || (typeof VueCompositionAPI !== 'undefined' ? VueCompositionAPI : undefined)
);
;
;(function (exports, Fuse, vueDemi, shared) {
'use strict';
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
};
}
exports.useFuse = useFuse;
})(this.VueUse = this.VueUse || {}, Fuse, VueDemi, VueUse);

View File

@@ -0,0 +1 @@
var VueDemi=function(n,t,f){if(n.install)return n;if(!t)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),n;if(t.version.slice(0,4)==="2.7."){let o=function(i,u){var l,c={},v={config:t.config,use:t.use.bind(t),mixin:t.mixin.bind(t),component:t.component.bind(t),provide:function(e,s){return c[e]=s,this},directive:function(e,s){return s?(t.directive(e,s),v):t.directive(e)},mount:function(e,s){return l||(l=new t(Object.assign({propsData:u},i,{provide:Object.assign(c,i.provide)})),l.$mount(e,s),l)},unmount:function(){l&&(l.$destroy(),l=void 0)}};return v};var a=o;for(var r in t)n[r]=t[r];n.isVue2=!0,n.isVue3=!1,n.install=function(){},n.Vue=t,n.Vue2=t,n.version=t.version,n.warn=t.util.warn,n.hasInjectionContext=()=>!!n.getCurrentInstance(),n.createApp=o}else if(t.version.slice(0,2)==="2.")if(f){for(var r in f)n[r]=f[r];n.isVue2=!0,n.isVue3=!1,n.install=function(){},n.Vue=t,n.Vue2=t,n.version=t.version,n.hasInjectionContext=()=>!!n.getCurrentInstance()}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(t.version.slice(0,2)==="3."){for(var r in t)n[r]=t[r];n.isVue2=!1,n.isVue3=!0,n.install=function(){},n.Vue=t,n.Vue2=void 0,n.version=t.version,n.set=function(o,i,u){return Array.isArray(o)?(o.length=Math.max(o.length,i),o.splice(i,1,u),u):(o[i]=u,u)},n.del=function(o,i){if(Array.isArray(o)){o.splice(i,1);return}delete o[i]}}else console.error("[vue-demi] Vue version "+t.version+" is unsupported.");return n}(this.VueDemi=this.VueDemi||(typeof VueDemi<"u"?VueDemi:{}),this.Vue||(typeof Vue<"u"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI<"u"?VueCompositionAPI:void 0));(function(n,t,f,r){"use strict";function a(o,i,u){const l=()=>{var e,s;return new t((e=r.toValue(i))!=null?e:[],(s=r.toValue(u))==null?void 0:s.fuseOptions)},c=f.ref(l());f.watch(()=>{var e;return(e=r.toValue(u))==null?void 0:e.fuseOptions},()=>{c.value=l()},{deep:!0}),f.watch(()=>r.toValue(i),e=>{c.value.setCollection(e)},{deep:!0});const v=f.computed(()=>{const e=r.toValue(u);if(e?.matchAllWhenSearchEmpty&&!r.toValue(o))return r.toValue(i).map((d,p)=>({item:d,refIndex:p}));const s=e?.resultLimit;return c.value.search(r.toValue(o),s?{limit:s}:void 0)});return{fuse:c,results:v}}n.useFuse=a})(this.VueUse=this.VueUse||{},Fuse,VueDemi,VueUse);

44
node_modules/@vueuse/integrations/useFuse.mjs generated vendored Normal file
View File

@@ -0,0 +1,44 @@
import Fuse from 'fuse.js';
import { ref, watch, computed } from 'vue-demi';
import { toValue } from '@vueuse/shared';
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
};
}
export { useFuse };

69
node_modules/@vueuse/integrations/useIDBKeyval.cjs generated vendored Normal file
View File

@@ -0,0 +1,69 @@
'use strict';
var shared = require('@vueuse/shared');
var core = require('@vueuse/core');
var vueDemi = require('vue-demi');
var idbKeyval = require('idb-keyval');
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 {
if (Array.isArray(data.value))
await idbKeyval.update(key, () => JSON.parse(JSON.stringify(data.value)));
else if (typeof data.value === "object")
await idbKeyval.update(key, () => ({ ...data.value }));
else
await idbKeyval.update(key, () => 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
};
}
exports.useIDBKeyval = useIDBKeyval;

43
node_modules/@vueuse/integrations/useIDBKeyval.d.cts generated vendored Normal file
View File

@@ -0,0 +1,43 @@
import { ConfigurableFlush, RemovableRef, MaybeRefOrGetter } from '@vueuse/shared';
import { Ref } from 'vue-demi';
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>;
export { type UseIDBKeyvalReturn, type UseIDBOptions, useIDBKeyval };

43
node_modules/@vueuse/integrations/useIDBKeyval.d.mts generated vendored Normal file
View File

@@ -0,0 +1,43 @@
import { ConfigurableFlush, RemovableRef, MaybeRefOrGetter } from '@vueuse/shared';
import { Ref } from 'vue-demi';
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>;
export { type UseIDBKeyvalReturn, type UseIDBOptions, useIDBKeyval };

43
node_modules/@vueuse/integrations/useIDBKeyval.d.ts generated vendored Normal file
View File

@@ -0,0 +1,43 @@
import { ConfigurableFlush, RemovableRef, MaybeRefOrGetter } from '@vueuse/shared';
import { Ref } from 'vue-demi';
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>;
export { type UseIDBKeyvalReturn, type UseIDBOptions, useIDBKeyval };

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