@khanacademy/perseus 47.0.0 → 47.0.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 +39 -8
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +39 -8
- package/dist/index.js.map +1 -1
- package/dist/perseus-types.d.ts +33 -4
- package/package.json +1 -1
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.
|