@react-aria/i18n 3.12.16 → 3.13.0
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/import.mjs +9 -11
- package/dist/main.js +19 -21
- package/dist/main.js.map +1 -1
- package/dist/module.js +9 -11
- package/dist/module.js.map +1 -1
- package/dist/{useMessageFormatter.main.js → private/useMessageFormatter.cjs} +15 -15
- package/dist/{useMessageFormatter.main.js.map → private/useMessageFormatter.cjs.map} +1 -1
- package/dist/private/useMessageFormatter.js +43 -0
- package/dist/{useMessageFormatter.module.js.map → private/useMessageFormatter.js.map} +1 -1
- package/dist/types/src/index.d.ts +15 -0
- package/dist/types/src/server.d.ts +1 -0
- package/dist/types/src/useMessageFormatter.d.ts +11 -0
- package/package.json +15 -21
- package/server/index.js +4 -72
- package/server/index.js.map +1 -1
- package/server/index.mjs +3 -67
- package/server/index.mjs.map +1 -1
- package/src/index.ts +11 -13
- package/src/server.ts +1 -0
- package/src/useMessageFormatter.ts +1 -1
- package/dist/context.main.js +0 -72
- package/dist/context.main.js.map +0 -1
- package/dist/context.mjs +0 -62
- package/dist/context.module.js +0 -62
- package/dist/context.module.js.map +0 -1
- package/dist/types.d.ts +0 -95
- package/dist/types.d.ts.map +0 -1
- package/dist/useCollator.main.js +0 -31
- package/dist/useCollator.main.js.map +0 -1
- package/dist/useCollator.mjs +0 -26
- package/dist/useCollator.module.js +0 -26
- package/dist/useCollator.module.js.map +0 -1
- package/dist/useDateFormatter.main.js +0 -47
- package/dist/useDateFormatter.main.js.map +0 -1
- package/dist/useDateFormatter.mjs +0 -42
- package/dist/useDateFormatter.module.js +0 -42
- package/dist/useDateFormatter.module.js.map +0 -1
- package/dist/useDefaultLocale.main.js +0 -70
- package/dist/useDefaultLocale.main.js.map +0 -1
- package/dist/useDefaultLocale.mjs +0 -65
- package/dist/useDefaultLocale.module.js +0 -65
- package/dist/useDefaultLocale.module.js.map +0 -1
- package/dist/useFilter.main.js +0 -72
- package/dist/useFilter.main.js.map +0 -1
- package/dist/useFilter.mjs +0 -67
- package/dist/useFilter.module.js +0 -67
- package/dist/useFilter.module.js.map +0 -1
- package/dist/useListFormatter.main.js +0 -31
- package/dist/useListFormatter.main.js.map +0 -1
- package/dist/useListFormatter.mjs +0 -26
- package/dist/useListFormatter.module.js +0 -26
- package/dist/useListFormatter.module.js.map +0 -1
- package/dist/useLocalizedStringFormatter.main.js +0 -47
- package/dist/useLocalizedStringFormatter.main.js.map +0 -1
- package/dist/useLocalizedStringFormatter.mjs +0 -41
- package/dist/useLocalizedStringFormatter.module.js +0 -41
- package/dist/useLocalizedStringFormatter.module.js.map +0 -1
- package/dist/useMessageFormatter.mjs +0 -43
- package/dist/useMessageFormatter.module.js +0 -43
- package/dist/useNumberFormatter.main.js +0 -33
- package/dist/useNumberFormatter.main.js.map +0 -1
- package/dist/useNumberFormatter.mjs +0 -28
- package/dist/useNumberFormatter.module.js +0 -28
- package/dist/useNumberFormatter.module.js.map +0 -1
- package/dist/utils.main.js +0 -70
- package/dist/utils.main.js.map +0 -1
- package/dist/utils.mjs +0 -65
- package/dist/utils.module.js +0 -65
- package/dist/utils.module.js.map +0 -1
- package/src/context.tsx +0 -87
- package/src/main.js +0 -6
- package/src/module.js +0 -6
- package/src/server.tsx +0 -99
- package/src/useCollator.ts +0 -33
- package/src/useDateFormatter.ts +0 -52
- package/src/useDefaultLocale.ts +0 -91
- package/src/useFilter.ts +0 -83
- package/src/useListFormatter.tsx +0 -24
- package/src/useLocalizedStringFormatter.ts +0 -44
- package/src/useNumberFormatter.ts +0 -25
- package/src/utils.ts +0 -43
package/dist/import.mjs
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {useListFormatter as $
|
|
5
|
-
import {useDateFormatter as $
|
|
6
|
-
import {useNumberFormatter as $
|
|
7
|
-
import {useCollator as $
|
|
8
|
-
import {useFilter as $
|
|
9
|
-
import {isRTL as $148a7a147e38ea7f$export$702d680b21cbd764} from "./utils.mjs";
|
|
1
|
+
import {useMessageFormatter as $345fc832e5b22baa$export$ec23bf898b1eed85} from "./private/useMessageFormatter.js";
|
|
2
|
+
import {I18nProvider as $1697a7ad3db7b79f$re_export$I18nProvider, useLocale as $1697a7ad3db7b79f$re_export$useLocale, isRTL as $1697a7ad3db7b79f$re_export$isRTL} from "react-aria/I18nProvider";
|
|
3
|
+
import {useLocalizedStringFormatter as $1697a7ad3db7b79f$re_export$useLocalizedStringFormatter, useLocalizedStringDictionary as $1697a7ad3db7b79f$re_export$useLocalizedStringDictionary} from "react-aria/useLocalizedStringFormatter";
|
|
4
|
+
import {useListFormatter as $1697a7ad3db7b79f$re_export$useListFormatter} from "react-aria/useListFormatter";
|
|
5
|
+
import {useDateFormatter as $1697a7ad3db7b79f$re_export$useDateFormatter} from "react-aria/useDateFormatter";
|
|
6
|
+
import {useNumberFormatter as $1697a7ad3db7b79f$re_export$useNumberFormatter} from "react-aria/useNumberFormatter";
|
|
7
|
+
import {useCollator as $1697a7ad3db7b79f$re_export$useCollator} from "react-aria/useCollator";
|
|
8
|
+
import {useFilter as $1697a7ad3db7b79f$re_export$useFilter} from "react-aria/useFilter";
|
|
10
9
|
|
|
11
10
|
/*
|
|
12
11
|
* Copyright 2020 Adobe. All rights reserved.
|
|
@@ -28,6 +27,5 @@ import {isRTL as $148a7a147e38ea7f$export$702d680b21cbd764} from "./utils.mjs";
|
|
|
28
27
|
|
|
29
28
|
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
export {$18f2051aff69b9bf$export$a54013f0d02a8f82 as I18nProvider, $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 as useLocale, $321bc95feeb923dd$export$ec23bf898b1eed85 as useMessageFormatter, $fca6afa0e843324b$export$f12b703ca79dfbb1 as useLocalizedStringFormatter, $fca6afa0e843324b$export$87b761675e8eaa10 as useLocalizedStringDictionary, $33bf17300c498528$export$a2f47a3d2973640 as useListFormatter, $896ba0a80a8f4d36$export$85fd5fdf27bacc79 as useDateFormatter, $a916eb452884faea$export$b7a616150fdb9f44 as useNumberFormatter, $325a3faab7a68acd$export$a16aca283550c30d as useCollator, $bb77f239b46e8c72$export$3274cf84b703fff as useFilter, $148a7a147e38ea7f$export$702d680b21cbd764 as isRTL};
|
|
30
|
+
export {$1697a7ad3db7b79f$re_export$I18nProvider as I18nProvider, $1697a7ad3db7b79f$re_export$useLocale as useLocale, $1697a7ad3db7b79f$re_export$isRTL as isRTL, $345fc832e5b22baa$export$ec23bf898b1eed85 as useMessageFormatter, $1697a7ad3db7b79f$re_export$useLocalizedStringFormatter as useLocalizedStringFormatter, $1697a7ad3db7b79f$re_export$useLocalizedStringDictionary as useLocalizedStringDictionary, $1697a7ad3db7b79f$re_export$useListFormatter as useListFormatter, $1697a7ad3db7b79f$re_export$useDateFormatter as useDateFormatter, $1697a7ad3db7b79f$re_export$useNumberFormatter as useNumberFormatter, $1697a7ad3db7b79f$re_export$useCollator as useCollator, $1697a7ad3db7b79f$re_export$useFilter as useFilter};
|
|
33
31
|
//# sourceMappingURL=module.js.map
|
package/dist/main.js
CHANGED
|
@@ -1,29 +1,28 @@
|
|
|
1
|
-
var $
|
|
2
|
-
var $
|
|
3
|
-
var $
|
|
4
|
-
var $
|
|
5
|
-
var $
|
|
6
|
-
var $
|
|
7
|
-
var $
|
|
8
|
-
var $
|
|
9
|
-
var $4d65847630a056a8$exports = require("./utils.main.js");
|
|
1
|
+
var $640f8936efd5afb8$exports = require("./private/useMessageFormatter.cjs");
|
|
2
|
+
var $hXxDt$reactariaI18nProvider = require("react-aria/I18nProvider");
|
|
3
|
+
var $hXxDt$reactariauseLocalizedStringFormatter = require("react-aria/useLocalizedStringFormatter");
|
|
4
|
+
var $hXxDt$reactariauseListFormatter = require("react-aria/useListFormatter");
|
|
5
|
+
var $hXxDt$reactariauseDateFormatter = require("react-aria/useDateFormatter");
|
|
6
|
+
var $hXxDt$reactariauseNumberFormatter = require("react-aria/useNumberFormatter");
|
|
7
|
+
var $hXxDt$reactariauseCollator = require("react-aria/useCollator");
|
|
8
|
+
var $hXxDt$reactariauseFilter = require("react-aria/useFilter");
|
|
10
9
|
|
|
11
10
|
|
|
12
11
|
function $parcel$export(e, n, v, s) {
|
|
13
12
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
14
13
|
}
|
|
15
14
|
|
|
16
|
-
$parcel$export(module.exports, "I18nProvider", ()
|
|
17
|
-
$parcel$export(module.exports, "useLocale", ()
|
|
18
|
-
$parcel$export(module.exports, "
|
|
19
|
-
$parcel$export(module.exports, "
|
|
20
|
-
$parcel$export(module.exports, "
|
|
21
|
-
$parcel$export(module.exports, "
|
|
22
|
-
$parcel$export(module.exports, "
|
|
23
|
-
$parcel$export(module.exports, "
|
|
24
|
-
$parcel$export(module.exports, "
|
|
25
|
-
$parcel$export(module.exports, "
|
|
26
|
-
$parcel$export(module.exports, "
|
|
15
|
+
$parcel$export(module.exports, "I18nProvider", function () { return $hXxDt$reactariaI18nProvider.I18nProvider; });
|
|
16
|
+
$parcel$export(module.exports, "useLocale", function () { return $hXxDt$reactariaI18nProvider.useLocale; });
|
|
17
|
+
$parcel$export(module.exports, "isRTL", function () { return $hXxDt$reactariaI18nProvider.isRTL; });
|
|
18
|
+
$parcel$export(module.exports, "useMessageFormatter", function () { return $640f8936efd5afb8$exports.useMessageFormatter; });
|
|
19
|
+
$parcel$export(module.exports, "useLocalizedStringFormatter", function () { return $hXxDt$reactariauseLocalizedStringFormatter.useLocalizedStringFormatter; });
|
|
20
|
+
$parcel$export(module.exports, "useLocalizedStringDictionary", function () { return $hXxDt$reactariauseLocalizedStringFormatter.useLocalizedStringDictionary; });
|
|
21
|
+
$parcel$export(module.exports, "useListFormatter", function () { return $hXxDt$reactariauseListFormatter.useListFormatter; });
|
|
22
|
+
$parcel$export(module.exports, "useDateFormatter", function () { return $hXxDt$reactariauseDateFormatter.useDateFormatter; });
|
|
23
|
+
$parcel$export(module.exports, "useNumberFormatter", function () { return $hXxDt$reactariauseNumberFormatter.useNumberFormatter; });
|
|
24
|
+
$parcel$export(module.exports, "useCollator", function () { return $hXxDt$reactariauseCollator.useCollator; });
|
|
25
|
+
$parcel$export(module.exports, "useFilter", function () { return $hXxDt$reactariauseFilter.useFilter; });
|
|
27
26
|
/*
|
|
28
27
|
* Copyright 2020 Adobe. All rights reserved.
|
|
29
28
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -44,5 +43,4 @@ $parcel$export(module.exports, "isRTL", () => $4d65847630a056a8$exports.isRTL);
|
|
|
44
43
|
|
|
45
44
|
|
|
46
45
|
|
|
47
|
-
|
|
48
46
|
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/i18n/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport {I18nProvider, useLocale, isRTL} from 'react-aria/I18nProvider';\n\nexport {useMessageFormatter} from './useMessageFormatter';\nexport {useLocalizedStringFormatter, useLocalizedStringDictionary} from 'react-aria/useLocalizedStringFormatter';\nexport {useListFormatter} from 'react-aria/useListFormatter';\nexport {useDateFormatter} from 'react-aria/useDateFormatter';\nexport {useNumberFormatter} from 'react-aria/useNumberFormatter';\nexport {useCollator} from 'react-aria/useCollator';\nexport {useFilter} from 'react-aria/useFilter';\nexport type {FormatMessage} from './useMessageFormatter';\nexport type {I18nProviderProps, Locale} from 'react-aria/I18nProvider';\nexport type {DateFormatterOptions} from 'react-aria/useDateFormatter';\nexport type {Filter} from 'react-aria/useFilter';\nexport type {LocalizedStringFormatter} from '@internationalized/string';\nexport type {LocalizedStrings} from '@internationalized/message';\nexport type {DateFormatter} from '@internationalized/date';\n"],"names":[],"version":3,"file":"main.js.map"}
|
package/dist/module.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {useListFormatter as $
|
|
5
|
-
import {useDateFormatter as $
|
|
6
|
-
import {useNumberFormatter as $
|
|
7
|
-
import {useCollator as $
|
|
8
|
-
import {useFilter as $
|
|
9
|
-
import {isRTL as $148a7a147e38ea7f$export$702d680b21cbd764} from "./utils.module.js";
|
|
1
|
+
import {useMessageFormatter as $345fc832e5b22baa$export$ec23bf898b1eed85} from "./private/useMessageFormatter.js";
|
|
2
|
+
import {I18nProvider as $1697a7ad3db7b79f$re_export$I18nProvider, useLocale as $1697a7ad3db7b79f$re_export$useLocale, isRTL as $1697a7ad3db7b79f$re_export$isRTL} from "react-aria/I18nProvider";
|
|
3
|
+
import {useLocalizedStringFormatter as $1697a7ad3db7b79f$re_export$useLocalizedStringFormatter, useLocalizedStringDictionary as $1697a7ad3db7b79f$re_export$useLocalizedStringDictionary} from "react-aria/useLocalizedStringFormatter";
|
|
4
|
+
import {useListFormatter as $1697a7ad3db7b79f$re_export$useListFormatter} from "react-aria/useListFormatter";
|
|
5
|
+
import {useDateFormatter as $1697a7ad3db7b79f$re_export$useDateFormatter} from "react-aria/useDateFormatter";
|
|
6
|
+
import {useNumberFormatter as $1697a7ad3db7b79f$re_export$useNumberFormatter} from "react-aria/useNumberFormatter";
|
|
7
|
+
import {useCollator as $1697a7ad3db7b79f$re_export$useCollator} from "react-aria/useCollator";
|
|
8
|
+
import {useFilter as $1697a7ad3db7b79f$re_export$useFilter} from "react-aria/useFilter";
|
|
10
9
|
|
|
11
10
|
/*
|
|
12
11
|
* Copyright 2020 Adobe. All rights reserved.
|
|
@@ -28,6 +27,5 @@ import {isRTL as $148a7a147e38ea7f$export$702d680b21cbd764} from "./utils.module
|
|
|
28
27
|
|
|
29
28
|
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
export {$18f2051aff69b9bf$export$a54013f0d02a8f82 as I18nProvider, $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 as useLocale, $321bc95feeb923dd$export$ec23bf898b1eed85 as useMessageFormatter, $fca6afa0e843324b$export$f12b703ca79dfbb1 as useLocalizedStringFormatter, $fca6afa0e843324b$export$87b761675e8eaa10 as useLocalizedStringDictionary, $33bf17300c498528$export$a2f47a3d2973640 as useListFormatter, $896ba0a80a8f4d36$export$85fd5fdf27bacc79 as useDateFormatter, $a916eb452884faea$export$b7a616150fdb9f44 as useNumberFormatter, $325a3faab7a68acd$export$a16aca283550c30d as useCollator, $bb77f239b46e8c72$export$3274cf84b703fff as useFilter, $148a7a147e38ea7f$export$702d680b21cbd764 as isRTL};
|
|
30
|
+
export {$1697a7ad3db7b79f$re_export$I18nProvider as I18nProvider, $1697a7ad3db7b79f$re_export$useLocale as useLocale, $1697a7ad3db7b79f$re_export$isRTL as isRTL, $345fc832e5b22baa$export$ec23bf898b1eed85 as useMessageFormatter, $1697a7ad3db7b79f$re_export$useLocalizedStringFormatter as useLocalizedStringFormatter, $1697a7ad3db7b79f$re_export$useLocalizedStringDictionary as useLocalizedStringDictionary, $1697a7ad3db7b79f$re_export$useListFormatter as useListFormatter, $1697a7ad3db7b79f$re_export$useDateFormatter as useDateFormatter, $1697a7ad3db7b79f$re_export$useNumberFormatter as useNumberFormatter, $1697a7ad3db7b79f$re_export$useCollator as useCollator, $1697a7ad3db7b79f$re_export$useFilter as useFilter};
|
|
33
31
|
//# sourceMappingURL=module.js.map
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/i18n/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport {I18nProvider, useLocale, isRTL} from 'react-aria/I18nProvider';\n\nexport {useMessageFormatter} from './useMessageFormatter';\nexport {useLocalizedStringFormatter, useLocalizedStringDictionary} from 'react-aria/useLocalizedStringFormatter';\nexport {useListFormatter} from 'react-aria/useListFormatter';\nexport {useDateFormatter} from 'react-aria/useDateFormatter';\nexport {useNumberFormatter} from 'react-aria/useNumberFormatter';\nexport {useCollator} from 'react-aria/useCollator';\nexport {useFilter} from 'react-aria/useFilter';\nexport type {FormatMessage} from './useMessageFormatter';\nexport type {I18nProviderProps, Locale} from 'react-aria/I18nProvider';\nexport type {DateFormatterOptions} from 'react-aria/useDateFormatter';\nexport type {Filter} from 'react-aria/useFilter';\nexport type {LocalizedStringFormatter} from '@internationalized/string';\nexport type {LocalizedStrings} from '@internationalized/message';\nexport type {DateFormatter} from '@internationalized/date';\n"],"names":[],"version":3,"file":"module.js.map"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var $
|
|
2
|
-
var $
|
|
3
|
-
var $
|
|
1
|
+
var $gCv12$internationalizedmessage = require("@internationalized/message");
|
|
2
|
+
var $gCv12$react = require("react");
|
|
3
|
+
var $gCv12$reactariaI18nProvider = require("react-aria/I18nProvider");
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
function $parcel$export(e, n, v, s) {
|
|
7
7
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
$parcel$export(module.exports, "useMessageFormatter", ()
|
|
10
|
+
$parcel$export(module.exports, "useMessageFormatter", function () { return $640f8936efd5afb8$export$ec23bf898b1eed85; });
|
|
11
11
|
/*
|
|
12
12
|
* Copyright 2020 Adobe. All rights reserved.
|
|
13
13
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -21,28 +21,28 @@ $parcel$export(module.exports, "useMessageFormatter", () => $c376aa482226bf60$ex
|
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
const $
|
|
25
|
-
function $
|
|
26
|
-
let dictionary = $
|
|
24
|
+
const $640f8936efd5afb8$var$cache = new WeakMap();
|
|
25
|
+
function $640f8936efd5afb8$var$getCachedDictionary(strings) {
|
|
26
|
+
let dictionary = $640f8936efd5afb8$var$cache.get(strings);
|
|
27
27
|
if (!dictionary) {
|
|
28
|
-
dictionary = new (0, $
|
|
29
|
-
$
|
|
28
|
+
dictionary = new (0, $gCv12$internationalizedmessage.MessageDictionary)(strings);
|
|
29
|
+
$640f8936efd5afb8$var$cache.set(strings, dictionary);
|
|
30
30
|
}
|
|
31
31
|
return dictionary;
|
|
32
32
|
}
|
|
33
|
-
function $
|
|
34
|
-
let { locale: locale } = (0, $
|
|
35
|
-
let dictionary = (0, $
|
|
33
|
+
function $640f8936efd5afb8$export$ec23bf898b1eed85(strings) {
|
|
34
|
+
let { locale: locale } = (0, $gCv12$reactariaI18nProvider.useLocale)();
|
|
35
|
+
let dictionary = (0, $gCv12$react.useMemo)(()=>$640f8936efd5afb8$var$getCachedDictionary(strings), [
|
|
36
36
|
strings
|
|
37
37
|
]);
|
|
38
|
-
let formatter = (0, $
|
|
38
|
+
let formatter = (0, $gCv12$react.useMemo)(()=>new (0, $gCv12$internationalizedmessage.MessageFormatter)(locale, dictionary), [
|
|
39
39
|
locale,
|
|
40
40
|
dictionary
|
|
41
41
|
]);
|
|
42
|
-
return (0, $
|
|
42
|
+
return (0, $gCv12$react.useCallback)((key, variables)=>formatter.format(key, variables), [
|
|
43
43
|
formatter
|
|
44
44
|
]);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
|
|
48
|
-
//# sourceMappingURL=useMessageFormatter.
|
|
48
|
+
//# sourceMappingURL=useMessageFormatter.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AAQD,MAAM,8BAAQ,IAAI;AAClB,SAAS,0CAAoB,OAAyB;IACpD,IAAI,aAAa,4BAAM,GAAG,CAAC;IAC3B,IAAI,CAAC,YAAY;QACf,aAAa,IAAI,CAAA,GAAA,iDAAgB,EAAE;QACnC,4BAAM,GAAG,CAAC,SAAS;IACrB;IAEA,OAAO;AACT;AAQO,SAAS,0CAAoB,OAAyB;IAC3D,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,
|
|
1
|
+
{"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AAQD,MAAM,8BAAQ,IAAI;AAClB,SAAS,0CAAoB,OAAyB;IACpD,IAAI,aAAa,4BAAM,GAAG,CAAC;IAC3B,IAAI,CAAC,YAAY;QACf,aAAa,IAAI,CAAA,GAAA,iDAAgB,EAAE;QACnC,4BAAM,GAAG,CAAC,SAAS;IACrB;IAEA,OAAO;AACT;AAQO,SAAS,0CAAoB,OAAyB;IAC3D,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,sCAAQ;IACvB,IAAI,aAAa,CAAA,GAAA,oBAAM,EAAE,IAAM,0CAAoB,UAAU;QAAC;KAAQ;IACtE,IAAI,YAAY,CAAA,GAAA,oBAAM,EAAE,IAAM,IAAI,CAAA,GAAA,gDAAe,EAAE,QAAQ,aAAa;QAAC;QAAQ;KAAW;IAC5F,OAAO,CAAA,GAAA,wBAAU,EAAE,CAAC,KAAK,YAAc,UAAU,MAAM,CAAC,KAAK,YAAY;QAAC;KAAU;AACtF","sources":["packages/@react-aria/i18n/src/useMessageFormatter.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {LocalizedStrings, MessageDictionary, MessageFormatter} from '@internationalized/message';\nimport {useCallback, useMemo} from 'react';\nimport {useLocale} from 'react-aria/I18nProvider';\n\nexport type FormatMessage = (key: string, variables?: {[key: string]: any}) => string;\n\nconst cache = new WeakMap();\nfunction getCachedDictionary(strings: LocalizedStrings) {\n let dictionary = cache.get(strings);\n if (!dictionary) {\n dictionary = new MessageDictionary(strings);\n cache.set(strings, dictionary);\n }\n\n return dictionary;\n}\n\n/**\n * Handles formatting ICU Message strings to create localized strings for the current locale.\n * Automatically updates when the locale changes, and handles caching of messages for performance.\n * @param strings - A mapping of languages to strings by key.\n * @deprecated - use useLocalizedStringFormatter instead.\n */\nexport function useMessageFormatter(strings: LocalizedStrings): FormatMessage {\n let {locale} = useLocale();\n let dictionary = useMemo(() => getCachedDictionary(strings), [strings]);\n let formatter = useMemo(() => new MessageFormatter(locale, dictionary), [locale, dictionary]);\n return useCallback((key, variables) => formatter.format(key, variables), [formatter]);\n}\n"],"names":[],"version":3,"file":"useMessageFormatter.cjs.map"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {MessageDictionary as $gt8dg$MessageDictionary, MessageFormatter as $gt8dg$MessageFormatter} from "@internationalized/message";
|
|
2
|
+
import {useMemo as $gt8dg$useMemo, useCallback as $gt8dg$useCallback} from "react";
|
|
3
|
+
import {useLocale as $gt8dg$useLocale} from "react-aria/I18nProvider";
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
7
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
9
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
12
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
13
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
14
|
+
* governing permissions and limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
const $345fc832e5b22baa$var$cache = new WeakMap();
|
|
19
|
+
function $345fc832e5b22baa$var$getCachedDictionary(strings) {
|
|
20
|
+
let dictionary = $345fc832e5b22baa$var$cache.get(strings);
|
|
21
|
+
if (!dictionary) {
|
|
22
|
+
dictionary = new (0, $gt8dg$MessageDictionary)(strings);
|
|
23
|
+
$345fc832e5b22baa$var$cache.set(strings, dictionary);
|
|
24
|
+
}
|
|
25
|
+
return dictionary;
|
|
26
|
+
}
|
|
27
|
+
function $345fc832e5b22baa$export$ec23bf898b1eed85(strings) {
|
|
28
|
+
let { locale: locale } = (0, $gt8dg$useLocale)();
|
|
29
|
+
let dictionary = (0, $gt8dg$useMemo)(()=>$345fc832e5b22baa$var$getCachedDictionary(strings), [
|
|
30
|
+
strings
|
|
31
|
+
]);
|
|
32
|
+
let formatter = (0, $gt8dg$useMemo)(()=>new (0, $gt8dg$MessageFormatter)(locale, dictionary), [
|
|
33
|
+
locale,
|
|
34
|
+
dictionary
|
|
35
|
+
]);
|
|
36
|
+
return (0, $gt8dg$useCallback)((key, variables)=>formatter.format(key, variables), [
|
|
37
|
+
formatter
|
|
38
|
+
]);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
export {$345fc832e5b22baa$export$ec23bf898b1eed85 as useMessageFormatter};
|
|
43
|
+
//# sourceMappingURL=useMessageFormatter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAQD,MAAM,8BAAQ,IAAI;AAClB,SAAS,0CAAoB,OAAyB;IACpD,IAAI,aAAa,4BAAM,GAAG,CAAC;IAC3B,IAAI,CAAC,YAAY;QACf,aAAa,IAAI,CAAA,GAAA,wBAAgB,EAAE;QACnC,4BAAM,GAAG,CAAC,SAAS;IACrB;IAEA,OAAO;AACT;AAQO,SAAS,0CAAoB,OAAyB;IAC3D,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,
|
|
1
|
+
{"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAQD,MAAM,8BAAQ,IAAI;AAClB,SAAS,0CAAoB,OAAyB;IACpD,IAAI,aAAa,4BAAM,GAAG,CAAC;IAC3B,IAAI,CAAC,YAAY;QACf,aAAa,IAAI,CAAA,GAAA,wBAAgB,EAAE;QACnC,4BAAM,GAAG,CAAC,SAAS;IACrB;IAEA,OAAO;AACT;AAQO,SAAS,0CAAoB,OAAyB;IAC3D,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,gBAAQ;IACvB,IAAI,aAAa,CAAA,GAAA,cAAM,EAAE,IAAM,0CAAoB,UAAU;QAAC;KAAQ;IACtE,IAAI,YAAY,CAAA,GAAA,cAAM,EAAE,IAAM,IAAI,CAAA,GAAA,uBAAe,EAAE,QAAQ,aAAa;QAAC;QAAQ;KAAW;IAC5F,OAAO,CAAA,GAAA,kBAAU,EAAE,CAAC,KAAK,YAAc,UAAU,MAAM,CAAC,KAAK,YAAY;QAAC;KAAU;AACtF","sources":["packages/@react-aria/i18n/src/useMessageFormatter.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {LocalizedStrings, MessageDictionary, MessageFormatter} from '@internationalized/message';\nimport {useCallback, useMemo} from 'react';\nimport {useLocale} from 'react-aria/I18nProvider';\n\nexport type FormatMessage = (key: string, variables?: {[key: string]: any}) => string;\n\nconst cache = new WeakMap();\nfunction getCachedDictionary(strings: LocalizedStrings) {\n let dictionary = cache.get(strings);\n if (!dictionary) {\n dictionary = new MessageDictionary(strings);\n cache.set(strings, dictionary);\n }\n\n return dictionary;\n}\n\n/**\n * Handles formatting ICU Message strings to create localized strings for the current locale.\n * Automatically updates when the locale changes, and handles caching of messages for performance.\n * @param strings - A mapping of languages to strings by key.\n * @deprecated - use useLocalizedStringFormatter instead.\n */\nexport function useMessageFormatter(strings: LocalizedStrings): FormatMessage {\n let {locale} = useLocale();\n let dictionary = useMemo(() => getCachedDictionary(strings), [strings]);\n let formatter = useMemo(() => new MessageFormatter(locale, dictionary), [locale, dictionary]);\n return useCallback((key, variables) => formatter.format(key, variables), [formatter]);\n}\n"],"names":[],"version":3,"file":"useMessageFormatter.js.map"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { I18nProvider, useLocale, isRTL } from 'react-aria/I18nProvider';
|
|
2
|
+
export { useMessageFormatter } from './useMessageFormatter';
|
|
3
|
+
export { useLocalizedStringFormatter, useLocalizedStringDictionary } from 'react-aria/useLocalizedStringFormatter';
|
|
4
|
+
export { useListFormatter } from 'react-aria/useListFormatter';
|
|
5
|
+
export { useDateFormatter } from 'react-aria/useDateFormatter';
|
|
6
|
+
export { useNumberFormatter } from 'react-aria/useNumberFormatter';
|
|
7
|
+
export { useCollator } from 'react-aria/useCollator';
|
|
8
|
+
export { useFilter } from 'react-aria/useFilter';
|
|
9
|
+
export type { FormatMessage } from './useMessageFormatter';
|
|
10
|
+
export type { I18nProviderProps, Locale } from 'react-aria/I18nProvider';
|
|
11
|
+
export type { DateFormatterOptions } from 'react-aria/useDateFormatter';
|
|
12
|
+
export type { Filter } from 'react-aria/useFilter';
|
|
13
|
+
export type { LocalizedStringFormatter } from '@internationalized/string';
|
|
14
|
+
export type { LocalizedStrings } from '@internationalized/message';
|
|
15
|
+
export type { DateFormatter } from '@internationalized/date';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PackageLocalizationProvider, getPackageLocalizationScript } from 'react-aria/private/i18n/server';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { LocalizedStrings } from '@internationalized/message';
|
|
2
|
+
export type FormatMessage = (key: string, variables?: {
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
}) => string;
|
|
5
|
+
/**
|
|
6
|
+
* Handles formatting ICU Message strings to create localized strings for the current locale.
|
|
7
|
+
* Automatically updates when the locale changes, and handles caching of messages for performance.
|
|
8
|
+
* @param strings - A mapping of languages to strings by key.
|
|
9
|
+
* @deprecated - use useLocalizedStringFormatter instead.
|
|
10
|
+
*/
|
|
11
|
+
export declare function useMessageFormatter(strings: LocalizedStrings): FormatMessage;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/i18n",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.13.0",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -8,34 +8,31 @@
|
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
10
|
"source": "./src/index.ts",
|
|
11
|
-
"types":
|
|
12
|
-
"./dist/types.d.ts",
|
|
13
|
-
"./src/index.ts"
|
|
14
|
-
],
|
|
11
|
+
"types": "./dist/types/src/index.d.ts",
|
|
15
12
|
"import": "./dist/import.mjs",
|
|
16
13
|
"require": "./dist/main.js"
|
|
17
14
|
},
|
|
18
15
|
"./server": {
|
|
19
|
-
"source": "./src/server.
|
|
16
|
+
"source": "./src/server.ts",
|
|
20
17
|
"import": "./server/index.mjs",
|
|
21
18
|
"require": "./server/index.js"
|
|
22
|
-
}
|
|
19
|
+
},
|
|
20
|
+
"./package.json": "./package.json"
|
|
23
21
|
},
|
|
24
22
|
"server-module": "server/index.mjs",
|
|
25
23
|
"server-main": "server/index.js",
|
|
26
|
-
"types": "dist/types.d.ts",
|
|
24
|
+
"types": "dist/types/src/index.d.ts",
|
|
27
25
|
"source": "src/index.ts",
|
|
28
26
|
"targets": {
|
|
29
|
-
"
|
|
30
|
-
"module": {},
|
|
27
|
+
"types": false,
|
|
31
28
|
"server-module": {
|
|
32
|
-
"source": "src/server.
|
|
29
|
+
"source": "src/server.ts",
|
|
33
30
|
"outputFormat": "esmodule",
|
|
34
31
|
"isLibrary": true,
|
|
35
32
|
"includeNodeModules": false
|
|
36
33
|
},
|
|
37
34
|
"server-main": {
|
|
38
|
-
"source": "src/server.
|
|
35
|
+
"source": "src/server.ts",
|
|
39
36
|
"outputFormat": "commonjs",
|
|
40
37
|
"isLibrary": true,
|
|
41
38
|
"includeNodeModules": false
|
|
@@ -52,14 +49,11 @@
|
|
|
52
49
|
"url": "https://github.com/adobe/react-spectrum"
|
|
53
50
|
},
|
|
54
51
|
"dependencies": {
|
|
55
|
-
"@internationalized/date": "^3.12.
|
|
56
|
-
"@internationalized/message": "^3.1.
|
|
57
|
-
"@internationalized/
|
|
58
|
-
"@
|
|
59
|
-
"
|
|
60
|
-
"@react-aria/utils": "^3.33.1",
|
|
61
|
-
"@react-types/shared": "^3.33.1",
|
|
62
|
-
"@swc/helpers": "^0.5.0"
|
|
52
|
+
"@internationalized/date": "^3.12.1",
|
|
53
|
+
"@internationalized/message": "^3.1.9",
|
|
54
|
+
"@internationalized/string": "^3.2.8",
|
|
55
|
+
"@swc/helpers": "^0.5.0",
|
|
56
|
+
"react-aria": "3.48.0"
|
|
63
57
|
},
|
|
64
58
|
"peerDependencies": {
|
|
65
59
|
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
|
|
@@ -68,5 +62,5 @@
|
|
|
68
62
|
"publishConfig": {
|
|
69
63
|
"access": "public"
|
|
70
64
|
},
|
|
71
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "a6999bdf494a2e9c0381a5881908328bdd22ddae"
|
|
72
66
|
}
|
package/server/index.js
CHANGED
|
@@ -1,81 +1,13 @@
|
|
|
1
|
-
var $
|
|
1
|
+
var $3bMwm$reactariaprivatei18nserver = require("react-aria/private/i18n/server");
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
function $parcel$interopDefault(a) {
|
|
5
|
-
return a && a.__esModule ? a.default : a;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
4
|
function $parcel$export(e, n, v, s) {
|
|
9
5
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
10
6
|
}
|
|
11
7
|
|
|
12
|
-
$parcel$export(module.exports, "PackageLocalizationProvider", ()
|
|
13
|
-
$parcel$export(module.exports, "getPackageLocalizationScript", ()
|
|
14
|
-
|
|
15
|
-
* Copyright 2023 Adobe. All rights reserved.
|
|
16
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
17
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
18
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
19
|
-
*
|
|
20
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
21
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
22
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
23
|
-
* governing permissions and limitations under the License.
|
|
24
|
-
*/
|
|
25
|
-
function $417d44b6975b2ee7$export$9ec1fc026a5460ba(props) {
|
|
26
|
-
if (typeof document !== 'undefined') {
|
|
27
|
-
console.log('PackageLocalizationProvider should only be rendered on the server.');
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
let { nonce: nonce, locale: locale, strings: strings } = props;
|
|
31
|
-
// suppressHydrationWarning is necessary because the browser
|
|
32
|
-
// remove the nonce parameter from the DOM before hydration
|
|
33
|
-
return /*#__PURE__*/ (0, ($parcel$interopDefault($kg1kr$react))).createElement("script", {
|
|
34
|
-
nonce: typeof window === 'undefined' ? nonce : '',
|
|
35
|
-
suppressHydrationWarning: true,
|
|
36
|
-
dangerouslySetInnerHTML: {
|
|
37
|
-
__html: $417d44b6975b2ee7$export$fe9518edbbdc73da(locale, strings)
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
function $417d44b6975b2ee7$export$fe9518edbbdc73da(locale, strings) {
|
|
42
|
-
return `window[Symbol.for('react-aria.i18n.locale')]=${JSON.stringify(locale)};{${$417d44b6975b2ee7$var$serialize(strings)}}`;
|
|
43
|
-
}
|
|
44
|
-
const $417d44b6975b2ee7$var$cache = new WeakMap();
|
|
45
|
-
function $417d44b6975b2ee7$var$serialize(strings) {
|
|
46
|
-
let cached = $417d44b6975b2ee7$var$cache.get(strings);
|
|
47
|
-
if (cached) return cached;
|
|
48
|
-
// Find common strings between packages and hoist them into variables.
|
|
49
|
-
let seen = new Set();
|
|
50
|
-
let common = new Map();
|
|
51
|
-
for(let pkg in strings)for(let key in strings[pkg]){
|
|
52
|
-
let v = strings[pkg][key];
|
|
53
|
-
let s = typeof v === 'string' ? JSON.stringify(v) : v.toString();
|
|
54
|
-
if (seen.has(s) && !common.has(s)) {
|
|
55
|
-
let name = String.fromCharCode(common.size > 25 ? common.size + 97 : common.size + 65);
|
|
56
|
-
common.set(s, name);
|
|
57
|
-
}
|
|
58
|
-
seen.add(s);
|
|
59
|
-
}
|
|
60
|
-
let res = '';
|
|
61
|
-
if (common.size > 0) res += 'let ';
|
|
62
|
-
for (let [string, name] of common)res += `${name}=${string},`;
|
|
63
|
-
if (common.size > 0) res = res.slice(0, -1) + ';';
|
|
64
|
-
res += "window[Symbol.for('react-aria.i18n.strings')]={";
|
|
65
|
-
for(let pkg in strings){
|
|
66
|
-
res += `'${pkg}':{`;
|
|
67
|
-
for(let key in strings[pkg]){
|
|
68
|
-
let v = strings[pkg][key];
|
|
69
|
-
let s = typeof v === 'string' ? JSON.stringify(v) : v.toString();
|
|
70
|
-
if (common.has(s)) s = common.get(s);
|
|
71
|
-
res += `${/[ ()]/.test(key) ? JSON.stringify(key) : key}:${s},`;
|
|
72
|
-
}
|
|
73
|
-
res = res.slice(0, -1) + '},';
|
|
74
|
-
}
|
|
75
|
-
res = res.slice(0, -1) + '};';
|
|
76
|
-
$417d44b6975b2ee7$var$cache.set(strings, res);
|
|
77
|
-
return res;
|
|
78
|
-
}
|
|
8
|
+
$parcel$export(module.exports, "PackageLocalizationProvider", function () { return $3bMwm$reactariaprivatei18nserver.PackageLocalizationProvider; });
|
|
9
|
+
$parcel$export(module.exports, "getPackageLocalizationScript", function () { return $3bMwm$reactariaprivatei18nserver.getPackageLocalizationScript; });
|
|
10
|
+
|
|
79
11
|
|
|
80
12
|
|
|
81
13
|
//# sourceMappingURL=index.js.map
|
package/server/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":"","sources":["packages/@react-aria/i18n/src/server.ts"],"sourcesContent":["export {PackageLocalizationProvider, getPackageLocalizationScript} from 'react-aria/private/i18n/server';\n"],"names":[],"version":3,"file":"index.js.map"}
|
package/server/index.mjs
CHANGED
|
@@ -1,71 +1,7 @@
|
|
|
1
|
-
import $
|
|
1
|
+
import {PackageLocalizationProvider as $bbeb5d05325e5e0f$re_export$PackageLocalizationProvider, getPackageLocalizationScript as $bbeb5d05325e5e0f$re_export$getPackageLocalizationScript} from "react-aria/private/i18n/server";
|
|
2
2
|
|
|
3
|
-
/*
|
|
4
|
-
* Copyright 2023 Adobe. All rights reserved.
|
|
5
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
7
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
*
|
|
9
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
10
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
11
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
12
|
-
* governing permissions and limitations under the License.
|
|
13
|
-
*/
|
|
14
|
-
function $f4fda66de26cefb3$export$9ec1fc026a5460ba(props) {
|
|
15
|
-
if (typeof document !== 'undefined') {
|
|
16
|
-
console.log('PackageLocalizationProvider should only be rendered on the server.');
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
let { nonce: nonce, locale: locale, strings: strings } = props;
|
|
20
|
-
// suppressHydrationWarning is necessary because the browser
|
|
21
|
-
// remove the nonce parameter from the DOM before hydration
|
|
22
|
-
return /*#__PURE__*/ (0, $7cMCw$react).createElement("script", {
|
|
23
|
-
nonce: typeof window === 'undefined' ? nonce : '',
|
|
24
|
-
suppressHydrationWarning: true,
|
|
25
|
-
dangerouslySetInnerHTML: {
|
|
26
|
-
__html: $f4fda66de26cefb3$export$fe9518edbbdc73da(locale, strings)
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
function $f4fda66de26cefb3$export$fe9518edbbdc73da(locale, strings) {
|
|
31
|
-
return `window[Symbol.for('react-aria.i18n.locale')]=${JSON.stringify(locale)};{${$f4fda66de26cefb3$var$serialize(strings)}}`;
|
|
32
|
-
}
|
|
33
|
-
const $f4fda66de26cefb3$var$cache = new WeakMap();
|
|
34
|
-
function $f4fda66de26cefb3$var$serialize(strings) {
|
|
35
|
-
let cached = $f4fda66de26cefb3$var$cache.get(strings);
|
|
36
|
-
if (cached) return cached;
|
|
37
|
-
// Find common strings between packages and hoist them into variables.
|
|
38
|
-
let seen = new Set();
|
|
39
|
-
let common = new Map();
|
|
40
|
-
for(let pkg in strings)for(let key in strings[pkg]){
|
|
41
|
-
let v = strings[pkg][key];
|
|
42
|
-
let s = typeof v === 'string' ? JSON.stringify(v) : v.toString();
|
|
43
|
-
if (seen.has(s) && !common.has(s)) {
|
|
44
|
-
let name = String.fromCharCode(common.size > 25 ? common.size + 97 : common.size + 65);
|
|
45
|
-
common.set(s, name);
|
|
46
|
-
}
|
|
47
|
-
seen.add(s);
|
|
48
|
-
}
|
|
49
|
-
let res = '';
|
|
50
|
-
if (common.size > 0) res += 'let ';
|
|
51
|
-
for (let [string, name] of common)res += `${name}=${string},`;
|
|
52
|
-
if (common.size > 0) res = res.slice(0, -1) + ';';
|
|
53
|
-
res += "window[Symbol.for('react-aria.i18n.strings')]={";
|
|
54
|
-
for(let pkg in strings){
|
|
55
|
-
res += `'${pkg}':{`;
|
|
56
|
-
for(let key in strings[pkg]){
|
|
57
|
-
let v = strings[pkg][key];
|
|
58
|
-
let s = typeof v === 'string' ? JSON.stringify(v) : v.toString();
|
|
59
|
-
if (common.has(s)) s = common.get(s);
|
|
60
|
-
res += `${/[ ()]/.test(key) ? JSON.stringify(key) : key}:${s},`;
|
|
61
|
-
}
|
|
62
|
-
res = res.slice(0, -1) + '},';
|
|
63
|
-
}
|
|
64
|
-
res = res.slice(0, -1) + '};';
|
|
65
|
-
$f4fda66de26cefb3$var$cache.set(strings, res);
|
|
66
|
-
return res;
|
|
67
|
-
}
|
|
68
3
|
|
|
69
4
|
|
|
70
|
-
|
|
5
|
+
|
|
6
|
+
export {$bbeb5d05325e5e0f$re_export$PackageLocalizationProvider as PackageLocalizationProvider, $bbeb5d05325e5e0f$re_export$getPackageLocalizationScript as getPackageLocalizationScript};
|
|
71
7
|
//# sourceMappingURL=index.mjs.map
|
package/server/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":"","sources":["packages/@react-aria/i18n/src/server.ts"],"sourcesContent":["export {PackageLocalizationProvider, getPackageLocalizationScript} from 'react-aria/private/i18n/server';\n"],"names":[],"version":3,"file":"index.mjs.map"}
|