mirror of
https://github.com/mivodev/mivodev.github.io.git
synced 2026-01-26 13:32:07 +07:00
Fix dependencies: Add flag-icons, tailwind directives, and postcss config
This commit is contained in:
21
node_modules/@vueuse/integrations/LICENSE
generated
vendored
Normal file
21
node_modules/@vueuse/integrations/LICENSE
generated
vendored
Normal 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
46
node_modules/@vueuse/integrations/README.md
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
# @vueuse/integrations
|
||||
|
||||
[](https://www.npmjs.com/package/@vueuse/integrations)
|
||||
|
||||
> This is an add-on of [VueUse](https://github.com/vueuse/vueuse), providing integration wrappers for utility libraries.
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
npm i @vueuse/integrations
|
||||
```
|
||||
|
||||
## Functions
|
||||
|
||||
<!--GENERATED LIST, DO NOT MODIFY MANUALLY-->
|
||||
<!--FUNCTIONS_LIST_STARTS-->
|
||||
|
||||
- [`useAsyncValidator`](https://vueuse.org/integrations/useAsyncValidator/) — wrapper for [`async-validator`](https://github.com/yiminghe/async-validator)
|
||||
- [`useAxios`](https://vueuse.org/integrations/useAxios/) — wrapper for [`axios`](https://github.com/axios/axios)
|
||||
- [`useChangeCase`](https://vueuse.org/integrations/useChangeCase/) — reactive wrapper for [`change-case`](https://github.com/blakeembrey/change-case)
|
||||
- [`useCookies`](https://vueuse.org/integrations/useCookies/) — wrapper for [`universal-cookie`](https://www.npmjs.com/package/universal-cookie)
|
||||
- [`useDrauu`](https://vueuse.org/integrations/useDrauu/) — reactive instance for [drauu](https://github.com/antfu/drauu)
|
||||
- [`useFocusTrap`](https://vueuse.org/integrations/useFocusTrap/) — reactive wrapper for [`focus-trap`](https://github.com/focus-trap/focus-trap)
|
||||
- [`useFuse`](https://vueuse.org/integrations/useFuse/) — easily implement fuzzy search using a composable with [Fuse.js](https://github.com/krisk/fuse)
|
||||
- [`useIDBKeyval`](https://vueuse.org/integrations/useIDBKeyval/) — wrapper for [`idb-keyval`](https://www.npmjs.com/package/idb-keyval)
|
||||
- [`useJwt`](https://vueuse.org/integrations/useJwt/) — wrapper for [`jwt-decode`](https://github.com/auth0/jwt-decode)
|
||||
- [`useNProgress`](https://vueuse.org/integrations/useNProgress/) — reactive wrapper for [`nprogress`](https://github.com/rstacruz/nprogress)
|
||||
- [`useQRCode`](https://vueuse.org/integrations/useQRCode/) — wrapper for [`qrcode`](https://github.com/soldair/node-qrcode)
|
||||
- [`useSortable`](https://vueuse.org/integrations/useSortable/) — wrapper for [`sortable`](https://github.com/SortableJS/Sortable)
|
||||
|
||||
<!--FUNCTIONS_LIST_ENDS-->
|
||||
|
||||
## Tree-shaking
|
||||
|
||||
For better tree-shaking result, import functions from submodules, for example:
|
||||
|
||||
```ts
|
||||
// Don't
|
||||
import { useAxios } from '@vueuse/integrations'
|
||||
|
||||
import { useAxios } from '@vueuse/integrations/useAxios'
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT License](https://github.com/vueuse/vueuse/blob/master/LICENSE) © 2019-PRESENT [Anthony Fu](https://github.com/antfu)
|
||||
703
node_modules/@vueuse/integrations/index.cjs
generated
vendored
Normal file
703
node_modules/@vueuse/integrations/index.cjs
generated
vendored
Normal file
@@ -0,0 +1,703 @@
|
||||
'use strict';
|
||||
|
||||
var shared = require('@vueuse/shared');
|
||||
var Schema = require('async-validator');
|
||||
var vue = require('vue');
|
||||
var axios = require('axios');
|
||||
var changeCase = require('change-case');
|
||||
var Cookie = require('universal-cookie');
|
||||
var core = require('@vueuse/core');
|
||||
var drauu = require('drauu');
|
||||
var focusTrap = require('focus-trap');
|
||||
var Fuse = require('fuse.js');
|
||||
var idbKeyval = require('idb-keyval');
|
||||
var jwtDecode = require('jwt-decode');
|
||||
var nprogress = require('nprogress');
|
||||
var QRCode = require('qrcode');
|
||||
var Sortable = require('sortablejs');
|
||||
|
||||
function _interopNamespaceDefault(e) {
|
||||
var n = Object.create(null);
|
||||
if (e) {
|
||||
Object.keys(e).forEach(function (k) {
|
||||
if (k !== 'default') {
|
||||
var d = Object.getOwnPropertyDescriptor(e, k);
|
||||
Object.defineProperty(n, k, d.get ? d : {
|
||||
enumerable: true,
|
||||
get: function () { return e[k]; }
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
n.default = e;
|
||||
return Object.freeze(n);
|
||||
}
|
||||
|
||||
var changeCase__namespace = /*#__PURE__*/_interopNamespaceDefault(changeCase);
|
||||
|
||||
const AsyncValidatorSchema = Schema.default || Schema;
|
||||
function useAsyncValidator(value, rules, options = {}) {
|
||||
const {
|
||||
validateOption = {},
|
||||
immediate = true,
|
||||
manual = false
|
||||
} = options;
|
||||
const valueRef = shared.toRef(value);
|
||||
const errorInfo = vue.shallowRef(null);
|
||||
const isFinished = vue.shallowRef(true);
|
||||
const pass = vue.shallowRef(!immediate || manual);
|
||||
const errors = vue.computed(() => {
|
||||
var _a;
|
||||
return ((_a = errorInfo.value) == null ? void 0 : _a.errors) || [];
|
||||
});
|
||||
const errorFields = vue.computed(() => {
|
||||
var _a;
|
||||
return ((_a = errorInfo.value) == null ? void 0 : _a.fields) || {};
|
||||
});
|
||||
const validator = vue.computed(() => new AsyncValidatorSchema(vue.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) {
|
||||
vue.watch(
|
||||
[valueRef, validator],
|
||||
() => execute(),
|
||||
{ immediate, deep: true }
|
||||
);
|
||||
}
|
||||
const shell = {
|
||||
isFinished,
|
||||
pass,
|
||||
errors,
|
||||
errorInfo,
|
||||
errorFields,
|
||||
execute
|
||||
};
|
||||
function waitUntilFinished() {
|
||||
return new Promise((resolve, reject) => {
|
||||
shared.until(isFinished).toBe(true).then(() => resolve(shell)).catch((error) => reject(error));
|
||||
});
|
||||
}
|
||||
return {
|
||||
...shell,
|
||||
then(onFulfilled, onRejected) {
|
||||
return waitUntilFinished().then(onFulfilled, onRejected);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function useAxios(...args) {
|
||||
const url = typeof args[0] === "string" ? args[0] : void 0;
|
||||
const argsPlaceholder = typeof url === "string" ? 1 : 0;
|
||||
const defaultOptions = {
|
||||
immediate: !!argsPlaceholder,
|
||||
shallow: true,
|
||||
abortPrevious: true
|
||||
};
|
||||
let defaultConfig = {};
|
||||
let instance = axios;
|
||||
let options = defaultOptions;
|
||||
const isAxiosInstance = (val) => !!(val == null ? void 0 : val.request);
|
||||
if (args.length > 0 + argsPlaceholder) {
|
||||
if (isAxiosInstance(args[0 + argsPlaceholder]))
|
||||
instance = args[0 + argsPlaceholder];
|
||||
else
|
||||
defaultConfig = args[0 + argsPlaceholder];
|
||||
}
|
||||
if (args.length > 1 + argsPlaceholder) {
|
||||
if (isAxiosInstance(args[1 + argsPlaceholder]))
|
||||
instance = args[1 + argsPlaceholder];
|
||||
}
|
||||
if (args.length === 2 + argsPlaceholder && !isAxiosInstance(args[1 + argsPlaceholder]) || args.length === 3 + argsPlaceholder) {
|
||||
options = args[args.length - 1] || defaultOptions;
|
||||
}
|
||||
const {
|
||||
shallow,
|
||||
onSuccess = shared.noop,
|
||||
onError = shared.noop,
|
||||
immediate,
|
||||
resetOnExecute = false
|
||||
} = options;
|
||||
const initialData = options.initialData;
|
||||
const response = vue.shallowRef();
|
||||
const data = (shallow ? vue.shallowRef : vue.ref)(initialData);
|
||||
const isFinished = vue.shallowRef(false);
|
||||
const isLoading = vue.shallowRef(false);
|
||||
const isAborted = vue.shallowRef(false);
|
||||
const error = vue.shallowRef();
|
||||
let abortController = new AbortController();
|
||||
const abort = (message) => {
|
||||
if (isFinished.value || !isLoading.value)
|
||||
return;
|
||||
abortController.abort(message);
|
||||
abortController = new AbortController();
|
||||
isAborted.value = true;
|
||||
isLoading.value = false;
|
||||
isFinished.value = false;
|
||||
};
|
||||
const loading = (loading2) => {
|
||||
isLoading.value = loading2;
|
||||
isFinished.value = !loading2;
|
||||
};
|
||||
const resetData = () => {
|
||||
if (resetOnExecute)
|
||||
data.value = initialData;
|
||||
};
|
||||
const waitUntilFinished = () => new Promise((resolve, reject) => {
|
||||
shared.until(isFinished).toBe(true).then(() => error.value ? reject(error.value) : resolve(result));
|
||||
});
|
||||
const promise = {
|
||||
then: (...args2) => waitUntilFinished().then(...args2),
|
||||
catch: (...args2) => waitUntilFinished().catch(...args2)
|
||||
};
|
||||
let executeCounter = 0;
|
||||
const execute = (executeUrl = url, config = {}) => {
|
||||
error.value = void 0;
|
||||
const _url = typeof executeUrl === "string" ? executeUrl : url != null ? url : config.url;
|
||||
if (_url === void 0) {
|
||||
error.value = new axios.AxiosError(axios.AxiosError.ERR_INVALID_URL);
|
||||
isFinished.value = true;
|
||||
return promise;
|
||||
}
|
||||
resetData();
|
||||
if (options.abortPrevious !== false)
|
||||
abort();
|
||||
loading(true);
|
||||
executeCounter += 1;
|
||||
const currentExecuteCounter = executeCounter;
|
||||
isAborted.value = false;
|
||||
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, signal: abortController.signal }).then((r) => {
|
||||
if (isAborted.value)
|
||||
return;
|
||||
response.value = r;
|
||||
const result2 = r.data;
|
||||
data.value = result2;
|
||||
onSuccess(result2);
|
||||
}).catch((e) => {
|
||||
error.value = e;
|
||||
onError(e);
|
||||
}).finally(() => {
|
||||
var _a;
|
||||
(_a = options.onFinish) == null ? void 0 : _a.call(options);
|
||||
if (currentExecuteCounter === executeCounter)
|
||||
loading(false);
|
||||
});
|
||||
return promise;
|
||||
};
|
||||
if (immediate && url)
|
||||
execute();
|
||||
const result = {
|
||||
response,
|
||||
data,
|
||||
error,
|
||||
isFinished,
|
||||
isLoading,
|
||||
cancel: abort,
|
||||
isAborted,
|
||||
isCanceled: isAborted,
|
||||
abort,
|
||||
execute
|
||||
};
|
||||
return {
|
||||
...result,
|
||||
...promise
|
||||
};
|
||||
}
|
||||
|
||||
const changeCaseTransforms = /* @__PURE__ */ Object.entries(changeCase__namespace).filter(([name, fn]) => typeof fn === "function" && name.endsWith("Case")).reduce((acc, [name, fn]) => {
|
||||
acc[name] = fn;
|
||||
return acc;
|
||||
}, {});
|
||||
function useChangeCase(input, type, options) {
|
||||
const typeRef = vue.computed(() => {
|
||||
const t = vue.toValue(type);
|
||||
if (!changeCaseTransforms[t])
|
||||
throw new Error(`Invalid change case type "${t}"`);
|
||||
return t;
|
||||
});
|
||||
if (typeof input === "function")
|
||||
return vue.computed(() => changeCaseTransforms[typeRef.value](vue.toValue(input), vue.toValue(options)));
|
||||
const text = vue.ref(input);
|
||||
return vue.computed({
|
||||
get() {
|
||||
return changeCaseTransforms[typeRef.value](text.value, vue.toValue(options));
|
||||
},
|
||||
set(value) {
|
||||
text.value = value;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function createCookies(req) {
|
||||
const universalCookie = new Cookie(req ? req.headers.cookie : null);
|
||||
return (dependencies, { doNotParse = false, autoUpdateDependencies = false } = {}) => useCookies(dependencies, { doNotParse, autoUpdateDependencies }, universalCookie);
|
||||
}
|
||||
function useCookies(dependencies, { doNotParse = false, autoUpdateDependencies = false } = {}, cookies = new Cookie()) {
|
||||
const watchingDependencies = autoUpdateDependencies ? [...dependencies || []] : dependencies;
|
||||
let previousCookies = cookies.getAll({ doNotParse: true });
|
||||
const touches = vue.shallowRef(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 = vue.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 = vue.shallowRef(false);
|
||||
const canRedo = vue.shallowRef(false);
|
||||
const altPressed = vue.shallowRef(false);
|
||||
const shiftPressed = vue.shallowRef(false);
|
||||
const brush = vue.ref({
|
||||
color: "black",
|
||||
size: 3,
|
||||
arrowEnd: false,
|
||||
cornerRadius: 0,
|
||||
dasharray: void 0,
|
||||
fill: "transparent",
|
||||
mode: "draw",
|
||||
...options == null ? void 0 : options.brush
|
||||
});
|
||||
vue.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;
|
||||
}
|
||||
};
|
||||
vue.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 = vue.shallowRef(false);
|
||||
const isPaused = vue.shallowRef(false);
|
||||
const activate = (opts) => trap && trap.activate(opts);
|
||||
const deactivate = (opts) => trap && trap.deactivate(opts);
|
||||
const pause = () => {
|
||||
if (trap) {
|
||||
trap.pause();
|
||||
isPaused.value = true;
|
||||
}
|
||||
};
|
||||
const unpause = () => {
|
||||
if (trap) {
|
||||
trap.unpause();
|
||||
isPaused.value = false;
|
||||
}
|
||||
};
|
||||
const targets = vue.computed(() => {
|
||||
const _targets = vue.toValue(target);
|
||||
return core.toArray(_targets).map((el) => {
|
||||
const _el = vue.toValue(el);
|
||||
return typeof _el === "string" ? _el : core.unrefElement(_el);
|
||||
}).filter(shared.notNullish);
|
||||
});
|
||||
vue.watch(
|
||||
targets,
|
||||
(els) => {
|
||||
if (!els.length)
|
||||
return;
|
||||
trap = focusTrap.createFocusTrap(els, {
|
||||
...focusTrapOptions,
|
||||
onActivate() {
|
||||
hasFocus.value = true;
|
||||
if (options.onActivate)
|
||||
options.onActivate();
|
||||
},
|
||||
onDeactivate() {
|
||||
hasFocus.value = false;
|
||||
if (options.onDeactivate)
|
||||
options.onDeactivate();
|
||||
}
|
||||
});
|
||||
if (immediate)
|
||||
activate();
|
||||
},
|
||||
{ flush: "post" }
|
||||
);
|
||||
core.tryOnScopeDispose(() => deactivate());
|
||||
return {
|
||||
hasFocus,
|
||||
isPaused,
|
||||
activate,
|
||||
deactivate,
|
||||
pause,
|
||||
unpause
|
||||
};
|
||||
}
|
||||
|
||||
function useFuse(search, data, options) {
|
||||
const createFuse = () => {
|
||||
var _a, _b;
|
||||
return new Fuse(
|
||||
(_a = vue.toValue(data)) != null ? _a : [],
|
||||
(_b = vue.toValue(options)) == null ? void 0 : _b.fuseOptions
|
||||
);
|
||||
};
|
||||
const fuse = vue.ref(createFuse());
|
||||
vue.watch(
|
||||
() => {
|
||||
var _a;
|
||||
return (_a = vue.toValue(options)) == null ? void 0 : _a.fuseOptions;
|
||||
},
|
||||
() => {
|
||||
fuse.value = createFuse();
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
vue.watch(
|
||||
() => vue.toValue(data),
|
||||
(newData) => {
|
||||
fuse.value.setCollection(newData);
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
const results = vue.computed(() => {
|
||||
const resolved = vue.toValue(options);
|
||||
if ((resolved == null ? void 0 : resolved.matchAllWhenSearchEmpty) && !vue.toValue(search))
|
||||
return vue.toValue(data).map((item, index) => ({ item, refIndex: index }));
|
||||
const limit = resolved == null ? void 0 : resolved.resultLimit;
|
||||
return fuse.value.search(vue.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 = vue.shallowRef(false);
|
||||
const data = (shallow ? vue.shallowRef : vue.ref)(initialValue);
|
||||
const rawInit = vue.toValue(initialValue);
|
||||
async function read() {
|
||||
try {
|
||||
const rawValue = await idbKeyval.get(key);
|
||||
if (rawValue === void 0) {
|
||||
if (rawInit !== void 0 && rawInit !== null && writeDefaults)
|
||||
await idbKeyval.set(key, rawInit);
|
||||
} else {
|
||||
data.value = rawValue;
|
||||
}
|
||||
} catch (e) {
|
||||
onError(e);
|
||||
}
|
||||
isFinished.value = true;
|
||||
}
|
||||
read();
|
||||
async function write() {
|
||||
try {
|
||||
if (data.value == null) {
|
||||
await idbKeyval.del(key);
|
||||
} else {
|
||||
await idbKeyval.update(key, () => vue.toRaw(data.value));
|
||||
}
|
||||
} catch (e) {
|
||||
onError(e);
|
||||
}
|
||||
}
|
||||
const {
|
||||
pause: pauseWatch,
|
||||
resume: resumeWatch
|
||||
} = core.watchPausable(data, () => write(), { flush, deep });
|
||||
async function setData(value) {
|
||||
pauseWatch();
|
||||
data.value = value;
|
||||
await write();
|
||||
resumeWatch();
|
||||
}
|
||||
return {
|
||||
set: setData,
|
||||
isFinished,
|
||||
data
|
||||
};
|
||||
}
|
||||
|
||||
function useJwt(encodedJwt, options = {}) {
|
||||
const {
|
||||
onError,
|
||||
fallbackValue = null
|
||||
} = options;
|
||||
const decodeWithFallback = (encodedJwt2, options2) => {
|
||||
try {
|
||||
return jwtDecode.jwtDecode(encodedJwt2, options2);
|
||||
} catch (err) {
|
||||
onError == null ? void 0 : onError(err);
|
||||
return fallbackValue;
|
||||
}
|
||||
};
|
||||
const header = vue.computed(() => decodeWithFallback(vue.toValue(encodedJwt), { header: true }));
|
||||
const payload = vue.computed(() => decodeWithFallback(vue.toValue(encodedJwt)));
|
||||
return {
|
||||
header,
|
||||
payload
|
||||
};
|
||||
}
|
||||
|
||||
function useNProgress(currentProgress = null, options) {
|
||||
const progress = shared.toRef(currentProgress);
|
||||
const isLoading = vue.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);
|
||||
};
|
||||
vue.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 = vue.shallowRef("");
|
||||
vue.watch(
|
||||
src,
|
||||
async (value) => {
|
||||
if (src.value && shared.isClient)
|
||||
result.value = await QRCode.toDataURL(value, options);
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
function useSortable(el, list, options = {}) {
|
||||
let sortable;
|
||||
const { document = core.defaultDocument, ...resetOptions } = options;
|
||||
const defaultOptions = {
|
||||
onUpdate: (e) => {
|
||||
moveArrayElement(list, e.oldIndex, e.newIndex, e);
|
||||
}
|
||||
};
|
||||
const start = () => {
|
||||
const target = typeof el === "string" ? document == null ? void 0 : document.querySelector(el) : core.unrefElement(el);
|
||||
if (!target || sortable !== void 0)
|
||||
return;
|
||||
sortable = new Sortable(target, { ...defaultOptions, ...resetOptions });
|
||||
};
|
||||
const stop = () => {
|
||||
sortable == null ? void 0 : sortable.destroy();
|
||||
sortable = void 0;
|
||||
};
|
||||
const option = (name, value) => {
|
||||
if (value !== void 0)
|
||||
sortable == null ? void 0 : sortable.option(name, value);
|
||||
else
|
||||
return sortable == null ? void 0 : sortable.option(name);
|
||||
};
|
||||
core.tryOnMounted(start);
|
||||
core.tryOnScopeDispose(stop);
|
||||
return {
|
||||
stop,
|
||||
start,
|
||||
option
|
||||
};
|
||||
}
|
||||
function insertNodeAt(parentElement, element, index) {
|
||||
const refElement = parentElement.children[index];
|
||||
parentElement.insertBefore(element, refElement);
|
||||
}
|
||||
function removeNode(node) {
|
||||
if (node.parentNode)
|
||||
node.parentNode.removeChild(node);
|
||||
}
|
||||
function moveArrayElement(list, from, to, e = null) {
|
||||
if (e != null) {
|
||||
removeNode(e.item);
|
||||
insertNodeAt(e.from, e.item, from);
|
||||
}
|
||||
const _valueIsRef = vue.isRef(list);
|
||||
const array = _valueIsRef ? [...vue.toValue(list)] : vue.toValue(list);
|
||||
if (to >= 0 && to < array.length) {
|
||||
const element = array.splice(from, 1)[0];
|
||||
vue.nextTick(() => {
|
||||
array.splice(to, 0, element);
|
||||
if (_valueIsRef)
|
||||
list.value = array;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
exports.createCookies = createCookies;
|
||||
exports.insertNodeAt = insertNodeAt;
|
||||
exports.moveArrayElement = moveArrayElement;
|
||||
exports.removeNode = removeNode;
|
||||
exports.useAsyncValidator = useAsyncValidator;
|
||||
exports.useAxios = useAxios;
|
||||
exports.useChangeCase = useChangeCase;
|
||||
exports.useCookies = useCookies;
|
||||
exports.useDrauu = useDrauu;
|
||||
exports.useFocusTrap = useFocusTrap;
|
||||
exports.useFuse = useFuse;
|
||||
exports.useIDBKeyval = useIDBKeyval;
|
||||
exports.useJwt = useJwt;
|
||||
exports.useNProgress = useNProgress;
|
||||
exports.useQRCode = useQRCode;
|
||||
exports.useSortable = useSortable;
|
||||
447
node_modules/@vueuse/integrations/index.d.cts
generated
vendored
Normal file
447
node_modules/@vueuse/integrations/index.d.cts
generated
vendored
Normal file
@@ -0,0 +1,447 @@
|
||||
import { ValidateError, ValidateOption, Rules } from 'async-validator';
|
||||
import * as vue from 'vue';
|
||||
import { ShallowRef, ComputedRef, MaybeRefOrGetter, Ref, MaybeRef, WritableComputedRef } from 'vue';
|
||||
import { AxiosResponse, AxiosRequestConfig, AxiosInstance } from 'axios';
|
||||
import * as changeCase from 'change-case';
|
||||
import { Options } from 'change-case';
|
||||
import * as universal_cookie from 'universal-cookie';
|
||||
import universal_cookie__default from 'universal-cookie';
|
||||
import { IncomingMessage } from 'node:http';
|
||||
import { EventHookOn, MaybeComputedElementRef, Fn, Arrayable, ConfigurableDocument } from '@vueuse/core';
|
||||
import { Options as Options$1, Drauu, Brush } from 'drauu';
|
||||
import { Options as Options$2, ActivateOptions, DeactivateOptions } from 'focus-trap';
|
||||
import * as fuse_js from 'fuse.js';
|
||||
import fuse_js__default, { IFuseOptions, FuseResult } from 'fuse.js';
|
||||
import { ConfigurableFlush, RemovableRef } from '@vueuse/shared';
|
||||
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: ShallowRef<boolean>;
|
||||
isFinished: ShallowRef<boolean>;
|
||||
errors: ComputedRef<AsyncValidatorError['errors'] | undefined>;
|
||||
errorInfo: ShallowRef<AsyncValidatorError | null>;
|
||||
errorFields: ComputedRef<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, O extends UseAxiosOptions = UseAxiosOptions<T>> {
|
||||
/**
|
||||
* Axios Response
|
||||
*/
|
||||
response: ShallowRef<R | undefined>;
|
||||
/**
|
||||
* Axios response data
|
||||
*/
|
||||
data: O extends UseAxiosOptionsWithInitialData<T> ? Ref<T> : 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, O extends UseAxiosOptions = UseAxiosOptions<T>> extends UseAxiosReturn<T, R, D, O> {
|
||||
/**
|
||||
* Manually call the axios request
|
||||
*/
|
||||
execute: (url?: string | AxiosRequestConfig<D>, config?: AxiosRequestConfig<D>) => Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
}
|
||||
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 UseAxiosOptionsBase<T = any> {
|
||||
/**
|
||||
* Will automatically run axios request when `useAxios` is used
|
||||
*
|
||||
*/
|
||||
immediate?: boolean;
|
||||
/**
|
||||
* Use shallowRef.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
shallow?: boolean;
|
||||
/**
|
||||
* Abort previous request when a new request is made.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
abortPrevious?: boolean;
|
||||
/**
|
||||
* Callback when error is caught.
|
||||
*/
|
||||
onError?: (e: unknown) => void;
|
||||
/**
|
||||
* Callback when success is caught.
|
||||
*/
|
||||
onSuccess?: (data: T) => void;
|
||||
/**
|
||||
* Sets the state to initialState before executing the promise.
|
||||
*/
|
||||
resetOnExecute?: boolean;
|
||||
/**
|
||||
* Callback when request is finished.
|
||||
*/
|
||||
onFinish?: () => void;
|
||||
}
|
||||
interface UseAxiosOptionsWithInitialData<T> extends UseAxiosOptionsBase<T> {
|
||||
/**
|
||||
* Initial data
|
||||
*/
|
||||
initialData: T;
|
||||
}
|
||||
type UseAxiosOptions<T = any> = UseAxiosOptionsBase<T> | UseAxiosOptionsWithInitialData<T>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsWithInitialData<T> = UseAxiosOptionsWithInitialData<T>>(url: string, config?: AxiosRequestConfig<D>, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsWithInitialData<T> = UseAxiosOptionsWithInitialData<T>>(url: string, instance?: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsWithInitialData<T> = UseAxiosOptionsWithInitialData<T>>(url: string, config: AxiosRequestConfig<D>, instance: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsBase<T> = UseAxiosOptionsBase<T>>(url: string, config?: AxiosRequestConfig<D>, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsBase<T> = UseAxiosOptionsBase<T>>(url: string, instance?: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsBase<T> = UseAxiosOptionsBase<T>>(url: string, config: AxiosRequestConfig<D>, instance: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: AxiosRequestConfig<D>): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: AxiosRequestConfig<D>, instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
|
||||
|
||||
type EndsWithCase<T> = T extends `${infer _}Case` ? T : never;
|
||||
type FilterKeys<T> = {
|
||||
[K in keyof T as K extends string ? K : never]: EndsWithCase<K>;
|
||||
};
|
||||
type ChangeCaseKeys = FilterKeys<typeof changeCase>;
|
||||
type ChangeCaseType = ChangeCaseKeys[keyof ChangeCaseKeys];
|
||||
declare function useChangeCase(input: MaybeRef<string>, type: MaybeRefOrGetter<ChangeCaseType>, options?: MaybeRefOrGetter<Options> | undefined): WritableComputedRef<string>;
|
||||
declare function useChangeCase(input: MaybeRefOrGetter<string>, type: MaybeRefOrGetter<ChangeCaseType>, options?: MaybeRefOrGetter<Options> | undefined): ComputedRef<string>;
|
||||
|
||||
/**
|
||||
* Creates a new {@link useCookies} function
|
||||
* @param req - incoming http request (for SSR)
|
||||
* @see https://github.com/reactivestack/cookies/tree/master/packages/universal-cookie universal-cookie
|
||||
* @description Creates universal-cookie instance using request (default is window.document.cookie) and returns {@link useCookies} function with provided universal-cookie instance
|
||||
*/
|
||||
declare function createCookies(req?: IncomingMessage): (dependencies?: string[] | null, { doNotParse, autoUpdateDependencies }?: {
|
||||
doNotParse?: boolean | undefined;
|
||||
autoUpdateDependencies?: boolean | undefined;
|
||||
}) => {
|
||||
/**
|
||||
* Reactive get cookie by name. If **autoUpdateDependencies = true** then it will update watching dependencies
|
||||
*/
|
||||
get: <T = any>(name: string, options?: universal_cookie.CookieGetOptions | undefined) => T;
|
||||
/**
|
||||
* Reactive get all cookies
|
||||
*/
|
||||
getAll: <T = any>(options?: universal_cookie.CookieGetOptions | undefined) => T;
|
||||
set: (name: string, value: any, options?: universal_cookie.CookieSetOptions | undefined) => void;
|
||||
remove: (name: string, options?: universal_cookie.CookieSetOptions | undefined) => void;
|
||||
addChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
|
||||
removeChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
|
||||
};
|
||||
/**
|
||||
* Reactive methods to work with cookies (use {@link createCookies} method instead if you are using SSR)
|
||||
* @param dependencies - array of watching cookie's names. Pass empty array if don't want to watch cookies changes.
|
||||
* @param options
|
||||
* @param options.doNotParse - don't try parse value as JSON
|
||||
* @param options.autoUpdateDependencies - automatically update watching dependencies
|
||||
* @param cookies - universal-cookie instance
|
||||
*/
|
||||
declare function useCookies(dependencies?: string[] | null, { doNotParse, autoUpdateDependencies }?: {
|
||||
doNotParse?: boolean | undefined;
|
||||
autoUpdateDependencies?: boolean | undefined;
|
||||
}, cookies?: universal_cookie__default): {
|
||||
/**
|
||||
* Reactive get cookie by name. If **autoUpdateDependencies = true** then it will update watching dependencies
|
||||
*/
|
||||
get: <T = any>(name: string, options?: universal_cookie.CookieGetOptions | undefined) => T;
|
||||
/**
|
||||
* Reactive get all cookies
|
||||
*/
|
||||
getAll: <T = any>(options?: universal_cookie.CookieGetOptions | undefined) => T;
|
||||
set: (name: string, value: any, options?: universal_cookie.CookieSetOptions | undefined) => void;
|
||||
remove: (name: string, options?: universal_cookie.CookieSetOptions | undefined) => void;
|
||||
addChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
|
||||
removeChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
|
||||
};
|
||||
|
||||
type UseDrauuOptions = Omit<Options$1, 'el'>;
|
||||
interface UseDrauuReturn {
|
||||
drauuInstance: Ref<Drauu | undefined>;
|
||||
load: (svg: string) => void;
|
||||
dump: () => string | undefined;
|
||||
clear: () => void;
|
||||
cancel: () => void;
|
||||
undo: () => boolean | undefined;
|
||||
redo: () => boolean | undefined;
|
||||
canUndo: ShallowRef<boolean>;
|
||||
canRedo: ShallowRef<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: ShallowRef<boolean>;
|
||||
/**
|
||||
* Indicates if the focus trap is currently paused
|
||||
*/
|
||||
isPaused: ShallowRef<boolean>;
|
||||
/**
|
||||
* Activate the focus trap
|
||||
*
|
||||
* @see https://github.com/focus-trap/focus-trap#trapactivateactivateoptions
|
||||
* @param opts Activate focus trap options
|
||||
*/
|
||||
activate: (opts?: ActivateOptions) => void;
|
||||
/**
|
||||
* Deactivate the focus trap
|
||||
*
|
||||
* @see https://github.com/focus-trap/focus-trap#trapdeactivatedeactivateoptions
|
||||
* @param opts Deactivate focus trap options
|
||||
*/
|
||||
deactivate: (opts?: DeactivateOptions) => void;
|
||||
/**
|
||||
* Pause the focus trap
|
||||
*
|
||||
* @see https://github.com/focus-trap/focus-trap#trappause
|
||||
*/
|
||||
pause: Fn;
|
||||
/**
|
||||
* Unpauses the focus trap
|
||||
*
|
||||
* @see https://github.com/focus-trap/focus-trap#trapunpause
|
||||
*/
|
||||
unpause: Fn;
|
||||
}
|
||||
/**
|
||||
* Reactive focus-trap
|
||||
*
|
||||
* @see https://vueuse.org/useFocusTrap
|
||||
*/
|
||||
declare function useFocusTrap(target: Arrayable<MaybeRefOrGetter<string> | MaybeComputedElementRef>, options?: UseFocusTrapOptions): UseFocusTrapReturn;
|
||||
|
||||
type FuseOptions<T> = IFuseOptions<T>;
|
||||
interface UseFuseOptions<T> {
|
||||
fuseOptions?: FuseOptions<T>;
|
||||
resultLimit?: number;
|
||||
matchAllWhenSearchEmpty?: boolean;
|
||||
}
|
||||
declare function useFuse<DataItem>(search: MaybeRefOrGetter<string>, data: MaybeRefOrGetter<DataItem[]>, options?: MaybeRefOrGetter<UseFuseOptions<DataItem>>): {
|
||||
fuse: vue.Ref<{
|
||||
search: <R = DataItem>(pattern: string | fuse_js.Expression, options?: fuse_js.FuseSearchOptions) => FuseResult<R>[];
|
||||
setCollection: (docs: readonly DataItem[], index?: fuse_js.FuseIndex<DataItem> | undefined) => void;
|
||||
add: (doc: DataItem) => void;
|
||||
remove: (predicate: (doc: DataItem, idx: number) => boolean) => DataItem[];
|
||||
removeAt: (idx: number) => void;
|
||||
getIndex: () => fuse_js.FuseIndex<DataItem>;
|
||||
}, fuse_js__default<DataItem> | {
|
||||
search: <R = DataItem>(pattern: string | fuse_js.Expression, options?: fuse_js.FuseSearchOptions) => FuseResult<R>[];
|
||||
setCollection: (docs: readonly DataItem[], index?: fuse_js.FuseIndex<DataItem> | undefined) => void;
|
||||
add: (doc: DataItem) => void;
|
||||
remove: (predicate: (doc: DataItem, idx: number) => boolean) => DataItem[];
|
||||
removeAt: (idx: number) => void;
|
||||
getIndex: () => fuse_js.FuseIndex<DataItem>;
|
||||
}>;
|
||||
results: ComputedRef<FuseResult<DataItem>[]>;
|
||||
};
|
||||
type UseFuseReturn = ReturnType<typeof useFuse>;
|
||||
|
||||
interface UseIDBOptions extends ConfigurableFlush {
|
||||
/**
|
||||
* Watch for deep changes
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
deep?: boolean;
|
||||
/**
|
||||
* On error callback
|
||||
*
|
||||
* Default log error to `console.error`
|
||||
*/
|
||||
onError?: (error: unknown) => void;
|
||||
/**
|
||||
* Use shallow ref as reference
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
shallow?: boolean;
|
||||
/**
|
||||
* Write the default value to the storage when it does not exist
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
writeDefaults?: boolean;
|
||||
}
|
||||
interface UseIDBKeyvalReturn<T> {
|
||||
data: RemovableRef<T>;
|
||||
isFinished: ShallowRef<boolean>;
|
||||
set: (value: T) => Promise<void>;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param key
|
||||
* @param initialValue
|
||||
* @param options
|
||||
*/
|
||||
declare function useIDBKeyval<T>(key: IDBValidKey, initialValue: MaybeRefOrGetter<T>, options?: UseIDBOptions): UseIDBKeyvalReturn<T>;
|
||||
|
||||
interface UseJwtOptions<Fallback> {
|
||||
/**
|
||||
* Value returned when encounter error on decoding
|
||||
*
|
||||
* @default null
|
||||
*/
|
||||
fallbackValue?: Fallback;
|
||||
/**
|
||||
* Error callback for decoding
|
||||
*/
|
||||
onError?: (error: unknown) => void;
|
||||
}
|
||||
interface UseJwtReturn<Payload, Header, Fallback> {
|
||||
header: ComputedRef<Header | Fallback>;
|
||||
payload: ComputedRef<Payload | Fallback>;
|
||||
}
|
||||
/**
|
||||
* Reactive decoded jwt token.
|
||||
*
|
||||
* @see https://vueuse.org/useJwt
|
||||
*/
|
||||
declare function useJwt<Payload extends object = JwtPayload, Header extends object = JwtHeader, Fallback = null>(encodedJwt: MaybeRefOrGetter<string>, options?: UseJwtOptions<Fallback>): UseJwtReturn<Payload, Header, Fallback>;
|
||||
|
||||
type UseNProgressOptions = Partial<NProgressOptions>;
|
||||
/**
|
||||
* Reactive progress bar.
|
||||
*
|
||||
* @see https://vueuse.org/useNProgress
|
||||
*/
|
||||
declare function useNProgress(currentProgress?: MaybeRefOrGetter<number | null | undefined>, options?: UseNProgressOptions): {
|
||||
isLoading: vue.WritableComputedRef<boolean, boolean>;
|
||||
progress: vue.Ref<number | null | undefined, number | null | undefined>;
|
||||
start: () => nprogress.NProgress;
|
||||
done: (force?: boolean) => nprogress.NProgress;
|
||||
remove: () => void;
|
||||
};
|
||||
type UseNProgressReturn = ReturnType<typeof useNProgress>;
|
||||
|
||||
/**
|
||||
* Wrapper for qrcode.
|
||||
*
|
||||
* @see https://vueuse.org/useQRCode
|
||||
* @param text
|
||||
* @param options
|
||||
*/
|
||||
declare function useQRCode(text: MaybeRefOrGetter<string>, options?: QRCode.QRCodeToDataURLOptions): vue.ShallowRef<string, string>;
|
||||
|
||||
interface UseSortableReturn {
|
||||
/**
|
||||
* start sortable instance
|
||||
*/
|
||||
start: () => void;
|
||||
/**
|
||||
* destroy sortable instance
|
||||
*/
|
||||
stop: () => void;
|
||||
/**
|
||||
* Options getter/setter
|
||||
* @param name a Sortable.Options property.
|
||||
* @param value a value.
|
||||
*/
|
||||
option: (<K extends keyof Sortable.Options>(name: K, value: Sortable.Options[K]) => void) & (<K extends keyof Sortable.Options>(name: K) => Sortable.Options[K]);
|
||||
}
|
||||
type UseSortableOptions = Options$3 & ConfigurableDocument;
|
||||
declare function useSortable<T>(selector: string, list: MaybeRefOrGetter<T[]>, options?: UseSortableOptions): UseSortableReturn;
|
||||
declare function useSortable<T>(el: MaybeRefOrGetter<HTMLElement | null | undefined>, list: MaybeRefOrGetter<T[]>, options?: UseSortableOptions): UseSortableReturn;
|
||||
/**
|
||||
* Inserts a element into the DOM at a given index.
|
||||
* @param parentElement
|
||||
* @param element
|
||||
* @param {number} index
|
||||
* @see https://github.com/Alfred-Skyblue/vue-draggable-plus/blob/a3829222095e1949bf2c9a20979d7b5930e66f14/src/utils/index.ts#L81C1-L94C2
|
||||
*/
|
||||
declare function insertNodeAt(parentElement: Element, element: Element, index: number): void;
|
||||
/**
|
||||
* Removes a node from the DOM.
|
||||
* @param {Node} node
|
||||
* @see https://github.com/Alfred-Skyblue/vue-draggable-plus/blob/a3829222095e1949bf2c9a20979d7b5930e66f14/src/utils/index.ts#L96C1-L102C2
|
||||
*/
|
||||
declare function removeNode(node: Node): void;
|
||||
declare function moveArrayElement<T>(list: MaybeRefOrGetter<T[]>, from: number, to: number, e?: Sortable.SortableEvent | null): void;
|
||||
|
||||
export { type AsyncValidatorError, type ChangeCaseType, type EasyUseAxiosReturn, type FuseOptions, type StrictUseAxiosReturn, type UseAsyncValidatorExecuteReturn, type UseAsyncValidatorOptions, type UseAsyncValidatorReturn, type UseAxiosOptions, type UseAxiosOptionsBase, type UseAxiosOptionsWithInitialData, type UseAxiosReturn, type UseDrauuOptions, type UseDrauuReturn, type UseFocusTrapOptions, type UseFocusTrapReturn, type UseFuseOptions, type UseFuseReturn, type UseIDBKeyvalReturn, type UseIDBOptions, type UseJwtOptions, type UseJwtReturn, type UseNProgressOptions, type UseNProgressReturn, type UseSortableOptions, type UseSortableReturn, createCookies, insertNodeAt, moveArrayElement, removeNode, useAsyncValidator, useAxios, useChangeCase, useCookies, useDrauu, useFocusTrap, useFuse, useIDBKeyval, useJwt, useNProgress, useQRCode, useSortable };
|
||||
447
node_modules/@vueuse/integrations/index.d.mts
generated
vendored
Normal file
447
node_modules/@vueuse/integrations/index.d.mts
generated
vendored
Normal file
@@ -0,0 +1,447 @@
|
||||
import { ValidateError, ValidateOption, Rules } from 'async-validator';
|
||||
import * as vue from 'vue';
|
||||
import { ShallowRef, ComputedRef, MaybeRefOrGetter, Ref, MaybeRef, WritableComputedRef } from 'vue';
|
||||
import { AxiosResponse, AxiosRequestConfig, AxiosInstance } from 'axios';
|
||||
import * as changeCase from 'change-case';
|
||||
import { Options } from 'change-case';
|
||||
import * as universal_cookie from 'universal-cookie';
|
||||
import universal_cookie__default from 'universal-cookie';
|
||||
import { IncomingMessage } from 'node:http';
|
||||
import { EventHookOn, MaybeComputedElementRef, Fn, Arrayable, ConfigurableDocument } from '@vueuse/core';
|
||||
import { Options as Options$1, Drauu, Brush } from 'drauu';
|
||||
import { Options as Options$2, ActivateOptions, DeactivateOptions } from 'focus-trap';
|
||||
import * as fuse_js from 'fuse.js';
|
||||
import fuse_js__default, { IFuseOptions, FuseResult } from 'fuse.js';
|
||||
import { ConfigurableFlush, RemovableRef } from '@vueuse/shared';
|
||||
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: ShallowRef<boolean>;
|
||||
isFinished: ShallowRef<boolean>;
|
||||
errors: ComputedRef<AsyncValidatorError['errors'] | undefined>;
|
||||
errorInfo: ShallowRef<AsyncValidatorError | null>;
|
||||
errorFields: ComputedRef<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, O extends UseAxiosOptions = UseAxiosOptions<T>> {
|
||||
/**
|
||||
* Axios Response
|
||||
*/
|
||||
response: ShallowRef<R | undefined>;
|
||||
/**
|
||||
* Axios response data
|
||||
*/
|
||||
data: O extends UseAxiosOptionsWithInitialData<T> ? Ref<T> : 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, O extends UseAxiosOptions = UseAxiosOptions<T>> extends UseAxiosReturn<T, R, D, O> {
|
||||
/**
|
||||
* Manually call the axios request
|
||||
*/
|
||||
execute: (url?: string | AxiosRequestConfig<D>, config?: AxiosRequestConfig<D>) => Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
}
|
||||
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 UseAxiosOptionsBase<T = any> {
|
||||
/**
|
||||
* Will automatically run axios request when `useAxios` is used
|
||||
*
|
||||
*/
|
||||
immediate?: boolean;
|
||||
/**
|
||||
* Use shallowRef.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
shallow?: boolean;
|
||||
/**
|
||||
* Abort previous request when a new request is made.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
abortPrevious?: boolean;
|
||||
/**
|
||||
* Callback when error is caught.
|
||||
*/
|
||||
onError?: (e: unknown) => void;
|
||||
/**
|
||||
* Callback when success is caught.
|
||||
*/
|
||||
onSuccess?: (data: T) => void;
|
||||
/**
|
||||
* Sets the state to initialState before executing the promise.
|
||||
*/
|
||||
resetOnExecute?: boolean;
|
||||
/**
|
||||
* Callback when request is finished.
|
||||
*/
|
||||
onFinish?: () => void;
|
||||
}
|
||||
interface UseAxiosOptionsWithInitialData<T> extends UseAxiosOptionsBase<T> {
|
||||
/**
|
||||
* Initial data
|
||||
*/
|
||||
initialData: T;
|
||||
}
|
||||
type UseAxiosOptions<T = any> = UseAxiosOptionsBase<T> | UseAxiosOptionsWithInitialData<T>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsWithInitialData<T> = UseAxiosOptionsWithInitialData<T>>(url: string, config?: AxiosRequestConfig<D>, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsWithInitialData<T> = UseAxiosOptionsWithInitialData<T>>(url: string, instance?: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsWithInitialData<T> = UseAxiosOptionsWithInitialData<T>>(url: string, config: AxiosRequestConfig<D>, instance: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsBase<T> = UseAxiosOptionsBase<T>>(url: string, config?: AxiosRequestConfig<D>, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsBase<T> = UseAxiosOptionsBase<T>>(url: string, instance?: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsBase<T> = UseAxiosOptionsBase<T>>(url: string, config: AxiosRequestConfig<D>, instance: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: AxiosRequestConfig<D>): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: AxiosRequestConfig<D>, instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
|
||||
|
||||
type EndsWithCase<T> = T extends `${infer _}Case` ? T : never;
|
||||
type FilterKeys<T> = {
|
||||
[K in keyof T as K extends string ? K : never]: EndsWithCase<K>;
|
||||
};
|
||||
type ChangeCaseKeys = FilterKeys<typeof changeCase>;
|
||||
type ChangeCaseType = ChangeCaseKeys[keyof ChangeCaseKeys];
|
||||
declare function useChangeCase(input: MaybeRef<string>, type: MaybeRefOrGetter<ChangeCaseType>, options?: MaybeRefOrGetter<Options> | undefined): WritableComputedRef<string>;
|
||||
declare function useChangeCase(input: MaybeRefOrGetter<string>, type: MaybeRefOrGetter<ChangeCaseType>, options?: MaybeRefOrGetter<Options> | undefined): ComputedRef<string>;
|
||||
|
||||
/**
|
||||
* Creates a new {@link useCookies} function
|
||||
* @param req - incoming http request (for SSR)
|
||||
* @see https://github.com/reactivestack/cookies/tree/master/packages/universal-cookie universal-cookie
|
||||
* @description Creates universal-cookie instance using request (default is window.document.cookie) and returns {@link useCookies} function with provided universal-cookie instance
|
||||
*/
|
||||
declare function createCookies(req?: IncomingMessage): (dependencies?: string[] | null, { doNotParse, autoUpdateDependencies }?: {
|
||||
doNotParse?: boolean | undefined;
|
||||
autoUpdateDependencies?: boolean | undefined;
|
||||
}) => {
|
||||
/**
|
||||
* Reactive get cookie by name. If **autoUpdateDependencies = true** then it will update watching dependencies
|
||||
*/
|
||||
get: <T = any>(name: string, options?: universal_cookie.CookieGetOptions | undefined) => T;
|
||||
/**
|
||||
* Reactive get all cookies
|
||||
*/
|
||||
getAll: <T = any>(options?: universal_cookie.CookieGetOptions | undefined) => T;
|
||||
set: (name: string, value: any, options?: universal_cookie.CookieSetOptions | undefined) => void;
|
||||
remove: (name: string, options?: universal_cookie.CookieSetOptions | undefined) => void;
|
||||
addChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
|
||||
removeChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
|
||||
};
|
||||
/**
|
||||
* Reactive methods to work with cookies (use {@link createCookies} method instead if you are using SSR)
|
||||
* @param dependencies - array of watching cookie's names. Pass empty array if don't want to watch cookies changes.
|
||||
* @param options
|
||||
* @param options.doNotParse - don't try parse value as JSON
|
||||
* @param options.autoUpdateDependencies - automatically update watching dependencies
|
||||
* @param cookies - universal-cookie instance
|
||||
*/
|
||||
declare function useCookies(dependencies?: string[] | null, { doNotParse, autoUpdateDependencies }?: {
|
||||
doNotParse?: boolean | undefined;
|
||||
autoUpdateDependencies?: boolean | undefined;
|
||||
}, cookies?: universal_cookie__default): {
|
||||
/**
|
||||
* Reactive get cookie by name. If **autoUpdateDependencies = true** then it will update watching dependencies
|
||||
*/
|
||||
get: <T = any>(name: string, options?: universal_cookie.CookieGetOptions | undefined) => T;
|
||||
/**
|
||||
* Reactive get all cookies
|
||||
*/
|
||||
getAll: <T = any>(options?: universal_cookie.CookieGetOptions | undefined) => T;
|
||||
set: (name: string, value: any, options?: universal_cookie.CookieSetOptions | undefined) => void;
|
||||
remove: (name: string, options?: universal_cookie.CookieSetOptions | undefined) => void;
|
||||
addChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
|
||||
removeChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
|
||||
};
|
||||
|
||||
type UseDrauuOptions = Omit<Options$1, 'el'>;
|
||||
interface UseDrauuReturn {
|
||||
drauuInstance: Ref<Drauu | undefined>;
|
||||
load: (svg: string) => void;
|
||||
dump: () => string | undefined;
|
||||
clear: () => void;
|
||||
cancel: () => void;
|
||||
undo: () => boolean | undefined;
|
||||
redo: () => boolean | undefined;
|
||||
canUndo: ShallowRef<boolean>;
|
||||
canRedo: ShallowRef<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: ShallowRef<boolean>;
|
||||
/**
|
||||
* Indicates if the focus trap is currently paused
|
||||
*/
|
||||
isPaused: ShallowRef<boolean>;
|
||||
/**
|
||||
* Activate the focus trap
|
||||
*
|
||||
* @see https://github.com/focus-trap/focus-trap#trapactivateactivateoptions
|
||||
* @param opts Activate focus trap options
|
||||
*/
|
||||
activate: (opts?: ActivateOptions) => void;
|
||||
/**
|
||||
* Deactivate the focus trap
|
||||
*
|
||||
* @see https://github.com/focus-trap/focus-trap#trapdeactivatedeactivateoptions
|
||||
* @param opts Deactivate focus trap options
|
||||
*/
|
||||
deactivate: (opts?: DeactivateOptions) => void;
|
||||
/**
|
||||
* Pause the focus trap
|
||||
*
|
||||
* @see https://github.com/focus-trap/focus-trap#trappause
|
||||
*/
|
||||
pause: Fn;
|
||||
/**
|
||||
* Unpauses the focus trap
|
||||
*
|
||||
* @see https://github.com/focus-trap/focus-trap#trapunpause
|
||||
*/
|
||||
unpause: Fn;
|
||||
}
|
||||
/**
|
||||
* Reactive focus-trap
|
||||
*
|
||||
* @see https://vueuse.org/useFocusTrap
|
||||
*/
|
||||
declare function useFocusTrap(target: Arrayable<MaybeRefOrGetter<string> | MaybeComputedElementRef>, options?: UseFocusTrapOptions): UseFocusTrapReturn;
|
||||
|
||||
type FuseOptions<T> = IFuseOptions<T>;
|
||||
interface UseFuseOptions<T> {
|
||||
fuseOptions?: FuseOptions<T>;
|
||||
resultLimit?: number;
|
||||
matchAllWhenSearchEmpty?: boolean;
|
||||
}
|
||||
declare function useFuse<DataItem>(search: MaybeRefOrGetter<string>, data: MaybeRefOrGetter<DataItem[]>, options?: MaybeRefOrGetter<UseFuseOptions<DataItem>>): {
|
||||
fuse: vue.Ref<{
|
||||
search: <R = DataItem>(pattern: string | fuse_js.Expression, options?: fuse_js.FuseSearchOptions) => FuseResult<R>[];
|
||||
setCollection: (docs: readonly DataItem[], index?: fuse_js.FuseIndex<DataItem> | undefined) => void;
|
||||
add: (doc: DataItem) => void;
|
||||
remove: (predicate: (doc: DataItem, idx: number) => boolean) => DataItem[];
|
||||
removeAt: (idx: number) => void;
|
||||
getIndex: () => fuse_js.FuseIndex<DataItem>;
|
||||
}, fuse_js__default<DataItem> | {
|
||||
search: <R = DataItem>(pattern: string | fuse_js.Expression, options?: fuse_js.FuseSearchOptions) => FuseResult<R>[];
|
||||
setCollection: (docs: readonly DataItem[], index?: fuse_js.FuseIndex<DataItem> | undefined) => void;
|
||||
add: (doc: DataItem) => void;
|
||||
remove: (predicate: (doc: DataItem, idx: number) => boolean) => DataItem[];
|
||||
removeAt: (idx: number) => void;
|
||||
getIndex: () => fuse_js.FuseIndex<DataItem>;
|
||||
}>;
|
||||
results: ComputedRef<FuseResult<DataItem>[]>;
|
||||
};
|
||||
type UseFuseReturn = ReturnType<typeof useFuse>;
|
||||
|
||||
interface UseIDBOptions extends ConfigurableFlush {
|
||||
/**
|
||||
* Watch for deep changes
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
deep?: boolean;
|
||||
/**
|
||||
* On error callback
|
||||
*
|
||||
* Default log error to `console.error`
|
||||
*/
|
||||
onError?: (error: unknown) => void;
|
||||
/**
|
||||
* Use shallow ref as reference
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
shallow?: boolean;
|
||||
/**
|
||||
* Write the default value to the storage when it does not exist
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
writeDefaults?: boolean;
|
||||
}
|
||||
interface UseIDBKeyvalReturn<T> {
|
||||
data: RemovableRef<T>;
|
||||
isFinished: ShallowRef<boolean>;
|
||||
set: (value: T) => Promise<void>;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param key
|
||||
* @param initialValue
|
||||
* @param options
|
||||
*/
|
||||
declare function useIDBKeyval<T>(key: IDBValidKey, initialValue: MaybeRefOrGetter<T>, options?: UseIDBOptions): UseIDBKeyvalReturn<T>;
|
||||
|
||||
interface UseJwtOptions<Fallback> {
|
||||
/**
|
||||
* Value returned when encounter error on decoding
|
||||
*
|
||||
* @default null
|
||||
*/
|
||||
fallbackValue?: Fallback;
|
||||
/**
|
||||
* Error callback for decoding
|
||||
*/
|
||||
onError?: (error: unknown) => void;
|
||||
}
|
||||
interface UseJwtReturn<Payload, Header, Fallback> {
|
||||
header: ComputedRef<Header | Fallback>;
|
||||
payload: ComputedRef<Payload | Fallback>;
|
||||
}
|
||||
/**
|
||||
* Reactive decoded jwt token.
|
||||
*
|
||||
* @see https://vueuse.org/useJwt
|
||||
*/
|
||||
declare function useJwt<Payload extends object = JwtPayload, Header extends object = JwtHeader, Fallback = null>(encodedJwt: MaybeRefOrGetter<string>, options?: UseJwtOptions<Fallback>): UseJwtReturn<Payload, Header, Fallback>;
|
||||
|
||||
type UseNProgressOptions = Partial<NProgressOptions>;
|
||||
/**
|
||||
* Reactive progress bar.
|
||||
*
|
||||
* @see https://vueuse.org/useNProgress
|
||||
*/
|
||||
declare function useNProgress(currentProgress?: MaybeRefOrGetter<number | null | undefined>, options?: UseNProgressOptions): {
|
||||
isLoading: vue.WritableComputedRef<boolean, boolean>;
|
||||
progress: vue.Ref<number | null | undefined, number | null | undefined>;
|
||||
start: () => nprogress.NProgress;
|
||||
done: (force?: boolean) => nprogress.NProgress;
|
||||
remove: () => void;
|
||||
};
|
||||
type UseNProgressReturn = ReturnType<typeof useNProgress>;
|
||||
|
||||
/**
|
||||
* Wrapper for qrcode.
|
||||
*
|
||||
* @see https://vueuse.org/useQRCode
|
||||
* @param text
|
||||
* @param options
|
||||
*/
|
||||
declare function useQRCode(text: MaybeRefOrGetter<string>, options?: QRCode.QRCodeToDataURLOptions): vue.ShallowRef<string, string>;
|
||||
|
||||
interface UseSortableReturn {
|
||||
/**
|
||||
* start sortable instance
|
||||
*/
|
||||
start: () => void;
|
||||
/**
|
||||
* destroy sortable instance
|
||||
*/
|
||||
stop: () => void;
|
||||
/**
|
||||
* Options getter/setter
|
||||
* @param name a Sortable.Options property.
|
||||
* @param value a value.
|
||||
*/
|
||||
option: (<K extends keyof Sortable.Options>(name: K, value: Sortable.Options[K]) => void) & (<K extends keyof Sortable.Options>(name: K) => Sortable.Options[K]);
|
||||
}
|
||||
type UseSortableOptions = Options$3 & ConfigurableDocument;
|
||||
declare function useSortable<T>(selector: string, list: MaybeRefOrGetter<T[]>, options?: UseSortableOptions): UseSortableReturn;
|
||||
declare function useSortable<T>(el: MaybeRefOrGetter<HTMLElement | null | undefined>, list: MaybeRefOrGetter<T[]>, options?: UseSortableOptions): UseSortableReturn;
|
||||
/**
|
||||
* Inserts a element into the DOM at a given index.
|
||||
* @param parentElement
|
||||
* @param element
|
||||
* @param {number} index
|
||||
* @see https://github.com/Alfred-Skyblue/vue-draggable-plus/blob/a3829222095e1949bf2c9a20979d7b5930e66f14/src/utils/index.ts#L81C1-L94C2
|
||||
*/
|
||||
declare function insertNodeAt(parentElement: Element, element: Element, index: number): void;
|
||||
/**
|
||||
* Removes a node from the DOM.
|
||||
* @param {Node} node
|
||||
* @see https://github.com/Alfred-Skyblue/vue-draggable-plus/blob/a3829222095e1949bf2c9a20979d7b5930e66f14/src/utils/index.ts#L96C1-L102C2
|
||||
*/
|
||||
declare function removeNode(node: Node): void;
|
||||
declare function moveArrayElement<T>(list: MaybeRefOrGetter<T[]>, from: number, to: number, e?: Sortable.SortableEvent | null): void;
|
||||
|
||||
export { type AsyncValidatorError, type ChangeCaseType, type EasyUseAxiosReturn, type FuseOptions, type StrictUseAxiosReturn, type UseAsyncValidatorExecuteReturn, type UseAsyncValidatorOptions, type UseAsyncValidatorReturn, type UseAxiosOptions, type UseAxiosOptionsBase, type UseAxiosOptionsWithInitialData, type UseAxiosReturn, type UseDrauuOptions, type UseDrauuReturn, type UseFocusTrapOptions, type UseFocusTrapReturn, type UseFuseOptions, type UseFuseReturn, type UseIDBKeyvalReturn, type UseIDBOptions, type UseJwtOptions, type UseJwtReturn, type UseNProgressOptions, type UseNProgressReturn, type UseSortableOptions, type UseSortableReturn, createCookies, insertNodeAt, moveArrayElement, removeNode, useAsyncValidator, useAxios, useChangeCase, useCookies, useDrauu, useFocusTrap, useFuse, useIDBKeyval, useJwt, useNProgress, useQRCode, useSortable };
|
||||
447
node_modules/@vueuse/integrations/index.d.ts
generated
vendored
Normal file
447
node_modules/@vueuse/integrations/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,447 @@
|
||||
import { ValidateError, ValidateOption, Rules } from 'async-validator';
|
||||
import * as vue from 'vue';
|
||||
import { ShallowRef, ComputedRef, MaybeRefOrGetter, Ref, MaybeRef, WritableComputedRef } from 'vue';
|
||||
import { AxiosResponse, AxiosRequestConfig, AxiosInstance } from 'axios';
|
||||
import * as changeCase from 'change-case';
|
||||
import { Options } from 'change-case';
|
||||
import * as universal_cookie from 'universal-cookie';
|
||||
import universal_cookie__default from 'universal-cookie';
|
||||
import { IncomingMessage } from 'node:http';
|
||||
import { EventHookOn, MaybeComputedElementRef, Fn, Arrayable, ConfigurableDocument } from '@vueuse/core';
|
||||
import { Options as Options$1, Drauu, Brush } from 'drauu';
|
||||
import { Options as Options$2, ActivateOptions, DeactivateOptions } from 'focus-trap';
|
||||
import * as fuse_js from 'fuse.js';
|
||||
import fuse_js__default, { IFuseOptions, FuseResult } from 'fuse.js';
|
||||
import { ConfigurableFlush, RemovableRef } from '@vueuse/shared';
|
||||
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: ShallowRef<boolean>;
|
||||
isFinished: ShallowRef<boolean>;
|
||||
errors: ComputedRef<AsyncValidatorError['errors'] | undefined>;
|
||||
errorInfo: ShallowRef<AsyncValidatorError | null>;
|
||||
errorFields: ComputedRef<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, O extends UseAxiosOptions = UseAxiosOptions<T>> {
|
||||
/**
|
||||
* Axios Response
|
||||
*/
|
||||
response: ShallowRef<R | undefined>;
|
||||
/**
|
||||
* Axios response data
|
||||
*/
|
||||
data: O extends UseAxiosOptionsWithInitialData<T> ? Ref<T> : 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, O extends UseAxiosOptions = UseAxiosOptions<T>> extends UseAxiosReturn<T, R, D, O> {
|
||||
/**
|
||||
* Manually call the axios request
|
||||
*/
|
||||
execute: (url?: string | AxiosRequestConfig<D>, config?: AxiosRequestConfig<D>) => Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
}
|
||||
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 UseAxiosOptionsBase<T = any> {
|
||||
/**
|
||||
* Will automatically run axios request when `useAxios` is used
|
||||
*
|
||||
*/
|
||||
immediate?: boolean;
|
||||
/**
|
||||
* Use shallowRef.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
shallow?: boolean;
|
||||
/**
|
||||
* Abort previous request when a new request is made.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
abortPrevious?: boolean;
|
||||
/**
|
||||
* Callback when error is caught.
|
||||
*/
|
||||
onError?: (e: unknown) => void;
|
||||
/**
|
||||
* Callback when success is caught.
|
||||
*/
|
||||
onSuccess?: (data: T) => void;
|
||||
/**
|
||||
* Sets the state to initialState before executing the promise.
|
||||
*/
|
||||
resetOnExecute?: boolean;
|
||||
/**
|
||||
* Callback when request is finished.
|
||||
*/
|
||||
onFinish?: () => void;
|
||||
}
|
||||
interface UseAxiosOptionsWithInitialData<T> extends UseAxiosOptionsBase<T> {
|
||||
/**
|
||||
* Initial data
|
||||
*/
|
||||
initialData: T;
|
||||
}
|
||||
type UseAxiosOptions<T = any> = UseAxiosOptionsBase<T> | UseAxiosOptionsWithInitialData<T>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsWithInitialData<T> = UseAxiosOptionsWithInitialData<T>>(url: string, config?: AxiosRequestConfig<D>, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsWithInitialData<T> = UseAxiosOptionsWithInitialData<T>>(url: string, instance?: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsWithInitialData<T> = UseAxiosOptionsWithInitialData<T>>(url: string, config: AxiosRequestConfig<D>, instance: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsBase<T> = UseAxiosOptionsBase<T>>(url: string, config?: AxiosRequestConfig<D>, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsBase<T> = UseAxiosOptionsBase<T>>(url: string, instance?: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsBase<T> = UseAxiosOptionsBase<T>>(url: string, config: AxiosRequestConfig<D>, instance: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: AxiosRequestConfig<D>): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: AxiosRequestConfig<D>, instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
|
||||
|
||||
type EndsWithCase<T> = T extends `${infer _}Case` ? T : never;
|
||||
type FilterKeys<T> = {
|
||||
[K in keyof T as K extends string ? K : never]: EndsWithCase<K>;
|
||||
};
|
||||
type ChangeCaseKeys = FilterKeys<typeof changeCase>;
|
||||
type ChangeCaseType = ChangeCaseKeys[keyof ChangeCaseKeys];
|
||||
declare function useChangeCase(input: MaybeRef<string>, type: MaybeRefOrGetter<ChangeCaseType>, options?: MaybeRefOrGetter<Options> | undefined): WritableComputedRef<string>;
|
||||
declare function useChangeCase(input: MaybeRefOrGetter<string>, type: MaybeRefOrGetter<ChangeCaseType>, options?: MaybeRefOrGetter<Options> | undefined): ComputedRef<string>;
|
||||
|
||||
/**
|
||||
* Creates a new {@link useCookies} function
|
||||
* @param req - incoming http request (for SSR)
|
||||
* @see https://github.com/reactivestack/cookies/tree/master/packages/universal-cookie universal-cookie
|
||||
* @description Creates universal-cookie instance using request (default is window.document.cookie) and returns {@link useCookies} function with provided universal-cookie instance
|
||||
*/
|
||||
declare function createCookies(req?: IncomingMessage): (dependencies?: string[] | null, { doNotParse, autoUpdateDependencies }?: {
|
||||
doNotParse?: boolean | undefined;
|
||||
autoUpdateDependencies?: boolean | undefined;
|
||||
}) => {
|
||||
/**
|
||||
* Reactive get cookie by name. If **autoUpdateDependencies = true** then it will update watching dependencies
|
||||
*/
|
||||
get: <T = any>(name: string, options?: universal_cookie.CookieGetOptions | undefined) => T;
|
||||
/**
|
||||
* Reactive get all cookies
|
||||
*/
|
||||
getAll: <T = any>(options?: universal_cookie.CookieGetOptions | undefined) => T;
|
||||
set: (name: string, value: any, options?: universal_cookie.CookieSetOptions | undefined) => void;
|
||||
remove: (name: string, options?: universal_cookie.CookieSetOptions | undefined) => void;
|
||||
addChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
|
||||
removeChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
|
||||
};
|
||||
/**
|
||||
* Reactive methods to work with cookies (use {@link createCookies} method instead if you are using SSR)
|
||||
* @param dependencies - array of watching cookie's names. Pass empty array if don't want to watch cookies changes.
|
||||
* @param options
|
||||
* @param options.doNotParse - don't try parse value as JSON
|
||||
* @param options.autoUpdateDependencies - automatically update watching dependencies
|
||||
* @param cookies - universal-cookie instance
|
||||
*/
|
||||
declare function useCookies(dependencies?: string[] | null, { doNotParse, autoUpdateDependencies }?: {
|
||||
doNotParse?: boolean | undefined;
|
||||
autoUpdateDependencies?: boolean | undefined;
|
||||
}, cookies?: universal_cookie__default): {
|
||||
/**
|
||||
* Reactive get cookie by name. If **autoUpdateDependencies = true** then it will update watching dependencies
|
||||
*/
|
||||
get: <T = any>(name: string, options?: universal_cookie.CookieGetOptions | undefined) => T;
|
||||
/**
|
||||
* Reactive get all cookies
|
||||
*/
|
||||
getAll: <T = any>(options?: universal_cookie.CookieGetOptions | undefined) => T;
|
||||
set: (name: string, value: any, options?: universal_cookie.CookieSetOptions | undefined) => void;
|
||||
remove: (name: string, options?: universal_cookie.CookieSetOptions | undefined) => void;
|
||||
addChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
|
||||
removeChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
|
||||
};
|
||||
|
||||
type UseDrauuOptions = Omit<Options$1, 'el'>;
|
||||
interface UseDrauuReturn {
|
||||
drauuInstance: Ref<Drauu | undefined>;
|
||||
load: (svg: string) => void;
|
||||
dump: () => string | undefined;
|
||||
clear: () => void;
|
||||
cancel: () => void;
|
||||
undo: () => boolean | undefined;
|
||||
redo: () => boolean | undefined;
|
||||
canUndo: ShallowRef<boolean>;
|
||||
canRedo: ShallowRef<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: ShallowRef<boolean>;
|
||||
/**
|
||||
* Indicates if the focus trap is currently paused
|
||||
*/
|
||||
isPaused: ShallowRef<boolean>;
|
||||
/**
|
||||
* Activate the focus trap
|
||||
*
|
||||
* @see https://github.com/focus-trap/focus-trap#trapactivateactivateoptions
|
||||
* @param opts Activate focus trap options
|
||||
*/
|
||||
activate: (opts?: ActivateOptions) => void;
|
||||
/**
|
||||
* Deactivate the focus trap
|
||||
*
|
||||
* @see https://github.com/focus-trap/focus-trap#trapdeactivatedeactivateoptions
|
||||
* @param opts Deactivate focus trap options
|
||||
*/
|
||||
deactivate: (opts?: DeactivateOptions) => void;
|
||||
/**
|
||||
* Pause the focus trap
|
||||
*
|
||||
* @see https://github.com/focus-trap/focus-trap#trappause
|
||||
*/
|
||||
pause: Fn;
|
||||
/**
|
||||
* Unpauses the focus trap
|
||||
*
|
||||
* @see https://github.com/focus-trap/focus-trap#trapunpause
|
||||
*/
|
||||
unpause: Fn;
|
||||
}
|
||||
/**
|
||||
* Reactive focus-trap
|
||||
*
|
||||
* @see https://vueuse.org/useFocusTrap
|
||||
*/
|
||||
declare function useFocusTrap(target: Arrayable<MaybeRefOrGetter<string> | MaybeComputedElementRef>, options?: UseFocusTrapOptions): UseFocusTrapReturn;
|
||||
|
||||
type FuseOptions<T> = IFuseOptions<T>;
|
||||
interface UseFuseOptions<T> {
|
||||
fuseOptions?: FuseOptions<T>;
|
||||
resultLimit?: number;
|
||||
matchAllWhenSearchEmpty?: boolean;
|
||||
}
|
||||
declare function useFuse<DataItem>(search: MaybeRefOrGetter<string>, data: MaybeRefOrGetter<DataItem[]>, options?: MaybeRefOrGetter<UseFuseOptions<DataItem>>): {
|
||||
fuse: vue.Ref<{
|
||||
search: <R = DataItem>(pattern: string | fuse_js.Expression, options?: fuse_js.FuseSearchOptions) => FuseResult<R>[];
|
||||
setCollection: (docs: readonly DataItem[], index?: fuse_js.FuseIndex<DataItem> | undefined) => void;
|
||||
add: (doc: DataItem) => void;
|
||||
remove: (predicate: (doc: DataItem, idx: number) => boolean) => DataItem[];
|
||||
removeAt: (idx: number) => void;
|
||||
getIndex: () => fuse_js.FuseIndex<DataItem>;
|
||||
}, fuse_js__default<DataItem> | {
|
||||
search: <R = DataItem>(pattern: string | fuse_js.Expression, options?: fuse_js.FuseSearchOptions) => FuseResult<R>[];
|
||||
setCollection: (docs: readonly DataItem[], index?: fuse_js.FuseIndex<DataItem> | undefined) => void;
|
||||
add: (doc: DataItem) => void;
|
||||
remove: (predicate: (doc: DataItem, idx: number) => boolean) => DataItem[];
|
||||
removeAt: (idx: number) => void;
|
||||
getIndex: () => fuse_js.FuseIndex<DataItem>;
|
||||
}>;
|
||||
results: ComputedRef<FuseResult<DataItem>[]>;
|
||||
};
|
||||
type UseFuseReturn = ReturnType<typeof useFuse>;
|
||||
|
||||
interface UseIDBOptions extends ConfigurableFlush {
|
||||
/**
|
||||
* Watch for deep changes
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
deep?: boolean;
|
||||
/**
|
||||
* On error callback
|
||||
*
|
||||
* Default log error to `console.error`
|
||||
*/
|
||||
onError?: (error: unknown) => void;
|
||||
/**
|
||||
* Use shallow ref as reference
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
shallow?: boolean;
|
||||
/**
|
||||
* Write the default value to the storage when it does not exist
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
writeDefaults?: boolean;
|
||||
}
|
||||
interface UseIDBKeyvalReturn<T> {
|
||||
data: RemovableRef<T>;
|
||||
isFinished: ShallowRef<boolean>;
|
||||
set: (value: T) => Promise<void>;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param key
|
||||
* @param initialValue
|
||||
* @param options
|
||||
*/
|
||||
declare function useIDBKeyval<T>(key: IDBValidKey, initialValue: MaybeRefOrGetter<T>, options?: UseIDBOptions): UseIDBKeyvalReturn<T>;
|
||||
|
||||
interface UseJwtOptions<Fallback> {
|
||||
/**
|
||||
* Value returned when encounter error on decoding
|
||||
*
|
||||
* @default null
|
||||
*/
|
||||
fallbackValue?: Fallback;
|
||||
/**
|
||||
* Error callback for decoding
|
||||
*/
|
||||
onError?: (error: unknown) => void;
|
||||
}
|
||||
interface UseJwtReturn<Payload, Header, Fallback> {
|
||||
header: ComputedRef<Header | Fallback>;
|
||||
payload: ComputedRef<Payload | Fallback>;
|
||||
}
|
||||
/**
|
||||
* Reactive decoded jwt token.
|
||||
*
|
||||
* @see https://vueuse.org/useJwt
|
||||
*/
|
||||
declare function useJwt<Payload extends object = JwtPayload, Header extends object = JwtHeader, Fallback = null>(encodedJwt: MaybeRefOrGetter<string>, options?: UseJwtOptions<Fallback>): UseJwtReturn<Payload, Header, Fallback>;
|
||||
|
||||
type UseNProgressOptions = Partial<NProgressOptions>;
|
||||
/**
|
||||
* Reactive progress bar.
|
||||
*
|
||||
* @see https://vueuse.org/useNProgress
|
||||
*/
|
||||
declare function useNProgress(currentProgress?: MaybeRefOrGetter<number | null | undefined>, options?: UseNProgressOptions): {
|
||||
isLoading: vue.WritableComputedRef<boolean, boolean>;
|
||||
progress: vue.Ref<number | null | undefined, number | null | undefined>;
|
||||
start: () => nprogress.NProgress;
|
||||
done: (force?: boolean) => nprogress.NProgress;
|
||||
remove: () => void;
|
||||
};
|
||||
type UseNProgressReturn = ReturnType<typeof useNProgress>;
|
||||
|
||||
/**
|
||||
* Wrapper for qrcode.
|
||||
*
|
||||
* @see https://vueuse.org/useQRCode
|
||||
* @param text
|
||||
* @param options
|
||||
*/
|
||||
declare function useQRCode(text: MaybeRefOrGetter<string>, options?: QRCode.QRCodeToDataURLOptions): vue.ShallowRef<string, string>;
|
||||
|
||||
interface UseSortableReturn {
|
||||
/**
|
||||
* start sortable instance
|
||||
*/
|
||||
start: () => void;
|
||||
/**
|
||||
* destroy sortable instance
|
||||
*/
|
||||
stop: () => void;
|
||||
/**
|
||||
* Options getter/setter
|
||||
* @param name a Sortable.Options property.
|
||||
* @param value a value.
|
||||
*/
|
||||
option: (<K extends keyof Sortable.Options>(name: K, value: Sortable.Options[K]) => void) & (<K extends keyof Sortable.Options>(name: K) => Sortable.Options[K]);
|
||||
}
|
||||
type UseSortableOptions = Options$3 & ConfigurableDocument;
|
||||
declare function useSortable<T>(selector: string, list: MaybeRefOrGetter<T[]>, options?: UseSortableOptions): UseSortableReturn;
|
||||
declare function useSortable<T>(el: MaybeRefOrGetter<HTMLElement | null | undefined>, list: MaybeRefOrGetter<T[]>, options?: UseSortableOptions): UseSortableReturn;
|
||||
/**
|
||||
* Inserts a element into the DOM at a given index.
|
||||
* @param parentElement
|
||||
* @param element
|
||||
* @param {number} index
|
||||
* @see https://github.com/Alfred-Skyblue/vue-draggable-plus/blob/a3829222095e1949bf2c9a20979d7b5930e66f14/src/utils/index.ts#L81C1-L94C2
|
||||
*/
|
||||
declare function insertNodeAt(parentElement: Element, element: Element, index: number): void;
|
||||
/**
|
||||
* Removes a node from the DOM.
|
||||
* @param {Node} node
|
||||
* @see https://github.com/Alfred-Skyblue/vue-draggable-plus/blob/a3829222095e1949bf2c9a20979d7b5930e66f14/src/utils/index.ts#L96C1-L102C2
|
||||
*/
|
||||
declare function removeNode(node: Node): void;
|
||||
declare function moveArrayElement<T>(list: MaybeRefOrGetter<T[]>, from: number, to: number, e?: Sortable.SortableEvent | null): void;
|
||||
|
||||
export { type AsyncValidatorError, type ChangeCaseType, type EasyUseAxiosReturn, type FuseOptions, type StrictUseAxiosReturn, type UseAsyncValidatorExecuteReturn, type UseAsyncValidatorOptions, type UseAsyncValidatorReturn, type UseAxiosOptions, type UseAxiosOptionsBase, type UseAxiosOptionsWithInitialData, type UseAxiosReturn, type UseDrauuOptions, type UseDrauuReturn, type UseFocusTrapOptions, type UseFocusTrapReturn, type UseFuseOptions, type UseFuseReturn, type UseIDBKeyvalReturn, type UseIDBOptions, type UseJwtOptions, type UseJwtReturn, type UseNProgressOptions, type UseNProgressReturn, type UseSortableOptions, type UseSortableReturn, createCookies, insertNodeAt, moveArrayElement, removeNode, useAsyncValidator, useAxios, useChangeCase, useCookies, useDrauu, useFocusTrap, useFuse, useIDBKeyval, useJwt, useNProgress, useQRCode, useSortable };
|
||||
690
node_modules/@vueuse/integrations/index.iife.js
generated
vendored
Normal file
690
node_modules/@vueuse/integrations/index.iife.js
generated
vendored
Normal file
@@ -0,0 +1,690 @@
|
||||
(function (exports, shared, Schema, vue, axios, changeCase, Cookie, core, drauu, focusTrap, Fuse, idbKeyval, jwtDecode, nprogress, QRCode, Sortable) {
|
||||
'use strict';
|
||||
|
||||
function _interopNamespaceDefault(e) {
|
||||
var n = Object.create(null);
|
||||
if (e) {
|
||||
Object.keys(e).forEach(function (k) {
|
||||
if (k !== 'default') {
|
||||
var d = Object.getOwnPropertyDescriptor(e, k);
|
||||
Object.defineProperty(n, k, d.get ? d : {
|
||||
enumerable: true,
|
||||
get: function () { return e[k]; }
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
n.default = e;
|
||||
return Object.freeze(n);
|
||||
}
|
||||
|
||||
var changeCase__namespace = /*#__PURE__*/_interopNamespaceDefault(changeCase);
|
||||
|
||||
const AsyncValidatorSchema = Schema.default || Schema;
|
||||
function useAsyncValidator(value, rules, options = {}) {
|
||||
const {
|
||||
validateOption = {},
|
||||
immediate = true,
|
||||
manual = false
|
||||
} = options;
|
||||
const valueRef = shared.toRef(value);
|
||||
const errorInfo = vue.shallowRef(null);
|
||||
const isFinished = vue.shallowRef(true);
|
||||
const pass = vue.shallowRef(!immediate || manual);
|
||||
const errors = vue.computed(() => {
|
||||
var _a;
|
||||
return ((_a = errorInfo.value) == null ? void 0 : _a.errors) || [];
|
||||
});
|
||||
const errorFields = vue.computed(() => {
|
||||
var _a;
|
||||
return ((_a = errorInfo.value) == null ? void 0 : _a.fields) || {};
|
||||
});
|
||||
const validator = vue.computed(() => new AsyncValidatorSchema(vue.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) {
|
||||
vue.watch(
|
||||
[valueRef, validator],
|
||||
() => execute(),
|
||||
{ immediate, deep: true }
|
||||
);
|
||||
}
|
||||
const shell = {
|
||||
isFinished,
|
||||
pass,
|
||||
errors,
|
||||
errorInfo,
|
||||
errorFields,
|
||||
execute
|
||||
};
|
||||
function waitUntilFinished() {
|
||||
return new Promise((resolve, reject) => {
|
||||
shared.until(isFinished).toBe(true).then(() => resolve(shell)).catch((error) => reject(error));
|
||||
});
|
||||
}
|
||||
return {
|
||||
...shell,
|
||||
then(onFulfilled, onRejected) {
|
||||
return waitUntilFinished().then(onFulfilled, onRejected);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function useAxios(...args) {
|
||||
const url = typeof args[0] === "string" ? args[0] : void 0;
|
||||
const argsPlaceholder = typeof url === "string" ? 1 : 0;
|
||||
const defaultOptions = {
|
||||
immediate: !!argsPlaceholder,
|
||||
shallow: true,
|
||||
abortPrevious: true
|
||||
};
|
||||
let defaultConfig = {};
|
||||
let instance = axios;
|
||||
let options = defaultOptions;
|
||||
const isAxiosInstance = (val) => !!(val == null ? void 0 : val.request);
|
||||
if (args.length > 0 + argsPlaceholder) {
|
||||
if (isAxiosInstance(args[0 + argsPlaceholder]))
|
||||
instance = args[0 + argsPlaceholder];
|
||||
else
|
||||
defaultConfig = args[0 + argsPlaceholder];
|
||||
}
|
||||
if (args.length > 1 + argsPlaceholder) {
|
||||
if (isAxiosInstance(args[1 + argsPlaceholder]))
|
||||
instance = args[1 + argsPlaceholder];
|
||||
}
|
||||
if (args.length === 2 + argsPlaceholder && !isAxiosInstance(args[1 + argsPlaceholder]) || args.length === 3 + argsPlaceholder) {
|
||||
options = args[args.length - 1] || defaultOptions;
|
||||
}
|
||||
const {
|
||||
shallow,
|
||||
onSuccess = shared.noop,
|
||||
onError = shared.noop,
|
||||
immediate,
|
||||
resetOnExecute = false
|
||||
} = options;
|
||||
const initialData = options.initialData;
|
||||
const response = vue.shallowRef();
|
||||
const data = (shallow ? vue.shallowRef : vue.ref)(initialData);
|
||||
const isFinished = vue.shallowRef(false);
|
||||
const isLoading = vue.shallowRef(false);
|
||||
const isAborted = vue.shallowRef(false);
|
||||
const error = vue.shallowRef();
|
||||
let abortController = new AbortController();
|
||||
const abort = (message) => {
|
||||
if (isFinished.value || !isLoading.value)
|
||||
return;
|
||||
abortController.abort(message);
|
||||
abortController = new AbortController();
|
||||
isAborted.value = true;
|
||||
isLoading.value = false;
|
||||
isFinished.value = false;
|
||||
};
|
||||
const loading = (loading2) => {
|
||||
isLoading.value = loading2;
|
||||
isFinished.value = !loading2;
|
||||
};
|
||||
const resetData = () => {
|
||||
if (resetOnExecute)
|
||||
data.value = initialData;
|
||||
};
|
||||
const waitUntilFinished = () => new Promise((resolve, reject) => {
|
||||
shared.until(isFinished).toBe(true).then(() => error.value ? reject(error.value) : resolve(result));
|
||||
});
|
||||
const promise = {
|
||||
then: (...args2) => waitUntilFinished().then(...args2),
|
||||
catch: (...args2) => waitUntilFinished().catch(...args2)
|
||||
};
|
||||
let executeCounter = 0;
|
||||
const execute = (executeUrl = url, config = {}) => {
|
||||
error.value = void 0;
|
||||
const _url = typeof executeUrl === "string" ? executeUrl : url != null ? url : config.url;
|
||||
if (_url === void 0) {
|
||||
error.value = new axios.AxiosError(axios.AxiosError.ERR_INVALID_URL);
|
||||
isFinished.value = true;
|
||||
return promise;
|
||||
}
|
||||
resetData();
|
||||
if (options.abortPrevious !== false)
|
||||
abort();
|
||||
loading(true);
|
||||
executeCounter += 1;
|
||||
const currentExecuteCounter = executeCounter;
|
||||
isAborted.value = false;
|
||||
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, signal: abortController.signal }).then((r) => {
|
||||
if (isAborted.value)
|
||||
return;
|
||||
response.value = r;
|
||||
const result2 = r.data;
|
||||
data.value = result2;
|
||||
onSuccess(result2);
|
||||
}).catch((e) => {
|
||||
error.value = e;
|
||||
onError(e);
|
||||
}).finally(() => {
|
||||
var _a;
|
||||
(_a = options.onFinish) == null ? void 0 : _a.call(options);
|
||||
if (currentExecuteCounter === executeCounter)
|
||||
loading(false);
|
||||
});
|
||||
return promise;
|
||||
};
|
||||
if (immediate && url)
|
||||
execute();
|
||||
const result = {
|
||||
response,
|
||||
data,
|
||||
error,
|
||||
isFinished,
|
||||
isLoading,
|
||||
cancel: abort,
|
||||
isAborted,
|
||||
isCanceled: isAborted,
|
||||
abort,
|
||||
execute
|
||||
};
|
||||
return {
|
||||
...result,
|
||||
...promise
|
||||
};
|
||||
}
|
||||
|
||||
const changeCaseTransforms = /* @__PURE__ */ Object.entries(changeCase__namespace).filter(([name, fn]) => typeof fn === "function" && name.endsWith("Case")).reduce((acc, [name, fn]) => {
|
||||
acc[name] = fn;
|
||||
return acc;
|
||||
}, {});
|
||||
function useChangeCase(input, type, options) {
|
||||
const typeRef = vue.computed(() => {
|
||||
const t = vue.toValue(type);
|
||||
if (!changeCaseTransforms[t])
|
||||
throw new Error(`Invalid change case type "${t}"`);
|
||||
return t;
|
||||
});
|
||||
if (typeof input === "function")
|
||||
return vue.computed(() => changeCaseTransforms[typeRef.value](vue.toValue(input), vue.toValue(options)));
|
||||
const text = vue.ref(input);
|
||||
return vue.computed({
|
||||
get() {
|
||||
return changeCaseTransforms[typeRef.value](text.value, vue.toValue(options));
|
||||
},
|
||||
set(value) {
|
||||
text.value = value;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function createCookies(req) {
|
||||
const universalCookie = new Cookie(req ? req.headers.cookie : null);
|
||||
return (dependencies, { doNotParse = false, autoUpdateDependencies = false } = {}) => useCookies(dependencies, { doNotParse, autoUpdateDependencies }, universalCookie);
|
||||
}
|
||||
function useCookies(dependencies, { doNotParse = false, autoUpdateDependencies = false } = {}, cookies = new Cookie()) {
|
||||
const watchingDependencies = autoUpdateDependencies ? [...dependencies || []] : dependencies;
|
||||
let previousCookies = cookies.getAll({ doNotParse: true });
|
||||
const touches = vue.shallowRef(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 = vue.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 = vue.shallowRef(false);
|
||||
const canRedo = vue.shallowRef(false);
|
||||
const altPressed = vue.shallowRef(false);
|
||||
const shiftPressed = vue.shallowRef(false);
|
||||
const brush = vue.ref({
|
||||
color: "black",
|
||||
size: 3,
|
||||
arrowEnd: false,
|
||||
cornerRadius: 0,
|
||||
dasharray: void 0,
|
||||
fill: "transparent",
|
||||
mode: "draw",
|
||||
...options == null ? void 0 : options.brush
|
||||
});
|
||||
vue.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;
|
||||
}
|
||||
};
|
||||
vue.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 = vue.shallowRef(false);
|
||||
const isPaused = vue.shallowRef(false);
|
||||
const activate = (opts) => trap && trap.activate(opts);
|
||||
const deactivate = (opts) => trap && trap.deactivate(opts);
|
||||
const pause = () => {
|
||||
if (trap) {
|
||||
trap.pause();
|
||||
isPaused.value = true;
|
||||
}
|
||||
};
|
||||
const unpause = () => {
|
||||
if (trap) {
|
||||
trap.unpause();
|
||||
isPaused.value = false;
|
||||
}
|
||||
};
|
||||
const targets = vue.computed(() => {
|
||||
const _targets = vue.toValue(target);
|
||||
return core.toArray(_targets).map((el) => {
|
||||
const _el = vue.toValue(el);
|
||||
return typeof _el === "string" ? _el : core.unrefElement(_el);
|
||||
}).filter(shared.notNullish);
|
||||
});
|
||||
vue.watch(
|
||||
targets,
|
||||
(els) => {
|
||||
if (!els.length)
|
||||
return;
|
||||
trap = focusTrap.createFocusTrap(els, {
|
||||
...focusTrapOptions,
|
||||
onActivate() {
|
||||
hasFocus.value = true;
|
||||
if (options.onActivate)
|
||||
options.onActivate();
|
||||
},
|
||||
onDeactivate() {
|
||||
hasFocus.value = false;
|
||||
if (options.onDeactivate)
|
||||
options.onDeactivate();
|
||||
}
|
||||
});
|
||||
if (immediate)
|
||||
activate();
|
||||
},
|
||||
{ flush: "post" }
|
||||
);
|
||||
core.tryOnScopeDispose(() => deactivate());
|
||||
return {
|
||||
hasFocus,
|
||||
isPaused,
|
||||
activate,
|
||||
deactivate,
|
||||
pause,
|
||||
unpause
|
||||
};
|
||||
}
|
||||
|
||||
function useFuse(search, data, options) {
|
||||
const createFuse = () => {
|
||||
var _a, _b;
|
||||
return new Fuse(
|
||||
(_a = vue.toValue(data)) != null ? _a : [],
|
||||
(_b = vue.toValue(options)) == null ? void 0 : _b.fuseOptions
|
||||
);
|
||||
};
|
||||
const fuse = vue.ref(createFuse());
|
||||
vue.watch(
|
||||
() => {
|
||||
var _a;
|
||||
return (_a = vue.toValue(options)) == null ? void 0 : _a.fuseOptions;
|
||||
},
|
||||
() => {
|
||||
fuse.value = createFuse();
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
vue.watch(
|
||||
() => vue.toValue(data),
|
||||
(newData) => {
|
||||
fuse.value.setCollection(newData);
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
const results = vue.computed(() => {
|
||||
const resolved = vue.toValue(options);
|
||||
if ((resolved == null ? void 0 : resolved.matchAllWhenSearchEmpty) && !vue.toValue(search))
|
||||
return vue.toValue(data).map((item, index) => ({ item, refIndex: index }));
|
||||
const limit = resolved == null ? void 0 : resolved.resultLimit;
|
||||
return fuse.value.search(vue.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 = vue.shallowRef(false);
|
||||
const data = (shallow ? vue.shallowRef : vue.ref)(initialValue);
|
||||
const rawInit = vue.toValue(initialValue);
|
||||
async function read() {
|
||||
try {
|
||||
const rawValue = await idbKeyval.get(key);
|
||||
if (rawValue === void 0) {
|
||||
if (rawInit !== void 0 && rawInit !== null && writeDefaults)
|
||||
await idbKeyval.set(key, rawInit);
|
||||
} else {
|
||||
data.value = rawValue;
|
||||
}
|
||||
} catch (e) {
|
||||
onError(e);
|
||||
}
|
||||
isFinished.value = true;
|
||||
}
|
||||
read();
|
||||
async function write() {
|
||||
try {
|
||||
if (data.value == null) {
|
||||
await idbKeyval.del(key);
|
||||
} else {
|
||||
await idbKeyval.update(key, () => vue.toRaw(data.value));
|
||||
}
|
||||
} catch (e) {
|
||||
onError(e);
|
||||
}
|
||||
}
|
||||
const {
|
||||
pause: pauseWatch,
|
||||
resume: resumeWatch
|
||||
} = core.watchPausable(data, () => write(), { flush, deep });
|
||||
async function setData(value) {
|
||||
pauseWatch();
|
||||
data.value = value;
|
||||
await write();
|
||||
resumeWatch();
|
||||
}
|
||||
return {
|
||||
set: setData,
|
||||
isFinished,
|
||||
data
|
||||
};
|
||||
}
|
||||
|
||||
function useJwt(encodedJwt, options = {}) {
|
||||
const {
|
||||
onError,
|
||||
fallbackValue = null
|
||||
} = options;
|
||||
const decodeWithFallback = (encodedJwt2, options2) => {
|
||||
try {
|
||||
return jwtDecode.jwtDecode(encodedJwt2, options2);
|
||||
} catch (err) {
|
||||
onError == null ? void 0 : onError(err);
|
||||
return fallbackValue;
|
||||
}
|
||||
};
|
||||
const header = vue.computed(() => decodeWithFallback(vue.toValue(encodedJwt), { header: true }));
|
||||
const payload = vue.computed(() => decodeWithFallback(vue.toValue(encodedJwt)));
|
||||
return {
|
||||
header,
|
||||
payload
|
||||
};
|
||||
}
|
||||
|
||||
function useNProgress(currentProgress = null, options) {
|
||||
const progress = shared.toRef(currentProgress);
|
||||
const isLoading = vue.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);
|
||||
};
|
||||
vue.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 = vue.shallowRef("");
|
||||
vue.watch(
|
||||
src,
|
||||
async (value) => {
|
||||
if (src.value && shared.isClient)
|
||||
result.value = await QRCode.toDataURL(value, options);
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
function useSortable(el, list, options = {}) {
|
||||
let sortable;
|
||||
const { document = core.defaultDocument, ...resetOptions } = options;
|
||||
const defaultOptions = {
|
||||
onUpdate: (e) => {
|
||||
moveArrayElement(list, e.oldIndex, e.newIndex, e);
|
||||
}
|
||||
};
|
||||
const start = () => {
|
||||
const target = typeof el === "string" ? document == null ? void 0 : document.querySelector(el) : core.unrefElement(el);
|
||||
if (!target || sortable !== void 0)
|
||||
return;
|
||||
sortable = new Sortable(target, { ...defaultOptions, ...resetOptions });
|
||||
};
|
||||
const stop = () => {
|
||||
sortable == null ? void 0 : sortable.destroy();
|
||||
sortable = void 0;
|
||||
};
|
||||
const option = (name, value) => {
|
||||
if (value !== void 0)
|
||||
sortable == null ? void 0 : sortable.option(name, value);
|
||||
else
|
||||
return sortable == null ? void 0 : sortable.option(name);
|
||||
};
|
||||
core.tryOnMounted(start);
|
||||
core.tryOnScopeDispose(stop);
|
||||
return {
|
||||
stop,
|
||||
start,
|
||||
option
|
||||
};
|
||||
}
|
||||
function insertNodeAt(parentElement, element, index) {
|
||||
const refElement = parentElement.children[index];
|
||||
parentElement.insertBefore(element, refElement);
|
||||
}
|
||||
function removeNode(node) {
|
||||
if (node.parentNode)
|
||||
node.parentNode.removeChild(node);
|
||||
}
|
||||
function moveArrayElement(list, from, to, e = null) {
|
||||
if (e != null) {
|
||||
removeNode(e.item);
|
||||
insertNodeAt(e.from, e.item, from);
|
||||
}
|
||||
const _valueIsRef = vue.isRef(list);
|
||||
const array = _valueIsRef ? [...vue.toValue(list)] : vue.toValue(list);
|
||||
if (to >= 0 && to < array.length) {
|
||||
const element = array.splice(from, 1)[0];
|
||||
vue.nextTick(() => {
|
||||
array.splice(to, 0, element);
|
||||
if (_valueIsRef)
|
||||
list.value = array;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
exports.createCookies = createCookies;
|
||||
exports.insertNodeAt = insertNodeAt;
|
||||
exports.moveArrayElement = moveArrayElement;
|
||||
exports.removeNode = removeNode;
|
||||
exports.useAsyncValidator = useAsyncValidator;
|
||||
exports.useAxios = useAxios;
|
||||
exports.useChangeCase = useChangeCase;
|
||||
exports.useCookies = useCookies;
|
||||
exports.useDrauu = useDrauu;
|
||||
exports.useFocusTrap = useFocusTrap;
|
||||
exports.useFuse = useFuse;
|
||||
exports.useIDBKeyval = useIDBKeyval;
|
||||
exports.useJwt = useJwt;
|
||||
exports.useNProgress = useNProgress;
|
||||
exports.useQRCode = useQRCode;
|
||||
exports.useSortable = useSortable;
|
||||
|
||||
})(this.VueUse = this.VueUse || {}, VueUse, AsyncValidator, Vue, axios, changeCase, UniversalCookie, VueUse, Drauu, focusTrap, Fuse, idbKeyval, jwt_decode, nprogress, QRCode, Sortable);
|
||||
1
node_modules/@vueuse/integrations/index.iife.min.js
generated
vendored
Normal file
1
node_modules/@vueuse/integrations/index.iife.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
667
node_modules/@vueuse/integrations/index.mjs
generated
vendored
Normal file
667
node_modules/@vueuse/integrations/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,667 @@
|
||||
import { toRef, until, noop, tryOnScopeDispose, notNullish, isClient } from '@vueuse/shared';
|
||||
import Schema from 'async-validator';
|
||||
import { shallowRef, computed, toValue, watch, ref, toRaw, watchEffect, isRef, nextTick } from 'vue';
|
||||
import axios, { AxiosError } from 'axios';
|
||||
import * as changeCase from 'change-case';
|
||||
import Cookie from 'universal-cookie';
|
||||
import { createEventHook, unrefElement, toArray, tryOnScopeDispose as tryOnScopeDispose$1, watchPausable, defaultDocument, tryOnMounted } from '@vueuse/core';
|
||||
import { createDrauu } from 'drauu';
|
||||
import { createFocusTrap } from 'focus-trap';
|
||||
import Fuse from 'fuse.js';
|
||||
import { get, set, del, update } from 'idb-keyval';
|
||||
import { jwtDecode } from 'jwt-decode';
|
||||
import nprogress from 'nprogress';
|
||||
import QRCode from 'qrcode';
|
||||
import Sortable from 'sortablejs';
|
||||
|
||||
const AsyncValidatorSchema = Schema.default || Schema;
|
||||
function useAsyncValidator(value, rules, options = {}) {
|
||||
const {
|
||||
validateOption = {},
|
||||
immediate = true,
|
||||
manual = false
|
||||
} = options;
|
||||
const valueRef = toRef(value);
|
||||
const errorInfo = shallowRef(null);
|
||||
const isFinished = shallowRef(true);
|
||||
const pass = shallowRef(!immediate || manual);
|
||||
const errors = computed(() => {
|
||||
var _a;
|
||||
return ((_a = errorInfo.value) == null ? void 0 : _a.errors) || [];
|
||||
});
|
||||
const errorFields = computed(() => {
|
||||
var _a;
|
||||
return ((_a = errorInfo.value) == null ? void 0 : _a.fields) || {};
|
||||
});
|
||||
const validator = computed(() => new AsyncValidatorSchema(toValue(rules)));
|
||||
const execute = async () => {
|
||||
isFinished.value = false;
|
||||
pass.value = false;
|
||||
try {
|
||||
await validator.value.validate(valueRef.value, validateOption);
|
||||
pass.value = true;
|
||||
errorInfo.value = null;
|
||||
} catch (err) {
|
||||
errorInfo.value = err;
|
||||
} finally {
|
||||
isFinished.value = true;
|
||||
}
|
||||
return {
|
||||
pass: pass.value,
|
||||
errorInfo: errorInfo.value,
|
||||
errors: errors.value,
|
||||
errorFields: errorFields.value
|
||||
};
|
||||
};
|
||||
if (!manual) {
|
||||
watch(
|
||||
[valueRef, validator],
|
||||
() => execute(),
|
||||
{ immediate, deep: true }
|
||||
);
|
||||
}
|
||||
const shell = {
|
||||
isFinished,
|
||||
pass,
|
||||
errors,
|
||||
errorInfo,
|
||||
errorFields,
|
||||
execute
|
||||
};
|
||||
function waitUntilFinished() {
|
||||
return new Promise((resolve, reject) => {
|
||||
until(isFinished).toBe(true).then(() => resolve(shell)).catch((error) => reject(error));
|
||||
});
|
||||
}
|
||||
return {
|
||||
...shell,
|
||||
then(onFulfilled, onRejected) {
|
||||
return waitUntilFinished().then(onFulfilled, onRejected);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function useAxios(...args) {
|
||||
const url = typeof args[0] === "string" ? args[0] : void 0;
|
||||
const argsPlaceholder = typeof url === "string" ? 1 : 0;
|
||||
const defaultOptions = {
|
||||
immediate: !!argsPlaceholder,
|
||||
shallow: true,
|
||||
abortPrevious: true
|
||||
};
|
||||
let defaultConfig = {};
|
||||
let instance = axios;
|
||||
let options = defaultOptions;
|
||||
const isAxiosInstance = (val) => !!(val == null ? void 0 : val.request);
|
||||
if (args.length > 0 + argsPlaceholder) {
|
||||
if (isAxiosInstance(args[0 + argsPlaceholder]))
|
||||
instance = args[0 + argsPlaceholder];
|
||||
else
|
||||
defaultConfig = args[0 + argsPlaceholder];
|
||||
}
|
||||
if (args.length > 1 + argsPlaceholder) {
|
||||
if (isAxiosInstance(args[1 + argsPlaceholder]))
|
||||
instance = args[1 + argsPlaceholder];
|
||||
}
|
||||
if (args.length === 2 + argsPlaceholder && !isAxiosInstance(args[1 + argsPlaceholder]) || args.length === 3 + argsPlaceholder) {
|
||||
options = args[args.length - 1] || defaultOptions;
|
||||
}
|
||||
const {
|
||||
shallow,
|
||||
onSuccess = noop,
|
||||
onError = noop,
|
||||
immediate,
|
||||
resetOnExecute = false
|
||||
} = options;
|
||||
const initialData = options.initialData;
|
||||
const response = shallowRef();
|
||||
const data = (shallow ? shallowRef : ref)(initialData);
|
||||
const isFinished = shallowRef(false);
|
||||
const isLoading = shallowRef(false);
|
||||
const isAborted = shallowRef(false);
|
||||
const error = shallowRef();
|
||||
let abortController = new AbortController();
|
||||
const abort = (message) => {
|
||||
if (isFinished.value || !isLoading.value)
|
||||
return;
|
||||
abortController.abort(message);
|
||||
abortController = new AbortController();
|
||||
isAborted.value = true;
|
||||
isLoading.value = false;
|
||||
isFinished.value = false;
|
||||
};
|
||||
const loading = (loading2) => {
|
||||
isLoading.value = loading2;
|
||||
isFinished.value = !loading2;
|
||||
};
|
||||
const resetData = () => {
|
||||
if (resetOnExecute)
|
||||
data.value = initialData;
|
||||
};
|
||||
const waitUntilFinished = () => new Promise((resolve, reject) => {
|
||||
until(isFinished).toBe(true).then(() => error.value ? reject(error.value) : resolve(result));
|
||||
});
|
||||
const promise = {
|
||||
then: (...args2) => waitUntilFinished().then(...args2),
|
||||
catch: (...args2) => waitUntilFinished().catch(...args2)
|
||||
};
|
||||
let executeCounter = 0;
|
||||
const execute = (executeUrl = url, config = {}) => {
|
||||
error.value = void 0;
|
||||
const _url = typeof executeUrl === "string" ? executeUrl : url != null ? url : config.url;
|
||||
if (_url === void 0) {
|
||||
error.value = new AxiosError(AxiosError.ERR_INVALID_URL);
|
||||
isFinished.value = true;
|
||||
return promise;
|
||||
}
|
||||
resetData();
|
||||
if (options.abortPrevious !== false)
|
||||
abort();
|
||||
loading(true);
|
||||
executeCounter += 1;
|
||||
const currentExecuteCounter = executeCounter;
|
||||
isAborted.value = false;
|
||||
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, signal: abortController.signal }).then((r) => {
|
||||
if (isAborted.value)
|
||||
return;
|
||||
response.value = r;
|
||||
const result2 = r.data;
|
||||
data.value = result2;
|
||||
onSuccess(result2);
|
||||
}).catch((e) => {
|
||||
error.value = e;
|
||||
onError(e);
|
||||
}).finally(() => {
|
||||
var _a;
|
||||
(_a = options.onFinish) == null ? void 0 : _a.call(options);
|
||||
if (currentExecuteCounter === executeCounter)
|
||||
loading(false);
|
||||
});
|
||||
return promise;
|
||||
};
|
||||
if (immediate && url)
|
||||
execute();
|
||||
const result = {
|
||||
response,
|
||||
data,
|
||||
error,
|
||||
isFinished,
|
||||
isLoading,
|
||||
cancel: abort,
|
||||
isAborted,
|
||||
isCanceled: isAborted,
|
||||
abort,
|
||||
execute
|
||||
};
|
||||
return {
|
||||
...result,
|
||||
...promise
|
||||
};
|
||||
}
|
||||
|
||||
const changeCaseTransforms = /* @__PURE__ */ Object.entries(changeCase).filter(([name, fn]) => typeof fn === "function" && name.endsWith("Case")).reduce((acc, [name, fn]) => {
|
||||
acc[name] = fn;
|
||||
return acc;
|
||||
}, {});
|
||||
function useChangeCase(input, type, options) {
|
||||
const typeRef = computed(() => {
|
||||
const t = toValue(type);
|
||||
if (!changeCaseTransforms[t])
|
||||
throw new Error(`Invalid change case type "${t}"`);
|
||||
return t;
|
||||
});
|
||||
if (typeof input === "function")
|
||||
return computed(() => changeCaseTransforms[typeRef.value](toValue(input), toValue(options)));
|
||||
const text = ref(input);
|
||||
return computed({
|
||||
get() {
|
||||
return changeCaseTransforms[typeRef.value](text.value, toValue(options));
|
||||
},
|
||||
set(value) {
|
||||
text.value = value;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function createCookies(req) {
|
||||
const universalCookie = new Cookie(req ? req.headers.cookie : null);
|
||||
return (dependencies, { doNotParse = false, autoUpdateDependencies = false } = {}) => useCookies(dependencies, { doNotParse, autoUpdateDependencies }, universalCookie);
|
||||
}
|
||||
function useCookies(dependencies, { doNotParse = false, autoUpdateDependencies = false } = {}, cookies = new Cookie()) {
|
||||
const watchingDependencies = autoUpdateDependencies ? [...dependencies || []] : dependencies;
|
||||
let previousCookies = cookies.getAll({ doNotParse: true });
|
||||
const touches = shallowRef(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 = shallowRef(false);
|
||||
const canRedo = shallowRef(false);
|
||||
const altPressed = shallowRef(false);
|
||||
const shiftPressed = shallowRef(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 = shallowRef(false);
|
||||
const isPaused = shallowRef(false);
|
||||
const activate = (opts) => trap && trap.activate(opts);
|
||||
const deactivate = (opts) => trap && trap.deactivate(opts);
|
||||
const pause = () => {
|
||||
if (trap) {
|
||||
trap.pause();
|
||||
isPaused.value = true;
|
||||
}
|
||||
};
|
||||
const unpause = () => {
|
||||
if (trap) {
|
||||
trap.unpause();
|
||||
isPaused.value = false;
|
||||
}
|
||||
};
|
||||
const targets = computed(() => {
|
||||
const _targets = toValue(target);
|
||||
return toArray(_targets).map((el) => {
|
||||
const _el = toValue(el);
|
||||
return typeof _el === "string" ? _el : unrefElement(_el);
|
||||
}).filter(notNullish);
|
||||
});
|
||||
watch(
|
||||
targets,
|
||||
(els) => {
|
||||
if (!els.length)
|
||||
return;
|
||||
trap = createFocusTrap(els, {
|
||||
...focusTrapOptions,
|
||||
onActivate() {
|
||||
hasFocus.value = true;
|
||||
if (options.onActivate)
|
||||
options.onActivate();
|
||||
},
|
||||
onDeactivate() {
|
||||
hasFocus.value = false;
|
||||
if (options.onDeactivate)
|
||||
options.onDeactivate();
|
||||
}
|
||||
});
|
||||
if (immediate)
|
||||
activate();
|
||||
},
|
||||
{ flush: "post" }
|
||||
);
|
||||
tryOnScopeDispose$1(() => deactivate());
|
||||
return {
|
||||
hasFocus,
|
||||
isPaused,
|
||||
activate,
|
||||
deactivate,
|
||||
pause,
|
||||
unpause
|
||||
};
|
||||
}
|
||||
|
||||
function useFuse(search, data, options) {
|
||||
const createFuse = () => {
|
||||
var _a, _b;
|
||||
return new Fuse(
|
||||
(_a = toValue(data)) != null ? _a : [],
|
||||
(_b = toValue(options)) == null ? void 0 : _b.fuseOptions
|
||||
);
|
||||
};
|
||||
const fuse = ref(createFuse());
|
||||
watch(
|
||||
() => {
|
||||
var _a;
|
||||
return (_a = toValue(options)) == null ? void 0 : _a.fuseOptions;
|
||||
},
|
||||
() => {
|
||||
fuse.value = createFuse();
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
watch(
|
||||
() => toValue(data),
|
||||
(newData) => {
|
||||
fuse.value.setCollection(newData);
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
const results = computed(() => {
|
||||
const resolved = toValue(options);
|
||||
if ((resolved == null ? void 0 : resolved.matchAllWhenSearchEmpty) && !toValue(search))
|
||||
return toValue(data).map((item, index) => ({ item, refIndex: index }));
|
||||
const limit = resolved == null ? void 0 : resolved.resultLimit;
|
||||
return fuse.value.search(toValue(search), limit ? { limit } : void 0);
|
||||
});
|
||||
return {
|
||||
fuse,
|
||||
results
|
||||
};
|
||||
}
|
||||
|
||||
function useIDBKeyval(key, initialValue, options = {}) {
|
||||
const {
|
||||
flush = "pre",
|
||||
deep = true,
|
||||
shallow = false,
|
||||
onError = (e) => {
|
||||
console.error(e);
|
||||
},
|
||||
writeDefaults = true
|
||||
} = options;
|
||||
const isFinished = shallowRef(false);
|
||||
const data = (shallow ? shallowRef : ref)(initialValue);
|
||||
const rawInit = toValue(initialValue);
|
||||
async function read() {
|
||||
try {
|
||||
const rawValue = await get(key);
|
||||
if (rawValue === void 0) {
|
||||
if (rawInit !== void 0 && rawInit !== null && writeDefaults)
|
||||
await set(key, rawInit);
|
||||
} else {
|
||||
data.value = rawValue;
|
||||
}
|
||||
} catch (e) {
|
||||
onError(e);
|
||||
}
|
||||
isFinished.value = true;
|
||||
}
|
||||
read();
|
||||
async function write() {
|
||||
try {
|
||||
if (data.value == null) {
|
||||
await del(key);
|
||||
} else {
|
||||
await update(key, () => toRaw(data.value));
|
||||
}
|
||||
} catch (e) {
|
||||
onError(e);
|
||||
}
|
||||
}
|
||||
const {
|
||||
pause: pauseWatch,
|
||||
resume: resumeWatch
|
||||
} = watchPausable(data, () => write(), { flush, deep });
|
||||
async function setData(value) {
|
||||
pauseWatch();
|
||||
data.value = value;
|
||||
await write();
|
||||
resumeWatch();
|
||||
}
|
||||
return {
|
||||
set: setData,
|
||||
isFinished,
|
||||
data
|
||||
};
|
||||
}
|
||||
|
||||
function useJwt(encodedJwt, options = {}) {
|
||||
const {
|
||||
onError,
|
||||
fallbackValue = null
|
||||
} = options;
|
||||
const decodeWithFallback = (encodedJwt2, options2) => {
|
||||
try {
|
||||
return jwtDecode(encodedJwt2, options2);
|
||||
} catch (err) {
|
||||
onError == null ? void 0 : onError(err);
|
||||
return fallbackValue;
|
||||
}
|
||||
};
|
||||
const header = computed(() => decodeWithFallback(toValue(encodedJwt), { header: true }));
|
||||
const payload = computed(() => decodeWithFallback(toValue(encodedJwt)));
|
||||
return {
|
||||
header,
|
||||
payload
|
||||
};
|
||||
}
|
||||
|
||||
function useNProgress(currentProgress = null, options) {
|
||||
const progress = toRef(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 = shallowRef("");
|
||||
watch(
|
||||
src,
|
||||
async (value) => {
|
||||
if (src.value && isClient)
|
||||
result.value = await QRCode.toDataURL(value, options);
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
function useSortable(el, list, options = {}) {
|
||||
let sortable;
|
||||
const { document = defaultDocument, ...resetOptions } = options;
|
||||
const defaultOptions = {
|
||||
onUpdate: (e) => {
|
||||
moveArrayElement(list, e.oldIndex, e.newIndex, e);
|
||||
}
|
||||
};
|
||||
const start = () => {
|
||||
const target = typeof el === "string" ? document == null ? void 0 : document.querySelector(el) : unrefElement(el);
|
||||
if (!target || sortable !== void 0)
|
||||
return;
|
||||
sortable = new Sortable(target, { ...defaultOptions, ...resetOptions });
|
||||
};
|
||||
const stop = () => {
|
||||
sortable == null ? void 0 : sortable.destroy();
|
||||
sortable = void 0;
|
||||
};
|
||||
const option = (name, value) => {
|
||||
if (value !== void 0)
|
||||
sortable == null ? void 0 : sortable.option(name, value);
|
||||
else
|
||||
return sortable == null ? void 0 : sortable.option(name);
|
||||
};
|
||||
tryOnMounted(start);
|
||||
tryOnScopeDispose$1(stop);
|
||||
return {
|
||||
stop,
|
||||
start,
|
||||
option
|
||||
};
|
||||
}
|
||||
function insertNodeAt(parentElement, element, index) {
|
||||
const refElement = parentElement.children[index];
|
||||
parentElement.insertBefore(element, refElement);
|
||||
}
|
||||
function removeNode(node) {
|
||||
if (node.parentNode)
|
||||
node.parentNode.removeChild(node);
|
||||
}
|
||||
function moveArrayElement(list, from, to, e = null) {
|
||||
if (e != null) {
|
||||
removeNode(e.item);
|
||||
insertNodeAt(e.from, e.item, from);
|
||||
}
|
||||
const _valueIsRef = isRef(list);
|
||||
const array = _valueIsRef ? [...toValue(list)] : toValue(list);
|
||||
if (to >= 0 && to < array.length) {
|
||||
const element = array.splice(from, 1)[0];
|
||||
nextTick(() => {
|
||||
array.splice(to, 0, element);
|
||||
if (_valueIsRef)
|
||||
list.value = array;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export { createCookies, insertNodeAt, moveArrayElement, removeNode, useAsyncValidator, useAxios, useChangeCase, useCookies, useDrauu, useFocusTrap, useFuse, useIDBKeyval, useJwt, useNProgress, useQRCode, useSortable };
|
||||
181
node_modules/@vueuse/integrations/package.json
generated
vendored
Normal file
181
node_modules/@vueuse/integrations/package.json
generated
vendored
Normal file
@@ -0,0 +1,181 @@
|
||||
{
|
||||
"name": "@vueuse/integrations",
|
||||
"type": "module",
|
||||
"version": "12.8.2",
|
||||
"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.ts",
|
||||
"files": [
|
||||
"**/*.cjs",
|
||||
"**/*.d.cts",
|
||||
"**/*.d.mts",
|
||||
"**/*.d.ts",
|
||||
"**/*.js",
|
||||
"**/*.mjs"
|
||||
],
|
||||
"peerDependencies": {
|
||||
"async-validator": "^4",
|
||||
"axios": "^1",
|
||||
"change-case": "^5",
|
||||
"drauu": "^0.4",
|
||||
"focus-trap": "^7",
|
||||
"fuse.js": "^7",
|
||||
"idb-keyval": "^6",
|
||||
"jwt-decode": "^4",
|
||||
"nprogress": "^0.2",
|
||||
"qrcode": "^1.5",
|
||||
"sortablejs": "^1",
|
||||
"universal-cookie": "^7"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"async-validator": {
|
||||
"optional": true
|
||||
},
|
||||
"axios": {
|
||||
"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
|
||||
},
|
||||
"sortablejs": {
|
||||
"optional": true
|
||||
},
|
||||
"universal-cookie": {
|
||||
"optional": true
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"vue": "^3.5.13",
|
||||
"@vueuse/core": "12.8.2",
|
||||
"@vueuse/shared": "12.8.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/nprogress": "^0.2.3",
|
||||
"@types/qrcode": "^1.5.5",
|
||||
"@types/sortablejs": "^1.15.8",
|
||||
"async-validator": "^4.2.5",
|
||||
"axios": "^1.8.1",
|
||||
"change-case": "^5.4.4",
|
||||
"drauu": "^0.4.3",
|
||||
"focus-trap": "^7.6.4",
|
||||
"fuse.js": "^7.1.0",
|
||||
"idb-keyval": "^6.2.1",
|
||||
"jwt-decode": "^4.0.0",
|
||||
"nprogress": "^0.2.0",
|
||||
"qrcode": "^1.5.4",
|
||||
"sortablejs": "^1.15.6",
|
||||
"universal-cookie": "^7.2.2"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rollup --config=rollup.config.ts --configPlugin=rollup-plugin-esbuild"
|
||||
}
|
||||
}
|
||||
74
node_modules/@vueuse/integrations/useAsyncValidator.cjs
generated
vendored
Normal file
74
node_modules/@vueuse/integrations/useAsyncValidator.cjs
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
'use strict';
|
||||
|
||||
var shared = require('@vueuse/shared');
|
||||
var Schema = require('async-validator');
|
||||
var vue = require('vue');
|
||||
|
||||
const AsyncValidatorSchema = Schema.default || Schema;
|
||||
function useAsyncValidator(value, rules, options = {}) {
|
||||
const {
|
||||
validateOption = {},
|
||||
immediate = true,
|
||||
manual = false
|
||||
} = options;
|
||||
const valueRef = shared.toRef(value);
|
||||
const errorInfo = vue.shallowRef(null);
|
||||
const isFinished = vue.shallowRef(true);
|
||||
const pass = vue.shallowRef(!immediate || manual);
|
||||
const errors = vue.computed(() => {
|
||||
var _a;
|
||||
return ((_a = errorInfo.value) == null ? void 0 : _a.errors) || [];
|
||||
});
|
||||
const errorFields = vue.computed(() => {
|
||||
var _a;
|
||||
return ((_a = errorInfo.value) == null ? void 0 : _a.fields) || {};
|
||||
});
|
||||
const validator = vue.computed(() => new AsyncValidatorSchema(vue.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) {
|
||||
vue.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;
|
||||
47
node_modules/@vueuse/integrations/useAsyncValidator.d.cts
generated
vendored
Normal file
47
node_modules/@vueuse/integrations/useAsyncValidator.d.cts
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
import { ValidateError, ValidateOption, Rules } from 'async-validator';
|
||||
import { ShallowRef, ComputedRef, MaybeRefOrGetter } from 'vue';
|
||||
|
||||
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: ShallowRef<boolean>;
|
||||
isFinished: ShallowRef<boolean>;
|
||||
errors: ComputedRef<AsyncValidatorError['errors'] | undefined>;
|
||||
errorInfo: ShallowRef<AsyncValidatorError | null>;
|
||||
errorFields: ComputedRef<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 };
|
||||
47
node_modules/@vueuse/integrations/useAsyncValidator.d.mts
generated
vendored
Normal file
47
node_modules/@vueuse/integrations/useAsyncValidator.d.mts
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
import { ValidateError, ValidateOption, Rules } from 'async-validator';
|
||||
import { ShallowRef, ComputedRef, MaybeRefOrGetter } from 'vue';
|
||||
|
||||
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: ShallowRef<boolean>;
|
||||
isFinished: ShallowRef<boolean>;
|
||||
errors: ComputedRef<AsyncValidatorError['errors'] | undefined>;
|
||||
errorInfo: ShallowRef<AsyncValidatorError | null>;
|
||||
errorFields: ComputedRef<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 };
|
||||
47
node_modules/@vueuse/integrations/useAsyncValidator.d.ts
generated
vendored
Normal file
47
node_modules/@vueuse/integrations/useAsyncValidator.d.ts
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
import { ValidateError, ValidateOption, Rules } from 'async-validator';
|
||||
import { ShallowRef, ComputedRef, MaybeRefOrGetter } from 'vue';
|
||||
|
||||
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: ShallowRef<boolean>;
|
||||
isFinished: ShallowRef<boolean>;
|
||||
errors: ComputedRef<AsyncValidatorError['errors'] | undefined>;
|
||||
errorInfo: ShallowRef<AsyncValidatorError | null>;
|
||||
errorFields: ComputedRef<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 };
|
||||
73
node_modules/@vueuse/integrations/useAsyncValidator.iife.js
generated
vendored
Normal file
73
node_modules/@vueuse/integrations/useAsyncValidator.iife.js
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
(function (exports, shared, Schema, vue) {
|
||||
'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 = vue.shallowRef(null);
|
||||
const isFinished = vue.shallowRef(true);
|
||||
const pass = vue.shallowRef(!immediate || manual);
|
||||
const errors = vue.computed(() => {
|
||||
var _a;
|
||||
return ((_a = errorInfo.value) == null ? void 0 : _a.errors) || [];
|
||||
});
|
||||
const errorFields = vue.computed(() => {
|
||||
var _a;
|
||||
return ((_a = errorInfo.value) == null ? void 0 : _a.fields) || {};
|
||||
});
|
||||
const validator = vue.computed(() => new AsyncValidatorSchema(vue.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) {
|
||||
vue.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, Vue);
|
||||
1
node_modules/@vueuse/integrations/useAsyncValidator.iife.min.js
generated
vendored
Normal file
1
node_modules/@vueuse/integrations/useAsyncValidator.iife.min.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
(function(w,s,u,t){"use strict";const m=u.default||u;function p(y,R,A={}){const{validateOption:F={},immediate:o=!0,manual:i=!1}=A,c=s.toRef(y),a=t.shallowRef(null),l=t.shallowRef(!0),r=t.shallowRef(!o||i),d=t.computed(()=>{var e;return((e=a.value)==null?void 0:e.errors)||[]}),f=t.computed(()=>{var e;return((e=a.value)==null?void 0:e.fields)||{}}),v=t.computed(()=>new m(t.toValue(R))),h=async()=>{l.value=!1,r.value=!1;try{await v.value.validate(c.value,F),r.value=!0,a.value=null}catch(e){a.value=e}finally{l.value=!0}return{pass:r.value,errorInfo:a.value,errors:d.value,errorFields:f.value}};i||t.watch([c,v],()=>h(),{immediate:o,deep:!0});const V={isFinished:l,pass:r,errors:d,errorInfo:a,errorFields:f,execute:h};function U(){return new Promise((e,n)=>{s.until(l).toBe(!0).then(()=>e(V)).catch(I=>n(I))})}return{...V,then(e,n){return U().then(e,n)}}}w.useAsyncValidator=p})(this.VueUse=this.VueUse||{},VueUse,AsyncValidator,Vue);
|
||||
72
node_modules/@vueuse/integrations/useAsyncValidator.mjs
generated
vendored
Normal file
72
node_modules/@vueuse/integrations/useAsyncValidator.mjs
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
import { toRef, until } from '@vueuse/shared';
|
||||
import Schema from 'async-validator';
|
||||
import { shallowRef, computed, toValue, watch } from 'vue';
|
||||
|
||||
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 = shallowRef(true);
|
||||
const pass = shallowRef(!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 };
|
||||
89
node_modules/@vueuse/integrations/useAsyncValidator/component.cjs
generated
vendored
Normal file
89
node_modules/@vueuse/integrations/useAsyncValidator/component.cjs
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
'use strict';
|
||||
|
||||
var vue = require('vue');
|
||||
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 = vue.shallowRef(null);
|
||||
const isFinished = vue.shallowRef(true);
|
||||
const pass = vue.shallowRef(!immediate || manual);
|
||||
const errors = vue.computed(() => errorInfo.value?.errors || []);
|
||||
const errorFields = vue.computed(() => errorInfo.value?.fields || {});
|
||||
const validator = vue.computed(() => new AsyncValidatorSchema(vue.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) {
|
||||
vue.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__*/ vue.defineComponent({
|
||||
name: "UseAsyncValidator",
|
||||
props: {
|
||||
form: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
rules: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
setup(props, { slots }) {
|
||||
const data = vue.reactive(useAsyncValidator(props.form, props.rules));
|
||||
return () => {
|
||||
if (slots.default)
|
||||
return slots.default(data);
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
exports.UseAsyncValidator = UseAsyncValidator;
|
||||
27
node_modules/@vueuse/integrations/useAsyncValidator/component.d.cts
generated
vendored
Normal file
27
node_modules/@vueuse/integrations/useAsyncValidator/component.d.cts
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import * as vue from 'vue';
|
||||
import { PropType } from 'vue';
|
||||
import { Rules } from 'async-validator';
|
||||
|
||||
declare const UseAsyncValidator: vue.DefineComponent<vue.ExtractPropTypes<{
|
||||
form: {
|
||||
type: PropType<Record<string, any>>;
|
||||
required: true;
|
||||
};
|
||||
rules: {
|
||||
type: PropType<Rules>;
|
||||
required: true;
|
||||
};
|
||||
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
||||
[key: string]: any;
|
||||
}>[] | undefined, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
||||
form: {
|
||||
type: PropType<Record<string, any>>;
|
||||
required: true;
|
||||
};
|
||||
rules: {
|
||||
type: PropType<Rules>;
|
||||
required: true;
|
||||
};
|
||||
}>> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
||||
|
||||
export { UseAsyncValidator };
|
||||
27
node_modules/@vueuse/integrations/useAsyncValidator/component.d.mts
generated
vendored
Normal file
27
node_modules/@vueuse/integrations/useAsyncValidator/component.d.mts
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import * as vue from 'vue';
|
||||
import { PropType } from 'vue';
|
||||
import { Rules } from 'async-validator';
|
||||
|
||||
declare const UseAsyncValidator: vue.DefineComponent<vue.ExtractPropTypes<{
|
||||
form: {
|
||||
type: PropType<Record<string, any>>;
|
||||
required: true;
|
||||
};
|
||||
rules: {
|
||||
type: PropType<Rules>;
|
||||
required: true;
|
||||
};
|
||||
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
||||
[key: string]: any;
|
||||
}>[] | undefined, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
||||
form: {
|
||||
type: PropType<Record<string, any>>;
|
||||
required: true;
|
||||
};
|
||||
rules: {
|
||||
type: PropType<Rules>;
|
||||
required: true;
|
||||
};
|
||||
}>> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
||||
|
||||
export { UseAsyncValidator };
|
||||
27
node_modules/@vueuse/integrations/useAsyncValidator/component.d.ts
generated
vendored
Normal file
27
node_modules/@vueuse/integrations/useAsyncValidator/component.d.ts
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import * as vue from 'vue';
|
||||
import { PropType } from 'vue';
|
||||
import { Rules } from 'async-validator';
|
||||
|
||||
declare const UseAsyncValidator: vue.DefineComponent<vue.ExtractPropTypes<{
|
||||
form: {
|
||||
type: PropType<Record<string, any>>;
|
||||
required: true;
|
||||
};
|
||||
rules: {
|
||||
type: PropType<Rules>;
|
||||
required: true;
|
||||
};
|
||||
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
||||
[key: string]: any;
|
||||
}>[] | undefined, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
||||
form: {
|
||||
type: PropType<Record<string, any>>;
|
||||
required: true;
|
||||
};
|
||||
rules: {
|
||||
type: PropType<Rules>;
|
||||
required: true;
|
||||
};
|
||||
}>> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
||||
|
||||
export { UseAsyncValidator };
|
||||
87
node_modules/@vueuse/integrations/useAsyncValidator/component.mjs
generated
vendored
Normal file
87
node_modules/@vueuse/integrations/useAsyncValidator/component.mjs
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
import { shallowRef, computed, toValue, watch, defineComponent, reactive } from 'vue';
|
||||
import { toRef, 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 = shallowRef(true);
|
||||
const pass = shallowRef(!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 };
|
||||
125
node_modules/@vueuse/integrations/useAxios.cjs
generated
vendored
Normal file
125
node_modules/@vueuse/integrations/useAxios.cjs
generated
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
'use strict';
|
||||
|
||||
var shared = require('@vueuse/shared');
|
||||
var axios = require('axios');
|
||||
var vue = require('vue');
|
||||
|
||||
function useAxios(...args) {
|
||||
const url = typeof args[0] === "string" ? args[0] : void 0;
|
||||
const argsPlaceholder = typeof url === "string" ? 1 : 0;
|
||||
const defaultOptions = {
|
||||
immediate: !!argsPlaceholder,
|
||||
shallow: true,
|
||||
abortPrevious: true
|
||||
};
|
||||
let defaultConfig = {};
|
||||
let instance = axios;
|
||||
let options = defaultOptions;
|
||||
const isAxiosInstance = (val) => !!(val == null ? void 0 : val.request);
|
||||
if (args.length > 0 + argsPlaceholder) {
|
||||
if (isAxiosInstance(args[0 + argsPlaceholder]))
|
||||
instance = args[0 + argsPlaceholder];
|
||||
else
|
||||
defaultConfig = args[0 + argsPlaceholder];
|
||||
}
|
||||
if (args.length > 1 + argsPlaceholder) {
|
||||
if (isAxiosInstance(args[1 + argsPlaceholder]))
|
||||
instance = args[1 + argsPlaceholder];
|
||||
}
|
||||
if (args.length === 2 + argsPlaceholder && !isAxiosInstance(args[1 + argsPlaceholder]) || args.length === 3 + argsPlaceholder) {
|
||||
options = args[args.length - 1] || defaultOptions;
|
||||
}
|
||||
const {
|
||||
shallow,
|
||||
onSuccess = shared.noop,
|
||||
onError = shared.noop,
|
||||
immediate,
|
||||
resetOnExecute = false
|
||||
} = options;
|
||||
const initialData = options.initialData;
|
||||
const response = vue.shallowRef();
|
||||
const data = (shallow ? vue.shallowRef : vue.ref)(initialData);
|
||||
const isFinished = vue.shallowRef(false);
|
||||
const isLoading = vue.shallowRef(false);
|
||||
const isAborted = vue.shallowRef(false);
|
||||
const error = vue.shallowRef();
|
||||
let abortController = new AbortController();
|
||||
const abort = (message) => {
|
||||
if (isFinished.value || !isLoading.value)
|
||||
return;
|
||||
abortController.abort(message);
|
||||
abortController = new AbortController();
|
||||
isAborted.value = true;
|
||||
isLoading.value = false;
|
||||
isFinished.value = false;
|
||||
};
|
||||
const loading = (loading2) => {
|
||||
isLoading.value = loading2;
|
||||
isFinished.value = !loading2;
|
||||
};
|
||||
const resetData = () => {
|
||||
if (resetOnExecute)
|
||||
data.value = initialData;
|
||||
};
|
||||
const waitUntilFinished = () => new Promise((resolve, reject) => {
|
||||
shared.until(isFinished).toBe(true).then(() => error.value ? reject(error.value) : resolve(result));
|
||||
});
|
||||
const promise = {
|
||||
then: (...args2) => waitUntilFinished().then(...args2),
|
||||
catch: (...args2) => waitUntilFinished().catch(...args2)
|
||||
};
|
||||
let executeCounter = 0;
|
||||
const execute = (executeUrl = url, config = {}) => {
|
||||
error.value = void 0;
|
||||
const _url = typeof executeUrl === "string" ? executeUrl : url != null ? url : config.url;
|
||||
if (_url === void 0) {
|
||||
error.value = new axios.AxiosError(axios.AxiosError.ERR_INVALID_URL);
|
||||
isFinished.value = true;
|
||||
return promise;
|
||||
}
|
||||
resetData();
|
||||
if (options.abortPrevious !== false)
|
||||
abort();
|
||||
loading(true);
|
||||
executeCounter += 1;
|
||||
const currentExecuteCounter = executeCounter;
|
||||
isAborted.value = false;
|
||||
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, signal: abortController.signal }).then((r) => {
|
||||
if (isAborted.value)
|
||||
return;
|
||||
response.value = r;
|
||||
const result2 = r.data;
|
||||
data.value = result2;
|
||||
onSuccess(result2);
|
||||
}).catch((e) => {
|
||||
error.value = e;
|
||||
onError(e);
|
||||
}).finally(() => {
|
||||
var _a;
|
||||
(_a = options.onFinish) == null ? void 0 : _a.call(options);
|
||||
if (currentExecuteCounter === executeCounter)
|
||||
loading(false);
|
||||
});
|
||||
return promise;
|
||||
};
|
||||
if (immediate && url)
|
||||
execute();
|
||||
const result = {
|
||||
response,
|
||||
data,
|
||||
error,
|
||||
isFinished,
|
||||
isLoading,
|
||||
cancel: abort,
|
||||
isAborted,
|
||||
isCanceled: isAborted,
|
||||
abort,
|
||||
execute
|
||||
};
|
||||
return {
|
||||
...result,
|
||||
...promise
|
||||
};
|
||||
}
|
||||
|
||||
exports.useAxios = useAxios;
|
||||
106
node_modules/@vueuse/integrations/useAxios.d.cts
generated
vendored
Normal file
106
node_modules/@vueuse/integrations/useAxios.d.cts
generated
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
import { AxiosResponse, AxiosRequestConfig, AxiosInstance } from 'axios';
|
||||
import { ShallowRef, Ref } from 'vue';
|
||||
|
||||
interface UseAxiosReturn<T, R = AxiosResponse<T>, _D = any, O extends UseAxiosOptions = UseAxiosOptions<T>> {
|
||||
/**
|
||||
* Axios Response
|
||||
*/
|
||||
response: ShallowRef<R | undefined>;
|
||||
/**
|
||||
* Axios response data
|
||||
*/
|
||||
data: O extends UseAxiosOptionsWithInitialData<T> ? Ref<T> : 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, O extends UseAxiosOptions = UseAxiosOptions<T>> extends UseAxiosReturn<T, R, D, O> {
|
||||
/**
|
||||
* Manually call the axios request
|
||||
*/
|
||||
execute: (url?: string | AxiosRequestConfig<D>, config?: AxiosRequestConfig<D>) => Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
}
|
||||
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 UseAxiosOptionsBase<T = any> {
|
||||
/**
|
||||
* Will automatically run axios request when `useAxios` is used
|
||||
*
|
||||
*/
|
||||
immediate?: boolean;
|
||||
/**
|
||||
* Use shallowRef.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
shallow?: boolean;
|
||||
/**
|
||||
* Abort previous request when a new request is made.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
abortPrevious?: boolean;
|
||||
/**
|
||||
* Callback when error is caught.
|
||||
*/
|
||||
onError?: (e: unknown) => void;
|
||||
/**
|
||||
* Callback when success is caught.
|
||||
*/
|
||||
onSuccess?: (data: T) => void;
|
||||
/**
|
||||
* Sets the state to initialState before executing the promise.
|
||||
*/
|
||||
resetOnExecute?: boolean;
|
||||
/**
|
||||
* Callback when request is finished.
|
||||
*/
|
||||
onFinish?: () => void;
|
||||
}
|
||||
interface UseAxiosOptionsWithInitialData<T> extends UseAxiosOptionsBase<T> {
|
||||
/**
|
||||
* Initial data
|
||||
*/
|
||||
initialData: T;
|
||||
}
|
||||
type UseAxiosOptions<T = any> = UseAxiosOptionsBase<T> | UseAxiosOptionsWithInitialData<T>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsWithInitialData<T> = UseAxiosOptionsWithInitialData<T>>(url: string, config?: AxiosRequestConfig<D>, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsWithInitialData<T> = UseAxiosOptionsWithInitialData<T>>(url: string, instance?: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsWithInitialData<T> = UseAxiosOptionsWithInitialData<T>>(url: string, config: AxiosRequestConfig<D>, instance: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsBase<T> = UseAxiosOptionsBase<T>>(url: string, config?: AxiosRequestConfig<D>, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsBase<T> = UseAxiosOptionsBase<T>>(url: string, instance?: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsBase<T> = UseAxiosOptionsBase<T>>(url: string, config: AxiosRequestConfig<D>, instance: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
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 UseAxiosOptionsBase, type UseAxiosOptionsWithInitialData, type UseAxiosReturn, useAxios };
|
||||
106
node_modules/@vueuse/integrations/useAxios.d.mts
generated
vendored
Normal file
106
node_modules/@vueuse/integrations/useAxios.d.mts
generated
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
import { AxiosResponse, AxiosRequestConfig, AxiosInstance } from 'axios';
|
||||
import { ShallowRef, Ref } from 'vue';
|
||||
|
||||
interface UseAxiosReturn<T, R = AxiosResponse<T>, _D = any, O extends UseAxiosOptions = UseAxiosOptions<T>> {
|
||||
/**
|
||||
* Axios Response
|
||||
*/
|
||||
response: ShallowRef<R | undefined>;
|
||||
/**
|
||||
* Axios response data
|
||||
*/
|
||||
data: O extends UseAxiosOptionsWithInitialData<T> ? Ref<T> : 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, O extends UseAxiosOptions = UseAxiosOptions<T>> extends UseAxiosReturn<T, R, D, O> {
|
||||
/**
|
||||
* Manually call the axios request
|
||||
*/
|
||||
execute: (url?: string | AxiosRequestConfig<D>, config?: AxiosRequestConfig<D>) => Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
}
|
||||
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 UseAxiosOptionsBase<T = any> {
|
||||
/**
|
||||
* Will automatically run axios request when `useAxios` is used
|
||||
*
|
||||
*/
|
||||
immediate?: boolean;
|
||||
/**
|
||||
* Use shallowRef.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
shallow?: boolean;
|
||||
/**
|
||||
* Abort previous request when a new request is made.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
abortPrevious?: boolean;
|
||||
/**
|
||||
* Callback when error is caught.
|
||||
*/
|
||||
onError?: (e: unknown) => void;
|
||||
/**
|
||||
* Callback when success is caught.
|
||||
*/
|
||||
onSuccess?: (data: T) => void;
|
||||
/**
|
||||
* Sets the state to initialState before executing the promise.
|
||||
*/
|
||||
resetOnExecute?: boolean;
|
||||
/**
|
||||
* Callback when request is finished.
|
||||
*/
|
||||
onFinish?: () => void;
|
||||
}
|
||||
interface UseAxiosOptionsWithInitialData<T> extends UseAxiosOptionsBase<T> {
|
||||
/**
|
||||
* Initial data
|
||||
*/
|
||||
initialData: T;
|
||||
}
|
||||
type UseAxiosOptions<T = any> = UseAxiosOptionsBase<T> | UseAxiosOptionsWithInitialData<T>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsWithInitialData<T> = UseAxiosOptionsWithInitialData<T>>(url: string, config?: AxiosRequestConfig<D>, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsWithInitialData<T> = UseAxiosOptionsWithInitialData<T>>(url: string, instance?: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsWithInitialData<T> = UseAxiosOptionsWithInitialData<T>>(url: string, config: AxiosRequestConfig<D>, instance: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsBase<T> = UseAxiosOptionsBase<T>>(url: string, config?: AxiosRequestConfig<D>, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsBase<T> = UseAxiosOptionsBase<T>>(url: string, instance?: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsBase<T> = UseAxiosOptionsBase<T>>(url: string, config: AxiosRequestConfig<D>, instance: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
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 UseAxiosOptionsBase, type UseAxiosOptionsWithInitialData, type UseAxiosReturn, useAxios };
|
||||
106
node_modules/@vueuse/integrations/useAxios.d.ts
generated
vendored
Normal file
106
node_modules/@vueuse/integrations/useAxios.d.ts
generated
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
import { AxiosResponse, AxiosRequestConfig, AxiosInstance } from 'axios';
|
||||
import { ShallowRef, Ref } from 'vue';
|
||||
|
||||
interface UseAxiosReturn<T, R = AxiosResponse<T>, _D = any, O extends UseAxiosOptions = UseAxiosOptions<T>> {
|
||||
/**
|
||||
* Axios Response
|
||||
*/
|
||||
response: ShallowRef<R | undefined>;
|
||||
/**
|
||||
* Axios response data
|
||||
*/
|
||||
data: O extends UseAxiosOptionsWithInitialData<T> ? Ref<T> : 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, O extends UseAxiosOptions = UseAxiosOptions<T>> extends UseAxiosReturn<T, R, D, O> {
|
||||
/**
|
||||
* Manually call the axios request
|
||||
*/
|
||||
execute: (url?: string | AxiosRequestConfig<D>, config?: AxiosRequestConfig<D>) => Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
}
|
||||
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 UseAxiosOptionsBase<T = any> {
|
||||
/**
|
||||
* Will automatically run axios request when `useAxios` is used
|
||||
*
|
||||
*/
|
||||
immediate?: boolean;
|
||||
/**
|
||||
* Use shallowRef.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
shallow?: boolean;
|
||||
/**
|
||||
* Abort previous request when a new request is made.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
abortPrevious?: boolean;
|
||||
/**
|
||||
* Callback when error is caught.
|
||||
*/
|
||||
onError?: (e: unknown) => void;
|
||||
/**
|
||||
* Callback when success is caught.
|
||||
*/
|
||||
onSuccess?: (data: T) => void;
|
||||
/**
|
||||
* Sets the state to initialState before executing the promise.
|
||||
*/
|
||||
resetOnExecute?: boolean;
|
||||
/**
|
||||
* Callback when request is finished.
|
||||
*/
|
||||
onFinish?: () => void;
|
||||
}
|
||||
interface UseAxiosOptionsWithInitialData<T> extends UseAxiosOptionsBase<T> {
|
||||
/**
|
||||
* Initial data
|
||||
*/
|
||||
initialData: T;
|
||||
}
|
||||
type UseAxiosOptions<T = any> = UseAxiosOptionsBase<T> | UseAxiosOptionsWithInitialData<T>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsWithInitialData<T> = UseAxiosOptionsWithInitialData<T>>(url: string, config?: AxiosRequestConfig<D>, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsWithInitialData<T> = UseAxiosOptionsWithInitialData<T>>(url: string, instance?: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsWithInitialData<T> = UseAxiosOptionsWithInitialData<T>>(url: string, config: AxiosRequestConfig<D>, instance: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsBase<T> = UseAxiosOptionsBase<T>>(url: string, config?: AxiosRequestConfig<D>, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsBase<T> = UseAxiosOptionsBase<T>>(url: string, instance?: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsBase<T> = UseAxiosOptionsBase<T>>(url: string, config: AxiosRequestConfig<D>, instance: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
|
||||
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 UseAxiosOptionsBase, type UseAxiosOptionsWithInitialData, type UseAxiosReturn, useAxios };
|
||||
124
node_modules/@vueuse/integrations/useAxios.iife.js
generated
vendored
Normal file
124
node_modules/@vueuse/integrations/useAxios.iife.js
generated
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
(function (exports, shared, axios, vue) {
|
||||
'use strict';
|
||||
|
||||
function useAxios(...args) {
|
||||
const url = typeof args[0] === "string" ? args[0] : void 0;
|
||||
const argsPlaceholder = typeof url === "string" ? 1 : 0;
|
||||
const defaultOptions = {
|
||||
immediate: !!argsPlaceholder,
|
||||
shallow: true,
|
||||
abortPrevious: true
|
||||
};
|
||||
let defaultConfig = {};
|
||||
let instance = axios;
|
||||
let options = defaultOptions;
|
||||
const isAxiosInstance = (val) => !!(val == null ? void 0 : val.request);
|
||||
if (args.length > 0 + argsPlaceholder) {
|
||||
if (isAxiosInstance(args[0 + argsPlaceholder]))
|
||||
instance = args[0 + argsPlaceholder];
|
||||
else
|
||||
defaultConfig = args[0 + argsPlaceholder];
|
||||
}
|
||||
if (args.length > 1 + argsPlaceholder) {
|
||||
if (isAxiosInstance(args[1 + argsPlaceholder]))
|
||||
instance = args[1 + argsPlaceholder];
|
||||
}
|
||||
if (args.length === 2 + argsPlaceholder && !isAxiosInstance(args[1 + argsPlaceholder]) || args.length === 3 + argsPlaceholder) {
|
||||
options = args[args.length - 1] || defaultOptions;
|
||||
}
|
||||
const {
|
||||
shallow,
|
||||
onSuccess = shared.noop,
|
||||
onError = shared.noop,
|
||||
immediate,
|
||||
resetOnExecute = false
|
||||
} = options;
|
||||
const initialData = options.initialData;
|
||||
const response = vue.shallowRef();
|
||||
const data = (shallow ? vue.shallowRef : vue.ref)(initialData);
|
||||
const isFinished = vue.shallowRef(false);
|
||||
const isLoading = vue.shallowRef(false);
|
||||
const isAborted = vue.shallowRef(false);
|
||||
const error = vue.shallowRef();
|
||||
let abortController = new AbortController();
|
||||
const abort = (message) => {
|
||||
if (isFinished.value || !isLoading.value)
|
||||
return;
|
||||
abortController.abort(message);
|
||||
abortController = new AbortController();
|
||||
isAborted.value = true;
|
||||
isLoading.value = false;
|
||||
isFinished.value = false;
|
||||
};
|
||||
const loading = (loading2) => {
|
||||
isLoading.value = loading2;
|
||||
isFinished.value = !loading2;
|
||||
};
|
||||
const resetData = () => {
|
||||
if (resetOnExecute)
|
||||
data.value = initialData;
|
||||
};
|
||||
const waitUntilFinished = () => new Promise((resolve, reject) => {
|
||||
shared.until(isFinished).toBe(true).then(() => error.value ? reject(error.value) : resolve(result));
|
||||
});
|
||||
const promise = {
|
||||
then: (...args2) => waitUntilFinished().then(...args2),
|
||||
catch: (...args2) => waitUntilFinished().catch(...args2)
|
||||
};
|
||||
let executeCounter = 0;
|
||||
const execute = (executeUrl = url, config = {}) => {
|
||||
error.value = void 0;
|
||||
const _url = typeof executeUrl === "string" ? executeUrl : url != null ? url : config.url;
|
||||
if (_url === void 0) {
|
||||
error.value = new axios.AxiosError(axios.AxiosError.ERR_INVALID_URL);
|
||||
isFinished.value = true;
|
||||
return promise;
|
||||
}
|
||||
resetData();
|
||||
if (options.abortPrevious !== false)
|
||||
abort();
|
||||
loading(true);
|
||||
executeCounter += 1;
|
||||
const currentExecuteCounter = executeCounter;
|
||||
isAborted.value = false;
|
||||
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, signal: abortController.signal }).then((r) => {
|
||||
if (isAborted.value)
|
||||
return;
|
||||
response.value = r;
|
||||
const result2 = r.data;
|
||||
data.value = result2;
|
||||
onSuccess(result2);
|
||||
}).catch((e) => {
|
||||
error.value = e;
|
||||
onError(e);
|
||||
}).finally(() => {
|
||||
var _a;
|
||||
(_a = options.onFinish) == null ? void 0 : _a.call(options);
|
||||
if (currentExecuteCounter === executeCounter)
|
||||
loading(false);
|
||||
});
|
||||
return promise;
|
||||
};
|
||||
if (immediate && url)
|
||||
execute();
|
||||
const result = {
|
||||
response,
|
||||
data,
|
||||
error,
|
||||
isFinished,
|
||||
isLoading,
|
||||
cancel: abort,
|
||||
isAborted,
|
||||
isCanceled: isAborted,
|
||||
abort,
|
||||
execute
|
||||
};
|
||||
return {
|
||||
...result,
|
||||
...promise
|
||||
};
|
||||
}
|
||||
|
||||
exports.useAxios = useAxios;
|
||||
|
||||
})(this.VueUse = this.VueUse || {}, VueUse, axios, Vue);
|
||||
1
node_modules/@vueuse/integrations/useAxios.iife.min.js
generated
vendored
Normal file
1
node_modules/@vueuse/integrations/useAxios.iife.min.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
(function(L,h,v,n){"use strict";function O(...t){const u=typeof t[0]=="string"?t[0]:void 0,o=typeof u=="string"?1:0,m={immediate:!!o,shallow:!0,abortPrevious:!0};let E={},d=v,s=m;const w=e=>!!e?.request;t.length>0+o&&(w(t[0+o])?d=t[0+o]:E=t[0+o]),t.length>1+o&&w(t[1+o])&&(d=t[1+o]),(t.length===2+o&&!w(t[1+o])||t.length===3+o)&&(s=t[t.length-1]||m);const{shallow:U,onSuccess:j=h.noop,onError:q=h.noop,immediate:B,resetOnExecute:N=!1}=s,x=s.initialData,y=n.shallowRef(),p=(U?n.shallowRef:n.ref)(x),i=n.shallowRef(!1),c=n.shallowRef(!1),r=n.shallowRef(!1),a=n.shallowRef();let b=new AbortController;const A=e=>{i.value||!c.value||(b.abort(e),b=new AbortController,r.value=!0,c.value=!1,i.value=!1)},V=e=>{c.value=e,i.value=!e},S=()=>{N&&(p.value=x)},D=()=>new Promise((e,f)=>{h.until(i).toBe(!0).then(()=>a.value?f(a.value):e(_))}),R={then:(...e)=>D().then(...e),catch:(...e)=>D().catch(...e)};let C=0;const P=(e=u,f={})=>{a.value=void 0;const F=typeof e=="string"?e:u??f.url;if(F===void 0)return a.value=new v.AxiosError(v.AxiosError.ERR_INVALID_URL),i.value=!0,R;S(),s.abortPrevious!==!1&&A(),V(!0),C+=1;const k=C;return r.value=!1,d(F,{...E,...typeof e=="object"?e:f,signal:b.signal}).then(l=>{if(r.value)return;y.value=l;const I=l.data;p.value=I,j(I)}).catch(l=>{a.value=l,q(l)}).finally(()=>{var l;(l=s.onFinish)==null||l.call(s),k===C&&V(!1)}),R};B&&u&&P();const _={response:y,data:p,error:a,isFinished:i,isLoading:c,cancel:A,isAborted:r,isCanceled:r,abort:A,execute:P};return{..._,...R}}L.useAxios=O})(this.VueUse=this.VueUse||{},VueUse,axios,Vue);
|
||||
123
node_modules/@vueuse/integrations/useAxios.mjs
generated
vendored
Normal file
123
node_modules/@vueuse/integrations/useAxios.mjs
generated
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
import { noop, until } from '@vueuse/shared';
|
||||
import axios, { AxiosError } from 'axios';
|
||||
import { shallowRef, ref } from 'vue';
|
||||
|
||||
function useAxios(...args) {
|
||||
const url = typeof args[0] === "string" ? args[0] : void 0;
|
||||
const argsPlaceholder = typeof url === "string" ? 1 : 0;
|
||||
const defaultOptions = {
|
||||
immediate: !!argsPlaceholder,
|
||||
shallow: true,
|
||||
abortPrevious: true
|
||||
};
|
||||
let defaultConfig = {};
|
||||
let instance = axios;
|
||||
let options = defaultOptions;
|
||||
const isAxiosInstance = (val) => !!(val == null ? void 0 : val.request);
|
||||
if (args.length > 0 + argsPlaceholder) {
|
||||
if (isAxiosInstance(args[0 + argsPlaceholder]))
|
||||
instance = args[0 + argsPlaceholder];
|
||||
else
|
||||
defaultConfig = args[0 + argsPlaceholder];
|
||||
}
|
||||
if (args.length > 1 + argsPlaceholder) {
|
||||
if (isAxiosInstance(args[1 + argsPlaceholder]))
|
||||
instance = args[1 + argsPlaceholder];
|
||||
}
|
||||
if (args.length === 2 + argsPlaceholder && !isAxiosInstance(args[1 + argsPlaceholder]) || args.length === 3 + argsPlaceholder) {
|
||||
options = args[args.length - 1] || defaultOptions;
|
||||
}
|
||||
const {
|
||||
shallow,
|
||||
onSuccess = noop,
|
||||
onError = noop,
|
||||
immediate,
|
||||
resetOnExecute = false
|
||||
} = options;
|
||||
const initialData = options.initialData;
|
||||
const response = shallowRef();
|
||||
const data = (shallow ? shallowRef : ref)(initialData);
|
||||
const isFinished = shallowRef(false);
|
||||
const isLoading = shallowRef(false);
|
||||
const isAborted = shallowRef(false);
|
||||
const error = shallowRef();
|
||||
let abortController = new AbortController();
|
||||
const abort = (message) => {
|
||||
if (isFinished.value || !isLoading.value)
|
||||
return;
|
||||
abortController.abort(message);
|
||||
abortController = new AbortController();
|
||||
isAborted.value = true;
|
||||
isLoading.value = false;
|
||||
isFinished.value = false;
|
||||
};
|
||||
const loading = (loading2) => {
|
||||
isLoading.value = loading2;
|
||||
isFinished.value = !loading2;
|
||||
};
|
||||
const resetData = () => {
|
||||
if (resetOnExecute)
|
||||
data.value = initialData;
|
||||
};
|
||||
const waitUntilFinished = () => new Promise((resolve, reject) => {
|
||||
until(isFinished).toBe(true).then(() => error.value ? reject(error.value) : resolve(result));
|
||||
});
|
||||
const promise = {
|
||||
then: (...args2) => waitUntilFinished().then(...args2),
|
||||
catch: (...args2) => waitUntilFinished().catch(...args2)
|
||||
};
|
||||
let executeCounter = 0;
|
||||
const execute = (executeUrl = url, config = {}) => {
|
||||
error.value = void 0;
|
||||
const _url = typeof executeUrl === "string" ? executeUrl : url != null ? url : config.url;
|
||||
if (_url === void 0) {
|
||||
error.value = new AxiosError(AxiosError.ERR_INVALID_URL);
|
||||
isFinished.value = true;
|
||||
return promise;
|
||||
}
|
||||
resetData();
|
||||
if (options.abortPrevious !== false)
|
||||
abort();
|
||||
loading(true);
|
||||
executeCounter += 1;
|
||||
const currentExecuteCounter = executeCounter;
|
||||
isAborted.value = false;
|
||||
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, signal: abortController.signal }).then((r) => {
|
||||
if (isAborted.value)
|
||||
return;
|
||||
response.value = r;
|
||||
const result2 = r.data;
|
||||
data.value = result2;
|
||||
onSuccess(result2);
|
||||
}).catch((e) => {
|
||||
error.value = e;
|
||||
onError(e);
|
||||
}).finally(() => {
|
||||
var _a;
|
||||
(_a = options.onFinish) == null ? void 0 : _a.call(options);
|
||||
if (currentExecuteCounter === executeCounter)
|
||||
loading(false);
|
||||
});
|
||||
return promise;
|
||||
};
|
||||
if (immediate && url)
|
||||
execute();
|
||||
const result = {
|
||||
response,
|
||||
data,
|
||||
error,
|
||||
isFinished,
|
||||
isLoading,
|
||||
cancel: abort,
|
||||
isAborted,
|
||||
isCanceled: isAborted,
|
||||
abort,
|
||||
execute
|
||||
};
|
||||
return {
|
||||
...result,
|
||||
...promise
|
||||
};
|
||||
}
|
||||
|
||||
export { useAxios };
|
||||
49
node_modules/@vueuse/integrations/useChangeCase.cjs
generated
vendored
Normal file
49
node_modules/@vueuse/integrations/useChangeCase.cjs
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
'use strict';
|
||||
|
||||
var changeCase = require('change-case');
|
||||
var vue = require('vue');
|
||||
|
||||
function _interopNamespaceDefault(e) {
|
||||
var n = Object.create(null);
|
||||
if (e) {
|
||||
Object.keys(e).forEach(function (k) {
|
||||
if (k !== 'default') {
|
||||
var d = Object.getOwnPropertyDescriptor(e, k);
|
||||
Object.defineProperty(n, k, d.get ? d : {
|
||||
enumerable: true,
|
||||
get: function () { return e[k]; }
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
n.default = e;
|
||||
return Object.freeze(n);
|
||||
}
|
||||
|
||||
var changeCase__namespace = /*#__PURE__*/_interopNamespaceDefault(changeCase);
|
||||
|
||||
const changeCaseTransforms = /* @__PURE__ */ Object.entries(changeCase__namespace).filter(([name, fn]) => typeof fn === "function" && name.endsWith("Case")).reduce((acc, [name, fn]) => {
|
||||
acc[name] = fn;
|
||||
return acc;
|
||||
}, {});
|
||||
function useChangeCase(input, type, options) {
|
||||
const typeRef = vue.computed(() => {
|
||||
const t = vue.toValue(type);
|
||||
if (!changeCaseTransforms[t])
|
||||
throw new Error(`Invalid change case type "${t}"`);
|
||||
return t;
|
||||
});
|
||||
if (typeof input === "function")
|
||||
return vue.computed(() => changeCaseTransforms[typeRef.value](vue.toValue(input), vue.toValue(options)));
|
||||
const text = vue.ref(input);
|
||||
return vue.computed({
|
||||
get() {
|
||||
return changeCaseTransforms[typeRef.value](text.value, vue.toValue(options));
|
||||
},
|
||||
set(value) {
|
||||
text.value = value;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
exports.useChangeCase = useChangeCase;
|
||||
14
node_modules/@vueuse/integrations/useChangeCase.d.cts
generated
vendored
Normal file
14
node_modules/@vueuse/integrations/useChangeCase.d.cts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import * as changeCase from 'change-case';
|
||||
import { Options } from 'change-case';
|
||||
import { MaybeRef, MaybeRefOrGetter, WritableComputedRef, ComputedRef } from 'vue';
|
||||
|
||||
type EndsWithCase<T> = T extends `${infer _}Case` ? T : never;
|
||||
type FilterKeys<T> = {
|
||||
[K in keyof T as K extends string ? K : never]: EndsWithCase<K>;
|
||||
};
|
||||
type ChangeCaseKeys = FilterKeys<typeof changeCase>;
|
||||
type ChangeCaseType = ChangeCaseKeys[keyof ChangeCaseKeys];
|
||||
declare function useChangeCase(input: MaybeRef<string>, type: MaybeRefOrGetter<ChangeCaseType>, options?: MaybeRefOrGetter<Options> | undefined): WritableComputedRef<string>;
|
||||
declare function useChangeCase(input: MaybeRefOrGetter<string>, type: MaybeRefOrGetter<ChangeCaseType>, options?: MaybeRefOrGetter<Options> | undefined): ComputedRef<string>;
|
||||
|
||||
export { type ChangeCaseType, useChangeCase };
|
||||
14
node_modules/@vueuse/integrations/useChangeCase.d.mts
generated
vendored
Normal file
14
node_modules/@vueuse/integrations/useChangeCase.d.mts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import * as changeCase from 'change-case';
|
||||
import { Options } from 'change-case';
|
||||
import { MaybeRef, MaybeRefOrGetter, WritableComputedRef, ComputedRef } from 'vue';
|
||||
|
||||
type EndsWithCase<T> = T extends `${infer _}Case` ? T : never;
|
||||
type FilterKeys<T> = {
|
||||
[K in keyof T as K extends string ? K : never]: EndsWithCase<K>;
|
||||
};
|
||||
type ChangeCaseKeys = FilterKeys<typeof changeCase>;
|
||||
type ChangeCaseType = ChangeCaseKeys[keyof ChangeCaseKeys];
|
||||
declare function useChangeCase(input: MaybeRef<string>, type: MaybeRefOrGetter<ChangeCaseType>, options?: MaybeRefOrGetter<Options> | undefined): WritableComputedRef<string>;
|
||||
declare function useChangeCase(input: MaybeRefOrGetter<string>, type: MaybeRefOrGetter<ChangeCaseType>, options?: MaybeRefOrGetter<Options> | undefined): ComputedRef<string>;
|
||||
|
||||
export { type ChangeCaseType, useChangeCase };
|
||||
14
node_modules/@vueuse/integrations/useChangeCase.d.ts
generated
vendored
Normal file
14
node_modules/@vueuse/integrations/useChangeCase.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import * as changeCase from 'change-case';
|
||||
import { Options } from 'change-case';
|
||||
import { MaybeRef, MaybeRefOrGetter, WritableComputedRef, ComputedRef } from 'vue';
|
||||
|
||||
type EndsWithCase<T> = T extends `${infer _}Case` ? T : never;
|
||||
type FilterKeys<T> = {
|
||||
[K in keyof T as K extends string ? K : never]: EndsWithCase<K>;
|
||||
};
|
||||
type ChangeCaseKeys = FilterKeys<typeof changeCase>;
|
||||
type ChangeCaseType = ChangeCaseKeys[keyof ChangeCaseKeys];
|
||||
declare function useChangeCase(input: MaybeRef<string>, type: MaybeRefOrGetter<ChangeCaseType>, options?: MaybeRefOrGetter<Options> | undefined): WritableComputedRef<string>;
|
||||
declare function useChangeCase(input: MaybeRefOrGetter<string>, type: MaybeRefOrGetter<ChangeCaseType>, options?: MaybeRefOrGetter<Options> | undefined): ComputedRef<string>;
|
||||
|
||||
export { type ChangeCaseType, useChangeCase };
|
||||
49
node_modules/@vueuse/integrations/useChangeCase.iife.js
generated
vendored
Normal file
49
node_modules/@vueuse/integrations/useChangeCase.iife.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
(function (exports, changeCase, vue) {
|
||||
'use strict';
|
||||
|
||||
function _interopNamespaceDefault(e) {
|
||||
var n = Object.create(null);
|
||||
if (e) {
|
||||
Object.keys(e).forEach(function (k) {
|
||||
if (k !== 'default') {
|
||||
var d = Object.getOwnPropertyDescriptor(e, k);
|
||||
Object.defineProperty(n, k, d.get ? d : {
|
||||
enumerable: true,
|
||||
get: function () { return e[k]; }
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
n.default = e;
|
||||
return Object.freeze(n);
|
||||
}
|
||||
|
||||
var changeCase__namespace = /*#__PURE__*/_interopNamespaceDefault(changeCase);
|
||||
|
||||
const changeCaseTransforms = /* @__PURE__ */ Object.entries(changeCase__namespace).filter(([name, fn]) => typeof fn === "function" && name.endsWith("Case")).reduce((acc, [name, fn]) => {
|
||||
acc[name] = fn;
|
||||
return acc;
|
||||
}, {});
|
||||
function useChangeCase(input, type, options) {
|
||||
const typeRef = vue.computed(() => {
|
||||
const t = vue.toValue(type);
|
||||
if (!changeCaseTransforms[t])
|
||||
throw new Error(`Invalid change case type "${t}"`);
|
||||
return t;
|
||||
});
|
||||
if (typeof input === "function")
|
||||
return vue.computed(() => changeCaseTransforms[typeRef.value](vue.toValue(input), vue.toValue(options)));
|
||||
const text = vue.ref(input);
|
||||
return vue.computed({
|
||||
get() {
|
||||
return changeCaseTransforms[typeRef.value](text.value, vue.toValue(options));
|
||||
},
|
||||
set(value) {
|
||||
text.value = value;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
exports.useChangeCase = useChangeCase;
|
||||
|
||||
})(this.VueUse = this.VueUse || {}, changeCase, Vue);
|
||||
1
node_modules/@vueuse/integrations/useChangeCase.iife.min.js
generated
vendored
Normal file
1
node_modules/@vueuse/integrations/useChangeCase.iife.min.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
(function(o,f,r){"use strict";function i(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if(n!=="default"){var a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var l=i(f);const u=Object.entries(l).filter(([e,t])=>typeof t=="function"&&e.endsWith("Case")).reduce((e,[t,n])=>(e[t]=n,e),{});function h(e,t,n){const a=r.computed(()=>{const c=r.toValue(t);if(!u[c])throw new Error(`Invalid change case type "${c}"`);return c});if(typeof e=="function")return r.computed(()=>u[a.value](r.toValue(e),r.toValue(n)));const s=r.ref(e);return r.computed({get(){return u[a.value](s.value,r.toValue(n))},set(c){s.value=c}})}o.useChangeCase=h})(this.VueUse=this.VueUse||{},changeCase,Vue);
|
||||
28
node_modules/@vueuse/integrations/useChangeCase.mjs
generated
vendored
Normal file
28
node_modules/@vueuse/integrations/useChangeCase.mjs
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
import * as changeCase from 'change-case';
|
||||
import { computed, toValue, ref } from 'vue';
|
||||
|
||||
const changeCaseTransforms = /* @__PURE__ */ Object.entries(changeCase).filter(([name, fn]) => typeof fn === "function" && name.endsWith("Case")).reduce((acc, [name, fn]) => {
|
||||
acc[name] = fn;
|
||||
return acc;
|
||||
}, {});
|
||||
function useChangeCase(input, type, options) {
|
||||
const typeRef = computed(() => {
|
||||
const t = toValue(type);
|
||||
if (!changeCaseTransforms[t])
|
||||
throw new Error(`Invalid change case type "${t}"`);
|
||||
return t;
|
||||
});
|
||||
if (typeof input === "function")
|
||||
return computed(() => changeCaseTransforms[typeRef.value](toValue(input), toValue(options)));
|
||||
const text = ref(input);
|
||||
return computed({
|
||||
get() {
|
||||
return changeCaseTransforms[typeRef.value](text.value, toValue(options));
|
||||
},
|
||||
set(value) {
|
||||
text.value = value;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export { useChangeCase };
|
||||
64
node_modules/@vueuse/integrations/useCookies.cjs
generated
vendored
Normal file
64
node_modules/@vueuse/integrations/useCookies.cjs
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
'use strict';
|
||||
|
||||
var shared = require('@vueuse/shared');
|
||||
var Cookie = require('universal-cookie');
|
||||
var vue = require('vue');
|
||||
|
||||
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 = vue.shallowRef(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
54
node_modules/@vueuse/integrations/useCookies.d.cts
generated
vendored
Normal 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 = any>(options?: universal_cookie.CookieGetOptions | undefined) => T;
|
||||
set: (name: string, value: any, options?: universal_cookie.CookieSetOptions | undefined) => void;
|
||||
remove: (name: string, options?: universal_cookie.CookieSetOptions | undefined) => void;
|
||||
addChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
|
||||
removeChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
|
||||
};
|
||||
/**
|
||||
* Reactive methods to work with cookies (use {@link createCookies} method instead if you are using SSR)
|
||||
* @param dependencies - array of watching cookie's names. Pass empty array if don't want to watch cookies changes.
|
||||
* @param options
|
||||
* @param options.doNotParse - don't try parse value as JSON
|
||||
* @param options.autoUpdateDependencies - automatically update watching dependencies
|
||||
* @param cookies - universal-cookie instance
|
||||
*/
|
||||
declare function useCookies(dependencies?: string[] | null, { doNotParse, autoUpdateDependencies }?: {
|
||||
doNotParse?: boolean | undefined;
|
||||
autoUpdateDependencies?: boolean | undefined;
|
||||
}, cookies?: universal_cookie__default): {
|
||||
/**
|
||||
* Reactive get cookie by name. If **autoUpdateDependencies = true** then it will update watching dependencies
|
||||
*/
|
||||
get: <T = any>(name: string, options?: universal_cookie.CookieGetOptions | undefined) => T;
|
||||
/**
|
||||
* Reactive get all cookies
|
||||
*/
|
||||
getAll: <T = any>(options?: universal_cookie.CookieGetOptions | undefined) => T;
|
||||
set: (name: string, value: any, options?: universal_cookie.CookieSetOptions | undefined) => void;
|
||||
remove: (name: string, options?: universal_cookie.CookieSetOptions | undefined) => void;
|
||||
addChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
|
||||
removeChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
|
||||
};
|
||||
|
||||
export { createCookies, useCookies };
|
||||
54
node_modules/@vueuse/integrations/useCookies.d.mts
generated
vendored
Normal file
54
node_modules/@vueuse/integrations/useCookies.d.mts
generated
vendored
Normal 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 = any>(options?: universal_cookie.CookieGetOptions | undefined) => T;
|
||||
set: (name: string, value: any, options?: universal_cookie.CookieSetOptions | undefined) => void;
|
||||
remove: (name: string, options?: universal_cookie.CookieSetOptions | undefined) => void;
|
||||
addChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
|
||||
removeChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
|
||||
};
|
||||
/**
|
||||
* Reactive methods to work with cookies (use {@link createCookies} method instead if you are using SSR)
|
||||
* @param dependencies - array of watching cookie's names. Pass empty array if don't want to watch cookies changes.
|
||||
* @param options
|
||||
* @param options.doNotParse - don't try parse value as JSON
|
||||
* @param options.autoUpdateDependencies - automatically update watching dependencies
|
||||
* @param cookies - universal-cookie instance
|
||||
*/
|
||||
declare function useCookies(dependencies?: string[] | null, { doNotParse, autoUpdateDependencies }?: {
|
||||
doNotParse?: boolean | undefined;
|
||||
autoUpdateDependencies?: boolean | undefined;
|
||||
}, cookies?: universal_cookie__default): {
|
||||
/**
|
||||
* Reactive get cookie by name. If **autoUpdateDependencies = true** then it will update watching dependencies
|
||||
*/
|
||||
get: <T = any>(name: string, options?: universal_cookie.CookieGetOptions | undefined) => T;
|
||||
/**
|
||||
* Reactive get all cookies
|
||||
*/
|
||||
getAll: <T = any>(options?: universal_cookie.CookieGetOptions | undefined) => T;
|
||||
set: (name: string, value: any, options?: universal_cookie.CookieSetOptions | undefined) => void;
|
||||
remove: (name: string, options?: universal_cookie.CookieSetOptions | undefined) => void;
|
||||
addChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
|
||||
removeChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
|
||||
};
|
||||
|
||||
export { createCookies, useCookies };
|
||||
54
node_modules/@vueuse/integrations/useCookies.d.ts
generated
vendored
Normal file
54
node_modules/@vueuse/integrations/useCookies.d.ts
generated
vendored
Normal 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 = any>(options?: universal_cookie.CookieGetOptions | undefined) => T;
|
||||
set: (name: string, value: any, options?: universal_cookie.CookieSetOptions | undefined) => void;
|
||||
remove: (name: string, options?: universal_cookie.CookieSetOptions | undefined) => void;
|
||||
addChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
|
||||
removeChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
|
||||
};
|
||||
/**
|
||||
* Reactive methods to work with cookies (use {@link createCookies} method instead if you are using SSR)
|
||||
* @param dependencies - array of watching cookie's names. Pass empty array if don't want to watch cookies changes.
|
||||
* @param options
|
||||
* @param options.doNotParse - don't try parse value as JSON
|
||||
* @param options.autoUpdateDependencies - automatically update watching dependencies
|
||||
* @param cookies - universal-cookie instance
|
||||
*/
|
||||
declare function useCookies(dependencies?: string[] | null, { doNotParse, autoUpdateDependencies }?: {
|
||||
doNotParse?: boolean | undefined;
|
||||
autoUpdateDependencies?: boolean | undefined;
|
||||
}, cookies?: universal_cookie__default): {
|
||||
/**
|
||||
* Reactive get cookie by name. If **autoUpdateDependencies = true** then it will update watching dependencies
|
||||
*/
|
||||
get: <T = any>(name: string, options?: universal_cookie.CookieGetOptions | undefined) => T;
|
||||
/**
|
||||
* Reactive get all cookies
|
||||
*/
|
||||
getAll: <T = any>(options?: universal_cookie.CookieGetOptions | undefined) => T;
|
||||
set: (name: string, value: any, options?: universal_cookie.CookieSetOptions | undefined) => void;
|
||||
remove: (name: string, options?: universal_cookie.CookieSetOptions | undefined) => void;
|
||||
addChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
|
||||
removeChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
|
||||
};
|
||||
|
||||
export { createCookies, useCookies };
|
||||
63
node_modules/@vueuse/integrations/useCookies.iife.js
generated
vendored
Normal file
63
node_modules/@vueuse/integrations/useCookies.iife.js
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
(function (exports, shared, Cookie, vue) {
|
||||
'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 = vue.shallowRef(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, UniversalCookie, Vue);
|
||||
1
node_modules/@vueuse/integrations/useCookies.iife.min.js
generated
vendored
Normal file
1
node_modules/@vueuse/integrations/useCookies.iife.min.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
(function(a,C,o,g){"use strict";function v(n){const r=new o(n?n.headers.cookie:null);return(u,{doNotParse:t=!1,autoUpdateDependencies:s=!1}={})=>i(u,{doNotParse:t,autoUpdateDependencies:s},r)}function i(n,{doNotParse:r=!1,autoUpdateDependencies:u=!1}={},t=new o){const s=u?[...n||[]]:n;let f=t.getAll({doNotParse:!0});const l=g.shallowRef(0),h=()=>{const e=t.getAll({doNotParse:!0});c(s||null,e,f)&&l.value++,f=e};return t.addChangeListener(h),C.tryOnScopeDispose(()=>{t.removeChangeListener(h)}),{get:(...e)=>(u&&s&&!s.includes(e[0])&&s.push(e[0]),l.value,t.get(e[0],{doNotParse:r,...e[1]})),getAll:(...e)=>(l.value,t.getAll({doNotParse:r,...e[0]})),set:(...e)=>t.set(...e),remove:(...e)=>t.remove(...e),addChangeListener:(...e)=>t.addChangeListener(...e),removeChangeListener:(...e)=>t.removeChangeListener(...e)}}function c(n,r,u){if(!n)return!0;for(const t of n)if(r[t]!==u[t])return!0;return!1}a.createCookies=v,a.useCookies=i})(this.VueUse=this.VueUse||{},VueUse,UniversalCookie,Vue);
|
||||
61
node_modules/@vueuse/integrations/useCookies.mjs
generated
vendored
Normal file
61
node_modules/@vueuse/integrations/useCookies.mjs
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
import { tryOnScopeDispose } from '@vueuse/shared';
|
||||
import Cookie from 'universal-cookie';
|
||||
import { shallowRef } from 'vue';
|
||||
|
||||
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 = shallowRef(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
116
node_modules/@vueuse/integrations/useDrauu.cjs
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
'use strict';
|
||||
|
||||
var core = require('@vueuse/core');
|
||||
var shared = require('@vueuse/shared');
|
||||
var drauu = require('drauu');
|
||||
var vue = require('vue');
|
||||
|
||||
function useDrauu(target, options) {
|
||||
const drauuInstance = vue.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 = vue.shallowRef(false);
|
||||
const canRedo = vue.shallowRef(false);
|
||||
const altPressed = vue.shallowRef(false);
|
||||
const shiftPressed = vue.shallowRef(false);
|
||||
const brush = vue.ref({
|
||||
color: "black",
|
||||
size: 3,
|
||||
arrowEnd: false,
|
||||
cornerRadius: 0,
|
||||
dasharray: void 0,
|
||||
fill: "transparent",
|
||||
mode: "draw",
|
||||
...options == null ? void 0 : options.brush
|
||||
});
|
||||
vue.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;
|
||||
}
|
||||
};
|
||||
vue.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
32
node_modules/@vueuse/integrations/useDrauu.d.cts
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
import { EventHookOn, MaybeComputedElementRef } from '@vueuse/core';
|
||||
import { Options, Drauu, Brush } from 'drauu';
|
||||
import { Ref, ShallowRef } from 'vue';
|
||||
|
||||
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: ShallowRef<boolean>;
|
||||
canRedo: ShallowRef<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
32
node_modules/@vueuse/integrations/useDrauu.d.mts
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
import { EventHookOn, MaybeComputedElementRef } from '@vueuse/core';
|
||||
import { Options, Drauu, Brush } from 'drauu';
|
||||
import { Ref, ShallowRef } from 'vue';
|
||||
|
||||
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: ShallowRef<boolean>;
|
||||
canRedo: ShallowRef<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
32
node_modules/@vueuse/integrations/useDrauu.d.ts
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
import { EventHookOn, MaybeComputedElementRef } from '@vueuse/core';
|
||||
import { Options, Drauu, Brush } from 'drauu';
|
||||
import { Ref, ShallowRef } from 'vue';
|
||||
|
||||
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: ShallowRef<boolean>;
|
||||
canRedo: ShallowRef<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 };
|
||||
114
node_modules/@vueuse/integrations/useDrauu.iife.js
generated
vendored
Normal file
114
node_modules/@vueuse/integrations/useDrauu.iife.js
generated
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
(function (exports, core, shared, drauu, vue) {
|
||||
'use strict';
|
||||
|
||||
function useDrauu(target, options) {
|
||||
const drauuInstance = vue.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 = vue.shallowRef(false);
|
||||
const canRedo = vue.shallowRef(false);
|
||||
const altPressed = vue.shallowRef(false);
|
||||
const shiftPressed = vue.shallowRef(false);
|
||||
const brush = vue.ref({
|
||||
color: "black",
|
||||
size: 3,
|
||||
arrowEnd: false,
|
||||
cornerRadius: 0,
|
||||
dasharray: void 0,
|
||||
fill: "transparent",
|
||||
mode: "draw",
|
||||
...options == null ? void 0 : options.brush
|
||||
});
|
||||
vue.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;
|
||||
}
|
||||
};
|
||||
vue.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 || {}, VueUse, VueUse, Drauu, Vue);
|
||||
1
node_modules/@vueuse/integrations/useDrauu.iife.min.js
generated
vendored
Normal file
1
node_modules/@vueuse/integrations/useDrauu.iife.min.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
(function(E,o,k,H,a){"use strict";function V(p,u){const n=a.ref();let r=[];const s=o.createEventHook(),c=o.createEventHook(),d=o.createEventHook(),v=o.createEventHook(),i=o.createEventHook(),f=a.shallowRef(!1),h=a.shallowRef(!1),w=a.shallowRef(!1),S=a.shallowRef(!1),l=a.ref({color:"black",size:3,arrowEnd:!1,cornerRadius:0,dasharray:void 0,fill:"transparent",mode:"draw",...u?.brush});a.watch(l,()=>{const e=n.value;e&&(e.brush=l.value,e.mode=l.value.mode)},{deep:!0});const R=()=>{var e;return(e=n.value)==null?void 0:e.undo()},_=()=>{var e;return(e=n.value)==null?void 0:e.redo()},C=()=>{var e;return(e=n.value)==null?void 0:e.clear()},U=()=>{var e;return(e=n.value)==null?void 0:e.cancel()},b=e=>{var t;return(t=n.value)==null?void 0:t.load(e)},D=()=>{var e;return(e=n.value)==null?void 0:e.dump()},m=()=>{var e;r.forEach(t=>t()),(e=n.value)==null||e.unmount()},g=()=>{n.value&&(f.value=n.value.canUndo(),h.value=n.value.canRedo(),w.value=n.value.altPressed,S.value=n.value.shiftPressed)};return a.watch(()=>o.unrefElement(p),e=>{!e||typeof SVGSVGElement>"u"||!(e instanceof SVGSVGElement)||(n.value&&m(),n.value=H.createDrauu({el:e,...u}),g(),r=[n.value.on("canceled",()=>c.trigger()),n.value.on("committed",t=>d.trigger(t)),n.value.on("start",()=>v.trigger()),n.value.on("end",()=>i.trigger()),n.value.on("changed",()=>{g(),s.trigger()})])},{flush:"post"}),k.tryOnScopeDispose(()=>m()),{drauuInstance:n,load:b,dump:D,clear:C,cancel:U,undo:R,redo:_,canUndo:f,canRedo:h,brush:l,onChanged:s.on,onCommitted:d.on,onStart:v.on,onEnd:i.on,onCanceled:c.on}}E.useDrauu=V})(this.VueUse=this.VueUse||{},VueUse,VueUse,Drauu,Vue);
|
||||
114
node_modules/@vueuse/integrations/useDrauu.mjs
generated
vendored
Normal file
114
node_modules/@vueuse/integrations/useDrauu.mjs
generated
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
import { createEventHook, unrefElement } from '@vueuse/core';
|
||||
import { tryOnScopeDispose } from '@vueuse/shared';
|
||||
import { createDrauu } from 'drauu';
|
||||
import { ref, shallowRef, watch } from 'vue';
|
||||
|
||||
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 = shallowRef(false);
|
||||
const canRedo = shallowRef(false);
|
||||
const altPressed = shallowRef(false);
|
||||
const shiftPressed = shallowRef(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 };
|
||||
68
node_modules/@vueuse/integrations/useFocusTrap.cjs
generated
vendored
Normal file
68
node_modules/@vueuse/integrations/useFocusTrap.cjs
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
'use strict';
|
||||
|
||||
var core = require('@vueuse/core');
|
||||
var shared = require('@vueuse/shared');
|
||||
var focusTrap = require('focus-trap');
|
||||
var vue = require('vue');
|
||||
|
||||
function useFocusTrap(target, options = {}) {
|
||||
let trap;
|
||||
const { immediate, ...focusTrapOptions } = options;
|
||||
const hasFocus = vue.shallowRef(false);
|
||||
const isPaused = vue.shallowRef(false);
|
||||
const activate = (opts) => trap && trap.activate(opts);
|
||||
const deactivate = (opts) => trap && trap.deactivate(opts);
|
||||
const pause = () => {
|
||||
if (trap) {
|
||||
trap.pause();
|
||||
isPaused.value = true;
|
||||
}
|
||||
};
|
||||
const unpause = () => {
|
||||
if (trap) {
|
||||
trap.unpause();
|
||||
isPaused.value = false;
|
||||
}
|
||||
};
|
||||
const targets = vue.computed(() => {
|
||||
const _targets = vue.toValue(target);
|
||||
return core.toArray(_targets).map((el) => {
|
||||
const _el = vue.toValue(el);
|
||||
return typeof _el === "string" ? _el : core.unrefElement(_el);
|
||||
}).filter(shared.notNullish);
|
||||
});
|
||||
vue.watch(
|
||||
targets,
|
||||
(els) => {
|
||||
if (!els.length)
|
||||
return;
|
||||
trap = focusTrap.createFocusTrap(els, {
|
||||
...focusTrapOptions,
|
||||
onActivate() {
|
||||
hasFocus.value = true;
|
||||
if (options.onActivate)
|
||||
options.onActivate();
|
||||
},
|
||||
onDeactivate() {
|
||||
hasFocus.value = false;
|
||||
if (options.onDeactivate)
|
||||
options.onDeactivate();
|
||||
}
|
||||
});
|
||||
if (immediate)
|
||||
activate();
|
||||
},
|
||||
{ flush: "post" }
|
||||
);
|
||||
core.tryOnScopeDispose(() => deactivate());
|
||||
return {
|
||||
hasFocus,
|
||||
isPaused,
|
||||
activate,
|
||||
deactivate,
|
||||
pause,
|
||||
unpause
|
||||
};
|
||||
}
|
||||
|
||||
exports.useFocusTrap = useFocusTrap;
|
||||
54
node_modules/@vueuse/integrations/useFocusTrap.d.cts
generated
vendored
Normal file
54
node_modules/@vueuse/integrations/useFocusTrap.d.cts
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
import { Fn, Arrayable, MaybeComputedElementRef } from '@vueuse/core';
|
||||
import { Options, ActivateOptions, DeactivateOptions } from 'focus-trap';
|
||||
import { ShallowRef, MaybeRefOrGetter } from 'vue';
|
||||
|
||||
interface UseFocusTrapOptions extends Options {
|
||||
/**
|
||||
* Immediately activate the trap
|
||||
*/
|
||||
immediate?: boolean;
|
||||
}
|
||||
interface UseFocusTrapReturn {
|
||||
/**
|
||||
* Indicates if the focus trap is currently active
|
||||
*/
|
||||
hasFocus: ShallowRef<boolean>;
|
||||
/**
|
||||
* Indicates if the focus trap is currently paused
|
||||
*/
|
||||
isPaused: ShallowRef<boolean>;
|
||||
/**
|
||||
* Activate the focus trap
|
||||
*
|
||||
* @see https://github.com/focus-trap/focus-trap#trapactivateactivateoptions
|
||||
* @param opts Activate focus trap options
|
||||
*/
|
||||
activate: (opts?: ActivateOptions) => void;
|
||||
/**
|
||||
* Deactivate the focus trap
|
||||
*
|
||||
* @see https://github.com/focus-trap/focus-trap#trapdeactivatedeactivateoptions
|
||||
* @param opts Deactivate focus trap options
|
||||
*/
|
||||
deactivate: (opts?: DeactivateOptions) => void;
|
||||
/**
|
||||
* Pause the focus trap
|
||||
*
|
||||
* @see https://github.com/focus-trap/focus-trap#trappause
|
||||
*/
|
||||
pause: Fn;
|
||||
/**
|
||||
* Unpauses the focus trap
|
||||
*
|
||||
* @see https://github.com/focus-trap/focus-trap#trapunpause
|
||||
*/
|
||||
unpause: Fn;
|
||||
}
|
||||
/**
|
||||
* Reactive focus-trap
|
||||
*
|
||||
* @see https://vueuse.org/useFocusTrap
|
||||
*/
|
||||
declare function useFocusTrap(target: Arrayable<MaybeRefOrGetter<string> | MaybeComputedElementRef>, options?: UseFocusTrapOptions): UseFocusTrapReturn;
|
||||
|
||||
export { type UseFocusTrapOptions, type UseFocusTrapReturn, useFocusTrap };
|
||||
54
node_modules/@vueuse/integrations/useFocusTrap.d.mts
generated
vendored
Normal file
54
node_modules/@vueuse/integrations/useFocusTrap.d.mts
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
import { Fn, Arrayable, MaybeComputedElementRef } from '@vueuse/core';
|
||||
import { Options, ActivateOptions, DeactivateOptions } from 'focus-trap';
|
||||
import { ShallowRef, MaybeRefOrGetter } from 'vue';
|
||||
|
||||
interface UseFocusTrapOptions extends Options {
|
||||
/**
|
||||
* Immediately activate the trap
|
||||
*/
|
||||
immediate?: boolean;
|
||||
}
|
||||
interface UseFocusTrapReturn {
|
||||
/**
|
||||
* Indicates if the focus trap is currently active
|
||||
*/
|
||||
hasFocus: ShallowRef<boolean>;
|
||||
/**
|
||||
* Indicates if the focus trap is currently paused
|
||||
*/
|
||||
isPaused: ShallowRef<boolean>;
|
||||
/**
|
||||
* Activate the focus trap
|
||||
*
|
||||
* @see https://github.com/focus-trap/focus-trap#trapactivateactivateoptions
|
||||
* @param opts Activate focus trap options
|
||||
*/
|
||||
activate: (opts?: ActivateOptions) => void;
|
||||
/**
|
||||
* Deactivate the focus trap
|
||||
*
|
||||
* @see https://github.com/focus-trap/focus-trap#trapdeactivatedeactivateoptions
|
||||
* @param opts Deactivate focus trap options
|
||||
*/
|
||||
deactivate: (opts?: DeactivateOptions) => void;
|
||||
/**
|
||||
* Pause the focus trap
|
||||
*
|
||||
* @see https://github.com/focus-trap/focus-trap#trappause
|
||||
*/
|
||||
pause: Fn;
|
||||
/**
|
||||
* Unpauses the focus trap
|
||||
*
|
||||
* @see https://github.com/focus-trap/focus-trap#trapunpause
|
||||
*/
|
||||
unpause: Fn;
|
||||
}
|
||||
/**
|
||||
* Reactive focus-trap
|
||||
*
|
||||
* @see https://vueuse.org/useFocusTrap
|
||||
*/
|
||||
declare function useFocusTrap(target: Arrayable<MaybeRefOrGetter<string> | MaybeComputedElementRef>, options?: UseFocusTrapOptions): UseFocusTrapReturn;
|
||||
|
||||
export { type UseFocusTrapOptions, type UseFocusTrapReturn, useFocusTrap };
|
||||
54
node_modules/@vueuse/integrations/useFocusTrap.d.ts
generated
vendored
Normal file
54
node_modules/@vueuse/integrations/useFocusTrap.d.ts
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
import { Fn, Arrayable, MaybeComputedElementRef } from '@vueuse/core';
|
||||
import { Options, ActivateOptions, DeactivateOptions } from 'focus-trap';
|
||||
import { ShallowRef, MaybeRefOrGetter } from 'vue';
|
||||
|
||||
interface UseFocusTrapOptions extends Options {
|
||||
/**
|
||||
* Immediately activate the trap
|
||||
*/
|
||||
immediate?: boolean;
|
||||
}
|
||||
interface UseFocusTrapReturn {
|
||||
/**
|
||||
* Indicates if the focus trap is currently active
|
||||
*/
|
||||
hasFocus: ShallowRef<boolean>;
|
||||
/**
|
||||
* Indicates if the focus trap is currently paused
|
||||
*/
|
||||
isPaused: ShallowRef<boolean>;
|
||||
/**
|
||||
* Activate the focus trap
|
||||
*
|
||||
* @see https://github.com/focus-trap/focus-trap#trapactivateactivateoptions
|
||||
* @param opts Activate focus trap options
|
||||
*/
|
||||
activate: (opts?: ActivateOptions) => void;
|
||||
/**
|
||||
* Deactivate the focus trap
|
||||
*
|
||||
* @see https://github.com/focus-trap/focus-trap#trapdeactivatedeactivateoptions
|
||||
* @param opts Deactivate focus trap options
|
||||
*/
|
||||
deactivate: (opts?: DeactivateOptions) => void;
|
||||
/**
|
||||
* Pause the focus trap
|
||||
*
|
||||
* @see https://github.com/focus-trap/focus-trap#trappause
|
||||
*/
|
||||
pause: Fn;
|
||||
/**
|
||||
* Unpauses the focus trap
|
||||
*
|
||||
* @see https://github.com/focus-trap/focus-trap#trapunpause
|
||||
*/
|
||||
unpause: Fn;
|
||||
}
|
||||
/**
|
||||
* Reactive focus-trap
|
||||
*
|
||||
* @see https://vueuse.org/useFocusTrap
|
||||
*/
|
||||
declare function useFocusTrap(target: Arrayable<MaybeRefOrGetter<string> | MaybeComputedElementRef>, options?: UseFocusTrapOptions): UseFocusTrapReturn;
|
||||
|
||||
export { type UseFocusTrapOptions, type UseFocusTrapReturn, useFocusTrap };
|
||||
66
node_modules/@vueuse/integrations/useFocusTrap.iife.js
generated
vendored
Normal file
66
node_modules/@vueuse/integrations/useFocusTrap.iife.js
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
(function (exports, core, shared, focusTrap, vue) {
|
||||
'use strict';
|
||||
|
||||
function useFocusTrap(target, options = {}) {
|
||||
let trap;
|
||||
const { immediate, ...focusTrapOptions } = options;
|
||||
const hasFocus = vue.shallowRef(false);
|
||||
const isPaused = vue.shallowRef(false);
|
||||
const activate = (opts) => trap && trap.activate(opts);
|
||||
const deactivate = (opts) => trap && trap.deactivate(opts);
|
||||
const pause = () => {
|
||||
if (trap) {
|
||||
trap.pause();
|
||||
isPaused.value = true;
|
||||
}
|
||||
};
|
||||
const unpause = () => {
|
||||
if (trap) {
|
||||
trap.unpause();
|
||||
isPaused.value = false;
|
||||
}
|
||||
};
|
||||
const targets = vue.computed(() => {
|
||||
const _targets = vue.toValue(target);
|
||||
return core.toArray(_targets).map((el) => {
|
||||
const _el = vue.toValue(el);
|
||||
return typeof _el === "string" ? _el : core.unrefElement(_el);
|
||||
}).filter(shared.notNullish);
|
||||
});
|
||||
vue.watch(
|
||||
targets,
|
||||
(els) => {
|
||||
if (!els.length)
|
||||
return;
|
||||
trap = focusTrap.createFocusTrap(els, {
|
||||
...focusTrapOptions,
|
||||
onActivate() {
|
||||
hasFocus.value = true;
|
||||
if (options.onActivate)
|
||||
options.onActivate();
|
||||
},
|
||||
onDeactivate() {
|
||||
hasFocus.value = false;
|
||||
if (options.onDeactivate)
|
||||
options.onDeactivate();
|
||||
}
|
||||
});
|
||||
if (immediate)
|
||||
activate();
|
||||
},
|
||||
{ flush: "post" }
|
||||
);
|
||||
core.tryOnScopeDispose(() => deactivate());
|
||||
return {
|
||||
hasFocus,
|
||||
isPaused,
|
||||
activate,
|
||||
deactivate,
|
||||
pause,
|
||||
unpause
|
||||
};
|
||||
}
|
||||
|
||||
exports.useFocusTrap = useFocusTrap;
|
||||
|
||||
})(this.VueUse = this.VueUse || {}, VueUse, VueUse, focusTrap, Vue);
|
||||
1
node_modules/@vueuse/integrations/useFocusTrap.iife.min.js
generated
vendored
Normal file
1
node_modules/@vueuse/integrations/useFocusTrap.iife.min.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
(function(l,u,f,p,a){"use strict";function h(v,s={}){let t;const{immediate:V,...d}=s,c=a.shallowRef(!1),n=a.shallowRef(!1),i=e=>t&&t.activate(e),r=e=>t&&t.deactivate(e),m=()=>{t&&(t.pause(),n.value=!0)},T=()=>{t&&(t.unpause(),n.value=!1)},g=a.computed(()=>{const e=a.toValue(v);return u.toArray(e).map(A=>{const o=a.toValue(A);return typeof o=="string"?o:u.unrefElement(o)}).filter(f.notNullish)});return a.watch(g,e=>{e.length&&(t=p.createFocusTrap(e,{...d,onActivate(){c.value=!0,s.onActivate&&s.onActivate()},onDeactivate(){c.value=!1,s.onDeactivate&&s.onDeactivate()}}),V&&i())},{flush:"post"}),u.tryOnScopeDispose(()=>r()),{hasFocus:c,isPaused:n,activate:i,deactivate:r,pause:m,unpause:T}}l.useFocusTrap=h})(this.VueUse=this.VueUse||{},VueUse,VueUse,focusTrap,Vue);
|
||||
66
node_modules/@vueuse/integrations/useFocusTrap.mjs
generated
vendored
Normal file
66
node_modules/@vueuse/integrations/useFocusTrap.mjs
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
import { toArray, unrefElement, tryOnScopeDispose } from '@vueuse/core';
|
||||
import { notNullish } from '@vueuse/shared';
|
||||
import { createFocusTrap } from 'focus-trap';
|
||||
import { shallowRef, computed, toValue, watch } from 'vue';
|
||||
|
||||
function useFocusTrap(target, options = {}) {
|
||||
let trap;
|
||||
const { immediate, ...focusTrapOptions } = options;
|
||||
const hasFocus = shallowRef(false);
|
||||
const isPaused = shallowRef(false);
|
||||
const activate = (opts) => trap && trap.activate(opts);
|
||||
const deactivate = (opts) => trap && trap.deactivate(opts);
|
||||
const pause = () => {
|
||||
if (trap) {
|
||||
trap.pause();
|
||||
isPaused.value = true;
|
||||
}
|
||||
};
|
||||
const unpause = () => {
|
||||
if (trap) {
|
||||
trap.unpause();
|
||||
isPaused.value = false;
|
||||
}
|
||||
};
|
||||
const targets = computed(() => {
|
||||
const _targets = toValue(target);
|
||||
return toArray(_targets).map((el) => {
|
||||
const _el = toValue(el);
|
||||
return typeof _el === "string" ? _el : unrefElement(_el);
|
||||
}).filter(notNullish);
|
||||
});
|
||||
watch(
|
||||
targets,
|
||||
(els) => {
|
||||
if (!els.length)
|
||||
return;
|
||||
trap = createFocusTrap(els, {
|
||||
...focusTrapOptions,
|
||||
onActivate() {
|
||||
hasFocus.value = true;
|
||||
if (options.onActivate)
|
||||
options.onActivate();
|
||||
},
|
||||
onDeactivate() {
|
||||
hasFocus.value = false;
|
||||
if (options.onDeactivate)
|
||||
options.onDeactivate();
|
||||
}
|
||||
});
|
||||
if (immediate)
|
||||
activate();
|
||||
},
|
||||
{ flush: "post" }
|
||||
);
|
||||
tryOnScopeDispose(() => deactivate());
|
||||
return {
|
||||
hasFocus,
|
||||
isPaused,
|
||||
activate,
|
||||
deactivate,
|
||||
pause,
|
||||
unpause
|
||||
};
|
||||
}
|
||||
|
||||
export { useFocusTrap };
|
||||
33
node_modules/@vueuse/integrations/useFocusTrap/component.cjs
generated
vendored
Normal file
33
node_modules/@vueuse/integrations/useFocusTrap/component.cjs
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
'use strict';
|
||||
|
||||
var core = require('@vueuse/core');
|
||||
var focusTrap = require('focus-trap');
|
||||
var vue = require('vue');
|
||||
|
||||
const UseFocusTrap = /* @__PURE__ */ /*@__PURE__*/ vue.defineComponent({
|
||||
name: "UseFocusTrap",
|
||||
props: ["as", "options"],
|
||||
setup(props, { slots }) {
|
||||
let trap;
|
||||
const target = vue.ref();
|
||||
const activate = () => trap && trap.activate();
|
||||
const deactivate = () => trap && trap.deactivate();
|
||||
vue.watch(
|
||||
() => core.unrefElement(target),
|
||||
(el) => {
|
||||
if (!el)
|
||||
return;
|
||||
trap = focusTrap.createFocusTrap(el, props.options || {});
|
||||
activate();
|
||||
},
|
||||
{ flush: "post" }
|
||||
);
|
||||
vue.onScopeDispose(() => deactivate());
|
||||
return () => {
|
||||
if (slots.default)
|
||||
return vue.h(props.as || "div", { ref: target }, slots.default());
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
exports.UseFocusTrap = UseFocusTrap;
|
||||
17
node_modules/@vueuse/integrations/useFocusTrap/component.d.cts
generated
vendored
Normal file
17
node_modules/@vueuse/integrations/useFocusTrap/component.d.cts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import * as vue from 'vue';
|
||||
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.DefineComponent<ComponentUseFocusTrapOptions, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<ComponentUseFocusTrapOptions> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
||||
|
||||
export { type ComponentUseFocusTrapOptions, UseFocusTrap };
|
||||
17
node_modules/@vueuse/integrations/useFocusTrap/component.d.mts
generated
vendored
Normal file
17
node_modules/@vueuse/integrations/useFocusTrap/component.d.mts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import * as vue from 'vue';
|
||||
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.DefineComponent<ComponentUseFocusTrapOptions, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<ComponentUseFocusTrapOptions> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
||||
|
||||
export { type ComponentUseFocusTrapOptions, UseFocusTrap };
|
||||
17
node_modules/@vueuse/integrations/useFocusTrap/component.d.ts
generated
vendored
Normal file
17
node_modules/@vueuse/integrations/useFocusTrap/component.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import * as vue from 'vue';
|
||||
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.DefineComponent<ComponentUseFocusTrapOptions, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<ComponentUseFocusTrapOptions> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
||||
|
||||
export { type ComponentUseFocusTrapOptions, UseFocusTrap };
|
||||
31
node_modules/@vueuse/integrations/useFocusTrap/component.mjs
generated
vendored
Normal file
31
node_modules/@vueuse/integrations/useFocusTrap/component.mjs
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
import { unrefElement } from '@vueuse/core';
|
||||
import { createFocusTrap } from 'focus-trap';
|
||||
import { defineComponent, ref, watch, onScopeDispose, h } from 'vue';
|
||||
|
||||
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 };
|
||||
45
node_modules/@vueuse/integrations/useFuse.cjs
generated
vendored
Normal file
45
node_modules/@vueuse/integrations/useFuse.cjs
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
'use strict';
|
||||
|
||||
var Fuse = require('fuse.js');
|
||||
var vue = require('vue');
|
||||
|
||||
function useFuse(search, data, options) {
|
||||
const createFuse = () => {
|
||||
var _a, _b;
|
||||
return new Fuse(
|
||||
(_a = vue.toValue(data)) != null ? _a : [],
|
||||
(_b = vue.toValue(options)) == null ? void 0 : _b.fuseOptions
|
||||
);
|
||||
};
|
||||
const fuse = vue.ref(createFuse());
|
||||
vue.watch(
|
||||
() => {
|
||||
var _a;
|
||||
return (_a = vue.toValue(options)) == null ? void 0 : _a.fuseOptions;
|
||||
},
|
||||
() => {
|
||||
fuse.value = createFuse();
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
vue.watch(
|
||||
() => vue.toValue(data),
|
||||
(newData) => {
|
||||
fuse.value.setCollection(newData);
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
const results = vue.computed(() => {
|
||||
const resolved = vue.toValue(options);
|
||||
if ((resolved == null ? void 0 : resolved.matchAllWhenSearchEmpty) && !vue.toValue(search))
|
||||
return vue.toValue(data).map((item, index) => ({ item, refIndex: index }));
|
||||
const limit = resolved == null ? void 0 : resolved.resultLimit;
|
||||
return fuse.value.search(vue.toValue(search), limit ? { limit } : void 0);
|
||||
});
|
||||
return {
|
||||
fuse,
|
||||
results
|
||||
};
|
||||
}
|
||||
|
||||
exports.useFuse = useFuse;
|
||||
32
node_modules/@vueuse/integrations/useFuse.d.cts
generated
vendored
Normal file
32
node_modules/@vueuse/integrations/useFuse.d.cts
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
import * as vue from 'vue';
|
||||
import { MaybeRefOrGetter, ComputedRef } from 'vue';
|
||||
import * as fuse_js from 'fuse.js';
|
||||
import fuse_js__default, { IFuseOptions, FuseResult } from 'fuse.js';
|
||||
|
||||
type FuseOptions<T> = IFuseOptions<T>;
|
||||
interface UseFuseOptions<T> {
|
||||
fuseOptions?: FuseOptions<T>;
|
||||
resultLimit?: number;
|
||||
matchAllWhenSearchEmpty?: boolean;
|
||||
}
|
||||
declare function useFuse<DataItem>(search: MaybeRefOrGetter<string>, data: MaybeRefOrGetter<DataItem[]>, options?: MaybeRefOrGetter<UseFuseOptions<DataItem>>): {
|
||||
fuse: vue.Ref<{
|
||||
search: <R = DataItem>(pattern: string | fuse_js.Expression, options?: fuse_js.FuseSearchOptions) => FuseResult<R>[];
|
||||
setCollection: (docs: readonly DataItem[], index?: fuse_js.FuseIndex<DataItem> | undefined) => void;
|
||||
add: (doc: DataItem) => void;
|
||||
remove: (predicate: (doc: DataItem, idx: number) => boolean) => DataItem[];
|
||||
removeAt: (idx: number) => void;
|
||||
getIndex: () => fuse_js.FuseIndex<DataItem>;
|
||||
}, fuse_js__default<DataItem> | {
|
||||
search: <R = DataItem>(pattern: string | fuse_js.Expression, options?: fuse_js.FuseSearchOptions) => FuseResult<R>[];
|
||||
setCollection: (docs: readonly DataItem[], index?: fuse_js.FuseIndex<DataItem> | undefined) => void;
|
||||
add: (doc: DataItem) => void;
|
||||
remove: (predicate: (doc: DataItem, idx: number) => boolean) => DataItem[];
|
||||
removeAt: (idx: number) => void;
|
||||
getIndex: () => fuse_js.FuseIndex<DataItem>;
|
||||
}>;
|
||||
results: ComputedRef<FuseResult<DataItem>[]>;
|
||||
};
|
||||
type UseFuseReturn = ReturnType<typeof useFuse>;
|
||||
|
||||
export { type FuseOptions, type UseFuseOptions, type UseFuseReturn, useFuse };
|
||||
32
node_modules/@vueuse/integrations/useFuse.d.mts
generated
vendored
Normal file
32
node_modules/@vueuse/integrations/useFuse.d.mts
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
import * as vue from 'vue';
|
||||
import { MaybeRefOrGetter, ComputedRef } from 'vue';
|
||||
import * as fuse_js from 'fuse.js';
|
||||
import fuse_js__default, { IFuseOptions, FuseResult } from 'fuse.js';
|
||||
|
||||
type FuseOptions<T> = IFuseOptions<T>;
|
||||
interface UseFuseOptions<T> {
|
||||
fuseOptions?: FuseOptions<T>;
|
||||
resultLimit?: number;
|
||||
matchAllWhenSearchEmpty?: boolean;
|
||||
}
|
||||
declare function useFuse<DataItem>(search: MaybeRefOrGetter<string>, data: MaybeRefOrGetter<DataItem[]>, options?: MaybeRefOrGetter<UseFuseOptions<DataItem>>): {
|
||||
fuse: vue.Ref<{
|
||||
search: <R = DataItem>(pattern: string | fuse_js.Expression, options?: fuse_js.FuseSearchOptions) => FuseResult<R>[];
|
||||
setCollection: (docs: readonly DataItem[], index?: fuse_js.FuseIndex<DataItem> | undefined) => void;
|
||||
add: (doc: DataItem) => void;
|
||||
remove: (predicate: (doc: DataItem, idx: number) => boolean) => DataItem[];
|
||||
removeAt: (idx: number) => void;
|
||||
getIndex: () => fuse_js.FuseIndex<DataItem>;
|
||||
}, fuse_js__default<DataItem> | {
|
||||
search: <R = DataItem>(pattern: string | fuse_js.Expression, options?: fuse_js.FuseSearchOptions) => FuseResult<R>[];
|
||||
setCollection: (docs: readonly DataItem[], index?: fuse_js.FuseIndex<DataItem> | undefined) => void;
|
||||
add: (doc: DataItem) => void;
|
||||
remove: (predicate: (doc: DataItem, idx: number) => boolean) => DataItem[];
|
||||
removeAt: (idx: number) => void;
|
||||
getIndex: () => fuse_js.FuseIndex<DataItem>;
|
||||
}>;
|
||||
results: ComputedRef<FuseResult<DataItem>[]>;
|
||||
};
|
||||
type UseFuseReturn = ReturnType<typeof useFuse>;
|
||||
|
||||
export { type FuseOptions, type UseFuseOptions, type UseFuseReturn, useFuse };
|
||||
32
node_modules/@vueuse/integrations/useFuse.d.ts
generated
vendored
Normal file
32
node_modules/@vueuse/integrations/useFuse.d.ts
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
import * as vue from 'vue';
|
||||
import { MaybeRefOrGetter, ComputedRef } from 'vue';
|
||||
import * as fuse_js from 'fuse.js';
|
||||
import fuse_js__default, { IFuseOptions, FuseResult } from 'fuse.js';
|
||||
|
||||
type FuseOptions<T> = IFuseOptions<T>;
|
||||
interface UseFuseOptions<T> {
|
||||
fuseOptions?: FuseOptions<T>;
|
||||
resultLimit?: number;
|
||||
matchAllWhenSearchEmpty?: boolean;
|
||||
}
|
||||
declare function useFuse<DataItem>(search: MaybeRefOrGetter<string>, data: MaybeRefOrGetter<DataItem[]>, options?: MaybeRefOrGetter<UseFuseOptions<DataItem>>): {
|
||||
fuse: vue.Ref<{
|
||||
search: <R = DataItem>(pattern: string | fuse_js.Expression, options?: fuse_js.FuseSearchOptions) => FuseResult<R>[];
|
||||
setCollection: (docs: readonly DataItem[], index?: fuse_js.FuseIndex<DataItem> | undefined) => void;
|
||||
add: (doc: DataItem) => void;
|
||||
remove: (predicate: (doc: DataItem, idx: number) => boolean) => DataItem[];
|
||||
removeAt: (idx: number) => void;
|
||||
getIndex: () => fuse_js.FuseIndex<DataItem>;
|
||||
}, fuse_js__default<DataItem> | {
|
||||
search: <R = DataItem>(pattern: string | fuse_js.Expression, options?: fuse_js.FuseSearchOptions) => FuseResult<R>[];
|
||||
setCollection: (docs: readonly DataItem[], index?: fuse_js.FuseIndex<DataItem> | undefined) => void;
|
||||
add: (doc: DataItem) => void;
|
||||
remove: (predicate: (doc: DataItem, idx: number) => boolean) => DataItem[];
|
||||
removeAt: (idx: number) => void;
|
||||
getIndex: () => fuse_js.FuseIndex<DataItem>;
|
||||
}>;
|
||||
results: ComputedRef<FuseResult<DataItem>[]>;
|
||||
};
|
||||
type UseFuseReturn = ReturnType<typeof useFuse>;
|
||||
|
||||
export { type FuseOptions, type UseFuseOptions, type UseFuseReturn, useFuse };
|
||||
45
node_modules/@vueuse/integrations/useFuse.iife.js
generated
vendored
Normal file
45
node_modules/@vueuse/integrations/useFuse.iife.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
(function (exports, Fuse, vue) {
|
||||
'use strict';
|
||||
|
||||
function useFuse(search, data, options) {
|
||||
const createFuse = () => {
|
||||
var _a, _b;
|
||||
return new Fuse(
|
||||
(_a = vue.toValue(data)) != null ? _a : [],
|
||||
(_b = vue.toValue(options)) == null ? void 0 : _b.fuseOptions
|
||||
);
|
||||
};
|
||||
const fuse = vue.ref(createFuse());
|
||||
vue.watch(
|
||||
() => {
|
||||
var _a;
|
||||
return (_a = vue.toValue(options)) == null ? void 0 : _a.fuseOptions;
|
||||
},
|
||||
() => {
|
||||
fuse.value = createFuse();
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
vue.watch(
|
||||
() => vue.toValue(data),
|
||||
(newData) => {
|
||||
fuse.value.setCollection(newData);
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
const results = vue.computed(() => {
|
||||
const resolved = vue.toValue(options);
|
||||
if ((resolved == null ? void 0 : resolved.matchAllWhenSearchEmpty) && !vue.toValue(search))
|
||||
return vue.toValue(data).map((item, index) => ({ item, refIndex: index }));
|
||||
const limit = resolved == null ? void 0 : resolved.resultLimit;
|
||||
return fuse.value.search(vue.toValue(search), limit ? { limit } : void 0);
|
||||
});
|
||||
return {
|
||||
fuse,
|
||||
results
|
||||
};
|
||||
}
|
||||
|
||||
exports.useFuse = useFuse;
|
||||
|
||||
})(this.VueUse = this.VueUse || {}, Fuse, Vue);
|
||||
1
node_modules/@vueuse/integrations/useFuse.iife.min.js
generated
vendored
Normal file
1
node_modules/@vueuse/integrations/useFuse.iife.min.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
(function(a,i,e){"use strict";function c(o,s,n){const r=()=>{var t,u;return new i((t=e.toValue(s))!=null?t:[],(u=e.toValue(n))==null?void 0:u.fuseOptions)},l=e.ref(r());e.watch(()=>{var t;return(t=e.toValue(n))==null?void 0:t.fuseOptions},()=>{l.value=r()},{deep:!0}),e.watch(()=>e.toValue(s),t=>{l.value.setCollection(t)},{deep:!0});const V=e.computed(()=>{const t=e.toValue(n);if(t?.matchAllWhenSearchEmpty&&!e.toValue(o))return e.toValue(s).map((d,f)=>({item:d,refIndex:f}));const u=t?.resultLimit;return l.value.search(e.toValue(o),u?{limit:u}:void 0)});return{fuse:l,results:V}}a.useFuse=c})(this.VueUse=this.VueUse||{},Fuse,Vue);
|
||||
43
node_modules/@vueuse/integrations/useFuse.mjs
generated
vendored
Normal file
43
node_modules/@vueuse/integrations/useFuse.mjs
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
import Fuse from 'fuse.js';
|
||||
import { ref, watch, toValue, computed } from 'vue';
|
||||
|
||||
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 };
|
||||
63
node_modules/@vueuse/integrations/useIDBKeyval.cjs
generated
vendored
Normal file
63
node_modules/@vueuse/integrations/useIDBKeyval.cjs
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
'use strict';
|
||||
|
||||
var core = require('@vueuse/core');
|
||||
var idbKeyval = require('idb-keyval');
|
||||
var vue = require('vue');
|
||||
|
||||
function useIDBKeyval(key, initialValue, options = {}) {
|
||||
const {
|
||||
flush = "pre",
|
||||
deep = true,
|
||||
shallow = false,
|
||||
onError = (e) => {
|
||||
console.error(e);
|
||||
},
|
||||
writeDefaults = true
|
||||
} = options;
|
||||
const isFinished = vue.shallowRef(false);
|
||||
const data = (shallow ? vue.shallowRef : vue.ref)(initialValue);
|
||||
const rawInit = vue.toValue(initialValue);
|
||||
async function read() {
|
||||
try {
|
||||
const rawValue = await idbKeyval.get(key);
|
||||
if (rawValue === void 0) {
|
||||
if (rawInit !== void 0 && rawInit !== null && writeDefaults)
|
||||
await idbKeyval.set(key, rawInit);
|
||||
} else {
|
||||
data.value = rawValue;
|
||||
}
|
||||
} catch (e) {
|
||||
onError(e);
|
||||
}
|
||||
isFinished.value = true;
|
||||
}
|
||||
read();
|
||||
async function write() {
|
||||
try {
|
||||
if (data.value == null) {
|
||||
await idbKeyval.del(key);
|
||||
} else {
|
||||
await idbKeyval.update(key, () => vue.toRaw(data.value));
|
||||
}
|
||||
} catch (e) {
|
||||
onError(e);
|
||||
}
|
||||
}
|
||||
const {
|
||||
pause: pauseWatch,
|
||||
resume: resumeWatch
|
||||
} = core.watchPausable(data, () => write(), { flush, deep });
|
||||
async function setData(value) {
|
||||
pauseWatch();
|
||||
data.value = value;
|
||||
await write();
|
||||
resumeWatch();
|
||||
}
|
||||
return {
|
||||
set: setData,
|
||||
isFinished,
|
||||
data
|
||||
};
|
||||
}
|
||||
|
||||
exports.useIDBKeyval = useIDBKeyval;
|
||||
43
node_modules/@vueuse/integrations/useIDBKeyval.d.cts
generated
vendored
Normal file
43
node_modules/@vueuse/integrations/useIDBKeyval.d.cts
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
import { ConfigurableFlush, RemovableRef } from '@vueuse/shared';
|
||||
import { ShallowRef, MaybeRefOrGetter } from 'vue';
|
||||
|
||||
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: ShallowRef<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
43
node_modules/@vueuse/integrations/useIDBKeyval.d.mts
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
import { ConfigurableFlush, RemovableRef } from '@vueuse/shared';
|
||||
import { ShallowRef, MaybeRefOrGetter } from 'vue';
|
||||
|
||||
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: ShallowRef<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
43
node_modules/@vueuse/integrations/useIDBKeyval.d.ts
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
import { ConfigurableFlush, RemovableRef } from '@vueuse/shared';
|
||||
import { ShallowRef, MaybeRefOrGetter } from 'vue';
|
||||
|
||||
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: ShallowRef<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 };
|
||||
62
node_modules/@vueuse/integrations/useIDBKeyval.iife.js
generated
vendored
Normal file
62
node_modules/@vueuse/integrations/useIDBKeyval.iife.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
(function (exports, core, idbKeyval, vue) {
|
||||
'use strict';
|
||||
|
||||
function useIDBKeyval(key, initialValue, options = {}) {
|
||||
const {
|
||||
flush = "pre",
|
||||
deep = true,
|
||||
shallow = false,
|
||||
onError = (e) => {
|
||||
console.error(e);
|
||||
},
|
||||
writeDefaults = true
|
||||
} = options;
|
||||
const isFinished = vue.shallowRef(false);
|
||||
const data = (shallow ? vue.shallowRef : vue.ref)(initialValue);
|
||||
const rawInit = vue.toValue(initialValue);
|
||||
async function read() {
|
||||
try {
|
||||
const rawValue = await idbKeyval.get(key);
|
||||
if (rawValue === void 0) {
|
||||
if (rawInit !== void 0 && rawInit !== null && writeDefaults)
|
||||
await idbKeyval.set(key, rawInit);
|
||||
} else {
|
||||
data.value = rawValue;
|
||||
}
|
||||
} catch (e) {
|
||||
onError(e);
|
||||
}
|
||||
isFinished.value = true;
|
||||
}
|
||||
read();
|
||||
async function write() {
|
||||
try {
|
||||
if (data.value == null) {
|
||||
await idbKeyval.del(key);
|
||||
} else {
|
||||
await idbKeyval.update(key, () => vue.toRaw(data.value));
|
||||
}
|
||||
} catch (e) {
|
||||
onError(e);
|
||||
}
|
||||
}
|
||||
const {
|
||||
pause: pauseWatch,
|
||||
resume: resumeWatch
|
||||
} = core.watchPausable(data, () => write(), { flush, deep });
|
||||
async function setData(value) {
|
||||
pauseWatch();
|
||||
data.value = value;
|
||||
await write();
|
||||
resumeWatch();
|
||||
}
|
||||
return {
|
||||
set: setData,
|
||||
isFinished,
|
||||
data
|
||||
};
|
||||
}
|
||||
|
||||
exports.useIDBKeyval = useIDBKeyval;
|
||||
|
||||
})(this.VueUse = this.VueUse || {}, VueUse, idbKeyval, Vue);
|
||||
1
node_modules/@vueuse/integrations/useIDBKeyval.iife.min.js
generated
vendored
Normal file
1
node_modules/@vueuse/integrations/useIDBKeyval.iife.min.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
(function(i,f,s,a){"use strict";function w(u,l,h={}){const{flush:d="pre",deep:p=!0,shallow:V=!1,onError:c=e=>{console.error(e)},writeDefaults:D=!0}=h,o=a.shallowRef(!1),t=(V?a.shallowRef:a.ref)(l),n=a.toValue(l);async function v(){try{const e=await s.get(u);e===void 0?n!=null&&D&&await s.set(u,n):t.value=e}catch(e){c(e)}o.value=!0}v();async function r(){try{t.value==null?await s.del(u):await s.update(u,()=>a.toRaw(t.value))}catch(e){c(e)}}const{pause:I,resume:R}=f.watchPausable(t,()=>r(),{flush:d,deep:p});async function U(e){I(),t.value=e,await r(),R()}return{set:U,isFinished:o,data:t}}i.useIDBKeyval=w})(this.VueUse=this.VueUse||{},VueUse,idbKeyval,Vue);
|
||||
61
node_modules/@vueuse/integrations/useIDBKeyval.mjs
generated
vendored
Normal file
61
node_modules/@vueuse/integrations/useIDBKeyval.mjs
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
import { watchPausable } from '@vueuse/core';
|
||||
import { get, set, del, update } from 'idb-keyval';
|
||||
import { shallowRef, ref, toValue, toRaw } from 'vue';
|
||||
|
||||
function useIDBKeyval(key, initialValue, options = {}) {
|
||||
const {
|
||||
flush = "pre",
|
||||
deep = true,
|
||||
shallow = false,
|
||||
onError = (e) => {
|
||||
console.error(e);
|
||||
},
|
||||
writeDefaults = true
|
||||
} = options;
|
||||
const isFinished = shallowRef(false);
|
||||
const data = (shallow ? shallowRef : ref)(initialValue);
|
||||
const rawInit = toValue(initialValue);
|
||||
async function read() {
|
||||
try {
|
||||
const rawValue = await get(key);
|
||||
if (rawValue === void 0) {
|
||||
if (rawInit !== void 0 && rawInit !== null && writeDefaults)
|
||||
await set(key, rawInit);
|
||||
} else {
|
||||
data.value = rawValue;
|
||||
}
|
||||
} catch (e) {
|
||||
onError(e);
|
||||
}
|
||||
isFinished.value = true;
|
||||
}
|
||||
read();
|
||||
async function write() {
|
||||
try {
|
||||
if (data.value == null) {
|
||||
await del(key);
|
||||
} else {
|
||||
await update(key, () => toRaw(data.value));
|
||||
}
|
||||
} catch (e) {
|
||||
onError(e);
|
||||
}
|
||||
}
|
||||
const {
|
||||
pause: pauseWatch,
|
||||
resume: resumeWatch
|
||||
} = watchPausable(data, () => write(), { flush, deep });
|
||||
async function setData(value) {
|
||||
pauseWatch();
|
||||
data.value = value;
|
||||
await write();
|
||||
resumeWatch();
|
||||
}
|
||||
return {
|
||||
set: setData,
|
||||
isFinished,
|
||||
data
|
||||
};
|
||||
}
|
||||
|
||||
export { useIDBKeyval };
|
||||
27
node_modules/@vueuse/integrations/useJwt.cjs
generated
vendored
Normal file
27
node_modules/@vueuse/integrations/useJwt.cjs
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
'use strict';
|
||||
|
||||
var jwtDecode = require('jwt-decode');
|
||||
var vue = require('vue');
|
||||
|
||||
function useJwt(encodedJwt, options = {}) {
|
||||
const {
|
||||
onError,
|
||||
fallbackValue = null
|
||||
} = options;
|
||||
const decodeWithFallback = (encodedJwt2, options2) => {
|
||||
try {
|
||||
return jwtDecode.jwtDecode(encodedJwt2, options2);
|
||||
} catch (err) {
|
||||
onError == null ? void 0 : onError(err);
|
||||
return fallbackValue;
|
||||
}
|
||||
};
|
||||
const header = vue.computed(() => decodeWithFallback(vue.toValue(encodedJwt), { header: true }));
|
||||
const payload = vue.computed(() => decodeWithFallback(vue.toValue(encodedJwt)));
|
||||
return {
|
||||
header,
|
||||
payload
|
||||
};
|
||||
}
|
||||
|
||||
exports.useJwt = useJwt;
|
||||
27
node_modules/@vueuse/integrations/useJwt.d.cts
generated
vendored
Normal file
27
node_modules/@vueuse/integrations/useJwt.d.cts
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import { JwtPayload, JwtHeader } from 'jwt-decode';
|
||||
import { ComputedRef, MaybeRefOrGetter } from 'vue';
|
||||
|
||||
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>;
|
||||
|
||||
export { type UseJwtOptions, type UseJwtReturn, useJwt };
|
||||
27
node_modules/@vueuse/integrations/useJwt.d.mts
generated
vendored
Normal file
27
node_modules/@vueuse/integrations/useJwt.d.mts
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import { JwtPayload, JwtHeader } from 'jwt-decode';
|
||||
import { ComputedRef, MaybeRefOrGetter } from 'vue';
|
||||
|
||||
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>;
|
||||
|
||||
export { type UseJwtOptions, type UseJwtReturn, useJwt };
|
||||
27
node_modules/@vueuse/integrations/useJwt.d.ts
generated
vendored
Normal file
27
node_modules/@vueuse/integrations/useJwt.d.ts
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import { JwtPayload, JwtHeader } from 'jwt-decode';
|
||||
import { ComputedRef, MaybeRefOrGetter } from 'vue';
|
||||
|
||||
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>;
|
||||
|
||||
export { type UseJwtOptions, type UseJwtReturn, useJwt };
|
||||
27
node_modules/@vueuse/integrations/useJwt.iife.js
generated
vendored
Normal file
27
node_modules/@vueuse/integrations/useJwt.iife.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
(function (exports, jwtDecode, vue) {
|
||||
'use strict';
|
||||
|
||||
function useJwt(encodedJwt, options = {}) {
|
||||
const {
|
||||
onError,
|
||||
fallbackValue = null
|
||||
} = options;
|
||||
const decodeWithFallback = (encodedJwt2, options2) => {
|
||||
try {
|
||||
return jwtDecode.jwtDecode(encodedJwt2, options2);
|
||||
} catch (err) {
|
||||
onError == null ? void 0 : onError(err);
|
||||
return fallbackValue;
|
||||
}
|
||||
};
|
||||
const header = vue.computed(() => decodeWithFallback(vue.toValue(encodedJwt), { header: true }));
|
||||
const payload = vue.computed(() => decodeWithFallback(vue.toValue(encodedJwt)));
|
||||
return {
|
||||
header,
|
||||
payload
|
||||
};
|
||||
}
|
||||
|
||||
exports.useJwt = useJwt;
|
||||
|
||||
})(this.VueUse = this.VueUse || {}, jwt_decode, Vue);
|
||||
1
node_modules/@vueuse/integrations/useJwt.iife.min.js
generated
vendored
Normal file
1
node_modules/@vueuse/integrations/useJwt.iife.min.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
(function(u,c,t){"use strict";function n(e,a={}){const{onError:o,fallbackValue:l=null}=a,r=(i,h)=>{try{return c.jwtDecode(i,h)}catch(V){return o?.(V),l}},s=t.computed(()=>r(t.toValue(e),{header:!0})),d=t.computed(()=>r(t.toValue(e)));return{header:s,payload:d}}u.useJwt=n})(this.VueUse=this.VueUse||{},jwt_decode,Vue);
|
||||
25
node_modules/@vueuse/integrations/useJwt.mjs
generated
vendored
Normal file
25
node_modules/@vueuse/integrations/useJwt.mjs
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
import { jwtDecode } from 'jwt-decode';
|
||||
import { computed, toValue } from 'vue';
|
||||
|
||||
function useJwt(encodedJwt, options = {}) {
|
||||
const {
|
||||
onError,
|
||||
fallbackValue = null
|
||||
} = options;
|
||||
const decodeWithFallback = (encodedJwt2, options2) => {
|
||||
try {
|
||||
return jwtDecode(encodedJwt2, options2);
|
||||
} catch (err) {
|
||||
onError == null ? void 0 : onError(err);
|
||||
return fallbackValue;
|
||||
}
|
||||
};
|
||||
const header = computed(() => decodeWithFallback(toValue(encodedJwt), { header: true }));
|
||||
const payload = computed(() => decodeWithFallback(toValue(encodedJwt)));
|
||||
return {
|
||||
header,
|
||||
payload
|
||||
};
|
||||
}
|
||||
|
||||
export { useJwt };
|
||||
37
node_modules/@vueuse/integrations/useNProgress.cjs
generated
vendored
Normal file
37
node_modules/@vueuse/integrations/useNProgress.cjs
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
'use strict';
|
||||
|
||||
var shared = require('@vueuse/shared');
|
||||
var nprogress = require('nprogress');
|
||||
var vue = require('vue');
|
||||
|
||||
function useNProgress(currentProgress = null, options) {
|
||||
const progress = shared.toRef(currentProgress);
|
||||
const isLoading = vue.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);
|
||||
};
|
||||
vue.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();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
exports.useNProgress = useNProgress;
|
||||
20
node_modules/@vueuse/integrations/useNProgress.d.cts
generated
vendored
Normal file
20
node_modules/@vueuse/integrations/useNProgress.d.cts
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
import * as vue from 'vue';
|
||||
import { MaybeRefOrGetter } from 'vue';
|
||||
import nprogress, { NProgressOptions } from 'nprogress';
|
||||
|
||||
type UseNProgressOptions = Partial<NProgressOptions>;
|
||||
/**
|
||||
* Reactive progress bar.
|
||||
*
|
||||
* @see https://vueuse.org/useNProgress
|
||||
*/
|
||||
declare function useNProgress(currentProgress?: MaybeRefOrGetter<number | null | undefined>, options?: UseNProgressOptions): {
|
||||
isLoading: vue.WritableComputedRef<boolean, boolean>;
|
||||
progress: vue.Ref<number | null | undefined, number | null | undefined>;
|
||||
start: () => nprogress.NProgress;
|
||||
done: (force?: boolean) => nprogress.NProgress;
|
||||
remove: () => void;
|
||||
};
|
||||
type UseNProgressReturn = ReturnType<typeof useNProgress>;
|
||||
|
||||
export { type UseNProgressOptions, type UseNProgressReturn, useNProgress };
|
||||
20
node_modules/@vueuse/integrations/useNProgress.d.mts
generated
vendored
Normal file
20
node_modules/@vueuse/integrations/useNProgress.d.mts
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
import * as vue from 'vue';
|
||||
import { MaybeRefOrGetter } from 'vue';
|
||||
import nprogress, { NProgressOptions } from 'nprogress';
|
||||
|
||||
type UseNProgressOptions = Partial<NProgressOptions>;
|
||||
/**
|
||||
* Reactive progress bar.
|
||||
*
|
||||
* @see https://vueuse.org/useNProgress
|
||||
*/
|
||||
declare function useNProgress(currentProgress?: MaybeRefOrGetter<number | null | undefined>, options?: UseNProgressOptions): {
|
||||
isLoading: vue.WritableComputedRef<boolean, boolean>;
|
||||
progress: vue.Ref<number | null | undefined, number | null | undefined>;
|
||||
start: () => nprogress.NProgress;
|
||||
done: (force?: boolean) => nprogress.NProgress;
|
||||
remove: () => void;
|
||||
};
|
||||
type UseNProgressReturn = ReturnType<typeof useNProgress>;
|
||||
|
||||
export { type UseNProgressOptions, type UseNProgressReturn, useNProgress };
|
||||
20
node_modules/@vueuse/integrations/useNProgress.d.ts
generated
vendored
Normal file
20
node_modules/@vueuse/integrations/useNProgress.d.ts
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
import * as vue from 'vue';
|
||||
import { MaybeRefOrGetter } from 'vue';
|
||||
import nprogress, { NProgressOptions } from 'nprogress';
|
||||
|
||||
type UseNProgressOptions = Partial<NProgressOptions>;
|
||||
/**
|
||||
* Reactive progress bar.
|
||||
*
|
||||
* @see https://vueuse.org/useNProgress
|
||||
*/
|
||||
declare function useNProgress(currentProgress?: MaybeRefOrGetter<number | null | undefined>, options?: UseNProgressOptions): {
|
||||
isLoading: vue.WritableComputedRef<boolean, boolean>;
|
||||
progress: vue.Ref<number | null | undefined, number | null | undefined>;
|
||||
start: () => nprogress.NProgress;
|
||||
done: (force?: boolean) => nprogress.NProgress;
|
||||
remove: () => void;
|
||||
};
|
||||
type UseNProgressReturn = ReturnType<typeof useNProgress>;
|
||||
|
||||
export { type UseNProgressOptions, type UseNProgressReturn, useNProgress };
|
||||
36
node_modules/@vueuse/integrations/useNProgress.iife.js
generated
vendored
Normal file
36
node_modules/@vueuse/integrations/useNProgress.iife.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
(function (exports, shared, nprogress, vue) {
|
||||
'use strict';
|
||||
|
||||
function useNProgress(currentProgress = null, options) {
|
||||
const progress = shared.toRef(currentProgress);
|
||||
const isLoading = vue.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);
|
||||
};
|
||||
vue.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();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
exports.useNProgress = useNProgress;
|
||||
|
||||
})(this.VueUse = this.VueUse || {}, VueUse, nprogress, Vue);
|
||||
1
node_modules/@vueuse/integrations/useNProgress.iife.min.js
generated
vendored
Normal file
1
node_modules/@vueuse/integrations/useNProgress.iife.min.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
(function(a,l,e,c){"use strict";function f(s=null,i){const t=l.toRef(s),n=c.computed({set:u=>u?e.start():e.done(),get:()=>typeof t.value=="number"&&t.value<1});i&&e.configure(i);const o=e.set;return e.set=u=>(t.value=u,o.call(e,u)),c.watchEffect(()=>{typeof t.value=="number"&&l.isClient&&o.call(e,t.value)}),l.tryOnScopeDispose(e.remove),{isLoading:n,progress:t,start:e.start,done:e.done,remove:()=>{t.value=null,e.remove()}}}a.useNProgress=f})(this.VueUse=this.VueUse||{},VueUse,nprogress,Vue);
|
||||
35
node_modules/@vueuse/integrations/useNProgress.mjs
generated
vendored
Normal file
35
node_modules/@vueuse/integrations/useNProgress.mjs
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
import { toRef, isClient, tryOnScopeDispose } from '@vueuse/shared';
|
||||
import nprogress from 'nprogress';
|
||||
import { computed, watchEffect } from 'vue';
|
||||
|
||||
function useNProgress(currentProgress = null, options) {
|
||||
const progress = toRef(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();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export { useNProgress };
|
||||
21
node_modules/@vueuse/integrations/useQRCode.cjs
generated
vendored
Normal file
21
node_modules/@vueuse/integrations/useQRCode.cjs
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
var shared = require('@vueuse/shared');
|
||||
var QRCode = require('qrcode');
|
||||
var vue = require('vue');
|
||||
|
||||
function useQRCode(text, options) {
|
||||
const src = shared.toRef(text);
|
||||
const result = vue.shallowRef("");
|
||||
vue.watch(
|
||||
src,
|
||||
async (value) => {
|
||||
if (src.value && shared.isClient)
|
||||
result.value = await QRCode.toDataURL(value, options);
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
exports.useQRCode = useQRCode;
|
||||
14
node_modules/@vueuse/integrations/useQRCode.d.cts
generated
vendored
Normal file
14
node_modules/@vueuse/integrations/useQRCode.d.cts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import * as vue from 'vue';
|
||||
import { MaybeRefOrGetter } from 'vue';
|
||||
import QRCode from 'qrcode';
|
||||
|
||||
/**
|
||||
* Wrapper for qrcode.
|
||||
*
|
||||
* @see https://vueuse.org/useQRCode
|
||||
* @param text
|
||||
* @param options
|
||||
*/
|
||||
declare function useQRCode(text: MaybeRefOrGetter<string>, options?: QRCode.QRCodeToDataURLOptions): vue.ShallowRef<string, string>;
|
||||
|
||||
export { useQRCode };
|
||||
14
node_modules/@vueuse/integrations/useQRCode.d.mts
generated
vendored
Normal file
14
node_modules/@vueuse/integrations/useQRCode.d.mts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import * as vue from 'vue';
|
||||
import { MaybeRefOrGetter } from 'vue';
|
||||
import QRCode from 'qrcode';
|
||||
|
||||
/**
|
||||
* Wrapper for qrcode.
|
||||
*
|
||||
* @see https://vueuse.org/useQRCode
|
||||
* @param text
|
||||
* @param options
|
||||
*/
|
||||
declare function useQRCode(text: MaybeRefOrGetter<string>, options?: QRCode.QRCodeToDataURLOptions): vue.ShallowRef<string, string>;
|
||||
|
||||
export { useQRCode };
|
||||
14
node_modules/@vueuse/integrations/useQRCode.d.ts
generated
vendored
Normal file
14
node_modules/@vueuse/integrations/useQRCode.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import * as vue from 'vue';
|
||||
import { MaybeRefOrGetter } from 'vue';
|
||||
import QRCode from 'qrcode';
|
||||
|
||||
/**
|
||||
* Wrapper for qrcode.
|
||||
*
|
||||
* @see https://vueuse.org/useQRCode
|
||||
* @param text
|
||||
* @param options
|
||||
*/
|
||||
declare function useQRCode(text: MaybeRefOrGetter<string>, options?: QRCode.QRCodeToDataURLOptions): vue.ShallowRef<string, string>;
|
||||
|
||||
export { useQRCode };
|
||||
20
node_modules/@vueuse/integrations/useQRCode.iife.js
generated
vendored
Normal file
20
node_modules/@vueuse/integrations/useQRCode.iife.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
(function (exports, shared, QRCode, vue) {
|
||||
'use strict';
|
||||
|
||||
function useQRCode(text, options) {
|
||||
const src = shared.toRef(text);
|
||||
const result = vue.shallowRef("");
|
||||
vue.watch(
|
||||
src,
|
||||
async (value) => {
|
||||
if (src.value && shared.isClient)
|
||||
result.value = await QRCode.toDataURL(value, options);
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
exports.useQRCode = useQRCode;
|
||||
|
||||
})(this.VueUse = this.VueUse || {}, VueUse, QRCode, Vue);
|
||||
1
node_modules/@vueuse/integrations/useQRCode.iife.min.js
generated
vendored
Normal file
1
node_modules/@vueuse/integrations/useQRCode.iife.min.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
(function(i,e,o,t){"use strict";function a(n,c){const s=e.toRef(n),u=t.shallowRef("");return t.watch(s,async l=>{s.value&&e.isClient&&(u.value=await o.toDataURL(l,c))},{immediate:!0}),u}i.useQRCode=a})(this.VueUse=this.VueUse||{},VueUse,QRCode,Vue);
|
||||
19
node_modules/@vueuse/integrations/useQRCode.mjs
generated
vendored
Normal file
19
node_modules/@vueuse/integrations/useQRCode.mjs
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
import { toRef, isClient } from '@vueuse/shared';
|
||||
import QRCode from 'qrcode';
|
||||
import { shallowRef, watch } from 'vue';
|
||||
|
||||
function useQRCode(text, options) {
|
||||
const src = toRef(text);
|
||||
const result = shallowRef("");
|
||||
watch(
|
||||
src,
|
||||
async (value) => {
|
||||
if (src.value && isClient)
|
||||
result.value = await QRCode.toDataURL(value, options);
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
export { useQRCode };
|
||||
67
node_modules/@vueuse/integrations/useSortable.cjs
generated
vendored
Normal file
67
node_modules/@vueuse/integrations/useSortable.cjs
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
'use strict';
|
||||
|
||||
var core = require('@vueuse/core');
|
||||
var Sortable = require('sortablejs');
|
||||
var vue = require('vue');
|
||||
|
||||
function useSortable(el, list, options = {}) {
|
||||
let sortable;
|
||||
const { document = core.defaultDocument, ...resetOptions } = options;
|
||||
const defaultOptions = {
|
||||
onUpdate: (e) => {
|
||||
moveArrayElement(list, e.oldIndex, e.newIndex, e);
|
||||
}
|
||||
};
|
||||
const start = () => {
|
||||
const target = typeof el === "string" ? document == null ? void 0 : document.querySelector(el) : core.unrefElement(el);
|
||||
if (!target || sortable !== void 0)
|
||||
return;
|
||||
sortable = new Sortable(target, { ...defaultOptions, ...resetOptions });
|
||||
};
|
||||
const stop = () => {
|
||||
sortable == null ? void 0 : sortable.destroy();
|
||||
sortable = void 0;
|
||||
};
|
||||
const option = (name, value) => {
|
||||
if (value !== void 0)
|
||||
sortable == null ? void 0 : sortable.option(name, value);
|
||||
else
|
||||
return sortable == null ? void 0 : sortable.option(name);
|
||||
};
|
||||
core.tryOnMounted(start);
|
||||
core.tryOnScopeDispose(stop);
|
||||
return {
|
||||
stop,
|
||||
start,
|
||||
option
|
||||
};
|
||||
}
|
||||
function insertNodeAt(parentElement, element, index) {
|
||||
const refElement = parentElement.children[index];
|
||||
parentElement.insertBefore(element, refElement);
|
||||
}
|
||||
function removeNode(node) {
|
||||
if (node.parentNode)
|
||||
node.parentNode.removeChild(node);
|
||||
}
|
||||
function moveArrayElement(list, from, to, e = null) {
|
||||
if (e != null) {
|
||||
removeNode(e.item);
|
||||
insertNodeAt(e.from, e.item, from);
|
||||
}
|
||||
const _valueIsRef = vue.isRef(list);
|
||||
const array = _valueIsRef ? [...vue.toValue(list)] : vue.toValue(list);
|
||||
if (to >= 0 && to < array.length) {
|
||||
const element = array.splice(from, 1)[0];
|
||||
vue.nextTick(() => {
|
||||
array.splice(to, 0, element);
|
||||
if (_valueIsRef)
|
||||
list.value = array;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
exports.insertNodeAt = insertNodeAt;
|
||||
exports.moveArrayElement = moveArrayElement;
|
||||
exports.removeNode = removeNode;
|
||||
exports.useSortable = useSortable;
|
||||
40
node_modules/@vueuse/integrations/useSortable.d.cts
generated
vendored
Normal file
40
node_modules/@vueuse/integrations/useSortable.d.cts
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
import { ConfigurableDocument } from '@vueuse/core';
|
||||
import Sortable, { Options } from 'sortablejs';
|
||||
import { MaybeRefOrGetter } from 'vue';
|
||||
|
||||
interface UseSortableReturn {
|
||||
/**
|
||||
* start sortable instance
|
||||
*/
|
||||
start: () => void;
|
||||
/**
|
||||
* destroy sortable instance
|
||||
*/
|
||||
stop: () => void;
|
||||
/**
|
||||
* Options getter/setter
|
||||
* @param name a Sortable.Options property.
|
||||
* @param value a value.
|
||||
*/
|
||||
option: (<K extends keyof Sortable.Options>(name: K, value: Sortable.Options[K]) => void) & (<K extends keyof Sortable.Options>(name: K) => Sortable.Options[K]);
|
||||
}
|
||||
type UseSortableOptions = Options & ConfigurableDocument;
|
||||
declare function useSortable<T>(selector: string, list: MaybeRefOrGetter<T[]>, options?: UseSortableOptions): UseSortableReturn;
|
||||
declare function useSortable<T>(el: MaybeRefOrGetter<HTMLElement | null | undefined>, list: MaybeRefOrGetter<T[]>, options?: UseSortableOptions): UseSortableReturn;
|
||||
/**
|
||||
* Inserts a element into the DOM at a given index.
|
||||
* @param parentElement
|
||||
* @param element
|
||||
* @param {number} index
|
||||
* @see https://github.com/Alfred-Skyblue/vue-draggable-plus/blob/a3829222095e1949bf2c9a20979d7b5930e66f14/src/utils/index.ts#L81C1-L94C2
|
||||
*/
|
||||
declare function insertNodeAt(parentElement: Element, element: Element, index: number): void;
|
||||
/**
|
||||
* Removes a node from the DOM.
|
||||
* @param {Node} node
|
||||
* @see https://github.com/Alfred-Skyblue/vue-draggable-plus/blob/a3829222095e1949bf2c9a20979d7b5930e66f14/src/utils/index.ts#L96C1-L102C2
|
||||
*/
|
||||
declare function removeNode(node: Node): void;
|
||||
declare function moveArrayElement<T>(list: MaybeRefOrGetter<T[]>, from: number, to: number, e?: Sortable.SortableEvent | null): void;
|
||||
|
||||
export { type UseSortableOptions, type UseSortableReturn, insertNodeAt, moveArrayElement, removeNode, useSortable };
|
||||
40
node_modules/@vueuse/integrations/useSortable.d.mts
generated
vendored
Normal file
40
node_modules/@vueuse/integrations/useSortable.d.mts
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
import { ConfigurableDocument } from '@vueuse/core';
|
||||
import Sortable, { Options } from 'sortablejs';
|
||||
import { MaybeRefOrGetter } from 'vue';
|
||||
|
||||
interface UseSortableReturn {
|
||||
/**
|
||||
* start sortable instance
|
||||
*/
|
||||
start: () => void;
|
||||
/**
|
||||
* destroy sortable instance
|
||||
*/
|
||||
stop: () => void;
|
||||
/**
|
||||
* Options getter/setter
|
||||
* @param name a Sortable.Options property.
|
||||
* @param value a value.
|
||||
*/
|
||||
option: (<K extends keyof Sortable.Options>(name: K, value: Sortable.Options[K]) => void) & (<K extends keyof Sortable.Options>(name: K) => Sortable.Options[K]);
|
||||
}
|
||||
type UseSortableOptions = Options & ConfigurableDocument;
|
||||
declare function useSortable<T>(selector: string, list: MaybeRefOrGetter<T[]>, options?: UseSortableOptions): UseSortableReturn;
|
||||
declare function useSortable<T>(el: MaybeRefOrGetter<HTMLElement | null | undefined>, list: MaybeRefOrGetter<T[]>, options?: UseSortableOptions): UseSortableReturn;
|
||||
/**
|
||||
* Inserts a element into the DOM at a given index.
|
||||
* @param parentElement
|
||||
* @param element
|
||||
* @param {number} index
|
||||
* @see https://github.com/Alfred-Skyblue/vue-draggable-plus/blob/a3829222095e1949bf2c9a20979d7b5930e66f14/src/utils/index.ts#L81C1-L94C2
|
||||
*/
|
||||
declare function insertNodeAt(parentElement: Element, element: Element, index: number): void;
|
||||
/**
|
||||
* Removes a node from the DOM.
|
||||
* @param {Node} node
|
||||
* @see https://github.com/Alfred-Skyblue/vue-draggable-plus/blob/a3829222095e1949bf2c9a20979d7b5930e66f14/src/utils/index.ts#L96C1-L102C2
|
||||
*/
|
||||
declare function removeNode(node: Node): void;
|
||||
declare function moveArrayElement<T>(list: MaybeRefOrGetter<T[]>, from: number, to: number, e?: Sortable.SortableEvent | null): void;
|
||||
|
||||
export { type UseSortableOptions, type UseSortableReturn, insertNodeAt, moveArrayElement, removeNode, useSortable };
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user