@khanacademy/perseus-score 4.1.0 → 5.0.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.map +1 -1
- package/dist/has-empty-diner-widgets.d.ts +1 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.js.map +1 -1
- package/dist/score.d.ts +1 -2
- package/dist/util/score-noop.d.ts +1 -1
- package/dist/validate.d.ts +1 -1
- package/dist/widgets/categorizer/score-categorizer.d.ts +1 -1
- package/dist/widgets/categorizer/validate-categorizer.d.ts +1 -1
- package/dist/widgets/cs-program/score-cs-program.d.ts +1 -1
- package/dist/widgets/dropdown/score-dropdown.d.ts +1 -1
- package/dist/widgets/dropdown/validate-dropdown.d.ts +1 -1
- package/dist/widgets/expression/score-expression.d.ts +1 -1
- package/dist/widgets/expression/validate-expression.d.ts +1 -1
- package/dist/widgets/grapher/score-grapher.d.ts +1 -1
- package/dist/widgets/group/score-group.d.ts +1 -1
- package/dist/widgets/group/validate-group.d.ts +1 -1
- package/dist/widgets/iframe/score-iframe.d.ts +1 -1
- package/dist/widgets/input-number/score-input-number.d.ts +1 -1
- package/dist/widgets/interactive-graph/score-interactive-graph.d.ts +1 -1
- package/dist/widgets/label-image/score-label-image.d.ts +1 -1
- package/dist/widgets/label-image/validate-label-image.d.ts +1 -1
- package/dist/widgets/matcher/score-matcher.d.ts +1 -1
- package/dist/widgets/matrix/score-matrix.d.ts +1 -1
- package/dist/widgets/matrix/validate-matrix.d.ts +1 -1
- package/dist/widgets/mock-widget/score-mock-widget.d.ts +1 -1
- package/dist/widgets/mock-widget/validate-mock-widget.d.ts +1 -1
- package/dist/widgets/number-line/score-number-line.d.ts +1 -1
- package/dist/widgets/number-line/validate-number-line.d.ts +1 -1
- package/dist/widgets/numeric-input/score-numeric-input.d.ts +1 -1
- package/dist/widgets/orderer/score-orderer.d.ts +1 -1
- package/dist/widgets/orderer/validate-orderer.d.ts +1 -1
- package/dist/widgets/plotter/score-plotter.d.ts +1 -1
- package/dist/widgets/plotter/validate-plotter.d.ts +1 -1
- package/dist/widgets/radio/score-radio.d.ts +1 -1
- package/dist/widgets/radio/validate-radio.d.ts +1 -1
- package/dist/widgets/sorter/score-sorter.d.ts +1 -1
- package/dist/widgets/sorter/validate-sorter.d.ts +1 -1
- package/dist/widgets/table/score-table.d.ts +1 -1
- package/dist/widgets/table/validate-table.d.ts +1 -1
- package/dist/widgets/widget-registry.d.ts +1 -1
- package/package.json +4 -4
- package/dist/validation.types.d.ts +0 -281
- package/dist/validation.typetest.d.ts +0 -1
package/dist/score.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { PerseusScore, UserInputMap } from "
|
|
2
|
-
import type { PerseusRenderer, PerseusWidgetsMap } from "@khanacademy/perseus-core";
|
|
1
|
+
import type { PerseusRenderer, PerseusScore, PerseusWidgetsMap, UserInputMap } from "@khanacademy/perseus-core";
|
|
3
2
|
/**
|
|
4
3
|
* If a widget says that it is empty once it is graded.
|
|
5
4
|
* Trying to encapsulate references to the score format.
|
package/dist/validate.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { UserInputMap, ValidationDataMap } from "
|
|
1
|
+
import type { UserInputMap, ValidationDataMap } from "@khanacademy/perseus-core";
|
|
2
2
|
/**
|
|
3
3
|
* Checks the given user input to see if any answerable widgets have not been
|
|
4
4
|
* "filled in" (ie. if they're empty). Another way to think about this
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { PerseusCategorizerRubric, PerseusCategorizerUserInput, PerseusScore } from "
|
|
1
|
+
import type { PerseusCategorizerRubric, PerseusCategorizerUserInput, PerseusScore } from "@khanacademy/perseus-core";
|
|
2
2
|
declare function scoreCategorizer(userInput: PerseusCategorizerUserInput, rubric: PerseusCategorizerRubric): PerseusScore;
|
|
3
3
|
export default scoreCategorizer;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PerseusCategorizerUserInput, PerseusCategorizerValidationData, ValidationResult } from "
|
|
1
|
+
import type { PerseusCategorizerUserInput, PerseusCategorizerValidationData, ValidationResult } from "@khanacademy/perseus-core";
|
|
2
2
|
/**
|
|
3
3
|
* Checks userInput from the categorizer widget to see if the user has selected
|
|
4
4
|
* a category for each item.
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { PerseusCSProgramUserInput, PerseusScore } from "
|
|
1
|
+
import type { PerseusCSProgramUserInput, PerseusScore } from "@khanacademy/perseus-core";
|
|
2
2
|
declare function scoreCSProgram(userInput: PerseusCSProgramUserInput): PerseusScore;
|
|
3
3
|
export default scoreCSProgram;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { PerseusDropdownRubric, PerseusDropdownUserInput, PerseusScore } from "
|
|
1
|
+
import type { PerseusDropdownRubric, PerseusDropdownUserInput, PerseusScore } from "@khanacademy/perseus-core";
|
|
2
2
|
declare function scoreDropdown(userInput: PerseusDropdownUserInput, rubric: PerseusDropdownRubric): PerseusScore;
|
|
3
3
|
export default scoreDropdown;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PerseusDropdownUserInput, ValidationResult } from "
|
|
1
|
+
import type { PerseusDropdownUserInput, ValidationResult } from "@khanacademy/perseus-core";
|
|
2
2
|
/**
|
|
3
3
|
* Checks if the user has selected an item from the dropdown before scoring.
|
|
4
4
|
* This is shown with a userInput value / index other than 0.
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { PerseusExpressionRubric, PerseusExpressionUserInput, PerseusScore } from "
|
|
1
|
+
import type { PerseusExpressionRubric, PerseusExpressionUserInput, PerseusScore } from "@khanacademy/perseus-core";
|
|
2
2
|
declare function scoreExpression(userInput: PerseusExpressionUserInput, rubric: PerseusExpressionRubric, locale: string): PerseusScore;
|
|
3
3
|
export default scoreExpression;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PerseusExpressionUserInput, ValidationResult } from "
|
|
1
|
+
import type { PerseusExpressionUserInput, ValidationResult } from "@khanacademy/perseus-core";
|
|
2
2
|
/**
|
|
3
3
|
* Checks user input from the expression widget to see if it is scorable.
|
|
4
4
|
*
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { PerseusGrapherRubric, PerseusGrapherUserInput, PerseusScore } from "
|
|
1
|
+
import type { PerseusGrapherRubric, PerseusGrapherUserInput, PerseusScore } from "@khanacademy/perseus-core";
|
|
2
2
|
declare function scoreGrapher(userInput: PerseusGrapherUserInput, rubric: PerseusGrapherRubric): PerseusScore;
|
|
3
3
|
export default scoreGrapher;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { PerseusGroupRubric, PerseusGroupUserInput, PerseusScore } from "
|
|
1
|
+
import type { PerseusGroupRubric, PerseusGroupUserInput, PerseusScore } from "@khanacademy/perseus-core";
|
|
2
2
|
declare function scoreGroup(userInput: PerseusGroupUserInput, rubric: PerseusGroupRubric, locale: string): PerseusScore;
|
|
3
3
|
export default scoreGroup;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { PerseusGroupUserInput, PerseusGroupValidationData, ValidationResult } from "
|
|
1
|
+
import type { PerseusGroupUserInput, PerseusGroupValidationData, ValidationResult } from "@khanacademy/perseus-core";
|
|
2
2
|
declare function validateGroup(userInput: PerseusGroupUserInput, validationData: PerseusGroupValidationData, locale: string): ValidationResult;
|
|
3
3
|
export default validateGroup;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { PerseusIFrameUserInput, PerseusScore } from "
|
|
1
|
+
import type { PerseusIFrameUserInput, PerseusScore } from "@khanacademy/perseus-core";
|
|
2
2
|
declare function scoreIframe(userInput: PerseusIFrameUserInput): PerseusScore;
|
|
3
3
|
export default scoreIframe;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PerseusInputNumberRubric, PerseusInputNumberUserInput, PerseusScore } from "
|
|
1
|
+
import type { PerseusInputNumberRubric, PerseusInputNumberUserInput, PerseusScore } from "@khanacademy/perseus-core";
|
|
2
2
|
export declare const inputNumberAnswerTypes: {
|
|
3
3
|
readonly number: {
|
|
4
4
|
readonly name: "Numbers";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { PerseusInteractiveGraphUserInput, PerseusInteractiveGraphRubric, PerseusScore } from "
|
|
1
|
+
import type { PerseusInteractiveGraphUserInput, PerseusInteractiveGraphRubric, PerseusScore } from "@khanacademy/perseus-core";
|
|
2
2
|
declare function scoreInteractiveGraph(userInput: PerseusInteractiveGraphUserInput, rubric: PerseusInteractiveGraphRubric): PerseusScore;
|
|
3
3
|
export default scoreInteractiveGraph;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PerseusLabelImageUserInput, PerseusLabelImageRubric, PerseusScore } from "
|
|
1
|
+
import type { PerseusLabelImageUserInput, PerseusLabelImageRubric, PerseusScore } from "@khanacademy/perseus-core";
|
|
2
2
|
type InteractiveMarkerScore = {
|
|
3
3
|
hasAnswers: boolean;
|
|
4
4
|
isCorrect: boolean;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { PerseusLabelImageUserInput, ValidationResult } from "
|
|
1
|
+
import type { PerseusLabelImageUserInput, ValidationResult } from "@khanacademy/perseus-core";
|
|
2
2
|
declare function validateLabelImage(userInput: PerseusLabelImageUserInput): ValidationResult;
|
|
3
3
|
export default validateLabelImage;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { PerseusMatcherRubric, PerseusMatcherUserInput, PerseusScore } from "
|
|
1
|
+
import type { PerseusMatcherRubric, PerseusMatcherUserInput, PerseusScore } from "@khanacademy/perseus-core";
|
|
2
2
|
declare function scoreMatcher(userInput: PerseusMatcherUserInput, rubric: PerseusMatcherRubric): PerseusScore;
|
|
3
3
|
export default scoreMatcher;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { PerseusMatrixRubric, PerseusMatrixUserInput, PerseusScore } from "
|
|
1
|
+
import type { PerseusMatrixRubric, PerseusMatrixUserInput, PerseusScore } from "@khanacademy/perseus-core";
|
|
2
2
|
declare function scoreMatrix(userInput: PerseusMatrixUserInput, rubric: PerseusMatrixRubric): PerseusScore;
|
|
3
3
|
export default scoreMatrix;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { PerseusMockWidgetRubric, PerseusMockWidgetUserInput } from "./mock-widget-validation.types";
|
|
2
|
-
import type { PerseusScore } from "
|
|
2
|
+
import type { PerseusScore } from "@khanacademy/perseus-core";
|
|
3
3
|
declare function scoreMockWidget(userInput: PerseusMockWidgetUserInput, rubric: PerseusMockWidgetRubric): PerseusScore;
|
|
4
4
|
export default scoreMockWidget;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { PerseusMockWidgetUserInput } from "./mock-widget-validation.types";
|
|
2
|
-
import type { ValidationResult } from "
|
|
2
|
+
import type { ValidationResult } from "@khanacademy/perseus-core";
|
|
3
3
|
declare function validateMockWidget(userInput: PerseusMockWidgetUserInput): ValidationResult;
|
|
4
4
|
export default validateMockWidget;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { PerseusNumberLineRubric, PerseusNumberLineUserInput, PerseusScore } from "
|
|
1
|
+
import type { PerseusNumberLineRubric, PerseusNumberLineUserInput, PerseusScore } from "@khanacademy/perseus-core";
|
|
2
2
|
declare function scoreNumberLine(userInput: PerseusNumberLineUserInput, rubric: PerseusNumberLineRubric): PerseusScore;
|
|
3
3
|
export default scoreNumberLine;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PerseusNumberLineUserInput, PerseusScore } from "
|
|
1
|
+
import type { PerseusNumberLineUserInput, PerseusScore } from "@khanacademy/perseus-core";
|
|
2
2
|
/**
|
|
3
3
|
* Checks user input is within the allowed range and not the same as the initial
|
|
4
4
|
* state.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PerseusNumericInputRubric, PerseusNumericInputUserInput, PerseusScore } from "
|
|
1
|
+
import type { PerseusNumericInputRubric, PerseusNumericInputUserInput, PerseusScore } from "@khanacademy/perseus-core";
|
|
2
2
|
export declare function maybeParsePercentInput(inputValue: string | number, normalizedAnswerExpected: boolean): string | number;
|
|
3
3
|
declare function scoreNumericInput(userInput: PerseusNumericInputUserInput, rubric: PerseusNumericInputRubric): PerseusScore;
|
|
4
4
|
export default scoreNumericInput;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { PerseusOrdererRubric, PerseusOrdererUserInput, PerseusScore } from "
|
|
1
|
+
import type { PerseusOrdererRubric, PerseusOrdererUserInput, PerseusScore } from "@khanacademy/perseus-core";
|
|
2
2
|
declare function scoreOrderer(userInput: PerseusOrdererUserInput, rubric: PerseusOrdererRubric): PerseusScore;
|
|
3
3
|
export default scoreOrderer;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PerseusOrdererUserInput, ValidationResult } from "
|
|
1
|
+
import type { PerseusOrdererUserInput, ValidationResult } from "@khanacademy/perseus-core";
|
|
2
2
|
/**
|
|
3
3
|
* Checks user input from the orderer widget to see if the user has started
|
|
4
4
|
* ordering the options, making the widget scorable.
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { PerseusPlotterUserInput, PerseusPlotterRubric, PerseusScore } from "
|
|
1
|
+
import type { PerseusPlotterUserInput, PerseusPlotterRubric, PerseusScore } from "@khanacademy/perseus-core";
|
|
2
2
|
declare function scorePlotter(userInput: PerseusPlotterUserInput, rubric: PerseusPlotterRubric): PerseusScore;
|
|
3
3
|
export default scorePlotter;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PerseusPlotterUserInput, PerseusPlotterValidationData, ValidationResult } from "
|
|
1
|
+
import type { PerseusPlotterUserInput, PerseusPlotterValidationData, ValidationResult } from "@khanacademy/perseus-core";
|
|
2
2
|
/**
|
|
3
3
|
* Checks user input to confirm it is not the same as the starting values for the graph.
|
|
4
4
|
* This means the user has modified the graph, and the question can be scored.
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { PerseusRadioRubric, PerseusRadioUserInput, PerseusScore } from "
|
|
1
|
+
import type { PerseusRadioRubric, PerseusRadioUserInput, PerseusScore } from "@khanacademy/perseus-core";
|
|
2
2
|
declare function scoreRadio(userInput: PerseusRadioUserInput, rubric: PerseusRadioRubric): PerseusScore;
|
|
3
3
|
export default scoreRadio;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PerseusRadioUserInput, ValidationResult } from "
|
|
1
|
+
import type { PerseusRadioUserInput, ValidationResult } from "@khanacademy/perseus-core";
|
|
2
2
|
/**
|
|
3
3
|
* Checks if the user has selected at least one option. Additional validation
|
|
4
4
|
* is done in scoreRadio to check if the number of selected options is correct
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { PerseusSorterRubric, PerseusSorterUserInput, PerseusScore } from "
|
|
1
|
+
import type { PerseusSorterRubric, PerseusSorterUserInput, PerseusScore } from "@khanacademy/perseus-core";
|
|
2
2
|
declare function scoreSorter(userInput: PerseusSorterUserInput, rubric: PerseusSorterRubric): PerseusScore;
|
|
3
3
|
export default scoreSorter;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PerseusSorterUserInput, ValidationResult } from "
|
|
1
|
+
import type { PerseusSorterUserInput, ValidationResult } from "@khanacademy/perseus-core";
|
|
2
2
|
/**
|
|
3
3
|
* Checks user input for the sorter widget to ensure that the user has made
|
|
4
4
|
* changes before attempting to score the widget.
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { PerseusTableRubric, PerseusScore, PerseusTableUserInput } from "
|
|
1
|
+
import type { PerseusTableRubric, PerseusScore, PerseusTableUserInput } from "@khanacademy/perseus-core";
|
|
2
2
|
declare function scoreTable(userInput: PerseusTableUserInput, rubric: PerseusTableRubric): PerseusScore;
|
|
3
3
|
export default scoreTable;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { PerseusTableUserInput, ValidationResult } from "
|
|
1
|
+
import type { PerseusTableUserInput, ValidationResult } from "@khanacademy/perseus-core";
|
|
2
2
|
declare function validateTable(userInput: PerseusTableUserInput): ValidationResult;
|
|
3
3
|
export default validateTable;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { WidgetScorerFunction, WidgetValidatorFunction } from "
|
|
1
|
+
import type { WidgetScorerFunction, WidgetValidatorFunction } from "@khanacademy/perseus-core";
|
|
2
2
|
export declare function registerWidget(type: string, scorer: WidgetScorerFunction, validator?: WidgetValidatorFunction): void;
|
|
3
3
|
export declare const getWidgetValidator: (name: string) => WidgetValidatorFunction | null;
|
|
4
4
|
export declare const getWidgetScorer: (name: string) => WidgetScorerFunction | null;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Perseus score",
|
|
4
4
|
"author": "Khan Academy",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "
|
|
6
|
+
"version": "5.0.0",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@khanacademy/kas": "2.0.1",
|
|
26
|
-
"@khanacademy/kmath": "2.0.
|
|
27
|
-
"@khanacademy/perseus-
|
|
28
|
-
"@khanacademy/perseus-
|
|
26
|
+
"@khanacademy/kmath": "2.0.3",
|
|
27
|
+
"@khanacademy/perseus-core": "7.1.0",
|
|
28
|
+
"@khanacademy/perseus-utils": "2.0.1"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"underscore": "^1.4.4",
|
|
@@ -1,281 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file contains types used for validation and scoring. The types abide by
|
|
3
|
-
* a naming convention so that they're easy to follow and that we remain
|
|
4
|
-
* consistent across all of the widgets.
|
|
5
|
-
*
|
|
6
|
-
* These types are:
|
|
7
|
-
*
|
|
8
|
-
* * `Perseus<Widget>UserInput`: the data from the widget that represents the
|
|
9
|
-
* data the user entered. This is referred to as the 'guess' in some older
|
|
10
|
-
* parts of Perseus.
|
|
11
|
-
*
|
|
12
|
-
* * `Perseus<Widget>ValidationData`: the data needed to do validation of the
|
|
13
|
-
* user input. Validation refers to the different checks that we can do
|
|
14
|
-
* both on the client-side (before submitting user input for scoring) and
|
|
15
|
-
* on the server-side (when we score it). As such, it cannot contain any of
|
|
16
|
-
* the sensitive scoring data that would reveal the answer.
|
|
17
|
-
*
|
|
18
|
-
* * `Perseus<Widget>Rubric` (nee `Perseus<Widget>Rubric`): the data
|
|
19
|
-
* needed to score the user input. By convention, this type is defined as
|
|
20
|
-
* the set of sensitive answer data and then intersected with
|
|
21
|
-
* `Perseus<Widget>ValidationData`.
|
|
22
|
-
*
|
|
23
|
-
* For example:
|
|
24
|
-
* ```
|
|
25
|
-
* type Perseus<Widget>Rubric = {
|
|
26
|
-
* correct: string; // Used _only_ for scoring
|
|
27
|
-
* size: number; // Used _only_ for scoring
|
|
28
|
-
* } & Perseus<Widget>ValidationData;
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
import type { GrapherAnswerTypes, PerseusDropdownChoice, PerseusExpressionAnswerForm, PerseusGradedGroupSetWidgetOptions, PerseusGradedGroupWidgetOptions, PerseusGraphType, PerseusGroupWidgetOptions, PerseusMatrixWidgetAnswers, PerseusNumericInputAnswer, PerseusOrdererWidgetOptions, PerseusRadioChoice, PerseusGraphCorrectType, MakeWidgetMap, Relationship } from "@khanacademy/perseus-core";
|
|
32
|
-
export type WidgetValidatorFunction = (userInput: UserInput, validationData: ValidationData, locale: string) => ValidationResult;
|
|
33
|
-
export type WidgetScorerFunction = (userInput: UserInput, rubric: Rubric, locale?: string) => PerseusScore;
|
|
34
|
-
export type PerseusScore = {
|
|
35
|
-
type: "invalid";
|
|
36
|
-
message?: string | null | undefined;
|
|
37
|
-
suppressAlmostThere?: boolean | null | undefined;
|
|
38
|
-
} | {
|
|
39
|
-
type: "points";
|
|
40
|
-
earned: number;
|
|
41
|
-
total: number;
|
|
42
|
-
message?: string | null | undefined;
|
|
43
|
-
};
|
|
44
|
-
export type ValidationResult = Extract<PerseusScore, {
|
|
45
|
-
type: "invalid";
|
|
46
|
-
}> | null;
|
|
47
|
-
export type UserInputStatus = "correct" | "incorrect" | "incomplete";
|
|
48
|
-
export type PerseusCategorizerRubric = {
|
|
49
|
-
values: ReadonlyArray<number>;
|
|
50
|
-
} & PerseusCategorizerValidationData;
|
|
51
|
-
export type PerseusCategorizerUserInput = {
|
|
52
|
-
values: PerseusCategorizerRubric["values"];
|
|
53
|
-
};
|
|
54
|
-
export type PerseusCategorizerValidationData = {
|
|
55
|
-
items: ReadonlyArray<string>;
|
|
56
|
-
};
|
|
57
|
-
export type PerseusCSProgramUserInput = {
|
|
58
|
-
status: UserInputStatus;
|
|
59
|
-
message: string | null;
|
|
60
|
-
};
|
|
61
|
-
export type PerseusDropdownRubric = {
|
|
62
|
-
choices: ReadonlyArray<PerseusDropdownChoice>;
|
|
63
|
-
};
|
|
64
|
-
export type PerseusDropdownUserInput = {
|
|
65
|
-
value: number;
|
|
66
|
-
};
|
|
67
|
-
export type PerseusExpressionRubric = {
|
|
68
|
-
answerForms: ReadonlyArray<PerseusExpressionAnswerForm>;
|
|
69
|
-
functions: ReadonlyArray<string>;
|
|
70
|
-
};
|
|
71
|
-
export type PerseusExpressionUserInput = string;
|
|
72
|
-
export type PerseusGroupRubric = PerseusGroupWidgetOptions;
|
|
73
|
-
export type PerseusGroupValidationData = {
|
|
74
|
-
widgets: ValidationDataMap;
|
|
75
|
-
};
|
|
76
|
-
export type PerseusGroupUserInput = UserInputMap;
|
|
77
|
-
export type PerseusGradedGroupRubric = PerseusGradedGroupWidgetOptions;
|
|
78
|
-
export type PerseusGradedGroupSetRubric = PerseusGradedGroupSetWidgetOptions;
|
|
79
|
-
export type PerseusGrapherRubric = {
|
|
80
|
-
correct: GrapherAnswerTypes;
|
|
81
|
-
};
|
|
82
|
-
export type PerseusGrapherUserInput = PerseusGrapherRubric["correct"];
|
|
83
|
-
export type PerseusIFrameUserInput = {
|
|
84
|
-
status: UserInputStatus;
|
|
85
|
-
message: string | null;
|
|
86
|
-
};
|
|
87
|
-
export type PerseusInputNumberRubric = {
|
|
88
|
-
answerType?: "number" | "decimal" | "integer" | "rational" | "improper" | "mixed" | "percent" | "pi";
|
|
89
|
-
inexact?: boolean;
|
|
90
|
-
maxError?: number | string;
|
|
91
|
-
simplify: "required" | "optional" | "enforced";
|
|
92
|
-
value: string | number;
|
|
93
|
-
};
|
|
94
|
-
export type PerseusInputNumberUserInput = {
|
|
95
|
-
currentValue: string;
|
|
96
|
-
};
|
|
97
|
-
export type PerseusInteractiveGraphRubric = {
|
|
98
|
-
correct: PerseusGraphCorrectType;
|
|
99
|
-
graph: PerseusGraphType;
|
|
100
|
-
};
|
|
101
|
-
export type PerseusInteractiveGraphUserInput = PerseusGraphType;
|
|
102
|
-
export type PerseusLabelImageRubric = {
|
|
103
|
-
markers: ReadonlyArray<{
|
|
104
|
-
answers: ReadonlyArray<string>;
|
|
105
|
-
label: string;
|
|
106
|
-
}>;
|
|
107
|
-
};
|
|
108
|
-
export type PerseusLabelImageUserInput = {
|
|
109
|
-
markers: ReadonlyArray<{
|
|
110
|
-
selected?: ReadonlyArray<string>;
|
|
111
|
-
label: string;
|
|
112
|
-
}>;
|
|
113
|
-
};
|
|
114
|
-
export type PerseusMatcherRubric = {
|
|
115
|
-
left: ReadonlyArray<string>;
|
|
116
|
-
right: ReadonlyArray<string>;
|
|
117
|
-
};
|
|
118
|
-
export type PerseusMatcherUserInput = {
|
|
119
|
-
left: ReadonlyArray<string>;
|
|
120
|
-
right: ReadonlyArray<string>;
|
|
121
|
-
};
|
|
122
|
-
export type PerseusMatrixRubric = {
|
|
123
|
-
answers: PerseusMatrixWidgetAnswers;
|
|
124
|
-
} & PerseusMatrixValidationData;
|
|
125
|
-
export type PerseusMatrixValidationData = Empty;
|
|
126
|
-
export type PerseusMatrixUserInput = {
|
|
127
|
-
answers: PerseusMatrixRubric["answers"];
|
|
128
|
-
};
|
|
129
|
-
export type PerseusNumberLineRubric = {
|
|
130
|
-
correctRel: string | null | undefined;
|
|
131
|
-
correctX: number;
|
|
132
|
-
range: ReadonlyArray<number>;
|
|
133
|
-
initialX: number | null | undefined;
|
|
134
|
-
isInequality: boolean;
|
|
135
|
-
};
|
|
136
|
-
export type PerseusNumberLineUserInput = {
|
|
137
|
-
isTickCrtl?: boolean;
|
|
138
|
-
numLinePosition: number;
|
|
139
|
-
rel: Relationship | "eq";
|
|
140
|
-
numDivisions: number;
|
|
141
|
-
divisionRange: ReadonlyArray<number>;
|
|
142
|
-
};
|
|
143
|
-
export type PerseusNumericInputRubric = {
|
|
144
|
-
answers: ReadonlyArray<PerseusNumericInputAnswer>;
|
|
145
|
-
coefficient: boolean;
|
|
146
|
-
};
|
|
147
|
-
export type PerseusNumericInputUserInput = {
|
|
148
|
-
currentValue: string;
|
|
149
|
-
};
|
|
150
|
-
export type PerseusOrdererRubric = PerseusOrdererWidgetOptions;
|
|
151
|
-
export type PerseusOrdererUserInput = {
|
|
152
|
-
current: ReadonlyArray<string>;
|
|
153
|
-
};
|
|
154
|
-
export type PerseusPlotterRubric = {
|
|
155
|
-
correct: ReadonlyArray<number>;
|
|
156
|
-
} & PerseusPlotterValidationData;
|
|
157
|
-
export type PerseusPlotterValidationData = {
|
|
158
|
-
starting: ReadonlyArray<number>;
|
|
159
|
-
};
|
|
160
|
-
export type PerseusPlotterUserInput = ReadonlyArray<number>;
|
|
161
|
-
export type PerseusRadioRubric = {
|
|
162
|
-
choices: ReadonlyArray<PerseusRadioChoice>;
|
|
163
|
-
};
|
|
164
|
-
export type PerseusRadioUserInput = {
|
|
165
|
-
choicesSelected: ReadonlyArray<boolean>;
|
|
166
|
-
};
|
|
167
|
-
export type PerseusSorterRubric = {
|
|
168
|
-
correct: ReadonlyArray<string>;
|
|
169
|
-
};
|
|
170
|
-
export type PerseusSorterUserInput = {
|
|
171
|
-
options: ReadonlyArray<string>;
|
|
172
|
-
changed: boolean;
|
|
173
|
-
};
|
|
174
|
-
export type PerseusTableRubric = {
|
|
175
|
-
answers: ReadonlyArray<ReadonlyArray<string>>;
|
|
176
|
-
};
|
|
177
|
-
export type PerseusTableUserInput = ReadonlyArray<ReadonlyArray<string>>;
|
|
178
|
-
export interface RubricRegistry {
|
|
179
|
-
categorizer: PerseusCategorizerRubric;
|
|
180
|
-
dropdown: PerseusDropdownRubric;
|
|
181
|
-
expression: PerseusExpressionRubric;
|
|
182
|
-
"graded-group-set": PerseusGradedGroupSetRubric;
|
|
183
|
-
"graded-group": PerseusGradedGroupRubric;
|
|
184
|
-
grapher: PerseusGrapherRubric;
|
|
185
|
-
group: PerseusGroupRubric;
|
|
186
|
-
image: PerseusLabelImageRubric;
|
|
187
|
-
"input-number": PerseusInputNumberRubric;
|
|
188
|
-
"interactive-graph": PerseusInteractiveGraphRubric;
|
|
189
|
-
"label-image": PerseusLabelImageRubric;
|
|
190
|
-
matcher: PerseusMatcherRubric;
|
|
191
|
-
matrix: PerseusMatrixRubric;
|
|
192
|
-
"number-line": PerseusNumberLineRubric;
|
|
193
|
-
"numeric-input": PerseusNumericInputRubric;
|
|
194
|
-
orderer: PerseusOrdererRubric;
|
|
195
|
-
plotter: PerseusPlotterRubric;
|
|
196
|
-
radio: PerseusRadioRubric;
|
|
197
|
-
sorter: PerseusSorterRubric;
|
|
198
|
-
table: PerseusTableRubric;
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* A map of scoring data (previously referred to as "rubric"), keyed by
|
|
202
|
-
* `widgetId`. This data is used to score a learner's guess for a PerseusItem.
|
|
203
|
-
*
|
|
204
|
-
* NOTE: The value in this map is intentionally a subset of WidgetOptions<T>.
|
|
205
|
-
* By using the same shape (minus any unneeded render data), we are able to
|
|
206
|
-
* share functionality that understands how to traverse maps of `widget id` to
|
|
207
|
-
* `options`.
|
|
208
|
-
*/
|
|
209
|
-
export type RubricMap = {
|
|
210
|
-
[Property in keyof RubricRegistry as `${Property} ${number}`]: {
|
|
211
|
-
type: Property;
|
|
212
|
-
static?: boolean;
|
|
213
|
-
options: RubricRegistry[Property];
|
|
214
|
-
};
|
|
215
|
-
};
|
|
216
|
-
export type Rubric = RubricRegistry[keyof RubricRegistry];
|
|
217
|
-
/**
|
|
218
|
-
* This is an interface so that it can be extended if a widget is created
|
|
219
|
-
* outside of this Perseus package. See `PerseusWidgetTypes` for a full
|
|
220
|
-
* explanation.
|
|
221
|
-
*/
|
|
222
|
-
interface UserInputRegistry {
|
|
223
|
-
categorizer: PerseusCategorizerUserInput;
|
|
224
|
-
"cs-program": PerseusCSProgramUserInput;
|
|
225
|
-
dropdown: PerseusDropdownUserInput;
|
|
226
|
-
expression: PerseusExpressionUserInput;
|
|
227
|
-
grapher: PerseusGrapherUserInput;
|
|
228
|
-
group: PerseusGroupUserInput;
|
|
229
|
-
iframe: PerseusIFrameUserInput;
|
|
230
|
-
"input-number": PerseusInputNumberUserInput;
|
|
231
|
-
"interactive-graph": PerseusInteractiveGraphUserInput;
|
|
232
|
-
"label-image": PerseusLabelImageUserInput;
|
|
233
|
-
matcher: PerseusMatcherUserInput;
|
|
234
|
-
matrix: PerseusMatrixUserInput;
|
|
235
|
-
"number-line": PerseusNumberLineUserInput;
|
|
236
|
-
"numeric-input": PerseusNumericInputUserInput;
|
|
237
|
-
orderer: PerseusOrdererUserInput;
|
|
238
|
-
plotter: PerseusPlotterUserInput;
|
|
239
|
-
radio: PerseusRadioUserInput;
|
|
240
|
-
sorter: PerseusSorterUserInput;
|
|
241
|
-
table: PerseusTableUserInput;
|
|
242
|
-
}
|
|
243
|
-
/** A union type of all the widget user input types */
|
|
244
|
-
export type UserInput = UserInputRegistry[keyof UserInputRegistry];
|
|
245
|
-
/**
|
|
246
|
-
* A map of widget IDs to user input types (strongly typed based on the format
|
|
247
|
-
* of the widget ID).
|
|
248
|
-
*/
|
|
249
|
-
export type UserInputMap = MakeWidgetMap<UserInputRegistry>;
|
|
250
|
-
/**
|
|
251
|
-
* deprecated prefer using UserInputMap
|
|
252
|
-
*/
|
|
253
|
-
export type UserInputArray = ReadonlyArray<UserInputArray | UserInput | null | undefined>;
|
|
254
|
-
export interface ValidationDataTypes {
|
|
255
|
-
categorizer: PerseusCategorizerValidationData;
|
|
256
|
-
group: PerseusGroupValidationData;
|
|
257
|
-
plotter: PerseusPlotterValidationData;
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* A map of validation data, keyed by `widgetId`. This data is used to check if
|
|
261
|
-
* a question is answerable. This data represents the minimal intersection of
|
|
262
|
-
* data that's available in the client (widget options) and server (scoring
|
|
263
|
-
* data) and is represented by a group of types known as "validation data".
|
|
264
|
-
*
|
|
265
|
-
* NOTE: The value in this map is intentionally a subset of WidgetOptions<T>.
|
|
266
|
-
* By using the same shape (minus any unneeded data), we are able to pass a
|
|
267
|
-
* `PerseusWidgetsMap` or ` into any function that accepts a
|
|
268
|
-
* `ValidationDataMap` without any mutation of data.
|
|
269
|
-
*/
|
|
270
|
-
export type ValidationDataMap = {
|
|
271
|
-
[Property in keyof ValidationDataTypes as `${Property} ${number}`]: {
|
|
272
|
-
type: Property;
|
|
273
|
-
static?: boolean;
|
|
274
|
-
options: ValidationDataTypes[Property];
|
|
275
|
-
};
|
|
276
|
-
};
|
|
277
|
-
/**
|
|
278
|
-
* A union type of all the different widget validation data types that exist.
|
|
279
|
-
*/
|
|
280
|
-
export type ValidationData = ValidationDataTypes[keyof ValidationDataTypes];
|
|
281
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|