@khanacademy/perseus 45.1.0 → 46.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/es/index.js +166 -186
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +141 -160
- package/dist/index.js.map +1 -1
- package/dist/renderer.d.ts +0 -1
- package/dist/types.d.ts +0 -1
- package/dist/util/scoring.d.ts +20 -0
- package/dist/util.d.ts +0 -30
- package/dist/widgets/input-number/input-number.d.ts +1 -1
- package/dist/widgets/numeric-input/numeric-input.d.ts +5 -1
- package/package.json +1 -1
package/dist/renderer.d.ts
CHANGED
|
@@ -232,7 +232,6 @@ declare class Renderer extends React.Component<Props, State> implements GetPromp
|
|
|
232
232
|
* @deprecated use scorePerseusItem
|
|
233
233
|
*/
|
|
234
234
|
guessAndScore: () => [UserInputArray, PerseusScore];
|
|
235
|
-
examples: () => ReadonlyArray<string> | null | undefined;
|
|
236
235
|
handletranslationLintErrors: (lintErrors: ReadonlyArray<string>) => void;
|
|
237
236
|
render(): React.ReactNode;
|
|
238
237
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -61,7 +61,6 @@ export interface Widget {
|
|
|
61
61
|
getUserInputMap?: () => UserInputMap | undefined;
|
|
62
62
|
getUserInput?: () => UserInputArray | UserInput | undefined;
|
|
63
63
|
showRationalesForCurrentlySelectedChoices?: (options?: any) => void;
|
|
64
|
-
examples?: () => ReadonlyArray<string>;
|
|
65
64
|
getPromptJSON?: () => WidgetPromptJSON;
|
|
66
65
|
}
|
|
67
66
|
export type ImageDict = {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { PerseusScore } from "../types";
|
|
2
|
+
import type { UserInputArray } from "../validation.types";
|
|
3
|
+
import type { KEScore } from "@khanacademy/perseus-core";
|
|
4
|
+
/**
|
|
5
|
+
* If a widget says that it is empty once it is graded.
|
|
6
|
+
* Trying to encapsulate references to the score format.
|
|
7
|
+
*/
|
|
8
|
+
export declare function scoreIsEmpty(score: PerseusScore): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Combine two score objects.
|
|
11
|
+
*
|
|
12
|
+
* Given two score objects for two different widgets, combine them so that
|
|
13
|
+
* if one is wrong, the total score is wrong, etc.
|
|
14
|
+
*/
|
|
15
|
+
export declare function combineScores(scoreA: PerseusScore, scoreB: PerseusScore): PerseusScore;
|
|
16
|
+
export declare function flattenScores(widgetScoreMap: {
|
|
17
|
+
[widgetId: string]: PerseusScore;
|
|
18
|
+
}): PerseusScore;
|
|
19
|
+
export declare function isCorrect(score: PerseusScore): boolean;
|
|
20
|
+
export declare function keScoreFromPerseusScore(score: PerseusScore, guess: UserInputArray | [UserInputArray, []], state: any): KEScore;
|
package/dist/util.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import * as GraphieUtil from "./util.graphie";
|
|
2
2
|
import type { Range } from "./perseus-types";
|
|
3
3
|
import type { PerseusStrings } from "./strings";
|
|
4
|
-
import type { PerseusScore } from "./types";
|
|
5
|
-
import type { UserInputArray } from "./validation.types";
|
|
6
|
-
import type { KEScore } from "@khanacademy/perseus-core";
|
|
7
4
|
import type * as React from "react";
|
|
8
5
|
type WordPosition = {
|
|
9
6
|
start: number;
|
|
@@ -41,18 +38,6 @@ type TouchHandlers = {
|
|
|
41
38
|
*/
|
|
42
39
|
declare function inputPathsEqual(a?: ReadonlyArray<string> | null, b?: ReadonlyArray<string> | null): boolean;
|
|
43
40
|
declare function shuffle<T>(array: ReadonlyArray<T>, randomSeed: number | RNG, ensurePermuted?: boolean): ReadonlyArray<T>;
|
|
44
|
-
/**
|
|
45
|
-
* Combine two score objects.
|
|
46
|
-
*
|
|
47
|
-
* Given two score objects for two different widgets, combine them so that
|
|
48
|
-
* if one is wrong, the total score is wrong, etc.
|
|
49
|
-
*/
|
|
50
|
-
declare function combineScores(scoreA: PerseusScore, scoreB: PerseusScore): PerseusScore;
|
|
51
|
-
declare function flattenScores(widgetScoreMap: {
|
|
52
|
-
[widgetId: string]: PerseusScore;
|
|
53
|
-
}): PerseusScore;
|
|
54
|
-
export declare function isCorrect(score: PerseusScore): boolean;
|
|
55
|
-
declare function keScoreFromPerseusScore(score: PerseusScore, guess: UserInputArray | [UserInputArray, []], state: any): KEScore;
|
|
56
41
|
/**
|
|
57
42
|
* Return the first valid interpretation of 'text' as a number, in the form
|
|
58
43
|
* {value: 2.3, exact: true}.
|
|
@@ -156,11 +141,6 @@ declare function updateQueryString(uri: string, key: string, value: string): str
|
|
|
156
141
|
* CC-BY-SA 2.5 license.
|
|
157
142
|
*/
|
|
158
143
|
declare function strongEncodeURIComponent(str: string): string;
|
|
159
|
-
/**
|
|
160
|
-
* If a widget says that it is empty once it is graded.
|
|
161
|
-
* Trying to encapsulate references to the score format.
|
|
162
|
-
*/
|
|
163
|
-
declare function scoreIsEmpty(score: PerseusScore): boolean;
|
|
164
144
|
declare function resetTouchHandlers(): void;
|
|
165
145
|
/**
|
|
166
146
|
* Extracts the location of a touch or mouse event, allowing you to pass
|
|
@@ -197,18 +177,9 @@ declare const Util: {
|
|
|
197
177
|
readonly rTypeFromWidgetId: RegExp;
|
|
198
178
|
readonly rWidgetParts: RegExp;
|
|
199
179
|
readonly snowman: "☃";
|
|
200
|
-
readonly noScore: {
|
|
201
|
-
type: "points";
|
|
202
|
-
earned: number;
|
|
203
|
-
total: number;
|
|
204
|
-
message?: string | null | undefined;
|
|
205
|
-
};
|
|
206
180
|
readonly seededRNG: (seed: number) => RNG;
|
|
207
181
|
readonly shuffle: typeof shuffle;
|
|
208
182
|
readonly split: (str: string, r: RegExp) => ReadonlyArray<string>;
|
|
209
|
-
readonly combineScores: typeof combineScores;
|
|
210
|
-
readonly flattenScores: typeof flattenScores;
|
|
211
|
-
readonly keScoreFromPerseusScore: typeof keScoreFromPerseusScore;
|
|
212
183
|
readonly firstNumericalParse: typeof firstNumericalParse;
|
|
213
184
|
readonly stringArrayOfSize: typeof stringArrayOfSize;
|
|
214
185
|
readonly gridDimensionConfig: typeof gridDimensionConfig;
|
|
@@ -224,7 +195,6 @@ declare const Util: {
|
|
|
224
195
|
readonly parseQueryString: typeof parseQueryString;
|
|
225
196
|
readonly updateQueryString: typeof updateQueryString;
|
|
226
197
|
readonly strongEncodeURIComponent: typeof strongEncodeURIComponent;
|
|
227
|
-
readonly scoreIsEmpty: typeof scoreIsEmpty;
|
|
228
198
|
readonly touchHandlers: TouchHandlers;
|
|
229
199
|
readonly resetTouchHandlers: typeof resetTouchHandlers;
|
|
230
200
|
readonly extractPointerLocation: typeof extractPointerLocation;
|
|
@@ -50,7 +50,7 @@ declare class InputNumber extends React.Component<Props> implements Widget {
|
|
|
50
50
|
setInputValue: (arg1: Path, arg2: string, arg3: () => void) => void;
|
|
51
51
|
getUserInput(): PerseusInputNumberUserInput;
|
|
52
52
|
getPromptJSON(): InputNumberPromptJSON;
|
|
53
|
-
examples
|
|
53
|
+
examples(): ReadonlyArray<string>;
|
|
54
54
|
render(): React.ReactNode;
|
|
55
55
|
}
|
|
56
56
|
declare const _default: {
|
|
@@ -43,7 +43,11 @@ export declare class NumericInput extends React.Component<Props, State> implemen
|
|
|
43
43
|
static defaultProps: DefaultProps;
|
|
44
44
|
static getUserInputFromProps(props: Props): PerseusNumericInputUserInput;
|
|
45
45
|
state: State;
|
|
46
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Generates a string that demonstrates how to input the various supported
|
|
48
|
+
* answer forms.
|
|
49
|
+
*/
|
|
50
|
+
examples(): ReadonlyArray<string>;
|
|
47
51
|
shouldShowExamples: () => boolean;
|
|
48
52
|
focus: () => boolean;
|
|
49
53
|
focusInputPath: () => void;
|