@react-aria/i18n
Advanced tools
Comparing version 3.0.0-nightly.2912 to 3.0.0-nightly.2917
@@ -37,3 +37,3 @@ var $4d65847630a056a8$exports = require("./utils.main.js"); | ||
locale: locale, | ||
direction: (0, $4d65847630a056a8$exports.isRTL)(locale) ? "rtl" : "ltr" | ||
direction: (0, $4d65847630a056a8$exports.isRTL)(locale) ? 'rtl' : 'ltr' | ||
}; | ||
@@ -40,0 +40,0 @@ }, [ |
@@ -26,3 +26,3 @@ import {isRTL as $148a7a147e38ea7f$export$702d680b21cbd764} from "./utils.module.js"; | ||
locale: locale, | ||
direction: (0, $148a7a147e38ea7f$export$702d680b21cbd764)(locale) ? "rtl" : "ltr" | ||
direction: (0, $148a7a147e38ea7f$export$702d680b21cbd764)(locale) ? 'rtl' : 'ltr' | ||
}; | ||
@@ -29,0 +29,0 @@ }, [ |
@@ -23,3 +23,3 @@ var $47fa5ec5ff482271$exports = require("./context.main.js"); | ||
let { locale: locale } = (0, $47fa5ec5ff482271$exports.useLocale)(); | ||
let cacheKey = locale + (options ? Object.entries(options).sort((a, b)=>a[0] < b[0] ? -1 : 1).join() : ""); | ||
let cacheKey = locale + (options ? Object.entries(options).sort((a, b)=>a[0] < b[0] ? -1 : 1).join() : ''); | ||
if ($27a5ce66022270ad$var$cache.has(cacheKey)) return $27a5ce66022270ad$var$cache.get(cacheKey); | ||
@@ -26,0 +26,0 @@ let formatter = new Intl.Collator(locale, options); |
@@ -17,3 +17,3 @@ import {useLocale as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7} from "./context.module.js"; | ||
let { locale: locale } = (0, $18f2051aff69b9bf$export$43bb16f9c6d9e3f7)(); | ||
let cacheKey = locale + (options ? Object.entries(options).sort((a, b)=>a[0] < b[0] ? -1 : 1).join() : ""); | ||
let cacheKey = locale + (options ? Object.entries(options).sort((a, b)=>a[0] < b[0] ? -1 : 1).join() : ''); | ||
if ($325a3faab7a68acd$var$cache.has(cacheKey)) return $325a3faab7a68acd$var$cache.get(cacheKey); | ||
@@ -20,0 +20,0 @@ let formatter = new Intl.Collator(locale, options); |
@@ -25,5 +25,5 @@ var $4d65847630a056a8$exports = require("./utils.main.js"); | ||
// Locale passed from server by PackageLocalizationProvider. | ||
const $2919bdec75484e64$var$localeSymbol = Symbol.for("react-aria.i18n.locale"); | ||
const $2919bdec75484e64$var$localeSymbol = Symbol.for('react-aria.i18n.locale'); | ||
function $2919bdec75484e64$export$f09106e7c6677ec5() { | ||
let locale = typeof window !== "undefined" && window[$2919bdec75484e64$var$localeSymbol] || typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US"; | ||
let locale = typeof window !== 'undefined' && window[$2919bdec75484e64$var$localeSymbol] || typeof navigator !== 'undefined' && (navigator.language || navigator.userLanguage) || 'en-US'; | ||
try { | ||
@@ -35,7 +35,7 @@ // @ts-ignore | ||
} catch (_err) { | ||
locale = "en-US"; | ||
locale = 'en-US'; | ||
} | ||
return { | ||
locale: locale, | ||
direction: (0, $4d65847630a056a8$exports.isRTL)(locale) ? "rtl" : "ltr" | ||
direction: (0, $4d65847630a056a8$exports.isRTL)(locale) ? 'rtl' : 'ltr' | ||
}; | ||
@@ -53,7 +53,7 @@ } | ||
(0, $5Ie0C$react.useEffect)(()=>{ | ||
if ($2919bdec75484e64$var$listeners.size === 0) window.addEventListener("languagechange", $2919bdec75484e64$var$updateLocale); | ||
if ($2919bdec75484e64$var$listeners.size === 0) window.addEventListener('languagechange', $2919bdec75484e64$var$updateLocale); | ||
$2919bdec75484e64$var$listeners.add(setDefaultLocale); | ||
return ()=>{ | ||
$2919bdec75484e64$var$listeners.delete(setDefaultLocale); | ||
if ($2919bdec75484e64$var$listeners.size === 0) window.removeEventListener("languagechange", $2919bdec75484e64$var$updateLocale); | ||
if ($2919bdec75484e64$var$listeners.size === 0) window.removeEventListener('languagechange', $2919bdec75484e64$var$updateLocale); | ||
}; | ||
@@ -64,4 +64,4 @@ }, []); | ||
if (isSSR) return { | ||
locale: "en-US", | ||
direction: "ltr" | ||
locale: 'en-US', | ||
direction: 'ltr' | ||
}; | ||
@@ -68,0 +68,0 @@ return defaultLocale; |
@@ -19,5 +19,5 @@ import {isRTL as $148a7a147e38ea7f$export$702d680b21cbd764} from "./utils.module.js"; | ||
// Locale passed from server by PackageLocalizationProvider. | ||
const $1e5a04cdaf7d1af8$var$localeSymbol = Symbol.for("react-aria.i18n.locale"); | ||
const $1e5a04cdaf7d1af8$var$localeSymbol = Symbol.for('react-aria.i18n.locale'); | ||
function $1e5a04cdaf7d1af8$export$f09106e7c6677ec5() { | ||
let locale = typeof window !== "undefined" && window[$1e5a04cdaf7d1af8$var$localeSymbol] || typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US"; | ||
let locale = typeof window !== 'undefined' && window[$1e5a04cdaf7d1af8$var$localeSymbol] || typeof navigator !== 'undefined' && (navigator.language || navigator.userLanguage) || 'en-US'; | ||
try { | ||
@@ -29,7 +29,7 @@ // @ts-ignore | ||
} catch (_err) { | ||
locale = "en-US"; | ||
locale = 'en-US'; | ||
} | ||
return { | ||
locale: locale, | ||
direction: (0, $148a7a147e38ea7f$export$702d680b21cbd764)(locale) ? "rtl" : "ltr" | ||
direction: (0, $148a7a147e38ea7f$export$702d680b21cbd764)(locale) ? 'rtl' : 'ltr' | ||
}; | ||
@@ -47,7 +47,7 @@ } | ||
(0, $ffhGL$useEffect)(()=>{ | ||
if ($1e5a04cdaf7d1af8$var$listeners.size === 0) window.addEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale); | ||
if ($1e5a04cdaf7d1af8$var$listeners.size === 0) window.addEventListener('languagechange', $1e5a04cdaf7d1af8$var$updateLocale); | ||
$1e5a04cdaf7d1af8$var$listeners.add(setDefaultLocale); | ||
return ()=>{ | ||
$1e5a04cdaf7d1af8$var$listeners.delete(setDefaultLocale); | ||
if ($1e5a04cdaf7d1af8$var$listeners.size === 0) window.removeEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale); | ||
if ($1e5a04cdaf7d1af8$var$listeners.size === 0) window.removeEventListener('languagechange', $1e5a04cdaf7d1af8$var$updateLocale); | ||
}; | ||
@@ -58,4 +58,4 @@ }, []); | ||
if (isSSR) return { | ||
locale: "en-US", | ||
direction: "ltr" | ||
locale: 'en-US', | ||
direction: 'ltr' | ||
}; | ||
@@ -62,0 +62,0 @@ return defaultLocale; |
@@ -24,3 +24,3 @@ var $27a5ce66022270ad$exports = require("./useCollator.main.js"); | ||
let collator = (0, $27a5ce66022270ad$exports.useCollator)({ | ||
usage: "search", | ||
usage: 'search', | ||
...options | ||
@@ -33,4 +33,4 @@ }); | ||
// TODO: take into account the ignorePunctuation option as well... | ||
string = string.normalize("NFC"); | ||
substring = substring.normalize("NFC"); | ||
string = string.normalize('NFC'); | ||
substring = substring.normalize('NFC'); | ||
return collator.compare(string.slice(0, substring.length), substring) === 0; | ||
@@ -42,4 +42,4 @@ }, [ | ||
if (substring.length === 0) return true; | ||
string = string.normalize("NFC"); | ||
substring = substring.normalize("NFC"); | ||
string = string.normalize('NFC'); | ||
substring = substring.normalize('NFC'); | ||
return collator.compare(string.slice(-substring.length), substring) === 0; | ||
@@ -51,4 +51,4 @@ }, [ | ||
if (substring.length === 0) return true; | ||
string = string.normalize("NFC"); | ||
substring = substring.normalize("NFC"); | ||
string = string.normalize('NFC'); | ||
substring = substring.normalize('NFC'); | ||
let scan = 0; | ||
@@ -55,0 +55,0 @@ let sliceLen = substring.length; |
@@ -18,3 +18,3 @@ import {useCollator as $325a3faab7a68acd$export$a16aca283550c30d} from "./useCollator.module.js"; | ||
let collator = (0, $325a3faab7a68acd$export$a16aca283550c30d)({ | ||
usage: "search", | ||
usage: 'search', | ||
...options | ||
@@ -27,4 +27,4 @@ }); | ||
// TODO: take into account the ignorePunctuation option as well... | ||
string = string.normalize("NFC"); | ||
substring = substring.normalize("NFC"); | ||
string = string.normalize('NFC'); | ||
substring = substring.normalize('NFC'); | ||
return collator.compare(string.slice(0, substring.length), substring) === 0; | ||
@@ -36,4 +36,4 @@ }, [ | ||
if (substring.length === 0) return true; | ||
string = string.normalize("NFC"); | ||
substring = substring.normalize("NFC"); | ||
string = string.normalize('NFC'); | ||
substring = substring.normalize('NFC'); | ||
return collator.compare(string.slice(-substring.length), substring) === 0; | ||
@@ -45,4 +45,4 @@ }, [ | ||
if (substring.length === 0) return true; | ||
string = string.normalize("NFC"); | ||
substring = substring.normalize("NFC"); | ||
string = string.normalize('NFC'); | ||
substring = substring.normalize('NFC'); | ||
let scan = 0; | ||
@@ -49,0 +49,0 @@ let sliceLen = substring.length; |
@@ -19,33 +19,33 @@ | ||
const $4d65847630a056a8$var$RTL_SCRIPTS = new Set([ | ||
"Arab", | ||
"Syrc", | ||
"Samr", | ||
"Mand", | ||
"Thaa", | ||
"Mend", | ||
"Nkoo", | ||
"Adlm", | ||
"Rohg", | ||
"Hebr" | ||
'Arab', | ||
'Syrc', | ||
'Samr', | ||
'Mand', | ||
'Thaa', | ||
'Mend', | ||
'Nkoo', | ||
'Adlm', | ||
'Rohg', | ||
'Hebr' | ||
]); | ||
const $4d65847630a056a8$var$RTL_LANGS = new Set([ | ||
"ae", | ||
"ar", | ||
"arc", | ||
"bcc", | ||
"bqi", | ||
"ckb", | ||
"dv", | ||
"fa", | ||
"glk", | ||
"he", | ||
"ku", | ||
"mzn", | ||
"nqo", | ||
"pnb", | ||
"ps", | ||
"sd", | ||
"ug", | ||
"ur", | ||
"yi" | ||
'ae', | ||
'ar', | ||
'arc', | ||
'bcc', | ||
'bqi', | ||
'ckb', | ||
'dv', | ||
'fa', | ||
'glk', | ||
'he', | ||
'ku', | ||
'mzn', | ||
'nqo', | ||
'pnb', | ||
'ps', | ||
'sd', | ||
'ug', | ||
'ur', | ||
'yi' | ||
]); | ||
@@ -60,4 +60,4 @@ function $4d65847630a056a8$export$702d680b21cbd764(localeString) { | ||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTextInfo | ||
let textInfo = typeof locale.getTextInfo === "function" ? locale.getTextInfo() : locale.textInfo; | ||
if (textInfo) return textInfo.direction === "rtl"; | ||
let textInfo = typeof locale.getTextInfo === 'function' ? locale.getTextInfo() : locale.textInfo; | ||
if (textInfo) return textInfo.direction === 'rtl'; | ||
// Fallback: guess using the script. | ||
@@ -68,3 +68,3 @@ // This is more accurate than guessing by language, since languages can be written in multiple scripts. | ||
// If not, just guess by the language (first part of the locale) | ||
let lang = localeString.split("-")[0]; | ||
let lang = localeString.split('-')[0]; | ||
return $4d65847630a056a8$var$RTL_LANGS.has(lang); | ||
@@ -71,0 +71,0 @@ } |
@@ -13,33 +13,33 @@ /* | ||
const $148a7a147e38ea7f$var$RTL_SCRIPTS = new Set([ | ||
"Arab", | ||
"Syrc", | ||
"Samr", | ||
"Mand", | ||
"Thaa", | ||
"Mend", | ||
"Nkoo", | ||
"Adlm", | ||
"Rohg", | ||
"Hebr" | ||
'Arab', | ||
'Syrc', | ||
'Samr', | ||
'Mand', | ||
'Thaa', | ||
'Mend', | ||
'Nkoo', | ||
'Adlm', | ||
'Rohg', | ||
'Hebr' | ||
]); | ||
const $148a7a147e38ea7f$var$RTL_LANGS = new Set([ | ||
"ae", | ||
"ar", | ||
"arc", | ||
"bcc", | ||
"bqi", | ||
"ckb", | ||
"dv", | ||
"fa", | ||
"glk", | ||
"he", | ||
"ku", | ||
"mzn", | ||
"nqo", | ||
"pnb", | ||
"ps", | ||
"sd", | ||
"ug", | ||
"ur", | ||
"yi" | ||
'ae', | ||
'ar', | ||
'arc', | ||
'bcc', | ||
'bqi', | ||
'ckb', | ||
'dv', | ||
'fa', | ||
'glk', | ||
'he', | ||
'ku', | ||
'mzn', | ||
'nqo', | ||
'pnb', | ||
'ps', | ||
'sd', | ||
'ug', | ||
'ur', | ||
'yi' | ||
]); | ||
@@ -54,4 +54,4 @@ function $148a7a147e38ea7f$export$702d680b21cbd764(localeString) { | ||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTextInfo | ||
let textInfo = typeof locale.getTextInfo === "function" ? locale.getTextInfo() : locale.textInfo; | ||
if (textInfo) return textInfo.direction === "rtl"; | ||
let textInfo = typeof locale.getTextInfo === 'function' ? locale.getTextInfo() : locale.textInfo; | ||
if (textInfo) return textInfo.direction === 'rtl'; | ||
// Fallback: guess using the script. | ||
@@ -62,3 +62,3 @@ // This is more accurate than guessing by language, since languages can be written in multiple scripts. | ||
// If not, just guess by the language (first part of the locale) | ||
let lang = localeString.split("-")[0]; | ||
let lang = localeString.split('-')[0]; | ||
return $148a7a147e38ea7f$var$RTL_LANGS.has(lang); | ||
@@ -65,0 +65,0 @@ } |
{ | ||
"name": "@react-aria/i18n", | ||
"version": "3.0.0-nightly.2912+d80999e89", | ||
"version": "3.0.0-nightly.2917+c34886769", | ||
"description": "Spectrum UI components in React", | ||
@@ -50,9 +50,9 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@internationalized/date": "3.5.4-nightly.4624+d80999e89", | ||
"@internationalized/message": "3.1.4-nightly.4624+d80999e89", | ||
"@internationalized/number": "3.5.3-nightly.4624+d80999e89", | ||
"@internationalized/string": "3.2.3-nightly.4624+d80999e89", | ||
"@react-aria/ssr": "3.9.4-nightly.4624+d80999e89", | ||
"@react-aria/utils": "3.0.0-nightly.2912+d80999e89", | ||
"@react-types/shared": "3.0.0-nightly.2912+d80999e89", | ||
"@internationalized/date": "3.5.5-nightly.4629+c34886769", | ||
"@internationalized/message": "3.1.5-nightly.4629+c34886769", | ||
"@internationalized/number": "3.5.4-nightly.4629+c34886769", | ||
"@internationalized/string": "3.2.4-nightly.4629+c34886769", | ||
"@react-aria/ssr": "3.9.5-nightly.4629+c34886769", | ||
"@react-aria/utils": "3.0.0-nightly.2917+c34886769", | ||
"@react-types/shared": "3.0.0-nightly.2917+c34886769", | ||
"@swc/helpers": "^0.5.0" | ||
@@ -66,3 +66,3 @@ }, | ||
}, | ||
"gitHead": "d80999e897b4d4db9fcfb4e9b8fcdc9fdd700882" | ||
"gitHead": "c34886769d3e69bb56553a02eead6a0fd877e754" | ||
} |
@@ -26,4 +26,4 @@ var $kg1kr$react = require("react"); | ||
function $417d44b6975b2ee7$export$9ec1fc026a5460ba(props) { | ||
if (typeof document !== "undefined") { | ||
console.log("PackageLocalizationProvider should only be rendered on the server."); | ||
if (typeof document !== 'undefined') { | ||
console.log('PackageLocalizationProvider should only be rendered on the server.'); | ||
return null; | ||
@@ -50,3 +50,3 @@ } | ||
let v = strings[pkg][key]; | ||
let s = typeof v === "string" ? JSON.stringify(v) : v.toString(); | ||
let s = typeof v === 'string' ? JSON.stringify(v) : v.toString(); | ||
if (seen.has(s) && !common.has(s)) { | ||
@@ -58,6 +58,6 @@ let name = String.fromCharCode(common.size > 25 ? common.size + 97 : common.size + 65); | ||
} | ||
let res = ""; | ||
if (common.size > 0) res += "let "; | ||
let res = ''; | ||
if (common.size > 0) res += 'let '; | ||
for (let [string, name] of common)res += `${name}=${string},`; | ||
if (common.size > 0) res = res.slice(0, -1) + ";"; | ||
if (common.size > 0) res = res.slice(0, -1) + ';'; | ||
res += "window[Symbol.for('react-aria.i18n.strings')]={"; | ||
@@ -68,9 +68,9 @@ for(let pkg in strings){ | ||
let v = strings[pkg][key]; | ||
let s = typeof v === "string" ? JSON.stringify(v) : v.toString(); | ||
let s = typeof v === 'string' ? JSON.stringify(v) : v.toString(); | ||
if (common.has(s)) s = common.get(s); | ||
res += `${/[ ()]/.test(key) ? JSON.stringify(key) : key}:${s},`; | ||
} | ||
res = res.slice(0, -1) + "},"; | ||
res = res.slice(0, -1) + '},'; | ||
} | ||
res = res.slice(0, -1) + "};"; | ||
res = res.slice(0, -1) + '};'; | ||
$417d44b6975b2ee7$var$cache.set(strings, res); | ||
@@ -77,0 +77,0 @@ return res; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package