@khanacademy/perseus-core 34.1.0 → 36.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/data-schema.d.ts +16 -3
- package/dist/es/index.item-splitting.js +7 -5
- package/dist/es/index.item-splitting.js.map +1 -1
- package/dist/es/index.js +20 -8
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.item-splitting.js +7 -5
- package/dist/index.item-splitting.js.map +1 -1
- package/dist/index.js +27 -7
- package/dist/index.js.map +1 -1
- package/dist/parse-perseus-json/general-purpose-parsers/object.d.ts +0 -19
- package/dist/parse-perseus-json/perseus-parsers/blank-user-input.d.ts +3 -0
- package/dist/parse-perseus-json/perseus-parsers/blank-user-input.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/perseus-parsers/blank-widget.d.ts +15 -0
- package/dist/parse-perseus-json/perseus-parsers/categorizer-widget.d.ts +18 -7
- package/dist/parse-perseus-json/perseus-parsers/cs-program-widget.d.ts +22 -11
- package/dist/parse-perseus-json/perseus-parsers/definition-widget.d.ts +16 -5
- package/dist/parse-perseus-json/perseus-parsers/dropdown-widget.d.ts +21 -10
- package/dist/parse-perseus-json/perseus-parsers/explanation-widget.d.ts +18 -7
- package/dist/parse-perseus-json/perseus-parsers/expression-widget.d.ts +27 -16
- package/dist/parse-perseus-json/perseus-parsers/graded-group-set-widget.d.ts +26 -15
- package/dist/parse-perseus-json/perseus-parsers/graded-group-widget.d.ts +24 -13
- package/dist/parse-perseus-json/perseus-parsers/grapher-widget.d.ts +60 -49
- package/dist/parse-perseus-json/perseus-parsers/group-widget.d.ts +12 -1
- package/dist/parse-perseus-json/perseus-parsers/iframe-widget.d.ts +23 -12
- package/dist/parse-perseus-json/perseus-parsers/image-widget.d.ts +34 -23
- package/dist/parse-perseus-json/perseus-parsers/input-number-widget.d.ts +45 -23
- package/dist/parse-perseus-json/perseus-parsers/interaction-widget.d.ts +135 -124
- package/dist/parse-perseus-json/perseus-parsers/interactive-graph-widget.d.ts +375 -364
- package/dist/parse-perseus-json/perseus-parsers/label-image-widget.d.ts +27 -16
- package/dist/parse-perseus-json/perseus-parsers/matcher-widget.d.ts +18 -7
- package/dist/parse-perseus-json/perseus-parsers/matrix-widget.d.ts +17 -6
- package/dist/parse-perseus-json/perseus-parsers/measurer-widget.d.ts +28 -17
- package/dist/parse-perseus-json/perseus-parsers/number-line-widget.d.ts +28 -17
- package/dist/parse-perseus-json/perseus-parsers/numeric-input-widget.d.ts +26 -15
- package/dist/parse-perseus-json/perseus-parsers/orderer-widget.d.ts +18 -7
- package/dist/parse-perseus-json/perseus-parsers/phet-simulation-widget.d.ts +15 -4
- package/dist/parse-perseus-json/perseus-parsers/plotter-widget.d.ts +26 -15
- package/dist/parse-perseus-json/perseus-parsers/python-program-widget.d.ts +15 -4
- package/dist/parse-perseus-json/perseus-parsers/radio-widget.d.ts +138 -83
- package/dist/parse-perseus-json/perseus-parsers/sorter-widget.d.ts +16 -5
- package/dist/parse-perseus-json/perseus-parsers/table-widget.d.ts +17 -6
- package/dist/parse-perseus-json/perseus-parsers/video-widget.d.ts +14 -3
- package/dist/parse-perseus-json/perseus-parsers/widget.d.ts +25 -4
- package/dist/types.d.ts +0 -1
- package/dist/utils/generators/blank-widget-generator.d.ts +3 -0
- package/dist/utils/generators/number-line-widget-generator.d.ts +3 -0
- package/dist/utils/generators/orderer-widget-generator.d.ts +9 -0
- package/dist/validation.types.d.ts +13 -0
- package/dist/widgets/blank/blank-util.d.ts +7 -0
- package/dist/widgets/blank/index.d.ts +5 -0
- package/dist/widgets/core-widget-registry.d.ts +1 -2
- package/dist/widgets/logic-export.types.d.ts +1 -2
- package/package.json +1 -1
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
export declare const parseVideoWidget: import("../parser-types").Parser<import("
|
|
2
|
-
|
|
1
|
+
export declare const parseVideoWidget: import("../parser-types").Parser<import("../general-purpose-parsers/object-types").OptionalizeProperties<{
|
|
2
|
+
type: "video";
|
|
3
3
|
static: boolean | undefined;
|
|
4
|
-
|
|
4
|
+
graded: boolean | undefined;
|
|
5
|
+
alignment: "default" | "block" | "inline-block" | "inline" | "wrap-left" | "wrap-right" | "full-width" | undefined;
|
|
6
|
+
options: import("../general-purpose-parsers/object-types").OptionalizeProperties<{
|
|
7
|
+
location: string;
|
|
8
|
+
static: boolean | undefined;
|
|
9
|
+
}>;
|
|
10
|
+
key: number | null | undefined;
|
|
11
|
+
version: import("../general-purpose-parsers/object-types").OptionalizeProperties<{
|
|
12
|
+
major: number;
|
|
13
|
+
minor: number;
|
|
14
|
+
}> | undefined;
|
|
15
|
+
}>>;
|
|
@@ -1,7 +1,28 @@
|
|
|
1
|
-
import type { WidgetOptions } from "../../data-schema";
|
|
2
1
|
import type { Parser } from "../parser-types";
|
|
3
|
-
export declare function parseWidget<Type extends string, Options extends object>(parseType: Parser<Type>, parseOptions: Parser<Options>): Parser<
|
|
4
|
-
|
|
2
|
+
export declare function parseWidget<Type extends string, Options extends object>(parseType: Parser<Type>, parseOptions: Parser<Options>): Parser<import("../general-purpose-parsers/object-types").OptionalizeProperties<{
|
|
3
|
+
type: Type;
|
|
4
|
+
static: boolean | undefined;
|
|
5
|
+
graded: boolean | undefined;
|
|
6
|
+
alignment: "default" | "block" | "inline-block" | "inline" | "wrap-left" | "wrap-right" | "full-width" | undefined;
|
|
7
|
+
options: Options;
|
|
8
|
+
key: number | null | undefined;
|
|
9
|
+
version: import("../general-purpose-parsers/object-types").OptionalizeProperties<{
|
|
10
|
+
major: number;
|
|
11
|
+
minor: number;
|
|
12
|
+
}> | undefined;
|
|
13
|
+
}>>;
|
|
14
|
+
export declare function parseWidgetWithVersion<Type extends string, Options extends object>(parseVersion: Parser<{
|
|
5
15
|
major: number;
|
|
6
16
|
minor: number;
|
|
7
|
-
} | undefined
|
|
17
|
+
} | undefined>, parseType: Parser<Type>, parseOptions: Parser<Options>): Parser<import("../general-purpose-parsers/object-types").OptionalizeProperties<{
|
|
18
|
+
type: Type;
|
|
19
|
+
static: boolean | undefined;
|
|
20
|
+
graded: boolean | undefined;
|
|
21
|
+
alignment: "default" | "block" | "inline-block" | "inline" | "wrap-left" | "wrap-right" | "full-width" | undefined;
|
|
22
|
+
options: Options;
|
|
23
|
+
key: number | null | undefined;
|
|
24
|
+
version: {
|
|
25
|
+
major: number;
|
|
26
|
+
minor: number;
|
|
27
|
+
} | undefined;
|
|
28
|
+
}>>;
|
package/dist/types.d.ts
CHANGED
|
@@ -18,7 +18,6 @@ export type InteractiveMarkerType = MarkerType & {
|
|
|
18
18
|
focused?: boolean;
|
|
19
19
|
};
|
|
20
20
|
export type Relationship = "eq" | "lt" | "gt" | "le" | "ge";
|
|
21
|
-
export type Alignment = "default" | "block" | "inline-block" | "inline" | "wrap-left" | "wrap-right" | "full-width";
|
|
22
21
|
export type RecursiveReadonly<T> = {
|
|
23
22
|
readonly [K in keyof T]: RecursiveReadonly<T[K]>;
|
|
24
23
|
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { PerseusBlankWidgetOptions, BlankWidget } from "../../data-schema";
|
|
2
|
+
export declare function generateBlankOptions(options?: Partial<PerseusBlankWidgetOptions>): PerseusBlankWidgetOptions;
|
|
3
|
+
export declare function generateBlankWidget(blankWidgetProperties?: Partial<Omit<BlankWidget, "type">>): BlankWidget;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { NumberLineWidget, PerseusNumberLineWidgetOptions } from "../../data-schema";
|
|
2
|
+
export declare function generateNumberLineOptions(options?: Partial<PerseusNumberLineWidgetOptions>): PerseusNumberLineWidgetOptions;
|
|
3
|
+
export declare function generateNumberLineWidget(numberLineWidgetProperties?: Partial<Omit<NumberLineWidget, "type">>): NumberLineWidget;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { OrdererWidget, PerseusOrdererWidgetOptions, PerseusRenderer } from "../../data-schema";
|
|
2
|
+
/**
|
|
3
|
+
* Builds a single orderer card. The orderer stores each card as a
|
|
4
|
+
* PerseusRenderer so that cards can contain math and images, but most tests
|
|
5
|
+
* only care about the card's text.
|
|
6
|
+
*/
|
|
7
|
+
export declare function generateOrdererOption(content: string): PerseusRenderer;
|
|
8
|
+
export declare function generateOrdererOptions(options?: Partial<PerseusOrdererWidgetOptions>): PerseusOrdererWidgetOptions;
|
|
9
|
+
export declare function generateOrdererWidget(ordererWidgetProperties?: Partial<Omit<OrdererWidget, "type">>): OrdererWidget;
|
|
@@ -103,6 +103,19 @@ export type ValidationResult = Extract<PerseusScore, {
|
|
|
103
103
|
* via postMessage.
|
|
104
104
|
*/
|
|
105
105
|
export type UserInputStatus = "correct" | "incorrect" | "incomplete";
|
|
106
|
+
export type PerseusBlankUserInput = {
|
|
107
|
+
/**
|
|
108
|
+
* The user's placed answer tile on the blank, or null if the user has not
|
|
109
|
+
* placed a tile yet.
|
|
110
|
+
*/
|
|
111
|
+
selected: string | null;
|
|
112
|
+
};
|
|
113
|
+
export type PerseusBlankRubric = {
|
|
114
|
+
/**
|
|
115
|
+
* The ID of the correct answer tile
|
|
116
|
+
*/
|
|
117
|
+
correctId: string;
|
|
118
|
+
};
|
|
106
119
|
/** Scoring rubric for the Categorizer widget. */
|
|
107
120
|
export type PerseusCategorizerRubric = {
|
|
108
121
|
/**
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PerseusBlankWidgetOptions } from "../../data-schema";
|
|
2
|
+
export type BlankPublicWidgetOptions = Pick<PerseusBlankWidgetOptions, "displayType">;
|
|
3
|
+
/**
|
|
4
|
+
* Given a PerseusBlankWidgetOptions object, return a new object with only
|
|
5
|
+
* the public options that should be exposed to the client.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getBlankPublicWidgetOptions(options: PerseusBlankWidgetOptions): BlankPublicWidgetOptions;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BlankPublicWidgetOptions } from "./blank-util";
|
|
2
|
+
import type { PerseusBlankWidgetOptions } from "../../data-schema";
|
|
3
|
+
import type { WidgetLogic } from "../logic-export.types";
|
|
4
|
+
declare const blankWidgetLogic: WidgetLogic<PerseusBlankWidgetOptions, BlankPublicWidgetOptions>;
|
|
5
|
+
export default blankWidgetLogic;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { PublicWidgetOptionsFunction, WidgetLogic } from "./logic-export.types";
|
|
2
|
-
import type { PerseusWidgetOptions, PerseusWidget } from "../data-schema";
|
|
3
|
-
import type { Alignment } from "../types";
|
|
2
|
+
import type { PerseusWidgetOptions, PerseusWidget, Alignment } from "../data-schema";
|
|
4
3
|
export declare function registerWidget(type: string, logic: WidgetLogic<any, any>): void;
|
|
5
4
|
export declare function isWidgetRegistered(type: string): boolean;
|
|
6
5
|
export declare function getCurrentVersion(type: string): import("..").Version;
|
|
@@ -18,8 +18,7 @@ import type { getPlotterPublicWidgetOptions } from "./plotter/plotter-util";
|
|
|
18
18
|
import type { getRadioPublicWidgetOptions } from "./radio/radio-util";
|
|
19
19
|
import type { getSorterPublicWidgetOptions } from "./sorter/sorter-util";
|
|
20
20
|
import type { getTablePublicWidgetOptions } from "./table/table-util";
|
|
21
|
-
import type { Version } from "../data-schema";
|
|
22
|
-
import type { Alignment } from "../types";
|
|
21
|
+
import type { Alignment, Version } from "../data-schema";
|
|
23
22
|
export type WidgetOptionsUpgradeMap = {
|
|
24
23
|
[targetMajorVersion: string]: (arg1: any) => any;
|
|
25
24
|
};
|