@terraware/web-components 4.3.3-rc.2 → 5.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@terraware/web-components",
3
- "version": "4.3.3-rc.2",
3
+ "version": "5.0.0",
4
4
  "author": "Terraformation Inc.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -1 +1 @@
1
- {"version":3,"file":"locales.d.ts","sourceRoot":"","sources":["../../src/strings/locales.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,8EAA8E;AAC9E,eAAO,MAAM,gBAAgB,EAAE,aAAa,EAK3C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,8BAA4B,KAAG,aAAa,EACsB,CAAC;AAEvG;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iBAAiB,GAAI,SAAS,aAAa,EAAE,EAAE,QAAQ,MAAM,KAAG,aAK1E,CAAC"}
1
+ {"version":3,"file":"locales.d.ts","sourceRoot":"","sources":["../../src/strings/locales.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,8EAA8E;AAC9E,eAAO,MAAM,gBAAgB,EAAE,aAAa,EAK3C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,8BAA4B,KAAG,aAAa,EACsB,CAAC;AAEvG;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iBAAiB,GAAI,SAAS,aAAa,EAAE,EAAE,QAAQ,MAAM,KAAG,aAQ1E,CAAC"}
@@ -33,6 +33,10 @@ const getSupportedLocales = (includeInDevelopment = false) => includeInDevelopme
33
33
  * If none of the locales in the list matches, returns the first locale from the list. The list
34
34
  * must not be empty.
35
35
  */
36
- const findLocaleDetails = (locales, locale) => locales.reduce((bestMatch, candidate) => locale.startsWith(candidate.id) && (!bestMatch.id.startsWith(locale) || candidate.id.length > bestMatch.id.length) ? candidate : bestMatch);
36
+ const findLocaleDetails = (locales, locale) => locales.reduce((bestMatch, candidate) =>
37
+ // The best match so far is only worth keeping if it's a prefix of the requested locale too.
38
+ // reduce() seeds with the first locale without checking it, so a leading 'en-US' would
39
+ // otherwise be treated as a match for 'en' and never replaced.
40
+ locale.startsWith(candidate.id) && (!locale.startsWith(bestMatch.id) || candidate.id.length > bestMatch.id.length) ? candidate : bestMatch);
37
41
 
38
42
  export { findLocaleDetails, getSupportedLocales, supportedLocales };