@khanacademy/perseus 38.0.0 → 39.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/components/math-input.d.ts +1 -1
- package/dist/components/sortable.d.ts +1 -1
- package/dist/definition-context.d.ts +1 -1
- package/dist/es/index.js +48 -112
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +44 -111
- package/dist/index.js.map +1 -1
- package/dist/interactive2/movable-point.d.ts +1 -1
- package/dist/multi-items/prop-type-builders.d.ts +0 -6
- package/dist/perseus-api.d.ts +3 -1
- package/dist/perseus-types.d.ts +3 -42
- package/dist/renderer.d.ts +1 -2
- package/dist/server-item-renderer.d.ts +3 -2
- package/dist/sigfigs.d.ts +0 -16
- package/dist/styles/constants.d.ts +0 -18
- package/dist/types.d.ts +4 -6
- package/dist/util/math.d.ts +0 -1
- package/dist/util.d.ts +2 -1
- package/dist/validation.types.d.ts +10 -11
- package/dist/widgets/__shared__/noop-validator.d.ts +1 -1
- package/dist/widgets/definition/definition.d.ts +1 -2
- package/dist/widgets/explanation/explanation.d.ts +1 -2
- package/dist/widgets/expression/expression.d.ts +25 -12
- package/dist/widgets/image/image.d.ts +1 -2
- package/dist/widgets/input-number/input-number-validator.d.ts +2 -4
- package/dist/widgets/input-number/input-number.d.ts +0 -1
- package/dist/widgets/interaction/interaction.d.ts +1 -2
- package/dist/widgets/interactive-graphs/graphs/components/movable-line.d.ts +0 -11
- package/dist/widgets/interactive-graphs/graphs/point.d.ts +0 -2
- package/dist/widgets/interactive-graphs/graphs/use-transform.d.ts +0 -1
- package/dist/widgets/interactive-graphs/mafs-supported-graph-types.d.ts +2 -1
- package/dist/widgets/interactive-graphs/protractor.d.ts +0 -2
- package/dist/widgets/label-image/answer-choices.d.ts +1 -1
- package/dist/widgets/label-image/label-image-validator.d.ts +1 -1
- package/dist/widgets/label-image/label-image.d.ts +14 -30
- package/dist/widgets/matrix/matrix.d.ts +0 -1
- package/dist/widgets/measurer/measurer.d.ts +3 -15
- package/dist/widgets/molecule/molecule.d.ts +0 -21
- package/dist/widgets/number-line/number-line.d.ts +0 -1
- package/dist/widgets/numeric-input/numeric-input.d.ts +0 -1
- package/dist/widgets/orderer/orderer.d.ts +1 -1
- package/dist/widgets/passage/passage.d.ts +1 -2
- package/dist/widgets/passage-ref/passage-ref.d.ts +1 -2
- package/dist/widgets/radio/base-radio.d.ts +2 -1
- package/dist/widgets/table/table.d.ts +0 -1
- package/dist/widgets/video/video.d.ts +1 -2
- package/package.json +4 -4
- package/dist/util/fix-passage-refs.d.ts +0 -3
- package/dist/widgets/radio/choice.jsx.fixture.d.ts +0 -1
|
@@ -5,7 +5,7 @@ import type { LegacyButtonSets } from "../perseus-types";
|
|
|
5
5
|
import type { PerseusDependenciesV2 } from "../types";
|
|
6
6
|
import type { Keys, MathFieldInterface } from "@khanacademy/math-input";
|
|
7
7
|
type ButtonsVisibleType = "always" | "never" | "focused";
|
|
8
|
-
|
|
8
|
+
type KeypadButtonSets = {
|
|
9
9
|
advancedRelations?: boolean;
|
|
10
10
|
basicRelations?: boolean;
|
|
11
11
|
divisionKey?: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { Position } from "../util";
|
|
3
3
|
import type { LinterContextProps } from "@khanacademy/perseus-linter";
|
|
4
|
-
|
|
4
|
+
type Layout = "horizontal" | "vertical";
|
|
5
5
|
declare enum ItemState {
|
|
6
6
|
STATIC = "static",
|
|
7
7
|
DRAGGING = "dragging",
|
|
@@ -9,7 +9,7 @@ type DefintionContext = {
|
|
|
9
9
|
type ProviderState = {
|
|
10
10
|
activeDefinitionId: string | null | undefined;
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
type ProviderProps = {
|
|
13
13
|
children: any;
|
|
14
14
|
};
|
|
15
15
|
export declare class DefinitionProvider extends React.Component<ProviderProps, ProviderState> {
|
package/dist/es/index.js
CHANGED
|
@@ -2402,11 +2402,6 @@ class Expression extends React.Component {
|
|
|
2402
2402
|
// @ts-expect-error - TS2339 - Property 'insert' does not exist on type 'ReactInstance'.
|
|
2403
2403
|
this.refs.input.insert(keyPressed);
|
|
2404
2404
|
}
|
|
2405
|
-
// TODO(Nicole): I believe this is going away and won't be needed anymore
|
|
2406
|
-
getGrammarTypeForPath(inputPath) {
|
|
2407
|
-
/* c8 ignore next */
|
|
2408
|
-
return "expression";
|
|
2409
|
-
}
|
|
2410
2405
|
setInputValue(path, newValue, cb) {
|
|
2411
2406
|
this.props.onChange({
|
|
2412
2407
|
value: newValue
|
|
@@ -2878,7 +2873,9 @@ function flattenScores(widgetScoreMap) {
|
|
|
2878
2873
|
function isCorrect(score) {
|
|
2879
2874
|
return score.type === "points" && score.earned >= score.total;
|
|
2880
2875
|
}
|
|
2881
|
-
function keScoreFromPerseusScore(score,
|
|
2876
|
+
function keScoreFromPerseusScore(score,
|
|
2877
|
+
// It's weird, but this is what we're passing it
|
|
2878
|
+
guess, state) {
|
|
2882
2879
|
if (score.type === "points") {
|
|
2883
2880
|
return {
|
|
2884
2881
|
empty: false,
|
|
@@ -3892,36 +3889,14 @@ const ZoomService = new ZoomServiceClass();
|
|
|
3892
3889
|
const baseFontFamily$1 = "'Lato', sans-serif";
|
|
3893
3890
|
// @boldFontFamily: "Lato-Bold", "Lato", sans-serif;
|
|
3894
3891
|
const boldFontFamily = "'Lato-Bold', 'Lato', sans-serif";
|
|
3895
|
-
// @green: #76a005;
|
|
3896
|
-
const green$1 = "#76A005";
|
|
3897
3892
|
// @kaGreen: #71b307;
|
|
3898
3893
|
const kaGreen$1 = "#71B307";
|
|
3899
|
-
// @blue: #1c758a;
|
|
3900
|
-
const blue$1 = "#1C758A";
|
|
3901
|
-
// @gray: #aaa;
|
|
3902
|
-
const gray$1 = "#AAAAAA";
|
|
3903
|
-
// @red: #ffbaba;
|
|
3904
|
-
const red$1 = "#FFBABA";
|
|
3905
|
-
// @grayLight: #aaa;
|
|
3906
|
-
const grayLight$1 = "#AAAAAA";
|
|
3907
|
-
// @grayLighter: #ddd;
|
|
3908
|
-
const grayLighter$1 = "#DDDDDD";
|
|
3909
|
-
// @learnstormBlue: #4898fc;
|
|
3910
|
-
const learnstormBlue$1 = "#4898FC";
|
|
3911
3894
|
const white$1 = "#FFFFFF";
|
|
3912
|
-
const gray98 = "#FAFAFA";
|
|
3913
3895
|
const gray97 = "#F6F7F7";
|
|
3914
|
-
const gray95 = "#F0F1F2";
|
|
3915
|
-
const gray90 = "#E3E5E6";
|
|
3916
3896
|
const gray85 = "#D6D8DA";
|
|
3917
3897
|
const gray76 = "#BABEC2";
|
|
3918
3898
|
const gray68 = "#888D93";
|
|
3919
|
-
const gray41 = "#626569";
|
|
3920
|
-
const gray25 = "#3B3e40";
|
|
3921
3899
|
const gray17 = "#21242c";
|
|
3922
|
-
const black$1 = "#000000";
|
|
3923
|
-
const warning1 = "#F86700";
|
|
3924
|
-
const warning3 = "#C75300";
|
|
3925
3900
|
|
|
3926
3901
|
// @pure-sm-min: 568px;
|
|
3927
3902
|
const pureSmMin$2 = "568px";
|
|
@@ -3941,16 +3916,10 @@ const pureMdMax$2 = "1023px";
|
|
|
3941
3916
|
const pureLgMax$2 = "1279px";
|
|
3942
3917
|
// @tableBackgroundAccent: #f9f9f9; // for striping
|
|
3943
3918
|
const tableBackgroundAccent$1 = "#F9F9F9";
|
|
3944
|
-
// @zIndexScratchPad: 1;
|
|
3945
|
-
const zIndexScratchPad = 1;
|
|
3946
3919
|
// @zIndexAboveScratchpad: @zIndexScratchPad + 1;
|
|
3947
3920
|
const zIndexAboveScratchpad$1 = 2;
|
|
3948
3921
|
// @zIndexInteractiveComponent: @zIndexAboveScratchpad + 1;
|
|
3949
3922
|
const zIndexInteractiveComponent$1 = 3;
|
|
3950
|
-
// @zIndexCurrentlyDragging: @zIndexInteractiveComponent + 1;
|
|
3951
|
-
const zIndexCurrentlyDragging = 4;
|
|
3952
|
-
// @zIndexCalculator: @zIndexCurrentlyDragging + 1;
|
|
3953
|
-
const zIndexCalculator = 5;
|
|
3954
3923
|
// @phoneMargin: 16px;
|
|
3955
3924
|
const phoneMargin = 16;
|
|
3956
3925
|
const negativePhoneMargin = -16;
|
|
@@ -3978,28 +3947,13 @@ var constants$1 = /*#__PURE__*/Object.freeze({
|
|
|
3978
3947
|
__proto__: null,
|
|
3979
3948
|
baseFontFamily: baseFontFamily$1,
|
|
3980
3949
|
boldFontFamily: boldFontFamily,
|
|
3981
|
-
green: green$1,
|
|
3982
3950
|
kaGreen: kaGreen$1,
|
|
3983
|
-
blue: blue$1,
|
|
3984
|
-
gray: gray$1,
|
|
3985
|
-
red: red$1,
|
|
3986
|
-
grayLight: grayLight$1,
|
|
3987
|
-
grayLighter: grayLighter$1,
|
|
3988
|
-
learnstormBlue: learnstormBlue$1,
|
|
3989
3951
|
white: white$1,
|
|
3990
|
-
gray98: gray98,
|
|
3991
3952
|
gray97: gray97,
|
|
3992
|
-
gray95: gray95,
|
|
3993
|
-
gray90: gray90,
|
|
3994
3953
|
gray85: gray85,
|
|
3995
3954
|
gray76: gray76,
|
|
3996
3955
|
gray68: gray68,
|
|
3997
|
-
gray41: gray41,
|
|
3998
|
-
gray25: gray25,
|
|
3999
3956
|
gray17: gray17,
|
|
4000
|
-
black: black$1,
|
|
4001
|
-
warning1: warning1,
|
|
4002
|
-
warning3: warning3,
|
|
4003
3957
|
pureSmMin: pureSmMin$2,
|
|
4004
3958
|
pureMdMin: pureMdMin$2,
|
|
4005
3959
|
pureLgMin: pureLgMin$2,
|
|
@@ -4009,11 +3963,8 @@ var constants$1 = /*#__PURE__*/Object.freeze({
|
|
|
4009
3963
|
pureMdMax: pureMdMax$2,
|
|
4010
3964
|
pureLgMax: pureLgMax$2,
|
|
4011
3965
|
tableBackgroundAccent: tableBackgroundAccent$1,
|
|
4012
|
-
zIndexScratchPad: zIndexScratchPad,
|
|
4013
3966
|
zIndexAboveScratchpad: zIndexAboveScratchpad$1,
|
|
4014
3967
|
zIndexInteractiveComponent: zIndexInteractiveComponent$1,
|
|
4015
|
-
zIndexCurrentlyDragging: zIndexCurrentlyDragging,
|
|
4016
|
-
zIndexCalculator: zIndexCalculator,
|
|
4017
3968
|
phoneMargin: phoneMargin,
|
|
4018
3969
|
negativePhoneMargin: negativePhoneMargin,
|
|
4019
3970
|
hintBorderWidth: hintBorderWidth,
|
|
@@ -19756,6 +19707,7 @@ class Renderer extends React.Component {
|
|
|
19756
19707
|
onBlur: _.partial(this._onWidgetBlur, id),
|
|
19757
19708
|
findWidgets: this.findWidgets,
|
|
19758
19709
|
reviewModeRubric: reviewModeRubric,
|
|
19710
|
+
reviewMode: this.props.reviewMode,
|
|
19759
19711
|
onChange: (newProps, cb, silent = false) => {
|
|
19760
19712
|
this._setWidgetProps(id, newProps, cb, silent);
|
|
19761
19713
|
},
|
|
@@ -20435,14 +20387,6 @@ class Renderer extends React.Component {
|
|
|
20435
20387
|
return ReactDOM__default.findDOMNode(widget);
|
|
20436
20388
|
}
|
|
20437
20389
|
};
|
|
20438
|
-
this.getGrammarTypeForPath = path => {
|
|
20439
|
-
// @ts-expect-error - TS2345 - Argument of type 'FocusPath' is not assignable to parameter of type 'List<any>'.
|
|
20440
|
-
const widgetId = _.first(path);
|
|
20441
|
-
// @ts-expect-error - TS2345 - Argument of type 'FocusPath' is not assignable to parameter of type 'List<any>'.
|
|
20442
|
-
const interWidgetPath = _.rest(path);
|
|
20443
|
-
const widget = this.getWidgetInstance(widgetId);
|
|
20444
|
-
return widget == null || widget.getGrammarTypeForPath == null ? void 0 : widget.getGrammarTypeForPath(interWidgetPath);
|
|
20445
|
-
};
|
|
20446
20390
|
this.getInputPaths = () => {
|
|
20447
20391
|
const inputPaths = [];
|
|
20448
20392
|
_.each(this.widgetIds, widgetId => {
|
|
@@ -20582,11 +20526,6 @@ class Renderer extends React.Component {
|
|
|
20582
20526
|
this.getWidgetIds = () => {
|
|
20583
20527
|
return this.widgetIds;
|
|
20584
20528
|
};
|
|
20585
|
-
this.guessAndScore = () => {
|
|
20586
|
-
const totalGuess = this.getUserInput();
|
|
20587
|
-
const totalScore = this.score();
|
|
20588
|
-
return [totalGuess, totalScore];
|
|
20589
|
-
};
|
|
20590
20529
|
this.examples = () => {
|
|
20591
20530
|
const widgetIds = this.widgetIds;
|
|
20592
20531
|
const examples = _.compact(_.map(widgetIds, widgetId => {
|
|
@@ -20808,6 +20747,11 @@ class Renderer extends React.Component {
|
|
|
20808
20747
|
const combinedScore = Util.flattenScores(scores);
|
|
20809
20748
|
return combinedScore;
|
|
20810
20749
|
}
|
|
20750
|
+
guessAndScore() {
|
|
20751
|
+
const totalGuess = this.getUserInput();
|
|
20752
|
+
const totalScore = this.score();
|
|
20753
|
+
return [totalGuess, totalScore];
|
|
20754
|
+
}
|
|
20811
20755
|
render() {
|
|
20812
20756
|
const apiOptions = this.getApiOptions();
|
|
20813
20757
|
if (this.reuseMarkdown) {
|
|
@@ -21676,7 +21620,7 @@ const answerTypes = {
|
|
|
21676
21620
|
forms: "pi"
|
|
21677
21621
|
}
|
|
21678
21622
|
};
|
|
21679
|
-
function inputNumberValidator(
|
|
21623
|
+
function inputNumberValidator(userInput, rubric, strings) {
|
|
21680
21624
|
if (rubric.answerType == null) {
|
|
21681
21625
|
rubric.answerType = "number";
|
|
21682
21626
|
}
|
|
@@ -21694,7 +21638,7 @@ function inputNumberValidator(state, rubric, strings) {
|
|
|
21694
21638
|
|
|
21695
21639
|
// We may have received TeX; try to parse it before grading.
|
|
21696
21640
|
// If `currentValue` is not TeX, this should be a no-op.
|
|
21697
|
-
const currentValue = ParseTex$1(
|
|
21641
|
+
const currentValue = ParseTex$1(userInput.currentValue);
|
|
21698
21642
|
const result = val(currentValue);
|
|
21699
21643
|
|
|
21700
21644
|
// TODO(eater): Seems silly to translate result to this invalid/points
|
|
@@ -21787,12 +21731,6 @@ class InputNumber extends React.Component {
|
|
|
21787
21731
|
/* c8 ignore next */
|
|
21788
21732
|
return [[]];
|
|
21789
21733
|
};
|
|
21790
|
-
// Note: We believe that this isn't used anywhere but are leaving it during
|
|
21791
|
-
// the initial refactor
|
|
21792
|
-
this.getGrammarTypeForPath = path => {
|
|
21793
|
-
/* c8 ignore next */
|
|
21794
|
-
return "number";
|
|
21795
|
-
};
|
|
21796
21734
|
this.setInputValue = (path, newValue, cb) => {
|
|
21797
21735
|
this.props.onChange({
|
|
21798
21736
|
currentValue: newValue
|
|
@@ -21836,17 +21774,13 @@ class InputNumber extends React.Component {
|
|
|
21836
21774
|
}
|
|
21837
21775
|
return input;
|
|
21838
21776
|
}
|
|
21839
|
-
// HACK(johnsullivan): Create a function with shared logic between
|
|
21840
|
-
// this and NumericInput.
|
|
21841
|
-
// TODO(jeremy): Deprecate this widget and prefer numeric-input.
|
|
21842
|
-
const rubric = this.props.reviewModeRubric;
|
|
21843
21777
|
|
|
21844
21778
|
// Note: This is _very_ similar to what `numeric-input.jsx` does. If
|
|
21845
21779
|
// you modify this, double-check if you also need to modify that
|
|
21846
21780
|
// component.
|
|
21847
21781
|
const inputStyles = [styles$A.default, this.props.size === "small" ? styles$A.small : null, this.props.rightAlign ? styles$A.rightAlign : styles$A.leftAlign];
|
|
21848
21782
|
// Unanswered
|
|
21849
|
-
if (
|
|
21783
|
+
if (this.props.reviewMode && !this.props.currentValue) {
|
|
21850
21784
|
inputStyles.push(styles$A.answerStateUnanswered);
|
|
21851
21785
|
}
|
|
21852
21786
|
return /*#__PURE__*/React.createElement(InputWithExamples
|
|
@@ -22149,10 +22083,6 @@ class NumericInput extends React.Component {
|
|
|
22149
22083
|
/* c8 ignore next */
|
|
22150
22084
|
return [[]];
|
|
22151
22085
|
};
|
|
22152
|
-
this.getGrammarTypeForPath = inputPath => {
|
|
22153
|
-
/* c8 ignore next */
|
|
22154
|
-
return "number";
|
|
22155
|
-
};
|
|
22156
22086
|
this.setInputValue = (path, newValue, cb) => {
|
|
22157
22087
|
/* c8 ignore next */
|
|
22158
22088
|
this.props.onChange({
|
|
@@ -22339,7 +22269,7 @@ var NumericInput$1 = {
|
|
|
22339
22269
|
* Several widgets don't have "right"/"wrong" validation logic,
|
|
22340
22270
|
* so this just says to move on past those widgets
|
|
22341
22271
|
*
|
|
22342
|
-
* TODO(LEMS-
|
|
22272
|
+
* TODO(LEMS-2543) widgets that use this probably shouldn't have any
|
|
22343
22273
|
* validation logic and the thing validating an exercise
|
|
22344
22274
|
* should just know to skip these
|
|
22345
22275
|
*/
|
|
@@ -24401,7 +24331,7 @@ class Passage extends React.Component {
|
|
|
24401
24331
|
const enabled = this.state.stylesAreApplied;
|
|
24402
24332
|
|
|
24403
24333
|
// Highlights are read-only in review mode.
|
|
24404
|
-
const editable = !this.props.
|
|
24334
|
+
const editable = !this.props.reviewMode;
|
|
24405
24335
|
return /*#__PURE__*/React.createElement(HighlightableContent, {
|
|
24406
24336
|
editable: editable,
|
|
24407
24337
|
enabled: enabled,
|
|
@@ -25660,6 +25590,7 @@ const BaseRadio = function BaseRadio(props) {
|
|
|
25660
25590
|
const {
|
|
25661
25591
|
apiOptions,
|
|
25662
25592
|
reviewModeRubric,
|
|
25593
|
+
reviewMode,
|
|
25663
25594
|
choices,
|
|
25664
25595
|
editMode,
|
|
25665
25596
|
multipleSelect,
|
|
@@ -25772,7 +25703,6 @@ const BaseRadio = function BaseRadio(props) {
|
|
|
25772
25703
|
});
|
|
25773
25704
|
|
|
25774
25705
|
// some commonly used shorthands
|
|
25775
|
-
const reviewMode = !!reviewModeRubric;
|
|
25776
25706
|
const isMobile = apiOptions.isMobile;
|
|
25777
25707
|
const firstChoiceHighlighted = choices[0].highlighted;
|
|
25778
25708
|
const lastChoiceHighlighted = choices[choices.length - 1].highlighted;
|
|
@@ -26340,6 +26270,7 @@ class Radio$1 extends React.Component {
|
|
|
26340
26270
|
}));
|
|
26341
26271
|
}
|
|
26342
26272
|
const choicesProp = choices.map((choice, i) => {
|
|
26273
|
+
var _this$props$reviewMod;
|
|
26343
26274
|
const content = choice.isNoneOfTheAbove && !choice.content ? strings.noneOfTheAbove : choice.content;
|
|
26344
26275
|
const {
|
|
26345
26276
|
selected,
|
|
@@ -26350,7 +26281,7 @@ class Radio$1 extends React.Component {
|
|
|
26350
26281
|
highlighted,
|
|
26351
26282
|
previouslyAnswered
|
|
26352
26283
|
} = choiceStates[i];
|
|
26353
|
-
const reviewChoice = this.props.reviewModeRubric
|
|
26284
|
+
const reviewChoice = (_this$props$reviewMod = this.props.reviewModeRubric) == null ? void 0 : _this$props$reviewMod.choices[i];
|
|
26354
26285
|
return {
|
|
26355
26286
|
content: this._renderRenderer(content),
|
|
26356
26287
|
checked: selected,
|
|
@@ -26385,6 +26316,7 @@ class Radio$1 extends React.Component {
|
|
|
26385
26316
|
choices: choicesProp,
|
|
26386
26317
|
onChange: this.updateChoices,
|
|
26387
26318
|
reviewModeRubric: this.props.reviewModeRubric,
|
|
26319
|
+
reviewMode: this.props.reviewMode,
|
|
26388
26320
|
deselectEnabled: this.props.deselectEnabled,
|
|
26389
26321
|
apiOptions: this.props.apiOptions,
|
|
26390
26322
|
isLastUsedWidget: this.props.isLastUsedWidget,
|
|
@@ -29121,7 +29053,7 @@ class Group extends React.Component {
|
|
|
29121
29053
|
ref: ref => this.rendererRef = ref,
|
|
29122
29054
|
apiOptions: apiOptions,
|
|
29123
29055
|
findExternalWidgets: this.props.findWidgets,
|
|
29124
|
-
reviewMode:
|
|
29056
|
+
reviewMode: this.props.reviewMode,
|
|
29125
29057
|
onInteractWithWidget: onInteractWithWidget,
|
|
29126
29058
|
linterContext: this.props.linterContext,
|
|
29127
29059
|
strings: this.context.strings
|
|
@@ -38693,10 +38625,12 @@ function scoreMarker(marker) {
|
|
|
38693
38625
|
}
|
|
38694
38626
|
return score;
|
|
38695
38627
|
}
|
|
38696
|
-
|
|
38628
|
+
|
|
38629
|
+
// TODO(LEMS-2440): May need to pull answers out of PerseusLabelImageWidgetOptions[markers] for the rubric
|
|
38630
|
+
function labelImageValidator(userInput, rubric) {
|
|
38697
38631
|
let numAnswered = 0;
|
|
38698
38632
|
let numCorrect = 0;
|
|
38699
|
-
for (const marker of
|
|
38633
|
+
for (const marker of userInput.markers) {
|
|
38700
38634
|
const score = scoreMarker(marker);
|
|
38701
38635
|
if (score.hasAnswers) {
|
|
38702
38636
|
numAnswered++;
|
|
@@ -38707,7 +38641,7 @@ function labelImageValidator(state, rubric) {
|
|
|
38707
38641
|
}
|
|
38708
38642
|
|
|
38709
38643
|
// We expect all question markers to be answered before grading.
|
|
38710
|
-
if (numAnswered !==
|
|
38644
|
+
if (numAnswered !== userInput.markers.length) {
|
|
38711
38645
|
return {
|
|
38712
38646
|
type: "invalid",
|
|
38713
38647
|
message: null
|
|
@@ -38717,7 +38651,7 @@ function labelImageValidator(state, rubric) {
|
|
|
38717
38651
|
type: "points",
|
|
38718
38652
|
// Markers with no expected answers are graded as correct if user
|
|
38719
38653
|
// makes no answer selection.
|
|
38720
|
-
earned: numCorrect ===
|
|
38654
|
+
earned: numCorrect === userInput.markers.length ? 1 : 0,
|
|
38721
38655
|
total: 1,
|
|
38722
38656
|
message: null
|
|
38723
38657
|
};
|
|
@@ -38981,8 +38915,6 @@ const styles$b = StyleSheet.create({
|
|
|
38981
38915
|
* No diagonals allowed.
|
|
38982
38916
|
*/
|
|
38983
38917
|
|
|
38984
|
-
// TODO: should this be using WidgetProps / PerseusLabelImageWidgetOptions?
|
|
38985
|
-
|
|
38986
38918
|
class LabelImage extends React.Component {
|
|
38987
38919
|
/**
|
|
38988
38920
|
* Test whether point is contained within triangle.
|
|
@@ -39186,6 +39118,8 @@ class LabelImage extends React.Component {
|
|
|
39186
39118
|
markers
|
|
39187
39119
|
};
|
|
39188
39120
|
}
|
|
39121
|
+
|
|
39122
|
+
// TODO(LEMS-2544): Investigate impact on scoring; possibly pull out &/or remove rubric parameter.
|
|
39189
39123
|
showRationalesForCurrentlySelectedChoices(rubric) {
|
|
39190
39124
|
const {
|
|
39191
39125
|
markers
|
|
@@ -40611,9 +40545,6 @@ class Matrix extends React.Component {
|
|
|
40611
40545
|
});
|
|
40612
40546
|
return inputPaths;
|
|
40613
40547
|
};
|
|
40614
|
-
this.getGrammarTypeForPath = inputPath => {
|
|
40615
|
-
return "number";
|
|
40616
|
-
};
|
|
40617
40548
|
this._handleFocus = (row, col) => {
|
|
40618
40549
|
this.props.onFocus(getInputPath$1(row, col));
|
|
40619
40550
|
};
|
|
@@ -41026,7 +40957,7 @@ class Measurer extends React.Component {
|
|
|
41026
40957
|
}
|
|
41027
40958
|
Measurer.defaultProps = {
|
|
41028
40959
|
box: [480, 480],
|
|
41029
|
-
image:
|
|
40960
|
+
image: defaultImage,
|
|
41030
40961
|
showProtractor: true,
|
|
41031
40962
|
protractorX: 7.5,
|
|
41032
40963
|
protractorY: 0.5,
|
|
@@ -42101,10 +42032,12 @@ const TickMarks = Graphie.createSimpleClass((graphie, props) => {
|
|
|
42101
42032
|
};
|
|
42102
42033
|
|
|
42103
42034
|
// Generate an array of tick numbers:
|
|
42104
|
-
// `Array(
|
|
42035
|
+
// `Array(Math.round(numDivisions))` makes an array of null values - one for every division marker
|
|
42105
42036
|
// `.keys()` gets the index values for each marker placeholder
|
|
42106
42037
|
// `.map()` converts the index values into actual tick numbers
|
|
42107
|
-
|
|
42038
|
+
// NOTE: 'numDivisions' can sometimes be a non-integer (i.e. 7.000001).
|
|
42039
|
+
// Using Math.round() to ensure that an integer is used in the Array setup.
|
|
42040
|
+
const initialTicks = [...Array(Math.round(numDivisions)).keys()].map(index => range[0] + index * tickStep);
|
|
42108
42041
|
|
|
42109
42042
|
// .sort() comparator
|
|
42110
42043
|
const byNumericAscending = (a, b) => a - b;
|
|
@@ -42409,11 +42342,6 @@ class NumberLine extends React.Component {
|
|
|
42409
42342
|
}
|
|
42410
42343
|
return null;
|
|
42411
42344
|
}
|
|
42412
|
-
getGrammarTypeForPath(inputPath) {
|
|
42413
|
-
if ((inputPath == null ? void 0 : inputPath.length) === 1 && inputPath[0] === "tick-ctrl") {
|
|
42414
|
-
return "number";
|
|
42415
|
-
}
|
|
42416
|
-
}
|
|
42417
42345
|
getUserInput() {
|
|
42418
42346
|
return {
|
|
42419
42347
|
numLinePosition: this.props.numLinePosition,
|
|
@@ -44507,9 +44435,6 @@ class Table extends React.Component {
|
|
|
44507
44435
|
});
|
|
44508
44436
|
return inputPaths;
|
|
44509
44437
|
};
|
|
44510
|
-
this.getGrammarTypeForPath = inputPath => {
|
|
44511
|
-
return "number";
|
|
44512
|
-
};
|
|
44513
44438
|
this.setInputValue = (path, newValue, cb) => {
|
|
44514
44439
|
// Extract row, column information
|
|
44515
44440
|
const row = getRowFromPath(path);
|
|
@@ -44827,7 +44752,7 @@ const init = function init(options) {
|
|
|
44827
44752
|
|
|
44828
44753
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
44829
44754
|
const libName = "@khanacademy/perseus";
|
|
44830
|
-
const libVersion = "
|
|
44755
|
+
const libVersion = "39.0.0";
|
|
44831
44756
|
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
44832
44757
|
|
|
44833
44758
|
const apiVersion = {
|
|
@@ -45549,9 +45474,6 @@ class ServerItemRenderer extends React.Component {
|
|
|
45549
45474
|
getDOMNodeForPath(path) {
|
|
45550
45475
|
return this.questionRenderer.getDOMNodeForPath(path);
|
|
45551
45476
|
}
|
|
45552
|
-
getGrammarTypeForPath(path) {
|
|
45553
|
-
return this.questionRenderer.getGrammarTypeForPath(path);
|
|
45554
|
-
}
|
|
45555
45477
|
getInputPaths() {
|
|
45556
45478
|
const questionAreaInputPaths = this.questionRenderer.getInputPaths();
|
|
45557
45479
|
return questionAreaInputPaths;
|
|
@@ -46828,7 +46750,6 @@ const styles = StyleSheet.create({
|
|
|
46828
46750
|
* If you're writing new components, though, consider using the Item and Shape
|
|
46829
46751
|
* types instead.
|
|
46830
46752
|
*/
|
|
46831
|
-
|
|
46832
46753
|
/**
|
|
46833
46754
|
* Return a PropType that accepts Items of the given shape, and rejects other
|
|
46834
46755
|
* objects.
|
|
@@ -47060,6 +46981,21 @@ function violatingWidgets(itemData) {
|
|
|
47060
46981
|
}
|
|
47061
46982
|
|
|
47062
46983
|
/* eslint-disable eqeqeq, @typescript-eslint/no-unused-vars */
|
|
46984
|
+
/*
|
|
46985
|
+
* A class for formatting number to significant digits.
|
|
46986
|
+
* Copyright (C) 2001 Stephen Ostermiller
|
|
46987
|
+
* http://ostermiller.org/contact.pl?regarding?JavaScript+Significant+Figures
|
|
46988
|
+
*
|
|
46989
|
+
* This program is free software; you can redistribute it and/or modify
|
|
46990
|
+
* it under the terms of the GNU General Public License as published by
|
|
46991
|
+
* the Free Software Foundation; either version 2 of the License, or
|
|
46992
|
+
* (at your option) any later version.
|
|
46993
|
+
*
|
|
46994
|
+
* This program is distributed in the hope that it will be useful,
|
|
46995
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
46996
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
46997
|
+
* GNU General Public License for more details.
|
|
46998
|
+
*/
|
|
47063
46999
|
|
|
47064
47000
|
/**
|
|
47065
47001
|
* Format a floating point for display using the specified
|