@vueuse/integrations
Advanced tools
Comparing version 4.0.0-beta.31 to 4.0.0-beta.32
@@ -9,2 +9,3 @@ 'use strict'; | ||
var Cookie = require('universal-cookie'); | ||
var QRCode = require('qrcode'); | ||
@@ -15,2 +16,3 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
var Cookie__default = /*#__PURE__*/_interopDefaultLegacy(Cookie); | ||
var QRCode__default = /*#__PURE__*/_interopDefaultLegacy(QRCode); | ||
@@ -123,4 +125,16 @@ function useAxios(url, config) { | ||
function useQRCode(text, options) { | ||
const src = vueDemi.ref(text); | ||
const result = vueDemi.ref(''); | ||
vueDemi.watch(src, async (value) => { | ||
result.value = await QRCode__default['default'].toDataURL(value, options); | ||
}, { | ||
immediate: true, | ||
}); | ||
return result; | ||
} | ||
exports.createCookies = createCookies; | ||
exports.useAxios = useAxios; | ||
exports.useCookies = useCookies; | ||
exports.useQRCode = useQRCode; |
/// <reference types="node" /> | ||
import { Ref } from 'vue-demi'; | ||
import { Ref, ComputedRef } from 'vue-demi'; | ||
import { AxiosRequestConfig, AxiosResponse, AxiosError } from 'axios'; | ||
import _mp_rt2_universal_cookie___CookieGetOptions, { CookieGetOptions, CookieSetOptions, CookieChangeListener } from 'universal-cookie'; | ||
import { IncomingMessage } from 'http'; | ||
import QRCode from 'qrcode'; | ||
@@ -65,2 +66,4 @@ declare function useAxios<T = any>(url: string, config?: AxiosRequestConfig): { | ||
export { createCookies, useAxios, useCookies }; | ||
declare function useQRCode(text: Ref<string> | ComputedRef<string> | string, options?: QRCode.QRCodeToDataURLOptions): Ref<string>; | ||
export { createCookies, useAxios, useCookies, useQRCode }; |
@@ -1,5 +0,6 @@ | ||
import { ref } from 'vue-demi'; | ||
import { ref, watch } from 'vue-demi'; | ||
import axios from 'axios'; | ||
import { tryOnMounted, tryOnUnmounted } from '@vueuse/shared'; | ||
import Cookie from 'universal-cookie'; | ||
import QRCode from 'qrcode'; | ||
@@ -112,2 +113,13 @@ function useAxios(url, config) { | ||
export { createCookies, useAxios, useCookies }; | ||
function useQRCode(text, options) { | ||
const src = ref(text); | ||
const result = ref(''); | ||
watch(src, async (value) => { | ||
result.value = await QRCode.toDataURL(value, options); | ||
}, { | ||
immediate: true, | ||
}); | ||
return result; | ||
} | ||
export { createCookies, useAxios, useCookies, useQRCode }; |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue-demi'), require('axios'), require('@vueuse/shared'), require('universal-cookie')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'vue-demi', 'axios', '@vueuse/shared', 'universal-cookie'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.VueUseIntegrations = {}, global.VueDemi, global.axios, global.VueUseShared, global.UniversalCookie)); | ||
}(this, (function (exports, vueDemi, axios, shared, Cookie) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue-demi'), require('axios'), require('@vueuse/shared'), require('universal-cookie'), require('qrcode')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'vue-demi', 'axios', '@vueuse/shared', 'universal-cookie', 'qrcode'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.VueUseIntegrations = {}, global.VueDemi, global.axios, global.VueUseShared, global.UniversalCookie, global.QRCode)); | ||
}(this, (function (exports, vueDemi, axios, shared, Cookie, QRCode) { 'use strict'; | ||
@@ -11,2 +11,3 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
var Cookie__default = /*#__PURE__*/_interopDefaultLegacy(Cookie); | ||
var QRCode__default = /*#__PURE__*/_interopDefaultLegacy(QRCode); | ||
@@ -119,5 +120,17 @@ function useAxios(url, config) { | ||
function useQRCode(text, options) { | ||
const src = vueDemi.ref(text); | ||
const result = vueDemi.ref(''); | ||
vueDemi.watch(src, async (value) => { | ||
result.value = await QRCode__default['default'].toDataURL(value, options); | ||
}, { | ||
immediate: true, | ||
}); | ||
return result; | ||
} | ||
exports.createCookies = createCookies; | ||
exports.useAxios = useAxios; | ||
exports.useCookies = useCookies; | ||
exports.useQRCode = useQRCode; | ||
@@ -124,0 +137,0 @@ Object.defineProperty(exports, '__esModule', { value: true }); |
@@ -1,1 +0,1 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("vue-demi"),require("axios"),require("@vueuse/shared"),require("universal-cookie")):"function"==typeof define&&define.amd?define(["exports","vue-demi","axios","@vueuse/shared","universal-cookie"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).VueUseIntegrations={},e.VueDemi,e.axios,e.VueUseShared,e.UniversalCookie)}(this,(function(e,n,t,o,r){"use strict";function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=a(t),u=a(r);function i(e,{doNotParse:t=!1,autoUpdateDependencies:r=!1}={},a=new u.default){const s=r?[...e||[]]:e;let i=a.getAll({doNotParse:!0});const d=n.ref(0),l=()=>{const e=a.getAll({doNotParse:!0});(function(e,n,t){if(!e)return!0;for(const o of e)if(n[o]!==t[o])return!0;return!1})(s||null,e,i)&&d.value++,i=e};return o.tryOnMounted((()=>{a.addChangeListener(l)})),o.tryOnUnmounted((()=>{a.removeChangeListener(l)})),{get:(...e)=>(r&&s&&!s.includes(e[0])&&s.push(e[0]),d.value,a.get(e[0],Object.assign({doNotParse:t},e[1]))),getAll:(...e)=>(d.value,a.getAll(Object.assign({doNotParse:t},e[0]))),set:(...e)=>a.set(...e),remove:(...e)=>a.remove(...e),addChangeListener:(...e)=>a.addChangeListener(...e),removeChangeListener:(...e)=>a.removeChangeListener(...e)}}e.createCookies=function(e){const n=new u.default(e?e.headers.cookie:null);return(e,{doNotParse:t=!1,autoUpdateDependencies:o=!1}={})=>i(e,{doNotParse:t,autoUpdateDependencies:o},n)},e.useAxios=function(e,t){const o=n.ref(null),r=n.ref(void 0),a=n.ref(!1),u=n.ref(!1),i=n.ref(),d=s.default.CancelToken.source();return s.default(e,Object.assign(Object.assign({},t),{cancelToken:d.token})).then((e=>{o.value=e,r.value=e.data,a.value=!0})).catch((e=>{i.value=e,a.value=!0})),{response:o,data:r,error:i,finished:a,cancel:e=>{d.cancel(e),u.value=!0},canceled:u}},e.useCookies=i,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue-demi"),require("axios"),require("@vueuse/shared"),require("universal-cookie"),require("qrcode")):"function"==typeof define&&define.amd?define(["exports","vue-demi","axios","@vueuse/shared","universal-cookie","qrcode"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).VueUseIntegrations={},e.VueDemi,e.axios,e.VueUseShared,e.UniversalCookie,e.QRCode)}(this,(function(e,t,n,o,r,a){"use strict";function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=s(n),i=s(r),d=s(a);function l(e,{doNotParse:n=!1,autoUpdateDependencies:r=!1}={},a=new i.default){const s=r?[...e||[]]:e;let u=a.getAll({doNotParse:!0});const d=t.ref(0),l=()=>{const e=a.getAll({doNotParse:!0});(function(e,t,n){if(!e)return!0;for(const o of e)if(t[o]!==n[o])return!0;return!1})(s||null,e,u)&&d.value++,u=e};return o.tryOnMounted((()=>{a.addChangeListener(l)})),o.tryOnUnmounted((()=>{a.removeChangeListener(l)})),{get:(...e)=>(r&&s&&!s.includes(e[0])&&s.push(e[0]),d.value,a.get(e[0],Object.assign({doNotParse:n},e[1]))),getAll:(...e)=>(d.value,a.getAll(Object.assign({doNotParse:n},e[0]))),set:(...e)=>a.set(...e),remove:(...e)=>a.remove(...e),addChangeListener:(...e)=>a.addChangeListener(...e),removeChangeListener:(...e)=>a.removeChangeListener(...e)}}e.createCookies=function(e){const t=new i.default(e?e.headers.cookie:null);return(e,{doNotParse:n=!1,autoUpdateDependencies:o=!1}={})=>l(e,{doNotParse:n,autoUpdateDependencies:o},t)},e.useAxios=function(e,n){const o=t.ref(null),r=t.ref(void 0),a=t.ref(!1),s=t.ref(!1),i=t.ref(),d=u.default.CancelToken.source();return u.default(e,Object.assign(Object.assign({},n),{cancelToken:d.token})).then((e=>{o.value=e,r.value=e.data,a.value=!0})).catch((e=>{i.value=e,a.value=!0})),{response:o,data:r,error:i,finished:a,cancel:e=>{d.cancel(e),s.value=!0},canceled:s}},e.useCookies=l,e.useQRCode=function(e,n){const o=t.ref(e),r=t.ref("");return t.watch(o,(async e=>{r.value=await d.default.toDataURL(e,n)}),{immediate:!0}),r},Object.defineProperty(e,"__esModule",{value:!0})})); |
{ | ||
"name": "@vueuse/integrations", | ||
"description": "Integration wrappers for utility libraries", | ||
"version": "4.0.0-beta.31", | ||
"version": "4.0.0-beta.32", | ||
"main": "dist/index.cjs.js", | ||
@@ -30,3 +30,3 @@ "types": "dist/index.d.ts", | ||
"dependencies": { | ||
"@vueuse/shared": "4.0.0-beta.31", | ||
"@vueuse/shared": "4.0.0-beta.32", | ||
"vue-demi": "latest" | ||
@@ -36,8 +36,11 @@ }, | ||
"axios": "^0.20.0", | ||
"qrcode": "^1.4.4", | ||
"universal-cookie": "^4.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/qrcode": "^1.3.5", | ||
"@types/universal-cookie": "^2.2.0", | ||
"qrcode": "^1.4.4", | ||
"universal-cookie": "^4.0.0" | ||
} | ||
} |
@@ -20,5 +20,6 @@ # @vueuse/integrations | ||
- Integrations | ||
- [`useAxios`](https://vueuse.js.org/?path=/story/add-ons-integrations--useaxios) — wrapper for [`axios`](https://github.com/axios/axios) | ||
- [`useCookies`](https://vueuse.js.org/?path=/story/add-ons-integrations--usecookies) — wrapper for `universal-cookie` module (similar to [react-cookie](https://www.npmjs.com/package/react-cookie)) | ||
- /Integrations | ||
- [`useAxios`](https://vueuse.js.org/?path=/story/integrations--useaxios) — wrapper for [`axios`](https://github.com/axios/axios) | ||
- [`useCookies`](https://vueuse.js.org/?path=/story/integrations--usecookies) — wrapper for [`universal-cookie`](https://www.npmjs.com/package/universal-cookie) | ||
- [`useQrcode`](https://vueuse.js.org/?path=/story/integrations--useqrcode) — wrapper for [`qrcode`](https://github.com/soldair/node-qrcode) | ||
@@ -25,0 +26,0 @@ <!--FUNCTIONS_LIST_ENDS--> |
Sorry, the diff of this file is not supported yet
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
25640
461
30
5
4
+ Added@vueuse/shared@4.0.0-beta.32(transitive)
+ Addedansi-regex@5.0.1(transitive)
+ Addedansi-styles@4.3.0(transitive)
+ Addedcamelcase@5.3.1(transitive)
+ Addedcliui@6.0.0(transitive)
+ Addedcolor-convert@2.0.1(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addeddecamelize@1.2.0(transitive)
+ Addeddijkstrajs@1.0.3(transitive)
+ Addedemoji-regex@8.0.0(transitive)
+ Addedfind-up@4.1.0(transitive)
+ Addedget-caller-file@2.0.5(transitive)
+ Addedis-fullwidth-code-point@3.0.0(transitive)
+ Addedlocate-path@5.0.0(transitive)
+ Addedp-limit@2.3.0(transitive)
+ Addedp-locate@4.1.0(transitive)
+ Addedp-try@2.2.0(transitive)
+ Addedpath-exists@4.0.0(transitive)
+ Addedpngjs@5.0.0(transitive)
+ Addedqrcode@1.5.4(transitive)
+ Addedrequire-directory@2.1.1(transitive)
+ Addedrequire-main-filename@2.0.0(transitive)
+ Addedset-blocking@2.0.0(transitive)
+ Addedstring-width@4.2.3(transitive)
+ Addedstrip-ansi@6.0.1(transitive)
+ Addedwhich-module@2.0.1(transitive)
+ Addedwrap-ansi@6.2.0(transitive)
+ Addedy18n@4.0.3(transitive)
+ Addedyargs@15.4.1(transitive)
+ Addedyargs-parser@18.1.3(transitive)
- Removed@vueuse/shared@4.0.0-beta.31(transitive)
Updated@vueuse/shared@4.0.0-beta.32