@khanacademy/perseus-core 8.0.0 → 10.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/data-schema.d.ts +82 -84
- package/dist/es/index.js +67 -53
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +9 -2
- package/dist/index.js +71 -52
- package/dist/index.js.map +1 -1
- package/dist/keypad.d.ts +1 -1
- package/dist/parse-perseus-json/general-purpose-parsers/defaulted.d.ts +1 -1
- package/dist/parse-perseus-json/general-purpose-parsers/index.d.ts +1 -1
- package/dist/parse-perseus-json/general-purpose-parsers/is-plain-object.d.ts +8 -0
- package/dist/parse-perseus-json/general-purpose-parsers/test-helpers.d.ts +5 -0
- package/dist/parse-perseus-json/perseus-parsers/categorizer-widget.d.ts +13 -3
- package/dist/parse-perseus-json/perseus-parsers/categorizer-widget.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/perseus-parsers/cs-program-widget.d.ts +12 -3
- package/dist/parse-perseus-json/perseus-parsers/cs-program-widget.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/perseus-parsers/definition-widget.d.ts +5 -3
- package/dist/parse-perseus-json/perseus-parsers/definition-widget.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/perseus-parsers/dropdown-widget.d.ts +10 -3
- package/dist/parse-perseus-json/perseus-parsers/dropdown-widget.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/perseus-parsers/explanation-widget.d.ts +7 -3
- package/dist/parse-perseus-json/perseus-parsers/explanation-widget.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/perseus-parsers/expression-widget.d.ts +16 -3
- package/dist/parse-perseus-json/perseus-parsers/expression-widget.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/perseus-parsers/graded-group-set-widget.d.ts +15 -3
- package/dist/parse-perseus-json/perseus-parsers/graded-group-set-widget.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/perseus-parsers/graded-group-widget.d.ts +14 -4
- package/dist/parse-perseus-json/perseus-parsers/graded-group-widget.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/perseus-parsers/grapher-widget.d.ts +51 -3
- package/dist/parse-perseus-json/perseus-parsers/grapher-widget.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/perseus-parsers/group-widget.d.ts +1 -3
- package/dist/parse-perseus-json/perseus-parsers/group-widget.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/perseus-parsers/hint.d.ts +9 -3
- package/dist/parse-perseus-json/perseus-parsers/hint.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/perseus-parsers/iframe-widget.d.ts +12 -3
- package/dist/parse-perseus-json/perseus-parsers/iframe-widget.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/perseus-parsers/image-widget.d.ts +22 -3
- package/dist/parse-perseus-json/perseus-parsers/image-widget.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/perseus-parsers/input-number-widget.d.ts +10 -2
- package/dist/parse-perseus-json/perseus-parsers/input-number-widget.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/perseus-parsers/interaction-widget.d.ts +125 -3
- package/dist/parse-perseus-json/perseus-parsers/interaction-widget.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/perseus-parsers/interactive-graph-user-input.d.ts +60 -1
- package/dist/parse-perseus-json/perseus-parsers/interactive-graph-widget.d.ts +326 -5
- package/dist/parse-perseus-json/perseus-parsers/interactive-graph-widget.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/perseus-parsers/label-image-widget.d.ts +16 -3
- package/dist/parse-perseus-json/perseus-parsers/label-image-widget.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/perseus-parsers/legacy-button-sets.d.ts +1 -2
- package/dist/parse-perseus-json/perseus-parsers/matcher-widget.d.ts +7 -3
- package/dist/parse-perseus-json/perseus-parsers/matcher-widget.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/perseus-parsers/matrix-widget.d.ts +8 -3
- package/dist/parse-perseus-json/perseus-parsers/matrix-widget.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/perseus-parsers/measurer-widget.d.ts +18 -3
- package/dist/parse-perseus-json/perseus-parsers/measurer-widget.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/perseus-parsers/molecule-renderer-widget.d.ts +5 -3
- package/dist/parse-perseus-json/perseus-parsers/molecule-renderer-widget.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/perseus-parsers/number-line-widget.d.ts +17 -3
- package/dist/parse-perseus-json/perseus-parsers/number-line-widget.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/perseus-parsers/numeric-input-widget.d.ts +21 -4
- package/dist/parse-perseus-json/perseus-parsers/numeric-input-widget.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/perseus-parsers/orderer-widget.d.ts +7 -3
- package/dist/parse-perseus-json/perseus-parsers/orderer-widget.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/perseus-parsers/passage-ref-widget.d.ts +5 -3
- package/dist/parse-perseus-json/perseus-parsers/passage-ref-widget.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/perseus-parsers/passage-widget.d.ts +7 -3
- package/dist/parse-perseus-json/perseus-parsers/passage-widget.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/perseus-parsers/perseus-answer-area.d.ts +11 -2
- package/dist/parse-perseus-json/perseus-parsers/perseus-answer-area.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/perseus-parsers/perseus-image-background.d.ts +9 -3
- package/dist/parse-perseus-json/perseus-parsers/perseus-image-background.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/perseus-parsers/perseus-image-detail.d.ts +4 -0
- package/dist/parse-perseus-json/perseus-parsers/perseus-image-detail.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/perseus-parsers/phet-simulation-widget.d.ts +4 -3
- package/dist/parse-perseus-json/perseus-parsers/phet-simulation-widget.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/perseus-parsers/plotter-widget.d.ts +15 -3
- package/dist/parse-perseus-json/perseus-parsers/plotter-widget.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/perseus-parsers/python-program-widget.d.ts +4 -3
- package/dist/parse-perseus-json/perseus-parsers/python-program-widget.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/perseus-parsers/sorter-widget.d.ts +5 -3
- package/dist/parse-perseus-json/perseus-parsers/sorter-widget.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/perseus-parsers/table-widget.d.ts +6 -3
- package/dist/parse-perseus-json/perseus-parsers/table-widget.typetest.d.ts +1 -0
- package/dist/parse-perseus-json/perseus-parsers/video-widget.d.ts +4 -3
- package/dist/parse-perseus-json/perseus-parsers/video-widget.typetest.d.ts +1 -0
- package/dist/types.d.ts +6 -3
- package/dist/utils/deep-clone.d.ts +1 -2
- package/dist/utils/item-has-hints.d.ts +5 -0
- package/dist/utils/item-has-rationales.d.ts +5 -0
- package/dist/utils/random-util.d.ts +1 -1
- package/dist/utils/split-perseus-item.d.ts +3 -3
- package/dist/utils/split-perseus-renderer.d.ts +7 -0
- package/dist/utils/test-utils.d.ts +2 -1
- package/dist/validation.types.d.ts +27 -27
- package/dist/widgets/core-widget-registry.d.ts +8 -0
- package/dist/widgets/group/group-util.d.ts +12 -0
- package/dist/widgets/input-number/input-number-util.d.ts +12 -0
- package/dist/widgets/logic-export.types.d.ts +3 -1
- package/dist/widgets/matrix/matrix-util.d.ts +1 -2
- package/dist/widgets/number-line/number-line-util.d.ts +1 -2
- package/dist/widgets/orderer/orderer-util.d.ts +2 -6
- package/dist/widgets/plotter/plotter-util.d.ts +1 -1
- package/package.json +4 -3
- package/dist/parse-perseus-json/general-purpose-parsers/is-object.d.ts +0 -1
package/dist/data-schema.d.ts
CHANGED
|
@@ -50,8 +50,8 @@ export type ShowSolutions = "all" | "selected" | "none";
|
|
|
50
50
|
*
|
|
51
51
|
* ```
|
|
52
52
|
* interface DummyRegistry {
|
|
53
|
-
* categorizer: { categories:
|
|
54
|
-
* dropdown: { choices:
|
|
53
|
+
* categorizer: { categories: string[] };
|
|
54
|
+
* dropdown: { choices: string[] }:
|
|
55
55
|
* }
|
|
56
56
|
* ```
|
|
57
57
|
*
|
|
@@ -65,8 +65,8 @@ export type ShowSolutions = "all" | "selected" | "none";
|
|
|
65
65
|
*
|
|
66
66
|
* ```
|
|
67
67
|
* type DummyMap = {
|
|
68
|
-
* `categorizer ${number}`: { categories:
|
|
69
|
-
* `dropdown ${number}`: { choices:
|
|
68
|
+
* `categorizer ${number}`: { categories: string[] };
|
|
69
|
+
* `dropdown ${number}`: { choices: string[] };
|
|
70
70
|
* }
|
|
71
71
|
* ```
|
|
72
72
|
*
|
|
@@ -192,14 +192,14 @@ export type PerseusWidget = PerseusWidgetTypes[keyof PerseusWidgetTypes];
|
|
|
192
192
|
*/
|
|
193
193
|
export type PerseusItem = {
|
|
194
194
|
question: PerseusRenderer;
|
|
195
|
-
hints:
|
|
195
|
+
hints: Hint[];
|
|
196
196
|
answerArea: PerseusAnswerArea | null | undefined;
|
|
197
197
|
};
|
|
198
198
|
/**
|
|
199
199
|
* A "PerseusArticle" is an item that is meant to be rendered as an article.
|
|
200
200
|
* This item is never scored and is rendered by the `ArticleRenderer`.
|
|
201
201
|
*/
|
|
202
|
-
export type PerseusArticle = PerseusRenderer |
|
|
202
|
+
export type PerseusArticle = PerseusRenderer | PerseusRenderer[];
|
|
203
203
|
export type Version = {
|
|
204
204
|
major: number;
|
|
205
205
|
minor: number;
|
|
@@ -316,18 +316,18 @@ export type PerseusImageBackground = {
|
|
|
316
316
|
export type MarkingsType = "axes" | "graph" | "grid" | "none";
|
|
317
317
|
export type AxisLabelLocation = "onAxis" | "alongEdge";
|
|
318
318
|
export type PerseusCategorizerWidgetOptions = {
|
|
319
|
-
items:
|
|
320
|
-
categories:
|
|
319
|
+
items: string[];
|
|
320
|
+
categories: string[];
|
|
321
321
|
randomizeItems: boolean;
|
|
322
322
|
static: boolean;
|
|
323
|
-
values:
|
|
323
|
+
values: number[];
|
|
324
324
|
highlightLint?: boolean;
|
|
325
325
|
linterContext?: PerseusLinterContext;
|
|
326
326
|
};
|
|
327
327
|
export type PerseusLinterContext = {
|
|
328
328
|
contentType: string;
|
|
329
|
-
paths:
|
|
330
|
-
stack:
|
|
329
|
+
paths: string[];
|
|
330
|
+
stack: string[];
|
|
331
331
|
};
|
|
332
332
|
export type PerseusDefinitionWidgetOptions = {
|
|
333
333
|
togglePrompt: string;
|
|
@@ -335,7 +335,7 @@ export type PerseusDefinitionWidgetOptions = {
|
|
|
335
335
|
static: boolean;
|
|
336
336
|
};
|
|
337
337
|
export type PerseusDropdownWidgetOptions = {
|
|
338
|
-
choices:
|
|
338
|
+
choices: PerseusDropdownChoice[];
|
|
339
339
|
placeholder: string;
|
|
340
340
|
static: boolean;
|
|
341
341
|
visibleLabel?: string;
|
|
@@ -352,13 +352,13 @@ export type PerseusExplanationWidgetOptions = {
|
|
|
352
352
|
widgets: PerseusWidgetsMap;
|
|
353
353
|
static: boolean;
|
|
354
354
|
};
|
|
355
|
-
export type LegacyButtonSets =
|
|
355
|
+
export type LegacyButtonSets = Array<"basic" | "basic+div" | "trig" | "prealgebra" | "logarithms" | "basic relations" | "advanced relations" | "scientific">;
|
|
356
356
|
export type PerseusExpressionWidgetOptions = {
|
|
357
|
-
answerForms:
|
|
357
|
+
answerForms: PerseusExpressionAnswerForm[];
|
|
358
358
|
buttonSets: LegacyButtonSets;
|
|
359
|
-
functions:
|
|
359
|
+
functions: string[];
|
|
360
360
|
times: boolean;
|
|
361
|
-
extraKeys?:
|
|
361
|
+
extraKeys?: KeypadKey[];
|
|
362
362
|
visibleLabel?: string;
|
|
363
363
|
ariaLabel?: string;
|
|
364
364
|
buttonsVisible?: "always" | "never" | "focused";
|
|
@@ -384,7 +384,7 @@ export type PerseusGradedGroupWidgetOptions = {
|
|
|
384
384
|
};
|
|
385
385
|
};
|
|
386
386
|
export type PerseusGradedGroupSetWidgetOptions = {
|
|
387
|
-
gradedGroups:
|
|
387
|
+
gradedGroups: PerseusGradedGroupWidgetOptions[];
|
|
388
388
|
};
|
|
389
389
|
export type GraphRange = [
|
|
390
390
|
x: [min: number, max: number],
|
|
@@ -415,7 +415,7 @@ export type GrapherAnswerTypes = {
|
|
|
415
415
|
coords: null | [Coord, Coord];
|
|
416
416
|
};
|
|
417
417
|
export type PerseusGrapherWidgetOptions = {
|
|
418
|
-
availableTypes:
|
|
418
|
+
availableTypes: Array<"absolute_value" | "exponential" | "linear" | "logarithm" | "quadratic" | "sinusoid" | "tangent">;
|
|
419
419
|
correct: GrapherAnswerTypes;
|
|
420
420
|
graph: {
|
|
421
421
|
backgroundImage: {
|
|
@@ -427,7 +427,7 @@ export type PerseusGrapherWidgetOptions = {
|
|
|
427
427
|
width?: number;
|
|
428
428
|
};
|
|
429
429
|
box?: [number, number];
|
|
430
|
-
editableSettings?:
|
|
430
|
+
editableSettings?: Array<"graph" | "snap" | "image" | "measure">;
|
|
431
431
|
gridStep?: [number, number];
|
|
432
432
|
labels: [string, string];
|
|
433
433
|
markings: MarkingsType;
|
|
@@ -449,14 +449,14 @@ export type PerseusImageWidgetOptions = {
|
|
|
449
449
|
alt?: string;
|
|
450
450
|
backgroundImage: PerseusImageBackground;
|
|
451
451
|
static?: boolean;
|
|
452
|
-
labels?:
|
|
452
|
+
labels?: Array<PerseusImageLabel>;
|
|
453
453
|
range?: [Interval, Interval];
|
|
454
454
|
box?: Size;
|
|
455
455
|
};
|
|
456
456
|
export type PerseusImageLabel = {
|
|
457
457
|
content: string;
|
|
458
458
|
alignment: string;
|
|
459
|
-
coordinates:
|
|
459
|
+
coordinates: number[];
|
|
460
460
|
};
|
|
461
461
|
export type PerseusInteractiveGraphWidgetOptions = {
|
|
462
462
|
step: [number, number];
|
|
@@ -467,7 +467,7 @@ export type PerseusInteractiveGraphWidgetOptions = {
|
|
|
467
467
|
* The type of markings to display on the graph.
|
|
468
468
|
*/
|
|
469
469
|
markings: MarkingsType;
|
|
470
|
-
labels?:
|
|
470
|
+
labels?: string[];
|
|
471
471
|
/**
|
|
472
472
|
* Specifies the location of the labels on the graph. default: "onAxis".
|
|
473
473
|
* - "onAxis": Labels are positioned on the axis at the right (x) and top (y) of the graph.
|
|
@@ -503,7 +503,7 @@ export type PerseusInteractiveGraphWidgetOptions = {
|
|
|
503
503
|
range: GraphRange;
|
|
504
504
|
graph: PerseusGraphType;
|
|
505
505
|
correct: PerseusGraphType;
|
|
506
|
-
lockedFigures
|
|
506
|
+
lockedFigures: LockedFigure[];
|
|
507
507
|
fullGraphAriaLabel?: string;
|
|
508
508
|
fullGraphAriaDescription?: string;
|
|
509
509
|
};
|
|
@@ -518,7 +518,7 @@ export type LockedPointType = {
|
|
|
518
518
|
coord: Coord;
|
|
519
519
|
color: LockedFigureColor;
|
|
520
520
|
filled: boolean;
|
|
521
|
-
labels
|
|
521
|
+
labels: LockedLabelType[];
|
|
522
522
|
ariaLabel?: string;
|
|
523
523
|
};
|
|
524
524
|
export type LockedLineType = {
|
|
@@ -529,14 +529,14 @@ export type LockedLineType = {
|
|
|
529
529
|
lineStyle: LockedLineStyle;
|
|
530
530
|
showPoint1: boolean;
|
|
531
531
|
showPoint2: boolean;
|
|
532
|
-
labels
|
|
532
|
+
labels: LockedLabelType[];
|
|
533
533
|
ariaLabel?: string;
|
|
534
534
|
};
|
|
535
535
|
export type LockedVectorType = {
|
|
536
536
|
type: "vector";
|
|
537
537
|
points: [tail: Coord, tip: Coord];
|
|
538
538
|
color: LockedFigureColor;
|
|
539
|
-
labels
|
|
539
|
+
labels: LockedLabelType[];
|
|
540
540
|
ariaLabel?: string;
|
|
541
541
|
};
|
|
542
542
|
export type LockedFigureFillType = "none" | "white" | "translucent" | "solid";
|
|
@@ -549,17 +549,17 @@ export type LockedEllipseType = {
|
|
|
549
549
|
color: LockedFigureColor;
|
|
550
550
|
fillStyle: LockedFigureFillType;
|
|
551
551
|
strokeStyle: LockedLineStyle;
|
|
552
|
-
labels
|
|
552
|
+
labels: LockedLabelType[];
|
|
553
553
|
ariaLabel?: string;
|
|
554
554
|
};
|
|
555
555
|
export type LockedPolygonType = {
|
|
556
556
|
type: "polygon";
|
|
557
|
-
points:
|
|
557
|
+
points: Coord[];
|
|
558
558
|
color: LockedFigureColor;
|
|
559
559
|
showVertices: boolean;
|
|
560
560
|
fillStyle: LockedFigureFillType;
|
|
561
561
|
strokeStyle: LockedLineStyle;
|
|
562
|
-
labels
|
|
562
|
+
labels: LockedLabelType[];
|
|
563
563
|
ariaLabel?: string;
|
|
564
564
|
};
|
|
565
565
|
export type LockedFunctionType = {
|
|
@@ -580,7 +580,7 @@ export type LockedFunctionType = {
|
|
|
580
580
|
* allowed. Note that infinite values are serialized as `null` in JSON.
|
|
581
581
|
*/
|
|
582
582
|
domain: [min: number, max: number];
|
|
583
|
-
labels
|
|
583
|
+
labels: LockedLabelType[];
|
|
584
584
|
ariaLabel?: string;
|
|
585
585
|
};
|
|
586
586
|
export type LockedLabelType = {
|
|
@@ -591,9 +591,6 @@ export type LockedLabelType = {
|
|
|
591
591
|
size: "small" | "medium" | "large";
|
|
592
592
|
};
|
|
593
593
|
export type PerseusGraphType = PerseusGraphTypeAngle | PerseusGraphTypeCircle | PerseusGraphTypeLinear | PerseusGraphTypeLinearSystem | PerseusGraphTypeNone | PerseusGraphTypePoint | PerseusGraphTypePolygon | PerseusGraphTypeQuadratic | PerseusGraphTypeRay | PerseusGraphTypeSegment | PerseusGraphTypeSinusoid;
|
|
594
|
-
type PerseusGraphTypeCommon = {
|
|
595
|
-
coord?: Coord;
|
|
596
|
-
};
|
|
597
594
|
export type PerseusGraphTypeAngle = {
|
|
598
595
|
type: "angle";
|
|
599
596
|
showAngles?: boolean;
|
|
@@ -601,7 +598,7 @@ export type PerseusGraphTypeAngle = {
|
|
|
601
598
|
angleOffsetDeg?: number;
|
|
602
599
|
snapDegrees?: number;
|
|
603
600
|
match?: "congruent";
|
|
604
|
-
coords?: [Coord, Coord, Coord]
|
|
601
|
+
coords?: [Coord, Coord, Coord];
|
|
605
602
|
startCoords?: [Coord, Coord, Coord];
|
|
606
603
|
};
|
|
607
604
|
export type PerseusGraphTypeCircle = {
|
|
@@ -612,26 +609,27 @@ export type PerseusGraphTypeCircle = {
|
|
|
612
609
|
center: Coord;
|
|
613
610
|
radius: number;
|
|
614
611
|
};
|
|
615
|
-
}
|
|
612
|
+
};
|
|
616
613
|
export type PerseusGraphTypeLinear = {
|
|
617
614
|
type: "linear";
|
|
618
615
|
coords?: CollinearTuple | null;
|
|
619
616
|
startCoords?: CollinearTuple;
|
|
620
|
-
}
|
|
617
|
+
};
|
|
621
618
|
export type PerseusGraphTypeLinearSystem = {
|
|
622
619
|
type: "linear-system";
|
|
623
620
|
coords?: CollinearTuple[] | null;
|
|
624
621
|
startCoords?: CollinearTuple[];
|
|
625
|
-
}
|
|
622
|
+
};
|
|
626
623
|
export type PerseusGraphTypeNone = {
|
|
627
624
|
type: "none";
|
|
628
625
|
};
|
|
629
626
|
export type PerseusGraphTypePoint = {
|
|
630
627
|
type: "point";
|
|
631
628
|
numPoints?: number | "unlimited";
|
|
632
|
-
coords?:
|
|
633
|
-
startCoords?:
|
|
634
|
-
|
|
629
|
+
coords?: Coord[] | null;
|
|
630
|
+
startCoords?: Coord[];
|
|
631
|
+
coord?: Coord;
|
|
632
|
+
};
|
|
635
633
|
export type PerseusGraphTypePolygon = {
|
|
636
634
|
type: "polygon";
|
|
637
635
|
numSides?: number | "unlimited";
|
|
@@ -639,30 +637,30 @@ export type PerseusGraphTypePolygon = {
|
|
|
639
637
|
showSides?: boolean;
|
|
640
638
|
snapTo?: "grid" | "angles" | "sides";
|
|
641
639
|
match?: "similar" | "congruent" | "approx" | "exact";
|
|
642
|
-
coords?:
|
|
643
|
-
startCoords?:
|
|
644
|
-
}
|
|
640
|
+
coords?: Coord[] | null;
|
|
641
|
+
startCoords?: Coord[];
|
|
642
|
+
};
|
|
645
643
|
export type PerseusGraphTypeQuadratic = {
|
|
646
644
|
type: "quadratic";
|
|
647
645
|
coords?: [Coord, Coord, Coord] | null;
|
|
648
646
|
startCoords?: [Coord, Coord, Coord];
|
|
649
|
-
}
|
|
647
|
+
};
|
|
650
648
|
export type PerseusGraphTypeSegment = {
|
|
651
649
|
type: "segment";
|
|
652
650
|
numSegments?: number;
|
|
653
651
|
coords?: CollinearTuple[] | null;
|
|
654
652
|
startCoords?: CollinearTuple[];
|
|
655
|
-
}
|
|
653
|
+
};
|
|
656
654
|
export type PerseusGraphTypeSinusoid = {
|
|
657
655
|
type: "sinusoid";
|
|
658
|
-
coords?:
|
|
659
|
-
startCoords?:
|
|
660
|
-
}
|
|
656
|
+
coords?: Coord[] | null;
|
|
657
|
+
startCoords?: Coord[];
|
|
658
|
+
};
|
|
661
659
|
export type PerseusGraphTypeRay = {
|
|
662
660
|
type: "ray";
|
|
663
661
|
coords?: CollinearTuple | null;
|
|
664
662
|
startCoords?: CollinearTuple;
|
|
665
|
-
}
|
|
663
|
+
};
|
|
666
664
|
type AngleGraphCorrect = {
|
|
667
665
|
type: "angle";
|
|
668
666
|
allowReflexAngles: boolean;
|
|
@@ -687,12 +685,12 @@ type NoneGraphCorrect = {
|
|
|
687
685
|
};
|
|
688
686
|
type PointGraphCorrect = {
|
|
689
687
|
type: "point";
|
|
690
|
-
coords:
|
|
688
|
+
coords: Coord[];
|
|
691
689
|
};
|
|
692
690
|
type PolygonGraphCorrect = {
|
|
693
691
|
type: "polygon";
|
|
694
692
|
match: "similar" | "congruent" | "approx";
|
|
695
|
-
coords:
|
|
693
|
+
coords: Coord[];
|
|
696
694
|
};
|
|
697
695
|
type QuadraticGraphCorrect = {
|
|
698
696
|
type: "quadratic";
|
|
@@ -712,36 +710,36 @@ type RayGraphCorrect = {
|
|
|
712
710
|
};
|
|
713
711
|
export type PerseusGraphCorrectType = AngleGraphCorrect | CircleGraphCorrect | LinearGraphCorrect | LinearSystemGraphCorrect | NoneGraphCorrect | PointGraphCorrect | PolygonGraphCorrect | QuadraticGraphCorrect | RayGraphCorrect | SegmentGraphCorrect | SinusoidGraphCorrect;
|
|
714
712
|
export type PerseusLabelImageWidgetOptions = {
|
|
715
|
-
choices:
|
|
713
|
+
choices: string[];
|
|
716
714
|
imageUrl: string;
|
|
717
715
|
imageAlt: string;
|
|
718
716
|
imageHeight: number;
|
|
719
717
|
imageWidth: number;
|
|
720
|
-
markers:
|
|
718
|
+
markers: PerseusLabelImageMarker[];
|
|
721
719
|
hideChoicesFromInstructions: boolean;
|
|
722
720
|
multipleAnswers: boolean;
|
|
723
721
|
static: boolean;
|
|
724
722
|
};
|
|
725
723
|
export type PerseusLabelImageMarker = {
|
|
726
|
-
answers:
|
|
724
|
+
answers: string[];
|
|
727
725
|
label: string;
|
|
728
726
|
x: number;
|
|
729
727
|
y: number;
|
|
730
728
|
};
|
|
731
729
|
export type PerseusMatcherWidgetOptions = {
|
|
732
|
-
labels:
|
|
733
|
-
left:
|
|
734
|
-
right:
|
|
730
|
+
labels: string[];
|
|
731
|
+
left: string[];
|
|
732
|
+
right: string[];
|
|
735
733
|
orderMatters: boolean;
|
|
736
734
|
padding: boolean;
|
|
737
735
|
};
|
|
738
|
-
export type PerseusMatrixWidgetAnswers =
|
|
736
|
+
export type PerseusMatrixWidgetAnswers = number[][];
|
|
739
737
|
export type PerseusMatrixWidgetOptions = {
|
|
740
738
|
prefix?: string | undefined;
|
|
741
739
|
suffix?: string | undefined;
|
|
742
740
|
answers: PerseusMatrixWidgetAnswers;
|
|
743
|
-
cursorPosition?:
|
|
744
|
-
matrixBoardSize:
|
|
741
|
+
cursorPosition?: number[] | undefined;
|
|
742
|
+
matrixBoardSize: number[];
|
|
745
743
|
static?: boolean | undefined;
|
|
746
744
|
};
|
|
747
745
|
export type PerseusMeasurerWidgetOptions = {
|
|
@@ -753,7 +751,6 @@ export type PerseusMeasurerWidgetOptions = {
|
|
|
753
751
|
rulerPixels: number;
|
|
754
752
|
rulerLength: number;
|
|
755
753
|
box: [number, number];
|
|
756
|
-
static: boolean;
|
|
757
754
|
};
|
|
758
755
|
export type MathFormat = "integer" | "mixed" | "improper" | "proper" | "decimal" | "percent" | "pi";
|
|
759
756
|
export type PerseusNumericInputAnswerForm = {
|
|
@@ -770,7 +767,7 @@ export type PerseusNumericInputAnswerForm = {
|
|
|
770
767
|
*/
|
|
771
768
|
export type PerseusNumericInputSimplify = "required" | "enforced" | "optional";
|
|
772
769
|
export type PerseusNumericInputWidgetOptions = {
|
|
773
|
-
answers:
|
|
770
|
+
answers: PerseusNumericInputAnswer[];
|
|
774
771
|
labelText?: string | undefined;
|
|
775
772
|
size: string;
|
|
776
773
|
coefficient: boolean;
|
|
@@ -781,31 +778,32 @@ export type PerseusNumericInputAnswer = {
|
|
|
781
778
|
message: string;
|
|
782
779
|
value?: number | null;
|
|
783
780
|
status: string;
|
|
784
|
-
answerForms?:
|
|
781
|
+
answerForms?: MathFormat[];
|
|
785
782
|
strict: boolean;
|
|
786
783
|
maxError?: number | null;
|
|
787
784
|
simplify: PerseusNumericInputSimplify;
|
|
788
785
|
};
|
|
789
786
|
export type PerseusNumberLineWidgetOptions = {
|
|
790
|
-
range:
|
|
791
|
-
labelRange:
|
|
787
|
+
range: number[];
|
|
788
|
+
labelRange: Array<number | null>;
|
|
792
789
|
labelStyle: string;
|
|
793
790
|
labelTicks: boolean;
|
|
794
791
|
isTickCtrl?: boolean | null;
|
|
795
|
-
|
|
792
|
+
isInequality: boolean;
|
|
793
|
+
divisionRange: number[];
|
|
796
794
|
numDivisions?: number | null;
|
|
797
795
|
snapDivisions: number;
|
|
798
796
|
tickStep?: number | null;
|
|
799
|
-
correctRel?:
|
|
797
|
+
correctRel?: "eq" | "lt" | "gt" | "le" | "ge";
|
|
800
798
|
correctX: number | null;
|
|
801
799
|
initialX?: number | null;
|
|
802
800
|
showTooltips?: boolean;
|
|
803
801
|
static: boolean;
|
|
804
802
|
};
|
|
805
803
|
export type PerseusOrdererWidgetOptions = {
|
|
806
|
-
options:
|
|
807
|
-
correctOptions:
|
|
808
|
-
otherOptions:
|
|
804
|
+
options: PerseusRenderer[];
|
|
805
|
+
correctOptions: PerseusRenderer[];
|
|
806
|
+
otherOptions: PerseusRenderer[];
|
|
809
807
|
height: "normal" | "auto";
|
|
810
808
|
layout: "horizontal" | "vertical";
|
|
811
809
|
};
|
|
@@ -824,22 +822,22 @@ export type PerseusPassageRefWidgetOptions = {
|
|
|
824
822
|
export declare const plotterPlotTypes: readonly ["bar", "line", "pic", "histogram", "dotplot"];
|
|
825
823
|
export type PlotType = (typeof plotterPlotTypes)[number];
|
|
826
824
|
export type PerseusPlotterWidgetOptions = {
|
|
827
|
-
labels:
|
|
828
|
-
categories:
|
|
825
|
+
labels: string[];
|
|
826
|
+
categories: string[];
|
|
829
827
|
type: PlotType;
|
|
830
828
|
maxY: number;
|
|
831
829
|
scaleY: number;
|
|
832
830
|
labelInterval?: number | null;
|
|
833
831
|
snapsPerLine: number;
|
|
834
|
-
starting:
|
|
835
|
-
correct:
|
|
832
|
+
starting: number[];
|
|
833
|
+
correct: number[];
|
|
836
834
|
picUrl?: string | null;
|
|
837
835
|
picSize?: number | null;
|
|
838
836
|
picBoxHeight?: number | null;
|
|
839
|
-
plotDimensions:
|
|
837
|
+
plotDimensions: number[];
|
|
840
838
|
};
|
|
841
839
|
export type PerseusRadioWidgetOptions = {
|
|
842
|
-
choices:
|
|
840
|
+
choices: PerseusRadioChoice[];
|
|
843
841
|
hasNoneOfTheAbove?: boolean;
|
|
844
842
|
countChoices?: boolean;
|
|
845
843
|
numCorrect?: number;
|
|
@@ -858,25 +856,25 @@ export type PerseusRadioChoice = {
|
|
|
858
856
|
widgets?: PerseusWidgetsMap;
|
|
859
857
|
};
|
|
860
858
|
export type PerseusSorterWidgetOptions = {
|
|
861
|
-
correct:
|
|
859
|
+
correct: string[];
|
|
862
860
|
padding: boolean;
|
|
863
861
|
layout: "horizontal" | "vertical";
|
|
864
862
|
};
|
|
865
863
|
export type PerseusTableWidgetOptions = {
|
|
866
|
-
headers:
|
|
864
|
+
headers: string[];
|
|
867
865
|
rows: number;
|
|
868
866
|
columns: number;
|
|
869
|
-
answers:
|
|
867
|
+
answers: string[][];
|
|
870
868
|
};
|
|
871
869
|
export type PerseusInteractionWidgetOptions = {
|
|
872
870
|
graph: PerseusInteractionGraph;
|
|
873
|
-
elements:
|
|
871
|
+
elements: PerseusInteractionElement[];
|
|
874
872
|
static: boolean;
|
|
875
873
|
};
|
|
876
874
|
export type PerseusInteractionGraph = {
|
|
877
|
-
editableSettings?:
|
|
875
|
+
editableSettings?: Array<"canvas" | "graph">;
|
|
878
876
|
box: Size;
|
|
879
|
-
labels:
|
|
877
|
+
labels: string[];
|
|
880
878
|
range: [Interval, Interval];
|
|
881
879
|
gridStep: [number, number];
|
|
882
880
|
/**
|
|
@@ -1001,7 +999,7 @@ export type PerseusInteractionRectangleElementOptions = {
|
|
|
1001
999
|
export type PerseusCSProgramWidgetOptions = {
|
|
1002
1000
|
programID: string;
|
|
1003
1001
|
programType?: any;
|
|
1004
|
-
settings:
|
|
1002
|
+
settings: PerseusCSProgramSetting[];
|
|
1005
1003
|
showEditor: boolean;
|
|
1006
1004
|
showButtons: boolean;
|
|
1007
1005
|
height: number;
|
|
@@ -1017,7 +1015,7 @@ export type PerseusPythonProgramWidgetOptions = {
|
|
|
1017
1015
|
};
|
|
1018
1016
|
export type PerseusIFrameWidgetOptions = {
|
|
1019
1017
|
url: string;
|
|
1020
|
-
settings?:
|
|
1018
|
+
settings?: PerseusCSProgramSetting[];
|
|
1021
1019
|
width: number | string;
|
|
1022
1020
|
height: number | string;
|
|
1023
1021
|
allowFullScreen: boolean;
|