@khanacademy/perseus 52.0.0 → 52.0.1
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 -223
- package/dist/es/index.js.map +1 -1
- package/dist/es/strings.js +21 -13
- package/dist/es/strings.js.map +1 -1
- package/dist/index.js +24 -223
- package/dist/index.js.map +1 -1
- package/dist/strings.d.ts +1 -1
- package/dist/strings.js +21 -13
- package/dist/strings.js.map +1 -1
- package/package.json +1 -1
package/dist/es/index.js
CHANGED
|
@@ -59,213 +59,6 @@ function _extends() {
|
|
|
59
59
|
* The translated strings that are used to render Perseus.
|
|
60
60
|
*/
|
|
61
61
|
|
|
62
|
-
/**
|
|
63
|
-
* Untranslated strings used in Perseus. To be used by an external
|
|
64
|
-
* translator to produce translated strings, passed in as `PerseusStrings`.
|
|
65
|
-
* !! Note: Ensure that all escape sequences are double-escaped. (e.g. `\\text` -> `\\\\text`)
|
|
66
|
-
*/
|
|
67
|
-
const strings = {
|
|
68
|
-
closeKeypad: "close math keypad",
|
|
69
|
-
openKeypad: "open math keypad",
|
|
70
|
-
mathInputBox: "Math input box",
|
|
71
|
-
removeHighlight: "Remove highlight",
|
|
72
|
-
addHighlight: "Add highlight",
|
|
73
|
-
hintPos: "Hint #%(pos)s",
|
|
74
|
-
errorRendering: "Error rendering: %(error)s",
|
|
75
|
-
APPROXIMATED_PI_ERROR: "Your answer is close, but you may " + "have approximated pi. Enter your " + "answer as a multiple of pi, like " + "12 pi or " + "2/3 pi",
|
|
76
|
-
EXTRA_SYMBOLS_ERROR: "We could not understand your " + "answer. Please check your answer for extra " + "text or symbols.",
|
|
77
|
-
NEEDS_TO_BE_SIMPLFIED_ERROR: "Your answer is almost correct, " + "but it needs to be simplified.",
|
|
78
|
-
MISSING_PERCENT_ERROR: "Your answer is almost correct, " + "but it is missing a " + "<code>\\\\%</code> at the end.",
|
|
79
|
-
MULTIPLICATION_SIGN_ERROR: "I'm a computer. I only understand " + "multiplication if you use an asterisk " + "(*) as the multiplication sign.",
|
|
80
|
-
WRONG_CASE_ERROR: "Your answer includes use of a variable with the wrong case.",
|
|
81
|
-
WRONG_LETTER_ERROR: "Your answer includes a wrong variable letter.",
|
|
82
|
-
invalidSelection: "Make sure you select something for every row.",
|
|
83
|
-
ERROR_TITLE: "Oops!",
|
|
84
|
-
ERROR_MESSAGE: "Sorry, I don't understand that!",
|
|
85
|
-
hints: "Hints",
|
|
86
|
-
getAnotherHint: "Get another hint",
|
|
87
|
-
deprecatedStandin: "Sorry, this part of the question is no longer available. 😅 Don't worry, you won't be graded on this part. Keep going!",
|
|
88
|
-
keepTrying: "Keep trying",
|
|
89
|
-
tryAgain: "Try again",
|
|
90
|
-
check: "Check",
|
|
91
|
-
correctExcited: "Correct!",
|
|
92
|
-
nextQuestion: "Next question",
|
|
93
|
-
skipToTitle: "Skip to %(title)s",
|
|
94
|
-
current: "Current",
|
|
95
|
-
correct: "Correct",
|
|
96
|
-
correctSelected: "Correct (selected)",
|
|
97
|
-
correctCrossedOut: "Correct (but you crossed it out)",
|
|
98
|
-
incorrect: "Incorrect",
|
|
99
|
-
incorrectSelected: "Incorrect (selected)",
|
|
100
|
-
hideExplanation: "Hide explanation",
|
|
101
|
-
explain: "Explain",
|
|
102
|
-
INVALID_MESSAGE_PREFIX: "We couldn't grade your answer.",
|
|
103
|
-
DEFAULT_INVALID_MESSAGE_1: "It looks like you left something blank or ",
|
|
104
|
-
DEFAULT_INVALID_MESSAGE_2: "entered in an invalid answer.",
|
|
105
|
-
integerExample: "an integer, like $6$",
|
|
106
|
-
properExample: "a *proper* fraction, like $1/2$ or $6/10$",
|
|
107
|
-
simplifiedProperExample: "a *simplified proper* fraction, like $3/5$",
|
|
108
|
-
improperExample: "an *improper* fraction, like $10/7$ or $14/8$",
|
|
109
|
-
simplifiedImproperExample: "a *simplified improper* fraction, like $7/4$",
|
|
110
|
-
mixedExample: "a mixed number, like $1\\\\ 3/4$",
|
|
111
|
-
decimalExample: "an *exact* decimal, like $0.75$",
|
|
112
|
-
percentExample: "a percent, like $12.34\\\\%$",
|
|
113
|
-
piExample: "a multiple of pi, like $12$ pi or $2/3$ pi",
|
|
114
|
-
yourAnswer: "**Your answer should be** ",
|
|
115
|
-
yourAnswerLabel: "Your answer:",
|
|
116
|
-
addPoints: "Click to add points",
|
|
117
|
-
addVertices: "Click to add vertices",
|
|
118
|
-
tapMultiple: "Tap each dot on the image to select all answers that apply.",
|
|
119
|
-
tapSingle: "Tap each dot on the image to select an answer.",
|
|
120
|
-
clickMultiple: "Click each dot on the image to select all answers that apply.",
|
|
121
|
-
clickSingle: "Click each dot on the image to select an answer.",
|
|
122
|
-
choices: "Choices:",
|
|
123
|
-
answers: {
|
|
124
|
-
one: "%(num)s answer",
|
|
125
|
-
other: "%(num)s answers"
|
|
126
|
-
},
|
|
127
|
-
hideAnswersToggleLabel: "Hide answer choices",
|
|
128
|
-
moves: {
|
|
129
|
-
one: "Moves: %(num)s",
|
|
130
|
-
other: "Moves: %(num)s"
|
|
131
|
-
},
|
|
132
|
-
clickTiles: "Click on the tiles to change the lights.",
|
|
133
|
-
turnOffLights: "You must turn on all of the lights to continue.",
|
|
134
|
-
fillAllCells: "Make sure you fill in all cells in the matrix.",
|
|
135
|
-
molecularDrawing: "A molecular structure drawing. SMILES notation: %(content)s",
|
|
136
|
-
switchDirection: "Switch direction",
|
|
137
|
-
circleOpen: "Make circle open",
|
|
138
|
-
circleFilled: "Make circle filled",
|
|
139
|
-
numDivisions: "Number of divisions:",
|
|
140
|
-
divisions: "Please make sure the number of divisions is in the range %(divRangeString)s.",
|
|
141
|
-
lineRange: "lines %(lineRange)s",
|
|
142
|
-
lineNumber: "line %(lineNumber)s",
|
|
143
|
-
symbolPassage: "The symbol %(questionSymbol)s indicates that question %(questionNumber)s references this portion of the passage.",
|
|
144
|
-
symbolQuestion: " The symbol %(sentenceSymbol)s indicates that the following sentence is referenced in a question.",
|
|
145
|
-
lineLabel: {
|
|
146
|
-
context: "a label next to a reading passage to denote the line number",
|
|
147
|
-
message: "Line"
|
|
148
|
-
},
|
|
149
|
-
beginningPassage: "Beginning of reading passage.",
|
|
150
|
-
beginningFootnotes: "Beginning of reading passage footnotes.",
|
|
151
|
-
endPassage: "End of reading passage.",
|
|
152
|
-
questionMarker: "[Marker for question %(number)s]",
|
|
153
|
-
circleMarker: "[Circle marker %(number)s]",
|
|
154
|
-
sentenceMarker: "[Sentence %(number)s]",
|
|
155
|
-
dragHandles: "Drag handles to make graph",
|
|
156
|
-
tapAddPoints: "Tap to add points",
|
|
157
|
-
false: "False",
|
|
158
|
-
true: "True",
|
|
159
|
-
no: "No",
|
|
160
|
-
yes: "Yes",
|
|
161
|
-
chooseCorrectNum: "Please choose the correct number of answers.",
|
|
162
|
-
notNoneOfTheAbove: "'None of the above' may not be selected when other answers are selected.",
|
|
163
|
-
noneOfTheAbove: "None of the above",
|
|
164
|
-
chooseNumAnswers: "Choose %(numCorrect)s answers:",
|
|
165
|
-
chooseAllAnswers: "Choose all answers that apply:",
|
|
166
|
-
chooseOneAnswer: "Choose 1 answer:",
|
|
167
|
-
choiceCheckedCorrect: "(Choice %(letter)s, Checked, Correct)",
|
|
168
|
-
choiceCrossedOutCorrect: "(Choice %(letter)s, Crossed out, Correct)",
|
|
169
|
-
choiceCorrect: "(Choice %(letter)s, Correct)",
|
|
170
|
-
choiceCheckedIncorrect: "(Choice %(letter)s, Checked, Incorrect)",
|
|
171
|
-
choiceCrossedOutIncorrect: "(Choice %(letter)s, Crossed out, Incorrect)",
|
|
172
|
-
choiceIncorrect: "(Choice %(letter)s, Incorrect)",
|
|
173
|
-
choiceChecked: "(Choice %(letter)s, Checked)",
|
|
174
|
-
choiceCrossedOut: "(Choice %(letter)s, Crossed out)",
|
|
175
|
-
choice: "(Choice %(letter)s)",
|
|
176
|
-
crossOut: "Cross out",
|
|
177
|
-
crossOutOption: "Cross out option",
|
|
178
|
-
crossOutChoice: "Cross out Choice %(letter)s",
|
|
179
|
-
bringBack: "Bring back",
|
|
180
|
-
openMenuForChoice: "Open menu for Choice %(letter)s",
|
|
181
|
-
letters: {
|
|
182
|
-
context: "This is a list of single-character labels that will appear in front of multiple-choice options. For instance, a multiple-choice question with three options would display (A) first option (B) second option (C) third option. There must be spaces between each of the different characters. The characters will show up next to options in the order that they are listed here. Most multiple choice questions have 5 or fewer options.",
|
|
183
|
-
message: "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"
|
|
184
|
-
},
|
|
185
|
-
rightArrow: "Reaction arrow pointing to the right.",
|
|
186
|
-
dontUnderstandUnits: "I couldn't understand those units.",
|
|
187
|
-
checkSigFigs: "Check your significant figures.",
|
|
188
|
-
answerNumericallyIncorrect: "That answer is numerically incorrect.",
|
|
189
|
-
checkUnits: "Check your units.",
|
|
190
|
-
dontUnderstand: "I don't understand that",
|
|
191
|
-
loading: "Loading...",
|
|
192
|
-
videoTranscript: "See video transcript",
|
|
193
|
-
somethingWrong: "Something went wrong.",
|
|
194
|
-
videoWrapper: "Khan Academy video wrapper",
|
|
195
|
-
mathInputTitle: "mathematics keyboard",
|
|
196
|
-
mathInputDescription: "Use keyboard/mouse to interact with math-based input fields",
|
|
197
|
-
sin: "sin",
|
|
198
|
-
cos: "cos",
|
|
199
|
-
tan: "tan",
|
|
200
|
-
simulationLoadFail: "Sorry, this simulation cannot load.",
|
|
201
|
-
simulationLocaleWarning: "Sorry, this simulation isn't available in your language.",
|
|
202
|
-
selectAnAnswer: "Select an answer",
|
|
203
|
-
// The following strings are used for interactive graph SR descriptions.
|
|
204
|
-
addPoint: "Add Point",
|
|
205
|
-
removePoint: "Remove Point",
|
|
206
|
-
graphKeyboardPrompt: "Press Shift + Enter to interact with the graph",
|
|
207
|
-
closePolygon: "Close shape",
|
|
208
|
-
openPolygon: "Re-open shape",
|
|
209
|
-
srInteractiveElements: "Interactive elements: %(elements)s",
|
|
210
|
-
srNoInteractiveElements: "No interactive elements",
|
|
211
|
-
// TODO(LEMS-2660): The following strings are ones that will need
|
|
212
|
-
// translation tickets after all interactive graph SR strings have
|
|
213
|
-
// been finalized. Remove this comment after the tickets have been
|
|
214
|
-
// created.
|
|
215
|
-
srPointAtCoordinates: "Point %(num)s at %(x)s comma %(y)s",
|
|
216
|
-
srCircleGraph: "A circle on a coordinate plane.",
|
|
217
|
-
srCircleShape: "Circle. The center point is at %(centerX)s comma %(centerY)s.",
|
|
218
|
-
srCircleRadiusPoint: "Radius point at %(radiusPointX)s comma %(radiusPointY)s.",
|
|
219
|
-
srCircleRadius: "Circle radius is %(radius)s.",
|
|
220
|
-
srCircleOuterPoints: "Points on the circle at %(point1X)s comma %(point1Y)s, %(point2X)s comma %(point2Y)s, %(point3X)s comma %(point3Y)s, %(point4X)s comma %(point4Y)s.",
|
|
221
|
-
srLinearGraph: "A line on a coordinate plane.",
|
|
222
|
-
srLinearGraphPoints: "The line has two points, point 1 at %(point1X)s comma %(point1Y)s and point 2 at %(point2X)s comma %(point2Y)s.",
|
|
223
|
-
srLinearGraphSlopeIncreasing: "Its slope increases from left to right.",
|
|
224
|
-
srLinearGraphSlopeDecreasing: "Its slope decreases from left to right.",
|
|
225
|
-
srLinearGraphSlopeHorizontal: "Its slope is zero.",
|
|
226
|
-
srLinearGraphSlopeVertical: "Its slope is undefined.",
|
|
227
|
-
srLinearGraphXOnlyIntercept: "The line crosses the X-axis at %(xIntercept)s comma 0.",
|
|
228
|
-
srLinearGraphYOnlyIntercept: "The line crosses the Y-axis at 0 comma %(yIntercept)s.",
|
|
229
|
-
srLinearGraphBothIntercepts: "The line crosses the X-axis at %(xIntercept)s comma 0 and the Y-axis at 0 comma %(yIntercept)s.",
|
|
230
|
-
srLinearGraphOriginIntercept: "The line crosses the x and y axes at the graph's origin.",
|
|
231
|
-
srLinearGrabHandle: "Line from %(point1X)s comma %(point1Y)s to %(point2X)s comma %(point2Y)s.",
|
|
232
|
-
srAngleSideAtCoordinates: "Point %(point)s, %(side)s at %(x)s comma %(y)s",
|
|
233
|
-
srAngleVertexAtCoordinatesWithAngleMeasure: "Point 2, vertex at %(x)s comma %(y)s. Angle %(angleMeasure)s degrees",
|
|
234
|
-
srAngleGraphAriaLabel: "An angle on a coordinate plane.",
|
|
235
|
-
srAngleGraphAriaDescription: "The angle measure is %(angleMeasure)s degrees with a vertex at %(vertexX)s comma %(vertexY)s, a point on the starting side at %(startingSideX)s comma %(startingSideY)s and a point on the ending side at %(endingSideX)s comma %(endingSideY)s",
|
|
236
|
-
srSingleSegmentGraphAriaLabel: "A line segment on a coordinate plane.",
|
|
237
|
-
srMultipleSegmentGraphAriaLabel: "%(countOfSegments)s line segments on a coordinate plane.",
|
|
238
|
-
srMultipleSegmentIndividualLabel: "Segment %(indexOfSegment)s: Endpoint 1 at %(point1X)s comma %(point1Y)s. Endpoint 2 %(point2X)s comma %(point2Y)s.",
|
|
239
|
-
srSingleSegmentLabel: "Endpoint 1 at %(point1X)s comma %(point1Y)s. Endpoint 2 %(point2X)s comma %(point2Y)s.",
|
|
240
|
-
srSegmentLength: "Segment length %(length)s units.",
|
|
241
|
-
srSingleSegmentGraphEndpointAriaLabel: "Endpoint %(endpointNumber)s at %(x)s comma %(y)s.",
|
|
242
|
-
srMultipleSegmentGraphEndpointAriaLabel: "Endpoint %(endpointNumber)s on segment %(indexOfSegment)s at %(x)s comma %(y)s.",
|
|
243
|
-
srSegmentGrabHandle: "Segment from %(point1X)s comma %(point1Y)s to %(point2X)s comma %(point2Y)s.",
|
|
244
|
-
srLinearSystemGraph: "Two lines on a coordinate plane.",
|
|
245
|
-
srLinearSystemPoints: "Line %(lineNumber)s has two points, point 1 at %(point1X)s comma %(point1Y)s and point 2 at %(point2X)s comma %(point2Y)s.",
|
|
246
|
-
srLinearSystemPoint: "Point %(pointSequence)s on line %(lineNumber)s at %(x)s comma %(y)s.",
|
|
247
|
-
srRayGraph: "A ray on a coordinate plane.",
|
|
248
|
-
srRayPoints: "The endpoint is at %(point1X)s comma %(point1Y)s and the ray goes through point %(point2X)s comma %(point2Y)s.",
|
|
249
|
-
srRayGrabHandle: "Ray with endpoint %(point1X)s comma %(point1Y)s going through point %(point2X)s comma %(point2Y)s.",
|
|
250
|
-
srRayEndpoint: "Endpoint at %(x)s comma %(y)s.",
|
|
251
|
-
srRayTerminalPoint: "Through point at %(x)s comma %(y)s.",
|
|
252
|
-
srQuadraticGraph: "A parabola on a 4-quadrant coordinate plane.",
|
|
253
|
-
srQuadraticFaceUp: "The parabola opens upward.",
|
|
254
|
-
srQuadraticFaceDown: "The parabola opens downward.",
|
|
255
|
-
srQuadraticGraphVertexOrigin: "Vertex is at the origin.",
|
|
256
|
-
srQuadraticGraphVertexXAxis: "Vertex is on the X-axis.",
|
|
257
|
-
srQuadraticGraphVertexYAxis: "Vertex is on the Y-axis.",
|
|
258
|
-
srQuadraticGraphVertexQuadrant: "Vertex is in quadrant %(quadrant)s.",
|
|
259
|
-
srQuadraticTwoXIntercepts: "The X-intercepts are at %(intercept1)s comma 0 and %(intercept2)s comma 0.",
|
|
260
|
-
srQuadraticOneXIntercept: "The X-intercept is at %(intercept)s comma 0.",
|
|
261
|
-
srQuadraticYIntercept: "The Y-intercept is at 0 comma %(intercept)s.",
|
|
262
|
-
srQuadraticPointOrigin: "Point %(pointNumber)s on parabola at the origin.",
|
|
263
|
-
srQuadraticPointAxis: "Point %(pointNumber)s on parabola at %(x)s comma %(y)s.",
|
|
264
|
-
srQuadraticPointQuadrant: "Point %(pointNumber)s on parabola in quadrant %(quadrant)s at %(x)s comma %(y)s.",
|
|
265
|
-
srQuadraticInteractiveElements: "Parabola with points at %(point1X)s comma %(point1Y)s, %(point2X)s comma %(point2Y)s, and %(point3X)s comma %(point3Y)s."
|
|
266
|
-
// The above strings are used for interactive graph SR descriptions.
|
|
267
|
-
};
|
|
268
|
-
|
|
269
62
|
/**
|
|
270
63
|
* Mock strings for the Perseus package, to be used for tests and Storybook.
|
|
271
64
|
*/
|
|
@@ -650,24 +443,32 @@ const mockStrings = {
|
|
|
650
443
|
|
|
651
444
|
// This type helps us make sure all error codes are mapped to strings
|
|
652
445
|
|
|
446
|
+
/**
|
|
447
|
+
* Map an error string to a PerseusStrings key
|
|
448
|
+
* that we can use to get the translated error message
|
|
449
|
+
*/
|
|
653
450
|
const errorToString = {
|
|
654
|
-
MISSING_PERCENT_ERROR:
|
|
655
|
-
NEEDS_TO_BE_SIMPLIFIED_ERROR:
|
|
656
|
-
APPROXIMATED_PI_ERROR:
|
|
657
|
-
EXTRA_SYMBOLS_ERROR:
|
|
658
|
-
WRONG_CASE_ERROR:
|
|
659
|
-
WRONG_LETTER_ERROR:
|
|
660
|
-
MULTIPLICATION_SIGN_ERROR:
|
|
661
|
-
INVALID_SELECTION_ERROR:
|
|
662
|
-
CHOOSE_CORRECT_NUM_ERROR:
|
|
663
|
-
NOT_NONE_ABOVE_ERROR:
|
|
664
|
-
FILL_ALL_CELLS_ERROR:
|
|
665
|
-
};
|
|
666
|
-
function mapErrorToString(
|
|
451
|
+
MISSING_PERCENT_ERROR: "MISSING_PERCENT_ERROR",
|
|
452
|
+
NEEDS_TO_BE_SIMPLIFIED_ERROR: "NEEDS_TO_BE_SIMPLFIED_ERROR",
|
|
453
|
+
APPROXIMATED_PI_ERROR: "APPROXIMATED_PI_ERROR",
|
|
454
|
+
EXTRA_SYMBOLS_ERROR: "EXTRA_SYMBOLS_ERROR",
|
|
455
|
+
WRONG_CASE_ERROR: "WRONG_CASE_ERROR",
|
|
456
|
+
WRONG_LETTER_ERROR: "WRONG_LETTER_ERROR",
|
|
457
|
+
MULTIPLICATION_SIGN_ERROR: "MULTIPLICATION_SIGN_ERROR",
|
|
458
|
+
INVALID_SELECTION_ERROR: "invalidSelection",
|
|
459
|
+
CHOOSE_CORRECT_NUM_ERROR: "chooseCorrectNum",
|
|
460
|
+
NOT_NONE_ABOVE_ERROR: "notNoneOfTheAbove",
|
|
461
|
+
FILL_ALL_CELLS_ERROR: "fillAllCells"
|
|
462
|
+
};
|
|
463
|
+
function mapErrorToString(
|
|
464
|
+
// the string representing an error code
|
|
465
|
+
err,
|
|
466
|
+
// the translated Perseus strings
|
|
467
|
+
translatedStrings) {
|
|
667
468
|
if (!err) {
|
|
668
469
|
return err;
|
|
669
470
|
}
|
|
670
|
-
return errorToString[err] || err;
|
|
471
|
+
return translatedStrings[errorToString[err]] || err;
|
|
671
472
|
}
|
|
672
473
|
|
|
673
474
|
/**
|
|
@@ -26072,7 +25873,7 @@ class GradedGroup extends React.Component {
|
|
|
26072
25873
|
DEFAULT_INVALID_MESSAGE_2
|
|
26073
25874
|
} = this.context.strings;
|
|
26074
25875
|
const status = score.type === "points" ? score.total === score.earned ? GRADING_STATUSES.correct : GRADING_STATUSES.incorrect : GRADING_STATUSES.invalid;
|
|
26075
|
-
const message = score.type === "points" ? score.message || "" : score.message ? `${INVALID_MESSAGE_PREFIX} ${mapErrorToString(score.message)}` : `${INVALID_MESSAGE_PREFIX} ${DEFAULT_INVALID_MESSAGE_1}${DEFAULT_INVALID_MESSAGE_2}`;
|
|
25876
|
+
const message = score.type === "points" ? score.message || "" : score.message ? `${INVALID_MESSAGE_PREFIX} ${mapErrorToString(score.message, this.context.strings)}` : `${INVALID_MESSAGE_PREFIX} ${DEFAULT_INVALID_MESSAGE_1}${DEFAULT_INVALID_MESSAGE_2}`;
|
|
26076
25877
|
this.setState({
|
|
26077
25878
|
status: status,
|
|
26078
25879
|
message: message,
|
|
@@ -43037,7 +42838,7 @@ const init = function init() {
|
|
|
43037
42838
|
|
|
43038
42839
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
43039
42840
|
const libName = "@khanacademy/perseus";
|
|
43040
|
-
const libVersion = "52.0.
|
|
42841
|
+
const libVersion = "52.0.1";
|
|
43041
42842
|
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
43042
42843
|
|
|
43043
42844
|
const apiVersion = {
|