@khanacademy/math-input 17.2.0 → 17.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/components/input/mathquill-types.d.ts +1 -0
- package/dist/components/input/strings.d.ts +19 -0
- package/dist/es/index.js +50 -7
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +50 -7
- package/dist/index.js.map +1 -1
- package/dist/strings.js +14 -0
- package/package.json +2 -2
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const mathQuillStrings: {
|
|
2
|
+
mathInputBox: string;
|
|
3
|
+
ariaStaticStringsMap: {
|
|
4
|
+
before: (obj: string) => string;
|
|
5
|
+
after: (obj: string) => string;
|
|
6
|
+
"beginning of": (obj: string) => string;
|
|
7
|
+
"end of": (obj: string) => string;
|
|
8
|
+
Baseline: string;
|
|
9
|
+
Superscript: string;
|
|
10
|
+
selected: (obj: string) => string;
|
|
11
|
+
"no answer": string;
|
|
12
|
+
"nothing selected": string;
|
|
13
|
+
"nothing to the right": string;
|
|
14
|
+
"nothing to the left": string;
|
|
15
|
+
"block is empty": string;
|
|
16
|
+
"nothing above": string;
|
|
17
|
+
labelValue: (label: string, value: string) => string;
|
|
18
|
+
};
|
|
19
|
+
};
|
package/dist/es/index.js
CHANGED
|
@@ -17,7 +17,7 @@ import PropTypes from 'prop-types';
|
|
|
17
17
|
|
|
18
18
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
19
19
|
const libName = "@khanacademy/math-input";
|
|
20
|
-
const libVersion = "17.2.
|
|
20
|
+
const libVersion = "17.2.2";
|
|
21
21
|
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
22
22
|
|
|
23
23
|
function _extends() {
|
|
@@ -383,6 +383,39 @@ function convertDotToTimesByLocale(convertDotToTimes) {
|
|
|
383
383
|
const inJest = typeof process !== "undefined" && !!((_process = process) != null && (_process = _process.env) != null && _process.JEST_WORKER_ID);
|
|
384
384
|
// Explicitly checking for undefined because Cypress throws an error
|
|
385
385
|
|
|
386
|
+
const mathQuillStrings = {
|
|
387
|
+
mathInputBox: i18n._("Math input box"),
|
|
388
|
+
ariaStaticStringsMap: {
|
|
389
|
+
before: obj => i18n._("before %(obj)s", {
|
|
390
|
+
obj
|
|
391
|
+
}),
|
|
392
|
+
after: obj => i18n._("after %(obj)s", {
|
|
393
|
+
obj
|
|
394
|
+
}),
|
|
395
|
+
"beginning of": obj => i18n._("beginning of %(obj)s", {
|
|
396
|
+
obj
|
|
397
|
+
}),
|
|
398
|
+
"end of": obj => i18n._("end of %(obj)s", {
|
|
399
|
+
obj
|
|
400
|
+
}),
|
|
401
|
+
Baseline: i18n._("Baseline"),
|
|
402
|
+
Superscript: i18n._("Superscript"),
|
|
403
|
+
selected: obj => i18n._("%(obj)s selected", {
|
|
404
|
+
obj
|
|
405
|
+
}),
|
|
406
|
+
"no answer": i18n._("no answer"),
|
|
407
|
+
"nothing selected": i18n._("nothing selected"),
|
|
408
|
+
"nothing to the right": i18n._("nothing to the right"),
|
|
409
|
+
"nothing to the left": i18n._("nothing to the left"),
|
|
410
|
+
"block is empty": i18n._("block is empty"),
|
|
411
|
+
"nothing above": i18n._("nothing above"),
|
|
412
|
+
labelValue: (label, value) => i18n._("%(label)s: %(value)s", {
|
|
413
|
+
label,
|
|
414
|
+
value
|
|
415
|
+
})
|
|
416
|
+
}
|
|
417
|
+
};
|
|
418
|
+
|
|
386
419
|
// We only need one MathQuill instance (referred to as MQ in the docs)
|
|
387
420
|
// and that contains some MQ constants and the MathField constructor
|
|
388
421
|
const mathQuillInstance = MathQuill.getInterface(3);
|
|
@@ -431,9 +464,7 @@ const createBaseConfig = () => ({
|
|
|
431
464
|
function createMathField(container, configCallback) {
|
|
432
465
|
const baseConfig = createBaseConfig();
|
|
433
466
|
const config = configCallback ? configCallback(baseConfig) : baseConfig;
|
|
434
|
-
const mathField = mathQuillInstance.MathField(container, config)
|
|
435
|
-
// translated in ./math-input.tsx
|
|
436
|
-
.setAriaLabel(i18n._("Math input box"));
|
|
467
|
+
const mathField = mathQuillInstance.MathField(container, config).setAriaLabel(mathQuillStrings.mathInputBox).setAriaStringsOverrideMap(mathQuillStrings.ariaStaticStringsMap);
|
|
437
468
|
|
|
438
469
|
// We should avoid running SpeechRuleEngine.setup() in Jest. It makes an
|
|
439
470
|
// HTTP request to fetch non-english speech rules, and cannot be easily
|
|
@@ -2176,7 +2207,7 @@ class MathInput extends React.Component {
|
|
|
2176
2207
|
// keyboard appear. It should only require one finger, which is how iOS works.
|
|
2177
2208
|
// TODO(diedra): Fix the bug that is causing Android to require a two finger tap
|
|
2178
2209
|
// to the open the keyboard, and then remove the second half of this label.
|
|
2179
|
-
const ariaLabel =
|
|
2210
|
+
const ariaLabel = mathQuillStrings.mathInputBox + " " + i18n._("Tap with one or two fingers to open keyboard");
|
|
2180
2211
|
return /*#__PURE__*/React.createElement(KeypadContext.Consumer, null, ({
|
|
2181
2212
|
keypadActive,
|
|
2182
2213
|
setKeypadActive
|
|
@@ -2352,10 +2383,22 @@ const IconAsset = function IconAsset({
|
|
|
2352
2383
|
fill: tintColor
|
|
2353
2384
|
}));
|
|
2354
2385
|
}
|
|
2386
|
+
case "Fractions":
|
|
2387
|
+
// The Fractions keypad is a special one that never displays anything
|
|
2388
|
+
// in the tabbar. Ideally, we'd separate the KeypadPageType from the
|
|
2389
|
+
// tab bar item types, but that's not easy given how the keypad manages
|
|
2390
|
+
// the selected page. For now, we'll just return a dummy SVG to satisfy
|
|
2391
|
+
// the types here.
|
|
2392
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
2393
|
+
width: "44",
|
|
2394
|
+
height: "44",
|
|
2395
|
+
viewBox: "0 0 44 44",
|
|
2396
|
+
fill: "none",
|
|
2397
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
2398
|
+
});
|
|
2355
2399
|
default:
|
|
2356
2400
|
{
|
|
2357
|
-
|
|
2358
|
-
throw new Error("Invalid icon type");
|
|
2401
|
+
throw new Error(`Invalid icon type: ${type}`);
|
|
2359
2402
|
}
|
|
2360
2403
|
}
|
|
2361
2404
|
};
|