@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.
- package/LICENSE +18 -0
- package/dist/data-schema.d.ts +25 -7
- package/dist/es/index.js +262 -2140
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +293 -2147
- package/dist/index.js.map +1 -1
- package/dist/parse-perseus-json/perseus-parsers/interactive-graph-widget.d.ts +1 -0
- package/dist/parse-perseus-json/perseus-parsers/perseus-answer-area.d.ts +2 -0
- package/dist/utils/random-util.d.ts +5 -0
- package/dist/widgets/dropdown/dropdown-util.d.ts +1 -1
- package/dist/widgets/group/index.d.ts +1 -1
- package/dist/widgets/interactive-graph/interactive-graph-util.d.ts +1 -2
- package/dist/widgets/logic-export.types.d.ts +2 -1
- package/dist/widgets/matcher/matcher-util.d.ts +28 -0
- package/dist/widgets/numeric-input/numeric-input-util.d.ts +3 -2
- package/dist/widgets/sorter/sorter-util.d.ts +1 -0
- package/package.json +33 -32
- /package/dist/{utils → shared-utils}/add-library-version-to-perseus-debug.d.ts +0 -0
|
@@ -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"
|
|
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
|
-
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
}
|
|
File without changes
|