@khanacademy/perseus-core 3.6.0 → 4.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/LICENSE +18 -0
- package/dist/data-schema.d.ts +25 -7
- package/dist/es/index.js +262 -2140
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +293 -2147
- package/dist/index.js.map +1 -1
- package/dist/parse-perseus-json/perseus-parsers/interactive-graph-widget.d.ts +1 -0
- package/dist/parse-perseus-json/perseus-parsers/perseus-answer-area.d.ts +2 -0
- package/dist/utils/random-util.d.ts +5 -0
- package/dist/widgets/dropdown/dropdown-util.d.ts +1 -1
- package/dist/widgets/group/index.d.ts +1 -1
- package/dist/widgets/interactive-graph/interactive-graph-util.d.ts +1 -2
- package/dist/widgets/logic-export.types.d.ts +2 -1
- package/dist/widgets/matcher/matcher-util.d.ts +28 -0
- package/dist/widgets/numeric-input/numeric-input-util.d.ts +3 -2
- package/dist/widgets/sorter/sorter-util.d.ts +1 -0
- package/package.json +33 -32
- /package/dist/{utils → shared-utils}/add-library-version-to-perseus-debug.d.ts +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Copyright 2022 Khan Academy
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
5
|
+
the Software without restriction, including without limitation the rights to use,
|
|
6
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
7
|
+
Software, and to permit persons to whom the Software is furnished to do so, subject
|
|
8
|
+
to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
15
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
16
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
17
|
+
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
18
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/dist/data-schema.d.ts
CHANGED
|
@@ -226,7 +226,14 @@ export type PerseusRenderer = {
|
|
|
226
226
|
* field.
|
|
227
227
|
*/
|
|
228
228
|
widgets: PerseusWidgetsMap;
|
|
229
|
-
|
|
229
|
+
/**
|
|
230
|
+
* Formerly used in the PerseusGradedGroup widget. A list of "tags" that
|
|
231
|
+
* are keys that represent other content in the system. Not rendered to
|
|
232
|
+
* the user. NOTE: perseus_data.go says this is required even though it
|
|
233
|
+
* isn't necessary.
|
|
234
|
+
* @deprecated
|
|
235
|
+
*/
|
|
236
|
+
metadata?: any;
|
|
230
237
|
/**
|
|
231
238
|
* A dictionary of {[imageUrl]: PerseusImageDetail}.
|
|
232
239
|
*/
|
|
@@ -258,7 +265,7 @@ export type WidgetOptions<Type extends string, Options> = {
|
|
|
258
265
|
graded?: boolean;
|
|
259
266
|
alignment?: string;
|
|
260
267
|
options: Options;
|
|
261
|
-
key?: number;
|
|
268
|
+
key?: number | null;
|
|
262
269
|
version?: Version;
|
|
263
270
|
};
|
|
264
271
|
export type CategorizerWidget = WidgetOptions<'categorizer', PerseusCategorizerWidgetOptions>;
|
|
@@ -304,7 +311,7 @@ export type PerseusImageBackground = {
|
|
|
304
311
|
height?: number;
|
|
305
312
|
top?: number;
|
|
306
313
|
left?: number;
|
|
307
|
-
scale?: number
|
|
314
|
+
scale?: number;
|
|
308
315
|
bottom?: number;
|
|
309
316
|
};
|
|
310
317
|
/**
|
|
@@ -558,9 +565,20 @@ export type LockedFunctionType = {
|
|
|
558
565
|
type: "function";
|
|
559
566
|
color: LockedFigureColor;
|
|
560
567
|
strokeStyle: LockedLineStyle;
|
|
568
|
+
/**
|
|
569
|
+
* This is the user-defined equation (as it was typed)
|
|
570
|
+
*/
|
|
561
571
|
equation: string;
|
|
572
|
+
/**
|
|
573
|
+
* The independent variable of this function
|
|
574
|
+
*/
|
|
562
575
|
directionalAxis: "x" | "y";
|
|
563
|
-
|
|
576
|
+
/**
|
|
577
|
+
* The minimum and maximum values along the `directionalAxis` at which
|
|
578
|
+
* this function should be graphed. Values of -Infinity and Infinity are
|
|
579
|
+
* allowed. Note that infinite values are serialized as `null` in JSON.
|
|
580
|
+
*/
|
|
581
|
+
domain: [min: number, max: number];
|
|
564
582
|
labels?: LockedLabelType[];
|
|
565
583
|
ariaLabel?: string;
|
|
566
584
|
};
|
|
@@ -738,9 +756,10 @@ export type PerseusMeasurerWidgetOptions = {
|
|
|
738
756
|
};
|
|
739
757
|
export type MathFormat = "integer" | "mixed" | "improper" | "proper" | "decimal" | "percent" | "pi";
|
|
740
758
|
export type PerseusNumericInputAnswerForm = {
|
|
741
|
-
simplify:
|
|
759
|
+
simplify: PerseusNumericInputSimplify | null | undefined;
|
|
742
760
|
name: MathFormat;
|
|
743
761
|
};
|
|
762
|
+
export type PerseusNumericInputSimplify = "required" | "correct" | "enforced" | "optional";
|
|
744
763
|
export type PerseusNumericInputWidgetOptions = {
|
|
745
764
|
answers: ReadonlyArray<PerseusNumericInputAnswer>;
|
|
746
765
|
labelText?: string | undefined;
|
|
@@ -748,7 +767,6 @@ export type PerseusNumericInputWidgetOptions = {
|
|
|
748
767
|
coefficient: boolean;
|
|
749
768
|
rightAlign?: boolean;
|
|
750
769
|
static: boolean;
|
|
751
|
-
answerForms?: ReadonlyArray<PerseusNumericInputAnswerForm>;
|
|
752
770
|
};
|
|
753
771
|
export type PerseusNumericInputAnswer = {
|
|
754
772
|
message: string;
|
|
@@ -757,7 +775,7 @@ export type PerseusNumericInputAnswer = {
|
|
|
757
775
|
answerForms?: ReadonlyArray<MathFormat>;
|
|
758
776
|
strict: boolean;
|
|
759
777
|
maxError: number | null | undefined;
|
|
760
|
-
simplify:
|
|
778
|
+
simplify: PerseusNumericInputSimplify | null | undefined;
|
|
761
779
|
};
|
|
762
780
|
export type PerseusNumberLineWidgetOptions = {
|
|
763
781
|
range: ReadonlyArray<number>;
|