@khanacademy/perseus 90.0.2 → 90.2.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/{chunk-register-all-widgets-for-testing-CgikCidU.js → chunk-register-all-widgets-for-testing-BOJFm0ap.js} +34 -25
- package/dist/chunk-register-all-widgets-for-testing-BOJFm0ap.js.map +1 -0
- package/dist/components/sortable.d.ts +2 -0
- package/dist/icon-paths.d.ts +0 -20
- package/dist/index.css +5 -5
- package/dist/index.css.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/question-paragraph.new.d.ts +2 -1
- package/dist/strings.d.ts +2 -0
- package/dist/strings.js +1 -1
- package/dist/strings.js.map +1 -1
- package/dist/testing.js +4 -1
- package/dist/testing.js.map +1 -1
- package/dist/util.d.ts +1 -0
- package/dist/widgets/graded-group/graded-group-answer-bar.d.ts +6 -9
- package/dist/widgets/mock-widgets/mock-widget.d.ts +3 -97
- package/dist/widgets/radio/radio-component.d.ts +2 -1
- package/package.json +7 -7
- package/dist/chunk-register-all-widgets-for-testing-CgikCidU.js.map +0 -1
package/dist/util.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ type TouchHandlers = {
|
|
|
35
35
|
* arrays of strings.
|
|
36
36
|
*/
|
|
37
37
|
declare function inputPathsEqual(a?: ReadonlyArray<string> | null, b?: ReadonlyArray<string> | null): boolean;
|
|
38
|
+
export declare const isContentGraphie: (node: SingleASTNode) => boolean;
|
|
38
39
|
/**
|
|
39
40
|
* Some widgets render as inline content but CANNOT safely live
|
|
40
41
|
* inside a paragraph (`<p>`). When this function returns true, the
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export type
|
|
2
|
+
import type { APIOptions, TrackingGradedGroupExtraArguments } from "../../types";
|
|
3
|
+
export type GradingStatus = TrackingGradedGroupExtraArguments["status"];
|
|
4
|
+
export type AnswerBarState = "active" | GradingStatus;
|
|
5
5
|
type Props = {
|
|
6
|
-
answerBarState:
|
|
6
|
+
answerBarState: AnswerBarState;
|
|
7
7
|
apiOptions: APIOptions;
|
|
8
|
+
invalidMessage?: string;
|
|
8
9
|
onCheckAnswer: () => unknown;
|
|
9
10
|
onNextQuestion?: () => unknown;
|
|
10
11
|
};
|
|
11
|
-
declare
|
|
12
|
-
static contextType: React.Context<import("../../components/i18n-context").I18nContextType>;
|
|
13
|
-
context: React.ContextType<typeof PerseusI18nContext>;
|
|
14
|
-
render(): React.ReactNode;
|
|
15
|
-
}
|
|
12
|
+
declare function GradedGroupAnswerBar({ apiOptions, answerBarState, invalidMessage, onCheckAnswer, onNextQuestion, }: Props): React.JSX.Element;
|
|
16
13
|
export default GradedGroupAnswerBar;
|
|
@@ -1,110 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
2
|
import type { MockWidgetOptions } from "./mock-widget-types";
|
|
3
3
|
import type { WidgetProps, Widget } from "../../types";
|
|
4
|
-
import type { MockWidgetPromptJSON } from "../../widget-ai-utils/mock-widget/prompt-utils";
|
|
5
4
|
import type { PerseusMockWidgetUserInput } from "@khanacademy/perseus-score";
|
|
6
5
|
type ExternalProps = WidgetProps<MockWidgetOptions, PerseusMockWidgetUserInput>;
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* This is a Mock Perseus widget, which is used for our various rendering tests
|
|
10
|
-
* both internally and in consuming projects. It is a simple widget that renders
|
|
11
|
-
* an interactable input field, and allows the user to input a string value.
|
|
12
|
-
*
|
|
13
|
-
* Please use this widget for all tests that are not specifically testing the
|
|
14
|
-
* functionality of a particular widget, such as testing the rendering components.
|
|
15
|
-
* This allows us to more easily update our widget schemas and behaviour without needing to
|
|
16
|
-
* update many different irrelevant tests across our codebases.
|
|
17
|
-
*
|
|
18
|
-
* You can register this widget for your tests by calling `registerWidget("mock-widget", MockWidget);`
|
|
19
|
-
*/
|
|
20
|
-
declare class MockWidgetComponent extends React.Component<Props> implements Widget {
|
|
21
|
-
inputRef: HTMLElement | null;
|
|
22
|
-
getPromptJSON(): MockWidgetPromptJSON;
|
|
23
|
-
focus: () => boolean;
|
|
24
|
-
focusInputPath: () => void;
|
|
25
|
-
blurInputPath: () => void;
|
|
26
|
-
getInputPaths: () => ReadonlyArray<ReadonlyArray<string>>;
|
|
27
|
-
handleChange: (newValue: string, cb?: () => unknown | null | undefined) => void;
|
|
28
|
-
/**
|
|
29
|
-
* @deprecated and likely very broken API
|
|
30
|
-
* [LEMS-3185] do not trust serializedState
|
|
31
|
-
*/
|
|
32
|
-
getSerializedState(): {
|
|
33
|
-
currentValue: string;
|
|
34
|
-
trackInteraction: (extraData?: Empty | undefined) => void;
|
|
35
|
-
widgetId: string;
|
|
36
|
-
widgetIndex: number;
|
|
37
|
-
alignment: import("@khanacademy/perseus-core").Alignment | null | undefined;
|
|
38
|
-
static: boolean | null | undefined;
|
|
39
|
-
graded?: boolean | null;
|
|
40
|
-
problemNum: number | null | undefined;
|
|
41
|
-
apiOptions: Readonly<Readonly<{
|
|
42
|
-
isArticle?: boolean;
|
|
43
|
-
onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
|
|
44
|
-
showAlignmentOptions?: boolean;
|
|
45
|
-
renderExtras?: (answerArea: import("@khanacademy/perseus-core").PerseusAnswerArea, widgetId: string) => React.ReactNode;
|
|
46
|
-
readOnly?: boolean;
|
|
47
|
-
editingDisabled?: boolean;
|
|
48
|
-
answerableCallback?: (arg1: boolean) => unknown;
|
|
49
|
-
getAnotherHint?: () => unknown;
|
|
50
|
-
interactionCallback?: (widgetData: {
|
|
51
|
-
[widgetId: string]: any;
|
|
52
|
-
}) => void;
|
|
53
|
-
imagePlaceholder?: React.ReactNode;
|
|
54
|
-
widgetPlaceholder?: React.ReactNode;
|
|
55
|
-
baseElements?: {
|
|
56
|
-
Link: React.ComponentType<any>;
|
|
57
|
-
};
|
|
58
|
-
trackInteraction?: (args: {
|
|
59
|
-
type: string;
|
|
60
|
-
id: string;
|
|
61
|
-
correct?: boolean;
|
|
62
|
-
} & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<{
|
|
63
|
-
visible: number;
|
|
64
|
-
}>) => void;
|
|
65
|
-
customKeypad?: boolean;
|
|
66
|
-
isMobile?: boolean;
|
|
67
|
-
isMobileApp?: boolean;
|
|
68
|
-
hintProgressColor?: string;
|
|
69
|
-
flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator" | "article-extras" | "dnd-widget-fitb", boolean>;
|
|
70
|
-
}> & {
|
|
71
|
-
baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
|
|
72
|
-
isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
|
|
73
|
-
isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
|
|
74
|
-
isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
|
|
75
|
-
editingDisabled: NonNullable<import("../..").APIOptions["editingDisabled"]>;
|
|
76
|
-
onFocusChange: NonNullable<import("../..").APIOptions["onFocusChange"]>;
|
|
77
|
-
readOnly: NonNullable<import("../..").APIOptions["readOnly"]>;
|
|
78
|
-
showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
|
|
79
|
-
}>;
|
|
80
|
-
keypadElement?: any;
|
|
81
|
-
onFocus: (blurPath: import("../..").FocusPath) => void;
|
|
82
|
-
onBlur: (blurPath: import("../..").FocusPath) => void;
|
|
83
|
-
findWidgets: import("../../types").FindWidgetsFunction;
|
|
84
|
-
reviewMode: boolean;
|
|
85
|
-
isScorable: boolean;
|
|
86
|
-
showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
|
|
87
|
-
handleUserInput: (newUserInput: PerseusMockWidgetUserInput, cb?: () => void, silent?: boolean) => void;
|
|
88
|
-
linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
|
|
89
|
-
containerSizeClass: import("../../util/sizing-utils").SizeClass;
|
|
90
|
-
value: string;
|
|
91
|
-
};
|
|
92
|
-
render(): React.ReactNode;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* @deprecated and likely a very broken API
|
|
96
|
-
* [LEMS-3185] do not trust serializedState
|
|
97
|
-
*/
|
|
98
|
-
declare function getUserInputFromSerializedState(serializedState: any): PerseusMockWidgetUserInput;
|
|
99
|
-
declare function getStartUserInput(options: PerseusMockWidgetUserInput): {
|
|
6
|
+
declare function getStartUserInput(): {
|
|
100
7
|
currentValue: string;
|
|
101
8
|
};
|
|
102
9
|
declare const _default: {
|
|
103
10
|
name: string;
|
|
104
11
|
displayName: string;
|
|
105
|
-
widget:
|
|
12
|
+
widget: React.ForwardRefExoticComponent<ExternalProps & React.RefAttributes<Widget>>;
|
|
106
13
|
isLintable: true;
|
|
107
14
|
getStartUserInput: typeof getStartUserInput;
|
|
108
|
-
getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
|
|
109
15
|
};
|
|
110
16
|
export default _default;
|
|
@@ -10,6 +10,7 @@ export interface RadioComponentProps {
|
|
|
10
10
|
numCorrect: number;
|
|
11
11
|
onChoiceChange: (choiceId: string, newCheckedState: boolean) => void;
|
|
12
12
|
reviewMode: boolean;
|
|
13
|
+
isRequired?: boolean;
|
|
13
14
|
}
|
|
14
15
|
/**
|
|
15
16
|
* The RadioComponent renders the UI for multiple choice questions.
|
|
@@ -49,5 +50,5 @@ export interface RadioComponentProps {
|
|
|
49
50
|
*
|
|
50
51
|
* Created as part of the Radio Revitalization Project (LEMS-2933).
|
|
51
52
|
*/
|
|
52
|
-
declare const RadioComponent: ({ choices, countChoices, multipleSelect, numCorrect, onChoiceChange, reviewMode, }: RadioComponentProps) => React.ReactElement;
|
|
53
|
+
declare const RadioComponent: ({ choices, countChoices, multipleSelect, numCorrect, onChoiceChange, reviewMode, isRequired, }: RadioComponentProps) => React.ReactElement;
|
|
53
54
|
export default RadioComponent;
|
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": "90.0
|
|
6
|
+
"version": "90.2.0",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
"mafs": "0.19.0",
|
|
35
35
|
"tiny-invariant": "1.3.1",
|
|
36
36
|
"uuid": "^10.0.0",
|
|
37
|
-
"@khanacademy/kmath": "3.0.3",
|
|
38
|
-
"@khanacademy/keypad-context": "6.0.2",
|
|
39
|
-
"@khanacademy/math-input": "30.0.3",
|
|
40
|
-
"@khanacademy/perseus-core": "41.0.0",
|
|
41
37
|
"@khanacademy/kas": "3.0.0",
|
|
42
|
-
"@khanacademy/
|
|
43
|
-
"@khanacademy/
|
|
38
|
+
"@khanacademy/keypad-context": "6.0.3",
|
|
39
|
+
"@khanacademy/kmath": "3.0.4",
|
|
40
|
+
"@khanacademy/math-input": "30.0.4",
|
|
41
|
+
"@khanacademy/perseus-core": "41.1.0",
|
|
42
|
+
"@khanacademy/perseus-linter": "6.1.1",
|
|
43
|
+
"@khanacademy/perseus-score": "9.0.4",
|
|
44
44
|
"@khanacademy/perseus-utils": "3.0.0",
|
|
45
45
|
"@khanacademy/pure-markdown": "3.0.0",
|
|
46
46
|
"@khanacademy/simple-markdown": "4.0.0"
|