@khanacademy/perseus 4.0.1 → 5.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/CHANGELOG.md +26 -0
- package/dist/components/highlighting/highlightable-content.d.ts +4 -4
- package/dist/components/highlighting/highlightable-content.js.flow +4 -7
- package/dist/components/highlighting/ui/highlight-renderer.d.ts +6 -6
- package/dist/components/highlighting/ui/highlight-renderer.js.flow +6 -8
- package/dist/components/highlighting/ui/highlight-set-renderer.d.ts +5 -5
- package/dist/components/highlighting/ui/highlight-set-renderer.js.flow +5 -8
- package/dist/components/highlighting/ui/highlight-tooltip.d.ts +2 -2
- package/dist/components/highlighting/ui/highlight-tooltip.js.flow +2 -4
- package/dist/components/highlighting/ui/highlighting-ui.d.ts +3 -3
- package/dist/components/highlighting/ui/highlighting-ui.js.flow +2 -2
- package/dist/components/highlighting/ui/selection-tracker.d.ts +5 -5
- package/dist/components/highlighting/ui/selection-tracker.js.flow +5 -7
- package/dist/components/highlighting/word-indexer.d.ts +2 -2
- package/dist/components/highlighting/word-indexer.js.flow +2 -2
- package/dist/components/inline-icon.d.ts +35 -1
- package/dist/components/inline-icon.js.flow +11 -1
- package/dist/components/simple-keypad-input.d.ts +1 -1
- package/dist/components/simple-keypad-input.js.flow +1 -1
- package/dist/components/tex-buttons.d.ts +2 -2
- package/dist/components/tex-buttons.js.flow +2 -2
- package/dist/error-boundary.d.ts +4 -4
- package/dist/error-boundary.js.flow +4 -6
- package/dist/es/index.js +53 -233
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +53 -233
- package/dist/index.js.map +1 -1
- package/dist/multi-items/multi-renderer.d.ts +1 -1
- package/dist/multi-items/multi-renderer.js.flow +1 -1
- package/dist/multi-items/prop-type-builders.d.ts +1 -1
- package/dist/multi-items/shape-types.d.ts +1 -1
- package/dist/multi-items/shape-types.js.flow +1 -1
- package/dist/multi-items/tree-types.d.ts +1 -1
- package/dist/multi-items/tree-types.js.flow +1 -1
- package/dist/perseus-types.d.ts +0 -1
- package/dist/perseus-types.js.flow +0 -1
- package/dist/widgets/__stories__/test-keypad-context-wrapper.d.ts +6 -0
- package/dist/widgets/__stories__/test-keypad-context-wrapper.js.flow +12 -0
- package/dist/widgets/expression.d.ts +2 -2
- package/dist/widgets/expression.js.flow +2 -2
- package/dist/widgets/interaction/element-container.d.ts +5 -4
- package/dist/widgets/interaction/element-container.js.flow +6 -11
- package/dist/widgets/label-image/marker.d.ts +4 -4
- package/dist/widgets/label-image/marker.js.flow +4 -6
- package/dist/widgets/numeric-input.d.ts +0 -2
- package/dist/widgets/numeric-input.js.flow +0 -4
- package/dist/widgets/radio/base-radio.d.ts +7 -1
- package/dist/widgets/radio/base-radio.js.flow +7 -1
- package/dist/widgets/radio/choice-icon/choice-icon.d.ts +1 -1
- package/dist/widgets/radio/choice-icon/choice-icon.js.flow +1 -1
- package/dist/widgets/radio/choice-icon/cross-out-line.d.ts +2 -2
- package/dist/widgets/radio/choice-icon/cross-out-line.js.flow +2 -2
- package/dist/widgets/radio/focus-ring.d.ts +8 -1
- package/dist/widgets/radio/focus-ring.js.flow +8 -1
- package/dist/widgets/radio/option-status.d.ts +2 -2
- package/dist/widgets/radio/option-status.js.flow +2 -2
- package/dist/widgets/video-transcript-link.d.ts +1 -1
- package/dist/widgets/video-transcript-link.js.flow +1 -1
- package/package.json +4 -4
- package/src/__stories__/item-renderer.stories.tsx +2 -6
- package/src/__stories__/server-item-renderer.stories.tsx +2 -6
- package/src/__testdata__/item-renderer.testdata.ts +1 -1
- package/src/__testdata__/renderer.testdata.ts +1 -1
- package/src/__tests__/item-renderer.test.tsx +1 -2
- package/src/__tests__/renderer-api.test.tsx +1 -5
- package/src/__tests__/renderer.test.tsx +1 -1
- package/src/components/__stories__/button-group.stories.tsx +2 -6
- package/src/components/__stories__/fixed-to-responsive.stories.tsx +14 -16
- package/src/components/__stories__/graph.stories.tsx +3 -5
- package/src/components/__stories__/graphie.stories.tsx +3 -5
- package/src/components/__stories__/hud.stories.tsx +2 -6
- package/src/components/__stories__/icon.stories.tsx +1 -1
- package/src/components/__stories__/image-loader.stories.tsx +4 -4
- package/src/components/__stories__/info-tip.stories.tsx +2 -6
- package/src/components/__stories__/inline-icon.stories.tsx +4 -8
- package/src/components/__stories__/input-with-examples.stories.tsx +6 -10
- package/src/components/__stories__/lint.stories.tsx +12 -12
- package/src/components/__stories__/math-input.stories.tsx +4 -8
- package/src/components/__stories__/math-output.stories.tsx +3 -5
- package/src/components/__stories__/multi-button-group.stories.tsx +2 -6
- package/src/components/__stories__/number-input.stories.tsx +6 -8
- package/src/components/__stories__/prop-check-box.stories.tsx +9 -9
- package/src/components/__stories__/range-input.stories.tsx +4 -6
- package/src/components/__stories__/simple-keypad-input.stories.tsx +2 -4
- package/src/components/__stories__/sortable.stories.tsx +15 -15
- package/src/components/__stories__/stub-tag-editor.stories.tsx +5 -9
- package/src/components/__stories__/svg-image.stories.tsx +10 -18
- package/src/components/__stories__/tex.stories.tsx +1 -3
- package/src/components/__stories__/text-buttons.stories.tsx +10 -22
- package/src/components/__stories__/text-input.stories.tsx +4 -10
- package/src/components/__stories__/text-list-editor.stories.tsx +1 -3
- package/src/components/__stories__/zoomable-tex.stories.tsx +6 -4
- package/src/components/__stories__/zoomable.stories.tsx +1 -3
- package/src/components/fixed-to-responsive.tsx +0 -1
- package/src/components/graph.tsx +0 -4
- package/src/components/highlighting/highlightable-content.tsx +4 -7
- package/src/components/highlighting/ui/highlight-renderer.tsx +6 -9
- package/src/components/highlighting/ui/highlight-set-renderer.tsx +5 -8
- package/src/components/highlighting/ui/highlight-tooltip.tsx +2 -2
- package/src/components/highlighting/ui/highlighting-ui.tsx +5 -15
- package/src/components/highlighting/ui/selection-tracker.tsx +6 -9
- package/src/components/highlighting/word-indexer.tsx +2 -6
- package/src/components/inline-icon.tsx +2 -2
- package/src/components/math-input.tsx +0 -2
- package/src/components/number-input.tsx +0 -2
- package/src/components/simple-keypad-input.tsx +2 -2
- package/src/components/tex-buttons.tsx +2 -2
- package/src/components/text-list-editor.tsx +0 -4
- package/src/components/visibility-observer/__stories__/visibility-observer.stories.tsx +1 -3
- package/src/components/zoomable-tex.tsx +0 -2
- package/src/components/zoomable.tsx +0 -4
- package/src/definition-context.tsx +0 -1
- package/src/error-boundary.tsx +4 -7
- package/src/hints-renderer.tsx +1 -1
- package/src/interactive2/__tests__/movable-point.test.ts +0 -1
- package/src/item-renderer.tsx +0 -5
- package/src/mixins/changeable.ts +1 -1
- package/src/multi-items/__stories__/multi-renderer.stories.tsx +1 -5
- package/src/multi-items/__tests__/items.test.ts +3 -13
- package/src/multi-items/__tests__/multi-renderer.test.tsx +3 -4
- package/src/multi-items/__tests__/prop-type-builders.test.ts +1 -1
- package/src/multi-items/__tests__/trees.test.ts +2 -10
- package/src/multi-items/multi-renderer.tsx +7 -10
- package/src/multi-items/prop-type-builders.ts +1 -1
- package/src/multi-items/shape-types.ts +1 -1
- package/src/multi-items/tree-types.ts +1 -1
- package/src/perseus-markdown.tsx +0 -2
- package/src/perseus-types.ts +1 -4
- package/src/renderer.tsx +2 -5
- package/src/server-item-renderer.tsx +0 -3
- package/src/util/graphie.ts +3 -3
- package/src/util/interactive.ts +0 -4
- package/src/util/math.ts +0 -3
- package/src/widgets/__stories__/categorizer.stories.tsx +1 -1
- package/src/widgets/__stories__/cs-program.stories.tsx +1 -1
- package/src/widgets/__stories__/definition.stories.tsx +3 -7
- package/src/widgets/__stories__/dropdown.stories.tsx +1 -1
- package/src/widgets/__stories__/explanation.stories.tsx +2 -2
- package/src/widgets/__stories__/expression.stories.tsx +113 -13
- package/src/widgets/__stories__/graded-group-set.stories.tsx +1 -1
- package/src/widgets/__stories__/graded-group.stories.tsx +1 -1
- package/src/widgets/__stories__/grapher.stories.tsx +7 -21
- package/src/widgets/__stories__/group.stories.tsx +1 -1
- package/src/widgets/__stories__/iframe.stories.tsx +1 -1
- package/src/widgets/__stories__/image.stories.tsx +2 -2
- package/src/widgets/__stories__/input-number.stories.tsx +3 -12
- package/src/widgets/__stories__/interaction.stories.tsx +1 -1
- package/src/widgets/__stories__/interactive-graph.stories.tsx +9 -9
- package/src/widgets/__stories__/matcher.stories.tsx +1 -1
- package/src/widgets/__stories__/matrix.stories.tsx +1 -1
- package/src/widgets/__stories__/number-line.stories.tsx +1 -1
- package/src/widgets/__stories__/numeric-input.stories.tsx +3 -5
- package/src/widgets/__stories__/orderer.stories.tsx +1 -1
- package/src/widgets/__stories__/passage-ref.stories.tsx +2 -2
- package/src/widgets/__stories__/passage.stories.tsx +3 -9
- package/src/widgets/__stories__/radio.stories.tsx +3 -5
- package/src/widgets/__stories__/sorter.stories.tsx +1 -1
- package/src/widgets/__stories__/{on-screen-keypad.stories.tsx → test-keypad-context-wrapper.tsx} +15 -57
- package/src/widgets/__stories__/transformer.stories.tsx +1 -1
- package/src/widgets/__stories__/unit.stories.tsx +1 -3
- package/src/widgets/__stories__/video-transcript-link.stories.tsx +2 -6
- package/src/widgets/__stories__/video.stories.tsx +1 -1
- package/src/widgets/__testdata__/expression.testdata.ts +16 -12
- package/src/widgets/__testdata__/group.testdata.ts +0 -2
- package/src/widgets/__testdata__/numeric-input.testdata.ts +0 -1
- package/src/widgets/__testdata__/transformer.testdata.ts +0 -1
- package/src/widgets/__tests__/group.test.tsx +0 -2
- package/src/widgets/__tests__/radio/focus-ring.test.tsx +0 -1
- package/src/widgets/__tests__/radio.test.ts +1 -1
- package/src/widgets/expression.tsx +4 -4
- package/src/widgets/graded-group-set.tsx +0 -4
- package/src/widgets/graded-group.tsx +0 -4
- package/src/widgets/grapher/util.tsx +1 -5
- package/src/widgets/grapher.tsx +0 -5
- package/src/widgets/group.tsx +0 -1
- package/src/widgets/interaction/element-container.tsx +7 -8
- package/src/widgets/interaction.tsx +0 -1
- package/src/widgets/interactive-graph.tsx +3 -62
- package/src/widgets/label-image/__stories__/answer-choices.stories.tsx +2 -4
- package/src/widgets/label-image/__stories__/marker.stories.tsx +9 -19
- package/src/widgets/label-image/marker.tsx +4 -4
- package/src/widgets/label-image.tsx +1 -1
- package/src/widgets/measurer.tsx +0 -1
- package/src/widgets/number-line.tsx +0 -2
- package/src/widgets/numeric-input.tsx +0 -3
- package/src/widgets/orderer.tsx +0 -3
- package/src/widgets/passage/passage-markdown.tsx +3 -3
- package/src/widgets/passage-ref-target.tsx +0 -1
- package/src/widgets/passage.tsx +1 -1
- package/src/widgets/plotter.tsx +0 -1
- package/src/widgets/radio/__stories__/base-radio.stories.tsx +13 -21
- package/src/widgets/radio/__stories__/choice-icon.stories.tsx +9 -11
- package/src/widgets/radio/__stories__/choice-none-above.stories.tsx +1 -1
- package/src/widgets/radio/__stories__/choice.stories.tsx +4 -4
- package/src/widgets/radio/__stories__/focus-ring.stories.tsx +1 -1
- package/src/widgets/radio/__stories__/option-status.stories.tsx +2 -4
- package/src/widgets/radio/base-radio.tsx +2 -2
- package/src/widgets/radio/choice-icon/choice-icon.tsx +5 -5
- package/src/widgets/radio/choice-icon/cross-out-line.tsx +1 -3
- package/src/widgets/radio/choice-none-above.tsx +2 -2
- package/src/widgets/radio/choice.tsx +1 -3
- package/src/widgets/radio/focus-ring.tsx +1 -1
- package/src/widgets/radio/option-status.tsx +2 -4
- package/src/widgets/radio/widget.tsx +0 -1
- package/src/widgets/reaction-diagram.tsx +2 -2
- package/src/widgets/transformer.tsx +1 -16
- package/src/widgets/video-transcript-link.tsx +1 -1
- package/src/widgets.ts +1 -1
- package/src/zoom.ts +0 -3
- package/tsconfig.tsbuildinfo +1 -1
package/dist/es/index.js
CHANGED
|
@@ -413,8 +413,6 @@ class MathInput extends React.Component {
|
|
|
413
413
|
// group. This will probably require ESCAPE key handling to enable to
|
|
414
414
|
// close (blur) the button group in order to focus on next page element.
|
|
415
415
|
if (!this.mouseDown &&
|
|
416
|
-
// $FlowFixMe[incompatible-use]
|
|
417
|
-
// $FlowFixMe[incompatible-call]
|
|
418
416
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
|
|
419
417
|
!ReactDOM__default.findDOMNode(this).contains(e.relatedTarget)) {
|
|
420
418
|
this.setState({
|
|
@@ -1235,7 +1233,7 @@ const _changeSingle = function _changeSingle(component, propName, value, callbac
|
|
|
1235
1233
|
* this.change(propName) -> returns a lambda that takes a prop value to
|
|
1236
1234
|
* set and a callback to call after having set that value.
|
|
1237
1235
|
*/
|
|
1238
|
-
// TODO(WEB-1727): use proper
|
|
1236
|
+
// TODO(WEB-1727): use proper TypeScript syntax for overloaded functions
|
|
1239
1237
|
const change = function change(newPropsOrSinglePropName, propValue, callback) {
|
|
1240
1238
|
if (_.isObject(newPropsOrSinglePropName) && callback === undefined) {
|
|
1241
1239
|
// Called with an object of multiple props to change
|
|
@@ -1320,8 +1318,6 @@ class TextListEditor extends React.Component {
|
|
|
1320
1318
|
// eslint-disable-next-line react/no-string-refs
|
|
1321
1319
|
// @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
1322
1320
|
this.refs["input_" + focusIndex]
|
|
1323
|
-
// $FlowFixMe[incompatible-use]
|
|
1324
|
-
// $FlowFixMe[prop-missing]
|
|
1325
1321
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'focus' does not exist on type 'Element | Text'.
|
|
1326
1322
|
).focus();
|
|
1327
1323
|
});
|
|
@@ -1357,8 +1353,6 @@ class TextListEditor extends React.Component {
|
|
|
1357
1353
|
// eslint-disable-next-line react/no-string-refs
|
|
1358
1354
|
// @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
1359
1355
|
this.refs["input_" + focusIndex]
|
|
1360
|
-
// $FlowFixMe[incompatible-use]
|
|
1361
|
-
// $FlowFixMe[prop-missing]
|
|
1362
1356
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'focus' does not exist on type 'Element | Text'.
|
|
1363
1357
|
).focus();
|
|
1364
1358
|
});
|
|
@@ -1675,7 +1669,6 @@ const KhanMath = {
|
|
|
1675
1669
|
}
|
|
1676
1670
|
return true;
|
|
1677
1671
|
},
|
|
1678
|
-
// $FlowFixMe[incompatible-return]
|
|
1679
1672
|
// @ts-expect-error [FEI-5003] - TS2366 - Function lacks ending return statement and return type does not include 'undefined'.
|
|
1680
1673
|
getPrimeFactorization: function (number) {
|
|
1681
1674
|
if (number === 1) {
|
|
@@ -1732,9 +1725,7 @@ const KhanMath = {
|
|
|
1732
1725
|
// toFraction(0.666, 0.001) => [2, 3]
|
|
1733
1726
|
//
|
|
1734
1727
|
// tolerance can't be bigger than 1, sorry
|
|
1735
|
-
toFraction: function (decimal,
|
|
1736
|
-
// $FlowFixMe[incompatible-return]
|
|
1737
|
-
tolerance) {
|
|
1728
|
+
toFraction: function (decimal, tolerance) {
|
|
1738
1729
|
if (tolerance == null) {
|
|
1739
1730
|
tolerance = Math.pow(2, -46);
|
|
1740
1731
|
}
|
|
@@ -2550,6 +2541,8 @@ const insertBraces = value => {
|
|
|
2550
2541
|
class Expression extends React.Component {
|
|
2551
2542
|
constructor(..._args) {
|
|
2552
2543
|
super(..._args);
|
|
2544
|
+
this._isMounted = false;
|
|
2545
|
+
this.errorTimeout = null;
|
|
2553
2546
|
this.displayName = "Expression";
|
|
2554
2547
|
this.state = {
|
|
2555
2548
|
showErrorTooltip: false,
|
|
@@ -2596,8 +2589,6 @@ class Expression extends React.Component {
|
|
|
2596
2589
|
clearTimeout(this.errorTimeout);
|
|
2597
2590
|
this._isMounted = false;
|
|
2598
2591
|
};
|
|
2599
|
-
this._isMounted = false;
|
|
2600
|
-
this.errorTimeout = null;
|
|
2601
2592
|
this.simpleValidate = (rubric, onInputError) => {
|
|
2602
2593
|
onInputError = onInputError || function () {};
|
|
2603
2594
|
return Expression.validate(this.getUserInput(), rubric, onInputError);
|
|
@@ -2837,7 +2828,7 @@ class Expression extends React.Component {
|
|
|
2837
2828
|
var _this$props$keypadEle;
|
|
2838
2829
|
// this.props.keypadElement should always be set
|
|
2839
2830
|
// when apiOptions.customKeypad is set, but how
|
|
2840
|
-
// to convince
|
|
2831
|
+
// to convince TypeScript of this?
|
|
2841
2832
|
(_this$props$keypadEle = this.props.keypadElement) == null ? void 0 : _this$props$keypadEle.configure(this.props.keypadConfiguration, () => {
|
|
2842
2833
|
if (this._isMounted) {
|
|
2843
2834
|
this._handleFocus();
|
|
@@ -4166,16 +4157,10 @@ Zoom.prototype._calculateZoom = function () {
|
|
|
4166
4157
|
// Zoom to fit the viewport.
|
|
4167
4158
|
const imageAspectRatio = originalFullImageWidth / originalFullImageHeight;
|
|
4168
4159
|
const viewportAspectRatio = viewportWidth / viewportHeight;
|
|
4169
|
-
if (
|
|
4170
|
-
// $FlowFixMe[invalid-compare]
|
|
4171
|
-
originalFullImageWidth < viewportWidth &&
|
|
4172
|
-
// $FlowFixMe[invalid-compare]
|
|
4173
|
-
originalFullImageHeight < viewportHeight) {
|
|
4160
|
+
if (originalFullImageWidth < viewportWidth && originalFullImageHeight < viewportHeight) {
|
|
4174
4161
|
this._imgScaleFactor = maxScaleFactor;
|
|
4175
4162
|
} else if (imageAspectRatio < viewportAspectRatio) {
|
|
4176
|
-
this._imgScaleFactor =
|
|
4177
|
-
// $FlowFixMe[unsafe-addition]
|
|
4178
|
-
viewportHeight / originalFullImageHeight * maxScaleFactor;
|
|
4163
|
+
this._imgScaleFactor = viewportHeight / originalFullImageHeight * maxScaleFactor;
|
|
4179
4164
|
} else {
|
|
4180
4165
|
this._imgScaleFactor = viewportWidth / (originalFullImageWidth != null ? originalFullImageWidth : 0) * maxScaleFactor;
|
|
4181
4166
|
}
|
|
@@ -4508,7 +4493,6 @@ const FixedToResponsive = createReactClass({
|
|
|
4508
4493
|
// Based on http://refills.bourbon.io/components/#video && medium.com
|
|
4509
4494
|
const spacer = /*#__PURE__*/React.createElement("div", {
|
|
4510
4495
|
style: {
|
|
4511
|
-
// $FlowFixMe[unsafe-addition]
|
|
4512
4496
|
// @ts-expect-error [FEI-5003] - TS2362 - The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
|
|
4513
4497
|
paddingBottom: (1 / aspectRatio).toFixed(4) * 100 + "%"
|
|
4514
4498
|
}
|
|
@@ -10007,7 +9991,7 @@ GraphUtils.createGraphie = function (el) {
|
|
|
10007
9991
|
* the function at i
|
|
10008
9992
|
* @param {[]} rangeArray array of ranges over which the
|
|
10009
9993
|
* corresponding functions are defined
|
|
10010
|
-
* @return {
|
|
9994
|
+
* @return {Set<any>} set of paths
|
|
10011
9995
|
*/
|
|
10012
9996
|
plotPiecewise: function (fnArray, rangeArray) {
|
|
10013
9997
|
const paths = raphael$1.set();
|
|
@@ -10029,8 +10013,8 @@ GraphUtils.createGraphie = function (el) {
|
|
|
10029
10013
|
* return a Raphael set of Raphael circle objects at those
|
|
10030
10014
|
* coordinates
|
|
10031
10015
|
*
|
|
10032
|
-
* @param {Array
|
|
10033
|
-
* @return {
|
|
10016
|
+
* @param {Array<[number, number]>} endpointArray
|
|
10017
|
+
* @return {Set<any>} set of circles
|
|
10034
10018
|
*/
|
|
10035
10019
|
plotEndpointCircles: function (endpointArray) {
|
|
10036
10020
|
const circles = raphael$1.set();
|
|
@@ -13556,9 +13540,7 @@ function Protractor(graph, center) {
|
|
|
13556
13540
|
const time = Math.abs(this.rotation - angle) * 5;
|
|
13557
13541
|
$({
|
|
13558
13542
|
0: this.rotation
|
|
13559
|
-
}).animate(
|
|
13560
|
-
// $FlowFixMe[unsupported-syntax]
|
|
13561
|
-
{
|
|
13543
|
+
}).animate({
|
|
13562
13544
|
0: angle
|
|
13563
13545
|
}, {
|
|
13564
13546
|
duration: time,
|
|
@@ -13611,11 +13593,8 @@ function Ruler(graphie, options) {
|
|
|
13611
13593
|
if (options.ticksPerUnit === 10) {
|
|
13612
13594
|
// decimal, as on a centimeter ruler
|
|
13613
13595
|
tickHeightMap = {
|
|
13614
|
-
// $FlowFixMe[unsupported-syntax]
|
|
13615
13596
|
10: tickHeight,
|
|
13616
|
-
// $FlowFixMe[unsupported-syntax]
|
|
13617
13597
|
5: tickHeight * 0.55,
|
|
13618
|
-
// $FlowFixMe[unsupported-syntax]
|
|
13619
13598
|
1: tickHeight * 0.35
|
|
13620
13599
|
};
|
|
13621
13600
|
} else {
|
|
@@ -17713,12 +17692,8 @@ Zoomable.defaultProps = {
|
|
|
17713
17692
|
computeChildBounds: parentNode => {
|
|
17714
17693
|
const firstChild = parentNode.firstElementChild;
|
|
17715
17694
|
return {
|
|
17716
|
-
// $FlowFixMe[incompatible-use]
|
|
17717
|
-
// $FlowFixMe[prop-missing]
|
|
17718
17695
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'. | TS2339 - Property 'offsetWidth' does not exist on type 'Element'.
|
|
17719
17696
|
width: firstChild.offsetWidth,
|
|
17720
|
-
// $FlowFixMe[incompatible-use]
|
|
17721
|
-
// $FlowFixMe[prop-missing]
|
|
17722
17697
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'. | TS2339 - Property 'offsetHeight' does not exist on type 'Element'.
|
|
17723
17698
|
height: firstChild.offsetHeight
|
|
17724
17699
|
};
|
|
@@ -17733,10 +17708,8 @@ Zoomable.defaultProps = {
|
|
|
17733
17708
|
const computeMathBounds = (parentNode, parentBounds) => {
|
|
17734
17709
|
const textElement = parentNode.querySelector(".katex-html") || parentNode.querySelector(".MathJax");
|
|
17735
17710
|
const textBounds = {
|
|
17736
|
-
// $FlowFixMe[incompatible-use]
|
|
17737
17711
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'. | TS2339 - Property 'offsetWidth' does not exist on type 'Element'.
|
|
17738
17712
|
width: textElement.offsetWidth,
|
|
17739
|
-
// $FlowFixMe[incompatible-use]
|
|
17740
17713
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'. | TS2339 - Property 'offsetHeight' does not exist on type 'Element'.
|
|
17741
17714
|
height: textElement.offsetHeight
|
|
17742
17715
|
};
|
|
@@ -18660,11 +18633,8 @@ var PerseusMarkdown = {
|
|
|
18660
18633
|
parse: parse$3,
|
|
18661
18634
|
parseInline: inlineParser,
|
|
18662
18635
|
reactFor: SimpleMarkdown.reactFor,
|
|
18663
|
-
// $FlowFixMe[incompatible-use]
|
|
18664
18636
|
ruleOutput: SimpleMarkdown.ruleOutput(rules$1, "react"),
|
|
18665
|
-
basicOutput: SimpleMarkdown.reactFor(
|
|
18666
|
-
// $FlowFixMe[incompatible-use]
|
|
18667
|
-
SimpleMarkdown.ruleOutput(rules$1, "react")),
|
|
18637
|
+
basicOutput: SimpleMarkdown.reactFor(SimpleMarkdown.ruleOutput(rules$1, "react")),
|
|
18668
18638
|
sanitizeUrl: SimpleMarkdown.sanitizeUrl
|
|
18669
18639
|
};
|
|
18670
18640
|
|
|
@@ -19103,7 +19073,7 @@ const validAlignments = ["block", "inline-block", "inline", "float-left", "float
|
|
|
19103
19073
|
* invalid.
|
|
19104
19074
|
*/
|
|
19105
19075
|
// TODO(alex): Change this to run as a testcase (vs. being run at runtime)
|
|
19106
|
-
// TODO(LP-10707): I think this can be completely removed because our
|
|
19076
|
+
// TODO(LP-10707): I think this can be completely removed because our TypeScript types
|
|
19107
19077
|
// enforce this!
|
|
19108
19078
|
const validateAlignments = () => {
|
|
19109
19079
|
_.each(widgets, function (widgetInfo) {
|
|
@@ -19469,10 +19439,8 @@ class Renderer extends React.Component {
|
|
|
19469
19439
|
let interactionTracker = this._interactionTrackers[id];
|
|
19470
19440
|
if (!interactionTracker) {
|
|
19471
19441
|
interactionTracker = this._interactionTrackers[id] = new InteractionTracker(apiOptions.trackInteraction,
|
|
19472
|
-
// $FlowFixMe[incompatible-call]
|
|
19473
19442
|
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'string | null | undefined' is not assignable to parameter of type 'string'.
|
|
19474
19443
|
widgetInfo && widgetInfo.type, id,
|
|
19475
|
-
// $FlowFixMe[incompatible-call]
|
|
19476
19444
|
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'string | null | undefined' is not assignable to parameter of type 'string'.
|
|
19477
19445
|
getTracking(widgetInfo && widgetInfo.type));
|
|
19478
19446
|
}
|
|
@@ -19779,7 +19747,7 @@ class Renderer extends React.Component {
|
|
|
19779
19747
|
const isString = typeof nodeOut === "string";
|
|
19780
19748
|
if (typeof nodeOut === "string" && lastWasString) {
|
|
19781
19749
|
/**
|
|
19782
|
-
* We know that last was string, but
|
|
19750
|
+
* We know that last was string, but TypeScript can't see this
|
|
19783
19751
|
* refinement.
|
|
19784
19752
|
*/
|
|
19785
19753
|
result[result.length - 1] += nodeOut;
|
|
@@ -19933,7 +19901,6 @@ class Renderer extends React.Component {
|
|
|
19933
19901
|
setAssetStatus
|
|
19934
19902
|
}) => /*#__PURE__*/React.createElement(SvgImage, _extends({
|
|
19935
19903
|
setAssetStatus: setAssetStatus
|
|
19936
|
-
/* $FlowFixMe[incompatible-type]: sanitizeUrl() can return null */
|
|
19937
19904
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'string | null | undefined' is not assignable to type 'string | undefined'.
|
|
19938
19905
|
,
|
|
19939
19906
|
src: PerseusMarkdown.sanitizeUrl(node.target),
|
|
@@ -21829,8 +21796,7 @@ NumericInput.defaultProps = {
|
|
|
21829
21796
|
coefficient: false,
|
|
21830
21797
|
answerForms: [],
|
|
21831
21798
|
labelText: "",
|
|
21832
|
-
linterContext: linterContextDefault
|
|
21833
|
-
multipleNumberInput: false
|
|
21799
|
+
linterContext: linterContextDefault
|
|
21834
21800
|
};
|
|
21835
21801
|
const unionAnswerForms = function unionAnswerForms(answerFormsList) {
|
|
21836
21802
|
// Takes a list of lists of answer forms, and returns a list of the forms
|
|
@@ -23274,7 +23240,7 @@ const BaseRadio = function BaseRadio(props) {
|
|
|
23274
23240
|
aphroditeClassName(true);
|
|
23275
23241
|
let correctnessClass;
|
|
23276
23242
|
// reviewMode is only true if there's a rubric
|
|
23277
|
-
// but
|
|
23243
|
+
// but TypeScript doesn't understand that
|
|
23278
23244
|
if (reviewMode && reviewModeRubric) {
|
|
23279
23245
|
correctnessClass = reviewModeRubric.choices[i].correct ? ClassNames.CORRECT : ClassNames.INCORRECT;
|
|
23280
23246
|
}
|
|
@@ -23787,9 +23753,7 @@ class Radio$1 extends React.Component {
|
|
|
23787
23753
|
};
|
|
23788
23754
|
});
|
|
23789
23755
|
return /*#__PURE__*/React.createElement(BaseRadio, {
|
|
23790
|
-
labelWrap: true
|
|
23791
|
-
// @ts-expect-error [FEI-5003] - TS2322 - Type 'boolean | undefined' is not assignable to type 'boolean'.
|
|
23792
|
-
,
|
|
23756
|
+
labelWrap: true,
|
|
23793
23757
|
multipleSelect: this.props.multipleSelect,
|
|
23794
23758
|
countChoices: this.props.countChoices,
|
|
23795
23759
|
numCorrect: this.props.numCorrect,
|
|
@@ -25018,7 +24982,6 @@ class GradedGroup extends React.Component {
|
|
|
25018
24982
|
}
|
|
25019
24983
|
const mobileClass = this.props.inGradedGroupSet ? css(styles$l.gradedGroupInSet) : css(styles$l.gradedGroup);
|
|
25020
24984
|
const classes = classNames({
|
|
25021
|
-
// $FlowFixMe[invalid-computed-prop]
|
|
25022
24985
|
[mobileClass]: apiOptions.isMobile,
|
|
25023
24986
|
"perseus-graded-group": true,
|
|
25024
24987
|
"answer-correct": apiOptions.isMobile ? false : this.state.status === GRADING_STATUSES.correct,
|
|
@@ -25271,7 +25234,6 @@ class GradedGroupSet extends React.Component {
|
|
|
25271
25234
|
/*#__PURE__*/
|
|
25272
25235
|
// TODO(jeremy): Don't spread this.props, instead
|
|
25273
25236
|
// pass in all props GradedGroup needs explicilty
|
|
25274
|
-
// $FlowFixMe[prop-missing]
|
|
25275
25237
|
// @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call.
|
|
25276
25238
|
React.createElement(GradedGroup, _extends({
|
|
25277
25239
|
key: i
|
|
@@ -25310,12 +25272,8 @@ class GradedGroupSet extends React.Component {
|
|
|
25310
25272
|
ref: comp => this._childGroup = comp
|
|
25311
25273
|
// We should pass in the set of props explicitly
|
|
25312
25274
|
}, this.props, currentGroup, {
|
|
25313
|
-
inGradedGroupSet: true
|
|
25314
|
-
|
|
25315
|
-
,
|
|
25316
|
-
title: null
|
|
25317
|
-
// $FlowFixMe[incompatible-type]
|
|
25318
|
-
,
|
|
25275
|
+
inGradedGroupSet: true,
|
|
25276
|
+
title: null,
|
|
25319
25277
|
onNextQuestion: handleNextQuestion,
|
|
25320
25278
|
linterContext: this.props.linterContext
|
|
25321
25279
|
})));
|
|
@@ -25588,7 +25546,6 @@ const Linear = _.extend({}, PlotDefaults, {
|
|
|
25588
25546
|
const Quadratic = _.extend({}, PlotDefaults, {
|
|
25589
25547
|
url: "https://ka-perseus-graphie.s3.amazonaws.com/e23d36e6fc29ee37174e92c9daba2a66677128ab.png",
|
|
25590
25548
|
defaultCoords: [[0.5, 0.5], [0.75, 0.75]],
|
|
25591
|
-
// $FlowFixMe[prop-missing]
|
|
25592
25549
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'Parabola' does not exist on type 'typeof Graphie'.
|
|
25593
25550
|
Movable: Graphie.Parabola,
|
|
25594
25551
|
getCoefficients: function (coords) {
|
|
@@ -25629,7 +25586,6 @@ const Quadratic = _.extend({}, PlotDefaults, {
|
|
|
25629
25586
|
const Sinusoid = _.extend({}, PlotDefaults, {
|
|
25630
25587
|
url: "https://ka-perseus-graphie.s3.amazonaws.com/3d68e7718498475f53b206c2ab285626baf8857e.png",
|
|
25631
25588
|
defaultCoords: [[0.5, 0.5], [0.6, 0.6]],
|
|
25632
|
-
// $FlowFixMe[prop-missing]
|
|
25633
25589
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'Sinusoid' does not exist on type 'typeof Graphie'.
|
|
25634
25590
|
Movable: Graphie.Sinusoid,
|
|
25635
25591
|
getCoefficients: function (coords) {
|
|
@@ -25869,7 +25825,7 @@ const functionTypeMapping = {
|
|
|
25869
25825
|
const allTypes = _.keys(functionTypeMapping);
|
|
25870
25826
|
function functionForType(
|
|
25871
25827
|
// TODO(jeremy): Actually `$Keys<typeof functionTypeMapping>` but that
|
|
25872
|
-
// triggers
|
|
25828
|
+
// triggers TypeScript to require all of our Plot types to be fully typed which
|
|
25873
25829
|
// is a big amount of work/change.
|
|
25874
25830
|
type) {
|
|
25875
25831
|
return functionTypeMapping[type];
|
|
@@ -26113,10 +26069,8 @@ class FunctionGrapher extends React.Component {
|
|
|
26113
26069
|
});
|
|
26114
26070
|
},
|
|
26115
26071
|
constraints: [
|
|
26116
|
-
// $FlowFixMe[prop-missing]
|
|
26117
26072
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
26118
26073
|
Interactive2.MovableLine.constraints.bound(),
|
|
26119
|
-
// $FlowFixMe[prop-missing]
|
|
26120
26074
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
26121
26075
|
Interactive2.MovableLine.constraints.snap(), (newCoord, oldCoord) => {
|
|
26122
26076
|
// Calculate and apply proposed displacement
|
|
@@ -26150,10 +26104,8 @@ class FunctionGrapher extends React.Component {
|
|
|
26150
26104
|
coord: coord,
|
|
26151
26105
|
static: this.props.static,
|
|
26152
26106
|
constraints: [
|
|
26153
|
-
// $FlowFixMe[prop-missing]
|
|
26154
26107
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
26155
26108
|
Interactive2.MovablePoint.constraints.bound(),
|
|
26156
|
-
// $FlowFixMe[prop-missing]
|
|
26157
26109
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
26158
26110
|
Interactive2.MovablePoint.constraints.snap(), coord => {
|
|
26159
26111
|
// Always enforce that this is a function
|
|
@@ -26211,7 +26163,6 @@ class FunctionGrapher extends React.Component {
|
|
|
26211
26163
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'Element' is not assignable to type 'null'.
|
|
26212
26164
|
image =
|
|
26213
26165
|
/*#__PURE__*/
|
|
26214
|
-
// $FlowFixMe[prop-missing]: alt props is missing
|
|
26215
26166
|
// @ts-expect-error [FEI-5003] - TS2741 - Property 'alt' is missing in type '{ src: any; width: any; height: any; scale: number; }' but required in type 'Pick<Readonly<Props> & Readonly<{ children?: ReactNode; }>, "children" | "height" | "width" | "title" | "alt" | "trackInteraction" | "preloader" | "allowFullBleed" | "extraGraphie" | "overrideAriaHidden">'.
|
|
26216
26167
|
React.createElement(SvgImage, {
|
|
26217
26168
|
src: imageDescription.url,
|
|
@@ -27091,9 +27042,7 @@ class Interaction extends React.Component {
|
|
|
27091
27042
|
functions: this.state.functions
|
|
27092
27043
|
});
|
|
27093
27044
|
compiledVars[name] = function (x) {
|
|
27094
|
-
return func(
|
|
27095
|
-
// $FlowFixMe[extra-arg]
|
|
27096
|
-
_.extend({}, compiledVars, {
|
|
27045
|
+
return func(_.extend({}, compiledVars, {
|
|
27097
27046
|
x: x
|
|
27098
27047
|
}));
|
|
27099
27048
|
};
|
|
@@ -27804,7 +27753,6 @@ class Graph extends React.Component {
|
|
|
27804
27753
|
const scale = this.props.box[0] / interactiveSizes$1.defaultBoxSize;
|
|
27805
27754
|
image =
|
|
27806
27755
|
/*#__PURE__*/
|
|
27807
|
-
// $FlowFixMe[prop-missing]: `alt` is missing
|
|
27808
27756
|
// @ts-expect-error [FEI-5003] - TS2741 - Property 'alt' is missing in type '{ src: any; width: any; height: any; scale: number; responsive: false; }' but required in type 'Pick<Readonly<Props> & Readonly<{ children?: ReactNode; }>, "children" | "height" | "width" | "title" | "alt" | "trackInteraction" | "preloader" | "allowFullBleed" | "extraGraphie" | "overrideAriaHidden">'.
|
|
27809
27757
|
React.createElement(SvgImage, {
|
|
27810
27758
|
src: imageData.url,
|
|
@@ -27822,15 +27770,12 @@ class Graph extends React.Component {
|
|
|
27822
27770
|
width: this.props.box[0],
|
|
27823
27771
|
height: this.props.box[1]
|
|
27824
27772
|
}
|
|
27825
|
-
// $FlowFixMe[prop-missing]: This can probably be removed
|
|
27826
27773
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'onMouseOut' does not exist on type 'Graph'.
|
|
27827
27774
|
,
|
|
27828
27775
|
onMouseOut: this.onMouseOut
|
|
27829
|
-
// $FlowFixMe[prop-missing]: This can probably be removed
|
|
27830
27776
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'onMouseOver' does not exist on type 'Graph'.
|
|
27831
27777
|
,
|
|
27832
27778
|
onMouseOver: this.onMouseOver
|
|
27833
|
-
// $FlowFixMe[prop-missing]: This can probably be removed
|
|
27834
27779
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'onClick' does not exist on type 'Graph'.
|
|
27835
27780
|
,
|
|
27836
27781
|
onClick: this.onClick
|
|
@@ -28324,10 +28269,8 @@ class InteractiveGraph extends React.Component {
|
|
|
28324
28269
|
return Interactive2.addMaybeMobileMovablePoint(this, {
|
|
28325
28270
|
coord: coord,
|
|
28326
28271
|
constraints: [
|
|
28327
|
-
// $FlowFixMe[prop-missing]
|
|
28328
28272
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28329
28273
|
Interactive2.MovablePoint.constraints.bound(),
|
|
28330
|
-
// $FlowFixMe[prop-missing]
|
|
28331
28274
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28332
28275
|
Interactive2.MovablePoint.constraints.snap()],
|
|
28333
28276
|
onMove: () => {
|
|
@@ -28385,7 +28328,6 @@ class InteractiveGraph extends React.Component {
|
|
|
28385
28328
|
}
|
|
28386
28329
|
const onMoveHandler = () => {
|
|
28387
28330
|
const graph = _.extend({}, this.props.graph, {
|
|
28388
|
-
// $FlowFixMe[incompatible-use]
|
|
28389
28331
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'. | TS2531 - Object is possibly 'null'. | TS2531 - Object is possibly 'null'.
|
|
28390
28332
|
coords: [pointA.coord(), pointB.coord(), pointC.coord()]
|
|
28391
28333
|
});
|
|
@@ -28402,17 +28344,13 @@ class InteractiveGraph extends React.Component {
|
|
|
28402
28344
|
pointA = this.pointA = Interactive2.addMaybeMobileMovablePoint(this, {
|
|
28403
28345
|
coord: coords[0],
|
|
28404
28346
|
constraints: [
|
|
28405
|
-
// $FlowFixMe[prop-missing]
|
|
28406
28347
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28407
28348
|
Interactive2.MovablePoint.constraints.bound(),
|
|
28408
|
-
// $FlowFixMe[prop-missing]
|
|
28409
28349
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28410
28350
|
Interactive2.MovablePoint.constraints.snap(), coord => {
|
|
28411
28351
|
return !pointA ||
|
|
28412
|
-
// $FlowFixMe[incompatible-use]
|
|
28413
28352
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
|
|
28414
28353
|
coord[0] !== pointB.coord()[0] &&
|
|
28415
|
-
// $FlowFixMe[incompatible-use]
|
|
28416
28354
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
|
|
28417
28355
|
coord[0] !== pointC.coord()[0];
|
|
28418
28356
|
}],
|
|
@@ -28426,17 +28364,13 @@ class InteractiveGraph extends React.Component {
|
|
|
28426
28364
|
pointB = this.pointB = Interactive2.addMaybeMobileMovablePoint(this, {
|
|
28427
28365
|
coord: coords[1],
|
|
28428
28366
|
constraints: [
|
|
28429
|
-
// $FlowFixMe[prop-missing]
|
|
28430
28367
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28431
28368
|
Interactive2.MovablePoint.constraints.bound(),
|
|
28432
|
-
// $FlowFixMe[prop-missing]
|
|
28433
28369
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28434
28370
|
Interactive2.MovablePoint.constraints.snap(), coord => {
|
|
28435
28371
|
return !pointB ||
|
|
28436
|
-
// $FlowFixMe[incompatible-use]
|
|
28437
28372
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
|
|
28438
28373
|
coord[0] !== pointA.coord()[0] &&
|
|
28439
|
-
// $FlowFixMe[incompatible-use]
|
|
28440
28374
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
|
|
28441
28375
|
coord[0] !== pointC.coord()[0];
|
|
28442
28376
|
}],
|
|
@@ -28450,17 +28384,13 @@ class InteractiveGraph extends React.Component {
|
|
|
28450
28384
|
pointC = this.pointC = Interactive2.addMaybeMobileMovablePoint(this, {
|
|
28451
28385
|
coord: coords[2],
|
|
28452
28386
|
constraints: [
|
|
28453
|
-
// $FlowFixMe[prop-missing]
|
|
28454
28387
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28455
28388
|
Interactive2.MovablePoint.constraints.bound(),
|
|
28456
|
-
// $FlowFixMe[prop-missing]
|
|
28457
28389
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28458
28390
|
Interactive2.MovablePoint.constraints.snap(), coord => {
|
|
28459
28391
|
return !pointC ||
|
|
28460
|
-
// $FlowFixMe[incompatible-use]
|
|
28461
28392
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
|
|
28462
28393
|
coord[0] !== pointA.coord()[0] &&
|
|
28463
|
-
// $FlowFixMe[incompatible-use]
|
|
28464
28394
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
|
|
28465
28395
|
coord[0] !== pointB.coord()[0];
|
|
28466
28396
|
}],
|
|
@@ -28515,7 +28445,6 @@ class InteractiveGraph extends React.Component {
|
|
|
28515
28445
|
}
|
|
28516
28446
|
const onMoveHandler = () => {
|
|
28517
28447
|
const graph = _.extend({}, this.props.graph, {
|
|
28518
|
-
// $FlowFixMe[incompatible-use]
|
|
28519
28448
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
|
|
28520
28449
|
coords: [pointA.coord(), pointB.coord()]
|
|
28521
28450
|
});
|
|
@@ -28532,10 +28461,8 @@ class InteractiveGraph extends React.Component {
|
|
|
28532
28461
|
pointA = this.pointA = Interactive2.addMaybeMobileMovablePoint(this, {
|
|
28533
28462
|
coord: coords[0],
|
|
28534
28463
|
constraints: [
|
|
28535
|
-
// $FlowFixMe[prop-missing]
|
|
28536
28464
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28537
28465
|
Interactive2.MovablePoint.constraints.bound(),
|
|
28538
|
-
// $FlowFixMe[prop-missing]
|
|
28539
28466
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28540
28467
|
Interactive2.MovablePoint.constraints.snap(), coord => {
|
|
28541
28468
|
return !pointA || coord[0] !== pointB.coord()[0];
|
|
@@ -28545,10 +28472,8 @@ class InteractiveGraph extends React.Component {
|
|
|
28545
28472
|
const pointB = this.pointB = Interactive2.addMaybeMobileMovablePoint(this, {
|
|
28546
28473
|
coord: coords[1],
|
|
28547
28474
|
constraints: [
|
|
28548
|
-
// $FlowFixMe[prop-missing]
|
|
28549
28475
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28550
28476
|
Interactive2.MovablePoint.constraints.bound(),
|
|
28551
|
-
// $FlowFixMe[prop-missing]
|
|
28552
28477
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28553
28478
|
Interactive2.MovablePoint.constraints.snap(), coord => {
|
|
28554
28479
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'coord' does not exist on type 'never'.
|
|
@@ -28608,9 +28533,7 @@ class InteractiveGraph extends React.Component {
|
|
|
28608
28533
|
});
|
|
28609
28534
|
$(circle).on("move", () => {
|
|
28610
28535
|
const graph = _.extend({}, this.props.graph, {
|
|
28611
|
-
// $FlowFixMe[incompatible-use]
|
|
28612
28536
|
center: circle.center,
|
|
28613
|
-
// $FlowFixMe[incompatible-use]
|
|
28614
28537
|
radius: circle.radius
|
|
28615
28538
|
});
|
|
28616
28539
|
this.onChange({
|
|
@@ -28637,10 +28560,8 @@ class InteractiveGraph extends React.Component {
|
|
|
28637
28560
|
segmentPoints.push(Interactive2.addMaybeMobileMovablePoint(this, {
|
|
28638
28561
|
coord: coord,
|
|
28639
28562
|
constraints: [
|
|
28640
|
-
// $FlowFixMe[prop-missing]
|
|
28641
28563
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28642
28564
|
Interactive2.MovablePoint.constraints.bound(),
|
|
28643
|
-
// $FlowFixMe[prop-missing]
|
|
28644
28565
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28645
28566
|
Interactive2.MovablePoint.constraints.snap(), coord => {
|
|
28646
28567
|
const otherSegment = segmentPoints[1 - i];
|
|
@@ -28691,12 +28612,7 @@ class InteractiveGraph extends React.Component {
|
|
|
28691
28612
|
}
|
|
28692
28613
|
const graphie = this.graphie;
|
|
28693
28614
|
const screenPoint = graphie == null ? void 0 : graphie.scalePoint(coord);
|
|
28694
|
-
return
|
|
28695
|
-
// $FlowFixMe[incompatible-use]
|
|
28696
|
-
screenPoint[0] >= graphie.xpixels - 40 &&
|
|
28697
|
-
// $FlowFixMe[incompatible-use]
|
|
28698
|
-
screenPoint[1] >= graphie.ypixels - 40
|
|
28699
|
-
);
|
|
28615
|
+
return screenPoint[0] >= graphie.xpixels - 40 && screenPoint[1] >= graphie.ypixels - 40;
|
|
28700
28616
|
};
|
|
28701
28617
|
this.createPointForPointsType = (coord, i) => {
|
|
28702
28618
|
const self = this;
|
|
@@ -28723,10 +28639,8 @@ class InteractiveGraph extends React.Component {
|
|
|
28723
28639
|
point$1 = Interactive2.addMaybeMobileMovablePoint(this, _extends({
|
|
28724
28640
|
coord: coord,
|
|
28725
28641
|
constraints: [
|
|
28726
|
-
// $FlowFixMe[prop-missing]
|
|
28727
28642
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28728
28643
|
Interactive2.MovablePoint.constraints.bound(),
|
|
28729
|
-
// $FlowFixMe[prop-missing]
|
|
28730
28644
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28731
28645
|
Interactive2.MovablePoint.constraints.snap(), function (coord) {
|
|
28732
28646
|
// TODO(jack): There ought to be a
|
|
@@ -29013,10 +28927,8 @@ class InteractiveGraph extends React.Component {
|
|
|
29013
28927
|
const point$1 = Interactive2.addMaybeMobileMovablePoint(this, _extends({
|
|
29014
28928
|
coord: coord,
|
|
29015
28929
|
constraints: [
|
|
29016
|
-
// $FlowFixMe[prop-missing]
|
|
29017
28930
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
29018
28931
|
Interactive2.MovablePoint.constraints.bound(), snapToGrid ?
|
|
29019
|
-
// $FlowFixMe[prop-missing]
|
|
29020
28932
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
29021
28933
|
Interactive2.MovablePoint.constraints.snap() : null, graphConstraint],
|
|
29022
28934
|
onMoveStart: () => {
|
|
@@ -29111,10 +29023,8 @@ class InteractiveGraph extends React.Component {
|
|
|
29111
29023
|
points.push(createPoint({
|
|
29112
29024
|
coord: coord,
|
|
29113
29025
|
constraints: [
|
|
29114
|
-
// $FlowFixMe[prop-missing]
|
|
29115
29026
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
29116
29027
|
Interactive2.MovablePoint.constraints.bound(),
|
|
29117
|
-
// $FlowFixMe[prop-missing]
|
|
29118
29028
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
29119
29029
|
Interactive2.MovablePoint.constraints.snap(), coord => {
|
|
29120
29030
|
const otherPoint = points[1 - _i];
|
|
@@ -29136,14 +29046,11 @@ class InteractiveGraph extends React.Component {
|
|
|
29136
29046
|
points: points,
|
|
29137
29047
|
static: false,
|
|
29138
29048
|
constraints: [
|
|
29139
|
-
// $FlowFixMe[prop-missing]
|
|
29140
29049
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
29141
29050
|
Interactive2.MovableLine.constraints.bound(),
|
|
29142
|
-
// $FlowFixMe[prop-missing]
|
|
29143
29051
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
29144
29052
|
Interactive2.MovableLine.constraints.snap()],
|
|
29145
29053
|
onMove: [
|
|
29146
|
-
// $FlowFixMe[prop-missing]
|
|
29147
29054
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'onMove' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
29148
29055
|
Interactive2.MovableLine.onMove.updatePoints, updateCoordProps],
|
|
29149
29056
|
normalStyle: _extends({
|
|
@@ -29236,10 +29143,8 @@ class InteractiveGraph extends React.Component {
|
|
|
29236
29143
|
const self = this;
|
|
29237
29144
|
self.polygon = Interactive2.addMovablePolygon(graphie, {
|
|
29238
29145
|
constraints: [
|
|
29239
|
-
// $FlowFixMe[prop-missing]
|
|
29240
29146
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => undefined'.
|
|
29241
29147
|
Interactive2.MovablePolygon.constraints.bound(), snapToGrid ?
|
|
29242
|
-
// $FlowFixMe[prop-missing]
|
|
29243
29148
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => undefined'.
|
|
29244
29149
|
Interactive2.MovablePolygon.constraints.snap() : null],
|
|
29245
29150
|
closed: closed,
|
|
@@ -29249,7 +29154,6 @@ class InteractiveGraph extends React.Component {
|
|
|
29249
29154
|
numArcs: numArcs,
|
|
29250
29155
|
sideLabels: sideLabels,
|
|
29251
29156
|
onMove: [
|
|
29252
|
-
// $FlowFixMe[prop-missing]
|
|
29253
29157
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'onMove' does not exist on type '(graphie: any, movable: any, options: any) => undefined'.
|
|
29254
29158
|
Interactive2.MovablePolygon.onMove.updatePoints, function () {
|
|
29255
29159
|
// @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
@@ -29479,7 +29383,6 @@ class InteractiveGraph extends React.Component {
|
|
|
29479
29383
|
*/
|
|
29480
29384
|
static getLineCoords(graph, props) {
|
|
29481
29385
|
return (
|
|
29482
|
-
// $FlowFixMe[incompatible-return]
|
|
29483
29386
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'coords' does not exist on type 'PerseusGraphType'.
|
|
29484
29387
|
graph.coords || InteractiveGraph.pointsFromNormalized(props, [[0.25, 0.75], [0.75, 0.75]])
|
|
29485
29388
|
);
|
|
@@ -29534,7 +29437,6 @@ class InteractiveGraph extends React.Component {
|
|
|
29534
29437
|
static getLinearSystemCoords(graph, props) {
|
|
29535
29438
|
return (
|
|
29536
29439
|
// The callers assume that we're return an array of points
|
|
29537
|
-
// $FlowFixMe[incompatible-return]
|
|
29538
29440
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'coords' does not exist on type 'PerseusGraphType'.
|
|
29539
29441
|
graph.coords || _.map([[[0.25, 0.75], [0.75, 0.75]], [[0.25, 0.25], [0.75, 0.25]]], coords => {
|
|
29540
29442
|
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'number[][]' is not assignable to parameter of type 'readonly Coord[]'.
|
|
@@ -29590,17 +29492,11 @@ class InteractiveGraph extends React.Component {
|
|
|
29590
29492
|
const n = graph.numSegments || 1;
|
|
29591
29493
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'number[] | undefined' is not assignable to type 'readonly number[]'.
|
|
29592
29494
|
const ys = {
|
|
29593
|
-
// $FlowFixMe[unsupported-syntax]
|
|
29594
29495
|
1: [5],
|
|
29595
|
-
// $FlowFixMe[unsupported-syntax]
|
|
29596
29496
|
2: [5, -5],
|
|
29597
|
-
// $FlowFixMe[unsupported-syntax]
|
|
29598
29497
|
3: [5, 0, -5],
|
|
29599
|
-
// $FlowFixMe[unsupported-syntax]
|
|
29600
29498
|
4: [6, 2, -2, -6],
|
|
29601
|
-
// $FlowFixMe[unsupported-syntax]
|
|
29602
29499
|
5: [6, 3, 0, -3, -6],
|
|
29603
|
-
// $FlowFixMe[unsupported-syntax]
|
|
29604
29500
|
6: [5, 3, 1, -1, -3, -5]
|
|
29605
29501
|
}[n];
|
|
29606
29502
|
const range = [[-10, 10], [-10, 10]];
|
|
@@ -29804,7 +29700,6 @@ class InteractiveGraph extends React.Component {
|
|
|
29804
29700
|
// If both of the guess points are on the correct line, it's
|
|
29805
29701
|
// correct.
|
|
29806
29702
|
if (
|
|
29807
|
-
// $FlowFixMe[incompatible-use] - Fix type so coords can't be omitted
|
|
29808
29703
|
// @ts-expect-error [FEI-5003] - TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'.
|
|
29809
29704
|
collinear(correct[0], correct[1], guess[0]) &&
|
|
29810
29705
|
// @ts-expect-error [FEI-5003] - TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'.
|
|
@@ -29831,8 +29726,6 @@ class InteractiveGraph extends React.Component {
|
|
|
29831
29726
|
// If the parabola coefficients match, it's correct.
|
|
29832
29727
|
const guessCoeffs = this.getQuadraticCoefficients(state.coords);
|
|
29833
29728
|
const correctCoeffs = this.getQuadraticCoefficients(
|
|
29834
|
-
// $FlowFixMe[incompatible-call]
|
|
29835
|
-
// $FlowFixMe[prop-missing]
|
|
29836
29729
|
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'readonly Coord[] | undefined' is not assignable to parameter of type 'readonly Coord[]'.
|
|
29837
29730
|
rubric.correct.coords);
|
|
29838
29731
|
if (deepEq$2(guessCoeffs, correctCoeffs)) {
|
|
@@ -29846,8 +29739,6 @@ class InteractiveGraph extends React.Component {
|
|
|
29846
29739
|
} else if (state.type === "sinusoid" && rubric.correct.type === "sinusoid" && state.coords != null) {
|
|
29847
29740
|
const guessCoeffs = this.getSinusoidCoefficients(state.coords);
|
|
29848
29741
|
const correctCoeffs = this.getSinusoidCoefficients(
|
|
29849
|
-
// $FlowFixMe[incompatible-call]
|
|
29850
|
-
// $FlowFixMe[prop-missing]
|
|
29851
29742
|
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'readonly Coord[] | undefined' is not assignable to parameter of type 'readonly Coord[]'.
|
|
29852
29743
|
rubric.correct.coords);
|
|
29853
29744
|
const canonicalGuessCoeffs = canonicalSineCoefficients(guessCoeffs);
|
|
@@ -29862,9 +29753,7 @@ class InteractiveGraph extends React.Component {
|
|
|
29862
29753
|
};
|
|
29863
29754
|
}
|
|
29864
29755
|
} else if (state.type === "circle" && rubric.correct.type === "circle") {
|
|
29865
|
-
if (deepEq$2(state.center, rubric.correct.center) &&
|
|
29866
|
-
// $FlowFixMe[prop-missing]
|
|
29867
|
-
eq(state.radius, rubric.correct.radius)) {
|
|
29756
|
+
if (deepEq$2(state.center, rubric.correct.center) && eq(state.radius, rubric.correct.radius)) {
|
|
29868
29757
|
return {
|
|
29869
29758
|
type: "points",
|
|
29870
29759
|
earned: 1,
|
|
@@ -29937,10 +29826,8 @@ class InteractiveGraph extends React.Component {
|
|
|
29937
29826
|
const guess = state.coords;
|
|
29938
29827
|
const correct = rubric.correct.coords;
|
|
29939
29828
|
if (
|
|
29940
|
-
// $FlowFixMe[incompatible-use]
|
|
29941
29829
|
// @ts-expect-error [FEI-5003] - TS2532 - Object is possibly 'undefined'.
|
|
29942
29830
|
deepEq$2(guess[0], correct[0]) &&
|
|
29943
|
-
// $FlowFixMe[incompatible-use]
|
|
29944
29831
|
// @ts-expect-error [FEI-5003] - TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'.
|
|
29945
29832
|
collinear(correct[0], correct[1], guess[1])) {
|
|
29946
29833
|
return {
|
|
@@ -29970,13 +29857,10 @@ class InteractiveGraph extends React.Component {
|
|
|
29970
29857
|
} else {
|
|
29971
29858
|
/* exact */
|
|
29972
29859
|
match =
|
|
29973
|
-
// $FlowFixMe[incompatible-use]
|
|
29974
29860
|
// @ts-expect-error [FEI-5003] - TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'.
|
|
29975
29861
|
deepEq$2(guess[1], correct[1]) &&
|
|
29976
|
-
// $FlowFixMe[incompatible-use]
|
|
29977
29862
|
// @ts-expect-error [FEI-5003] - TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'.
|
|
29978
29863
|
collinear(correct[1], correct[0], guess[0]) &&
|
|
29979
|
-
// $FlowFixMe[incompatible-use]
|
|
29980
29864
|
// @ts-expect-error [FEI-5003] - TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'.
|
|
29981
29865
|
collinear(correct[1], correct[2], guess[2]);
|
|
29982
29866
|
}
|
|
@@ -30015,7 +29899,6 @@ InteractiveGraph.defaultProps = {
|
|
|
30015
29899
|
labels: ["x", "y"],
|
|
30016
29900
|
range: [[-10, 10], [-10, 10]],
|
|
30017
29901
|
step: [1, 1],
|
|
30018
|
-
// $FlowFixMe[prop-missing]
|
|
30019
29902
|
// @ts-expect-error [FEI-5003] - TS2739 - Type '{ readonly url: null; }' is missing the following properties from type 'PerseusImageBackground': width, height
|
|
30020
29903
|
backgroundImage: defaultBackgroundImage$1,
|
|
30021
29904
|
markings: "graph",
|
|
@@ -31697,7 +31580,7 @@ class LabelImage extends React.Component {
|
|
|
31697
31580
|
this.handleDocumentClick = e => {
|
|
31698
31581
|
// Dismiss open popup with answer choices if user clicks outside it.
|
|
31699
31582
|
if (this._selectedMarkerPopup && this._answerChoices) {
|
|
31700
|
-
const answerChoices =
|
|
31583
|
+
const answerChoices = ReactDOM.findDOMNode(this._answerChoices);
|
|
31701
31584
|
const targetElement = e.target;
|
|
31702
31585
|
// HACK(michaelpolyak): We want to determine if the click target is
|
|
31703
31586
|
// contained within the popup layer. As there's no public interface
|
|
@@ -31788,7 +31671,7 @@ class LabelImage extends React.Component {
|
|
|
31788
31671
|
// Set focus on the just-deselected-marker, to enable to resume
|
|
31789
31672
|
// navigating between the markers using the keyboard.
|
|
31790
31673
|
if (marker) {
|
|
31791
|
-
|
|
31674
|
+
ReactDOM.findDOMNode(marker).focus();
|
|
31792
31675
|
}
|
|
31793
31676
|
});
|
|
31794
31677
|
}
|
|
@@ -31878,7 +31761,7 @@ class LabelImage extends React.Component {
|
|
|
31878
31761
|
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type '{ x: number; y: number; } | { x: number; y: number; } | { x: number; y: number; } | { x: number; y: number; }' is not assignable to parameter of type 'Direction'.
|
|
31879
31762
|
navigateDirection, markers, index)];
|
|
31880
31763
|
if (marker) {
|
|
31881
|
-
|
|
31764
|
+
ReactDOM.findDOMNode(marker).focus();
|
|
31882
31765
|
}
|
|
31883
31766
|
}
|
|
31884
31767
|
handleAnswerChoicesChangeForMarker(index, selection) {
|
|
@@ -33327,8 +33210,6 @@ class NumberInput extends React.Component {
|
|
|
33327
33210
|
};
|
|
33328
33211
|
this.getValue = () => {
|
|
33329
33212
|
return this.parseInputValue(
|
|
33330
|
-
// $FlowFixMe[incompatible-use]
|
|
33331
|
-
// $FlowFixMe[prop-missing]
|
|
33332
33213
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'. | TS2339 - Property 'value' does not exist on type 'Element | Text'.
|
|
33333
33214
|
ReactDOM__default.findDOMNode(this.refs.input).value // eslint-disable-line react/no-string-refs
|
|
33334
33215
|
);
|
|
@@ -35141,14 +35022,10 @@ const TickMarks = Graphie.createSimpleClass((graphie, props) => {
|
|
|
35141
35022
|
// Render the text labels
|
|
35142
35023
|
results.push(graphie.style(props.isMobile ? {
|
|
35143
35024
|
color: KhanColors.BLUE_D
|
|
35144
|
-
} : {},
|
|
35145
|
-
// $FlowFixMe[incompatible-call]
|
|
35146
|
-
() => _label(graphie, props.labelStyle, leftLabel, leftLabel, base)));
|
|
35025
|
+
} : {}, () => _label(graphie, props.labelStyle, leftLabel, leftLabel, base)));
|
|
35147
35026
|
results.push(graphie.style(props.isMobile ? {
|
|
35148
35027
|
color: KhanColors.BLUE_D
|
|
35149
|
-
} : {}, () =>
|
|
35150
|
-
// $FlowFixMe[incompatible-call]
|
|
35151
|
-
_label(graphie, props.labelStyle, rightLabel, rightLabel, base)));
|
|
35028
|
+
} : {}, () => _label(graphie, props.labelStyle, rightLabel, rightLabel, base)));
|
|
35152
35029
|
|
|
35153
35030
|
// Render the labels' lines
|
|
35154
35031
|
graphie.style({
|
|
@@ -35830,10 +35707,7 @@ class Orderer extends React.Component {
|
|
|
35830
35707
|
current: list,
|
|
35831
35708
|
dragging: true,
|
|
35832
35709
|
placeholderIndex: placeholderIndex,
|
|
35833
|
-
// $FlowFixMe[prop-missing]
|
|
35834
|
-
// $FlowFixMe[incompatible-use]
|
|
35835
35710
|
dragKey: opt.key,
|
|
35836
|
-
// $FlowFixMe[incompatible-use]
|
|
35837
35711
|
dragContent: opt.content,
|
|
35838
35712
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'width' does not exist on type 'JQueryStatic'.
|
|
35839
35713
|
dragWidth: $draggable.width(),
|
|
@@ -37169,7 +37043,7 @@ class SelectionTracker extends React.PureComponent {
|
|
|
37169
37043
|
}
|
|
37170
37044
|
|
|
37171
37045
|
// NOTE(mdr): The focus node is guaranteed to exist, because
|
|
37172
|
-
// there's a range, but the
|
|
37046
|
+
// there's a range, but the type annotations for
|
|
37173
37047
|
// Selection don't know that. Cast it ourselves.
|
|
37174
37048
|
const focusNode = selection.focusNode;
|
|
37175
37049
|
const focusOffset = selection.focusOffset;
|
|
@@ -37291,23 +37165,8 @@ class HighlightingUI extends React.PureComponent {
|
|
|
37291
37165
|
zIndexes: this.props.zIndexes
|
|
37292
37166
|
}), this._selectionIsValid(trackedSelection) && !userIsMouseSelecting && /*#__PURE__*/React.createElement(HighlightTooltip, {
|
|
37293
37167
|
label: i18n._("Add highlight"),
|
|
37294
|
-
onClick: () => this._handleAddHighlight(
|
|
37295
|
-
|
|
37296
|
-
// "proposedHighlight (Cannot get `trackedSelection.proposedHighlight` because property `proposedHighlight` is missing in null or undefined [1].)"
|
|
37297
|
-
// $FlowFixMe[incompatible-use](0.57.3->0.75.0)
|
|
37298
|
-
// @ts-expect-error [FEI-5003] - TS2533 - Object is possibly 'null' or 'undefined'.
|
|
37299
|
-
trackedSelection.proposedHighlight)
|
|
37300
|
-
// TODO(mdr): We found a new Flow error when upgrading:
|
|
37301
|
-
// "focusNode (Cannot get `trackedSelection.focusNode` because property `focusNode` is missing in null or undefined [1].)"
|
|
37302
|
-
// $FlowFixMe[incompatible-use](0.57.3->0.75.0)
|
|
37303
|
-
// @ts-expect-error [FEI-5003] - TS2533 - Object is possibly 'null' or 'undefined'.
|
|
37304
|
-
,
|
|
37305
|
-
focusNode: trackedSelection.focusNode
|
|
37306
|
-
// TODO(mdr): We found a new Flow error when upgrading:
|
|
37307
|
-
// "focusOffset (Cannot get `trackedSelection.focusOffset` because property `focusOffset` is missing in null or undefined [1].)"
|
|
37308
|
-
// $FlowFixMe[incompatible-use](0.57.3->0.75.0)
|
|
37309
|
-
// @ts-expect-error [FEI-5003] - TS2533 - Object is possibly 'null' or 'undefined'.
|
|
37310
|
-
,
|
|
37168
|
+
onClick: () => this._handleAddHighlight(trackedSelection.proposedHighlight),
|
|
37169
|
+
focusNode: trackedSelection.focusNode,
|
|
37311
37170
|
focusOffset: trackedSelection.focusOffset,
|
|
37312
37171
|
offsetParent: this.props.offsetParent
|
|
37313
37172
|
})));
|
|
@@ -37394,11 +37253,7 @@ class WordIndexer extends React.PureComponent {
|
|
|
37394
37253
|
let newTrailingWordRange = null;
|
|
37395
37254
|
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'string | null' is not assignable to parameter of type 'string'.
|
|
37396
37255
|
while ((wordMatch = wordPattern.exec(text)) !== null) {
|
|
37397
|
-
// TODO(mdr): We found a new Flow error when upgrading:
|
|
37398
|
-
// "index (Cannot get `wordMatch.index` because property `index` is missing in null [1].)"
|
|
37399
37256
|
const startOffset = wordMatch.index;
|
|
37400
|
-
// TODO(mdr): We found a new Flow error when upgrading:
|
|
37401
|
-
// "index (Cannot get `wordMatch.index` because property `index` is missing in null [1].)", "0 (Cannot get `wordMatch[0]` because an indexer property is missing in null [1].)"
|
|
37402
37257
|
const endOffset = wordMatch.index + wordMatch[0].length;
|
|
37403
37258
|
let range;
|
|
37404
37259
|
if (startOffset === 0 && trailingWordRange) {
|
|
@@ -37680,7 +37535,7 @@ const rules = {
|
|
|
37680
37535
|
|
|
37681
37536
|
// A "magic" capture that matches the opening {{
|
|
37682
37537
|
// but captures the full ref text internally :D
|
|
37683
|
-
// unfortunately the "magic" makes
|
|
37538
|
+
// unfortunately the "magic" makes TypeScript upset,
|
|
37684
37539
|
// so there's this questionable workaround
|
|
37685
37540
|
capture[1] = source.slice(2, closeIndex);
|
|
37686
37541
|
return capture;
|
|
@@ -38057,7 +37912,7 @@ class Passage extends React.Component {
|
|
|
38057
37912
|
});
|
|
38058
37913
|
}
|
|
38059
37914
|
_measureLines() {
|
|
38060
|
-
const renderer =
|
|
37915
|
+
const renderer = ReactDOM.findDOMNode(this._contentRef);
|
|
38061
37916
|
// @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call. | TS2339 - Property 'height' does not exist on type 'JQueryStatic'.
|
|
38062
37917
|
const contentsHeight = $(renderer).height();
|
|
38063
37918
|
const lineHeight = this._getLineHeight();
|
|
@@ -38111,7 +37966,7 @@ class Passage extends React.Component {
|
|
|
38111
37966
|
}
|
|
38112
37967
|
|
|
38113
37968
|
// @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call.
|
|
38114
|
-
const $ref = $(
|
|
37969
|
+
const $ref = $(ReactDOM.findDOMNode(ref));
|
|
38115
37970
|
// We really care about the first text after the ref, not the
|
|
38116
37971
|
// ref element itself:
|
|
38117
37972
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'next' does not exist on type 'JQueryStatic'.
|
|
@@ -38132,7 +37987,7 @@ class Passage extends React.Component {
|
|
|
38132
37987
|
}
|
|
38133
37988
|
|
|
38134
37989
|
// @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call.
|
|
38135
|
-
const $ref = $(
|
|
37990
|
+
const $ref = $(ReactDOM.findDOMNode(ref));
|
|
38136
37991
|
// We really care about the last text before the ref, not the
|
|
38137
37992
|
// ref element itself:
|
|
38138
37993
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'prev' does not exist on type 'JQueryStatic'.
|
|
@@ -38157,7 +38012,7 @@ class Passage extends React.Component {
|
|
|
38157
38012
|
return this.state.startLineNumbersAfter + line;
|
|
38158
38013
|
}
|
|
38159
38014
|
_convertPosToLineNumber(absoluteVPos) {
|
|
38160
|
-
const content =
|
|
38015
|
+
const content = ReactDOM.findDOMNode(this._contentRef);
|
|
38161
38016
|
// @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call. | TS2339 - Property 'offset' does not exist on type 'JQueryStatic'.
|
|
38162
38017
|
const relativeVPos = absoluteVPos - $(content).offset().top;
|
|
38163
38018
|
const lineHeight = this._getLineHeight();
|
|
@@ -38380,18 +38235,14 @@ class PassageRefTarget extends React.Component {
|
|
|
38380
38235
|
};
|
|
38381
38236
|
}
|
|
38382
38237
|
render() {
|
|
38383
|
-
return (
|
|
38384
|
-
|
|
38385
|
-
//
|
|
38386
|
-
|
|
38387
|
-
|
|
38388
|
-
|
|
38389
|
-
|
|
38390
|
-
|
|
38391
|
-
apiOptions: this.props.apiOptions,
|
|
38392
|
-
linterContext: this.props.linterContext
|
|
38393
|
-
})
|
|
38394
|
-
);
|
|
38238
|
+
return /*#__PURE__*/React.createElement(Renderer, {
|
|
38239
|
+
content: this.props.content
|
|
38240
|
+
// @ts-expect-error [FEI-5003] - TS2322 - Type '{ content: any; inline: boolean; apiOptions: any; linterContext: any; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Renderer> & Pick<Readonly<Props> & Readonly<{ children?: ReactNode; }>, "children" | ... 3 more ... | "legacyPerseusLint"> & InexactPartial<...> & InexactPartial<...>'.
|
|
38241
|
+
,
|
|
38242
|
+
inline: true,
|
|
38243
|
+
apiOptions: this.props.apiOptions,
|
|
38244
|
+
linterContext: this.props.linterContext
|
|
38245
|
+
});
|
|
38395
38246
|
}
|
|
38396
38247
|
}
|
|
38397
38248
|
PassageRefTarget.propTypes = _extends({}, propTypes, {
|
|
@@ -38983,7 +38834,6 @@ class Plotter extends React.Component {
|
|
|
38983
38834
|
if (i > 0) {
|
|
38984
38835
|
c.graph.lines[i] = Interactive2.addMovableLine(graphie, {
|
|
38985
38836
|
points: [c.graph.points[i - 1], c.graph.points[i]],
|
|
38986
|
-
// $FlowFixMe[prop-missing]
|
|
38987
38837
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
38988
38838
|
constraints: Interactive2.MovablePoint.constraints.fixed(),
|
|
38989
38839
|
normalStyle: {
|
|
@@ -41715,9 +41565,7 @@ const ShapeTypes = {
|
|
|
41715
41565
|
fixed: !options.translatable && !options.editable
|
|
41716
41566
|
},
|
|
41717
41567
|
visible: options.showPoints,
|
|
41718
|
-
// $FlowFixMe[prop-missing]
|
|
41719
41568
|
snapX: options.snap && options.snap[0] || 0,
|
|
41720
|
-
// $FlowFixMe[prop-missing]
|
|
41721
41569
|
snapY: options.snap && options.snap[1] || 0,
|
|
41722
41570
|
bounded: false,
|
|
41723
41571
|
// Don't bound it when placing it on the graph
|
|
@@ -42289,7 +42137,6 @@ class Transformer extends React.Component {
|
|
|
42289
42137
|
transform = {
|
|
42290
42138
|
type: "translation",
|
|
42291
42139
|
// NOTE(kevib): these should be numbers
|
|
42292
|
-
// $FlowFixMe[incompatible-type]
|
|
42293
42140
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'null' is not assignable to type 'number'. | TS2322 - Type 'null' is not assignable to type 'number'.
|
|
42294
42141
|
vector: [null, null]
|
|
42295
42142
|
};
|
|
@@ -42298,11 +42145,9 @@ class Transformer extends React.Component {
|
|
|
42298
42145
|
transform = {
|
|
42299
42146
|
type: "rotation",
|
|
42300
42147
|
// NOTE(kevib): these should be numbers
|
|
42301
|
-
// $FlowFixMe[incompatible-type]
|
|
42302
42148
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'null' is not assignable to type 'number'. | TS2322 - Type 'null' is not assignable to type 'number'.
|
|
42303
42149
|
center: [null, null],
|
|
42304
42150
|
// NOTE(kevib): this should be a number
|
|
42305
|
-
// $FlowFixMe[incompatible-type]
|
|
42306
42151
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'null' is not assignable to type 'number'.
|
|
42307
42152
|
angleDeg: null
|
|
42308
42153
|
};
|
|
@@ -42313,11 +42158,9 @@ class Transformer extends React.Component {
|
|
|
42313
42158
|
type: "reflection",
|
|
42314
42159
|
line: [
|
|
42315
42160
|
// NOTE(kevib): these should be numbers
|
|
42316
|
-
// $FlowFixMe[incompatible-type]
|
|
42317
42161
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'null' is not assignable to type 'number'. | TS2322 - Type 'null' is not assignable to type 'number'.
|
|
42318
42162
|
[null, null],
|
|
42319
42163
|
// NOTE(kevib): these should be numbers
|
|
42320
|
-
// $FlowFixMe[incompatible-type]
|
|
42321
42164
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'null' is not assignable to type 'number'. | TS2322 - Type 'null' is not assignable to type 'number'.
|
|
42322
42165
|
[null, null]]
|
|
42323
42166
|
};
|
|
@@ -42326,11 +42169,9 @@ class Transformer extends React.Component {
|
|
|
42326
42169
|
transform = {
|
|
42327
42170
|
type: "dilation",
|
|
42328
42171
|
// NOTE(kevib): these should be numbers
|
|
42329
|
-
// $FlowFixMe[incompatible-type]
|
|
42330
42172
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'null' is not assignable to type 'number'. | TS2322 - Type 'null' is not assignable to type 'number'.
|
|
42331
42173
|
center: [null, null],
|
|
42332
42174
|
// NOTE(kevib): this should be a number
|
|
42333
|
-
// $FlowFixMe[incompatible-type]
|
|
42334
42175
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'null' is not assignable to type 'number'.
|
|
42335
42176
|
scale: null
|
|
42336
42177
|
};
|
|
@@ -42503,7 +42344,6 @@ class Transformer extends React.Component {
|
|
|
42503
42344
|
if (reflectRotateHandle) {
|
|
42504
42345
|
$(reflectRotateHandle).on("move", function () {
|
|
42505
42346
|
const rotateHandleApprox = self.snapCoord(
|
|
42506
|
-
// $FlowFixMe[incompatible-use]
|
|
42507
42347
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
|
|
42508
42348
|
reflectRotateHandle.coord);
|
|
42509
42349
|
const rotateVector = vector$1.subtract(rotateHandleApprox, reflectButton.coord);
|
|
@@ -42571,9 +42411,7 @@ class Transformer extends React.Component {
|
|
|
42571
42411
|
width: this.scaleToCurrentRange(0.24),
|
|
42572
42412
|
hoverWidth: this.scaleToCurrentRange(0.4),
|
|
42573
42413
|
onMove: function (newAngle, oldAngle) {
|
|
42574
|
-
const transform = self.getRotationTransformFromAngle(
|
|
42575
|
-
// $FlowFixMe[incompatible-use]
|
|
42576
|
-
self.rotatePoint.coord, newAngle - oldAngle);
|
|
42414
|
+
const transform = self.getRotationTransformFromAngle(self.rotatePoint.coord, newAngle - oldAngle);
|
|
42577
42415
|
|
|
42578
42416
|
// Rotate polygon with rotateHandle
|
|
42579
42417
|
self.doTransform(transform);
|
|
@@ -42622,9 +42460,7 @@ class Transformer extends React.Component {
|
|
|
42622
42460
|
self.doTransform({
|
|
42623
42461
|
type: "dilation",
|
|
42624
42462
|
// NOTE(kevinb): It's hard to convince that this.dilationCircle
|
|
42625
|
-
// will still be defined here.
|
|
42626
|
-
// $FlowFixMe[incompatible-use]
|
|
42627
|
-
center: self.dilationCircle.centerPoint.coord,
|
|
42463
|
+
// will still be defined here. center: self.dilationCircle.centerPoint.coord,
|
|
42628
42464
|
scale: newRadius / oldRadius
|
|
42629
42465
|
});
|
|
42630
42466
|
},
|
|
@@ -42660,7 +42496,6 @@ class Transformer extends React.Component {
|
|
|
42660
42496
|
origOnMoveEnd(args);
|
|
42661
42497
|
}
|
|
42662
42498
|
self.changeTool("dilation", {
|
|
42663
|
-
// $FlowFixMe[incompatible-use]
|
|
42664
42499
|
coord: self.dilationCircle.centerPoint.coord
|
|
42665
42500
|
});
|
|
42666
42501
|
};
|
|
@@ -42780,7 +42615,6 @@ class Transformer extends React.Component {
|
|
|
42780
42615
|
// handle coordinates in formal mode without movement, since
|
|
42781
42616
|
// the movablepoints never move
|
|
42782
42617
|
shape: {
|
|
42783
|
-
// $FlowFixMe[incompatible-use]
|
|
42784
42618
|
type: this.shape.type,
|
|
42785
42619
|
coords: this.getCoords(),
|
|
42786
42620
|
options: (_this$shape5 = this.shape) == null ? void 0 : _this$shape5.getOptions()
|
|
@@ -44716,7 +44550,7 @@ class HintsRenderer extends React.Component {
|
|
|
44716
44550
|
this._cacheHintImages();
|
|
44717
44551
|
}
|
|
44718
44552
|
|
|
44719
|
-
// Force number to make
|
|
44553
|
+
// Force number to make TypeScript happy
|
|
44720
44554
|
const prevHintsVisible = prevProps.hintsVisible || 0;
|
|
44721
44555
|
const nextHintsVisible = this.props.hintsVisible || 0;
|
|
44722
44556
|
|
|
@@ -44972,13 +44806,7 @@ class ItemRenderer extends React.Component {
|
|
|
44972
44806
|
// that have completely different places in the DOM, we have to do this
|
|
44973
44807
|
// strangeness instead of relying on React's normal render() method.
|
|
44974
44808
|
// TODO(alpert): Figure out how to clean this up somehow
|
|
44975
|
-
render(
|
|
44976
|
-
/*#__PURE__*/
|
|
44977
|
-
// metadata (from item.question, aka PerseusRenderer)
|
|
44978
|
-
// replace (also item.question, aka PerseusRenderer)
|
|
44979
|
-
// savedState (I _think_ this is serializedState on Renderer)
|
|
44980
|
-
// $FlowFixMe[prop-missing] metadata, replace, savedState (see above)
|
|
44981
|
-
React.createElement(Renderer, _extends({
|
|
44809
|
+
render( /*#__PURE__*/React.createElement(Renderer, _extends({
|
|
44982
44810
|
ref: node => {
|
|
44983
44811
|
if (!node) {
|
|
44984
44812
|
return;
|
|
@@ -45063,9 +44891,7 @@ class ItemRenderer extends React.Component {
|
|
|
45063
44891
|
return Util.inputPathsEqual(inputPath, this._currentFocus);
|
|
45064
44892
|
});
|
|
45065
44893
|
if (this.props.apiOptions.onFocusChange != null) {
|
|
45066
|
-
this.props.apiOptions.onFocusChange(this._currentFocus, prevFocus,
|
|
45067
|
-
// $FlowFixMe[incompatible-call]: onFocusChange expects an HTMLElement or nothing
|
|
45068
|
-
didFocusInput && keypadElement && keypadElement.getDOMNode());
|
|
44894
|
+
this.props.apiOptions.onFocusChange(this._currentFocus, prevFocus, didFocusInput && keypadElement && keypadElement.getDOMNode());
|
|
45069
44895
|
}
|
|
45070
44896
|
if (keypadElement) {
|
|
45071
44897
|
if (didFocusInput) {
|
|
@@ -45370,14 +45196,9 @@ class ServerItemRenderer extends React.Component {
|
|
|
45370
45196
|
return Util.inputPathsEqual(inputPath, this._currentFocus);
|
|
45371
45197
|
});
|
|
45372
45198
|
if (onFocusChange != null) {
|
|
45373
|
-
onFocusChange(this._currentFocus, prevFocus,
|
|
45374
|
-
// $FlowFixMe[incompatible-call]: onFocusChange expects an HTMLElement or nothing
|
|
45375
|
-
didFocusInput && keypadElement && keypadElement.getDOMNode(),
|
|
45376
|
-
// $FlowFixMe[incompatible-call]: onFocusChange expects an HTMLElement or nothing
|
|
45199
|
+
onFocusChange(this._currentFocus, prevFocus, didFocusInput && keypadElement && keypadElement.getDOMNode(),
|
|
45377
45200
|
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'false | Element | Text | null | undefined' is not assignable to parameter of type 'HTMLElement | undefined'.
|
|
45378
|
-
didFocusInput &&
|
|
45379
|
-
// $FlowFixMe[incompatible-call]: onFocusChange expects an HTMLElement or nothing
|
|
45380
|
-
this.questionRenderer.getDOMNodeForPath(newFocus));
|
|
45201
|
+
didFocusInput && this.questionRenderer.getDOMNodeForPath(newFocus));
|
|
45381
45202
|
}
|
|
45382
45203
|
if (keypadElement && isMobile) {
|
|
45383
45204
|
if (didFocusInput) {
|
|
@@ -46660,7 +46481,7 @@ class MultiRenderer extends React.Component {
|
|
|
46660
46481
|
// were to change every render, it would cause the Renderer to
|
|
46661
46482
|
// re-render a lot more than is necessary. Don't re-compute this
|
|
46662
46483
|
// element unless it is necessary!
|
|
46663
|
-
// HACK(mdr):
|
|
46484
|
+
// HACK(mdr): TypeScript can't prove that this is a ContentRendererData,
|
|
46664
46485
|
// because of how we awkwardly construct it in order to obtain a
|
|
46665
46486
|
// circular reference. But it is, I promise.
|
|
46666
46487
|
const data = {
|
|
@@ -46680,7 +46501,6 @@ class MultiRenderer extends React.Component {
|
|
|
46680
46501
|
* one to one could introduce a bug. Need to work out the exact
|
|
46681
46502
|
* type for ContentNode and then fix this.
|
|
46682
46503
|
*/
|
|
46683
|
-
// $FlowFixMe[cannot-spread-inexact]
|
|
46684
46504
|
// @ts-expect-error [FEI-5003] - TS2322 - Type '{ ref: (e: any) => any; findExternalWidgets: (criterion: any) => readonly (Widget | null | undefined)[]; serializedState: any; onSerializedStateUpdated: (state: any) => void; __type: "content" | "item"; ... 9 more ...; reviewMode?: boolean | ... 1 more ... | undefined; }' is not assignable to type 'InexactPartial<Pick<Readonly<Props> & Readonly<{ children?: ReactNode; }>, "content" | "images" | "onRender" | "linterContext" | "widgets" | "alwaysUpdate" | ... 6 more ... | "serializedState">>'.
|
|
46685
46505
|
React.createElement(Renderer, _extends({}, this._getRendererProps(), content, {
|
|
46686
46506
|
ref: refFunc,
|
|
@@ -46924,7 +46744,7 @@ const styles = StyleSheet.create({
|
|
|
46924
46744
|
* Utility functions to build React PropTypes for multi-items and shapes.
|
|
46925
46745
|
*
|
|
46926
46746
|
* If you're writing new components, though, consider using the Item and Shape
|
|
46927
|
-
*
|
|
46747
|
+
* types instead.
|
|
46928
46748
|
*/
|
|
46929
46749
|
|
|
46930
46750
|
/**
|