@khanacademy/perseus-core 3.6.0 → 4.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.
@@ -1,3 +1,4 @@
1
1
  import type { InteractiveGraphWidget } from "../../data-schema";
2
2
  import type { Parser } from "../parser-types";
3
+ export declare const parseLockedFunctionDomain: Parser<[number, number]>;
3
4
  export declare const parseInteractiveGraphWidget: Parser<InteractiveGraphWidget>;
@@ -0,0 +1,2 @@
1
+ import type { PerseusAnswerArea } from "@khanacademy/perseus-core";
2
+ export declare const parsePerseusAnswerArea: import("../parser-types").Parser<PerseusAnswerArea>;
@@ -0,0 +1,5 @@
1
+ type RNG = () => number;
2
+ export declare const seededRNG: (seed: number) => RNG;
3
+ export declare function shuffle<T>(array: ReadonlyArray<T>, randomSeed: number | RNG, ensurePermuted?: boolean): ReadonlyArray<T>;
4
+ export declare const random: RNG;
5
+ export {};
@@ -3,7 +3,7 @@ import type { PerseusDropdownWidgetOptions } from "@khanacademy/perseus-core";
3
3
  * For details on the individual options, see the
4
4
  * PerseusDropdownWidgetOptions type
5
5
  */
6
- type DropdownPublicWidgetOptions = {
6
+ export type DropdownPublicWidgetOptions = {
7
7
  choices: ReadonlyArray<{
8
8
  content: string;
9
9
  }>;
@@ -1,5 +1,5 @@
1
1
  import type { PerseusGroupWidgetOptions } from "../../data-schema";
2
2
  import type { WidgetLogic } from "../logic-export.types";
3
- export type GroupDefaultWidgetOptions = Pick<PerseusGroupWidgetOptions, "content" | "widgets" | "images" | "metadata">;
3
+ export type GroupDefaultWidgetOptions = Pick<PerseusGroupWidgetOptions, "content" | "widgets" | "images">;
4
4
  declare const groupWidgetLogic: WidgetLogic;
5
5
  export default groupWidgetLogic;
@@ -1,4 +1,3 @@
1
1
  import type { PerseusInteractiveGraphWidgetOptions } from "@khanacademy/perseus-core";
2
- type InteractiveGraphPublicWidgetOptions = Pick<PerseusInteractiveGraphWidgetOptions, "step" | "gridStep" | "snapStep" | "backgroundImage" | "markings" | "labels" | "showProtractor" | "showRuler" | "showTooltips" | "rulerLabel" | "rulerTicks" | "range" | "graph" | "lockedFigures" | "fullGraphAriaLabel" | "fullGraphAriaDescription">;
2
+ export type InteractiveGraphPublicWidgetOptions = Pick<PerseusInteractiveGraphWidgetOptions, "step" | "gridStep" | "snapStep" | "backgroundImage" | "markings" | "labels" | "showProtractor" | "showRuler" | "showTooltips" | "rulerLabel" | "rulerTicks" | "range" | "graph" | "lockedFigures" | "fullGraphAriaLabel" | "fullGraphAriaDescription">;
3
3
  export default function getInteractiveGraphPublicWidgetOptions(options: PerseusInteractiveGraphWidgetOptions): InteractiveGraphPublicWidgetOptions;
4
- export {};
@@ -6,6 +6,7 @@ import type getGrapherPublicWidgetOptions from "./grapher/grapher-util";
6
6
  import type getIFramePublicWidgetOptions from "./iframe/iframe-util";
7
7
  import type getInteractiveGraphPublicWidgetOptions from "./interactive-graph/interactive-graph-util";
8
8
  import type getLabelImagePublicWidgetOptions from "./label-image/label-image-util";
9
+ import type getMatcherPublicWidgetOptions from "./matcher/matcher-util";
9
10
  import type getMatrixPublicWidgetOptions from "./matrix/matrix-util";
10
11
  import type getNumberLinePublicWidgetOptions from "./number-line/number-line-util";
11
12
  import type getNumericInputPublicWidgetOptions from "./numeric-input/numeric-input-util";
@@ -25,7 +26,7 @@ export type WidgetOptionsUpgradeMap = {
25
26
  * TODO(LEMS-2870): figure out how to make this generic so we don't need to be
26
27
  * so reliant on a set group of widgets
27
28
  */
28
- export type PublicWidgetOptionsFunction = typeof getPlotterPublicWidgetOptions | typeof getIFramePublicWidgetOptions | typeof getRadioPublicWidgetOptions | typeof getNumericInputPublicWidgetOptions | typeof getDropdownPublicWidgetOptions | typeof getCategorizerPublicWidgetOptions | typeof getOrdererPublicWidgetOptions | typeof getExpressionPublicWidgetOptions | typeof getInteractiveGraphPublicWidgetOptions | typeof getLabelImagePublicWidgetOptions | typeof getSorterPublicWidgetOptions | typeof getCSProgramPublicWidgetOptions | typeof getNumberLinePublicWidgetOptions | typeof getTablePublicWidgetOptions | typeof getGrapherPublicWidgetOptions | typeof getMatrixPublicWidgetOptions;
29
+ export type PublicWidgetOptionsFunction = typeof getMatcherPublicWidgetOptions | typeof getPlotterPublicWidgetOptions | typeof getIFramePublicWidgetOptions | typeof getRadioPublicWidgetOptions | typeof getNumericInputPublicWidgetOptions | typeof getDropdownPublicWidgetOptions | typeof getCategorizerPublicWidgetOptions | typeof getOrdererPublicWidgetOptions | typeof getExpressionPublicWidgetOptions | typeof getInteractiveGraphPublicWidgetOptions | typeof getLabelImagePublicWidgetOptions | typeof getSorterPublicWidgetOptions | typeof getCSProgramPublicWidgetOptions | typeof getNumberLinePublicWidgetOptions | typeof getTablePublicWidgetOptions | typeof getGrapherPublicWidgetOptions | typeof getMatrixPublicWidgetOptions;
29
30
  export type WidgetLogic = {
30
31
  name: string;
31
32
  version?: Version;
@@ -0,0 +1,28 @@
1
+ import type { PerseusMatcherWidgetOptions } from "@khanacademy/perseus-core";
2
+ type MatcherInfo = {
3
+ left: ReadonlyArray<string>;
4
+ right: ReadonlyArray<string>;
5
+ orderMatters: boolean;
6
+ problemNum: number | null | undefined;
7
+ };
8
+ export declare const shuffleMatcher: (props: MatcherInfo) => {
9
+ left: ReadonlyArray<string>;
10
+ right: ReadonlyArray<string>;
11
+ };
12
+ /**
13
+ * For details on the individual options, see the
14
+ * PerseusMatcherWidgetOptions type
15
+ */
16
+ type MatcherPublicWidgetOptions = {
17
+ labels: PerseusMatcherWidgetOptions["labels"];
18
+ left: PerseusMatcherWidgetOptions["left"];
19
+ right: PerseusMatcherWidgetOptions["right"];
20
+ orderMatters: PerseusMatcherWidgetOptions["orderMatters"];
21
+ padding: PerseusMatcherWidgetOptions["padding"];
22
+ };
23
+ /**
24
+ * Given a PerseusMatcherWidgetOptions object, return a new object with only
25
+ * the public options that should be exposed to the client.
26
+ */
27
+ declare function getMatcherPublicWidgetOptions(options: PerseusMatcherWidgetOptions): MatcherPublicWidgetOptions;
28
+ export default getMatcherPublicWidgetOptions;
@@ -1,4 +1,5 @@
1
- import type { PerseusNumericInputWidgetOptions } from "@khanacademy/perseus-core";
1
+ import type { PerseusNumericInputAnswer, PerseusNumericInputWidgetOptions } from "@khanacademy/perseus-core";
2
+ type NumericInputAnswerPublicData = Pick<PerseusNumericInputAnswer, "answerForms" | "simplify" | "status">;
2
3
  /**
3
4
  * For details on the individual options, see the
4
5
  * PerseusNumericInputWidgetOptions type
@@ -9,7 +10,7 @@ type NumericInputPublicWidgetOptions = {
9
10
  coefficient: PerseusNumericInputWidgetOptions["coefficient"];
10
11
  rightAlign?: PerseusNumericInputWidgetOptions["rightAlign"];
11
12
  static: PerseusNumericInputWidgetOptions["static"];
12
- answerForms?: PerseusNumericInputWidgetOptions["answerForms"];
13
+ answers: ReadonlyArray<NumericInputAnswerPublicData>;
13
14
  };
14
15
  /**
15
16
  * Given a PerseusNumericInputWidgetOptions object, return a new object with only
@@ -7,6 +7,7 @@ type SorterPublicWidgetOptions = {
7
7
  correct: PerseusSorterWidgetOptions["correct"];
8
8
  padding: PerseusSorterWidgetOptions["padding"];
9
9
  layout: PerseusSorterWidgetOptions["layout"];
10
+ isCorrectShuffled: boolean;
10
11
  };
11
12
  /**
12
13
  * Given a PerseusSorterWidgetOptions object, return a new object with only
package/package.json CHANGED
@@ -1,34 +1,35 @@
1
1
  {
2
- "name": "@khanacademy/perseus-core",
3
- "description": "Shared Perseus infrastructure",
4
- "author": "Khan Academy",
5
- "license": "MIT",
6
- "version": "3.6.0",
7
- "publishConfig": {
8
- "access": "public"
9
- },
10
- "repository": {
11
- "type": "git",
12
- "url": "https://github.com/Khan/perseus.git",
13
- "directory": "packages/perseus-core"
14
- },
15
- "bugs": {
16
- "url": "https://github.com/Khan/perseus/issues"
17
- },
18
- "module": "dist/es/index.js",
19
- "main": "dist/index.js",
20
- "source": "src/index.ts",
21
- "files": [
22
- "dist"
23
- ],
24
- "scripts": {
25
- "prepublishOnly": "../../utils/package-pre-publish-check.sh",
26
- "test": "bash -c 'yarn --silent --cwd \"../..\" test ${@:0} $($([[ ${@: -1} = -* ]] || [[ ${@: -1} = bash ]]) && echo $PWD)'"
27
- },
28
- "dependencies": {},
29
- "devDependencies": {
30
- "@khanacademy/wonder-stuff-core": "1.5.4"
31
- },
32
- "peerDependencies": {},
33
- "keywords": []
2
+ "name": "@khanacademy/perseus-core",
3
+ "description": "Shared Perseus infrastructure",
4
+ "author": "Khan Academy",
5
+ "license": "MIT",
6
+ "version": "4.0.0",
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/Khan/perseus.git",
13
+ "directory": "packages/perseus-core"
14
+ },
15
+ "bugs": {
16
+ "url": "https://github.com/Khan/perseus/issues"
17
+ },
18
+ "module": "dist/es/index.js",
19
+ "main": "dist/index.js",
20
+ "source": "src/index.ts",
21
+ "files": [
22
+ "dist"
23
+ ],
24
+ "dependencies": {},
25
+ "devDependencies": {
26
+ "@khanacademy/wonder-stuff-core": "1.5.4",
27
+ "underscore": "^1.4.4"
28
+ },
29
+ "peerDependencies": {
30
+ "@khanacademy/wonder-stuff-core": "1.5.4",
31
+ "underscore": "^1.4.4"
32
+ },
33
+ "keywords": [],
34
+ "scripts": {}
34
35
  }