@khanacademy/perseus-core 27.0.3 → 27.1.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.
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
* } & Perseus<Widget>ValidationData;
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
|
-
import type { GrapherAnswerTypes, PerseusDropdownChoice, PerseusExpressionAnswerForm, PerseusGradedGroupSetWidgetOptions, PerseusGradedGroupWidgetOptions, PerseusGraphType, PerseusGroupWidgetOptions, PerseusMatrixWidgetAnswers, PerseusNumericInputAnswer, PerseusOrdererWidgetOptions, PerseusRadioChoice, PerseusGraphCorrectType, MakeWidgetMap, PerseusFreeResponseWidgetScoringCriterion, PerseusRenderer } from "./data-schema";
|
|
31
|
+
import type { GrapherAnswerTypes, PerseusDropdownChoice, PerseusExpressionAnswerForm, PerseusGradedGroupSetWidgetOptions, PerseusGradedGroupWidgetOptions, PerseusGraphType, PerseusGroupWidgetOptions, PerseusMatrixWidgetAnswers, PerseusNumericInputAnswer, PerseusOrdererWidgetOptions, PerseusRadioChoice, PerseusGraphCorrectType, MakeWidgetMap, PerseusFreeResponseWidgetScoringCriterion, PerseusRenderer, PerseusInputNumberWidgetOptions } from "./data-schema";
|
|
32
32
|
import type { ErrorCode } from "./error-codes";
|
|
33
33
|
import type { Relationship } from "./types";
|
|
34
34
|
/**
|
|
@@ -213,70 +213,6 @@ export type PerseusIFrameUserInput = {
|
|
|
213
213
|
/** An optional message from the iframe to display alongside the score. */
|
|
214
214
|
message?: string | null;
|
|
215
215
|
};
|
|
216
|
-
/** Scoring rubric for the InputNumber widget. */
|
|
217
|
-
export type PerseusInputNumberRubric = {
|
|
218
|
-
/**
|
|
219
|
-
* Constrains which numeric forms are accepted (ie. these don't change the
|
|
220
|
-
* correct numerical value - they only restrict which input representation
|
|
221
|
-
* the scorer accepts as valid).
|
|
222
|
-
*
|
|
223
|
-
* Defaults to "number" if unset.
|
|
224
|
-
*
|
|
225
|
-
* - "number" - Any standard numeric form: integer, decimal, proper
|
|
226
|
-
* fraction, improper fraction, or mixed number (note that
|
|
227
|
-
* "percent" and "pi" are _not_ included in this format).
|
|
228
|
-
* - "decimal" - Decimal notation only (e.g. 1.5)
|
|
229
|
-
* - "integer" - Whole numbers only (e.g. 3, -7)
|
|
230
|
-
* - "rational" - Integer, proper fraction, improper fraction, or mixed
|
|
231
|
-
* number — but no decimals
|
|
232
|
-
* - "improper" - Integer, proper or improper fraction — mixed numbers
|
|
233
|
-
* like 1 3/4 are rejected
|
|
234
|
-
* - "mixed" - Integer, proper fraction, or mixed number — standalone
|
|
235
|
-
* improper fractions are rejected
|
|
236
|
-
* - "percent" - All numeric forms plus percent notation (e.g. 50%); all
|
|
237
|
-
* number forms are accepted, but the % sign is required
|
|
238
|
-
* when entering the value as a percentage (e.g. 50%)
|
|
239
|
-
* rather than as the equivalent decimal (e.g. 0.5).
|
|
240
|
-
* - "pi" - Expressions involving π or τ (e.g. 3 pi, 5/6 pi, 2 \pi);
|
|
241
|
-
* the user must express the answer as a multiple of pi. 0
|
|
242
|
-
* is accepted literally since 0·π = 0. Decimal
|
|
243
|
-
* approximations within 0.01 of a multiple of π or τ are
|
|
244
|
-
* also accepted. Any fraction with 7 as the denominator
|
|
245
|
-
* (ie. `x/7`) is resolved to a numeric value and compared
|
|
246
|
-
* against the answer (approximating pi).
|
|
247
|
-
*/
|
|
248
|
-
answerType?: "number" | "decimal" | "integer" | "rational" | "improper" | "mixed" | "percent" | "pi";
|
|
249
|
-
/**
|
|
250
|
-
* When true, approximate answers within `maxError` of the correct
|
|
251
|
-
* value are accepted.
|
|
252
|
-
*/
|
|
253
|
-
inexact?: boolean;
|
|
254
|
-
/**
|
|
255
|
-
* The maximum allowable deviation from the correct value when
|
|
256
|
-
* `inexact` is true.
|
|
257
|
-
*
|
|
258
|
-
* Legacy content encodes this number as a string (eg. "0.5"), encoding the
|
|
259
|
-
* values as the `number` type is preferred!
|
|
260
|
-
*/
|
|
261
|
-
maxError?: number | string;
|
|
262
|
-
/**
|
|
263
|
-
* Controls how the scorer handles unsimplified fractions (e.g. 2/4
|
|
264
|
-
* instead of 1/2) when the numerical value is otherwise correct.
|
|
265
|
-
*
|
|
266
|
-
* - "required" - The unsimplified answer is treated as not yet
|
|
267
|
-
* submitted: the scorer returns an invalid/empty result
|
|
268
|
-
* with a "needs to be simplified" prompt, so the learner
|
|
269
|
-
* must simplify before their attempt is graded.
|
|
270
|
-
* - "optional" - Unsimplified fractions are accepted as fully correct;
|
|
271
|
-
* simplification is not checked.
|
|
272
|
-
* - "enforced" - Unsimplified fractions are scored as wrong (incorrect,
|
|
273
|
-
* not just unsubmitted), with a "needs to be simplified"
|
|
274
|
-
* message shown alongside the incorrect result.
|
|
275
|
-
*/
|
|
276
|
-
simplify: "required" | "optional" | "enforced";
|
|
277
|
-
/** The correct answer value. */
|
|
278
|
-
value: string | number;
|
|
279
|
-
};
|
|
280
216
|
/** User input for the InputNumber widget. */
|
|
281
217
|
export type PerseusInputNumberUserInput = {
|
|
282
218
|
/**
|
|
@@ -544,7 +480,7 @@ export interface RubricRegistry {
|
|
|
544
480
|
"graded-group": PerseusGradedGroupRubric;
|
|
545
481
|
grapher: PerseusGrapherRubric;
|
|
546
482
|
group: PerseusGroupRubric;
|
|
547
|
-
"input-number":
|
|
483
|
+
"input-number": PerseusInputNumberWidgetOptions;
|
|
548
484
|
"interactive-graph": PerseusInteractiveGraphRubric;
|
|
549
485
|
"label-image": PerseusLabelImageRubric;
|
|
550
486
|
matcher: PerseusMatcherRubric;
|