@khanacademy/perseus 77.3.2 → 77.4.1
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 +11 -10
- package/dist/es/index.js.map +1 -1
- package/dist/es/strings.js +1 -1
- package/dist/es/strings.js.map +1 -1
- package/dist/index.js +11 -10
- package/dist/index.js.map +1 -1
- package/dist/server-item-renderer.d.ts +1 -1
- package/dist/strings.d.ts +2 -0
- package/dist/strings.js +1 -1
- package/dist/strings.js.map +1 -1
- package/dist/testing/feature-flags-util.d.ts +2 -8
- package/dist/testing/item-renderer-hooks.d.ts +1 -1
- package/dist/types.d.ts +3 -0
- package/dist/widget-ai-utils/interactive-graph/interactive-graph-ai-utils.d.ts +2 -2
- package/dist/widgets/dropdown/dropdown.d.ts +2 -1
- package/dist/widgets/expression/expression.d.ts +4 -2
- package/dist/widgets/interactive-graphs/interactive-graph.d.ts +7 -4
- package/dist/widgets/interactive-graphs/stateful-mafs-graph.d.ts +1 -0
- package/dist/widgets/interactive-graphs/types.d.ts +1 -1
- package/dist/widgets/label-image/label-image.d.ts +2 -1
- package/dist/widgets/mock-widgets/mock-widget.d.ts +2 -1
- package/dist/widgets/numeric-input/numeric-input.class.d.ts +2 -1
- package/dist/widgets/numeric-input/numeric-input.d.ts +3 -2
- package/dist/widgets/table/table.d.ts +2 -1
- package/dist/widgets.d.ts +5 -0
- package/package.json +7 -7
package/dist/types.d.ts
CHANGED
|
@@ -360,6 +360,8 @@ export type WidgetExports<T extends React.ComponentType<any> & Widget = React.Co
|
|
|
360
360
|
version?: Version;
|
|
361
361
|
isLintable?: boolean;
|
|
362
362
|
tracking?: Tracking;
|
|
363
|
+
/** When true, the widget editor shows a "Graded" toggle. */
|
|
364
|
+
supportsUngraded?: boolean;
|
|
363
365
|
getOneCorrectAnswerFromRubric?: (rubric: WidgetOptions) => string | null | undefined;
|
|
364
366
|
/**
|
|
365
367
|
* @deprecated - do not use in new code.
|
|
@@ -385,6 +387,7 @@ type UniversalWidgetProps<TUserInput = Empty, TrackingExtraArgs = Empty> = {
|
|
|
385
387
|
widgetIndex: number;
|
|
386
388
|
alignment: string | null | undefined;
|
|
387
389
|
static: boolean | null | undefined;
|
|
390
|
+
graded?: boolean | null;
|
|
388
391
|
problemNum: number | null | undefined;
|
|
389
392
|
apiOptions: APIOptionsWithDefaults;
|
|
390
393
|
keypadElement?: any;
|
|
@@ -6,7 +6,7 @@ type Coord = [x: number, y: number];
|
|
|
6
6
|
type CollinearTuple = readonly [Coord, Coord];
|
|
7
7
|
type AngleGraphOptions = {
|
|
8
8
|
type: "angle";
|
|
9
|
-
angleOffsetDegrees
|
|
9
|
+
angleOffsetDegrees?: number | null;
|
|
10
10
|
startCoords?: readonly [Coord, Coord, Coord];
|
|
11
11
|
};
|
|
12
12
|
type CircleGraphOptions = {
|
|
@@ -82,7 +82,7 @@ type NoneGraphOptions = Record<string, never>;
|
|
|
82
82
|
type GraphOptions = AbsoluteValueGraphOptions | AngleGraphOptions | CircleGraphOptions | ExponentialGraphOptions | LinearGraphOptions | LinearSystemGraphOptions | NoneGraphOptions | PointGraphOptions | PolygonGraphOptions | QuadraticGraphOptions | RayGraphOptions | SegmentGraphOptions | SinusoidGraphOptions | TangentGraphOptions | LogarithmGraphOptions | VectorGraphOptions;
|
|
83
83
|
type AngleUserInput = {
|
|
84
84
|
coords?: readonly [Coord, Coord, Coord];
|
|
85
|
-
angleOffsetDegrees?: number;
|
|
85
|
+
angleOffsetDegrees?: number | null;
|
|
86
86
|
};
|
|
87
87
|
type CircleUserInput = {
|
|
88
88
|
center?: Coord;
|
|
@@ -18,6 +18,7 @@ declare const _default: {
|
|
|
18
18
|
widgetIndex: number;
|
|
19
19
|
alignment: string | null | undefined;
|
|
20
20
|
static: boolean | null | undefined;
|
|
21
|
+
graded?: boolean | null;
|
|
21
22
|
problemNum: number | null | undefined;
|
|
22
23
|
apiOptions: Readonly<Readonly<{
|
|
23
24
|
isArticle?: boolean;
|
|
@@ -51,7 +52,7 @@ declare const _default: {
|
|
|
51
52
|
hintProgressColor?: string;
|
|
52
53
|
canScrollPage?: boolean;
|
|
53
54
|
editorChangeDelay?: number;
|
|
54
|
-
flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-
|
|
55
|
+
flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-vector" | "interactive-graph-not-scored", boolean>;
|
|
55
56
|
}> & {
|
|
56
57
|
baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
|
|
57
58
|
canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
|
|
@@ -8,6 +8,7 @@ export declare const Expression: React.ForwardRefExoticComponent<PerseusExpressi
|
|
|
8
8
|
widgetIndex: number;
|
|
9
9
|
alignment: string | null | undefined;
|
|
10
10
|
static: boolean | null | undefined;
|
|
11
|
+
graded?: boolean | null;
|
|
11
12
|
problemNum: number | null | undefined;
|
|
12
13
|
apiOptions: Readonly<Readonly<{
|
|
13
14
|
isArticle?: boolean;
|
|
@@ -41,7 +42,7 @@ export declare const Expression: React.ForwardRefExoticComponent<PerseusExpressi
|
|
|
41
42
|
hintProgressColor?: string;
|
|
42
43
|
canScrollPage?: boolean;
|
|
43
44
|
editorChangeDelay?: number;
|
|
44
|
-
flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-
|
|
45
|
+
flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-vector" | "interactive-graph-not-scored", boolean>;
|
|
45
46
|
}> & {
|
|
46
47
|
baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
|
|
47
48
|
canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
|
|
@@ -87,6 +88,7 @@ declare const _default: {
|
|
|
87
88
|
widgetIndex: number;
|
|
88
89
|
alignment: string | null | undefined;
|
|
89
90
|
static: boolean | null | undefined;
|
|
91
|
+
graded?: boolean | null;
|
|
90
92
|
problemNum: number | null | undefined;
|
|
91
93
|
apiOptions: Readonly<Readonly<{
|
|
92
94
|
isArticle?: boolean;
|
|
@@ -120,7 +122,7 @@ declare const _default: {
|
|
|
120
122
|
hintProgressColor?: string;
|
|
121
123
|
canScrollPage?: boolean;
|
|
122
124
|
editorChangeDelay?: number;
|
|
123
|
-
flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-
|
|
125
|
+
flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-vector" | "interactive-graph-not-scored", boolean>;
|
|
124
126
|
}> & {
|
|
125
127
|
baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
|
|
126
128
|
canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
2
3
|
import type { StatefulMafsGraphType } from "./stateful-mafs-graph";
|
|
3
4
|
import type { QuadraticGraphState } from "./types";
|
|
4
5
|
import type { Coord } from "../../interactive2/types";
|
|
@@ -125,6 +126,8 @@ type DefaultProps = {
|
|
|
125
126
|
};
|
|
126
127
|
type State = any;
|
|
127
128
|
declare class InteractiveGraph extends React.Component<Props, State> {
|
|
129
|
+
static contextType: React.Context<import("../../components/i18n-context").I18nContextType>;
|
|
130
|
+
context: React.ContextType<typeof PerseusI18nContext>;
|
|
128
131
|
mafsRef: React.RefObject<StatefulMafsGraphType>;
|
|
129
132
|
static defaultProps: DefaultProps;
|
|
130
133
|
getUserInput(): PerseusInteractiveGraphUserInput;
|
|
@@ -158,12 +161,11 @@ declare class InteractiveGraph extends React.Component<Props, State> {
|
|
|
158
161
|
widgetIndex: number;
|
|
159
162
|
alignment: string | null | undefined;
|
|
160
163
|
static: boolean | null | undefined;
|
|
164
|
+
graded?: boolean | null;
|
|
161
165
|
problemNum: number | null | undefined;
|
|
162
166
|
apiOptions: Readonly<Readonly<{
|
|
163
167
|
isArticle?: boolean;
|
|
164
|
-
onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement
|
|
165
|
-
* Whether to show the arrows on the axis.
|
|
166
|
-
*/: HTMLElement) => unknown;
|
|
168
|
+
onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
|
|
167
169
|
showAlignmentOptions?: boolean;
|
|
168
170
|
readOnly?: boolean;
|
|
169
171
|
editingDisabled?: boolean;
|
|
@@ -193,7 +195,7 @@ declare class InteractiveGraph extends React.Component<Props, State> {
|
|
|
193
195
|
hintProgressColor?: string;
|
|
194
196
|
canScrollPage?: boolean;
|
|
195
197
|
editorChangeDelay?: number;
|
|
196
|
-
flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-
|
|
198
|
+
flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-vector" | "interactive-graph-not-scored", boolean>;
|
|
197
199
|
}> & {
|
|
198
200
|
baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
|
|
199
201
|
canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
|
|
@@ -290,5 +292,6 @@ declare const _default: {
|
|
|
290
292
|
getStartUserInput: typeof getStartUserInput;
|
|
291
293
|
getCorrectUserInput: typeof getCorrectUserInput;
|
|
292
294
|
getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
|
|
295
|
+
supportsUngraded: true;
|
|
293
296
|
};
|
|
294
297
|
export default _default;
|
|
@@ -27,6 +27,7 @@ export type StatefulMafsGraphProps = {
|
|
|
27
27
|
static: InteractiveGraphProps["static"];
|
|
28
28
|
showAxisArrows: InteractiveGraphProps["showAxisArrows"];
|
|
29
29
|
widgetId: string;
|
|
30
|
+
graded?: boolean | null;
|
|
30
31
|
};
|
|
31
32
|
export type StatefulMafsGraphType = {
|
|
32
33
|
getUserInput: () => PerseusInteractiveGraphUserInput;
|
|
@@ -105,7 +105,7 @@ export interface AngleGraphState extends InteractiveGraphStateCommon {
|
|
|
105
105
|
type: "angle";
|
|
106
106
|
showAngles?: boolean;
|
|
107
107
|
allowReflexAngles?: boolean;
|
|
108
|
-
angleOffsetDeg?: number;
|
|
108
|
+
angleOffsetDeg?: number | null;
|
|
109
109
|
snapDegrees?: number;
|
|
110
110
|
coords: [Coord, Coord, Coord];
|
|
111
111
|
}
|
|
@@ -117,6 +117,7 @@ declare const _default: {
|
|
|
117
117
|
widgetIndex: number;
|
|
118
118
|
alignment: string | null | undefined;
|
|
119
119
|
static: boolean | null | undefined;
|
|
120
|
+
graded?: boolean | null;
|
|
120
121
|
problemNum: number | null | undefined;
|
|
121
122
|
apiOptions: Readonly<Readonly<{
|
|
122
123
|
isArticle?: boolean;
|
|
@@ -150,7 +151,7 @@ declare const _default: {
|
|
|
150
151
|
hintProgressColor?: string;
|
|
151
152
|
canScrollPage?: boolean;
|
|
152
153
|
editorChangeDelay?: number;
|
|
153
|
-
flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-
|
|
154
|
+
flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-vector" | "interactive-graph-not-scored", boolean>;
|
|
154
155
|
}> & {
|
|
155
156
|
baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
|
|
156
157
|
canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
|
|
@@ -41,6 +41,7 @@ declare class MockWidgetComponent extends React.Component<Props> implements Widg
|
|
|
41
41
|
widgetId: string;
|
|
42
42
|
widgetIndex: number;
|
|
43
43
|
alignment: string | null | undefined;
|
|
44
|
+
graded?: boolean | null;
|
|
44
45
|
problemNum: number | null | undefined;
|
|
45
46
|
apiOptions: Readonly<Readonly<{
|
|
46
47
|
isArticle?: boolean;
|
|
@@ -74,7 +75,7 @@ declare class MockWidgetComponent extends React.Component<Props> implements Widg
|
|
|
74
75
|
hintProgressColor?: string;
|
|
75
76
|
canScrollPage?: boolean;
|
|
76
77
|
editorChangeDelay?: number;
|
|
77
|
-
flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-
|
|
78
|
+
flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-vector" | "interactive-graph-not-scored", boolean>;
|
|
78
79
|
}> & {
|
|
79
80
|
baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
|
|
80
81
|
canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
|
|
@@ -48,6 +48,7 @@ export declare class NumericInput extends React.Component<NumericInputProps> imp
|
|
|
48
48
|
widgetId: string;
|
|
49
49
|
widgetIndex: number;
|
|
50
50
|
alignment: string | null | undefined;
|
|
51
|
+
graded?: boolean | null;
|
|
51
52
|
problemNum: number | null | undefined;
|
|
52
53
|
apiOptions: Readonly<Readonly<{
|
|
53
54
|
isArticle?: boolean;
|
|
@@ -81,7 +82,7 @@ export declare class NumericInput extends React.Component<NumericInputProps> imp
|
|
|
81
82
|
hintProgressColor?: string;
|
|
82
83
|
canScrollPage?: boolean;
|
|
83
84
|
editorChangeDelay?: number;
|
|
84
|
-
flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-
|
|
85
|
+
flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-vector" | "interactive-graph-not-scored", boolean>;
|
|
85
86
|
}> & {
|
|
86
87
|
baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
|
|
87
88
|
canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
|
|
@@ -11,6 +11,7 @@ export declare const NumericInputComponent: React.ForwardRefExoticComponent<impo
|
|
|
11
11
|
widgetIndex: number;
|
|
12
12
|
alignment: string | null | undefined;
|
|
13
13
|
static: boolean | null | undefined;
|
|
14
|
+
graded?: boolean | null;
|
|
14
15
|
problemNum: number | null | undefined;
|
|
15
16
|
apiOptions: Readonly<Readonly<{
|
|
16
17
|
isArticle?: boolean;
|
|
@@ -44,7 +45,7 @@ export declare const NumericInputComponent: React.ForwardRefExoticComponent<impo
|
|
|
44
45
|
hintProgressColor?: string;
|
|
45
46
|
canScrollPage?: boolean;
|
|
46
47
|
editorChangeDelay?: number;
|
|
47
|
-
flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-
|
|
48
|
+
flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-vector" | "interactive-graph-not-scored", boolean>;
|
|
48
49
|
}> & {
|
|
49
50
|
baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
|
|
50
51
|
canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
|
|
@@ -103,7 +104,7 @@ export declare const NumericInputComponent: React.ForwardRefExoticComponent<impo
|
|
|
103
104
|
hintProgressColor?: string;
|
|
104
105
|
canScrollPage?: boolean;
|
|
105
106
|
editorChangeDelay?: number;
|
|
106
|
-
flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-
|
|
107
|
+
flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-vector" | "interactive-graph-not-scored", boolean>;
|
|
107
108
|
}> & {
|
|
108
109
|
baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
|
|
109
110
|
canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
|
|
@@ -49,6 +49,7 @@ declare class Table extends React.Component<Props> implements Widget {
|
|
|
49
49
|
widgetIndex: number;
|
|
50
50
|
alignment: string | null | undefined;
|
|
51
51
|
static: boolean | null | undefined;
|
|
52
|
+
graded?: boolean | null;
|
|
52
53
|
problemNum: number | null | undefined;
|
|
53
54
|
apiOptions: Readonly<Readonly<{
|
|
54
55
|
isArticle?: boolean;
|
|
@@ -82,7 +83,7 @@ declare class Table extends React.Component<Props> implements Widget {
|
|
|
82
83
|
hintProgressColor?: string;
|
|
83
84
|
canScrollPage?: boolean;
|
|
84
85
|
editorChangeDelay?: number;
|
|
85
|
-
flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-
|
|
86
|
+
flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-vector" | "interactive-graph-not-scored", boolean>;
|
|
86
87
|
}> & {
|
|
87
88
|
baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
|
|
88
89
|
canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
|
package/dist/widgets.d.ts
CHANGED
|
@@ -43,6 +43,11 @@ export declare const getAllWidgetTypes: () => ReadonlyArray<string>;
|
|
|
43
43
|
* getCorrectUserInput function.
|
|
44
44
|
*/
|
|
45
45
|
export declare const supportsStaticMode: (type: string) => boolean | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Returns true if the widget supports the "Graded" toggle in the editor.
|
|
48
|
+
* A widget opts in by setting supportsUngraded: true in its export object.
|
|
49
|
+
*/
|
|
50
|
+
export declare const supportsUngraded: (type: string) => boolean;
|
|
46
51
|
/**
|
|
47
52
|
* Returns the tracking option for the widget. The default is "",
|
|
48
53
|
* which means simply to track interactions once. The other available
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Core Perseus API (includes renderers and widgets)",
|
|
4
4
|
"author": "Khan Academy",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "77.
|
|
6
|
+
"version": "77.4.1",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
"tiny-invariant": "1.3.1",
|
|
44
44
|
"uuid": "^10.0.0",
|
|
45
45
|
"@khanacademy/kas": "2.2.2",
|
|
46
|
-
"@khanacademy/keypad-context": "3.2.
|
|
47
|
-
"@khanacademy/kmath": "2.4.
|
|
48
|
-
"@khanacademy/math-input": "26.4.
|
|
49
|
-
"@khanacademy/perseus-core": "26.0.
|
|
50
|
-
"@khanacademy/perseus-linter": "5.0.
|
|
51
|
-
"@khanacademy/perseus-score": "8.
|
|
46
|
+
"@khanacademy/keypad-context": "3.2.47",
|
|
47
|
+
"@khanacademy/kmath": "2.4.5",
|
|
48
|
+
"@khanacademy/math-input": "26.4.19",
|
|
49
|
+
"@khanacademy/perseus-core": "26.0.2",
|
|
50
|
+
"@khanacademy/perseus-linter": "5.0.2",
|
|
51
|
+
"@khanacademy/perseus-score": "8.8.1",
|
|
52
52
|
"@khanacademy/perseus-utils": "2.1.5",
|
|
53
53
|
"@khanacademy/pure-markdown": "2.2.7",
|
|
54
54
|
"@khanacademy/simple-markdown": "2.2.2"
|