use-intl 2.13.1 → 2.13.4
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 +1 -1
- package/dist/_virtual/use-intl.esm.js +4 -28
- package/dist/_virtual/use-intl.esm.js.map +1 -1
- package/dist/core/AbstractIntlMessages.d.ts +1 -1
- package/dist/core/DateTimeFormatOptions.d.ts +1 -1
- package/dist/core/Formats.d.ts +1 -1
- package/dist/core/IntlConfig.d.ts +2 -2
- package/dist/core/TranslationValues.d.ts +3 -3
- package/dist/core/createBaseTranslator.d.ts +3 -3
- package/dist/core/createFormatter.d.ts +4 -4
- package/dist/core/createIntl.d.ts +1 -1
- package/dist/core/createTranslator.d.ts +1 -1
- package/dist/core/createTranslatorImpl.d.ts +2 -2
- package/dist/core/use-intl.esm.js +0 -9
- package/dist/core/use-intl.esm.js.map +1 -1
- package/dist/core/use-intl.esm10.js +2 -4
- package/dist/core/use-intl.esm10.js.map +1 -1
- package/dist/core/use-intl.esm2.js +10 -12
- package/dist/core/use-intl.esm2.js.map +1 -1
- package/dist/core/use-intl.esm3.js +13 -36
- package/dist/core/use-intl.esm3.js.map +1 -1
- package/dist/core/use-intl.esm4.js +0 -1
- package/dist/core/use-intl.esm4.js.map +1 -1
- package/dist/core/use-intl.esm5.js +12 -56
- package/dist/core/use-intl.esm5.js.map +1 -1
- package/dist/core/use-intl.esm6.js +50 -12
- package/dist/core/use-intl.esm6.js.map +1 -1
- package/dist/core/use-intl.esm7.js +188 -7
- package/dist/core/use-intl.esm7.js.map +1 -1
- package/dist/core/use-intl.esm8.js +7 -230
- package/dist/core/use-intl.esm8.js.map +1 -1
- package/dist/core/use-intl.esm9.js +2 -6
- package/dist/core/use-intl.esm9.js.map +1 -1
- package/dist/core/utils/MessageKeys.d.ts +1 -1
- package/dist/core/utils/NamespaceKeys.d.ts +1 -1
- package/dist/core/utils/NestedKeyOf.d.ts +1 -1
- package/dist/core/utils/NestedValueOf.d.ts +1 -1
- package/dist/react/IntlProvider.d.ts +1 -1
- package/dist/react/use-intl.esm.js +1 -2
- package/dist/react/use-intl.esm.js.map +1 -1
- package/dist/react/use-intl.esm10.js +0 -2
- package/dist/react/use-intl.esm10.js.map +1 -1
- package/dist/react/use-intl.esm11.js +9 -10
- package/dist/react/use-intl.esm11.js.map +1 -1
- package/dist/react/use-intl.esm2.js +4 -4
- package/dist/react/use-intl.esm2.js.map +1 -1
- package/dist/react/use-intl.esm3.js +40 -3
- package/dist/react/use-intl.esm3.js.map +1 -1
- package/dist/react/use-intl.esm4.js +3 -45
- package/dist/react/use-intl.esm4.js.map +1 -1
- package/dist/react/use-intl.esm5.js.map +1 -1
- package/dist/react/use-intl.esm6.js +15 -10
- package/dist/react/use-intl.esm6.js.map +1 -1
- package/dist/react/use-intl.esm7.js +9 -18
- package/dist/react/use-intl.esm7.js.map +1 -1
- package/dist/react/use-intl.esm8.js.map +1 -1
- package/dist/react/use-intl.esm9.js +4 -8
- package/dist/react/use-intl.esm9.js.map +1 -1
- package/dist/react/useFormatter.d.ts +1 -1
- package/dist/react/useIntl.d.ts +1 -1
- package/dist/react/useNow.d.ts +1 -1
- package/dist/src/core/AbstractIntlMessages.d.ts +1 -1
- package/dist/src/core/DateTimeFormatOptions.d.ts +1 -1
- package/dist/src/core/Formats.d.ts +1 -1
- package/dist/src/core/IntlConfig.d.ts +2 -2
- package/dist/src/core/TranslationValues.d.ts +3 -3
- package/dist/src/core/createBaseTranslator.d.ts +3 -3
- package/dist/src/core/createFormatter.d.ts +4 -4
- package/dist/src/core/createIntl.d.ts +1 -1
- package/dist/src/core/createTranslator.d.ts +1 -1
- package/dist/src/core/createTranslator.js +1 -1
- package/dist/src/core/createTranslator.js.map +1 -1
- package/dist/src/core/createTranslatorImpl.d.ts +2 -2
- package/dist/src/core/utils/MessageKeys.d.ts +1 -1
- package/dist/src/core/utils/NamespaceKeys.d.ts +1 -1
- package/dist/src/core/utils/NestedKeyOf.d.ts +1 -1
- package/dist/src/core/utils/NestedValueOf.d.ts +1 -1
- package/dist/src/core/validateMessages.js +35 -1
- package/dist/src/core/validateMessages.js.map +1 -1
- package/dist/src/react/IntlProvider.d.ts +1 -1
- package/dist/src/react/useFormatter.d.ts +1 -1
- package/dist/src/react/useIntl.d.ts +1 -1
- package/dist/src/react/useNow.d.ts +1 -1
- package/dist/use-intl.cjs.development.js +92 -222
- package/dist/use-intl.cjs.development.js.map +1 -1
- package/dist/use-intl.cjs.production.min.js +1 -1
- package/dist/use-intl.cjs.production.min.js.map +1 -1
- package/dist/use-intl.esm.js +4 -4
- package/package.json +17 -17
- package/src/core/createTranslator.tsx +1 -1
- package/src/core/validateMessages.tsx +37 -3
|
@@ -1,50 +1,8 @@
|
|
|
1
|
-
import { useState, useEffect } from 'react';
|
|
2
1
|
import useIntlContext from './use-intl.esm10.js';
|
|
3
2
|
|
|
4
|
-
function
|
|
5
|
-
return
|
|
3
|
+
function useLocale() {
|
|
4
|
+
return useIntlContext().locale;
|
|
6
5
|
}
|
|
7
|
-
/**
|
|
8
|
-
* Reading the current date via `new Date()` in components should be avoided, as
|
|
9
|
-
* it causes components to be impure and can lead to flaky tests. Instead, this
|
|
10
|
-
* hook can be used.
|
|
11
|
-
*
|
|
12
|
-
* By default, it returns the time when the component mounts. If `updateInterval`
|
|
13
|
-
* is specified, the value will be updated based on the interval.
|
|
14
|
-
*
|
|
15
|
-
* You can however also return a static value from this hook, if you
|
|
16
|
-
* configure the `now` parameter on the context provider. Note however,
|
|
17
|
-
* that if `updateInterval` is configured in this case, the component
|
|
18
|
-
* will initialize with the global value, but will afterwards update
|
|
19
|
-
* continuously based on the interval.
|
|
20
|
-
*
|
|
21
|
-
* For unit tests, this can be mocked to a constant value. For end-to-end
|
|
22
|
-
* testing, an environment parameter can be passed to the `now` parameter
|
|
23
|
-
* of the provider to mock this to a static value.
|
|
24
|
-
*/
|
|
25
6
|
|
|
26
|
-
|
|
27
|
-
function useNow(options) {
|
|
28
|
-
var updateInterval = options == null ? void 0 : options.updateInterval;
|
|
29
|
-
|
|
30
|
-
var _useIntlContext = useIntlContext(),
|
|
31
|
-
globalNow = _useIntlContext.now;
|
|
32
|
-
|
|
33
|
-
var _useState = useState(globalNow || getNow()),
|
|
34
|
-
now = _useState[0],
|
|
35
|
-
setNow = _useState[1];
|
|
36
|
-
|
|
37
|
-
useEffect(function () {
|
|
38
|
-
if (!updateInterval) return;
|
|
39
|
-
var intervalId = setInterval(function () {
|
|
40
|
-
setNow(getNow());
|
|
41
|
-
}, updateInterval);
|
|
42
|
-
return function () {
|
|
43
|
-
clearInterval(intervalId);
|
|
44
|
-
};
|
|
45
|
-
}, [globalNow, updateInterval]);
|
|
46
|
-
return now;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export { useNow as default };
|
|
7
|
+
export { useLocale as default };
|
|
50
8
|
//# sourceMappingURL=use-intl.esm4.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-intl.esm4.js","sources":["../../src/react/useNow.tsx"],"sourcesContent":["import {useState, useEffect} from 'react';\nimport useIntlContext from './useIntlContext';\n\ntype Options = {\n updateInterval?: number;\n};\n\nfunction getNow() {\n return new Date();\n}\n\n/**\n * Reading the current date via `new Date()` in components should be avoided, as\n * it causes components to be impure and can lead to flaky tests. Instead, this\n * hook can be used.\n *\n * By default, it returns the time when the component mounts. If `updateInterval`\n * is specified, the value will be updated based on the interval.\n *\n * You can however also return a static value from this hook, if you\n * configure the `now` parameter on the context provider. Note however,\n * that if `updateInterval` is configured in this case, the component\n * will initialize with the global value, but will afterwards update\n * continuously based on the interval.\n *\n * For unit tests, this can be mocked to a constant value. For end-to-end\n * testing, an environment parameter can be passed to the `now` parameter\n * of the provider to mock this to a static value.\n */\nexport default function useNow(options?: Options) {\n const updateInterval = options?.updateInterval;\n\n const {now: globalNow} = useIntlContext();\n const [now, setNow] = useState(globalNow || getNow());\n\n useEffect(() => {\n if (!updateInterval) return;\n\n const intervalId = setInterval(() => {\n setNow(getNow());\n }, updateInterval);\n\n return () => {\n clearInterval(intervalId);\n };\n }, [globalNow, updateInterval]);\n\n return now;\n}\n"],"names":["getNow","Date","useNow","options","updateInterval","useIntlContext","globalNow","now","useState","setNow","useEffect","intervalId","setInterval","clearInterval"],"mappings":";;;AAOA,SAASA,
|
|
1
|
+
{"version":3,"file":"use-intl.esm4.js","sources":["../../src/react/useNow.tsx"],"sourcesContent":["import {useState, useEffect} from 'react';\nimport useIntlContext from './useIntlContext';\n\ntype Options = {\n updateInterval?: number;\n};\n\nfunction getNow() {\n return new Date();\n}\n\n/**\n * Reading the current date via `new Date()` in components should be avoided, as\n * it causes components to be impure and can lead to flaky tests. Instead, this\n * hook can be used.\n *\n * By default, it returns the time when the component mounts. If `updateInterval`\n * is specified, the value will be updated based on the interval.\n *\n * You can however also return a static value from this hook, if you\n * configure the `now` parameter on the context provider. Note however,\n * that if `updateInterval` is configured in this case, the component\n * will initialize with the global value, but will afterwards update\n * continuously based on the interval.\n *\n * For unit tests, this can be mocked to a constant value. For end-to-end\n * testing, an environment parameter can be passed to the `now` parameter\n * of the provider to mock this to a static value.\n */\nexport default function useNow(options?: Options) {\n const updateInterval = options?.updateInterval;\n\n const {now: globalNow} = useIntlContext();\n const [now, setNow] = useState(globalNow || getNow());\n\n useEffect(() => {\n if (!updateInterval) return;\n\n const intervalId = setInterval(() => {\n setNow(getNow());\n }, updateInterval);\n\n return () => {\n clearInterval(intervalId);\n };\n }, [globalNow, updateInterval]);\n\n return now;\n}\n"],"names":["getNow","Date","useNow","options","updateInterval","_useIntlContext","useIntlContext","globalNow","now","_useState","useState","setNow","useEffect","intervalId","setInterval","clearInterval"],"mappings":";;;AAOA,SAASA,MAAMA,GAAA;EACb,OAAO,IAAIC,IAAI,EAAE,CAAA;AACnB,CAAA;AAEA;;;;;;;;;;;;;;;;;AAiBG;AACqB,SAAAC,MAAMA,CAACC,OAAiB,EAAA;AAC9C,EAAA,IAAMC,cAAc,GAAGD,OAAO,IAAPA,IAAAA,GAAAA,KAAAA,CAAAA,GAAAA,OAAO,CAAEC,cAAc,CAAA;AAE9C,EAAA,IAAAC,eAAA,GAAyBC,cAAc,EAAE;IAA7BC,SAAS,GAAAF,eAAA,CAAdG,GAAG,CAAA;EACV,IAAAC,SAAA,GAAsBC,QAAQ,CAACH,SAAS,IAAIP,MAAM,EAAE,CAAC;AAA9CQ,IAAAA,GAAG,GAAAC,SAAA,CAAA,CAAA,CAAA;AAAEE,IAAAA,MAAM,GAAAF,SAAA,CAAA,CAAA,CAAA,CAAA;AAElBG,EAAAA,SAAS,CAAC,YAAK;IACb,IAAI,CAACR,cAAc,EAAE,OAAA;AAErB,IAAA,IAAMS,UAAU,GAAGC,WAAW,CAAC,YAAK;AAClCH,MAAAA,MAAM,CAACX,MAAM,EAAE,CAAC,CAAA;KACjB,EAAEI,cAAc,CAAC,CAAA;AAElB,IAAA,OAAO,YAAK;MACVW,aAAa,CAACF,UAAU,CAAC,CAAA;KAC1B,CAAA;AACH,GAAC,EAAE,CAACN,SAAS,EAAEH,cAAc,CAAC,CAAC,CAAA;AAE/B,EAAA,OAAOI,GAAG,CAAA;AACZ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-intl.esm5.js","sources":["../../src/react/
|
|
1
|
+
{"version":3,"file":"use-intl.esm5.js","sources":["../../src/react/useIntl.tsx"],"sourcesContent":["import {useMemo} from 'react';\nimport createIntl from '../core/createIntl';\nimport useIntlContext from './useIntlContext';\n\nlet hasWarned = false;\n\n/** @deprecated Switch to `useFormatter` instead. */\nexport default function useIntl() {\n const {formats, locale, now: globalNow, onError, timeZone} = useIntlContext();\n\n if (!hasWarned) {\n hasWarned = true;\n console.warn(\n '`useIntl()` is deprecated and will be removed in the next major version. Please switch to `useFormatter()`.'\n );\n }\n\n return useMemo(\n () =>\n createIntl({\n formats,\n locale,\n now: globalNow,\n onError,\n timeZone\n }),\n [formats, globalNow, locale, onError, timeZone]\n );\n}\n"],"names":["hasWarned","useIntl","_useIntlContext","useIntlContext","formats","locale","globalNow","now","onError","timeZone","console","warn","useMemo","createIntl"],"mappings":";;;;AAIA,IAAIA,SAAS,GAAG,KAAK,CAAA;AAErB;AACc,SAAUC,OAAOA,GAAA;AAC7B,EAAA,IAAAC,eAAA,GAA6DC,cAAc,EAAE;IAAtEC,OAAO,GAAAF,eAAA,CAAPE,OAAO;IAAEC,MAAM,GAAAH,eAAA,CAANG,MAAM;IAAOC,SAAS,GAAAJ,eAAA,CAAdK,GAAG;IAAaC,OAAO,GAAAN,eAAA,CAAPM,OAAO;IAAEC,QAAQ,GAAAP,eAAA,CAARO,QAAQ,CAAA;EAEzD,IAAI,CAACT,SAAS,EAAE;AACdA,IAAAA,SAAS,GAAG,IAAI,CAAA;AAChBU,IAAAA,OAAO,CAACC,IAAI,CACV,6GAA6G,CAC9G,CAAA;AACF,GAAA;AAED,EAAA,OAAOC,OAAO,CACZ,YAAA;AAAA,IAAA,OACEC,UAAU,CAAC;AACTT,MAAAA,OAAO,EAAPA,OAAO;AACPC,MAAAA,MAAM,EAANA,MAAM;AACNE,MAAAA,GAAG,EAAED,SAAS;AACdE,MAAAA,OAAO,EAAPA,OAAO;AACPC,MAAAA,QAAQ,EAARA,QAAAA;AACD,KAAA,CAAC,CAAA;GACJ,EAAA,CAACL,OAAO,EAAEE,SAAS,EAAED,MAAM,EAAEG,OAAO,EAAEC,QAAQ,CAAC,CAChD,CAAA;AACH;;;;"}
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import createIntl from '../core/use-intl.esm4.js';
|
|
3
3
|
import useIntlContext from './use-intl.esm10.js';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
var hasWarned = false;
|
|
6
|
+
/** @deprecated Switch to `useFormatter` instead. */
|
|
7
|
+
function useIntl() {
|
|
6
8
|
var _useIntlContext = useIntlContext(),
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
formats = _useIntlContext.formats,
|
|
10
|
+
locale = _useIntlContext.locale,
|
|
11
|
+
globalNow = _useIntlContext.now,
|
|
12
|
+
onError = _useIntlContext.onError,
|
|
13
|
+
timeZone = _useIntlContext.timeZone;
|
|
14
|
+
if (!hasWarned) {
|
|
15
|
+
hasWarned = true;
|
|
16
|
+
console.warn('`useIntl()` is deprecated and will be removed in the next major version. Please switch to `useFormatter()`.');
|
|
17
|
+
}
|
|
13
18
|
return useMemo(function () {
|
|
14
|
-
return
|
|
19
|
+
return createIntl({
|
|
15
20
|
formats: formats,
|
|
16
21
|
locale: locale,
|
|
17
22
|
now: globalNow,
|
|
@@ -21,5 +26,5 @@ function useFormatter() {
|
|
|
21
26
|
}, [formats, globalNow, locale, onError, timeZone]);
|
|
22
27
|
}
|
|
23
28
|
|
|
24
|
-
export {
|
|
29
|
+
export { useIntl as default };
|
|
25
30
|
//# sourceMappingURL=use-intl.esm6.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-intl.esm6.js","sources":["../../src/react/
|
|
1
|
+
{"version":3,"file":"use-intl.esm6.js","sources":["../../src/react/useTimeZone.tsx"],"sourcesContent":["import useIntlContext from './useIntlContext';\n\nexport default function useTimeZone() {\n return useIntlContext().timeZone;\n}\n"],"names":["useTimeZone","useIntlContext","timeZone"],"mappings":";;AAEc,SAAUA,WAAWA,GAAA;AACjC,EAAA,OAAOC,cAAc,EAAE,CAACC,QAAQ,CAAA;AAClC;;;;"}
|
|
@@ -1,25 +1,16 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import createFormatter from '../core/use-intl.esm3.js';
|
|
3
3
|
import useIntlContext from './use-intl.esm10.js';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
/** @deprecated Switch to `useFormatter` instead. */
|
|
7
|
-
|
|
8
|
-
function useIntl() {
|
|
5
|
+
function useFormatter() {
|
|
9
6
|
var _useIntlContext = useIntlContext(),
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if (!hasWarned) {
|
|
17
|
-
hasWarned = true;
|
|
18
|
-
console.warn('`useIntl()` is deprecated and will be removed in the next major version. Please switch to `useFormatter()`.');
|
|
19
|
-
}
|
|
20
|
-
|
|
7
|
+
formats = _useIntlContext.formats,
|
|
8
|
+
locale = _useIntlContext.locale,
|
|
9
|
+
globalNow = _useIntlContext.now,
|
|
10
|
+
onError = _useIntlContext.onError,
|
|
11
|
+
timeZone = _useIntlContext.timeZone;
|
|
21
12
|
return useMemo(function () {
|
|
22
|
-
return
|
|
13
|
+
return createFormatter({
|
|
23
14
|
formats: formats,
|
|
24
15
|
locale: locale,
|
|
25
16
|
now: globalNow,
|
|
@@ -29,5 +20,5 @@ function useIntl() {
|
|
|
29
20
|
}, [formats, globalNow, locale, onError, timeZone]);
|
|
30
21
|
}
|
|
31
22
|
|
|
32
|
-
export {
|
|
23
|
+
export { useFormatter as default };
|
|
33
24
|
//# sourceMappingURL=use-intl.esm7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-intl.esm7.js","sources":["../../src/react/
|
|
1
|
+
{"version":3,"file":"use-intl.esm7.js","sources":["../../src/react/useFormatter.tsx"],"sourcesContent":["import {useMemo} from 'react';\nimport createFormatter from '../core/createFormatter';\nimport useIntlContext from './useIntlContext';\n\nexport default function useFormatter() {\n const {formats, locale, now: globalNow, onError, timeZone} = useIntlContext();\n\n return useMemo(\n () =>\n createFormatter({\n formats,\n locale,\n now: globalNow,\n onError,\n timeZone\n }),\n [formats, globalNow, locale, onError, timeZone]\n );\n}\n"],"names":["useFormatter","_useIntlContext","useIntlContext","formats","locale","globalNow","now","onError","timeZone","useMemo","createFormatter"],"mappings":";;;;AAIc,SAAUA,YAAYA,GAAA;AAClC,EAAA,IAAAC,eAAA,GAA6DC,cAAc,EAAE;IAAtEC,OAAO,GAAAF,eAAA,CAAPE,OAAO;IAAEC,MAAM,GAAAH,eAAA,CAANG,MAAM;IAAOC,SAAS,GAAAJ,eAAA,CAAdK,GAAG;IAAaC,OAAO,GAAAN,eAAA,CAAPM,OAAO;IAAEC,QAAQ,GAAAP,eAAA,CAARO,QAAQ,CAAA;AAEzD,EAAA,OAAOC,OAAO,CACZ,YAAA;AAAA,IAAA,OACEC,eAAe,CAAC;AACdP,MAAAA,OAAO,EAAPA,OAAO;AACPC,MAAAA,MAAM,EAANA,MAAM;AACNE,MAAAA,GAAG,EAAED,SAAS;AACdE,MAAAA,OAAO,EAAPA,OAAO;AACPC,MAAAA,QAAQ,EAARA,QAAAA;AACD,KAAA,CAAC,CAAA;GACJ,EAAA,CAACL,OAAO,EAAEE,SAAS,EAAED,MAAM,EAAEG,OAAO,EAAEC,QAAQ,CAAC,CAChD,CAAA;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-intl.esm8.js","sources":["../../src/react/
|
|
1
|
+
{"version":3,"file":"use-intl.esm8.js","sources":["../../src/react/useTranslationsImpl.tsx"],"sourcesContent":["// eslint-disable-next-line import/no-named-as-default -- False positive\nimport IntlMessageFormat from 'intl-messageformat';\nimport {useMemo, useRef} from 'react';\nimport AbstractIntlMessages from '../core/AbstractIntlMessages';\nimport createBaseTranslator, {\n getMessagesOrError\n} from '../core/createBaseTranslator';\nimport resolveNamespace from '../core/resolveNamespace';\nimport NestedKeyOf from '../core/utils/NestedKeyOf';\nimport useIntlContext from './useIntlContext';\n\nexport default function useTranslationsImpl<\n Messages extends AbstractIntlMessages,\n NestedKey extends NestedKeyOf<Messages>\n>(allMessages: Messages, namespace: NestedKey, namespacePrefix: string) {\n const {\n defaultTranslationValues,\n formats: globalFormats,\n getMessageFallback,\n locale,\n onError,\n timeZone\n } = useIntlContext();\n\n // The `namespacePrefix` is part of the type system.\n // See the comment in the hook invocation.\n allMessages = allMessages[namespacePrefix] as Messages;\n namespace = resolveNamespace(namespace, namespacePrefix) as NestedKey;\n\n const cachedFormatsByLocaleRef = useRef<\n Record<string, Record<string, IntlMessageFormat>>\n >({});\n\n const messagesOrError = useMemo(\n () => getMessagesOrError({messages: allMessages, namespace, onError}),\n [allMessages, namespace, onError]\n );\n\n const translate = useMemo(\n () =>\n createBaseTranslator({\n cachedFormatsByLocale: cachedFormatsByLocaleRef.current,\n getMessageFallback,\n messagesOrError,\n defaultTranslationValues,\n namespace,\n onError,\n formats: globalFormats,\n locale,\n timeZone\n }),\n [\n getMessageFallback,\n messagesOrError,\n defaultTranslationValues,\n namespace,\n onError,\n globalFormats,\n locale,\n timeZone\n ]\n );\n\n return translate;\n}\n"],"names":["useTranslationsImpl","allMessages","namespace","namespacePrefix","_useIntlContext","useIntlContext","defaultTranslationValues","globalFormats","formats","getMessageFallback","locale","onError","timeZone","resolveNamespace","cachedFormatsByLocaleRef","useRef","messagesOrError","useMemo","getMessagesOrError","messages","translate","createBaseTranslator","cachedFormatsByLocale","current"],"mappings":";;;;;AAWwB,SAAAA,mBAAmBA,CAGzCC,WAAqB,EAAEC,SAAoB,EAAEC,eAAuB,EAAA;AACpE,EAAA,IAAAC,eAAA,GAOIC,cAAc,EAAE;IANlBC,wBAAwB,GAAAF,eAAA,CAAxBE,wBAAwB;IACfC,aAAa,GAAAH,eAAA,CAAtBI,OAAO;IACPC,kBAAkB,GAAAL,eAAA,CAAlBK,kBAAkB;IAClBC,MAAM,GAAAN,eAAA,CAANM,MAAM;IACNC,OAAO,GAAAP,eAAA,CAAPO,OAAO;IACPC,QAAQ,GAAAR,eAAA,CAARQ,QAAQ,CAAA;AAGV;AACA;AACAX,EAAAA,WAAW,GAAGA,WAAW,CAACE,eAAe,CAAa,CAAA;AACtDD,EAAAA,SAAS,GAAGW,gBAAgB,CAACX,SAAS,EAAEC,eAAe,CAAc,CAAA;AAErE,EAAA,IAAMW,wBAAwB,GAAGC,MAAM,CAErC,EAAE,CAAC,CAAA;EAEL,IAAMC,eAAe,GAAGC,OAAO,CAC7B,YAAA;AAAA,IAAA,OAAMC,kBAAkB,CAAC;AAACC,MAAAA,QAAQ,EAAElB,WAAW;AAAEC,MAAAA,SAAS,EAATA,SAAS;AAAES,MAAAA,OAAO,EAAPA,OAAAA;AAAO,KAAC,CAAC,CAAA;AAAA,GAAA,EACrE,CAACV,WAAW,EAAEC,SAAS,EAAES,OAAO,CAAC,CAClC,CAAA;EAED,IAAMS,SAAS,GAAGH,OAAO,CACvB,YAAA;AAAA,IAAA,OACEI,oBAAoB,CAAC;MACnBC,qBAAqB,EAAER,wBAAwB,CAACS,OAAO;AACvDd,MAAAA,kBAAkB,EAAlBA,kBAAkB;AAClBO,MAAAA,eAAe,EAAfA,eAAe;AACfV,MAAAA,wBAAwB,EAAxBA,wBAAwB;AACxBJ,MAAAA,SAAS,EAATA,SAAS;AACTS,MAAAA,OAAO,EAAPA,OAAO;AACPH,MAAAA,OAAO,EAAED,aAAa;AACtBG,MAAAA,MAAM,EAANA,MAAM;AACNE,MAAAA,QAAQ,EAARA,QAAAA;AACD,KAAA,CAAC,CAAA;AAAA,GAAA,EACJ,CACEH,kBAAkB,EAClBO,eAAe,EACfV,wBAAwB,EACxBJ,SAAS,EACTS,OAAO,EACPJ,aAAa,EACbG,MAAM,EACNE,QAAQ,CACT,CACF,CAAA;AAED,EAAA,OAAOQ,SAAS,CAAA;AAClB;;;;"}
|
|
@@ -1,27 +1,23 @@
|
|
|
1
1
|
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose, extends as _extends } from '../_virtual/use-intl.esm.js';
|
|
2
|
-
import { defaultOnError, defaultGetMessageFallback } from '../core/use-intl.
|
|
2
|
+
import { defaultOnError, defaultGetMessageFallback } from '../core/use-intl.esm5.js';
|
|
3
3
|
import validateMessages from '../core/use-intl.esm9.js';
|
|
4
4
|
|
|
5
5
|
var _excluded = ["getMessageFallback", "messages", "onError"];
|
|
6
6
|
/**
|
|
7
7
|
* Enhances the incoming props with defaults.
|
|
8
8
|
*/
|
|
9
|
-
|
|
10
9
|
function getInitializedConfig(_ref) {
|
|
11
10
|
var getMessageFallback = _ref.getMessageFallback,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
messages = _ref.messages,
|
|
12
|
+
onError = _ref.onError,
|
|
13
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
16
14
|
var finalOnError = onError || defaultOnError;
|
|
17
15
|
var finalGetMessageFallback = getMessageFallback || defaultGetMessageFallback;
|
|
18
|
-
|
|
19
16
|
if (process.env.NODE_ENV !== 'production') {
|
|
20
17
|
if (messages) {
|
|
21
18
|
validateMessages(messages, finalOnError);
|
|
22
19
|
}
|
|
23
20
|
}
|
|
24
|
-
|
|
25
21
|
return _extends({}, rest, {
|
|
26
22
|
messages: messages,
|
|
27
23
|
onError: finalOnError,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-intl.esm9.js","sources":["../../src/react/
|
|
1
|
+
{"version":3,"file":"use-intl.esm9.js","sources":["../../src/react/useIntlContext.tsx"],"sourcesContent":["import {useContext} from 'react';\nimport IntlContext from './IntlContext';\n\nexport default function useIntlContext() {\n const context = useContext(IntlContext);\n\n if (!context) {\n throw new Error(\n process.env.NODE_ENV !== 'production'\n ? 'No intl context found. Have you configured the provider?'\n : undefined\n );\n }\n\n return context;\n}\n"],"names":["useIntlContext","context","useContext","IntlContext","Error","process","env","NODE_ENV","undefined"],"mappings":";;;AAGc,SAAUA,cAAcA,GAAA;AACpC,EAAA,IAAMC,OAAO,GAAGC,UAAU,CAACC,WAAW,CAAC,CAAA;EAEvC,IAAI,CAACF,OAAO,EAAE;AACZ,IAAA,MAAM,IAAIG,KAAK,CACbC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,GACjC,0DAA0D,GAC1DC,SAAS,CACd,CAAA;AACF,GAAA;AAED,EAAA,OAAOP,OAAO,CAAA;AAChB;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default function useFormatter(): {
|
|
2
2
|
dateTime: (value: number | Date, formatOrOptions?: string | import("../core/DateTimeFormatOptions").default | undefined) => string;
|
|
3
|
-
number: (value: number | bigint, formatOrOptions?: string | import("@formatjs/ecma402-abstract").NumberFormatOptions | undefined) => string;
|
|
3
|
+
number: (value: number | bigint, formatOrOptions?: string | import("@formatjs/ecma402-abstract/types/number").NumberFormatOptions | undefined) => string;
|
|
4
4
|
relativeTime: (date: number | Date, now?: number | Date | undefined) => string;
|
|
5
5
|
};
|
package/dist/react/useIntl.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @deprecated Switch to `useFormatter` instead. */
|
|
2
2
|
export default function useIntl(): {
|
|
3
3
|
formatDateTime: (value: number | Date, formatOrOptions?: string | import("../core/DateTimeFormatOptions").default | undefined) => string;
|
|
4
|
-
formatNumber: (value: number | bigint, formatOrOptions?: string | import("@formatjs/ecma402-abstract").NumberFormatOptions | undefined) => string;
|
|
4
|
+
formatNumber: (value: number | bigint, formatOrOptions?: string | import("@formatjs/ecma402-abstract/types/number").NumberFormatOptions | undefined) => string;
|
|
5
5
|
formatRelativeTime: (date: number | Date, now?: number | Date | undefined) => string;
|
|
6
6
|
};
|
package/dist/react/useNow.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Optionally `IntlMessages` can be provided to get type safety for message
|
|
4
4
|
* namespaces and keys. See https://next-intl-docs.vercel.app/docs/usage/typescript
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
type AbstractIntlMessages = {
|
|
7
7
|
[id: string]: AbstractIntlMessages | string;
|
|
8
8
|
};
|
|
9
9
|
export default AbstractIntlMessages;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat
|
|
3
3
|
*/
|
|
4
|
-
|
|
4
|
+
type DateTimeFormatOptions = Intl.DateTimeFormatOptions & {
|
|
5
5
|
/**
|
|
6
6
|
* Examples:
|
|
7
7
|
* - numeric: "2021"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import DateTimeFormatOptions from './DateTimeFormatOptions';
|
|
2
2
|
import NumberFormatOptions from './NumberFormatOptions';
|
|
3
|
-
|
|
3
|
+
type Formats = {
|
|
4
4
|
number: Record<string, NumberFormatOptions>;
|
|
5
5
|
dateTime: Record<string, DateTimeFormatOptions>;
|
|
6
6
|
};
|
|
@@ -4,7 +4,7 @@ import { AbstractIntlMessages, RichTranslationValues } from '.';
|
|
|
4
4
|
/**
|
|
5
5
|
* Should be used for entry points that configure the library.
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
type IntlConfig<Messages = AbstractIntlMessages> = {
|
|
8
8
|
/** A valid Unicode locale tag (e.g. "en" or "en-GB"). */
|
|
9
9
|
locale: string;
|
|
10
10
|
/** Global formats can be provided to achieve consistent
|
|
@@ -46,7 +46,7 @@ declare type IntlConfig<Messages = AbstractIntlMessages> = {
|
|
|
46
46
|
* A stricter set of the configuration that should be used internally
|
|
47
47
|
* once defaults are assigned to `IntlConfiguration`.
|
|
48
48
|
*/
|
|
49
|
-
export
|
|
49
|
+
export type InitializedIntlConfig<Messages = AbstractIntlMessages> = IntlConfig<Messages> & {
|
|
50
50
|
onError: NonNullable<IntlConfig<Messages>['onError']>;
|
|
51
51
|
getMessageFallback: NonNullable<IntlConfig<Messages>['getMessageFallback']>;
|
|
52
52
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
export
|
|
2
|
+
export type TranslationValue = string | number | boolean | Date | null | undefined;
|
|
3
|
+
type TranslationValues = Record<string, TranslationValue>;
|
|
4
|
+
export type RichTranslationValues = Record<string, TranslationValue | ((chunks: ReactNode) => ReactNode)>;
|
|
5
5
|
export default TranslationValues;
|
|
@@ -13,14 +13,14 @@ export declare function getMessagesOrError<Messages extends AbstractIntlMessages
|
|
|
13
13
|
namespace?: string;
|
|
14
14
|
onError?(error: IntlError): void;
|
|
15
15
|
}): AbstractIntlMessages | IntlError;
|
|
16
|
-
export
|
|
16
|
+
export type CreateBaseTranslatorProps<Messages> = InitializedIntlConfig & {
|
|
17
17
|
cachedFormatsByLocale?: Record<string, Record<string, IntlMessageFormat>>;
|
|
18
18
|
defaultTranslationValues?: RichTranslationValues;
|
|
19
19
|
namespace?: string;
|
|
20
20
|
messagesOrError: Messages | IntlError;
|
|
21
21
|
};
|
|
22
22
|
export default function createBaseTranslator<Messages extends AbstractIntlMessages, NestedKey extends NestedKeyOf<Messages>>({ cachedFormatsByLocale, defaultTranslationValues, formats: globalFormats, getMessageFallback, locale, messagesOrError, namespace, onError, timeZone }: CreateBaseTranslatorProps<Messages>): {
|
|
23
|
-
<TargetKey extends MessageKeys<NestedValueOf<Messages, NestedKey>, NestedKeyOf<NestedValueOf<Messages, NestedKey>>>>(key: TargetKey, values?: TranslationValues
|
|
24
|
-
rich: (key: string, values?: RichTranslationValues
|
|
23
|
+
<TargetKey extends MessageKeys<NestedValueOf<Messages, NestedKey>, NestedKeyOf<NestedValueOf<Messages, NestedKey>>>>(key: TargetKey, values?: TranslationValues, formats?: Partial<Formats>): string;
|
|
24
|
+
rich: (key: string, values?: RichTranslationValues, formats?: Partial<Formats>) => string | ReactElement | ReactNodeArray;
|
|
25
25
|
raw(key: string): any;
|
|
26
26
|
};
|
|
@@ -2,7 +2,7 @@ import DateTimeFormatOptions from './DateTimeFormatOptions';
|
|
|
2
2
|
import Formats from './Formats';
|
|
3
3
|
import IntlError from './IntlError';
|
|
4
4
|
import NumberFormatOptions from './NumberFormatOptions';
|
|
5
|
-
|
|
5
|
+
type Props = {
|
|
6
6
|
locale: string;
|
|
7
7
|
timeZone?: string;
|
|
8
8
|
onError?(error: IntlError): void;
|
|
@@ -10,8 +10,8 @@ declare type Props = {
|
|
|
10
10
|
now?: Date;
|
|
11
11
|
};
|
|
12
12
|
export default function createFormatter({ formats, locale, now: globalNow, onError, timeZone }: Props): {
|
|
13
|
-
dateTime: (value: Date | number, formatOrOptions?: string | DateTimeFormatOptions
|
|
14
|
-
number: (value: number | bigint, formatOrOptions?: string | NumberFormatOptions
|
|
15
|
-
relativeTime: (date: number | Date, now?: number | Date
|
|
13
|
+
dateTime: (value: Date | number, formatOrOptions?: string | DateTimeFormatOptions) => string;
|
|
14
|
+
number: (value: number | bigint, formatOrOptions?: string | NumberFormatOptions) => string;
|
|
15
|
+
relativeTime: (date: number | Date, now?: number | Date) => string;
|
|
16
16
|
};
|
|
17
17
|
export {};
|
|
@@ -2,6 +2,6 @@ import createFormatter from './createFormatter';
|
|
|
2
2
|
/** @deprecated Switch to `createFormatter` */
|
|
3
3
|
export default function createIntl(...args: Parameters<typeof createFormatter>): {
|
|
4
4
|
formatDateTime: (value: number | Date, formatOrOptions?: string | import("./DateTimeFormatOptions").default | undefined) => string;
|
|
5
|
-
formatNumber: (value: number | bigint, formatOrOptions?: string | import("@formatjs/ecma402-abstract").NumberFormatOptions | undefined) => string;
|
|
5
|
+
formatNumber: (value: number | bigint, formatOrOptions?: string | import("@formatjs/ecma402-abstract/types/number").NumberFormatOptions | undefined) => string;
|
|
6
6
|
formatRelativeTime: (date: number | Date, now?: number | Date | undefined) => string;
|
|
7
7
|
};
|
|
@@ -14,7 +14,7 @@ import NestedValueOf from './utils/NestedValueOf';
|
|
|
14
14
|
* The namespace can also indicate nesting by using a dot
|
|
15
15
|
* (e.g. `namespace.Component`).
|
|
16
16
|
*/
|
|
17
|
-
export default function createTranslator<NestedKey extends NamespaceKeys<IntlMessages, NestedKeyOf<IntlMessages>> = never>({
|
|
17
|
+
export default function createTranslator<NestedKey extends NamespaceKeys<IntlMessages, NestedKeyOf<IntlMessages>> = never>({ getMessageFallback, messages, namespace, onError, ...rest }: Omit<IntlConfig<IntlMessages>, 'defaultTranslationValues' | 'messages'> & {
|
|
18
18
|
messages: NonNullable<IntlConfig<IntlMessages>['messages']>;
|
|
19
19
|
namespace?: NestedKey;
|
|
20
20
|
}): {
|
|
@@ -8,7 +8,7 @@ import { defaultGetMessageFallback, defaultOnError } from './defaults';
|
|
|
8
8
|
* The namespace can also indicate nesting by using a dot
|
|
9
9
|
* (e.g. `namespace.Component`).
|
|
10
10
|
*/
|
|
11
|
-
export default function createTranslator({
|
|
11
|
+
export default function createTranslator({ getMessageFallback = defaultGetMessageFallback, messages, namespace, onError = defaultOnError, ...rest }) {
|
|
12
12
|
// We have to wrap the actual function so the type inference for the optional
|
|
13
13
|
// namespace works correctly. See https://stackoverflow.com/a/71529575/343045
|
|
14
14
|
// The prefix ("!") is arbitrary.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTranslator.js","sourceRoot":"","sources":["../../../src/core/createTranslator.tsx"],"names":[],"mappings":"AAGA,OAAO,oBAEN,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAC,yBAAyB,EAAE,cAAc,EAAC,MAAM,YAAY,CAAC;AAMrE;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAKtC,EACA,
|
|
1
|
+
{"version":3,"file":"createTranslator.js","sourceRoot":"","sources":["../../../src/core/createTranslator.tsx"],"names":[],"mappings":"AAGA,OAAO,oBAEN,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAC,yBAAyB,EAAE,cAAc,EAAC,MAAM,YAAY,CAAC;AAMrE;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAKtC,EACA,kBAAkB,GAAG,yBAAyB,EAC9C,QAAQ,EACR,SAAS,EACT,OAAO,GAAG,cAAc,EACxB,GAAG,IAAI,EAIR;IA4DC,6EAA6E;IAC7E,6EAA6E;IAC7E,iCAAiC;IACjC,OAAO,oBAAoB,CAIzB;QACE,GAAG,IAAI;QACP,OAAO;QACP,kBAAkB;QAClB,QAAQ,EAAE,EAAC,GAAG,EAAE,QAAQ,EAAC;QACzB,aAAa;QACb,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC,CAAC,CAAC,GAAG;KAC9C,EACD,GAAG,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -2,8 +2,8 @@ import AbstractIntlMessages from './AbstractIntlMessages';
|
|
|
2
2
|
import { InitializedIntlConfig } from './IntlConfig';
|
|
3
3
|
import { TranslationValue } from './TranslationValues';
|
|
4
4
|
import NestedKeyOf from './utils/NestedKeyOf';
|
|
5
|
-
export
|
|
6
|
-
export
|
|
5
|
+
export type CoreRichTranslationValues = Record<string, TranslationValue | ((chunks: string) => string)>;
|
|
6
|
+
export type CreateTranslatorImplProps<Messages> = Omit<InitializedIntlConfig, 'messages'> & {
|
|
7
7
|
namespace: string;
|
|
8
8
|
messages: Messages;
|
|
9
9
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import NestedValueOf from './NestedValueOf';
|
|
2
|
-
|
|
2
|
+
type MessageKeys<ObjectType, Keys extends string> = {
|
|
3
3
|
[Property in Keys]: NestedValueOf<ObjectType, Property> extends string ? Property : never;
|
|
4
4
|
}[Keys];
|
|
5
5
|
export default MessageKeys;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import NestedValueOf from './NestedValueOf';
|
|
2
|
-
|
|
2
|
+
type NamespaceKeys<ObjectType, Keys extends string> = {
|
|
3
3
|
[Property in Keys]: NestedValueOf<ObjectType, Property> extends string ? never : Property;
|
|
4
4
|
}[Keys];
|
|
5
5
|
export default NamespaceKeys;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
type NestedKeyOf<ObjectType> = ObjectType extends object ? {
|
|
2
2
|
[Key in keyof ObjectType]: `${Key & string}` | `${Key & string}.${NestedKeyOf<ObjectType[Key]>}`;
|
|
3
3
|
}[keyof ObjectType] : never;
|
|
4
4
|
export default NestedKeyOf;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
type NestedValueOf<ObjectType, Property extends string> = Property extends `${infer Key}.${infer Rest}` ? Key extends keyof ObjectType ? NestedValueOf<ObjectType[Key], Rest> : never : Property extends keyof ObjectType ? ObjectType[Property] : never;
|
|
2
2
|
export default NestedValueOf;
|
|
@@ -16,7 +16,41 @@ export default function validateMessages(messages, onError) {
|
|
|
16
16
|
const invalidKeyLabels = [];
|
|
17
17
|
validateMessagesSegment(messages, invalidKeyLabels);
|
|
18
18
|
if (invalidKeyLabels.length > 0) {
|
|
19
|
-
onError(new IntlError(IntlErrorCode.INVALID_KEY,
|
|
19
|
+
onError(new IntlError(IntlErrorCode.INVALID_KEY, process.env.NODE_ENV !== 'production'
|
|
20
|
+
? `Namespace keys can not contain the character "." as this is used to express nesting. Please remove it or replace it with another character.
|
|
21
|
+
|
|
22
|
+
Invalid ${invalidKeyLabels.length === 1 ? 'key' : 'keys'}: ${invalidKeyLabels.join(', ')}
|
|
23
|
+
|
|
24
|
+
If you're migrating from a flat structure, you can convert your messages as follows:
|
|
25
|
+
|
|
26
|
+
import {set} from "lodash";
|
|
27
|
+
|
|
28
|
+
const input = {
|
|
29
|
+
"one.one": "1.1",
|
|
30
|
+
"one.two": "1.2",
|
|
31
|
+
"two.one.one": "2.1.1"
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const output = Object.entries(input).reduce(
|
|
35
|
+
(acc, [key, value]) => set(acc, key, value),
|
|
36
|
+
{}
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
// Output:
|
|
40
|
+
//
|
|
41
|
+
// {
|
|
42
|
+
// "one": {
|
|
43
|
+
// "one": "1.1",
|
|
44
|
+
// "two": "1.2"
|
|
45
|
+
// },
|
|
46
|
+
// "two": {
|
|
47
|
+
// "one": {
|
|
48
|
+
// "one": "2.1.1"
|
|
49
|
+
// }
|
|
50
|
+
// }
|
|
51
|
+
// }
|
|
52
|
+
`
|
|
53
|
+
: undefined));
|
|
20
54
|
}
|
|
21
55
|
}
|
|
22
56
|
//# sourceMappingURL=validateMessages.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateMessages.js","sourceRoot":"","sources":["../../../src/core/validateMessages.tsx"],"names":[],"mappings":"AACA,OAAO,SAAS,EAAE,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAErD,SAAS,uBAAuB,CAC9B,QAA8B,EAC9B,gBAA+B,EAC/B,UAAmB;IAEnB,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,iBAAiB,CAAC,EAAE,EAAE;QAC5D,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YACrB,IAAI,QAAQ,GAAG,GAAG,CAAC;YACnB,IAAI,UAAU;gBAAE,QAAQ,IAAI,QAAQ,UAAU,GAAG,CAAC;YAClD,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SACjC;QAED,IAAI,iBAAiB,IAAI,IAAI,IAAI,OAAO,iBAAiB,KAAK,QAAQ,EAAE;YACtE,uBAAuB,CACrB,iBAAiB,EACjB,gBAAgB,EAChB,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAC3D,CAAC;SACH;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,QAA8B,EAC9B,OAAmC;IAEnC,MAAM,gBAAgB,GAAkB,EAAE,CAAC;IAC3C,uBAAuB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;IAEpD,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE;QAC/B,OAAO,CACL,IAAI,SAAS,CACX,aAAa,CAAC,WAAW,EACzB,
|
|
1
|
+
{"version":3,"file":"validateMessages.js","sourceRoot":"","sources":["../../../src/core/validateMessages.tsx"],"names":[],"mappings":"AACA,OAAO,SAAS,EAAE,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAErD,SAAS,uBAAuB,CAC9B,QAA8B,EAC9B,gBAA+B,EAC/B,UAAmB;IAEnB,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,iBAAiB,CAAC,EAAE,EAAE;QAC5D,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YACrB,IAAI,QAAQ,GAAG,GAAG,CAAC;YACnB,IAAI,UAAU;gBAAE,QAAQ,IAAI,QAAQ,UAAU,GAAG,CAAC;YAClD,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SACjC;QAED,IAAI,iBAAiB,IAAI,IAAI,IAAI,OAAO,iBAAiB,KAAK,QAAQ,EAAE;YACtE,uBAAuB,CACrB,iBAAiB,EACjB,gBAAgB,EAChB,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAC3D,CAAC;SACH;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,QAA8B,EAC9B,OAAmC;IAEnC,MAAM,gBAAgB,GAAkB,EAAE,CAAC;IAC3C,uBAAuB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;IAEpD,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE;QAC/B,OAAO,CACL,IAAI,SAAS,CACX,aAAa,CAAC,WAAW,EACzB,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY;YACnC,CAAC,CAAC;;UAGE,gBAAgB,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAC1C,KAAK,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8B3C;YACS,CAAC,CAAC,SAAS,CACd,CACF,CAAC;KACH;AACH,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default function useFormatter(): {
|
|
2
2
|
dateTime: (value: number | Date, formatOrOptions?: string | import("../core/DateTimeFormatOptions").default | undefined) => string;
|
|
3
|
-
number: (value: number | bigint, formatOrOptions?: string | import("@formatjs/ecma402-abstract").NumberFormatOptions | undefined) => string;
|
|
3
|
+
number: (value: number | bigint, formatOrOptions?: string | import("@formatjs/ecma402-abstract/types/number").NumberFormatOptions | undefined) => string;
|
|
4
4
|
relativeTime: (date: number | Date, now?: number | Date | undefined) => string;
|
|
5
5
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @deprecated Switch to `useFormatter` instead. */
|
|
2
2
|
export default function useIntl(): {
|
|
3
3
|
formatDateTime: (value: number | Date, formatOrOptions?: string | import("../core/DateTimeFormatOptions").default | undefined) => string;
|
|
4
|
-
formatNumber: (value: number | bigint, formatOrOptions?: string | import("@formatjs/ecma402-abstract").NumberFormatOptions | undefined) => string;
|
|
4
|
+
formatNumber: (value: number | bigint, formatOrOptions?: string | import("@formatjs/ecma402-abstract/types/number").NumberFormatOptions | undefined) => string;
|
|
5
5
|
formatRelativeTime: (date: number | Date, now?: number | Date | undefined) => string;
|
|
6
6
|
};
|