@khanacademy/math-input 22.2.0 → 22.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/index.js +3 -36
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +3 -35
- package/dist/index.js.map +1 -1
- package/dist/utils.d.ts +0 -8
- package/package.json +13 -13
package/dist/index.js
CHANGED
|
@@ -45,7 +45,7 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
|
45
45
|
|
|
46
46
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
47
47
|
const libName = "@khanacademy/math-input";
|
|
48
|
-
const libVersion = "22.2.
|
|
48
|
+
const libVersion = "22.2.2";
|
|
49
49
|
perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
50
50
|
|
|
51
51
|
function _extends() {
|
|
@@ -450,38 +450,6 @@ let CursorContext = /*#__PURE__*/function (CursorContext) {
|
|
|
450
450
|
return CursorContext;
|
|
451
451
|
}({});
|
|
452
452
|
|
|
453
|
-
const DecimalSeparator = {
|
|
454
|
-
COMMA: ",",
|
|
455
|
-
PERIOD: "."
|
|
456
|
-
};
|
|
457
|
-
|
|
458
|
-
/**
|
|
459
|
-
* Get the character used for separating decimals.
|
|
460
|
-
*/
|
|
461
|
-
const getDecimalSeparator = locale => {
|
|
462
|
-
let separator = DecimalSeparator.PERIOD;
|
|
463
|
-
switch (locale) {
|
|
464
|
-
// TODO(somewhatabstract): Remove this when Chrome supports the `ka`
|
|
465
|
-
// locale properly.
|
|
466
|
-
// https://github.com/formatjs/formatjs/issues/1526#issuecomment-559891201
|
|
467
|
-
//
|
|
468
|
-
// Supported locales in Chrome:
|
|
469
|
-
// https://source.chromium.org/chromium/chromium/src/+/master:third_party/icu/scripts/chrome_ui_languages.list
|
|
470
|
-
case "ka":
|
|
471
|
-
separator = ",";
|
|
472
|
-
break;
|
|
473
|
-
default:
|
|
474
|
-
const numberWithDecimalSeparator = 1.1;
|
|
475
|
-
// TODO(FEI-3647): Update to use .formatToParts() once we no longer have to
|
|
476
|
-
// support Safari 12.
|
|
477
|
-
const match = new Intl.NumberFormat(locale).format(numberWithDecimalSeparator)
|
|
478
|
-
// 0x661 is ARABIC-INDIC DIGIT ONE
|
|
479
|
-
// 0x6F1 is EXTENDED ARABIC-INDIC DIGIT ONE
|
|
480
|
-
.match(/[^\d\u0661\u06F1]/);
|
|
481
|
-
separator = match?.[0] ?? ".";
|
|
482
|
-
}
|
|
483
|
-
return separator === "," ? DecimalSeparator.COMMA : DecimalSeparator.PERIOD;
|
|
484
|
-
};
|
|
485
453
|
const CDOT_ONLY = ["az", "cs", "da", "de", "hu", "hy", "kk", "ky", "lt", "lv", "nb", "sk", "sr", "sv", "uz"];
|
|
486
454
|
const TIMES_ONLY = ["fr", "tr", "pt-pt"];
|
|
487
455
|
|
|
@@ -1245,7 +1213,7 @@ const getKeyTranslator = (locale, strings) => ({
|
|
|
1245
1213
|
SIN: buildTranslatableFunctionCallback(strings.sin, ["sin", "sen"], "sin"),
|
|
1246
1214
|
TAN: buildTranslatableFunctionCallback(strings.tan, ["tan", "tg"], "tan"),
|
|
1247
1215
|
CDOT: buildGenericCallback("\\cdot"),
|
|
1248
|
-
DECIMAL: buildGenericCallback(getDecimalSeparator(locale)),
|
|
1216
|
+
DECIMAL: buildGenericCallback(perseusCore.getDecimalSeparator(locale)),
|
|
1249
1217
|
DIVIDE: buildGenericCallback("\\div"),
|
|
1250
1218
|
EQUAL: buildGenericCallback("="),
|
|
1251
1219
|
GEQ: buildGenericCallback("\\geq"),
|
|
@@ -3500,7 +3468,7 @@ function ButtonAsset(_ref) {
|
|
|
3500
3468
|
case "PERIOD":
|
|
3501
3469
|
// Different locales use different symbols for the decimal separator
|
|
3502
3470
|
// (, vs .)
|
|
3503
|
-
if (id === "DECIMAL" && getDecimalSeparator(locale)
|
|
3471
|
+
if (id === "DECIMAL" && perseusCore.getDecimalSeparator(locale) !== ".") {
|
|
3504
3472
|
// comma decimal separator
|
|
3505
3473
|
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
3506
3474
|
width: "40",
|