@vueuse/core
Advanced tools
Comparing version 2.0.0-alpha.25 to 2.0.0
@@ -1,2 +0,2 @@ | ||
export declare const version = "2.0.0-alpha.25"; | ||
export declare const version = "2.0.0"; | ||
export * from './useAsyncState'; | ||
@@ -3,0 +3,0 @@ export * from './useBattery'; |
@@ -1,2 +0,2 @@ | ||
export var version = '2.0.0-alpha.25'; | ||
export var version = '2.0.0'; | ||
export * from './useAsyncState'; | ||
@@ -3,0 +3,0 @@ export * from './useBattery'; |
/* this implementation is original ported from https://github.com/logaretm/vue-use-web by Abdelrahman Awad */ | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
}; | ||
import { ref } from '../api'; | ||
import { useEventListener } from '../useEventListener'; | ||
export function useClipboard() { | ||
var _this = this; | ||
var text = ref(''); | ||
var supported = ref('clipboard' in window.navigator); | ||
useEventListener('copy', function () { return __awaiter(_this, void 0, void 0, function () { | ||
var _a; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_a = text; | ||
return [4 /*yield*/, window.navigator.clipboard.readText()]; | ||
case 1: | ||
_a.value = _b.sent(); | ||
return [2 /*return*/]; | ||
} | ||
useEventListener('copy', function () { | ||
window.navigator.clipboard.readText().then(function (value) { | ||
text.value = value; | ||
}); | ||
}); }); | ||
}); | ||
function copy(txt) { | ||
@@ -58,0 +13,0 @@ text.value = txt; |
@@ -1,4 +0,11 @@ | ||
export declare function useMouse(): { | ||
export declare function useMouse(options?: { | ||
touch?: boolean; | ||
resetOnTouchEnds?: boolean; | ||
initial?: { | ||
x: number; | ||
y: number; | ||
}; | ||
}): { | ||
x: import("@vue/composition-api/dist/reactivity/ref").Ref<number>; | ||
y: import("@vue/composition-api/dist/reactivity/ref").Ref<number>; | ||
}; |
import { ref } from '../api'; | ||
import { useEventListener } from '../useEventListener'; | ||
export function useMouse() { | ||
var x = ref(0); | ||
var y = ref(0); | ||
export function useMouse(options) { | ||
if (options === void 0) { options = {}; } | ||
var _a = options.touch, touch = _a === void 0 ? true : _a, _b = options.resetOnTouchEnds, resetOnTouchEnds = _b === void 0 ? true : _b, _c = options.initial, initial = _c === void 0 ? { x: 0, y: 0 } : _c; | ||
var x = ref(initial.x); | ||
var y = ref(initial.y); | ||
useEventListener('mousemove', function (event) { | ||
@@ -10,2 +12,16 @@ x.value = event.pageX; | ||
}); | ||
if (touch) { | ||
useEventListener('touchmove', function (event) { | ||
if (event.touches.length > 0) { | ||
x.value = event.touches[0].clientX; | ||
y.value = event.touches[0].clientY; | ||
} | ||
}); | ||
if (resetOnTouchEnds) { | ||
useEventListener('touchend', function () { | ||
x.value = initial.x; | ||
y.value = initial.y; | ||
}); | ||
} | ||
} | ||
return { | ||
@@ -12,0 +28,0 @@ x: x, |
@@ -1,2 +0,6 @@ | ||
import { Ref } from '../api'; | ||
export declare function useRafFn(fn: (elapsed: Ref<number>) => any): Readonly<Ref<number>>; | ||
export declare function useRafFn(fn: () => any, options?: { | ||
startNow?: boolean; | ||
}): { | ||
stop: () => void; | ||
start: () => void; | ||
}; |
@@ -1,7 +0,27 @@ | ||
import { watch } from '../api'; | ||
import { useRaf } from '../useRaf'; | ||
export function useRafFn(fn) { | ||
var elapsed = useRaf(); | ||
watch(function () { return elapsed; }, fn); | ||
return elapsed; | ||
import { getCurrentInstance } from '@vue/composition-api'; | ||
import { onUnmounted } from '../api'; | ||
export function useRafFn(fn, options) { | ||
if (options === void 0) { options = {}; } | ||
var startNow = options.startNow; | ||
var started = false; | ||
function loop() { | ||
if (!started) | ||
return; | ||
fn(); | ||
requestAnimationFrame(loop); | ||
} | ||
function start() { | ||
if (!started) { | ||
started = true; | ||
loop(); | ||
} | ||
} | ||
function stop() { | ||
started = false; | ||
} | ||
if (startNow) | ||
start(); | ||
if (getCurrentInstance()) | ||
onUnmounted(function () { return stop(); }); | ||
return { stop: stop, start: start }; | ||
} |
@@ -1,2 +0,2 @@ | ||
export declare const version = "2.0.0-alpha.25"; | ||
export declare const version = "2.0.0"; | ||
export * from './useAsyncState'; | ||
@@ -3,0 +3,0 @@ export * from './useBattery'; |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.version = '2.0.0-alpha.25'; | ||
exports.version = '2.0.0'; | ||
__export(require("./useAsyncState")); | ||
@@ -9,0 +9,0 @@ __export(require("./useBattery")); |
"use strict"; | ||
/* this implementation is original ported from https://github.com/logaretm/vue-use-web by Abdelrahman Awad */ | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -43,18 +7,9 @@ var api_1 = require("../api"); | ||
function useClipboard() { | ||
var _this = this; | ||
var text = api_1.ref(''); | ||
var supported = api_1.ref('clipboard' in window.navigator); | ||
useEventListener_1.useEventListener('copy', function () { return __awaiter(_this, void 0, void 0, function () { | ||
var _a; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_a = text; | ||
return [4 /*yield*/, window.navigator.clipboard.readText()]; | ||
case 1: | ||
_a.value = _b.sent(); | ||
return [2 /*return*/]; | ||
} | ||
useEventListener_1.useEventListener('copy', function () { | ||
window.navigator.clipboard.readText().then(function (value) { | ||
text.value = value; | ||
}); | ||
}); }); | ||
}); | ||
function copy(txt) { | ||
@@ -61,0 +16,0 @@ text.value = txt; |
@@ -1,4 +0,11 @@ | ||
export declare function useMouse(): { | ||
export declare function useMouse(options?: { | ||
touch?: boolean; | ||
resetOnTouchEnds?: boolean; | ||
initial?: { | ||
x: number; | ||
y: number; | ||
}; | ||
}): { | ||
x: import("@vue/composition-api/dist/reactivity/ref").Ref<number>; | ||
y: import("@vue/composition-api/dist/reactivity/ref").Ref<number>; | ||
}; |
@@ -5,5 +5,7 @@ "use strict"; | ||
var useEventListener_1 = require("../useEventListener"); | ||
function useMouse() { | ||
var x = api_1.ref(0); | ||
var y = api_1.ref(0); | ||
function useMouse(options) { | ||
if (options === void 0) { options = {}; } | ||
var _a = options.touch, touch = _a === void 0 ? true : _a, _b = options.resetOnTouchEnds, resetOnTouchEnds = _b === void 0 ? true : _b, _c = options.initial, initial = _c === void 0 ? { x: 0, y: 0 } : _c; | ||
var x = api_1.ref(initial.x); | ||
var y = api_1.ref(initial.y); | ||
useEventListener_1.useEventListener('mousemove', function (event) { | ||
@@ -13,2 +15,16 @@ x.value = event.pageX; | ||
}); | ||
if (touch) { | ||
useEventListener_1.useEventListener('touchmove', function (event) { | ||
if (event.touches.length > 0) { | ||
x.value = event.touches[0].clientX; | ||
y.value = event.touches[0].clientY; | ||
} | ||
}); | ||
if (resetOnTouchEnds) { | ||
useEventListener_1.useEventListener('touchend', function () { | ||
x.value = initial.x; | ||
y.value = initial.y; | ||
}); | ||
} | ||
} | ||
return { | ||
@@ -15,0 +31,0 @@ x: x, |
@@ -1,2 +0,6 @@ | ||
import { Ref } from '../api'; | ||
export declare function useRafFn(fn: (elapsed: Ref<number>) => any): Readonly<Ref<number>>; | ||
export declare function useRafFn(fn: () => any, options?: { | ||
startNow?: boolean; | ||
}): { | ||
stop: () => void; | ||
start: () => void; | ||
}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var composition_api_1 = require("@vue/composition-api"); | ||
var api_1 = require("../api"); | ||
var useRaf_1 = require("../useRaf"); | ||
function useRafFn(fn) { | ||
var elapsed = useRaf_1.useRaf(); | ||
api_1.watch(function () { return elapsed; }, fn); | ||
return elapsed; | ||
function useRafFn(fn, options) { | ||
if (options === void 0) { options = {}; } | ||
var startNow = options.startNow; | ||
var started = false; | ||
function loop() { | ||
if (!started) | ||
return; | ||
fn(); | ||
requestAnimationFrame(loop); | ||
} | ||
function start() { | ||
if (!started) { | ||
started = true; | ||
loop(); | ||
} | ||
} | ||
function stop() { | ||
started = false; | ||
} | ||
if (startNow) | ||
start(); | ||
if (composition_api_1.getCurrentInstance()) | ||
api_1.onUnmounted(function () { return stop(); }); | ||
return { stop: stop, start: start }; | ||
} | ||
exports.useRafFn = useRafFn; |
@@ -118,55 +118,10 @@ (function (global, factory) { | ||
/* this implementation is original ported from https://github.com/logaretm/vue-use-web by Abdelrahman Awad */ | ||
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __generator = (undefined && undefined.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
}; | ||
function useClipboard() { | ||
var _this = this; | ||
var text = CompositionAPI.ref(''); | ||
var supported = CompositionAPI.ref('clipboard' in window.navigator); | ||
useEventListener('copy', function () { return __awaiter(_this, void 0, void 0, function () { | ||
var _a; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_a = text; | ||
return [4 /*yield*/, window.navigator.clipboard.readText()]; | ||
case 1: | ||
_a.value = _b.sent(); | ||
return [2 /*return*/]; | ||
} | ||
useEventListener('copy', function () { | ||
window.navigator.clipboard.readText().then(function (value) { | ||
text.value = value; | ||
}); | ||
}); }); | ||
}); | ||
function copy(txt) { | ||
@@ -588,5 +543,7 @@ text.value = txt; | ||
function useMouse() { | ||
var x = CompositionAPI.ref(0); | ||
var y = CompositionAPI.ref(0); | ||
function useMouse(options) { | ||
if (options === void 0) { options = {}; } | ||
var _a = options.touch, touch = _a === void 0 ? true : _a, _b = options.resetOnTouchEnds, resetOnTouchEnds = _b === void 0 ? true : _b, _c = options.initial, initial = _c === void 0 ? { x: 0, y: 0 } : _c; | ||
var x = CompositionAPI.ref(initial.x); | ||
var y = CompositionAPI.ref(initial.y); | ||
useEventListener('mousemove', function (event) { | ||
@@ -596,2 +553,16 @@ x.value = event.pageX; | ||
}); | ||
if (touch) { | ||
useEventListener('touchmove', function (event) { | ||
if (event.touches.length > 0) { | ||
x.value = event.touches[0].clientX; | ||
y.value = event.touches[0].clientY; | ||
} | ||
}); | ||
if (resetOnTouchEnds) { | ||
useEventListener('touchend', function () { | ||
x.value = initial.x; | ||
y.value = initial.y; | ||
}); | ||
} | ||
} | ||
return { | ||
@@ -823,6 +794,26 @@ x: x, | ||
function useRafFn(fn) { | ||
var elapsed = useRaf(); | ||
CompositionAPI.watch(function () { return elapsed; }, fn); | ||
return elapsed; | ||
function useRafFn(fn, options) { | ||
if (options === void 0) { options = {}; } | ||
var startNow = options.startNow; | ||
var started = false; | ||
function loop() { | ||
if (!started) | ||
return; | ||
fn(); | ||
requestAnimationFrame(loop); | ||
} | ||
function start() { | ||
if (!started) { | ||
started = true; | ||
loop(); | ||
} | ||
} | ||
function stop() { | ||
started = false; | ||
} | ||
if (startNow) | ||
start(); | ||
if (CompositionAPI.getCurrentInstance()) | ||
CompositionAPI.onUnmounted(function () { return stop(); }); | ||
return { stop: stop, start: start }; | ||
} | ||
@@ -891,3 +882,3 @@ | ||
var version = '2.0.0-alpha.25'; | ||
var version = '2.0.0'; | ||
@@ -894,0 +885,0 @@ exports.useAsyncState = useAsyncState; |
@@ -1,1 +0,1 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("vue"),require("@vue/composition-api")):"function"==typeof define&&define.amd?define(["exports","vue","@vue/composition-api"],n):n((e=e||self).VueUse={},e.Vue,e.vueCompositionApi)}(this,function(e,n,y){"use strict";n=n&&n.hasOwnProperty("default")?n.default:n;"default"in y&&y.default;function i(e,n){void 0===e&&(e=1e3),void 0===n&&(n=!0);var t=y.ref(!1),u=null;function o(){t.value=!1,u&&(clearTimeout(u),u=null)}function r(){o(),u=setTimeout(function(){t.value=!0,u=null},e)}return n&&r(),y.getCurrentInstance()&&y.onUnmounted(o),{ready:t,start:r,stop:o}}function a(n,e){var t=i(e),u=t.ready,o=t.start,r=t.stop;return y.watch(u,function(e){e&&n()},{lazy:!0}),{ready:u,start:o,stop:r}}var l=["chargingchange","chargingtimechange","dischargingtimechange","levelchange"];function v(e,n,t,u){void 0===u&&(u=window),y.onMounted(function(){u.addEventListener(e,n,t)}),y.onUnmounted(function(){u.removeEventListener(e,n,t)})}var u=function(e,i,a,l){return new(a=a||Promise)(function(t,n){function u(e){try{r(l.next(e))}catch(e){n(e)}}function o(e){try{r(l.throw(e))}catch(e){n(e)}}function r(e){var n;e.done?t(e.value):((n=e.value)instanceof a?n:new a(function(e){e(n)})).then(u,o)}r((l=l.apply(e,i||[])).next())})},o=function(t,u){var o,r,i,e,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return e={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function n(n){return function(e){return function(n){if(o)throw new TypeError("Generator is already executing.");for(;a;)try{if(o=1,r&&(i=2&n[0]?r.return:n[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,n[1])).done)return i;switch(r=0,i&&(n=[2&n[0],i.value]),n[0]){case 0:case 1:i=n;break;case 4:return a.label++,{value:n[1],done:!1};case 5:a.label++,r=n[1],n=[0];continue;case 7:n=a.ops.pop(),a.trys.pop();continue;default:if(!(i=0<(i=a.trys).length&&i[i.length-1])&&(6===n[0]||2===n[0])){a=0;continue}if(3===n[0]&&(!i||n[1]>i[0]&&n[1]<i[3])){a.label=n[1];break}if(6===n[0]&&a.label<i[1]){a.label=i[1],i=n;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(n);break}i[2]&&a.ops.pop(),a.trys.pop();continue}n=u.call(t,a)}catch(e){n=[6,e],r=0}finally{o=i=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,e])}}};function f(r,i,a,l){var c,v=!1,f=0;function s(){c&&clearTimeout(c)}function e(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var t=this,u=Date.now()-f;if(!v){var o=function(){f=Date.now(),a&&a.apply(t,e)};l&&!c&&o(),s(),void 0===l&&r<u?o():!0!==i&&(c=setTimeout(l?function(){c=void 0}:o,void 0===l?r-u:r))}}return"boolean"!=typeof i&&(l=!!a,a=i,i=void 0),e.cancel=function(){s(),v=!0},e}function s(){return+Date.now()}var r="object"==typeof window;function m(){var n=y.ref(!1),t=y.ref(0),u=y.ref(0),o=y.ref(0);return v("deviceorientation",function(e){n.value=e.absolute,t.value=e.alpha,u.value=e.beta,o.value=e.gamma}),{isAbsolute:n,alpha:t,beta:u,gamma:o}}var d=["mousemove","mousedown","resize","keydown","touchstart","wheel"];function c(n,t,u){void 0===u&&(u=localStorage);var o=y.ref(t);function e(){try{var e=u.getItem(n);!e&&t?(u.setItem(n,t),e=t):o.value=e||void 0}catch(e){console.warn(e)}}return e(),v("storage",e),y.watch(o,function(){try{null==o.value?u.removeItem(n):u.setItem(n,o.value)}catch(e){console.warn(e)}},{flush:"sync",lazy:!0}),o}function t(e,n,t){function u(e){return e?JSON.stringify(e):""}function o(e){return e?JSON.parse(e):n||{}}void 0===t&&(t=localStorage);var r=c(e,u(n),t),i=y.ref(o(r.value));return y.watch(r,function(){return i.value=o(r.value)},{flush:"sync",lazy:!0}),y.watch(i,function(){r.value=u(i.value)},{flush:"sync",lazy:!0,deep:!0}),i}function g(e){var n;"undefined"!=typeof window&&(n=window.matchMedia(e));var t=y.ref(!!n&&n.matches);function u(e){t.value=e.matches}return y.onMounted(function(){n=n||window.matchMedia(e),t.value=n.matches,n.addListener(u)}),y.onUnmounted(function(){n.removeListener(u)}),t}function h(e,c){void 0===e&&(e=y.ref(document.body)),void 0===c&&(c=!1);var v=y.ref(0),f=y.ref(0),s=y.ref(0),d=y.ref(0),m=y.ref(0),g=y.ref(0),h=y.ref(0),p=y.ref(0),w=y.ref(!1),n=y.watch(e,function(l,e,n){function t(e){var n=(l||document.body).getBoundingClientRect(),t=n.left,u=n.top,o=n.width,r=n.height;v.value=e.pageX,f.value=e.pageY,m.value=t+window.pageXOffset,g.value=u+window.pageYOffset,h.value=r,p.value=o;var i=e.pageX-m.value,a=e.pageY-g.value;w.value=i<0||a<0||i>p.value||a>h.value,!c&&w.value||(s.value=i,d.value=a)}document.addEventListener("mousemove",t),n(function(){document.removeEventListener("mousemove",t)})});return{x:v,y:f,documentX:v,documentY:f,elementX:s,elementY:d,elementPositionX:m,elementPositionY:g,elementHeight:h,elementWidth:p,isOutside:w,stop:n}}function p(){var e=y.ref(!0),n=y.ref(!1),t=y.ref(void 0),u=y.ref(void 0),o=y.ref(void 0),r=y.ref(void 0),i=y.ref("unknown"),a=window.navigator,l="connection"in a?a.connection:void 0;function c(){e.value=a.onLine,t.value=e.value?void 0:Date.now(),l&&(u.value=l.downlink,o.value=l.downlinkMax,r.value=l.effectiveType,n.value=l.saveData,i.value=l.type)}return y.onMounted(c),v("offline",function(){e.value=!1,t.value=Date.now()}),v("online",function(){e.value=!0}),l&&v("change",c,!1,l),{isOnline:e,saveData:n,offlineAt:t,downlink:u,downlinkMax:o,effectiveType:r,type:i}}function w(){return+Date.now()}function b(){var e=y.ref(w()),n=!1,t=function(){requestAnimationFrame(function(){e.value=w(),n&&t()})};return n||(n=!0,t()),y.getCurrentInstance()&&y.onUnmounted(function(){n=!1}),e}function x(){}function M(){var e=b(),n=y.ref(e.value);return y.computed(function(){return e.value-n.value})}e.useAsyncState=function(e,n,t,u){void 0===t&&(t=0),void 0===u&&(u=function(e){});var o=y.ref(n),r=y.ref(!1);function i(){e.then(function(e){o.value=e,r.value=!0}).catch(u)}return t?a(i,t):i(),{state:o,ready:r}},e.useBattery=function(){var e=y.ref(!1),n=y.ref(0),t=y.ref(0),u=y.ref(1),o=y.ref("getBattery"in navigator);function r(){e.value=this.charging,n.value=this.chargingTime||0,t.value=this.dischargingTime||0,u.value=this.level}return y.onMounted(function(){o.value&&navigator.getBattery().then(function(n){r.call(n),l.forEach(function(e){n.addEventListener(e,r)})})}),y.onUnmounted(function(){o.value&&navigator.getBattery().then(function(n){l.forEach(function(e){n.removeEventListener(e,r)})})}),{charging:e,chargingTime:n,dischargingTime:t,level:u,supported:o}},e.useClipboard=function(){var e=this,t=y.ref(""),n=y.ref("clipboard"in window.navigator);return v("copy",function(){return u(e,void 0,void 0,function(){var n;return o(this,function(e){switch(e.label){case 0:return n=t,[4,window.navigator.clipboard.readText()];case 1:return n.value=e.sent(),[2]}})})}),{text:t,copy:function(e){return t.value=e,window.navigator.clipboard.writeText(e)},supported:n}},e.useCounter=function(n){function t(e){return u.value=e}void 0===n&&(n=0);var u=y.ref(n);return{count:u,inc:function(e){return void 0===e&&(e=1),u.value+=e},dec:function(e){return void 0===e&&(e=1),u.value-=e},get:function(){return u.value},set:t,reset:function(e){return void 0===e&&(e=n),t(n=e)}}},e.useDeviceLight=function(){var n=y.ref(null);return v("devicelight",function(e){n.value=e.value}),n},e.useDeviceMotion=function(e){void 0===e&&(e={throttleMs:10});var n=y.ref({x:null,y:null,z:null}),t=y.ref({alpha:null,beta:null,gamma:null}),u=y.ref(0),o=y.ref({x:null,y:null,z:null});function r(e){n.value=e.acceleration,o.value=e.accelerationIncludingGravity,t.value=e.rotationRate,u.value=e.interval}return v("devicemotion",e.throttleMs?f(e.throttleMs,r):r,!1),{acceleration:n,accelerationIncludingGravity:o,rotationRate:t,interval:u}},e.useDeviceOrientation=m,e.useEventListener=v,e.useFullscreen=function(e){void 0===e&&(e=y.ref(document.body));var n=y.ref(!1);function t(){document.fullscreenElement&&document.exitFullscreen(),n.value=!1}return{isFullscreen:n,enterFullscreen:function(){t(),e.value.requestFullscreen().then(function(){n.value=!0})},exitFullscreen:t}},e.useGeolocation=function(e){void 0===e&&(e={enableHighAccuracy:!0,maximumAge:3e4,timeout:27e3});var n,t=y.ref(null),u=y.ref(null),o=y.ref({accuracy:0,latitude:0,longitude:0,altitude:null,altitudeAccuracy:null,heading:null,speed:null});function r(e){t.value=e.timestamp,o.value=e.coords,u.value=null}return y.onMounted(function(){"geolocation"in navigator&&(n=window.navigator.geolocation.watchPosition(r,function(e){u.value=e},e))}),y.onUnmounted(function(){n&&window.navigator.geolocation.clearWatch(n)}),{coords:o,locatedAt:t,error:u}},e.useIdle=function(e,n,t,u){void 0===e&&(e=6e4),void 0===n&&(n=!1),void 0===t&&(t=d),void 0===u&&(u=50);for(var o,r=y.ref(n),i=y.ref(s()),a=f(u,function(){r.value=!1,clearTimeout(o),o=setTimeout(function(){return r.value=!0},e),i.value=s()}),l=0,c=t;l<c.length;l++){v(c[l],a)}return v("visibilitychange",function(){document.hidden||a()},void 0,document),y.onMounted(function(){o=setTimeout(function(){return e=!0,void(r.value=e);var e},e)}),{idle:r,lastActive:i}},e.useInterval=function(e,n){void 0===e&&(e=1e3),void 0===n&&(n=!0);var t=null,u=y.ref(0);function o(){t&&(clearInterval(t),t=null)}function r(){o(),t=setInterval(function(){u.value+=1},e)}return n&&y.onMounted(r),y.getCurrentInstance()&&y.onUnmounted(o),{counter:u,start:r,stop:o}},e.useIntervalFn=function(e,n,t){void 0===n&&(n=1e3),void 0===t&&(t=!0);var u=null;function o(){u&&(clearInterval(u),u=null)}function r(){o(),u=setInterval(e,n)}return t&&r(),y.getCurrentInstance()&&y.onUnmounted(o),{start:r,stop:o}},e.useLocalStorage=function(e,n){return t(e,n,localStorage)},e.useMediaQuery=g,e.useMouse=function(){var n=y.ref(0),t=y.ref(0);return v("mousemove",function(e){n.value=e.pageX,t.value=e.pageY}),{x:n,y:t}},e.useMouseInElement=h,e.useNetwork=p,e.useNow=b,e.useOnline=function(){return p().isOnline},e.usePageLeave=function(){var t=y.ref(!1);return v("mouseout",function(e){var n=(e=e||window.event).relatedTarget||e.toElement;t.value=!n}),t},e.useParallax=function(e){var n=m(),t=n.beta,u=n.gamma,o=h(null===e||void 0===e?void 0:e.targetElement,!1),r=o.elementX,i=o.elementY,a=o.elementWidth,l=o.elementHeight,c=y.computed(function(){return null!=t.value&&null!=t.value?"deviceOrientation":"mouse"}),v=(null===e||void 0===e?void 0:e.deviceOrientationTiltAdjust)||function(e){return e},f=(null===e||void 0===e?void 0:e.deviceOrientationRollAdjust)||function(e){return e},s=(null===e||void 0===e?void 0:e.mouseTiltAdjust)||function(e){return e},d=(null===e||void 0===e?void 0:e.mouseRollAdjust)||function(e){return e};return{roll:y.computed(function(){if("deviceOrientation"===c.value&&null!=t.value){var e=-t.value/180;return f(e)}e=-(i.value-l.value/2)/l.value;return d(e)}),tilt:y.computed(function(){if("deviceOrientation"===c.value&&null!=u.value){var e=u.value/180;return v(e)}e=(r.value-a.value/2)/a.value;return s(e)}),source:c}},e.usePermission=function(e){function n(){t&&(o.value=t.state)}var t=null,u="string"==typeof e?{name:e}:e,o=y.ref("");return"permissions"in navigator&&navigator.permissions.query(u).then(function(e){t=e,n(),v("change",n,void 0,t)}).catch(x),o},e.usePreferredDark=function(){return g("(prefers-color-scheme: dark)")},e.usePreferredLanguages=function(){var e=y.ref(navigator.languages);return v("languagechange",function(){e.value=navigator.languages}),e},e.useRaf=M,e.useRafFn=function(e){var n=M();return y.watch(function(){return n},e),n},e.useSessionStorage=function(e,n){return t(e,n,sessionStorage)},e.useStorage=t,e.useStoragePlain=c,e.useTimeout=i,e.useTimeoutFn=a,e.useWebWorker=function(e){var n,t=y.ref(null);return y.onMounted(function(){(n=new Worker(e)).onmessage=function(e){t.value=e.data}}),y.onUnmounted(function(){n.terminate()}),{data:t,post:function(e){n&&n.postMessage(e)},terminate:function(){n&&n.terminate()}}},e.useWindowScroll=function(){var e=y.ref(r?window.pageXOffset:0),n=y.ref(r?window.pageYOffset:0);return v("scroll",function(){e.value=window.pageXOffset,n.value=window.pageYOffset},{capture:!1,passive:!0}),{x:e,y:n}},e.useWindowSize=function(e,n){void 0===e&&(e=1/0),void 0===n&&(n=1/0);var t=y.ref(r?window.innerWidth:e),u=y.ref(r?window.innerWidth:n);return r||v("resize",function(){t.value=window.innerWidth,u.value=window.innerHeight}),{width:t,height:u}},e.version="2.0.0-alpha.25",Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("vue"),require("@vue/composition-api")):"function"==typeof define&&define.amd?define(["exports","vue","@vue/composition-api"],n):n((e=e||self).VueUse={},e.Vue,e.vueCompositionApi)}(this,function(e,n,y){"use strict";n=n&&n.hasOwnProperty("default")?n.default:n;"default"in y&&y.default;function r(e,n){void 0===e&&(e=1e3),void 0===n&&(n=!0);var t=y.ref(!1),u=null;function o(){t.value=!1,u&&(clearTimeout(u),u=null)}function i(){o(),u=setTimeout(function(){t.value=!0,u=null},e)}return n&&i(),y.getCurrentInstance()&&y.onUnmounted(o),{ready:t,start:i,stop:o}}function a(n,e){var t=r(e),u=t.ready,o=t.start,i=t.stop;return y.watch(u,function(e){e&&n()},{lazy:!0}),{ready:u,start:o,stop:i}}var l=["chargingchange","chargingtimechange","dischargingtimechange","levelchange"];function v(e,n,t,u){void 0===u&&(u=window),y.onMounted(function(){u.addEventListener(e,n,t)}),y.onUnmounted(function(){u.removeEventListener(e,n,t)})}function f(i,r,a,l){var c,v=!1,f=0;function d(){c&&clearTimeout(c)}function e(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var t=this,u=Date.now()-f;if(!v){var o=function(){f=Date.now(),a&&a.apply(t,e)};l&&!c&&o(),d(),void 0===l&&i<u?o():!0!==r&&(c=setTimeout(l?function(){c=void 0}:o,void 0===l?i-u:i))}}return"boolean"!=typeof r&&(l=!!a,a=r,r=void 0),e.cancel=function(){d(),v=!0},e}function d(){return+Date.now()}var o="object"==typeof window;function m(){var n=y.ref(!1),t=y.ref(0),u=y.ref(0),o=y.ref(0);return v("deviceorientation",function(e){n.value=e.absolute,t.value=e.alpha,u.value=e.beta,o.value=e.gamma}),{isAbsolute:n,alpha:t,beta:u,gamma:o}}var s=["mousemove","mousedown","resize","keydown","touchstart","wheel"];function c(n,t,u){void 0===u&&(u=localStorage);var o=y.ref(t);function e(){try{var e=u.getItem(n);!e&&t?(u.setItem(n,t),e=t):o.value=e||void 0}catch(e){console.warn(e)}}return e(),v("storage",e),y.watch(o,function(){try{null==o.value?u.removeItem(n):u.setItem(n,o.value)}catch(e){console.warn(e)}},{flush:"sync",lazy:!0}),o}function t(e,n,t){function u(e){return e?JSON.stringify(e):""}function o(e){return e?JSON.parse(e):n||{}}void 0===t&&(t=localStorage);var i=c(e,u(n),t),r=y.ref(o(i.value));return y.watch(i,function(){return r.value=o(i.value)},{flush:"sync",lazy:!0}),y.watch(r,function(){i.value=u(r.value)},{flush:"sync",lazy:!0,deep:!0}),r}function u(e){var n;"undefined"!=typeof window&&(n=window.matchMedia(e));var t=y.ref(!!n&&n.matches);function u(e){t.value=e.matches}return y.onMounted(function(){n=n||window.matchMedia(e),t.value=n.matches,n.addListener(u)}),y.onUnmounted(function(){n.removeListener(u)}),t}function g(e,c){void 0===e&&(e=y.ref(document.body)),void 0===c&&(c=!1);var v=y.ref(0),f=y.ref(0),d=y.ref(0),s=y.ref(0),m=y.ref(0),g=y.ref(0),h=y.ref(0),w=y.ref(0),p=y.ref(!1),n=y.watch(e,function(l,e,n){function t(e){var n=(l||document.body).getBoundingClientRect(),t=n.left,u=n.top,o=n.width,i=n.height;v.value=e.pageX,f.value=e.pageY,m.value=t+window.pageXOffset,g.value=u+window.pageYOffset,h.value=i,w.value=o;var r=e.pageX-m.value,a=e.pageY-g.value;p.value=r<0||a<0||r>w.value||a>h.value,!c&&p.value||(d.value=r,s.value=a)}document.addEventListener("mousemove",t),n(function(){document.removeEventListener("mousemove",t)})});return{x:v,y:f,documentX:v,documentY:f,elementX:d,elementY:s,elementPositionX:m,elementPositionY:g,elementHeight:h,elementWidth:w,isOutside:p,stop:n}}function i(){var e=y.ref(!0),n=y.ref(!1),t=y.ref(void 0),u=y.ref(void 0),o=y.ref(void 0),i=y.ref(void 0),r=y.ref("unknown"),a=window.navigator,l="connection"in a?a.connection:void 0;function c(){e.value=a.onLine,t.value=e.value?void 0:Date.now(),l&&(u.value=l.downlink,o.value=l.downlinkMax,i.value=l.effectiveType,n.value=l.saveData,r.value=l.type)}return y.onMounted(c),v("offline",function(){e.value=!1,t.value=Date.now()}),v("online",function(){e.value=!0}),l&&v("change",c,!1,l),{isOnline:e,saveData:n,offlineAt:t,downlink:u,downlinkMax:o,effectiveType:i,type:r}}function h(){return+Date.now()}function w(){var e=y.ref(h()),n=!1,t=function(){requestAnimationFrame(function(){e.value=h(),n&&t()})};return n||(n=!0,t()),y.getCurrentInstance()&&y.onUnmounted(function(){n=!1}),e}function p(){}e.useAsyncState=function(e,n,t,u){void 0===t&&(t=0),void 0===u&&(u=function(e){});var o=y.ref(n),i=y.ref(!1);function r(){e.then(function(e){o.value=e,i.value=!0}).catch(u)}return t?a(r,t):r(),{state:o,ready:i}},e.useBattery=function(){var e=y.ref(!1),n=y.ref(0),t=y.ref(0),u=y.ref(1),o=y.ref("getBattery"in navigator);function i(){e.value=this.charging,n.value=this.chargingTime||0,t.value=this.dischargingTime||0,u.value=this.level}return y.onMounted(function(){o.value&&navigator.getBattery().then(function(n){i.call(n),l.forEach(function(e){n.addEventListener(e,i)})})}),y.onUnmounted(function(){o.value&&navigator.getBattery().then(function(n){l.forEach(function(e){n.removeEventListener(e,i)})})}),{charging:e,chargingTime:n,dischargingTime:t,level:u,supported:o}},e.useClipboard=function(){var n=y.ref(""),e=y.ref("clipboard"in window.navigator);return v("copy",function(){window.navigator.clipboard.readText().then(function(e){n.value=e})}),{text:n,copy:function(e){return n.value=e,window.navigator.clipboard.writeText(e)},supported:e}},e.useCounter=function(n){function t(e){return u.value=e}void 0===n&&(n=0);var u=y.ref(n);return{count:u,inc:function(e){return void 0===e&&(e=1),u.value+=e},dec:function(e){return void 0===e&&(e=1),u.value-=e},get:function(){return u.value},set:t,reset:function(e){return void 0===e&&(e=n),t(n=e)}}},e.useDeviceLight=function(){var n=y.ref(null);return v("devicelight",function(e){n.value=e.value}),n},e.useDeviceMotion=function(e){void 0===e&&(e={throttleMs:10});var n=y.ref({x:null,y:null,z:null}),t=y.ref({alpha:null,beta:null,gamma:null}),u=y.ref(0),o=y.ref({x:null,y:null,z:null});function i(e){n.value=e.acceleration,o.value=e.accelerationIncludingGravity,t.value=e.rotationRate,u.value=e.interval}return v("devicemotion",e.throttleMs?f(e.throttleMs,i):i,!1),{acceleration:n,accelerationIncludingGravity:o,rotationRate:t,interval:u}},e.useDeviceOrientation=m,e.useEventListener=v,e.useFullscreen=function(e){void 0===e&&(e=y.ref(document.body));var n=y.ref(!1);function t(){document.fullscreenElement&&document.exitFullscreen(),n.value=!1}return{isFullscreen:n,enterFullscreen:function(){t(),e.value.requestFullscreen().then(function(){n.value=!0})},exitFullscreen:t}},e.useGeolocation=function(e){void 0===e&&(e={enableHighAccuracy:!0,maximumAge:3e4,timeout:27e3});var n,t=y.ref(null),u=y.ref(null),o=y.ref({accuracy:0,latitude:0,longitude:0,altitude:null,altitudeAccuracy:null,heading:null,speed:null});function i(e){t.value=e.timestamp,o.value=e.coords,u.value=null}return y.onMounted(function(){"geolocation"in navigator&&(n=window.navigator.geolocation.watchPosition(i,function(e){u.value=e},e))}),y.onUnmounted(function(){n&&window.navigator.geolocation.clearWatch(n)}),{coords:o,locatedAt:t,error:u}},e.useIdle=function(e,n,t,u){void 0===e&&(e=6e4),void 0===n&&(n=!1),void 0===t&&(t=s),void 0===u&&(u=50);for(var o,i=y.ref(n),r=y.ref(d()),a=f(u,function(){i.value=!1,clearTimeout(o),o=setTimeout(function(){return i.value=!0},e),r.value=d()}),l=0,c=t;l<c.length;l++){v(c[l],a)}return v("visibilitychange",function(){document.hidden||a()},void 0,document),y.onMounted(function(){o=setTimeout(function(){return e=!0,void(i.value=e);var e},e)}),{idle:i,lastActive:r}},e.useInterval=function(e,n){void 0===e&&(e=1e3),void 0===n&&(n=!0);var t=null,u=y.ref(0);function o(){t&&(clearInterval(t),t=null)}function i(){o(),t=setInterval(function(){u.value+=1},e)}return n&&y.onMounted(i),y.getCurrentInstance()&&y.onUnmounted(o),{counter:u,start:i,stop:o}},e.useIntervalFn=function(e,n,t){void 0===n&&(n=1e3),void 0===t&&(t=!0);var u=null;function o(){u&&(clearInterval(u),u=null)}function i(){o(),u=setInterval(e,n)}return t&&i(),y.getCurrentInstance()&&y.onUnmounted(o),{start:i,stop:o}},e.useLocalStorage=function(e,n){return t(e,n,localStorage)},e.useMediaQuery=u,e.useMouse=function(e){void 0===e&&(e={});var n=e.touch,t=void 0===n||n,u=e.resetOnTouchEnds,o=void 0===u||u,i=e.initial,r=void 0===i?{x:0,y:0}:i,a=y.ref(r.x),l=y.ref(r.y);return v("mousemove",function(e){a.value=e.pageX,l.value=e.pageY}),t&&(v("touchmove",function(e){0<e.touches.length&&(a.value=e.touches[0].clientX,l.value=e.touches[0].clientY)}),o&&v("touchend",function(){a.value=r.x,l.value=r.y})),{x:a,y:l}},e.useMouseInElement=g,e.useNetwork=i,e.useNow=w,e.useOnline=function(){return i().isOnline},e.usePageLeave=function(){var t=y.ref(!1);return v("mouseout",function(e){var n=(e=e||window.event).relatedTarget||e.toElement;t.value=!n}),t},e.useParallax=function(e){var n=m(),t=n.beta,u=n.gamma,o=g(null===e||void 0===e?void 0:e.targetElement,!1),i=o.elementX,r=o.elementY,a=o.elementWidth,l=o.elementHeight,c=y.computed(function(){return null!=t.value&&null!=t.value?"deviceOrientation":"mouse"}),v=(null===e||void 0===e?void 0:e.deviceOrientationTiltAdjust)||function(e){return e},f=(null===e||void 0===e?void 0:e.deviceOrientationRollAdjust)||function(e){return e},d=(null===e||void 0===e?void 0:e.mouseTiltAdjust)||function(e){return e},s=(null===e||void 0===e?void 0:e.mouseRollAdjust)||function(e){return e};return{roll:y.computed(function(){if("deviceOrientation"===c.value&&null!=t.value){var e=-t.value/180;return f(e)}e=-(r.value-l.value/2)/l.value;return s(e)}),tilt:y.computed(function(){if("deviceOrientation"===c.value&&null!=u.value){var e=u.value/180;return v(e)}e=(i.value-a.value/2)/a.value;return d(e)}),source:c}},e.usePermission=function(e){function n(){t&&(o.value=t.state)}var t=null,u="string"==typeof e?{name:e}:e,o=y.ref("");return"permissions"in navigator&&navigator.permissions.query(u).then(function(e){t=e,n(),v("change",n,void 0,t)}).catch(p),o},e.usePreferredDark=function(){return u("(prefers-color-scheme: dark)")},e.usePreferredLanguages=function(){var e=y.ref(navigator.languages);return v("languagechange",function(){e.value=navigator.languages}),e},e.useRaf=function(){var e=w(),n=y.ref(e.value);return y.computed(function(){return e.value-n.value})},e.useRafFn=function(e,n){void 0===n&&(n={});var t=n.startNow,u=!1;function o(){u&&(e(),requestAnimationFrame(o))}function i(){u||(u=!0,o())}function r(){u=!1}return t&&i(),y.getCurrentInstance()&&y.onUnmounted(function(){return r()}),{stop:r,start:i}},e.useSessionStorage=function(e,n){return t(e,n,sessionStorage)},e.useStorage=t,e.useStoragePlain=c,e.useTimeout=r,e.useTimeoutFn=a,e.useWebWorker=function(e){var n,t=y.ref(null);return y.onMounted(function(){(n=new Worker(e)).onmessage=function(e){t.value=e.data}}),y.onUnmounted(function(){n.terminate()}),{data:t,post:function(e){n&&n.postMessage(e)},terminate:function(){n&&n.terminate()}}},e.useWindowScroll=function(){var e=y.ref(o?window.pageXOffset:0),n=y.ref(o?window.pageYOffset:0);return v("scroll",function(){e.value=window.pageXOffset,n.value=window.pageYOffset},{capture:!1,passive:!0}),{x:e,y:n}},e.useWindowSize=function(e,n){void 0===e&&(e=1/0),void 0===n&&(n=1/0);var t=y.ref(o?window.innerWidth:e),u=y.ref(o?window.innerWidth:n);return o||v("resize",function(){t.value=window.innerWidth,u.value=window.innerHeight}),{width:t,height:u}},e.version="2.0.0",Object.defineProperty(e,"__esModule",{value:!0})}); |
{ | ||
"name": "@vueuse/core", | ||
"version": "2.0.0-alpha.25", | ||
"version": "2.0.0", | ||
"description": "Collection of essential Vue Composition API", | ||
@@ -5,0 +5,0 @@ "main": "dist/main/index.js", |
@@ -70,2 +70,3 @@ <p align="center"> | ||
- [useRaf](https://vueuse.netlify.com/?path=/story/animation--useraf) | ||
- [useRafFn](https://vueuse.netlify.com/?path=/story/animation--useraffn) | ||
- [useTimeout](https://vueuse.netlify.com/?path=/story/animation--usetimeout) | ||
@@ -96,2 +97,3 @@ - [useTimeoutFn](https://vueuse.netlify.com/?path=/story/animation--usetimeoutfn) | ||
- [useOnline](https://vueuse.netlify.com/?path=/story/sensors--useonline) | ||
- [usePageLeave](https://vueuse.netlify.com/?path=/story/sensors--usepageleave) | ||
- [useParallax](https://vueuse.netlify.com/?path=/story/sensors--useparallax) | ||
@@ -98,0 +100,0 @@ - [useWindowScroll](https://vueuse.netlify.com/?path=/story/sensors--usewindowscroll) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
153
161169
3484