@khanacademy/perseus 19.2.1 → 19.3.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/es/index.js +24 -23
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +19 -23
- package/dist/index.js.map +1 -1
- package/dist/perseus-api.d.ts +3 -1
- package/dist/server-item-renderer.d.ts +3 -1
- package/dist/types.d.ts +3 -1
- package/dist/widgets/expression.d.ts +18 -6
- package/dist/widgets/label-image.d.ts +16 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1929,11 +1929,22 @@ const KhanAnswerTypes = {
|
|
|
1929
1929
|
|
|
1930
1930
|
const ERROR_TITLE = i18n__namespace._("Oops!");
|
|
1931
1931
|
const ERROR_MESSAGE = i18n__namespace._("Sorry, I don't understand that!");
|
|
1932
|
+
|
|
1933
|
+
// Map of international operator names to their English equivalents
|
|
1934
|
+
const englishOperators = {
|
|
1935
|
+
arctg: "arctan",
|
|
1936
|
+
cosec: "csc",
|
|
1937
|
+
cossec: "csc",
|
|
1938
|
+
cotg: "cot",
|
|
1939
|
+
ctg: "cot",
|
|
1940
|
+
sen: "sin",
|
|
1941
|
+
tg: "tan"
|
|
1942
|
+
};
|
|
1932
1943
|
const anglicizeOperators = tex => {
|
|
1933
1944
|
// sen is used instead of sin in some languages, e.g. Portuguese.
|
|
1934
1945
|
// To ensure that answers in various languages are graded correctly, we
|
|
1935
1946
|
// convert operators to their Englishy forms.
|
|
1936
|
-
return tex.replace(/\\operatorname{
|
|
1947
|
+
return tex.replace(/\\operatorname{([a-z]+)}/g, (_, op) => `\\${englishOperators[op] ?? op} `);
|
|
1937
1948
|
};
|
|
1938
1949
|
const normalizeTex = tex => {
|
|
1939
1950
|
return anglicizeOperators(tex);
|
|
@@ -21682,15 +21693,6 @@ class InputNumber extends React__namespace.Component {
|
|
|
21682
21693
|
};
|
|
21683
21694
|
_handleFocus = () => {
|
|
21684
21695
|
this.props.onFocus([]);
|
|
21685
|
-
// HACK(kevinb): We want to dismiss the feedback popover that webapp
|
|
21686
|
-
// displays as soon as a user clicks in in the input field so we call
|
|
21687
|
-
// interactionCallback directly.
|
|
21688
|
-
const {
|
|
21689
|
-
interactionCallback
|
|
21690
|
-
} = this.props.apiOptions;
|
|
21691
|
-
if (interactionCallback) {
|
|
21692
|
-
interactionCallback();
|
|
21693
|
-
}
|
|
21694
21696
|
};
|
|
21695
21697
|
_handleBlur = () => {
|
|
21696
21698
|
this.props.onBlur([]);
|
|
@@ -22094,15 +22096,6 @@ class NumericInput extends React__namespace.Component {
|
|
|
22094
22096
|
};
|
|
22095
22097
|
_handleFocus = () => {
|
|
22096
22098
|
this.props.onFocus([]);
|
|
22097
|
-
// HACK(kevinb): We want to dismiss the feedback popover that webapp
|
|
22098
|
-
// displays as soon as a user clicks in in the input field so we call
|
|
22099
|
-
// interactionCallback directly.
|
|
22100
|
-
const {
|
|
22101
|
-
interactionCallback
|
|
22102
|
-
} = this.props.apiOptions;
|
|
22103
|
-
if (interactionCallback) {
|
|
22104
|
-
interactionCallback();
|
|
22105
|
-
}
|
|
22106
22099
|
};
|
|
22107
22100
|
_handleBlur = () => {
|
|
22108
22101
|
this.props.onBlur([]);
|
|
@@ -41697,7 +41690,7 @@ const init = function (options) {
|
|
|
41697
41690
|
|
|
41698
41691
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
41699
41692
|
const libName = "@khanacademy/perseus";
|
|
41700
|
-
const libVersion = "19.
|
|
41693
|
+
const libVersion = "19.3.0";
|
|
41701
41694
|
perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
41702
41695
|
|
|
41703
41696
|
const apiVersion = {
|
|
@@ -42290,6 +42283,9 @@ class ServerItemRenderer extends React__namespace.Component {
|
|
|
42290
42283
|
_handleFocusChange = (newFocus, oldFocus) => {
|
|
42291
42284
|
if (newFocus != null) {
|
|
42292
42285
|
this._setCurrentFocus(newFocus);
|
|
42286
|
+
|
|
42287
|
+
// Call the interactionCallback, if it exists, with the current user input data
|
|
42288
|
+
this.props.apiOptions?.interactionCallback?.(this.questionRenderer.getUserInputForWidgets());
|
|
42293
42289
|
} else {
|
|
42294
42290
|
this._onRendererBlur(oldFocus);
|
|
42295
42291
|
}
|
|
@@ -42397,9 +42393,9 @@ class ServerItemRenderer extends React__namespace.Component {
|
|
|
42397
42393
|
questionCompleted: false,
|
|
42398
42394
|
questionHighlightedWidgets: withRemoved
|
|
42399
42395
|
});
|
|
42400
|
-
|
|
42401
|
-
|
|
42402
|
-
|
|
42396
|
+
|
|
42397
|
+
// Call the interactionCallback, if it exists, with the current user input data
|
|
42398
|
+
this.props.apiOptions?.interactionCallback?.(this.questionRenderer.getUserInputForWidgets());
|
|
42403
42399
|
};
|
|
42404
42400
|
focus() {
|
|
42405
42401
|
return this.questionRenderer.focus();
|