preact-intlayer 8.5.0 → 8.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/client/index.cjs +0 -2
- package/dist/cjs/format/index.cjs +20 -0
- package/dist/cjs/{client/format → format}/useCompact.cjs +3 -3
- package/dist/cjs/format/useCompact.cjs.map +1 -0
- package/dist/cjs/{client/format → format}/useCurrency.cjs +3 -3
- package/dist/cjs/format/useCurrency.cjs.map +1 -0
- package/dist/cjs/{client/format → format}/useDate.cjs +3 -3
- package/dist/cjs/format/useDate.cjs.map +1 -0
- package/dist/cjs/{client/format → format}/useIntl.cjs +3 -3
- package/dist/cjs/format/useIntl.cjs.map +1 -0
- package/dist/cjs/{client/format → format}/useList.cjs +3 -3
- package/dist/cjs/format/useList.cjs.map +1 -0
- package/dist/cjs/{client/format → format}/useNumber.cjs +3 -3
- package/dist/cjs/format/useNumber.cjs.map +1 -0
- package/dist/cjs/{client/format → format}/usePercentage.cjs +3 -3
- package/dist/cjs/format/usePercentage.cjs.map +1 -0
- package/dist/cjs/{client/format → format}/useRelativeTime.cjs +3 -3
- package/dist/cjs/format/useRelativeTime.cjs.map +1 -0
- package/dist/cjs/{client/format → format}/useUnit.cjs +3 -3
- package/dist/cjs/format/useUnit.cjs.map +1 -0
- package/dist/cjs/index.cjs +0 -2
- package/dist/esm/client/index.mjs +1 -2
- package/dist/esm/{client/format → format}/index.mjs +2 -1
- package/dist/esm/{client/format → format}/useCompact.mjs +2 -2
- package/dist/esm/format/useCompact.mjs.map +1 -0
- package/dist/esm/{client/format → format}/useCurrency.mjs +2 -2
- package/dist/esm/format/useCurrency.mjs.map +1 -0
- package/dist/esm/{client/format → format}/useDate.mjs +2 -2
- package/dist/esm/format/useDate.mjs.map +1 -0
- package/dist/esm/{client/format → format}/useIntl.mjs +2 -2
- package/dist/esm/format/useIntl.mjs.map +1 -0
- package/dist/esm/{client/format → format}/useList.mjs +2 -2
- package/dist/esm/format/useList.mjs.map +1 -0
- package/dist/esm/{client/format → format}/useNumber.mjs +2 -2
- package/dist/esm/format/useNumber.mjs.map +1 -0
- package/dist/esm/{client/format → format}/usePercentage.mjs +2 -2
- package/dist/esm/format/usePercentage.mjs.map +1 -0
- package/dist/esm/{client/format → format}/useRelativeTime.mjs +2 -2
- package/dist/esm/format/useRelativeTime.mjs.map +1 -0
- package/dist/esm/{client/format → format}/useUnit.mjs +2 -2
- package/dist/esm/format/useUnit.mjs.map +1 -0
- package/dist/esm/index.mjs +1 -2
- package/dist/types/client/index.d.ts +1 -2
- package/dist/types/client/useContent.d.ts +2 -2
- package/dist/types/client/useContent.d.ts.map +1 -1
- package/dist/types/client/useDictionary.d.ts +2 -2
- package/dist/types/client/useDictionary.d.ts.map +1 -1
- package/dist/types/client/useDictionaryDynamic.d.ts +2 -2
- package/dist/types/client/useDictionaryDynamic.d.ts.map +1 -1
- package/dist/types/client/useLocale.d.ts +3 -3
- package/dist/types/client/useLocaleBase.d.ts +5 -6
- package/dist/types/client/useLocaleBase.d.ts.map +1 -1
- package/dist/types/client/useLocaleStorage.d.ts +5 -5
- package/dist/types/client/useLocaleStorage.d.ts.map +1 -1
- package/dist/types/{client/format → format}/index.d.ts +2 -1
- package/dist/types/{client/format → format}/useCompact.d.ts +3 -3
- package/dist/types/format/useCompact.d.ts.map +1 -0
- package/dist/types/{client/format → format}/useCurrency.d.ts +3 -3
- package/dist/types/format/useCurrency.d.ts.map +1 -0
- package/dist/types/{client/format → format}/useDate.d.ts +1 -1
- package/dist/types/format/useDate.d.ts.map +1 -0
- package/dist/types/{client/format → format}/useIntl.d.ts +1 -1
- package/dist/types/format/useIntl.d.ts.map +1 -0
- package/dist/types/{client/format → format}/useList.d.ts +3 -3
- package/dist/types/format/useList.d.ts.map +1 -0
- package/dist/types/{client/format → format}/useNumber.d.ts +3 -3
- package/dist/types/format/useNumber.d.ts.map +1 -0
- package/dist/types/{client/format → format}/usePercentage.d.ts +3 -3
- package/dist/types/format/usePercentage.d.ts.map +1 -0
- package/dist/types/{client/format → format}/useRelativeTime.d.ts +3 -3
- package/dist/types/format/useRelativeTime.d.ts.map +1 -0
- package/dist/types/{client/format → format}/useUnit.d.ts +3 -3
- package/dist/types/format/useUnit.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/intlayer/dist/types/index.d.ts +4 -0
- package/package.json +11 -11
- package/dist/cjs/client/format/index.cjs +0 -18
- package/dist/cjs/client/format/useCompact.cjs.map +0 -1
- package/dist/cjs/client/format/useCurrency.cjs.map +0 -1
- package/dist/cjs/client/format/useDate.cjs.map +0 -1
- package/dist/cjs/client/format/useIntl.cjs.map +0 -1
- package/dist/cjs/client/format/useList.cjs.map +0 -1
- package/dist/cjs/client/format/useNumber.cjs.map +0 -1
- package/dist/cjs/client/format/usePercentage.cjs.map +0 -1
- package/dist/cjs/client/format/useRelativeTime.cjs.map +0 -1
- package/dist/cjs/client/format/useUnit.cjs.map +0 -1
- package/dist/esm/client/format/useCompact.mjs.map +0 -1
- package/dist/esm/client/format/useCurrency.mjs.map +0 -1
- package/dist/esm/client/format/useDate.mjs.map +0 -1
- package/dist/esm/client/format/useIntl.mjs.map +0 -1
- package/dist/esm/client/format/useList.mjs.map +0 -1
- package/dist/esm/client/format/useNumber.mjs.map +0 -1
- package/dist/esm/client/format/usePercentage.mjs.map +0 -1
- package/dist/esm/client/format/useRelativeTime.mjs.map +0 -1
- package/dist/esm/client/format/useUnit.mjs.map +0 -1
- package/dist/types/client/format/useCompact.d.ts.map +0 -1
- package/dist/types/client/format/useCurrency.d.ts.map +0 -1
- package/dist/types/client/format/useDate.d.ts.map +0 -1
- package/dist/types/client/format/useIntl.d.ts.map +0 -1
- package/dist/types/client/format/useList.d.ts.map +0 -1
- package/dist/types/client/format/useNumber.d.ts.map +0 -1
- package/dist/types/client/format/usePercentage.d.ts.map +0 -1
- package/dist/types/client/format/useRelativeTime.d.ts.map +0 -1
- package/dist/types/client/format/useUnit.d.ts.map +0 -1
|
@@ -1,17 +1,17 @@
|
|
|
1
|
+
import { Locale } from "../intlayer/dist/types/index.js";
|
|
1
2
|
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
2
|
-
import * as _intlayer_types_allLocales0 from "@intlayer/types/allLocales";
|
|
3
3
|
|
|
4
4
|
//#region src/client/useLocaleStorage.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Get the locale cookie
|
|
7
7
|
*/
|
|
8
|
-
declare const localeInStorage:
|
|
8
|
+
declare const localeInStorage: Locale;
|
|
9
9
|
/**
|
|
10
10
|
* @deprecated Use localeInStorage instead
|
|
11
11
|
*
|
|
12
12
|
* Get the locale cookie
|
|
13
13
|
*/
|
|
14
|
-
declare const localeCookie:
|
|
14
|
+
declare const localeCookie: Locale;
|
|
15
15
|
/**
|
|
16
16
|
* Set the locale cookie
|
|
17
17
|
*/
|
|
@@ -26,7 +26,7 @@ declare const setLocaleCookie: (locale: LocalesValues, isCookieEnabled: boolean)
|
|
|
26
26
|
* Hook that provides the locale storage and a function to set it
|
|
27
27
|
*/
|
|
28
28
|
declare const useLocaleStorage: (isCookieEnabled?: boolean) => {
|
|
29
|
-
getLocale: () =>
|
|
29
|
+
getLocale: () => Locale;
|
|
30
30
|
setLocale: (locale: LocalesValues) => void;
|
|
31
31
|
};
|
|
32
32
|
/**
|
|
@@ -37,7 +37,7 @@ declare const useLocaleStorage: (isCookieEnabled?: boolean) => {
|
|
|
37
37
|
* Hook that provides the locale cookie and a function to set it
|
|
38
38
|
*/
|
|
39
39
|
declare const useLocaleCookie: (isCookieEnabled?: boolean) => {
|
|
40
|
-
localeCookie:
|
|
40
|
+
localeCookie: Locale;
|
|
41
41
|
setLocaleCookie: (locale: LocalesValues) => void;
|
|
42
42
|
};
|
|
43
43
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocaleStorage.d.ts","names":[],"sources":["../../../src/client/useLocaleStorage.ts"],"mappings":";;;;;;;cAYa,eAAA,EAA4D,
|
|
1
|
+
{"version":3,"file":"useLocaleStorage.d.ts","names":[],"sources":["../../../src/client/useLocaleStorage.ts"],"mappings":";;;;;;;cAYa,eAAA,EAA4D,MAAA;;;;;AAMzE;cAAa,YAAA,EAA8B,MAAA;;;;cAK9B,kBAAA,GACX,MAAA,EAAQ,aAAA,EACR,eAAA;;;;;;cAYW,eAAA,GAAe,MAAA,EAblB,aAAA,EAAa,eAAA;;;AAavB;cAKa,gBAAA,GAAoB,eAAA;mBAQ9B,MAAA;sBAAA,aAAA;AAAA;;;;;AARH;;;cAiBa,eAAA,GAAmB,eAAA;gBAM/B,MAAA;4BAAA,aAAA;AAAA"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { useCompact } from "./useCompact.js";
|
|
2
2
|
import { useCurrency } from "./useCurrency.js";
|
|
3
3
|
import { useDate } from "./useDate.js";
|
|
4
|
+
import { useIntl } from "./useIntl.js";
|
|
4
5
|
import { useList } from "./useList.js";
|
|
5
6
|
import { useNumber } from "./useNumber.js";
|
|
6
7
|
import { usePercentage } from "./usePercentage.js";
|
|
7
8
|
import { useRelativeTime } from "./useRelativeTime.js";
|
|
8
9
|
import { useUnit } from "./useUnit.js";
|
|
9
|
-
export { useCompact, useCurrency, useDate, useList, useNumber, usePercentage, useRelativeTime, useUnit };
|
|
10
|
+
export { useCompact, useCurrency, useDate, useIntl, useList, useNumber, usePercentage, useRelativeTime, useUnit };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { LocalesValues } from "../intlayer/dist/types/index.js";
|
|
2
2
|
|
|
3
|
-
//#region src/
|
|
3
|
+
//#region src/format/useCompact.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* React client hook that provides a compact number formatter
|
|
6
6
|
* bound to the current application locale.
|
|
@@ -12,7 +12,7 @@ import * as _intlayer_types_module_augmentation0 from "@intlayer/types/module_au
|
|
|
12
12
|
* ```
|
|
13
13
|
*/
|
|
14
14
|
declare const useCompact: () => (value: string | number, options?: Intl.NumberFormatOptions & {
|
|
15
|
-
locale?:
|
|
15
|
+
locale?: LocalesValues;
|
|
16
16
|
}) => string;
|
|
17
17
|
//#endregion
|
|
18
18
|
export { useCompact };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCompact.d.ts","names":[],"sources":["../../../src/format/useCompact.ts"],"mappings":";;;;;;AAcA;;;;;;;cAAa,UAAA,SAAU,KAAA,mBAAA,OAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,aAAA;AAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { LocalesValues } from "../intlayer/dist/types/index.js";
|
|
2
2
|
|
|
3
|
-
//#region src/
|
|
3
|
+
//#region src/format/useCurrency.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* React client hook that provides a currency formatter
|
|
6
6
|
* bound to the current application locale.
|
|
@@ -26,7 +26,7 @@ import * as _intlayer_types_module_augmentation0 from "@intlayer/types/module_au
|
|
|
26
26
|
* ```
|
|
27
27
|
*/
|
|
28
28
|
declare const useCurrency: () => (value: string | number, options?: Intl.NumberFormatOptions & {
|
|
29
|
-
locale?:
|
|
29
|
+
locale?: LocalesValues;
|
|
30
30
|
}) => string;
|
|
31
31
|
//#endregion
|
|
32
32
|
export { useCurrency };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCurrency.d.ts","names":[],"sources":["../../../src/format/useCurrency.ts"],"mappings":";;;;;;AA4BA;;;;;;;;;;;;;;;;;;;;;cAAa,WAAA,SAAW,KAAA,mBAAA,OAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,aAAA;AAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDate.d.ts","names":[],"sources":["../../../src/format/useDate.ts"],"mappings":";;;;;AA8BA;;;;;;;;;;;;;;;;;;;;;;;;cAAa,OAAA,YAGA,IAAA,EAAM,UAAA,QAAkB,IAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
2
2
|
import { WrappedIntl } from "@intlayer/core/formatters";
|
|
3
3
|
|
|
4
|
-
//#region src/
|
|
4
|
+
//#region src/format/useIntl.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Preact client hook that provides a locale-bound `Intl` object.
|
|
7
7
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIntl.d.ts","names":[],"sources":["../../../src/format/useIntl.ts"],"mappings":";;;;;;AAuBA;;;;;;;;;;;;;;;;cAAa,OAAA,GAAW,MAAA,GAAS,aAAA,KAAa,WAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { LocalesValues } from "../intlayer/dist/types/index.js";
|
|
2
2
|
|
|
3
|
-
//#region src/
|
|
3
|
+
//#region src/format/useList.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* React client hook that provides a list formatter
|
|
6
6
|
* bound to the current application locale.
|
|
@@ -27,7 +27,7 @@ declare const useList: () => (values: (string | number)[], options?: {
|
|
|
27
27
|
type?: "conjunction" | "disjunction" | "unit";
|
|
28
28
|
style?: "long" | "short" | "narrow";
|
|
29
29
|
} & {
|
|
30
|
-
locale?:
|
|
30
|
+
locale?: LocalesValues;
|
|
31
31
|
}) => string;
|
|
32
32
|
//#endregion
|
|
33
33
|
export { useList };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useList.d.ts","names":[],"sources":["../../../src/format/useList.ts"],"mappings":";;;;;;AAyBA;;;;;;;;;;;;;;;;;;cAAa,OAAA,SAAO,MAAA,uBAAA,OAAA;;;;;WAWnB,aAAA;AAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { LocalesValues } from "../intlayer/dist/types/index.js";
|
|
2
2
|
|
|
3
|
-
//#region src/
|
|
3
|
+
//#region src/format/useNumber.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* React client hook that provides a localized number formatter.
|
|
6
6
|
*
|
|
@@ -24,7 +24,7 @@ import * as _intlayer_types_module_augmentation0 from "@intlayer/types/module_au
|
|
|
24
24
|
* A number formatting function bound to the active locale.
|
|
25
25
|
*/
|
|
26
26
|
declare const useNumber: () => (value: string | number, options?: Intl.NumberFormatOptions & {
|
|
27
|
-
locale?:
|
|
27
|
+
locale?: LocalesValues;
|
|
28
28
|
}) => string;
|
|
29
29
|
//#endregion
|
|
30
30
|
export { useNumber };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNumber.d.ts","names":[],"sources":["../../../src/format/useNumber.ts"],"mappings":";;;;;;AA0BA;;;;;;;;;;;;;;;;;;;cAAa,SAAA,SAAS,KAAA,mBAAA,OAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,aAAA;AAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { LocalesValues } from "../intlayer/dist/types/index.js";
|
|
2
2
|
|
|
3
|
-
//#region src/
|
|
3
|
+
//#region src/format/usePercentage.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* React hook to provide a percentage formatter function
|
|
6
6
|
* based on the current application locale.
|
|
@@ -20,7 +20,7 @@ import * as _intlayer_types_module_augmentation0 from "@intlayer/types/module_au
|
|
|
20
20
|
* A function that formats numbers or numeric strings into localized percentages.
|
|
21
21
|
*/
|
|
22
22
|
declare const usePercentage: () => (value: string | number, options?: Intl.NumberFormatOptions & {
|
|
23
|
-
locale?:
|
|
23
|
+
locale?: LocalesValues;
|
|
24
24
|
}) => string;
|
|
25
25
|
//#endregion
|
|
26
26
|
export { usePercentage };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePercentage.d.ts","names":[],"sources":["../../../src/format/usePercentage.ts"],"mappings":";;;;;;AAsBA;;;;;;;;;;;;;;;cAAa,aAAA,SAAa,KAAA,mBAAA,OAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,aAAA;AAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { LocalesValues } from "../intlayer/dist/types/index.js";
|
|
2
2
|
|
|
3
|
-
//#region src/
|
|
3
|
+
//#region src/format/useRelativeTime.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Client-side React hook for accessing a localized relative time formatter.
|
|
6
6
|
*
|
|
@@ -20,7 +20,7 @@ import * as _intlayer_types_module_augmentation0 from "@intlayer/types/module_au
|
|
|
20
20
|
* bound to the current client locale.
|
|
21
21
|
*/
|
|
22
22
|
declare const useRelativeTime: () => (from: string | number | Date, to?: string | number | Date, options?: Intl.RelativeTimeFormatOptions & {
|
|
23
|
-
locale?:
|
|
23
|
+
locale?: LocalesValues;
|
|
24
24
|
unit?: Intl.RelativeTimeFormatUnit;
|
|
25
25
|
}) => string;
|
|
26
26
|
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRelativeTime.d.ts","names":[],"sources":["../../../src/format/useRelativeTime.ts"],"mappings":";;;;;;AAsBA;;;;;;;;;;;;;;;cAAa,eAAA,SAAe,IAAA,oBAAA,IAAA,EAAA,EAAA,qBAAA,IAAA,EAAA,OAAA,GAAA,IAAA,CAAA,yBAAA;WAAA,aAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { LocalesValues } from "../intlayer/dist/types/index.js";
|
|
2
2
|
|
|
3
|
-
//#region src/
|
|
3
|
+
//#region src/format/useUnit.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* React hook that provides a unit formatting function
|
|
6
6
|
* based on the current locale from {@link useLocaleBase}.
|
|
@@ -19,7 +19,7 @@ import * as _intlayer_types_module_augmentation0 from "@intlayer/types/module_au
|
|
|
19
19
|
* @returns {Function} A unit formatting function that accepts a value and optional formatting options.
|
|
20
20
|
*/
|
|
21
21
|
declare const useUnit: () => (value: string | number, options?: Intl.NumberFormatOptions & {
|
|
22
|
-
locale?:
|
|
22
|
+
locale?: LocalesValues;
|
|
23
23
|
}) => string;
|
|
24
24
|
//#endregion
|
|
25
25
|
export { useUnit };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUnit.d.ts","names":[],"sources":["../../../src/format/useUnit.ts"],"mappings":";;;;;;AAqBA;;;;;;;;;;;;;;cAAa,OAAA,SAAO,KAAA,mBAAA,OAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,aAAA;AAAA"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { IntlayerNode } from "./IntlayerNode.js";
|
|
2
2
|
import { IntlayerClientContext, IntlayerProvider, IntlayerProviderContent, IntlayerProviderProps, useIntlayerContext } from "./client/IntlayerProvider.js";
|
|
3
|
-
import { useIntl } from "./client/format/useIntl.js";
|
|
4
3
|
import { t } from "./client/t.js";
|
|
5
4
|
import { IInterpreterPluginPreact } from "./plugins.js";
|
|
6
5
|
import { useDictionary } from "./client/useDictionary.js";
|
|
@@ -20,5 +19,5 @@ declare module '@intlayer/core/interpreter' {
|
|
|
20
19
|
interface IInterpreterPlugin<T, S, L extends LocalesValues> extends IInterpreterPluginPreact<T, S, L> {}
|
|
21
20
|
}
|
|
22
21
|
//#endregion
|
|
23
|
-
export { IntlayerClientContext, type IntlayerNode, IntlayerProvider, IntlayerProviderContent, type IntlayerProviderProps, getDictionary, getIntlayer, localeCookie, setLocaleCookie, setLocaleInStorage, t, useDictionary, useDictionaryAsync, useDictionaryDynamic,
|
|
22
|
+
export { IntlayerClientContext, type IntlayerNode, IntlayerProvider, IntlayerProviderContent, type IntlayerProviderProps, getDictionary, getIntlayer, localeCookie, setLocaleCookie, setLocaleInStorage, t, useDictionary, useDictionaryAsync, useDictionaryDynamic, useIntlayer, useIntlayerContext, useLoadDynamic, useLocale, useLocaleBase, useLocaleCookie, useLocaleStorage };
|
|
24
23
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;YAIY,kBAAA,iBAAmC,aAAA,UACnC,wBAAA,CAAyB,CAAA,EAAG,CAAA,EAAG,CAAA;AAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { LocalesValues as LocalesValues$1 } from "@intlayer/types/module_augmentation";
|
|
2
|
+
import { Locale as Locale$1 } from "@intlayer/types/allLocales";
|
|
3
|
+
import { Dictionary } from "@intlayer/types/dictionary";
|
|
4
|
+
export { type Locale$1 as Locale, type LocalesValues$1 as LocalesValues };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "preact-intlayer",
|
|
3
|
-
"version": "8.5.
|
|
3
|
+
"version": "8.5.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your Preact applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"import": "./dist/esm/index.mjs"
|
|
41
41
|
},
|
|
42
42
|
"./format": {
|
|
43
|
-
"types": "./dist/types/
|
|
44
|
-
"require": "./dist/cjs/
|
|
45
|
-
"import": "./dist/esm/
|
|
43
|
+
"types": "./dist/types/format/index.d.ts",
|
|
44
|
+
"require": "./dist/cjs/format/index.cjs",
|
|
45
|
+
"import": "./dist/esm/format/index.mjs"
|
|
46
46
|
},
|
|
47
47
|
"./html": {
|
|
48
48
|
"types": "./dist/types/html/index.d.ts",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"./dist/types/index.d.ts"
|
|
66
66
|
],
|
|
67
67
|
"format": [
|
|
68
|
-
"./dist/types/
|
|
68
|
+
"./dist/types/format/index.d.ts"
|
|
69
69
|
],
|
|
70
70
|
"html": [
|
|
71
71
|
"./dist/types/html/index.d.ts"
|
|
@@ -100,12 +100,12 @@
|
|
|
100
100
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
101
101
|
},
|
|
102
102
|
"dependencies": {
|
|
103
|
-
"@intlayer/api": "8.5.
|
|
104
|
-
"@intlayer/chokidar": "8.5.
|
|
105
|
-
"@intlayer/config": "8.5.
|
|
106
|
-
"@intlayer/core": "8.5.
|
|
107
|
-
"@intlayer/editor": "8.5.
|
|
108
|
-
"@intlayer/types": "8.5.
|
|
103
|
+
"@intlayer/api": "8.5.1",
|
|
104
|
+
"@intlayer/chokidar": "8.5.1",
|
|
105
|
+
"@intlayer/config": "8.5.1",
|
|
106
|
+
"@intlayer/core": "8.5.1",
|
|
107
|
+
"@intlayer/editor": "8.5.1",
|
|
108
|
+
"@intlayer/types": "8.5.1"
|
|
109
109
|
},
|
|
110
110
|
"devDependencies": {
|
|
111
111
|
"@types/node": "25.5.0",
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_client_format_useUnit = require('./useUnit.cjs');
|
|
3
|
-
const require_client_format_useDate = require('./useDate.cjs');
|
|
4
|
-
const require_client_format_useNumber = require('./useNumber.cjs');
|
|
5
|
-
const require_client_format_useRelativeTime = require('./useRelativeTime.cjs');
|
|
6
|
-
const require_client_format_useCompact = require('./useCompact.cjs');
|
|
7
|
-
const require_client_format_useList = require('./useList.cjs');
|
|
8
|
-
const require_client_format_usePercentage = require('./usePercentage.cjs');
|
|
9
|
-
const require_client_format_useCurrency = require('./useCurrency.cjs');
|
|
10
|
-
|
|
11
|
-
exports.useCompact = require_client_format_useCompact.useCompact;
|
|
12
|
-
exports.useCurrency = require_client_format_useCurrency.useCurrency;
|
|
13
|
-
exports.useDate = require_client_format_useDate.useDate;
|
|
14
|
-
exports.useList = require_client_format_useList.useList;
|
|
15
|
-
exports.useNumber = require_client_format_useNumber.useNumber;
|
|
16
|
-
exports.usePercentage = require_client_format_usePercentage.usePercentage;
|
|
17
|
-
exports.useRelativeTime = require_client_format_useRelativeTime.useRelativeTime;
|
|
18
|
-
exports.useUnit = require_client_format_useUnit.useUnit;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useCompact.cjs","names":["IntlayerClientContext"],"sources":["../../../../src/client/format/useCompact.ts"],"sourcesContent":["import { compact } from '@intlayer/core/formatters';\nimport { useCallback, useContext } from 'preact/hooks';\nimport { IntlayerClientContext } from '../IntlayerProvider';\n\n/**\n * React client hook that provides a compact number formatter\n * bound to the current application locale.\n *\n * @example\n * ```tsx\n * const formatCompact = useCompact();\n * formatCompact(1500); // \"1.5K\"\n * ```\n */\nexport const useCompact = () => {\n const { locale } = useContext(IntlayerClientContext);\n\n return useCallback(\n (...args: Parameters<typeof compact>) =>\n compact(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n }),\n [locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAcA,MAAa,mBAAmB;CAC9B,MAAM,EAAE,wCAAsBA,sDAAsB;AAEpD,uCACG,GAAG,gDACM,KAAK,IAAI;EACf,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC,EACJ,CAAC,OAAO,CACT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useCurrency.cjs","names":["IntlayerClientContext"],"sources":["../../../../src/client/format/useCurrency.ts"],"sourcesContent":["import { currency } from '@intlayer/core/formatters';\nimport { useCallback, useContext } from 'preact/hooks';\nimport { IntlayerClientContext } from '../IntlayerProvider';\n\n/**\n * React client hook that provides a currency formatter\n * bound to the current application locale.\n *\n * @returns {(value: string | number, options?: CurrencyProps) => string}\n * A function to format numbers into localized currency strings.\n *\n * @example\n * ```tsx\n * const formatCurrency = useCurrency();\n *\n * formatCurrency(1500, { currency: \"USD\" });\n * // \"$1,500.00\"\n *\n * formatCurrency(1500, { currency: \"EUR\", locale: \"de-DE\" });\n * // \"1.500,00 €\"\n *\n * formatCurrency(9876543.21, {\n * currency: \"JPY\",\n * fractionDigits: 0,\n * });\n * // \"¥9,876,543\"\n * ```\n */\nexport const useCurrency = () => {\n const { locale } = useContext(IntlayerClientContext);\n\n return useCallback(\n (...args: Parameters<typeof currency>) =>\n currency(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n }),\n [locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAa,oBAAoB;CAC/B,MAAM,EAAE,wCAAsBA,sDAAsB;AAEpD,uCACG,GAAG,iDACO,KAAK,IAAI;EAChB,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC,EACJ,CAAC,OAAO,CACT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useDate.cjs","names":["IntlayerClientContext"],"sources":["../../../../src/client/format/useDate.ts"],"sourcesContent":["import { date } from '@intlayer/core/formatters';\nimport { useContext } from 'preact/hooks';\nimport { IntlayerClientContext } from '../IntlayerProvider';\n\n/**\n * React client hook that provides a localized date/time formatter\n * bound to the current application locale.\n *\n * @returns {(date: Date | string | number, options?: DateProps) => string}\n * A function to format dates or timestamps into localized date/time strings.\n *\n * @example\n * ```tsx\n * const formatDate = useDate();\n *\n * formatDate(new Date(\"2025-01-01\"));\n * // \"Jan 1, 2025\"\n *\n * formatDate(\"2025-01-01T15:30:00Z\", {\n * dateStyle: \"full\",\n * timeStyle: \"short\",\n * });\n * // \"Wednesday, January 1, 2025 at 3:30 PM\"\n *\n * formatDate(1735689600000, { locale: \"fr-FR\", dateStyle: \"long\" });\n * // \"1 janvier 2025\"\n * ```\n *\n * @see createDate\n */\nexport const useDate = () => {\n const { locale } = useContext(IntlayerClientContext);\n\n return (...args: Parameters<typeof date>) =>\n date(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAa,gBAAgB;CAC3B,MAAM,EAAE,wCAAsBA,sDAAsB;AAEpD,SAAQ,GAAG,6CACJ,KAAK,IAAI;EACZ,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useIntl.cjs","names":["IntlayerClientContext"],"sources":["../../../../src/client/format/useIntl.ts"],"sourcesContent":["import { bindIntl, type WrappedIntl } from '@intlayer/core/formatters';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport { useContext, useMemo } from 'preact/hooks';\nimport { IntlayerClientContext } from '../IntlayerProvider';\n\n/**\n * Preact client hook that provides a locale-bound `Intl` object.\n *\n * It acts exactly like the native `Intl` object, but acts as a proxy to:\n * 1. Inject the current locale automatically if none is provided.\n * 2. Use the performance-optimized `CachedIntl` under the hood.\n *\n * @example\n * ```tsx\n * const intl = useIntl(); // uses context locale\n *\n * // Standard API, but no need to pass locale as the first argument\n * const formatted = new intl.NumberFormat({\n * style: 'currency',\n * currency: 'USD'\n * }).format(123.45);\n * ```\n */\nexport const useIntl = (locale?: LocalesValues) => {\n const { locale: contextLocale } = useContext(IntlayerClientContext);\n const currentLocale = locale ?? contextLocale;\n\n return useMemo<WrappedIntl>(() => bindIntl(currentLocale), [currentLocale]);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAa,WAAW,WAA2B;CACjD,MAAM,EAAE,QAAQ,+CAA6BA,sDAAsB;CACnE,MAAM,gBAAgB,UAAU;AAEhC,gFAA2C,cAAc,EAAE,CAAC,cAAc,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useList.cjs","names":["IntlayerClientContext"],"sources":["../../../../src/client/format/useList.ts"],"sourcesContent":["import { list } from '@intlayer/core/formatters';\nimport { useCallback, useContext } from 'preact/hooks';\nimport { IntlayerClientContext } from '../IntlayerProvider';\n\n/**\n * React client hook that provides a list formatter\n * bound to the current application locale.\n *\n * @returns {(values: (string | number)[], options?: ListProps) => string}\n * A function to format arrays into localized list strings.\n *\n * @example\n * ```tsx\n * const formatList = useList();\n *\n * formatList(['apple', 'banana', 'orange']);\n * // \"apple, banana, and orange\"\n *\n * formatList(['red', 'green', 'blue'], { type: 'disjunction' });\n * // \"red, green, or blue\"\n *\n * formatList([1, 2, 3], { type: 'unit', locale: 'de-DE' });\n * // \"1, 2 und 3\"\n * ```\n */\nexport const useList = () => {\n const { locale } = useContext(IntlayerClientContext);\n\n return useCallback(\n (...args: Parameters<typeof list>) =>\n list(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n }),\n [locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,MAAa,gBAAgB;CAC3B,MAAM,EAAE,wCAAsBA,sDAAsB;AAEpD,uCACG,GAAG,6CACG,KAAK,IAAI;EACZ,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC,EACJ,CAAC,OAAO,CACT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useNumber.cjs","names":["IntlayerClientContext"],"sources":["../../../../src/client/format/useNumber.ts"],"sourcesContent":["import { number } from '@intlayer/core/formatters';\nimport { useCallback, useContext } from 'preact/hooks';\nimport { IntlayerClientContext } from '../IntlayerProvider';\n\n/**\n * React client hook that provides a localized number formatter.\n *\n * Uses the current locale from {@link useLocaleBase} and returns\n * a function that can be used to format numbers consistently\n * according to the user's locale.\n *\n * @example\n * ```tsx\n * const formatNumber = useNumber();\n *\n * formatNumber(12345);\n * // e.g. \"12,345\" (en-US)\n * // e.g. \"12 345\" (fr-FR)\n *\n * formatNumber(0.75, { style: \"percent\" });\n * // e.g. \"75%\"\n * ```\n *\n * @returns {(value: string | number, options?: import(\"../createNumber\").NumberProps) => string}\n * A number formatting function bound to the active locale.\n */\nexport const useNumber = () => {\n const { locale } = useContext(IntlayerClientContext);\n\n return useCallback(\n (...args: Parameters<typeof number>) =>\n number(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n }),\n [locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAa,kBAAkB;CAC7B,MAAM,EAAE,wCAAsBA,sDAAsB;AAEpD,uCACG,GAAG,+CACK,KAAK,IAAI;EACd,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC,EACJ,CAAC,OAAO,CACT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"usePercentage.cjs","names":["IntlayerClientContext"],"sources":["../../../../src/client/format/usePercentage.ts"],"sourcesContent":["import { percentage } from '@intlayer/core/formatters';\nimport { useCallback, useContext } from 'preact/hooks';\nimport { IntlayerClientContext } from '../IntlayerProvider';\n\n/**\n * React hook to provide a percentage formatter function\n * based on the current application locale.\n *\n * This hook retrieves the active locale using {@link useLocaleBase}\n * and memoizes a `createPercentage` instance for that locale.\n *\n * @example\n * ```tsx\n * const formatPercentage = usePercentage();\n *\n * const result = formatPercentage(0.875, { maximumFractionDigits: 1 });\n * // \"87.5%\" (depending on locale)\n * ```\n *\n * @returns {(value: string | number, options?: Omit<PercentageOptions, \"value\">) => string}\n * A function that formats numbers or numeric strings into localized percentages.\n */\nexport const usePercentage = () => {\n const { locale } = useContext(IntlayerClientContext);\n\n return useCallback(\n (...args: Parameters<typeof percentage>) =>\n percentage(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n }),\n [locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAa,sBAAsB;CACjC,MAAM,EAAE,wCAAsBA,sDAAsB;AAEpD,uCACG,GAAG,mDACS,KAAK,IAAI;EAClB,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC,EACJ,CAAC,OAAO,CACT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useRelativeTime.cjs","names":["IntlayerClientContext"],"sources":["../../../../src/client/format/useRelativeTime.ts"],"sourcesContent":["import { relativeTime } from '@intlayer/core/formatters';\nimport { useCallback, useContext } from 'preact/hooks';\nimport { IntlayerClientContext } from '../IntlayerProvider';\n\n/**\n * Client-side React hook for accessing a localized relative time formatter.\n *\n * This hook:\n * - Reads the current locale from {@link useLocaleBase}.\n * - Creates a new relative time formatter with {@link createRelativeTime}.\n * - Returns a function that can format time differences into localized strings.\n *\n * Example:\n * ```tsx\n * const relativeTime = useRelativeTime();\n * const formatted = relativeTime(new Date(\"2024-08-01\"), new Date());\n * // e.g., \"2 weeks ago\"\n * ```\n *\n * @returns {ReturnType<typeof createRelativeTime>} A relative time formatting function\n * bound to the current client locale.\n */\nexport const useRelativeTime = () => {\n const { locale } = useContext(IntlayerClientContext);\n\n return useCallback(\n (...args: Parameters<typeof relativeTime>) =>\n relativeTime(args[0], args[1], {\n ...args[2],\n locale: args[2]?.locale ?? locale,\n }),\n [locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAa,wBAAwB;CACnC,MAAM,EAAE,wCAAsBA,sDAAsB;AAEpD,uCACG,GAAG,qDACW,KAAK,IAAI,KAAK,IAAI;EAC7B,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC,EACJ,CAAC,OAAO,CACT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useUnit.cjs","names":["IntlayerClientContext"],"sources":["../../../../src/client/format/useUnit.ts"],"sourcesContent":["import { units } from '@intlayer/core/formatters';\nimport { useCallback, useContext } from 'preact/hooks';\nimport { IntlayerClientContext } from '../IntlayerProvider';\n\n/**\n * React hook that provides a unit formatting function\n * based on the current locale from {@link useLocaleBase}.\n *\n * This hook wraps {@link createUnit} to return a formatter\n * that can convert values into human-readable localized units\n * (e.g., \"10 km\", \"5 lbs\").\n *\n * @example\n * ```tsx\n * const formatUnit = useUnit();\n * const distance = formatUnit(10, { unit: \"kilometer\" });\n * // \"10 km\" (depending on locale)\n * ```\n *\n * @returns {Function} A unit formatting function that accepts a value and optional formatting options.\n */\nexport const useUnit = () => {\n const { locale } = useContext(IntlayerClientContext);\n\n return useCallback(\n (...args: Parameters<typeof units>) =>\n units(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n }),\n [locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,gBAAgB;CAC3B,MAAM,EAAE,wCAAsBA,sDAAsB;AAEpD,uCACG,GAAG,8CACI,KAAK,IAAI;EACb,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC,EACJ,CAAC,OAAO,CACT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useCompact.mjs","names":[],"sources":["../../../../src/client/format/useCompact.ts"],"sourcesContent":["import { compact } from '@intlayer/core/formatters';\nimport { useCallback, useContext } from 'preact/hooks';\nimport { IntlayerClientContext } from '../IntlayerProvider';\n\n/**\n * React client hook that provides a compact number formatter\n * bound to the current application locale.\n *\n * @example\n * ```tsx\n * const formatCompact = useCompact();\n * formatCompact(1500); // \"1.5K\"\n * ```\n */\nexport const useCompact = () => {\n const { locale } = useContext(IntlayerClientContext);\n\n return useCallback(\n (...args: Parameters<typeof compact>) =>\n compact(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n }),\n [locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;AAcA,MAAa,mBAAmB;CAC9B,MAAM,EAAE,WAAW,WAAW,sBAAsB;AAEpD,QAAO,aACJ,GAAG,SACF,QAAQ,KAAK,IAAI;EACf,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC,EACJ,CAAC,OAAO,CACT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useCurrency.mjs","names":[],"sources":["../../../../src/client/format/useCurrency.ts"],"sourcesContent":["import { currency } from '@intlayer/core/formatters';\nimport { useCallback, useContext } from 'preact/hooks';\nimport { IntlayerClientContext } from '../IntlayerProvider';\n\n/**\n * React client hook that provides a currency formatter\n * bound to the current application locale.\n *\n * @returns {(value: string | number, options?: CurrencyProps) => string}\n * A function to format numbers into localized currency strings.\n *\n * @example\n * ```tsx\n * const formatCurrency = useCurrency();\n *\n * formatCurrency(1500, { currency: \"USD\" });\n * // \"$1,500.00\"\n *\n * formatCurrency(1500, { currency: \"EUR\", locale: \"de-DE\" });\n * // \"1.500,00 €\"\n *\n * formatCurrency(9876543.21, {\n * currency: \"JPY\",\n * fractionDigits: 0,\n * });\n * // \"¥9,876,543\"\n * ```\n */\nexport const useCurrency = () => {\n const { locale } = useContext(IntlayerClientContext);\n\n return useCallback(\n (...args: Parameters<typeof currency>) =>\n currency(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n }),\n [locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAa,oBAAoB;CAC/B,MAAM,EAAE,WAAW,WAAW,sBAAsB;AAEpD,QAAO,aACJ,GAAG,SACF,SAAS,KAAK,IAAI;EAChB,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC,EACJ,CAAC,OAAO,CACT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useDate.mjs","names":[],"sources":["../../../../src/client/format/useDate.ts"],"sourcesContent":["import { date } from '@intlayer/core/formatters';\nimport { useContext } from 'preact/hooks';\nimport { IntlayerClientContext } from '../IntlayerProvider';\n\n/**\n * React client hook that provides a localized date/time formatter\n * bound to the current application locale.\n *\n * @returns {(date: Date | string | number, options?: DateProps) => string}\n * A function to format dates or timestamps into localized date/time strings.\n *\n * @example\n * ```tsx\n * const formatDate = useDate();\n *\n * formatDate(new Date(\"2025-01-01\"));\n * // \"Jan 1, 2025\"\n *\n * formatDate(\"2025-01-01T15:30:00Z\", {\n * dateStyle: \"full\",\n * timeStyle: \"short\",\n * });\n * // \"Wednesday, January 1, 2025 at 3:30 PM\"\n *\n * formatDate(1735689600000, { locale: \"fr-FR\", dateStyle: \"long\" });\n * // \"1 janvier 2025\"\n * ```\n *\n * @see createDate\n */\nexport const useDate = () => {\n const { locale } = useContext(IntlayerClientContext);\n\n return (...args: Parameters<typeof date>) =>\n date(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAa,gBAAgB;CAC3B,MAAM,EAAE,WAAW,WAAW,sBAAsB;AAEpD,SAAQ,GAAG,SACT,KAAK,KAAK,IAAI;EACZ,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useIntl.mjs","names":[],"sources":["../../../../src/client/format/useIntl.ts"],"sourcesContent":["import { bindIntl, type WrappedIntl } from '@intlayer/core/formatters';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport { useContext, useMemo } from 'preact/hooks';\nimport { IntlayerClientContext } from '../IntlayerProvider';\n\n/**\n * Preact client hook that provides a locale-bound `Intl` object.\n *\n * It acts exactly like the native `Intl` object, but acts as a proxy to:\n * 1. Inject the current locale automatically if none is provided.\n * 2. Use the performance-optimized `CachedIntl` under the hood.\n *\n * @example\n * ```tsx\n * const intl = useIntl(); // uses context locale\n *\n * // Standard API, but no need to pass locale as the first argument\n * const formatted = new intl.NumberFormat({\n * style: 'currency',\n * currency: 'USD'\n * }).format(123.45);\n * ```\n */\nexport const useIntl = (locale?: LocalesValues) => {\n const { locale: contextLocale } = useContext(IntlayerClientContext);\n const currentLocale = locale ?? contextLocale;\n\n return useMemo<WrappedIntl>(() => bindIntl(currentLocale), [currentLocale]);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAa,WAAW,WAA2B;CACjD,MAAM,EAAE,QAAQ,kBAAkB,WAAW,sBAAsB;CACnE,MAAM,gBAAgB,UAAU;AAEhC,QAAO,cAA2B,SAAS,cAAc,EAAE,CAAC,cAAc,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useList.mjs","names":[],"sources":["../../../../src/client/format/useList.ts"],"sourcesContent":["import { list } from '@intlayer/core/formatters';\nimport { useCallback, useContext } from 'preact/hooks';\nimport { IntlayerClientContext } from '../IntlayerProvider';\n\n/**\n * React client hook that provides a list formatter\n * bound to the current application locale.\n *\n * @returns {(values: (string | number)[], options?: ListProps) => string}\n * A function to format arrays into localized list strings.\n *\n * @example\n * ```tsx\n * const formatList = useList();\n *\n * formatList(['apple', 'banana', 'orange']);\n * // \"apple, banana, and orange\"\n *\n * formatList(['red', 'green', 'blue'], { type: 'disjunction' });\n * // \"red, green, or blue\"\n *\n * formatList([1, 2, 3], { type: 'unit', locale: 'de-DE' });\n * // \"1, 2 und 3\"\n * ```\n */\nexport const useList = () => {\n const { locale } = useContext(IntlayerClientContext);\n\n return useCallback(\n (...args: Parameters<typeof list>) =>\n list(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n }),\n [locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,MAAa,gBAAgB;CAC3B,MAAM,EAAE,WAAW,WAAW,sBAAsB;AAEpD,QAAO,aACJ,GAAG,SACF,KAAK,KAAK,IAAI;EACZ,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC,EACJ,CAAC,OAAO,CACT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useNumber.mjs","names":[],"sources":["../../../../src/client/format/useNumber.ts"],"sourcesContent":["import { number } from '@intlayer/core/formatters';\nimport { useCallback, useContext } from 'preact/hooks';\nimport { IntlayerClientContext } from '../IntlayerProvider';\n\n/**\n * React client hook that provides a localized number formatter.\n *\n * Uses the current locale from {@link useLocaleBase} and returns\n * a function that can be used to format numbers consistently\n * according to the user's locale.\n *\n * @example\n * ```tsx\n * const formatNumber = useNumber();\n *\n * formatNumber(12345);\n * // e.g. \"12,345\" (en-US)\n * // e.g. \"12 345\" (fr-FR)\n *\n * formatNumber(0.75, { style: \"percent\" });\n * // e.g. \"75%\"\n * ```\n *\n * @returns {(value: string | number, options?: import(\"../createNumber\").NumberProps) => string}\n * A number formatting function bound to the active locale.\n */\nexport const useNumber = () => {\n const { locale } = useContext(IntlayerClientContext);\n\n return useCallback(\n (...args: Parameters<typeof number>) =>\n number(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n }),\n [locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAa,kBAAkB;CAC7B,MAAM,EAAE,WAAW,WAAW,sBAAsB;AAEpD,QAAO,aACJ,GAAG,SACF,OAAO,KAAK,IAAI;EACd,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC,EACJ,CAAC,OAAO,CACT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"usePercentage.mjs","names":[],"sources":["../../../../src/client/format/usePercentage.ts"],"sourcesContent":["import { percentage } from '@intlayer/core/formatters';\nimport { useCallback, useContext } from 'preact/hooks';\nimport { IntlayerClientContext } from '../IntlayerProvider';\n\n/**\n * React hook to provide a percentage formatter function\n * based on the current application locale.\n *\n * This hook retrieves the active locale using {@link useLocaleBase}\n * and memoizes a `createPercentage` instance for that locale.\n *\n * @example\n * ```tsx\n * const formatPercentage = usePercentage();\n *\n * const result = formatPercentage(0.875, { maximumFractionDigits: 1 });\n * // \"87.5%\" (depending on locale)\n * ```\n *\n * @returns {(value: string | number, options?: Omit<PercentageOptions, \"value\">) => string}\n * A function that formats numbers or numeric strings into localized percentages.\n */\nexport const usePercentage = () => {\n const { locale } = useContext(IntlayerClientContext);\n\n return useCallback(\n (...args: Parameters<typeof percentage>) =>\n percentage(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n }),\n [locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAa,sBAAsB;CACjC,MAAM,EAAE,WAAW,WAAW,sBAAsB;AAEpD,QAAO,aACJ,GAAG,SACF,WAAW,KAAK,IAAI;EAClB,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC,EACJ,CAAC,OAAO,CACT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useRelativeTime.mjs","names":[],"sources":["../../../../src/client/format/useRelativeTime.ts"],"sourcesContent":["import { relativeTime } from '@intlayer/core/formatters';\nimport { useCallback, useContext } from 'preact/hooks';\nimport { IntlayerClientContext } from '../IntlayerProvider';\n\n/**\n * Client-side React hook for accessing a localized relative time formatter.\n *\n * This hook:\n * - Reads the current locale from {@link useLocaleBase}.\n * - Creates a new relative time formatter with {@link createRelativeTime}.\n * - Returns a function that can format time differences into localized strings.\n *\n * Example:\n * ```tsx\n * const relativeTime = useRelativeTime();\n * const formatted = relativeTime(new Date(\"2024-08-01\"), new Date());\n * // e.g., \"2 weeks ago\"\n * ```\n *\n * @returns {ReturnType<typeof createRelativeTime>} A relative time formatting function\n * bound to the current client locale.\n */\nexport const useRelativeTime = () => {\n const { locale } = useContext(IntlayerClientContext);\n\n return useCallback(\n (...args: Parameters<typeof relativeTime>) =>\n relativeTime(args[0], args[1], {\n ...args[2],\n locale: args[2]?.locale ?? locale,\n }),\n [locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAa,wBAAwB;CACnC,MAAM,EAAE,WAAW,WAAW,sBAAsB;AAEpD,QAAO,aACJ,GAAG,SACF,aAAa,KAAK,IAAI,KAAK,IAAI;EAC7B,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC,EACJ,CAAC,OAAO,CACT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useUnit.mjs","names":[],"sources":["../../../../src/client/format/useUnit.ts"],"sourcesContent":["import { units } from '@intlayer/core/formatters';\nimport { useCallback, useContext } from 'preact/hooks';\nimport { IntlayerClientContext } from '../IntlayerProvider';\n\n/**\n * React hook that provides a unit formatting function\n * based on the current locale from {@link useLocaleBase}.\n *\n * This hook wraps {@link createUnit} to return a formatter\n * that can convert values into human-readable localized units\n * (e.g., \"10 km\", \"5 lbs\").\n *\n * @example\n * ```tsx\n * const formatUnit = useUnit();\n * const distance = formatUnit(10, { unit: \"kilometer\" });\n * // \"10 km\" (depending on locale)\n * ```\n *\n * @returns {Function} A unit formatting function that accepts a value and optional formatting options.\n */\nexport const useUnit = () => {\n const { locale } = useContext(IntlayerClientContext);\n\n return useCallback(\n (...args: Parameters<typeof units>) =>\n units(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n }),\n [locale]\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,gBAAgB;CAC3B,MAAM,EAAE,WAAW,WAAW,sBAAsB;AAEpD,QAAO,aACJ,GAAG,SACF,MAAM,KAAK,IAAI;EACb,GAAG,KAAK;EACR,QAAQ,KAAK,IAAI,UAAU;EAC5B,CAAC,EACJ,CAAC,OAAO,CACT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useCompact.d.ts","names":[],"sources":["../../../../src/client/format/useCompact.ts"],"mappings":";;;;;;AAcA;;;;;;;cAAa,UAAA,SAAU,KAAA,mBAAA,OAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,oCAAA,CAAA,aAAA;AAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useCurrency.d.ts","names":[],"sources":["../../../../src/client/format/useCurrency.ts"],"mappings":";;;;;;AA4BA;;;;;;;;;;;;;;;;;;;;;cAAa,WAAA,SAAW,KAAA,mBAAA,OAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,oCAAA,CAAA,aAAA;AAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useDate.d.ts","names":[],"sources":["../../../../src/client/format/useDate.ts"],"mappings":";;;;;AA8BA;;;;;;;;;;;;;;;;;;;;;;;;cAAa,OAAA,YAGA,IAAA,EAAM,UAAA,QAAkB,IAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useIntl.d.ts","names":[],"sources":["../../../../src/client/format/useIntl.ts"],"mappings":";;;;;;AAuBA;;;;;;;;;;;;;;;;cAAa,OAAA,GAAW,MAAA,GAAS,aAAA,KAAa,WAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useList.d.ts","names":[],"sources":["../../../../src/client/format/useList.ts"],"mappings":";;;;;;AAyBA;;;;;;;;;;;;;;;;;;cAAa,OAAA,SAAO,MAAA,uBAAA,OAAA;;;;;WAWnB,oCAAA,CAAA,aAAA;AAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useNumber.d.ts","names":[],"sources":["../../../../src/client/format/useNumber.ts"],"mappings":";;;;;;AA0BA;;;;;;;;;;;;;;;;;;;cAAa,SAAA,SAAS,KAAA,mBAAA,OAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,oCAAA,CAAA,aAAA;AAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"usePercentage.d.ts","names":[],"sources":["../../../../src/client/format/usePercentage.ts"],"mappings":";;;;;;AAsBA;;;;;;;;;;;;;;;cAAa,aAAA,SAAa,KAAA,mBAAA,OAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,oCAAA,CAAA,aAAA;AAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useRelativeTime.d.ts","names":[],"sources":["../../../../src/client/format/useRelativeTime.ts"],"mappings":";;;;;;AAsBA;;;;;;;;;;;;;;;cAAa,eAAA,SAAe,IAAA,oBAAA,IAAA,EAAA,EAAA,qBAAA,IAAA,EAAA,OAAA,GAAA,IAAA,CAAA,yBAAA;WAAA,oCAAA,CAAA,aAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useUnit.d.ts","names":[],"sources":["../../../../src/client/format/useUnit.ts"],"mappings":";;;;;;AAqBA;;;;;;;;;;;;;;cAAa,OAAA,SAAO,KAAA,mBAAA,OAAA,GAAA,IAAA,CAAA,mBAAA;WAAA,oCAAA,CAAA,aAAA;AAAA"}
|