preact-intlayer 9.4.4 → 9.5.2
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/README.md +0 -2
- package/dist/cjs/client/useLocale.cjs +1 -1
- package/dist/cjs/client/useLocale.cjs.map +1 -1
- package/dist/esm/client/useLocale.mjs +1 -1
- package/dist/esm/client/useLocale.mjs.map +1 -1
- package/dist/types/client/useContent.d.ts +2 -1
- package/dist/types/client/useContent.d.ts.map +1 -1
- package/dist/types/client/useLocale.d.ts.map +1 -1
- package/dist/types/client/useLocaleBase.d.ts +5 -4
- package/dist/types/client/useLocaleBase.d.ts.map +1 -1
- package/dist/types/client/useLocaleStorage.d.ts +4 -3
- package/dist/types/client/useLocaleStorage.d.ts.map +1 -1
- package/dist/types/format/useCompact.d.ts +2 -1
- package/dist/types/format/useCompact.d.ts.map +1 -1
- package/dist/types/format/useCurrency.d.ts +2 -1
- package/dist/types/format/useCurrency.d.ts.map +1 -1
- package/dist/types/format/useList.d.ts +2 -1
- package/dist/types/format/useList.d.ts.map +1 -1
- package/dist/types/format/useNumber.d.ts +2 -1
- package/dist/types/format/useNumber.d.ts.map +1 -1
- package/dist/types/format/usePercentage.d.ts +2 -1
- package/dist/types/format/usePercentage.d.ts.map +1 -1
- package/dist/types/format/useRelativeTime.d.ts +2 -1
- package/dist/types/format/useRelativeTime.d.ts.map +1 -1
- package/dist/types/format/useUnit.d.ts +2 -1
- package/dist/types/format/useUnit.d.ts.map +1 -1
- package/dist/types/intlayer/dist/types/index.d.ts +14 -0
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -69,8 +69,6 @@ With **per-locale content files**, **TypeScript autocompletion**, **tree-shakabl
|
|
|
69
69
|
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/interoperability.png?raw=true" alt="Feature" width="700"> | **Interoperability**<br><br>Allow interoperability with react-i18next, next-i18next, next-intl, react-intl, vue-i18n. <br><br> - [Intlayer and react-intl](https://intlayer.org/blog/intlayer-with-react-intl) <br> - [Intlayer and next-intl](https://intlayer.org/blog/intlayer-with-next-intl) <br> - [Intlayer and next-i18next](https://intlayer.org/blog/intlayer-with-next-i18next) <br> - [Intlayer and vue-i18n](https://intlayer.org/blog/intlayer-with-vue-i18n) <br> - [Intlayer compat adapters](https://intlayer.org/doc/compatibility) |
|
|
70
70
|
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/benchmark.png?raw=true" alt="Feature" width="700"> | **Performances & Benchmark**<br><br>Uses advanced tree-shaking and dynamic loading to boost performances and keep the solution as light as possible. <br><br> - [Performances & Benchmark](https://intlayer.org/doc/benchmark) |
|
|
71
71
|
|
|
72
|
-
---
|
|
73
|
-
|
|
74
72
|
## 📦 Installation
|
|
75
73
|
|
|
76
74
|
Start your journey with Intlayer today and experience a smoother, more powerful approach to internationalization.
|
|
@@ -5,6 +5,7 @@ let _intlayer_config_built = require("@intlayer/config/built");
|
|
|
5
5
|
let preact_hooks = require("preact/hooks");
|
|
6
6
|
|
|
7
7
|
//#region src/client/useLocale.ts
|
|
8
|
+
const { defaultLocale, locales: availableLocales } = _intlayer_config_built.internationalization ?? {};
|
|
8
9
|
/**
|
|
9
10
|
* Preact hook to get the current locale and related locale management functions.
|
|
10
11
|
*
|
|
@@ -29,7 +30,6 @@ let preact_hooks = require("preact/hooks");
|
|
|
29
30
|
* ```
|
|
30
31
|
*/
|
|
31
32
|
const useLocale = ({ isCookieEnabled, onLocaleChange } = {}) => {
|
|
32
|
-
const { defaultLocale, locales: availableLocales } = _intlayer_config_built.internationalization ?? {};
|
|
33
33
|
const { locale, setLocale: setLocaleState, isCookieEnabled: isCookieEnabledContext } = (0, preact_hooks.useContext)(require_client_IntlayerProvider.IntlayerClientContext) ?? {};
|
|
34
34
|
const setLocale = (locale) => {
|
|
35
35
|
if (!availableLocales?.map(String).includes(locale)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocale.cjs","names":["internationalization","useContext","IntlayerClientContext"],"sources":["../../../src/client/useLocale.ts"],"sourcesContent":["import { internationalization } from '@intlayer/config/built';\nimport type {\n DeclaredLocales,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { useContext } from 'preact/hooks';\nimport { IntlayerClientContext } from './IntlayerProvider';\nimport { setLocaleInStorage } from './useLocaleStorage';\n\ntype UseLocaleProps = {\n isCookieEnabled?: boolean;\n onLocaleChange?: (locale: DeclaredLocales) => void;\n};\n\ntype UseLocaleResult = {\n locale: DeclaredLocales;\n defaultLocale: DeclaredLocales;\n availableLocales: DeclaredLocales[];\n setLocale: (locale: LocalesValues) => void;\n};\n\n/**\n * Preact hook to get the current locale and related locale management functions.\n *\n * @param props - Optional properties for the hook.\n * @returns An object containing the current locale, default locale, available locales, and a function to update the locale.\n *\n * @example\n * ```tsx\n * import { useLocale } from 'preact-intlayer';\n *\n * const LocaleSwitcher = () => {\n * const { locale, setLocale, availableLocales } = useLocale();\n *\n * return (\n * <select value={locale} onChange={(e) => setLocale(e.target.value)}>\n * {availableLocales.map((loc) => (\n * <option key={loc} value={loc}>{loc}</option>\n * ))}\n * </select>\n * );\n * };\n * ```\n */\nexport const useLocale = ({\n isCookieEnabled,\n onLocaleChange,\n}: UseLocaleProps = {}): UseLocaleResult => {\n const {
|
|
1
|
+
{"version":3,"file":"useLocale.cjs","names":["internationalization","useContext","IntlayerClientContext"],"sources":["../../../src/client/useLocale.ts"],"sourcesContent":["import { internationalization } from '@intlayer/config/built';\nimport type {\n DeclaredLocales,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { useContext } from 'preact/hooks';\nimport { IntlayerClientContext } from './IntlayerProvider';\nimport { setLocaleInStorage } from './useLocaleStorage';\n\ntype UseLocaleProps = {\n isCookieEnabled?: boolean;\n onLocaleChange?: (locale: DeclaredLocales) => void;\n};\n\ntype UseLocaleResult = {\n locale: DeclaredLocales;\n defaultLocale: DeclaredLocales;\n availableLocales: DeclaredLocales[];\n setLocale: (locale: LocalesValues) => void;\n};\n\nconst { defaultLocale, locales: availableLocales } = internationalization ?? {};\n\n/**\n * Preact hook to get the current locale and related locale management functions.\n *\n * @param props - Optional properties for the hook.\n * @returns An object containing the current locale, default locale, available locales, and a function to update the locale.\n *\n * @example\n * ```tsx\n * import { useLocale } from 'preact-intlayer';\n *\n * const LocaleSwitcher = () => {\n * const { locale, setLocale, availableLocales } = useLocale();\n *\n * return (\n * <select value={locale} onChange={(e) => setLocale(e.target.value)}>\n * {availableLocales.map((loc) => (\n * <option key={loc} value={loc}>{loc}</option>\n * ))}\n * </select>\n * );\n * };\n * ```\n */\nexport const useLocale = ({\n isCookieEnabled,\n onLocaleChange,\n}: UseLocaleProps = {}): UseLocaleResult => {\n const {\n locale,\n setLocale: setLocaleState,\n isCookieEnabled: isCookieEnabledContext,\n } = useContext(IntlayerClientContext) ?? {};\n\n const setLocale = (locale: LocalesValues) => {\n if (!availableLocales?.map(String).includes(locale)) {\n console.error(`Locale ${locale} is not available`);\n return;\n }\n\n setLocaleState(locale);\n\n setLocaleInStorage(\n locale,\n isCookieEnabled ?? isCookieEnabledContext ?? true\n );\n\n onLocaleChange?.(locale as DeclaredLocales);\n };\n\n return {\n locale, // Current locale\n defaultLocale, // Principal locale defined in config\n availableLocales, // List of the available locales defined in config\n setLocale, // Function to set the locale\n } as UseLocaleResult;\n};\n"],"mappings":";;;;;;;AAqBA,MAAM,EAAE,eAAe,SAAS,qBAAqBA,+CAAwB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;AAyB9E,MAAa,aAAa,EACxB,iBACA,mBACkB,CAAC,MAAuB;CAC1C,MAAM,EACJ,QACA,WAAW,gBACX,iBAAiB,+BACfC,yBAAWC,qDAAqB,KAAK,CAAC;CAE1C,MAAM,aAAa,WAA0B;EAC3C,IAAI,CAAC,kBAAkB,IAAI,MAAM,CAAC,CAAC,SAAS,MAAM,GAAG;GACnD,QAAQ,MAAM,UAAU,OAAO,kBAAkB;GACjD;EACF;EAEA,eAAe,MAAM;EAErB,mDACE,QACA,mBAAmB,0BAA0B,IAC/C;EAEA,iBAAiB,MAAyB;CAC5C;CAEA,OAAO;EACL;EACA;EACA;EACA;CACF;AACF"}
|
|
@@ -4,6 +4,7 @@ import { internationalization } from "@intlayer/config/built";
|
|
|
4
4
|
import { useContext } from "preact/hooks";
|
|
5
5
|
|
|
6
6
|
//#region src/client/useLocale.ts
|
|
7
|
+
const { defaultLocale, locales: availableLocales } = internationalization ?? {};
|
|
7
8
|
/**
|
|
8
9
|
* Preact hook to get the current locale and related locale management functions.
|
|
9
10
|
*
|
|
@@ -28,7 +29,6 @@ import { useContext } from "preact/hooks";
|
|
|
28
29
|
* ```
|
|
29
30
|
*/
|
|
30
31
|
const useLocale = ({ isCookieEnabled, onLocaleChange } = {}) => {
|
|
31
|
-
const { defaultLocale, locales: availableLocales } = internationalization ?? {};
|
|
32
32
|
const { locale, setLocale: setLocaleState, isCookieEnabled: isCookieEnabledContext } = useContext(IntlayerClientContext) ?? {};
|
|
33
33
|
const setLocale = (locale) => {
|
|
34
34
|
if (!availableLocales?.map(String).includes(locale)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocale.mjs","names":[],"sources":["../../../src/client/useLocale.ts"],"sourcesContent":["import { internationalization } from '@intlayer/config/built';\nimport type {\n DeclaredLocales,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { useContext } from 'preact/hooks';\nimport { IntlayerClientContext } from './IntlayerProvider';\nimport { setLocaleInStorage } from './useLocaleStorage';\n\ntype UseLocaleProps = {\n isCookieEnabled?: boolean;\n onLocaleChange?: (locale: DeclaredLocales) => void;\n};\n\ntype UseLocaleResult = {\n locale: DeclaredLocales;\n defaultLocale: DeclaredLocales;\n availableLocales: DeclaredLocales[];\n setLocale: (locale: LocalesValues) => void;\n};\n\n/**\n * Preact hook to get the current locale and related locale management functions.\n *\n * @param props - Optional properties for the hook.\n * @returns An object containing the current locale, default locale, available locales, and a function to update the locale.\n *\n * @example\n * ```tsx\n * import { useLocale } from 'preact-intlayer';\n *\n * const LocaleSwitcher = () => {\n * const { locale, setLocale, availableLocales } = useLocale();\n *\n * return (\n * <select value={locale} onChange={(e) => setLocale(e.target.value)}>\n * {availableLocales.map((loc) => (\n * <option key={loc} value={loc}>{loc}</option>\n * ))}\n * </select>\n * );\n * };\n * ```\n */\nexport const useLocale = ({\n isCookieEnabled,\n onLocaleChange,\n}: UseLocaleProps = {}): UseLocaleResult => {\n const {
|
|
1
|
+
{"version":3,"file":"useLocale.mjs","names":[],"sources":["../../../src/client/useLocale.ts"],"sourcesContent":["import { internationalization } from '@intlayer/config/built';\nimport type {\n DeclaredLocales,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { useContext } from 'preact/hooks';\nimport { IntlayerClientContext } from './IntlayerProvider';\nimport { setLocaleInStorage } from './useLocaleStorage';\n\ntype UseLocaleProps = {\n isCookieEnabled?: boolean;\n onLocaleChange?: (locale: DeclaredLocales) => void;\n};\n\ntype UseLocaleResult = {\n locale: DeclaredLocales;\n defaultLocale: DeclaredLocales;\n availableLocales: DeclaredLocales[];\n setLocale: (locale: LocalesValues) => void;\n};\n\nconst { defaultLocale, locales: availableLocales } = internationalization ?? {};\n\n/**\n * Preact hook to get the current locale and related locale management functions.\n *\n * @param props - Optional properties for the hook.\n * @returns An object containing the current locale, default locale, available locales, and a function to update the locale.\n *\n * @example\n * ```tsx\n * import { useLocale } from 'preact-intlayer';\n *\n * const LocaleSwitcher = () => {\n * const { locale, setLocale, availableLocales } = useLocale();\n *\n * return (\n * <select value={locale} onChange={(e) => setLocale(e.target.value)}>\n * {availableLocales.map((loc) => (\n * <option key={loc} value={loc}>{loc}</option>\n * ))}\n * </select>\n * );\n * };\n * ```\n */\nexport const useLocale = ({\n isCookieEnabled,\n onLocaleChange,\n}: UseLocaleProps = {}): UseLocaleResult => {\n const {\n locale,\n setLocale: setLocaleState,\n isCookieEnabled: isCookieEnabledContext,\n } = useContext(IntlayerClientContext) ?? {};\n\n const setLocale = (locale: LocalesValues) => {\n if (!availableLocales?.map(String).includes(locale)) {\n console.error(`Locale ${locale} is not available`);\n return;\n }\n\n setLocaleState(locale);\n\n setLocaleInStorage(\n locale,\n isCookieEnabled ?? isCookieEnabledContext ?? true\n );\n\n onLocaleChange?.(locale as DeclaredLocales);\n };\n\n return {\n locale, // Current locale\n defaultLocale, // Principal locale defined in config\n availableLocales, // List of the available locales defined in config\n setLocale, // Function to set the locale\n } as UseLocaleResult;\n};\n"],"mappings":";;;;;;AAqBA,MAAM,EAAE,eAAe,SAAS,qBAAqB,wBAAwB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;AAyB9E,MAAa,aAAa,EACxB,iBACA,mBACkB,CAAC,MAAuB;CAC1C,MAAM,EACJ,QACA,WAAW,gBACX,iBAAiB,2BACf,WAAW,qBAAqB,KAAK,CAAC;CAE1C,MAAM,aAAa,WAA0B;EAC3C,IAAI,CAAC,kBAAkB,IAAI,MAAM,CAAC,CAAC,SAAS,MAAM,GAAG;GACnD,QAAQ,MAAM,UAAU,OAAO,kBAAkB;GACjD;EACF;EAEA,eAAe,MAAM;EAErB,mBACE,QACA,mBAAmB,0BAA0B,IAC/C;EAEA,iBAAiB,MAAyB;CAC5C;CAEA,OAAO;EACL;EACA;EACA;EACA;CACF;AACF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LocalesValues as LocalesValues$1 } from "../intlayer/dist/types/index.js";
|
|
1
2
|
import { useTranslation } from "./useTraduction.js";
|
|
2
3
|
import { StrictModeLocaleMap } from "@intlayer/types/module_augmentation";
|
|
3
4
|
//#region src/client/useContent.d.ts
|
|
@@ -5,7 +6,7 @@ import { StrictModeLocaleMap } from "@intlayer/types/module_augmentation";
|
|
|
5
6
|
* On the client side, hook to get the translation content based on the locale
|
|
6
7
|
*/
|
|
7
8
|
export declare const useContent: <Content>(languageContent: StrictModeLocaleMap<Content>) => {
|
|
8
|
-
locale:
|
|
9
|
+
locale: LocalesValues$1;
|
|
9
10
|
content: Content;
|
|
10
11
|
t: typeof useTranslation;
|
|
11
12
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useContent.d.ts","names":[],"sources":["../../../src/client/useContent.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useContent.d.ts","names":[],"sources":["../../../src/client/useContent.ts"],"mappings":";;;;;;;qBAOa,aAAc,SAAO,iBACf,oBAAoB;UAApB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocale.d.ts","names":[],"sources":["../../../src/client/useLocale.ts"],"mappings":";;KASK;EACH;EACA,kBAAkB,QAAQ;;KAGvB;EACH,QAAQ;EACR,eAAe;EACf,kBAAkB;EAClB,YAAY,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useLocale.d.ts","names":[],"sources":["../../../src/client/useLocale.ts"],"mappings":";;KASK;EACH;EACA,kBAAkB,QAAQ;;KAGvB;EACH,QAAQ;EACR,eAAe;EACf,kBAAkB;EAClB,YAAY,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;qBA4BT,cAAS,iBAAA,mBAGnB,mBAAsB"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import { Locale, LocalesValues } from "../intlayer/dist/types/index.js";
|
|
1
2
|
//#region src/client/useLocaleBase.d.ts
|
|
2
3
|
/**
|
|
3
4
|
* On the client side, hook to get the current locale and all related fields
|
|
4
5
|
*/
|
|
5
6
|
export declare const useLocaleBase: () => {
|
|
6
|
-
locale:
|
|
7
|
-
defaultLocale:
|
|
8
|
-
availableLocales:
|
|
9
|
-
setLocale: (newLocale:
|
|
7
|
+
locale: LocalesValues;
|
|
8
|
+
defaultLocale: Locale;
|
|
9
|
+
availableLocales: Locale[];
|
|
10
|
+
setLocale: (newLocale: LocalesValues) => void;
|
|
10
11
|
};
|
|
11
12
|
//#endregion
|
|
12
13
|
//# sourceMappingURL=useLocaleBase.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocaleBase.d.ts","names":[],"sources":["../../../src/client/useLocaleBase.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useLocaleBase.d.ts","names":[],"sources":["../../../src/client/useLocaleBase.ts"],"mappings":";;;;;qBASa;UAAA"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
import { Locale } from "../intlayer/dist/types/index.js";
|
|
1
2
|
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
2
3
|
//#region src/client/useLocaleStorage.d.ts
|
|
3
4
|
/**
|
|
4
5
|
* Get the locale cookie
|
|
5
6
|
*/
|
|
6
|
-
export declare const localeInStorage:
|
|
7
|
+
export declare const localeInStorage: Locale;
|
|
7
8
|
/**
|
|
8
9
|
* @deprecated Use localeInStorage instead
|
|
9
10
|
*
|
|
10
11
|
* Get the locale cookie
|
|
11
12
|
*/
|
|
12
|
-
export declare const localeCookie:
|
|
13
|
+
export declare const localeCookie: Locale;
|
|
13
14
|
/**
|
|
14
15
|
* Set the locale cookie
|
|
15
16
|
*/
|
|
@@ -24,7 +25,7 @@ export declare const setLocaleCookie: typeof setLocaleInStorage;
|
|
|
24
25
|
* Hook that provides the locale storage and a function to set it
|
|
25
26
|
*/
|
|
26
27
|
export declare const useLocaleStorage: (isCookieEnabled?: boolean) => {
|
|
27
|
-
getLocale: () =>
|
|
28
|
+
getLocale: () => Locale;
|
|
28
29
|
setLocale: (locale: LocalesValues) => void;
|
|
29
30
|
};
|
|
30
31
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocaleStorage.d.ts","names":[],"sources":["../../../src/client/useLocaleStorage.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useLocaleStorage.d.ts","names":[],"sources":["../../../src/client/useLocaleStorage.ts"],"mappings":";;;;;;qBAYa,iBAAA;;;;;;qBAMA,cAAA;;;;qBAKA,qBAAkB,QACrB,eAAa;;;;;;qBAaV,wBAAe;;;;qBAKf,mBAAgB;mBAAhB;sBAAA;;;;;;;;;qBAiBA,wBAAe"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LocalesValues } from "../intlayer/dist/types/index.js";
|
|
1
2
|
//#region src/format/useCompact.d.ts
|
|
2
3
|
/**
|
|
3
4
|
* React client hook that provides a compact number formatter
|
|
@@ -10,7 +11,7 @@
|
|
|
10
11
|
* ```
|
|
11
12
|
*/
|
|
12
13
|
export declare const useCompact: () => (value: string | number, options?: Intl.NumberFormatOptions & {
|
|
13
|
-
locale?:
|
|
14
|
+
locale?: LocalesValues;
|
|
14
15
|
}) => string;
|
|
15
16
|
//#endregion
|
|
16
17
|
//# sourceMappingURL=useCompact.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCompact.d.ts","names":[],"sources":["../../../src/format/useCompact.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useCompact.d.ts","names":[],"sources":["../../../src/format/useCompact.ts"],"mappings":";;;;;;;;;;;;qBAca,mBAAU,wBAAA,UAAA,KAAA;WAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LocalesValues } from "../intlayer/dist/types/index.js";
|
|
1
2
|
//#region src/format/useCurrency.d.ts
|
|
2
3
|
/**
|
|
3
4
|
* React client hook that provides a currency formatter
|
|
@@ -24,7 +25,7 @@
|
|
|
24
25
|
* ```
|
|
25
26
|
*/
|
|
26
27
|
export declare const useCurrency: () => (value: string | number, options?: Intl.NumberFormatOptions & {
|
|
27
|
-
locale?:
|
|
28
|
+
locale?: LocalesValues;
|
|
28
29
|
}) => string;
|
|
29
30
|
//#endregion
|
|
30
31
|
//# sourceMappingURL=useCurrency.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCurrency.d.ts","names":[],"sources":["../../../src/format/useCurrency.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useCurrency.d.ts","names":[],"sources":["../../../src/format/useCurrency.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;qBA4Ba,oBAAW,wBAAA,UAAA,KAAA;WAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LocalesValues } from "../intlayer/dist/types/index.js";
|
|
1
2
|
//#region src/format/useList.d.ts
|
|
2
3
|
/**
|
|
3
4
|
* React client hook that provides a list formatter
|
|
@@ -21,7 +22,7 @@
|
|
|
21
22
|
* ```
|
|
22
23
|
*/
|
|
23
24
|
export declare const useList: () => (values: (string | number)[], options?: import("@intlayer/core/formatters").ListFormatOptions & {
|
|
24
|
-
locale?:
|
|
25
|
+
locale?: LocalesValues;
|
|
25
26
|
}) => string;
|
|
26
27
|
//#endregion
|
|
27
28
|
//# sourceMappingURL=useList.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useList.d.ts","names":[],"sources":["../../../src/format/useList.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useList.d.ts","names":[],"sources":["../../../src/format/useList.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;qBAyBa,gBAAO,6BAAA,8CAAA;WAAP"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LocalesValues } from "../intlayer/dist/types/index.js";
|
|
1
2
|
//#region src/format/useNumber.d.ts
|
|
2
3
|
/**
|
|
3
4
|
* React client hook that provides a localized number formatter.
|
|
@@ -22,7 +23,7 @@
|
|
|
22
23
|
* A number formatting function bound to the active locale.
|
|
23
24
|
*/
|
|
24
25
|
export declare const useNumber: () => (value: string | number, args_1?: Intl.NumberFormatOptions & {
|
|
25
|
-
locale?:
|
|
26
|
+
locale?: LocalesValues;
|
|
26
27
|
}) => string;
|
|
27
28
|
//#endregion
|
|
28
29
|
//# sourceMappingURL=useNumber.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNumber.d.ts","names":[],"sources":["../../../src/format/useNumber.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useNumber.d.ts","names":[],"sources":["../../../src/format/useNumber.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;qBA0Ba,kBAAS,wBAAA,SAAA,KAAA;WAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LocalesValues } from "../intlayer/dist/types/index.js";
|
|
1
2
|
//#region src/format/usePercentage.d.ts
|
|
2
3
|
/**
|
|
3
4
|
* React hook to provide a percentage formatter function
|
|
@@ -18,7 +19,7 @@
|
|
|
18
19
|
* A function that formats numbers or numeric strings into localized percentages.
|
|
19
20
|
*/
|
|
20
21
|
export declare const usePercentage: () => (value: string | number, args_1?: Intl.NumberFormatOptions & {
|
|
21
|
-
locale?:
|
|
22
|
+
locale?: LocalesValues;
|
|
22
23
|
}) => string;
|
|
23
24
|
//#endregion
|
|
24
25
|
//# sourceMappingURL=usePercentage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePercentage.d.ts","names":[],"sources":["../../../src/format/usePercentage.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"usePercentage.d.ts","names":[],"sources":["../../../src/format/usePercentage.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;qBAsBa,sBAAa,wBAAA,SAAA,KAAA;WAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LocalesValues } from "../intlayer/dist/types/index.js";
|
|
1
2
|
//#region src/format/useRelativeTime.d.ts
|
|
2
3
|
/**
|
|
3
4
|
* Client-side React hook for accessing a localized relative time formatter.
|
|
@@ -18,7 +19,7 @@
|
|
|
18
19
|
* bound to the current client locale.
|
|
19
20
|
*/
|
|
20
21
|
export declare const useRelativeTime: () => (from: string | number | Date, to?: string | number | Date, options?: Intl.RelativeTimeFormatOptions & {
|
|
21
|
-
locale?:
|
|
22
|
+
locale?: LocalesValues;
|
|
22
23
|
unit?: Intl.RelativeTimeFormatUnit;
|
|
23
24
|
}) => string;
|
|
24
25
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRelativeTime.d.ts","names":[],"sources":["../../../src/format/useRelativeTime.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useRelativeTime.d.ts","names":[],"sources":["../../../src/format/useRelativeTime.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;qBAsBa,wBAAe,wBAAA,MAAA,uBAAA,MAAA,UAAA,KAAA;WAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LocalesValues } from "../intlayer/dist/types/index.js";
|
|
1
2
|
//#region src/format/useUnit.d.ts
|
|
2
3
|
/**
|
|
3
4
|
* React hook that provides a unit formatting function
|
|
@@ -17,7 +18,7 @@
|
|
|
17
18
|
* @returns {Function} A unit formatting function that accepts a value and optional formatting options.
|
|
18
19
|
*/
|
|
19
20
|
export declare const useUnit: () => (value: string | number, options?: Intl.NumberFormatOptions & {
|
|
20
|
-
locale?:
|
|
21
|
+
locale?: LocalesValues;
|
|
21
22
|
}) => string;
|
|
22
23
|
//#endregion
|
|
23
24
|
//# sourceMappingURL=useUnit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUnit.d.ts","names":[],"sources":["../../../src/format/useUnit.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useUnit.d.ts","names":[],"sources":["../../../src/format/useUnit.ts"],"mappings":";;;;;;;;;;;;;;;;;;;qBAqBa,gBAAO,wBAAA,UAAA,KAAA;WAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import "@intlayer/core/interpreter";
|
|
2
|
+
import { DeclaredLocales, LocalesValues as LocalesValues$1 } from "@intlayer/types/module_augmentation";
|
|
3
|
+
import { Locale as Locale$1 } from "@intlayer/types/allLocales";
|
|
4
|
+
import "@intlayer/core/transpiler";
|
|
5
|
+
import { Dictionary } from "@intlayer/types/dictionary";
|
|
6
|
+
import "@intlayer/types/config";
|
|
7
|
+
import "@intlayer/types/locales";
|
|
8
|
+
import "@intlayer/config/built";
|
|
9
|
+
import "@intlayer/core/file";
|
|
10
|
+
import "@intlayer/core/formatters";
|
|
11
|
+
import "@intlayer/core/localization";
|
|
12
|
+
import "@intlayer/core/markdown";
|
|
13
|
+
import "@intlayer/core/utils";
|
|
14
|
+
export type { Locale$1 as Locale, LocalesValues$1 as LocalesValues };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "preact-intlayer",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.5.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your Preact applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -100,15 +100,15 @@
|
|
|
100
100
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
101
101
|
},
|
|
102
102
|
"dependencies": {
|
|
103
|
-
"@intlayer/api": "9.
|
|
104
|
-
"@intlayer/config": "9.
|
|
105
|
-
"@intlayer/core": "9.
|
|
106
|
-
"@intlayer/editor": "9.
|
|
107
|
-
"@intlayer/engine": "9.
|
|
108
|
-
"@intlayer/types": "9.
|
|
103
|
+
"@intlayer/api": "9.5.2",
|
|
104
|
+
"@intlayer/config": "9.5.2",
|
|
105
|
+
"@intlayer/core": "9.5.2",
|
|
106
|
+
"@intlayer/editor": "9.5.2",
|
|
107
|
+
"@intlayer/engine": "9.5.2",
|
|
108
|
+
"@intlayer/types": "9.5.2"
|
|
109
109
|
},
|
|
110
110
|
"devDependencies": {
|
|
111
|
-
"@types/node": "
|
|
111
|
+
"@types/node": "^22",
|
|
112
112
|
"@utils/ts-config": "1.0.4",
|
|
113
113
|
"@utils/ts-config-types": "1.0.4",
|
|
114
114
|
"@utils/tsdown-config": "1.0.4",
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
"preact": ">=8.0.0"
|
|
123
123
|
},
|
|
124
124
|
"optionalDependencies": {
|
|
125
|
-
"@intlayer/analytics": "9.
|
|
125
|
+
"@intlayer/analytics": "9.5.2"
|
|
126
126
|
},
|
|
127
127
|
"engines": {
|
|
128
128
|
"node": ">=14.18"
|