@khanacademy/perseus-core 11.0.0 → 12.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.
@@ -0,0 +1,3 @@
1
+ import type { FreeResponseWidget } from "../../data-schema";
2
+ import type { Parser } from "../parser-types";
3
+ export declare const parseFreeResponseWidget: Parser<FreeResponseWidget>;
@@ -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 } from "./data-schema";
31
+ import type { GrapherAnswerTypes, PerseusDropdownChoice, PerseusExpressionAnswerForm, PerseusGradedGroupSetWidgetOptions, PerseusGradedGroupWidgetOptions, PerseusGraphType, PerseusGroupWidgetOptions, PerseusMatrixWidgetAnswers, PerseusNumericInputAnswer, PerseusOrdererWidgetOptions, PerseusRadioChoice, PerseusGraphCorrectType, MakeWidgetMap, PerseusFreeResponseWidgetScoringCriterion } from "./data-schema";
32
32
  import type { Relationship } from "./types";
33
33
  export type WidgetValidatorFunction = (userInput: UserInput, validationData: ValidationData, locale: string) => ValidationResult;
34
34
  export type WidgetScorerFunction = (userInput: UserInput, rubric: Rubric, locale?: string) => PerseusScore;
@@ -148,6 +148,13 @@ export type PerseusNumericInputRubric = {
148
148
  export type PerseusNumericInputUserInput = {
149
149
  currentValue: string;
150
150
  };
151
+ export type PerseusFreeResponseUserInput = {
152
+ currentValue: string;
153
+ };
154
+ export type PerseusFreeResponseRubric = {
155
+ question: string;
156
+ scoringCriteria: ReadonlyArray<PerseusFreeResponseWidgetScoringCriterion>;
157
+ };
151
158
  export type PerseusOrdererRubric = PerseusOrdererWidgetOptions;
152
159
  export type PerseusOrdererUserInput = {
153
160
  current: string[];
@@ -225,6 +232,7 @@ interface UserInputRegistry {
225
232
  "cs-program": PerseusCSProgramUserInput;
226
233
  dropdown: PerseusDropdownUserInput;
227
234
  expression: PerseusExpressionUserInput;
235
+ "free-response": PerseusFreeResponseUserInput;
228
236
  grapher: PerseusGrapherUserInput;
229
237
  group: PerseusGroupUserInput;
230
238
  iframe: PerseusIFrameUserInput;
@@ -0,0 +1,17 @@
1
+ import type { PerseusFreeResponseWidgetOptions } from "../../data-schema";
2
+ /**
3
+ * For details on the individual options, see the
4
+ * {@link PerseusFreeResponseWidgetOptions} type
5
+ */
6
+ export type FreeResponsePublicWidgetOptions = {
7
+ allowUnlimitedCharacters: PerseusFreeResponseWidgetOptions["allowUnlimitedCharacters"];
8
+ characterLimit: PerseusFreeResponseWidgetOptions["characterLimit"];
9
+ placeholder: PerseusFreeResponseWidgetOptions["placeholder"];
10
+ question: PerseusFreeResponseWidgetOptions["question"];
11
+ };
12
+ /**
13
+ * Given a FreeResponsePublicWidgetOptions object, return a new object with only
14
+ * the public options that should be exposed to the client.
15
+ */
16
+ declare function getFreeResponsePublicWidgetOptions(options: PerseusFreeResponseWidgetOptions): FreeResponsePublicWidgetOptions;
17
+ export default getFreeResponsePublicWidgetOptions;
@@ -0,0 +1,5 @@
1
+ import type { PerseusFreeResponseWidgetOptions } from "../../data-schema";
2
+ import type { WidgetLogic } from "../logic-export.types";
3
+ export type FreeResponseDefaultWidgetOptions = Pick<PerseusFreeResponseWidgetOptions, "allowUnlimitedCharacters" | "characterLimit" | "placeholder" | "question" | "scoringCriteria">;
4
+ declare const freeResponseWidgetLogic: WidgetLogic;
5
+ export default freeResponseWidgetLogic;
@@ -2,6 +2,7 @@ import type getCategorizerPublicWidgetOptions from "./categorizer/categorizer-ut
2
2
  import type getCSProgramPublicWidgetOptions from "./cs-program/cs-program-util";
3
3
  import type getDropdownPublicWidgetOptions from "./dropdown/dropdown-util";
4
4
  import type getExpressionPublicWidgetOptions from "./expression/expression-util";
5
+ import type getFreeResponsePublicWidgetOptions from "./free-response/free-response-util";
5
6
  import type getGrapherPublicWidgetOptions from "./grapher/grapher-util";
6
7
  import type getGroupPublicWidgetOptions from "./group/group-util";
7
8
  import type getIFramePublicWidgetOptions from "./iframe/iframe-util";
@@ -28,7 +29,7 @@ export type WidgetOptionsUpgradeMap = {
28
29
  * TODO(LEMS-2870): figure out how to make this generic so we don't need to be
29
30
  * so reliant on a set group of widgets
30
31
  */
31
- export type PublicWidgetOptionsFunction = typeof getCategorizerPublicWidgetOptions | typeof getCSProgramPublicWidgetOptions | typeof getDropdownPublicWidgetOptions | typeof getExpressionPublicWidgetOptions | typeof getGrapherPublicWidgetOptions | typeof getGroupPublicWidgetOptions | typeof getIFramePublicWidgetOptions | typeof getInputNumberPublicWidgetOptions | typeof getInteractiveGraphPublicWidgetOptions | typeof getLabelImagePublicWidgetOptions | typeof getMatcherPublicWidgetOptions | typeof getMatrixPublicWidgetOptions | typeof getNumberLinePublicWidgetOptions | typeof getNumericInputPublicWidgetOptions | typeof getOrdererPublicWidgetOptions | typeof getPlotterPublicWidgetOptions | typeof getRadioPublicWidgetOptions | typeof getSorterPublicWidgetOptions | typeof getTablePublicWidgetOptions;
32
+ export type PublicWidgetOptionsFunction = typeof getCategorizerPublicWidgetOptions | typeof getCSProgramPublicWidgetOptions | typeof getDropdownPublicWidgetOptions | typeof getExpressionPublicWidgetOptions | typeof getFreeResponsePublicWidgetOptions | typeof getGrapherPublicWidgetOptions | typeof getGroupPublicWidgetOptions | typeof getIFramePublicWidgetOptions | typeof getInputNumberPublicWidgetOptions | typeof getInteractiveGraphPublicWidgetOptions | typeof getLabelImagePublicWidgetOptions | typeof getMatcherPublicWidgetOptions | typeof getMatrixPublicWidgetOptions | typeof getNumberLinePublicWidgetOptions | typeof getNumericInputPublicWidgetOptions | typeof getOrdererPublicWidgetOptions | typeof getPlotterPublicWidgetOptions | typeof getRadioPublicWidgetOptions | typeof getSorterPublicWidgetOptions | typeof getTablePublicWidgetOptions;
32
33
  export type WidgetLogic = {
33
34
  name: string;
34
35
  version?: Version;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Shared Perseus infrastructure",
4
4
  "author": "Khan Academy",
5
5
  "license": "MIT",
6
- "version": "11.0.0",
6
+ "version": "12.0.0",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },