New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@vue-composable/web

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vue-composable/web - npm Package Compare versions

Comparing version 1.0.0-dev.20 to 1.0.0-dev.21

107

dist/web.cjs.js

@@ -829,9 +829,9 @@ 'use strict';

const args = e.data || [];
return new Promise((res) => {
return new Promise(res => {
try {
Promise.resolve(f.apply(f, args))
// @ts-ignore
.then((x) => res(postMessage([true, x])))
.then(x => res(postMessage([true, x])))
// @ts-ignore
.catch((x) => res(postMessage([false, x])));
.catch(x => res(postMessage([false, x])));
}

@@ -851,3 +851,3 @@ catch (e) {

"onmessage=",
`(${inlineWorkExecution.toString()})(${fn.toString()})`,
`(${inlineWorkExecution.toString()})(${fn.toString()})`
];

@@ -888,3 +888,3 @@ const blob = new Blob(blobScript, { type: "text/javascript" });

: core.NO_OP;
worker.addEventListener("message", (e) => {
worker.addEventListener("message", e => {
if (e.data[0]) {

@@ -898,3 +898,3 @@ res(e.data[1]);

}, core.PASSIVE_EV);
worker.addEventListener("error", (e) => {
worker.addEventListener("error", e => {
terminate();

@@ -911,3 +911,3 @@ rej(e);

lazy: true,
throwException: true,
throwException: true
});

@@ -1114,2 +1114,93 @@ return promise;

function intlDateFormatExtractArguments(localesOptions, opts) {
const wrappedOpts = core.wrap(opts);
const wrappedLocalesOptions = core.wrap(localesOptions);
return core.isObject(wrappedOpts.value) || compositionApi.isRef(opts)
? [
wrappedLocalesOptions.value !== undefined
? wrappedLocalesOptions
: undefined,
wrappedOpts
]
: core.isObject(wrappedLocalesOptions.value) &&
!core.isArray(wrappedLocalesOptions.value) &&
!core.isString(wrappedLocalesOptions.value)
? [undefined, wrappedLocalesOptions]
: [
wrappedLocalesOptions.value
? wrappedLocalesOptions
: undefined,
undefined
];
}
function useIntlNumberFormat(localesOptions, opts) {
const [locales, options] = intlDateFormatExtractArguments(localesOptions, opts);
const formatter = compositionApi.computed(() => new Intl.NumberFormat(core.unwrap(locales), core.unwrap(options)));
const formatString = (value, overrideOpts, overrideLocale) => {
const f = overrideOpts || overrideLocale
? new Intl.NumberFormat(core.unwrap(overrideLocale) ||
core.unwrap(locales), { ...core.unwrap(options), ...core.unwrap(overrideOpts) })
: formatter.value;
return f.format(core.unwrap(value));
};
const format = (value, overrideOpts, overrideLocale) => compositionApi.computed(() => formatString(value, overrideOpts, overrideLocale));
return {
format,
formatString,
formatter
};
}
function useCurrencyFormat(currencyCodeOptions, localesOptions, opts) {
const unwrapCodeOptions = core.unwrap(currencyCodeOptions);
const hasCurrency = !core.isObject(unwrapCodeOptions);
const currencyCode = hasCurrency
? currencyCodeOptions
: compositionApi.computed(() => {
const o = core.unwrap(currencyCodeOptions);
return o.currency;
});
const [locales, argOptions] = intlDateFormatExtractArguments(localesOptions, hasCurrency
? opts
: currencyCodeOptions);
const options = compositionApi.computed(() => {
const opts = core.unwrap(argOptions) || {};
const currency = core.unwrap(currencyCode) || opts.currency;
return {
style: "currency",
...opts,
currency
};
});
const numberFormat = useIntlNumberFormat(locales);
const formatString = (amount, currency, display, opts, overrideLocale) => {
const o = { ...options.value, ...core.unwrap(opts) };
const c = core.unwrap(currency) || o.currency;
const d = core.unwrap(display) || o.currencyDisplay;
// istanbul ignore else
{
if (!c) {
console.error("[useCurrencyFormat] No currency provided.");
return "";
}
if (o.style !== "currency") {
console.warn("[useCurrencyFormat] invalid style passed in options, please leave it undefined.");
}
}
return numberFormat.formatString(amount, {
...o,
currency: c,
currencyDisplay: d
}, overrideLocale);
};
const format = (amount, currency, display, opts, overrideLocale) => {
return compositionApi.computed(() => formatString(amount, currency, display, opts, overrideLocale));
};
return {
format,
formatString
};
}
function getBreakpointWidth(bp) {

@@ -1561,2 +1652,3 @@ if (!bp)

exports.useCssVariables = useCssVariables;
exports.useCurrencyFormat = useCurrencyFormat;
exports.useEvent = useEvent;

@@ -1566,2 +1658,3 @@ exports.useFetch = useFetch;

exports.useIntersectionObserver = useIntersectionObserver;
exports.useIntlNumberFormat = useIntlNumberFormat;
exports.useLanguage = useLanguage;

@@ -1568,0 +1661,0 @@ exports.useLocalStorage = useLocalStorage;

@@ -792,9 +792,9 @@ 'use strict';

const args = e.data || [];
return new Promise((res) => {
return new Promise(res => {
try {
Promise.resolve(f.apply(f, args))
// @ts-ignore
.then((x) => res(postMessage([true, x])))
.then(x => res(postMessage([true, x])))
// @ts-ignore
.catch((x) => res(postMessage([false, x])));
.catch(x => res(postMessage([false, x])));
}

@@ -814,3 +814,3 @@ catch (e) {

"onmessage=",
`(${inlineWorkExecution.toString()})(${fn.toString()})`,
`(${inlineWorkExecution.toString()})(${fn.toString()})`
];

@@ -851,3 +851,3 @@ const blob = new Blob(blobScript, { type: "text/javascript" });

: core.NO_OP;
worker.addEventListener("message", (e) => {
worker.addEventListener("message", e => {
if (e.data[0]) {

@@ -861,3 +861,3 @@ res(e.data[1]);

}, core.PASSIVE_EV);
worker.addEventListener("error", (e) => {
worker.addEventListener("error", e => {
terminate();

@@ -874,3 +874,3 @@ rej(e);

lazy: true,
throwException: true,
throwException: true
});

@@ -1056,2 +1056,83 @@ return promise;

function intlDateFormatExtractArguments(localesOptions, opts) {
const wrappedOpts = core.wrap(opts);
const wrappedLocalesOptions = core.wrap(localesOptions);
return core.isObject(wrappedOpts.value) || compositionApi.isRef(opts)
? [
wrappedLocalesOptions.value !== undefined
? wrappedLocalesOptions
: undefined,
wrappedOpts
]
: core.isObject(wrappedLocalesOptions.value) &&
!core.isArray(wrappedLocalesOptions.value) &&
!core.isString(wrappedLocalesOptions.value)
? [undefined, wrappedLocalesOptions]
: [
wrappedLocalesOptions.value
? wrappedLocalesOptions
: undefined,
undefined
];
}
function useIntlNumberFormat(localesOptions, opts) {
const [locales, options] = intlDateFormatExtractArguments(localesOptions, opts);
const formatter = compositionApi.computed(() => new Intl.NumberFormat(core.unwrap(locales), core.unwrap(options)));
const formatString = (value, overrideOpts, overrideLocale) => {
const f = overrideOpts || overrideLocale
? new Intl.NumberFormat(core.unwrap(overrideLocale) ||
core.unwrap(locales), { ...core.unwrap(options), ...core.unwrap(overrideOpts) })
: formatter.value;
return f.format(core.unwrap(value));
};
const format = (value, overrideOpts, overrideLocale) => compositionApi.computed(() => formatString(value, overrideOpts, overrideLocale));
return {
format,
formatString,
formatter
};
}
function useCurrencyFormat(currencyCodeOptions, localesOptions, opts) {
const unwrapCodeOptions = core.unwrap(currencyCodeOptions);
const hasCurrency = !core.isObject(unwrapCodeOptions);
const currencyCode = hasCurrency
? currencyCodeOptions
: compositionApi.computed(() => {
const o = core.unwrap(currencyCodeOptions);
return o.currency;
});
const [locales, argOptions] = intlDateFormatExtractArguments(localesOptions, hasCurrency
? opts
: currencyCodeOptions);
const options = compositionApi.computed(() => {
const opts = core.unwrap(argOptions) || {};
const currency = core.unwrap(currencyCode) || opts.currency;
return {
style: "currency",
...opts,
currency
};
});
const numberFormat = useIntlNumberFormat(locales);
const formatString = (amount, currency, display, opts, overrideLocale) => {
const o = { ...options.value, ...core.unwrap(opts) };
const c = core.unwrap(currency) || o.currency;
const d = core.unwrap(display) || o.currencyDisplay;
return numberFormat.formatString(amount, {
...o,
currency: c,
currencyDisplay: d
}, overrideLocale);
};
const format = (amount, currency, display, opts, overrideLocale) => {
return compositionApi.computed(() => formatString(amount, currency, display, opts, overrideLocale));
};
return {
format,
formatString
};
}
function getBreakpointWidth(bp) {

@@ -1478,2 +1559,3 @@ if (!bp)

exports.useCssVariables = useCssVariables;
exports.useCurrencyFormat = useCurrencyFormat;
exports.useEvent = useEvent;

@@ -1483,2 +1565,3 @@ exports.useFetch = useFetch;

exports.useIntersectionObserver = useIntersectionObserver;
exports.useIntlNumberFormat = useIntlNumberFormat;
exports.useLanguage = useLanguage;

@@ -1485,0 +1568,0 @@ exports.useLocalStorage = useLocalStorage;

@@ -77,2 +77,11 @@ import { CancellablePromiseResult } from '@vue-composable/core';

export declare type CurrencyCodes = "AFA" | "ALL" | "DZD" | "AOR" | "ARS" | "AMD" | "AWG" | "AUD" | "AZN" | "BSD" | "BHD" | "BDT" | "BBD" | "BYN" | "BZD" | "BMD" | "BTN" | "BOB" | "BWP" | "BRL" | "GBP" | "BND" | "BGN" | "BIF" | "KHR" | "CAD" | "CVE" | "KYD" | "XOF" | "XAF" | "XPF" | "CLP" | "CNY" | "COP" | "KMF" | "CDF" | "CRC" | "HRK" | "CUP" | "CZK" | "DKK" | "DJF" | "DOP" | "XCD" | "EGP" | "SVC" | "ERN" | "EEK" | "ETB" | "EUR" | "FKP" | "FJD" | "GMD" | "GEL" | "GHS" | "GIP" | "XAU" | "XFO" | "GTQ" | "GNF" | "GYD" | "HTG" | "HNL" | "HKD" | "HUF" | "ISK" | "XDR" | "INR" | "IDR" | "IRR" | "IQD" | "ILS" | "JMD" | "JPY" | "JOD" | "KZT" | "KES" | "KWD" | "KGS" | "LAK" | "LVL" | "LBP" | "LSL" | "LRD" | "LYD" | "LTL" | "MOP" | "MKD" | "MGA" | "MWK" | "MYR" | "MVR" | "MRO" | "MUR" | "MXN" | "MDL" | "MNT" | "MAD" | "MZN" | "MMK" | "NAD" | "NPR" | "ANG" | "NZD" | "NIO" | "NGN" | "KPW" | "NOK" | "OMR" | "PKR" | "XPD" | "PAB" | "PGK" | "PYG" | "PEN" | "PHP" | "XPT" | "PLN" | "QAR" | "RON" | "RUB" | "RWF" | "SHP" | "WST" | "STD" | "SAR" | "RSD" | "SCR" | "SLL" | "XAG" | "SGD" | "SBD" | "SOS" | "ZAR" | "KRW" | "LKR" | "SDG" | "SRD" | "SZL" | "SEK" | "CHF" | "SYP" | "TWD" | "TJS" | "TZS" | "THB" | "TOP" | "TTD" | "TND" | "TRY" | "TMT" | "AED" | "UGX" | "XFU" | "UAH" | "UYU" | "USD" | "UZS" | "VUV" | "VEF" | "VND" | "YER" | "ZMK" | "ZWL";
export declare type CurrencyDisplay = "none" | "symbol" | "code";
export declare interface CurrencyFormatReturn {
format: (amount: RefTyped<number>, currency?: Readonly<RefTyped<Readonly<CurrencyCodes>>>, display?: RefTyped<CurrencyDisplay>, overrideOptions?: RefTyped<IntlNumberFormatOptions>, overrideLocale?: RefTyped<IntlNumberFormatLocales>) => Ref<Readonly<string>>;
formatString: (amount: RefTyped<number>, currency?: Readonly<RefTyped<Readonly<CurrencyCodes>>>, display?: RefTyped<CurrencyDisplay>, overrideOptions?: RefTyped<IntlNumberFormatOptions>, overrideLocale?: RefTyped<IntlNumberFormatLocales>) => string;
}
declare interface DefaultTailwindBreakpoints {

@@ -134,2 +143,30 @@ sm: 640;

export declare type IntlNumberFormatLocales = RefTyped<string> | RefTyped<string[]> | undefined;
export declare type IntlNumberFormatOptions = Intl.NumberFormatOptions & {
style?: IntNumberFormatOptionStyle & string;
currency?: CurrencyCodes & string;
currencyDisplay?: CurrencyDisplay & string;
};
export declare type IntNumberFormatOptionStyle =
/**
* A decimal style format
*/
"decimal"
/**
* A percent style format.
*/
| "percent"
/**
* A currency style format that uses the currency symbol defined by the number formatter locale.
*/
| "currency"
/**
* A unit format
*/
| "unit";
export declare type IntNumberFormatterFormat<T> = (value: Readonly<RefTyped<Readonly<number>>>, overrideOpts?: RefTyped<Intl.NumberFormatOptions>, overrideLocale?: RefTyped<IntlNumberFormatLocales>) => T;
export declare interface LocalStorageReturn<T> {

@@ -212,2 +249,8 @@ supported: boolean;

export declare interface NumberFormatReturn {
formatter: Ref<Readonly<Intl.NumberFormat>>;
format: IntNumberFormatterFormat<Ref<Readonly<string>>>;
formatString: IntNumberFormatterFormat<string>;
}
export declare function refShared<T = any>(defaultValue?: RefTyped<T>, id?: string): Ref<RefTyped<T>>;

@@ -363,2 +406,18 @@

export declare function useCurrencyFormat(): CurrencyFormatReturn;
export declare function useCurrencyFormat(options: RefTyped<IntlNumberFormatOptions>, locales?: IntlNumberFormatLocales): CurrencyFormatReturn;
export declare function useCurrencyFormat(currencyCode: Readonly<RefTyped<Readonly<CurrencyCodes>>>): CurrencyFormatReturn;
export declare function useCurrencyFormat(currencyCode: Ref<string> | string): CurrencyFormatReturn;
export declare function useCurrencyFormat(currencyCode: Readonly<RefTyped<Readonly<CurrencyCodes>>>, locales: IntlNumberFormatLocales, options?: RefTyped<IntlNumberFormatOptions>): CurrencyFormatReturn;
export declare function useCurrencyFormat(currencyCode: Ref<string> | string, locales: IntlNumberFormatLocales, options?: RefTyped<IntlNumberFormatOptions>): CurrencyFormatReturn;
export declare function useCurrencyFormat(currencyCode: Readonly<RefTyped<Readonly<CurrencyCodes>>>, options: RefTyped<IntlNumberFormatOptions>): CurrencyFormatReturn;
export declare function useCurrencyFormat(currencyCode: Ref<string> | string, options: RefTyped<IntlNumberFormatOptions>): CurrencyFormatReturn;
export declare function useEvent<T extends {

@@ -408,2 +467,14 @@ addEventListener: (name: string, listener: EventListenerOrEventListenerObject) => any;

export declare function useIntlNumberFormat(): NumberFormatReturn;
export declare function useIntlNumberFormat(locales: IntlNumberFormatLocales): NumberFormatReturn;
export declare function useIntlNumberFormat(options: RefTyped<IntlNumberFormatOptions>): NumberFormatReturn;
export declare function useIntlNumberFormat(options: RefTyped<Intl.NumberFormatOptions>): NumberFormatReturn;
export declare function useIntlNumberFormat(locales: IntlNumberFormatLocales, options?: RefTyped<IntlNumberFormatOptions | undefined>): NumberFormatReturn;
export declare function useIntlNumberFormat(locales: IntlNumberFormatLocales, options: RefTyped<Intl.NumberFormatOptions | undefined>): NumberFormatReturn;
export declare function useLanguage(): {

@@ -410,0 +481,0 @@ language: Ref<String>;

@@ -828,9 +828,9 @@ import { onUnmounted, onMounted, watch, ref, isRef, computed, getCurrentInstance, provide, inject } from '@vue/composition-api';

const args = e.data || [];
return new Promise((res) => {
return new Promise(res => {
try {
Promise.resolve(f.apply(f, args))
// @ts-ignore
.then((x) => res(postMessage([true, x])))
.then(x => res(postMessage([true, x])))
// @ts-ignore
.catch((x) => res(postMessage([false, x])));
.catch(x => res(postMessage([false, x])));
}

@@ -850,3 +850,3 @@ catch (e) {

"onmessage=",
`(${inlineWorkExecution.toString()})(${fn.toString()})`,
`(${inlineWorkExecution.toString()})(${fn.toString()})`
];

@@ -887,3 +887,3 @@ const blob = new Blob(blobScript, { type: "text/javascript" });

: NO_OP;
worker.addEventListener("message", (e) => {
worker.addEventListener("message", e => {
if (e.data[0]) {

@@ -897,3 +897,3 @@ res(e.data[1]);

}, PASSIVE_EV);
worker.addEventListener("error", (e) => {
worker.addEventListener("error", e => {
terminate();

@@ -910,3 +910,3 @@ rej(e);

lazy: true,
throwException: true,
throwException: true
});

@@ -1113,2 +1113,93 @@ return promise;

function intlDateFormatExtractArguments(localesOptions, opts) {
const wrappedOpts = wrap(opts);
const wrappedLocalesOptions = wrap(localesOptions);
return isObject(wrappedOpts.value) || isRef(opts)
? [
wrappedLocalesOptions.value !== undefined
? wrappedLocalesOptions
: undefined,
wrappedOpts
]
: isObject(wrappedLocalesOptions.value) &&
!isArray(wrappedLocalesOptions.value) &&
!isString(wrappedLocalesOptions.value)
? [undefined, wrappedLocalesOptions]
: [
wrappedLocalesOptions.value
? wrappedLocalesOptions
: undefined,
undefined
];
}
function useIntlNumberFormat(localesOptions, opts) {
const [locales, options] = intlDateFormatExtractArguments(localesOptions, opts);
const formatter = computed(() => new Intl.NumberFormat(unwrap(locales), unwrap(options)));
const formatString = (value, overrideOpts, overrideLocale) => {
const f = overrideOpts || overrideLocale
? new Intl.NumberFormat(unwrap(overrideLocale) ||
unwrap(locales), { ...unwrap(options), ...unwrap(overrideOpts) })
: formatter.value;
return f.format(unwrap(value));
};
const format = (value, overrideOpts, overrideLocale) => computed(() => formatString(value, overrideOpts, overrideLocale));
return {
format,
formatString,
formatter
};
}
function useCurrencyFormat(currencyCodeOptions, localesOptions, opts) {
const unwrapCodeOptions = unwrap(currencyCodeOptions);
const hasCurrency = !isObject(unwrapCodeOptions);
const currencyCode = hasCurrency
? currencyCodeOptions
: computed(() => {
const o = unwrap(currencyCodeOptions);
return o.currency;
});
const [locales, argOptions] = intlDateFormatExtractArguments(localesOptions, hasCurrency
? opts
: currencyCodeOptions);
const options = computed(() => {
const opts = unwrap(argOptions) || {};
const currency = unwrap(currencyCode) || opts.currency;
return {
style: "currency",
...opts,
currency
};
});
const numberFormat = useIntlNumberFormat(locales);
const formatString = (amount, currency, display, opts, overrideLocale) => {
const o = { ...options.value, ...unwrap(opts) };
const c = unwrap(currency) || o.currency;
const d = unwrap(display) || o.currencyDisplay;
// istanbul ignore else
if ((process.env.NODE_ENV !== 'production')) {
if (!c) {
console.error("[useCurrencyFormat] No currency provided.");
return "";
}
if (o.style !== "currency") {
console.warn("[useCurrencyFormat] invalid style passed in options, please leave it undefined.");
}
}
return numberFormat.formatString(amount, {
...o,
currency: c,
currencyDisplay: d
}, overrideLocale);
};
const format = (amount, currency, display, opts, overrideLocale) => {
return computed(() => formatString(amount, currency, display, opts, overrideLocale));
};
return {
format,
formatString
};
}
function getBreakpointWidth(bp) {

@@ -1549,2 +1640,2 @@ if (!bp)

export { exposeWorker, getCssVariableFor, refShared, setBreakpointTailwindCSS, setCssVariableFor, storageAvailable, useBreakpoint, useBreakpointChrome, useBreakpointTailwindCSS, useBroadcastChannel, useCssVariables, useEvent, useFetch, useGeolocation, useIntersectionObserver, useLanguage, useLocalStorage, useMatchMedia, useNetworkInformation, useOnMouseMove, useOnResize, useOnScroll, useOnline, usePageVisibility, useSessionStorage, useSharedRef, useStorage, useWebSocket, useWebStorage, useWorker, useWorkerFunction };
export { exposeWorker, getCssVariableFor, refShared, setBreakpointTailwindCSS, setCssVariableFor, storageAvailable, useBreakpoint, useBreakpointChrome, useBreakpointTailwindCSS, useBroadcastChannel, useCssVariables, useCurrencyFormat, useEvent, useFetch, useGeolocation, useIntersectionObserver, useIntlNumberFormat, useLanguage, useLocalStorage, useMatchMedia, useNetworkInformation, useOnMouseMove, useOnResize, useOnScroll, useOnline, usePageVisibility, useSessionStorage, useSharedRef, useStorage, useWebSocket, useWebStorage, useWorker, useWorkerFunction };

4

package.json
{
"name": "@vue-composable/web",
"version": "1.0.0-dev.20",
"version": "1.0.0-dev.21",
"description": "@vue-composable/web",

@@ -42,3 +42,3 @@ "main": "index.js",

"dependencies": {
"@vue-composable/core": "1.0.0-dev.20"
"@vue-composable/core": "1.0.0-dev.21"
},

@@ -45,0 +45,0 @@ "devDependencies": {

@@ -46,2 +46,7 @@ # @vue-composable/web

### Intl
- [numberFormat](https://pikax.me/vue-composable/composable/Intl/numberFormat) - Intl.NumberFormat
- [currencyFormat](https://pikax.me/vue-composable/composable/Intl/currencyFormat) - CurrencyFormat with Intl.NumberFormat
### Storage

@@ -48,0 +53,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc