@khanacademy/perseus 90.1.0 → 91.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/{chunk-register-all-widgets-for-testing-B94oNv6V.js → chunk-register-all-widgets-for-testing-nYS5kWmb.js} +61 -60
- package/dist/chunk-register-all-widgets-for-testing-nYS5kWmb.js.map +1 -0
- package/dist/components/sortable.d.ts +2 -0
- package/dist/index.css +5 -5
- package/dist/index.css.map +1 -1
- package/dist/index.js +3 -4
- package/dist/index.js.map +1 -1
- package/dist/question-paragraph.new.d.ts +2 -1
- package/dist/testing.js +1 -2
- package/dist/testing.js.map +1 -1
- package/dist/types.d.ts +0 -1
- package/dist/util.d.ts +1 -0
- package/dist/widgets/label-image/answer-choices.d.ts +1 -0
- package/dist/widgets/label-image/marker.d.ts +0 -4
- package/dist/widgets/label-image/pill.d.ts +22 -0
- package/dist/widgets/mock-widgets/mock-asset-loading-widget.d.ts +6 -12
- package/dist/widgets/mock-widgets/mock-widget.d.ts +3 -97
- package/package.json +8 -10
- package/dist/chunk-register-all-widgets-for-testing-B94oNv6V.js.map +0 -1
package/dist/types.d.ts
CHANGED
|
@@ -297,7 +297,6 @@ type WidgetOptions = any;
|
|
|
297
297
|
export type WidgetExports<T extends React.ComponentType<any> & Widget = React.ComponentType<any>, TUserInput = Empty> = Readonly<{
|
|
298
298
|
name: string;
|
|
299
299
|
displayName: string;
|
|
300
|
-
getWidget?: () => T;
|
|
301
300
|
widget: T;
|
|
302
301
|
/** Supresses widget from showing up in the dropdown in the content editor */
|
|
303
302
|
hidden?: boolean;
|
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
|
|
@@ -15,6 +15,7 @@ type AnswerChoicesProps = {
|
|
|
15
15
|
opener: PropsFor<typeof SingleSelect>["opener"];
|
|
16
16
|
onToggle: (opened: boolean) => unknown;
|
|
17
17
|
disabled: boolean;
|
|
18
|
+
"aria-required"?: boolean;
|
|
18
19
|
};
|
|
19
20
|
declare const AnswerChoices: (props: AnswerChoicesProps) => React.JSX.Element;
|
|
20
21
|
export default AnswerChoices;
|
|
@@ -4,12 +4,10 @@
|
|
|
4
4
|
* The target for labeling question image with answers.
|
|
5
5
|
*/
|
|
6
6
|
import * as React from "react";
|
|
7
|
-
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
8
7
|
import type { CSSProperties } from "aphrodite";
|
|
9
8
|
type Props = {
|
|
10
9
|
selected?: string[];
|
|
11
10
|
showCorrectness?: "correct" | "incorrect";
|
|
12
|
-
label: string;
|
|
13
11
|
showSelected: boolean;
|
|
14
12
|
showPulsate: boolean;
|
|
15
13
|
answerSide: "top" | "bottom" | "left" | "right";
|
|
@@ -19,8 +17,6 @@ type Props = {
|
|
|
19
17
|
hovered: boolean;
|
|
20
18
|
};
|
|
21
19
|
export default class Marker extends React.Component<Props> {
|
|
22
|
-
static contextType: React.Context<import("../../components/i18n-context").I18nContextType>;
|
|
23
|
-
context: React.ContextType<typeof PerseusI18nContext>;
|
|
24
20
|
_icon: HTMLElement | null | undefined;
|
|
25
21
|
_mounted: boolean;
|
|
26
22
|
static defaultProps: {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
3
|
+
type Props = {
|
|
4
|
+
/**
|
|
5
|
+
* The unique identifier for the pill.
|
|
6
|
+
*/
|
|
7
|
+
id?: string;
|
|
8
|
+
/**
|
|
9
|
+
* The content to display within the pill.
|
|
10
|
+
*/
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Called when the pill is clicked.
|
|
14
|
+
*/
|
|
15
|
+
onClick?: () => unknown;
|
|
16
|
+
/**
|
|
17
|
+
* Custom styles to add to this pill component.
|
|
18
|
+
*/
|
|
19
|
+
style?: StyleType;
|
|
20
|
+
};
|
|
21
|
+
declare const Pill: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLElement | HTMLButtonElement>>;
|
|
22
|
+
export default Pill;
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* our server-item-renderer tests to test the asset loading callbacks.
|
|
7
|
-
*/
|
|
8
|
-
export declare class MockAssetLoadingWidget extends React.Component<Record<any, any>> {
|
|
9
|
-
setAssetStatus: ((assetKey: string, loaded: boolean) => void) | null;
|
|
10
|
-
render(): React.ReactNode;
|
|
11
|
-
}
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { Widget } from "../../types";
|
|
3
|
+
export type MockAssetLoadingWidgetHandle = Widget & {
|
|
4
|
+
setAssetStatus: (assetKey: string, loaded: boolean) => void;
|
|
5
|
+
};
|
|
12
6
|
declare const _default: {
|
|
13
7
|
name: string;
|
|
14
8
|
displayName: string;
|
|
15
|
-
widget:
|
|
9
|
+
widget: React.ForwardRefExoticComponent<Omit<Record<any, any>, "ref"> & React.RefAttributes<MockAssetLoadingWidgetHandle>>;
|
|
16
10
|
};
|
|
17
11
|
export default _default;
|
|
@@ -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;
|
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": "91.0.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/keypad-context": "6.0.2",
|
|
38
|
-
"@khanacademy/kmath": "3.0.3",
|
|
39
|
-
"@khanacademy/perseus-core": "41.0.0",
|
|
40
|
-
"@khanacademy/math-input": "30.0.3",
|
|
41
37
|
"@khanacademy/kas": "3.0.0",
|
|
42
|
-
"@khanacademy/
|
|
43
|
-
"@khanacademy/
|
|
38
|
+
"@khanacademy/keypad-context": "6.0.4",
|
|
39
|
+
"@khanacademy/kmath": "3.0.5",
|
|
40
|
+
"@khanacademy/math-input": "30.0.5",
|
|
41
|
+
"@khanacademy/perseus-core": "41.2.0",
|
|
42
|
+
"@khanacademy/perseus-linter": "6.1.2",
|
|
43
|
+
"@khanacademy/perseus-score": "9.0.5",
|
|
44
44
|
"@khanacademy/perseus-utils": "3.0.0",
|
|
45
45
|
"@khanacademy/pure-markdown": "3.0.0",
|
|
46
46
|
"@khanacademy/simple-markdown": "4.0.0"
|
|
@@ -60,7 +60,6 @@
|
|
|
60
60
|
"@khanacademy/wonder-blocks-layout": "3.1.62",
|
|
61
61
|
"@khanacademy/wonder-blocks-link": "10.4.1",
|
|
62
62
|
"@khanacademy/wonder-blocks-modal": "8.9.0",
|
|
63
|
-
"@khanacademy/wonder-blocks-pill": "3.1.78",
|
|
64
63
|
"@khanacademy/wonder-blocks-popover": "7.0.0",
|
|
65
64
|
"@khanacademy/wonder-blocks-progress-spinner": "3.1.62",
|
|
66
65
|
"@khanacademy/wonder-blocks-switch": "3.4.14",
|
|
@@ -96,7 +95,6 @@
|
|
|
96
95
|
"@khanacademy/wonder-blocks-layout": "^3.1.62",
|
|
97
96
|
"@khanacademy/wonder-blocks-link": "^10.4.1",
|
|
98
97
|
"@khanacademy/wonder-blocks-modal": "^8.9.0",
|
|
99
|
-
"@khanacademy/wonder-blocks-pill": "^3.1.78",
|
|
100
98
|
"@khanacademy/wonder-blocks-popover": "^7.0.0",
|
|
101
99
|
"@khanacademy/wonder-blocks-progress-spinner": "^3.1.62",
|
|
102
100
|
"@khanacademy/wonder-blocks-switch": "^3.4.14",
|
|
@@ -117,7 +115,7 @@
|
|
|
117
115
|
},
|
|
118
116
|
"keywords": [],
|
|
119
117
|
"khan": {
|
|
120
|
-
"catalogHash": "
|
|
118
|
+
"catalogHash": "7484f91061a1760b"
|
|
121
119
|
},
|
|
122
120
|
"scripts": {}
|
|
123
121
|
}
|