@khanacademy/perseus-editor 30.3.0 → 30.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 +65 -61
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +64 -60
- package/dist/index.js.map +1 -1
- package/dist/preview/preview-data-sanitizer.d.ts +13 -0
- package/dist/preview/sanitize-api-options.d.ts +11 -0
- package/dist/widgets/interactive-graph-editor/components/vector-answer-options.d.ts +9 -0
- package/dist/widgets/interactive-graph-editor/interactive-graph-editor.d.ts +84 -0
- package/dist/widgets/interactive-graph-editor/locked-figures/util.d.ts +0 -5
- package/dist/widgets/interactive-graph-editor/start-coords/start-coords-absolute-value.d.ts +9 -0
- package/dist/widgets/interactive-graph-editor/start-coords/types.d.ts +2 -0
- package/package.json +42 -42
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PreviewContent } from "./message-types";
|
|
2
|
+
/**
|
|
3
|
+
* Sanitizes preview content by removing non-serializable functions and React
|
|
4
|
+
* components from apiOptions before sending via postMessage.
|
|
5
|
+
*
|
|
6
|
+
* NOTE: The article-all case currently sanitizes apiOptions on each section
|
|
7
|
+
* individually because the current type is ArticlePreviewData[] (each section
|
|
8
|
+
* carries its own apiOptions). This will be simplified to a single apiOptions
|
|
9
|
+
* when we restructure the preview data types.
|
|
10
|
+
*/
|
|
11
|
+
export declare function sanitizePreviewData(
|
|
12
|
+
/** Preview content to sanitize */
|
|
13
|
+
content: PreviewContent): PreviewContent;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { APIOptions } from "@khanacademy/perseus";
|
|
2
|
+
/**
|
|
3
|
+
* Removes non-serializable functions and React components from APIOptions
|
|
4
|
+
* before sending via postMessage.
|
|
5
|
+
*
|
|
6
|
+
* All function callbacks and React components are removed as they cannot be
|
|
7
|
+
* cloned by the structured clone algorithm used by postMessage.
|
|
8
|
+
*
|
|
9
|
+
* Serializable options (booleans, strings, numbers) are preserved.
|
|
10
|
+
*/
|
|
11
|
+
export declare function sanitizeApiOptions(apiOptions: APIOptions): Partial<APIOptions> | null;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { Props as EditorProps } from "../interactive-graph-editor";
|
|
3
|
+
import type { PerseusGraphTypeVector } from "@khanacademy/perseus-core";
|
|
4
|
+
interface Props {
|
|
5
|
+
correct: PerseusGraphTypeVector;
|
|
6
|
+
onChange: (props: Partial<EditorProps>) => void;
|
|
7
|
+
}
|
|
8
|
+
export default function VectorAnswerOptions({ correct, onChange }: Props): React.JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -5009,6 +5009,90 @@ declare const InteractiveGraph: {
|
|
|
5009
5009
|
linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
|
|
5010
5010
|
containerSizeClass: import("../../../../perseus/src/util/sizing-utils").SizeClass;
|
|
5011
5011
|
}): string;
|
|
5012
|
+
getVectorEquationString(props: {
|
|
5013
|
+
step: [number, number];
|
|
5014
|
+
gridStep?: [x: number, y: number];
|
|
5015
|
+
snapStep?: [x: number, y: number];
|
|
5016
|
+
backgroundImage?: PerseusImageBackground;
|
|
5017
|
+
markings: MarkingsType;
|
|
5018
|
+
labels: string[];
|
|
5019
|
+
labelLocation: AxisLabelLocation;
|
|
5020
|
+
showProtractor: boolean;
|
|
5021
|
+
showRuler?: boolean;
|
|
5022
|
+
showTooltips?: boolean;
|
|
5023
|
+
rulerLabel?: string;
|
|
5024
|
+
rulerTicks?: number;
|
|
5025
|
+
range: import("@khanacademy/perseus-core").GraphRange;
|
|
5026
|
+
showAxisArrows: ShowAxisArrows;
|
|
5027
|
+
graph: PerseusGraphType;
|
|
5028
|
+
correct?: PerseusGraphType;
|
|
5029
|
+
lockedFigures: LockedFigure[];
|
|
5030
|
+
fullGraphAriaLabel?: string;
|
|
5031
|
+
fullGraphAriaDescription?: string;
|
|
5032
|
+
} & {
|
|
5033
|
+
trackInteraction: (extraData?: Empty | undefined) => void;
|
|
5034
|
+
widgetId: string;
|
|
5035
|
+
widgetIndex: number;
|
|
5036
|
+
alignment: string | null | undefined;
|
|
5037
|
+
static: boolean | null | undefined;
|
|
5038
|
+
problemNum: number | null | undefined;
|
|
5039
|
+
apiOptions: Readonly<Readonly<{
|
|
5040
|
+
isArticle?: boolean;
|
|
5041
|
+
onFocusChange?: (newFocusPath: import("@khanacademy/perseus").FocusPath, oldFocusPath: import("@khanacademy/perseus").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
|
|
5042
|
+
showAlignmentOptions?: boolean;
|
|
5043
|
+
readOnly?: boolean;
|
|
5044
|
+
editingDisabled?: boolean;
|
|
5045
|
+
answerableCallback?: (arg1: boolean) => unknown;
|
|
5046
|
+
getAnotherHint?: () => unknown;
|
|
5047
|
+
interactionCallback?: (widgetData: {
|
|
5048
|
+
[widgetId: string]: any;
|
|
5049
|
+
}) => void;
|
|
5050
|
+
imagePlaceholder?: React.ReactNode;
|
|
5051
|
+
widgetPlaceholder?: React.ReactNode;
|
|
5052
|
+
baseElements?: {
|
|
5053
|
+
Link: React.ComponentType<any>;
|
|
5054
|
+
};
|
|
5055
|
+
imagePreloader?: (dimensions: import("../../../../perseus/src/types").Dimensions) => React.ReactNode;
|
|
5056
|
+
trackInteraction?: (args: {
|
|
5057
|
+
type: string;
|
|
5058
|
+
id: string;
|
|
5059
|
+
correct?: boolean;
|
|
5060
|
+
} & Partial<import("../../../../perseus/src/types").TrackingGradedGroupExtraArguments> & Partial<{
|
|
5061
|
+
visible: number;
|
|
5062
|
+
}>) => void;
|
|
5063
|
+
customKeypad?: boolean;
|
|
5064
|
+
nativeKeypadProxy?: (blur: () => void) => import("@khanacademy/math-input").KeypadAPI;
|
|
5065
|
+
isMobile?: boolean;
|
|
5066
|
+
isMobileApp?: boolean;
|
|
5067
|
+
setDrawingAreaAvailable?: (arg1: boolean) => unknown;
|
|
5068
|
+
hintProgressColor?: string;
|
|
5069
|
+
canScrollPage?: boolean;
|
|
5070
|
+
editorChangeDelay?: number;
|
|
5071
|
+
flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-absolute-value" | "interactive-graph-tangent" | "interactive-graph-logarithm" | "interactive-graph-exponent" | "interactive-graph-vector", boolean>;
|
|
5072
|
+
}> & {
|
|
5073
|
+
baseElements: NonNullable<import("@khanacademy/perseus").APIOptions["baseElements"]>;
|
|
5074
|
+
canScrollPage: NonNullable<import("@khanacademy/perseus").APIOptions["canScrollPage"]>;
|
|
5075
|
+
editorChangeDelay: NonNullable<import("@khanacademy/perseus").APIOptions["editorChangeDelay"]>;
|
|
5076
|
+
isArticle: NonNullable<import("@khanacademy/perseus").APIOptions["isArticle"]>;
|
|
5077
|
+
isMobile: NonNullable<import("@khanacademy/perseus").APIOptions["isMobile"]>;
|
|
5078
|
+
isMobileApp: NonNullable<import("@khanacademy/perseus").APIOptions["isMobileApp"]>;
|
|
5079
|
+
editingDisabled: NonNullable<import("@khanacademy/perseus").APIOptions["editingDisabled"]>;
|
|
5080
|
+
onFocusChange: NonNullable<import("@khanacademy/perseus").APIOptions["onFocusChange"]>;
|
|
5081
|
+
readOnly: NonNullable<import("@khanacademy/perseus").APIOptions["readOnly"]>;
|
|
5082
|
+
setDrawingAreaAvailable: NonNullable<import("@khanacademy/perseus").APIOptions["setDrawingAreaAvailable"]>;
|
|
5083
|
+
showAlignmentOptions: NonNullable<import("@khanacademy/perseus").APIOptions["showAlignmentOptions"]>;
|
|
5084
|
+
}>;
|
|
5085
|
+
keypadElement?: any;
|
|
5086
|
+
onFocus: (blurPath: import("@khanacademy/perseus").FocusPath) => void;
|
|
5087
|
+
onBlur: (blurPath: import("@khanacademy/perseus").FocusPath) => void;
|
|
5088
|
+
findWidgets: import("../../../../perseus/src/types").FindWidgetsFunction;
|
|
5089
|
+
reviewMode: boolean;
|
|
5090
|
+
showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
|
|
5091
|
+
handleUserInput: (newUserInput: PerseusGraphType, cb?: () => void, silent?: boolean) => void;
|
|
5092
|
+
userInput: PerseusGraphType;
|
|
5093
|
+
linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
|
|
5094
|
+
containerSizeClass: import("../../../../perseus/src/util/sizing-utils").SizeClass;
|
|
5095
|
+
}): string;
|
|
5012
5096
|
contextType?: React.Context<any> | undefined;
|
|
5013
5097
|
};
|
|
5014
5098
|
type InteractiveGraphProps = PropsFor<typeof InteractiveGraph>;
|
|
@@ -14,8 +14,3 @@ export declare function generateSpokenMathDetails(mathString: string): Promise<s
|
|
|
14
14
|
* spoken math using the SpeechRuleEngine.
|
|
15
15
|
*/
|
|
16
16
|
export declare function joinLabelsAsSpokenMath(labels: LockedLabelType[]): Promise<string>;
|
|
17
|
-
/**
|
|
18
|
-
* Non-async mocked version of joinLabelsAsSpokenMath for tests.
|
|
19
|
-
*/
|
|
20
|
-
export declare function mockedJoinLabelsAsSpokenMathForTests(labels: LockedLabelType[]): Promise<string>;
|
|
21
|
-
export declare function mockedGenerateSpokenMathDetailsForTests(mathString: string): Promise<string>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { Coord } from "@khanacademy/perseus";
|
|
3
|
+
type AbsoluteValueCoords = [Coord, Coord];
|
|
4
|
+
type Props = {
|
|
5
|
+
startCoords: AbsoluteValueCoords;
|
|
6
|
+
onChange: (startCoords: AbsoluteValueCoords) => void;
|
|
7
|
+
};
|
|
8
|
+
declare const StartCoordsAbsoluteValue: (props: Props) => React.JSX.Element;
|
|
9
|
+
export default StartCoordsAbsoluteValue;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Perseus editors",
|
|
4
4
|
"author": "Khan Academy",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "30.
|
|
6
|
+
"version": "30.4.1",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -35,36 +35,36 @@
|
|
|
35
35
|
"katex": "0.11.1",
|
|
36
36
|
"mafs": "^0.19.0",
|
|
37
37
|
"tiny-invariant": "1.3.1",
|
|
38
|
-
"@khanacademy/kas": "2.2.
|
|
39
|
-
"@khanacademy/keypad-context": "3.2.
|
|
40
|
-
"@khanacademy/kmath": "2.4.
|
|
41
|
-
"@khanacademy/math-input": "26.4.
|
|
42
|
-
"@khanacademy/perseus": "77.
|
|
43
|
-
"@khanacademy/perseus-core": "
|
|
44
|
-
"@khanacademy/perseus-linter": "4.9.
|
|
45
|
-
"@khanacademy/perseus-score": "8.
|
|
38
|
+
"@khanacademy/kas": "2.2.2",
|
|
39
|
+
"@khanacademy/keypad-context": "3.2.44",
|
|
40
|
+
"@khanacademy/kmath": "2.4.2",
|
|
41
|
+
"@khanacademy/math-input": "26.4.16",
|
|
42
|
+
"@khanacademy/perseus": "77.3.1",
|
|
43
|
+
"@khanacademy/perseus-core": "25.0.0",
|
|
44
|
+
"@khanacademy/perseus-linter": "4.9.5",
|
|
45
|
+
"@khanacademy/perseus-score": "8.7.0",
|
|
46
46
|
"@khanacademy/perseus-utils": "2.1.5"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@khanacademy/mathjax-renderer": "3.0.0",
|
|
50
|
-
"@khanacademy/wonder-blocks-accordion": "3.1.
|
|
51
|
-
"@khanacademy/wonder-blocks-banner": "5.0.
|
|
52
|
-
"@khanacademy/wonder-blocks-button": "11.
|
|
53
|
-
"@khanacademy/wonder-blocks-clickable": "8.1.
|
|
50
|
+
"@khanacademy/wonder-blocks-accordion": "3.1.54",
|
|
51
|
+
"@khanacademy/wonder-blocks-banner": "5.0.20",
|
|
52
|
+
"@khanacademy/wonder-blocks-button": "11.5.1",
|
|
53
|
+
"@khanacademy/wonder-blocks-clickable": "8.1.6",
|
|
54
54
|
"@khanacademy/wonder-blocks-core": "12.4.3",
|
|
55
|
-
"@khanacademy/wonder-blocks-dropdown": "10.8.
|
|
56
|
-
"@khanacademy/wonder-blocks-form": "7.5.
|
|
57
|
-
"@khanacademy/wonder-blocks-icon": "5.3.
|
|
58
|
-
"@khanacademy/wonder-blocks-icon-button": "11.1
|
|
59
|
-
"@khanacademy/wonder-blocks-labeled-field": "4.0.
|
|
60
|
-
"@khanacademy/wonder-blocks-layout": "3.1.
|
|
61
|
-
"@khanacademy/wonder-blocks-link": "10.1.
|
|
62
|
-
"@khanacademy/wonder-blocks-pill": "3.1.
|
|
63
|
-
"@khanacademy/wonder-blocks-switch": "3.3.
|
|
55
|
+
"@khanacademy/wonder-blocks-dropdown": "10.8.5",
|
|
56
|
+
"@khanacademy/wonder-blocks-form": "7.5.7",
|
|
57
|
+
"@khanacademy/wonder-blocks-icon": "5.3.10",
|
|
58
|
+
"@khanacademy/wonder-blocks-icon-button": "11.2.1",
|
|
59
|
+
"@khanacademy/wonder-blocks-labeled-field": "4.0.17",
|
|
60
|
+
"@khanacademy/wonder-blocks-layout": "3.1.47",
|
|
61
|
+
"@khanacademy/wonder-blocks-link": "10.1.8",
|
|
62
|
+
"@khanacademy/wonder-blocks-pill": "3.1.58",
|
|
63
|
+
"@khanacademy/wonder-blocks-switch": "3.3.31",
|
|
64
64
|
"@khanacademy/wonder-blocks-timing": "7.0.4",
|
|
65
|
-
"@khanacademy/wonder-blocks-tokens": "16.
|
|
66
|
-
"@khanacademy/wonder-blocks-tooltip": "4.1.
|
|
67
|
-
"@khanacademy/wonder-blocks-typography": "4.
|
|
65
|
+
"@khanacademy/wonder-blocks-tokens": "16.2.0",
|
|
66
|
+
"@khanacademy/wonder-blocks-tooltip": "4.1.71",
|
|
67
|
+
"@khanacademy/wonder-blocks-typography": "4.3.0",
|
|
68
68
|
"@khanacademy/wonder-stuff-core": "3.0.0",
|
|
69
69
|
"@phosphor-icons/core": "2.0.2",
|
|
70
70
|
"aphrodite": "1.2.5",
|
|
@@ -79,24 +79,24 @@
|
|
|
79
79
|
},
|
|
80
80
|
"peerDependencies": {
|
|
81
81
|
"@khanacademy/mathjax-renderer": "^3.0.0",
|
|
82
|
-
"@khanacademy/wonder-blocks-accordion": "^3.1.
|
|
83
|
-
"@khanacademy/wonder-blocks-banner": "^5.0.
|
|
84
|
-
"@khanacademy/wonder-blocks-button": "^11.
|
|
85
|
-
"@khanacademy/wonder-blocks-clickable": "^8.1.
|
|
82
|
+
"@khanacademy/wonder-blocks-accordion": "^3.1.54",
|
|
83
|
+
"@khanacademy/wonder-blocks-banner": "^5.0.20",
|
|
84
|
+
"@khanacademy/wonder-blocks-button": "^11.5.1",
|
|
85
|
+
"@khanacademy/wonder-blocks-clickable": "^8.1.6",
|
|
86
86
|
"@khanacademy/wonder-blocks-core": "^12.4.3",
|
|
87
|
-
"@khanacademy/wonder-blocks-dropdown": "^10.8.
|
|
88
|
-
"@khanacademy/wonder-blocks-form": "^7.5.
|
|
89
|
-
"@khanacademy/wonder-blocks-icon": "^5.3.
|
|
90
|
-
"@khanacademy/wonder-blocks-icon-button": "^11.1
|
|
91
|
-
"@khanacademy/wonder-blocks-labeled-field": "^4.0.
|
|
92
|
-
"@khanacademy/wonder-blocks-layout": "^3.1.
|
|
93
|
-
"@khanacademy/wonder-blocks-link": "^10.1.
|
|
94
|
-
"@khanacademy/wonder-blocks-pill": "^3.1.
|
|
95
|
-
"@khanacademy/wonder-blocks-switch": "^3.3.
|
|
87
|
+
"@khanacademy/wonder-blocks-dropdown": "^10.8.5",
|
|
88
|
+
"@khanacademy/wonder-blocks-form": "^7.5.7",
|
|
89
|
+
"@khanacademy/wonder-blocks-icon": "^5.3.10",
|
|
90
|
+
"@khanacademy/wonder-blocks-icon-button": "^11.2.1",
|
|
91
|
+
"@khanacademy/wonder-blocks-labeled-field": "^4.0.17",
|
|
92
|
+
"@khanacademy/wonder-blocks-layout": "^3.1.47",
|
|
93
|
+
"@khanacademy/wonder-blocks-link": "^10.1.8",
|
|
94
|
+
"@khanacademy/wonder-blocks-pill": "^3.1.58",
|
|
95
|
+
"@khanacademy/wonder-blocks-switch": "^3.3.31",
|
|
96
96
|
"@khanacademy/wonder-blocks-timing": "^7.0.4",
|
|
97
|
-
"@khanacademy/wonder-blocks-tokens": "^16.
|
|
98
|
-
"@khanacademy/wonder-blocks-tooltip": "^4.1.
|
|
99
|
-
"@khanacademy/wonder-blocks-typography": "^4.
|
|
97
|
+
"@khanacademy/wonder-blocks-tokens": "^16.2.0",
|
|
98
|
+
"@khanacademy/wonder-blocks-tooltip": "^4.1.71",
|
|
99
|
+
"@khanacademy/wonder-blocks-typography": "^4.3.0",
|
|
100
100
|
"@khanacademy/wonder-stuff-core": "^3.0.0",
|
|
101
101
|
"@phosphor-icons/core": "^2.0.2",
|
|
102
102
|
"aphrodite": "^1.2.5",
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
},
|
|
110
110
|
"keywords": [],
|
|
111
111
|
"khan": {
|
|
112
|
-
"catalogHash": "
|
|
112
|
+
"catalogHash": "522e5ac78ae83dd8"
|
|
113
113
|
},
|
|
114
114
|
"scripts": {}
|
|
115
115
|
}
|