@khanacademy/perseus 82.0.1 → 82.1.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/es/index.css +1 -1
- package/dist/es/index.css.map +1 -1
- package/dist/es/index.js +7 -7
- 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.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/strings.js +1 -1
- package/dist/strings.js.map +1 -1
- package/dist/widgets/cs-program/cs-program.d.ts +60 -26
- package/dist/widgets/number-line/number-line.d.ts +62 -7
- package/package.json +7 -7
|
@@ -1,32 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This widget is for embedding Khan Academy CS programs.
|
|
3
3
|
*/
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import type { Widget, WidgetProps } from "../../types";
|
|
7
|
-
import type { UnsupportedWidgetPromptJSON } from "../../widget-ai-utils/unsupported-widget";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import type { Widget } from "../../types";
|
|
8
6
|
import type { PerseusCSProgramWidgetOptions, PerseusCSProgramUserInput } from "@khanacademy/perseus-core";
|
|
9
|
-
type
|
|
10
|
-
type DefaultProps = {
|
|
11
|
-
showEditor: Props["showEditor"];
|
|
12
|
-
showButtons: Props["showButtons"];
|
|
13
|
-
userInput: Props["userInput"];
|
|
14
|
-
};
|
|
15
|
-
declare class CSProgram extends React.Component<Props> implements Widget {
|
|
16
|
-
static contextType: React.Context<import("../../components/i18n-context").I18nContextType>;
|
|
17
|
-
context: React.ContextType<typeof PerseusI18nContext>;
|
|
18
|
-
static defaultProps: DefaultProps;
|
|
19
|
-
componentDidMount(): void;
|
|
20
|
-
componentWillUnmount(): void;
|
|
21
|
-
handleMessageEvent: (arg1: any) => void;
|
|
22
|
-
getPromptJSON(): UnsupportedWidgetPromptJSON;
|
|
23
|
-
/**
|
|
24
|
-
* @deprecated and likely very broken API
|
|
25
|
-
* [LEMS-3185] do not trust serializedState
|
|
26
|
-
*/
|
|
27
|
-
getSerializedState(): any;
|
|
28
|
-
render(): React.ReactNode;
|
|
29
|
-
}
|
|
7
|
+
type WidgetHandle = Pick<Widget, "getPromptJSON" | "getSerializedState">;
|
|
30
8
|
/**
|
|
31
9
|
* @deprecated and likely a very broken API
|
|
32
10
|
* [LEMS-3185] do not trust serializedState
|
|
@@ -36,7 +14,63 @@ declare function getStartUserInput(): PerseusCSProgramUserInput;
|
|
|
36
14
|
declare const _default: {
|
|
37
15
|
name: string;
|
|
38
16
|
displayName: string;
|
|
39
|
-
widget:
|
|
17
|
+
widget: React.ForwardRefExoticComponent<PerseusCSProgramWidgetOptions & {
|
|
18
|
+
trackInteraction: (extraData?: Empty | undefined) => void;
|
|
19
|
+
widgetId: string;
|
|
20
|
+
widgetIndex: number;
|
|
21
|
+
alignment: string | null | undefined;
|
|
22
|
+
static: boolean | null | undefined;
|
|
23
|
+
graded?: boolean | null;
|
|
24
|
+
problemNum: number | null | undefined;
|
|
25
|
+
apiOptions: Readonly<Readonly<{
|
|
26
|
+
isArticle?: boolean;
|
|
27
|
+
onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
|
|
28
|
+
showAlignmentOptions?: boolean;
|
|
29
|
+
readOnly?: boolean;
|
|
30
|
+
editingDisabled?: boolean;
|
|
31
|
+
answerableCallback?: (arg1: boolean) => unknown;
|
|
32
|
+
getAnotherHint?: () => unknown;
|
|
33
|
+
interactionCallback?: (widgetData: {
|
|
34
|
+
[widgetId: string]: any;
|
|
35
|
+
}) => void;
|
|
36
|
+
imagePlaceholder?: React.ReactNode;
|
|
37
|
+
widgetPlaceholder?: React.ReactNode;
|
|
38
|
+
baseElements?: {
|
|
39
|
+
Link: React.ComponentType<any>;
|
|
40
|
+
};
|
|
41
|
+
trackInteraction?: (args: {
|
|
42
|
+
type: string;
|
|
43
|
+
id: string;
|
|
44
|
+
correct?: boolean;
|
|
45
|
+
} & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<{
|
|
46
|
+
visible: number;
|
|
47
|
+
}>) => void;
|
|
48
|
+
customKeypad?: boolean;
|
|
49
|
+
isMobile?: boolean;
|
|
50
|
+
isMobileApp?: boolean;
|
|
51
|
+
hintProgressColor?: string;
|
|
52
|
+
flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator", boolean>;
|
|
53
|
+
}> & {
|
|
54
|
+
baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
|
|
55
|
+
isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
|
|
56
|
+
isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
|
|
57
|
+
isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
|
|
58
|
+
editingDisabled: NonNullable<import("../..").APIOptions["editingDisabled"]>;
|
|
59
|
+
onFocusChange: NonNullable<import("../..").APIOptions["onFocusChange"]>;
|
|
60
|
+
readOnly: NonNullable<import("../..").APIOptions["readOnly"]>;
|
|
61
|
+
showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
|
|
62
|
+
}>;
|
|
63
|
+
keypadElement?: any;
|
|
64
|
+
onFocus: (blurPath: import("../..").FocusPath) => void;
|
|
65
|
+
onBlur: (blurPath: import("../..").FocusPath) => void;
|
|
66
|
+
findWidgets: import("../../types").FindWidgetsFunction;
|
|
67
|
+
reviewMode: boolean;
|
|
68
|
+
showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
|
|
69
|
+
handleUserInput: (newUserInput: PerseusCSProgramUserInput, cb?: () => void, silent?: boolean) => void;
|
|
70
|
+
userInput: PerseusCSProgramUserInput;
|
|
71
|
+
linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
|
|
72
|
+
containerSizeClass: import("../../util/sizing-utils").SizeClass;
|
|
73
|
+
} & React.RefAttributes<WidgetHandle>>;
|
|
40
74
|
hidden: true;
|
|
41
75
|
getStartUserInput: typeof getStartUserInput;
|
|
42
76
|
getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import type {
|
|
2
|
+
import type { Widget, PerseusDependenciesV2 } from "../../types";
|
|
3
3
|
import type { PerseusNumberLineUserInput, PerseusNumberLineWidgetOptions, NumberLinePublicWidgetOptions } from "@khanacademy/perseus-core";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*/
|
|
7
|
-
type Props = WidgetProps<PerseusNumberLineWidgetOptions, PerseusNumberLineUserInput> & {
|
|
8
|
-
dependencies: PerseusDependenciesV2;
|
|
4
|
+
type WidgetHandle = Pick<Widget, "focus" | "focusInputPath" | "blurInputPath" | "getInputPaths" | "getDOMNodeForPath" | "getSerializedState" | "getPromptJSON"> & {
|
|
5
|
+
movePosition: (targetPosition: number) => void;
|
|
9
6
|
};
|
|
10
7
|
/**
|
|
11
8
|
* @deprecated and likely a very broken API
|
|
@@ -17,7 +14,65 @@ declare function getStartUserInput(options: NumberLinePublicWidgetOptions): Pers
|
|
|
17
14
|
declare const _default: {
|
|
18
15
|
name: string;
|
|
19
16
|
displayName: string;
|
|
20
|
-
widget: React.ForwardRefExoticComponent<Omit<
|
|
17
|
+
widget: React.ForwardRefExoticComponent<Omit<Omit<PerseusNumberLineWidgetOptions & {
|
|
18
|
+
trackInteraction: (extraData?: Empty | undefined) => void;
|
|
19
|
+
widgetId: string;
|
|
20
|
+
widgetIndex: number;
|
|
21
|
+
alignment: string | null | undefined;
|
|
22
|
+
static: boolean | null | undefined;
|
|
23
|
+
graded?: boolean | null;
|
|
24
|
+
problemNum: number | null | undefined;
|
|
25
|
+
apiOptions: Readonly<Readonly<{
|
|
26
|
+
isArticle?: boolean;
|
|
27
|
+
onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
|
|
28
|
+
showAlignmentOptions?: boolean;
|
|
29
|
+
readOnly?: boolean;
|
|
30
|
+
editingDisabled?: boolean;
|
|
31
|
+
answerableCallback?: (arg1: boolean) => unknown;
|
|
32
|
+
getAnotherHint?: () => unknown;
|
|
33
|
+
interactionCallback?: (widgetData: {
|
|
34
|
+
[widgetId: string]: any;
|
|
35
|
+
}) => void;
|
|
36
|
+
imagePlaceholder?: React.ReactNode;
|
|
37
|
+
widgetPlaceholder?: React.ReactNode;
|
|
38
|
+
baseElements?: {
|
|
39
|
+
Link: React.ComponentType<any>;
|
|
40
|
+
};
|
|
41
|
+
trackInteraction?: (args: {
|
|
42
|
+
type: string;
|
|
43
|
+
id: string;
|
|
44
|
+
correct?: boolean;
|
|
45
|
+
} & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<{
|
|
46
|
+
visible: number;
|
|
47
|
+
}>) => void;
|
|
48
|
+
customKeypad?: boolean;
|
|
49
|
+
isMobile?: boolean;
|
|
50
|
+
isMobileApp?: boolean;
|
|
51
|
+
hintProgressColor?: string;
|
|
52
|
+
flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator", boolean>;
|
|
53
|
+
}> & {
|
|
54
|
+
baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
|
|
55
|
+
isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
|
|
56
|
+
isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
|
|
57
|
+
isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
|
|
58
|
+
editingDisabled: NonNullable<import("../..").APIOptions["editingDisabled"]>;
|
|
59
|
+
onFocusChange: NonNullable<import("../..").APIOptions["onFocusChange"]>;
|
|
60
|
+
readOnly: NonNullable<import("../..").APIOptions["readOnly"]>;
|
|
61
|
+
showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
|
|
62
|
+
}>;
|
|
63
|
+
keypadElement?: any;
|
|
64
|
+
onFocus: (blurPath: import("../..").FocusPath) => void;
|
|
65
|
+
onBlur: (blurPath: import("../..").FocusPath) => void;
|
|
66
|
+
findWidgets: import("../../types").FindWidgetsFunction;
|
|
67
|
+
reviewMode: boolean;
|
|
68
|
+
showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
|
|
69
|
+
handleUserInput: (newUserInput: PerseusNumberLineUserInput, cb?: () => void, silent?: boolean) => void;
|
|
70
|
+
userInput: PerseusNumberLineUserInput;
|
|
71
|
+
linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
|
|
72
|
+
containerSizeClass: import("../../util/sizing-utils").SizeClass;
|
|
73
|
+
} & {
|
|
74
|
+
dependencies: PerseusDependenciesV2;
|
|
75
|
+
} & React.RefAttributes<WidgetHandle>, "dependencies">, "ref"> & React.RefAttributes<any>>;
|
|
21
76
|
getCorrectUserInput: typeof getCorrectUserInput;
|
|
22
77
|
getStartUserInput: typeof getStartUserInput;
|
|
23
78
|
getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
|
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": "82.0
|
|
6
|
+
"version": "82.1.0",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -42,13 +42,13 @@
|
|
|
42
42
|
"mafs": "0.19.0",
|
|
43
43
|
"tiny-invariant": "1.3.1",
|
|
44
44
|
"uuid": "^10.0.0",
|
|
45
|
-
"@khanacademy/keypad-context": "3.2.76",
|
|
46
|
-
"@khanacademy/kmath": "2.4.35",
|
|
47
|
-
"@khanacademy/math-input": "26.6.5",
|
|
48
|
-
"@khanacademy/perseus-linter": "5.1.16",
|
|
49
45
|
"@khanacademy/kas": "2.2.3",
|
|
50
|
-
"@khanacademy/
|
|
51
|
-
"@khanacademy/
|
|
46
|
+
"@khanacademy/keypad-context": "3.2.77",
|
|
47
|
+
"@khanacademy/kmath": "2.4.36",
|
|
48
|
+
"@khanacademy/math-input": "26.6.6",
|
|
49
|
+
"@khanacademy/perseus-core": "33.0.1",
|
|
50
|
+
"@khanacademy/perseus-linter": "5.1.17",
|
|
51
|
+
"@khanacademy/perseus-score": "8.12.9",
|
|
52
52
|
"@khanacademy/perseus-utils": "2.1.5",
|
|
53
53
|
"@khanacademy/pure-markdown": "2.3.1",
|
|
54
54
|
"@khanacademy/simple-markdown": "3.0.0"
|