@khanacademy/perseus-core 17.0.0 → 18.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/data-schema.d.ts +4 -0
- package/dist/es/index.js +49 -5
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +49 -4
- package/dist/index.js.map +1 -1
- package/dist/parse-perseus-json/index.d.ts +12 -0
- package/dist/parse-perseus-json/perseus-parsers/interactive-graph-widget.d.ts +4 -0
- package/dist/widgets/deprecated-standin/index.d.ts +3 -0
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Result } from "./result";
|
|
2
2
|
import type { PerseusItem, PerseusArticle } from "../data-schema";
|
|
3
|
+
import type { UserInputMap } from "../validation.types";
|
|
3
4
|
/**
|
|
4
5
|
* Helper to parse PerseusItem JSON
|
|
5
6
|
* Why not just use JSON.parse? We want:
|
|
@@ -44,3 +45,14 @@ export declare function parseAndMigratePerseusItem(data: unknown): Result<Perseu
|
|
|
44
45
|
* @throws SyntaxError if the argument is not well-formed JSON.
|
|
45
46
|
*/
|
|
46
47
|
export declare function parseAndMigratePerseusArticle(data: unknown): Result<PerseusArticle, ParseFailureDetail>;
|
|
48
|
+
/**
|
|
49
|
+
* Parses a UserInputMap from a plain object or JSON string, migrates old
|
|
50
|
+
* formats to the latest schema, and runtime-typechecks the result.
|
|
51
|
+
*
|
|
52
|
+
* @returns a {@link Result} of the parsed UserInputMap. If the result is a
|
|
53
|
+
* failure, it will contain an error message describing where in the tree
|
|
54
|
+
* parsing failed.
|
|
55
|
+
* @throws SyntaxError if the argument is a string that is not well-formed
|
|
56
|
+
* JSON.
|
|
57
|
+
*/
|
|
58
|
+
export declare function parseAndMigrateUserInputMap(data: unknown): Result<UserInputMap, ParseFailureDetail>;
|
|
@@ -255,6 +255,7 @@ export declare const parseInteractiveGraphWidget: import("../parser-types").Pars
|
|
|
255
255
|
lineStyle: "solid" | "dashed";
|
|
256
256
|
showPoint1: boolean;
|
|
257
257
|
showPoint2: boolean;
|
|
258
|
+
weight: "thin" | "medium" | "thick";
|
|
258
259
|
labels: import("../general-purpose-parsers/object-types").OptionalizeProperties<{
|
|
259
260
|
type: "label";
|
|
260
261
|
coord: [number, number];
|
|
@@ -267,6 +268,7 @@ export declare const parseInteractiveGraphWidget: import("../parser-types").Pars
|
|
|
267
268
|
type: "vector";
|
|
268
269
|
points: [[number, number], [number, number]];
|
|
269
270
|
color: "blue" | "green" | "grayH" | "purple" | "pink" | "orange" | "red";
|
|
271
|
+
weight: "thin" | "medium" | "thick";
|
|
270
272
|
labels: import("../general-purpose-parsers/object-types").OptionalizeProperties<{
|
|
271
273
|
type: "label";
|
|
272
274
|
coord: [number, number];
|
|
@@ -283,6 +285,7 @@ export declare const parseInteractiveGraphWidget: import("../parser-types").Pars
|
|
|
283
285
|
color: "blue" | "green" | "grayH" | "purple" | "pink" | "orange" | "red";
|
|
284
286
|
fillStyle: "none" | "solid" | "white" | "translucent";
|
|
285
287
|
strokeStyle: "solid" | "dashed";
|
|
288
|
+
weight: "thin" | "medium" | "thick";
|
|
286
289
|
labels: import("../general-purpose-parsers/object-types").OptionalizeProperties<{
|
|
287
290
|
type: "label";
|
|
288
291
|
coord: [number, number];
|
|
@@ -311,6 +314,7 @@ export declare const parseInteractiveGraphWidget: import("../parser-types").Pars
|
|
|
311
314
|
type: "function";
|
|
312
315
|
color: "blue" | "green" | "grayH" | "purple" | "pink" | "orange" | "red";
|
|
313
316
|
strokeStyle: "solid" | "dashed";
|
|
317
|
+
weight: "thin" | "medium" | "thick";
|
|
314
318
|
equation: string;
|
|
315
319
|
directionalAxis: "x" | "y";
|
|
316
320
|
domain: [number, number];
|