@khanacademy/perseus 47.0.0 → 48.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 +259 -187
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +249 -187
- package/dist/index.js.map +1 -1
- package/dist/perseus-types.d.ts +33 -4
- package/dist/renderer.d.ts +0 -4
- package/dist/server-item-renderer.d.ts +0 -6
- package/dist/util/test-utils.d.ts +7 -1
- package/package.json +9 -9
package/dist/perseus-types.d.ts
CHANGED
|
@@ -1,8 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The Perseus "data schema" file.
|
|
3
|
+
*
|
|
4
|
+
* This file, and the types in it, represents the "data schema" that Perseus
|
|
5
|
+
* uses. The @khanacademy/perseus-editor package edits and produces objects
|
|
6
|
+
* that conform to the types in this file. Similarly, the top-level renderers
|
|
7
|
+
* in @khanacademy/perseus, consume objects that conform to these types.
|
|
8
|
+
*
|
|
9
|
+
* WARNING: This file should not import any types from elsewhere so that it is
|
|
10
|
+
* easy to reason about changes that alter the Perseus schema. This helps
|
|
11
|
+
* ensure that it is not changed accidentally when upgrading a dependant
|
|
12
|
+
* package or other part of Perseus code. Note that TypeScript does type
|
|
13
|
+
* checking via something called "structural typing". This means that as long
|
|
14
|
+
* as the shape of a type matches, the name it goes by doesn't matter. As a
|
|
15
|
+
* result, a `Coord` type that looks like this `[x: number, y: number]` is
|
|
16
|
+
* _identical_, in TypeScript's eyes, to this `Vector2` type `[x: number, y:
|
|
17
|
+
* number]`. Also, with tuples, the labels for each entry is ignored, so `[x:
|
|
18
|
+
* number, y: number]` is compatible with `[min: number, max: number]`. The
|
|
19
|
+
* labels are for humans, not TypeScript. :)
|
|
20
|
+
*
|
|
21
|
+
* If you make changes to types in this file, be very sure that:
|
|
22
|
+
*
|
|
23
|
+
* a) the changes are backwards compatible. If they are not, old data from
|
|
24
|
+
* previous versions of the "schema" could become unrenderable, or worse,
|
|
25
|
+
* introduce hard-to-diagnose bugs.
|
|
26
|
+
* b) the parsing code (`util/parse-perseus-json/`) is updated to handle
|
|
27
|
+
* the new format _as well as_ the old format.
|
|
28
|
+
*/
|
|
29
|
+
export type Coord = [x: number, y: number];
|
|
30
|
+
export type Interval = [min: number, max: number];
|
|
31
|
+
export type Vector2 = Coord;
|
|
3
32
|
export type Range = Interval;
|
|
4
|
-
export type Size = [number, number];
|
|
5
|
-
export type CollinearTuple = [
|
|
33
|
+
export type Size = [width: number, height: number];
|
|
34
|
+
export type CollinearTuple = [Vector2, Vector2];
|
|
6
35
|
export type ShowSolutions = "all" | "selected" | "none";
|
|
7
36
|
/**
|
|
8
37
|
* Our core set of Perseus widgets.
|
package/dist/renderer.d.ts
CHANGED
|
@@ -228,10 +228,6 @@ declare class Renderer extends React.Component<Props, State> implements GetPromp
|
|
|
228
228
|
* @deprecated use scorePerseusItem
|
|
229
229
|
*/
|
|
230
230
|
score(): PerseusScore;
|
|
231
|
-
/**
|
|
232
|
-
* @deprecated use scorePerseusItem
|
|
233
|
-
*/
|
|
234
|
-
guessAndScore: () => [UserInputArray, PerseusScore];
|
|
235
231
|
handletranslationLintErrors: (lintErrors: ReadonlyArray<string>) => void;
|
|
236
232
|
render(): React.ReactNode;
|
|
237
233
|
}
|
|
@@ -105,12 +105,6 @@ export declare class ServerItemRenderer extends React.Component<Props, State> im
|
|
|
105
105
|
* Returns an object of the widget `.getUserInput()` results
|
|
106
106
|
*/
|
|
107
107
|
getUserInput(): UserInputMap;
|
|
108
|
-
/**
|
|
109
|
-
* Grades the item.
|
|
110
|
-
*
|
|
111
|
-
* @deprecated use scorePerseusItem
|
|
112
|
-
*/
|
|
113
|
-
scoreInput(): KEScore;
|
|
114
108
|
/**
|
|
115
109
|
* Returns an array of all widget IDs in the order they occur in
|
|
116
110
|
* the question content.
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import type { CategorizerWidget, ExpressionWidget, InteractiveGraphWidget, NumericInputWidget, PerseusItem, RadioWidget } from "../perseus-types";
|
|
1
|
+
import type { CategorizerWidget, ExpressionWidget, InteractiveGraphWidget, NumericInputWidget, PerseusItem, PerseusRenderer, RadioWidget } from "../perseus-types";
|
|
2
|
+
import type { PerseusScore } from "../types";
|
|
3
|
+
import type { UserInputMap } from "../validation.types";
|
|
2
4
|
export declare const genericPerseusItemData: PerseusItem;
|
|
5
|
+
/**
|
|
6
|
+
* Thin wrapper around scorePerseusItem for internal testing
|
|
7
|
+
*/
|
|
8
|
+
export declare function scorePerseusItemTesting(perseusRenderData: PerseusRenderer, userInputMap: UserInputMap): PerseusScore;
|
|
3
9
|
/**
|
|
4
10
|
* Generate a Perseus item object for testing purposes.
|
|
5
11
|
*
|
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": "48.0.0",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -40,14 +40,14 @@
|
|
|
40
40
|
"test": "bash -c 'yarn --silent --cwd \"../..\" test ${@:0} $($([[ ${@: -1} = -* ]] || [[ ${@: -1} = bash ]]) && echo $PWD)'"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@khanacademy/kas": "^0.4.
|
|
44
|
-
"@khanacademy/keypad-context": "^1.0.
|
|
45
|
-
"@khanacademy/kmath": "^0.1.
|
|
46
|
-
"@khanacademy/math-input": "^21.1.
|
|
47
|
-
"@khanacademy/perseus-core": "
|
|
48
|
-
"@khanacademy/perseus-linter": "^1.2.
|
|
49
|
-
"@khanacademy/pure-markdown": "^0.3.
|
|
50
|
-
"@khanacademy/simple-markdown": "^0.13.
|
|
43
|
+
"@khanacademy/kas": "^0.4.3",
|
|
44
|
+
"@khanacademy/keypad-context": "^1.0.5",
|
|
45
|
+
"@khanacademy/kmath": "^0.1.17",
|
|
46
|
+
"@khanacademy/math-input": "^21.1.7",
|
|
47
|
+
"@khanacademy/perseus-core": "2.0.0",
|
|
48
|
+
"@khanacademy/perseus-linter": "^1.2.5",
|
|
49
|
+
"@khanacademy/pure-markdown": "^0.3.14",
|
|
50
|
+
"@khanacademy/simple-markdown": "^0.13.7",
|
|
51
51
|
"@types/classnames": "2.2.0",
|
|
52
52
|
"@use-gesture/react": "^10.2.27",
|
|
53
53
|
"mafs": "0.19.0",
|