@khanacademy/perseus 84.3.0 → 85.1.2
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/components/sortable.d.ts +3 -0
- package/dist/es/index.css +12 -4
- package/dist/es/index.css.map +1 -1
- package/dist/es/index.js +33 -40
- package/dist/es/index.js.map +1 -1
- package/dist/index.css +12 -4
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +0 -9
- package/dist/index.js +28 -38
- package/dist/index.js.map +1 -1
- package/dist/interactive2/wrapped-ellipse.d.ts +5 -0
- package/dist/renderer.new.d.ts +0 -7
- package/dist/renderer.old.d.ts +0 -7
- package/dist/types.d.ts +0 -3
- package/dist/widgets/definition/definition.d.ts +4 -7
- package/dist/widgets/explanation/explanation.d.ts +3 -5
- package/dist/widgets/expression/expression.d.ts +2 -2
- package/dist/widgets/grapher/function-type-icon.d.ts +8 -0
- package/dist/widgets/numeric-input/utils.d.ts +2 -2
- package/dist/widgets/radio/radio-widget.d.ts +2 -2
- package/dist/widgets/sorter/index.d.ts +73 -1
- package/dist/widgets/sorter/sorter.d.ts +15 -20
- package/package.json +7 -7
- package/dist/mixins/changeable.d.ts +0 -35
- package/dist/mixins/editor-jsonify.d.ts +0 -8
- package/dist/mixins/widget-prop-denylist.d.ts +0 -5
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import WrappedDrawing from "./wrapped-drawing";
|
|
2
2
|
import type { Coord } from "./types";
|
|
3
3
|
import type { VisibleShape } from "./wrapped-drawing";
|
|
4
|
+
export declare const wrappedEllipseShadow: string;
|
|
4
5
|
declare class WrappedEllipse extends WrappedDrawing {
|
|
5
6
|
initialPoint: Coord;
|
|
6
7
|
wrapper: HTMLDivElement;
|
|
7
8
|
visibleShape: VisibleShape;
|
|
8
9
|
constructor(graphie: any, center: Coord, radii: [number, number], options: any);
|
|
10
|
+
/**
|
|
11
|
+
* Turns the ellipse's drop shadow on or off.
|
|
12
|
+
*/
|
|
13
|
+
setShadow(shadow: boolean): void;
|
|
9
14
|
}
|
|
10
15
|
export default WrappedEllipse;
|
package/dist/renderer.new.d.ts
CHANGED
|
@@ -160,13 +160,6 @@ declare class Renderer extends React.Component<Props, State> implements GetPromp
|
|
|
160
160
|
focusPath: (path: FocusPath) => void;
|
|
161
161
|
blurPath: (path: FocusPath) => void;
|
|
162
162
|
blur: () => void;
|
|
163
|
-
/**
|
|
164
|
-
* Serializes widget state. Seems to be used only by editors though.
|
|
165
|
-
*
|
|
166
|
-
* @deprecated and likely a very broken API
|
|
167
|
-
* [LEMS-3185] do not trust serializedState
|
|
168
|
-
*/
|
|
169
|
-
serialize: () => Record<any, any>;
|
|
170
163
|
/**
|
|
171
164
|
* Returns an array of widget ids that are empty (meaning widgets where the
|
|
172
165
|
* learner has not interacted with the widget yet or has not filled in all
|
package/dist/renderer.old.d.ts
CHANGED
|
@@ -171,13 +171,6 @@ declare class Renderer extends React.Component<Props, State> implements GetPromp
|
|
|
171
171
|
focusPath: (path: FocusPath) => void;
|
|
172
172
|
blurPath: (path: FocusPath) => void;
|
|
173
173
|
blur: () => void;
|
|
174
|
-
/**
|
|
175
|
-
* Serializes widget state. Seems to be used only by editors though.
|
|
176
|
-
*
|
|
177
|
-
* @deprecated and likely a very broken API
|
|
178
|
-
* [LEMS-3185] do not trust serializedState
|
|
179
|
-
*/
|
|
180
|
-
serialize: () => Record<any, any>;
|
|
181
174
|
/**
|
|
182
175
|
* Returns an array of widget ids that are empty (meaning widgets where the
|
|
183
176
|
* learner has not interacted with the widget yet or has not filled in all
|
package/dist/types.d.ts
CHANGED
|
@@ -341,9 +341,6 @@ export type WidgetProps<TWidgetOptions, TUserInput = Empty, TrackingExtraArgs =
|
|
|
341
341
|
linterContext: LinterContextProps;
|
|
342
342
|
containerSizeClass: SizeClass;
|
|
343
343
|
};
|
|
344
|
-
export type ChangeFn = (newPropsOrSinglePropName: string | {
|
|
345
|
-
[key: string]: any;
|
|
346
|
-
}, propValue?: any, callback?: () => unknown) => any;
|
|
347
344
|
export type SharedRendererProps = {
|
|
348
345
|
apiOptions: APIOptions;
|
|
349
346
|
linterContext: LinterContextProps;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import type {
|
|
3
|
-
import type { PerseusDefinitionWidgetOptions
|
|
4
|
-
type
|
|
5
|
-
widgets: PerseusRenderer["widgets"];
|
|
6
|
-
dependencies: PerseusDependenciesV2;
|
|
7
|
-
};
|
|
2
|
+
import type { Widget, WidgetProps } from "../../types";
|
|
3
|
+
import type { PerseusDefinitionWidgetOptions } from "@khanacademy/perseus-core";
|
|
4
|
+
type Props = WidgetProps<PerseusDefinitionWidgetOptions>;
|
|
8
5
|
declare const _default: {
|
|
9
6
|
name: string;
|
|
10
7
|
displayName: string;
|
|
11
|
-
widget: React.ForwardRefExoticComponent<
|
|
8
|
+
widget: React.ForwardRefExoticComponent<Props & React.RefAttributes<Widget>>;
|
|
12
9
|
};
|
|
13
10
|
export default _default;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import type {
|
|
2
|
+
import type { Widget, WidgetProps } from "../../types";
|
|
3
3
|
import type { PerseusExplanationWidgetOptions } from "@khanacademy/perseus-core";
|
|
4
|
-
type Props = WidgetProps<PerseusExplanationWidgetOptions
|
|
5
|
-
dependencies: PerseusDependenciesV2;
|
|
6
|
-
};
|
|
4
|
+
type Props = WidgetProps<PerseusExplanationWidgetOptions>;
|
|
7
5
|
declare const _default: {
|
|
8
6
|
name: string;
|
|
9
7
|
displayName: string;
|
|
10
|
-
widget: React.ForwardRefExoticComponent<
|
|
8
|
+
widget: React.ForwardRefExoticComponent<Props & React.RefAttributes<Widget>>;
|
|
11
9
|
isLintable: true;
|
|
12
10
|
};
|
|
13
11
|
export default _default;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { Widget, WidgetProps } from "../../types";
|
|
3
|
-
import type {
|
|
3
|
+
import type { PerseusExpressionWidgetOptions, PerseusExpressionUserInput } from "@khanacademy/perseus-core";
|
|
4
4
|
type Props = WidgetProps<PerseusExpressionWidgetOptions, PerseusExpressionUserInput>;
|
|
5
5
|
export declare const Expression: React.ForwardRefExoticComponent<Props & React.RefAttributes<Widget>>;
|
|
6
6
|
/**
|
|
@@ -9,7 +9,7 @@ export declare const Expression: React.ForwardRefExoticComponent<Props & React.R
|
|
|
9
9
|
*/
|
|
10
10
|
declare function getUserInputFromSerializedState(serializedState: any): PerseusExpressionUserInput;
|
|
11
11
|
declare function getStartUserInput(): PerseusExpressionUserInput;
|
|
12
|
-
declare function getOneCorrectAnswerFromRubric(rubric:
|
|
12
|
+
declare function getOneCorrectAnswerFromRubric(rubric: PerseusExpressionWidgetOptions): string | null | undefined;
|
|
13
13
|
declare function getCorrectUserInput(options: PerseusExpressionWidgetOptions): PerseusExpressionUserInput;
|
|
14
14
|
declare const _default: {
|
|
15
15
|
name: string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { FunctionTypeMappingKeys } from "@khanacademy/perseus-core";
|
|
3
|
+
interface Props {
|
|
4
|
+
type: FunctionTypeMappingKeys;
|
|
5
|
+
label: string;
|
|
6
|
+
}
|
|
7
|
+
export default function FunctionTypeIcon({ type, label }: Props): React.JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PerseusStrings } from "../../strings";
|
|
2
|
-
import type { PerseusNumericInputAnswerForm,
|
|
2
|
+
import type { PerseusNumericInputAnswerForm, PerseusNumericInputWidgetOptions, PerseusNumericInputUserInput } from "@khanacademy/perseus-core";
|
|
3
3
|
/**
|
|
4
4
|
* Generates the specific set of examples for the current question.
|
|
5
5
|
* This string is shown as examples to the user in a tooltip.
|
|
@@ -33,4 +33,4 @@ export declare function findCommonFractions(value: number): {
|
|
|
33
33
|
denom: number;
|
|
34
34
|
} | undefined;
|
|
35
35
|
export declare function getCorrectUserInput(options: PerseusNumericInputWidgetOptions): PerseusNumericInputUserInput;
|
|
36
|
-
export declare function getOneCorrectAnswerFromRubric(rubric:
|
|
36
|
+
export declare function getOneCorrectAnswerFromRubric(rubric: PerseusNumericInputWidgetOptions): string | null | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { WidgetProps, ChoiceState, Widget } from "../../types";
|
|
3
3
|
import type { RadioPromptJSON } from "../../widget-ai-utils/radio/radio-ai-utils";
|
|
4
|
-
import type { PerseusRadioChoice,
|
|
4
|
+
import type { PerseusRadioChoice, PerseusRadioWidgetOptions, PerseusRadioUserInput } from "@khanacademy/perseus-core";
|
|
5
5
|
/**
|
|
6
6
|
* Represents a single choice in the RadioComponent
|
|
7
7
|
*/
|
|
@@ -35,7 +35,7 @@ export interface RadioChoiceWithMetadata extends PerseusRadioChoice {
|
|
|
35
35
|
originalIndex: number;
|
|
36
36
|
correct?: boolean;
|
|
37
37
|
}
|
|
38
|
-
type Props = WidgetProps<RadioProps, PerseusRadioUserInput,
|
|
38
|
+
type Props = WidgetProps<RadioProps, PerseusRadioUserInput, PerseusRadioWidgetOptions>;
|
|
39
39
|
declare class Radio extends React.Component<Props> implements Widget {
|
|
40
40
|
radioRef: React.RefObject<RadioWidgetHandle>;
|
|
41
41
|
/**
|
|
@@ -1 +1,73 @@
|
|
|
1
|
-
|
|
1
|
+
import type { SorterPublicWidgetOptions, PerseusSorterUserInput } from "@khanacademy/perseus-core";
|
|
2
|
+
declare function getStartUserInput(options: SorterPublicWidgetOptions, problemNum: number): PerseusSorterUserInput;
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated and likely a very broken API
|
|
5
|
+
* [LEMS-3185] do not trust serializedState
|
|
6
|
+
*/
|
|
7
|
+
declare function getUserInputFromSerializedState(serializedState: any): PerseusSorterUserInput;
|
|
8
|
+
declare const _default: {
|
|
9
|
+
name: string;
|
|
10
|
+
displayName: string;
|
|
11
|
+
widget: import("react").ForwardRefExoticComponent<{
|
|
12
|
+
options: import("@khanacademy/perseus-core").PerseusSorterWidgetOptions;
|
|
13
|
+
trackInteraction: (extraData?: Empty | undefined) => void;
|
|
14
|
+
widgetId: string;
|
|
15
|
+
widgetIndex: number;
|
|
16
|
+
alignment: import("@khanacademy/perseus-core").Alignment | null | undefined;
|
|
17
|
+
static: boolean | null | undefined;
|
|
18
|
+
graded?: boolean | null;
|
|
19
|
+
problemNum: number | null | undefined;
|
|
20
|
+
apiOptions: Readonly<Readonly<{
|
|
21
|
+
isArticle?: boolean;
|
|
22
|
+
onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
|
|
23
|
+
showAlignmentOptions?: boolean;
|
|
24
|
+
readOnly?: boolean;
|
|
25
|
+
editingDisabled?: boolean;
|
|
26
|
+
answerableCallback?: (arg1: boolean) => unknown;
|
|
27
|
+
getAnotherHint?: () => unknown;
|
|
28
|
+
interactionCallback?: (widgetData: {
|
|
29
|
+
[widgetId: string]: any;
|
|
30
|
+
}) => void;
|
|
31
|
+
imagePlaceholder?: React.ReactNode;
|
|
32
|
+
widgetPlaceholder?: React.ReactNode;
|
|
33
|
+
baseElements?: {
|
|
34
|
+
Link: React.ComponentType<any>;
|
|
35
|
+
};
|
|
36
|
+
trackInteraction?: (args: {
|
|
37
|
+
type: string;
|
|
38
|
+
id: string;
|
|
39
|
+
correct?: boolean;
|
|
40
|
+
} & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<{
|
|
41
|
+
visible: number;
|
|
42
|
+
}>) => void;
|
|
43
|
+
customKeypad?: boolean;
|
|
44
|
+
isMobile?: boolean;
|
|
45
|
+
isMobileApp?: boolean;
|
|
46
|
+
hintProgressColor?: string;
|
|
47
|
+
flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator", boolean>;
|
|
48
|
+
}> & {
|
|
49
|
+
baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
|
|
50
|
+
isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
|
|
51
|
+
isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
|
|
52
|
+
isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
|
|
53
|
+
editingDisabled: NonNullable<import("../..").APIOptions["editingDisabled"]>;
|
|
54
|
+
onFocusChange: NonNullable<import("../..").APIOptions["onFocusChange"]>;
|
|
55
|
+
readOnly: NonNullable<import("../..").APIOptions["readOnly"]>;
|
|
56
|
+
showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
|
|
57
|
+
}>;
|
|
58
|
+
keypadElement?: any;
|
|
59
|
+
onFocus: (blurPath: import("../..").FocusPath) => void;
|
|
60
|
+
onBlur: (blurPath: import("../..").FocusPath) => void;
|
|
61
|
+
findWidgets: import("../../types").FindWidgetsFunction;
|
|
62
|
+
reviewMode: boolean;
|
|
63
|
+
showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
|
|
64
|
+
handleUserInput: (newUserInput: PerseusSorterUserInput, cb?: () => void, silent?: boolean) => void;
|
|
65
|
+
userInput: PerseusSorterUserInput;
|
|
66
|
+
linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
|
|
67
|
+
containerSizeClass: import("../../util/sizing-utils").SizeClass;
|
|
68
|
+
} & import("react").RefAttributes<import("./sorter").SorterHandle>>;
|
|
69
|
+
isLintable: true;
|
|
70
|
+
getStartUserInput: typeof getStartUserInput;
|
|
71
|
+
getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
|
|
72
|
+
};
|
|
73
|
+
export default _default;
|
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
isLintable: true;
|
|
18
|
-
getStartUserInput: typeof getStartUserInput;
|
|
19
|
-
getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
|
|
20
|
-
};
|
|
21
|
-
export default _default;
|
|
2
|
+
import type { SortableOption } from "../../components/sortable";
|
|
3
|
+
import type { Widget, WidgetProps } from "../../types";
|
|
4
|
+
import type { PerseusSorterWidgetOptions, PerseusSorterUserInput } from "@khanacademy/perseus-core";
|
|
5
|
+
type Props = WidgetProps<PerseusSorterWidgetOptions, PerseusSorterUserInput>;
|
|
6
|
+
export interface SorterHandle extends Widget {
|
|
7
|
+
/**
|
|
8
|
+
* Programatic API for moving options. This is used by testing.
|
|
9
|
+
*
|
|
10
|
+
* @deprecated prefer user interaction testing over backdoor
|
|
11
|
+
* state manipulation
|
|
12
|
+
*/
|
|
13
|
+
moveOptionToIndex: (option: SortableOption, index: number) => void;
|
|
14
|
+
}
|
|
15
|
+
declare const Sorter: React.ForwardRefExoticComponent<Props & React.RefAttributes<SorterHandle>>;
|
|
16
|
+
export default Sorter;
|
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": "
|
|
6
|
+
"version": "85.1.2",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
"uuid": "^10.0.0",
|
|
46
46
|
"jquery": "^2.1.1",
|
|
47
47
|
"@khanacademy/kas": "2.2.6",
|
|
48
|
-
"@khanacademy/keypad-context": "3.2.
|
|
49
|
-
"@khanacademy/kmath": "2.4.
|
|
50
|
-
"@khanacademy/math-input": "27.0.
|
|
51
|
-
"@khanacademy/perseus-core": "
|
|
52
|
-
"@khanacademy/perseus-
|
|
48
|
+
"@khanacademy/keypad-context": "3.2.87",
|
|
49
|
+
"@khanacademy/kmath": "2.4.46",
|
|
50
|
+
"@khanacademy/math-input": "27.0.8",
|
|
51
|
+
"@khanacademy/perseus-core": "38.0.1",
|
|
52
|
+
"@khanacademy/perseus-linter": "5.2.0",
|
|
53
|
+
"@khanacademy/perseus-score": "8.12.19",
|
|
53
54
|
"@khanacademy/perseus-utils": "2.1.5",
|
|
54
55
|
"@khanacademy/pure-markdown": "2.3.2",
|
|
55
|
-
"@khanacademy/perseus-linter": "5.1.24",
|
|
56
56
|
"@khanacademy/simple-markdown": "3.0.1"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Changeable
|
|
3
|
-
*
|
|
4
|
-
* Adds a this.change() function to a component
|
|
5
|
-
*
|
|
6
|
-
* This.change takes prop changes as parameters, and calls
|
|
7
|
-
* this.props.onChange with the modified props.
|
|
8
|
-
*/
|
|
9
|
-
import type { ChangeFn } from "../types";
|
|
10
|
-
/**
|
|
11
|
-
* this.change()
|
|
12
|
-
*
|
|
13
|
-
* Can be called as follows:
|
|
14
|
-
* this.change(newProps, callback);
|
|
15
|
-
*
|
|
16
|
-
* this.change(propName, propValue, callback);
|
|
17
|
-
*
|
|
18
|
-
* this.change(propName) -> returns a lambda that takes a prop value to
|
|
19
|
-
* set and a callback to call after having set that value.
|
|
20
|
-
*
|
|
21
|
-
* TODO(LEMS-3245) remove Changeable
|
|
22
|
-
*
|
|
23
|
-
* @deprecated
|
|
24
|
-
*/
|
|
25
|
-
export declare const change: ChangeFn;
|
|
26
|
-
/**
|
|
27
|
-
* TODO(LEMS-3245) remove Changeable
|
|
28
|
-
*
|
|
29
|
-
* @deprecated
|
|
30
|
-
*/
|
|
31
|
-
export type ChangeableProps = {
|
|
32
|
-
onChange: (values: {
|
|
33
|
-
[key: string]: any;
|
|
34
|
-
}, callback?: (() => unknown) | null | undefined, silent?: boolean) => unknown;
|
|
35
|
-
};
|