@khanacademy/perseus 4.0.1 → 4.0.2
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 +11 -0
- package/dist/components/highlighting/ui/highlighting-ui.d.ts +1 -1
- package/dist/es/index.js +46 -223
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +46 -223
- 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/widgets/__stories__/test-keypad-context-wrapper.d.ts +6 -0
- package/dist/widgets/__stories__/test-keypad-context-wrapper.js.flow +14 -0
- package/package.json +4 -4
- 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/fixed-to-responsive.tsx +0 -1
- package/src/components/graph.tsx +0 -4
- package/src/components/highlighting/ui/highlighting-ui.tsx +3 -13
- package/src/components/highlighting/ui/selection-tracker.tsx +1 -1
- package/src/components/highlighting/word-indexer.tsx +0 -4
- package/src/components/math-input.tsx +0 -2
- package/src/components/number-input.tsx +0 -2
- package/src/components/text-list-editor.tsx +0 -4
- package/src/components/zoomable-tex.tsx +0 -2
- package/src/components/zoomable.tsx +0 -4
- package/src/definition-context.tsx +0 -1
- 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 +0 -4
- package/src/multi-items/__tests__/items.test.ts +3 -13
- package/src/multi-items/__tests__/multi-renderer.test.tsx +1 -1
- 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 -1
- package/src/renderer.tsx +2 -5
- package/src/server-item-renderer.tsx +0 -3
- package/src/util/interactive.ts +0 -4
- package/src/util/math.ts +0 -3
- package/src/widgets/__stories__/expression.stories.tsx +113 -7
- package/src/widgets/__stories__/image.stories.tsx +1 -1
- package/src/widgets/__stories__/{on-screen-keypad.stories.tsx → test-keypad-context-wrapper.tsx} +17 -57
- package/src/widgets/__testdata__/expression.testdata.ts +16 -12
- package/src/widgets/__testdata__/numeric-input.testdata.ts +0 -1
- package/src/widgets/__testdata__/transformer.testdata.ts +0 -1
- package/src/widgets/__tests__/radio.test.ts +1 -1
- package/src/widgets/expression.tsx +1 -1
- 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.tsx +0 -1
- package/src/widgets/interactive-graph.tsx +3 -62
- 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/orderer.tsx +0 -3
- package/src/widgets/passage/passage-markdown.tsx +1 -1
- 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 +2 -2
- package/src/widgets/radio/base-radio.tsx +1 -1
- package/src/widgets/transformer.tsx +1 -16
- package/src/widgets.ts +1 -1
- package/src/zoom.ts +0 -3
- package/tsconfig.tsbuildinfo +1 -1
package/dist/index.js
CHANGED
|
@@ -485,8 +485,6 @@ class MathInput extends React__namespace.Component {
|
|
|
485
485
|
// group. This will probably require ESCAPE key handling to enable to
|
|
486
486
|
// close (blur) the button group in order to focus on next page element.
|
|
487
487
|
if (!this.mouseDown &&
|
|
488
|
-
// $FlowFixMe[incompatible-use]
|
|
489
|
-
// $FlowFixMe[incompatible-call]
|
|
490
488
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
|
|
491
489
|
!ReactDOM__default["default"].findDOMNode(this).contains(e.relatedTarget)) {
|
|
492
490
|
this.setState({
|
|
@@ -1309,7 +1307,7 @@ const _changeSingle = function (component, propName, value, callback) {
|
|
|
1309
1307
|
* this.change(propName) -> returns a lambda that takes a prop value to
|
|
1310
1308
|
* set and a callback to call after having set that value.
|
|
1311
1309
|
*/
|
|
1312
|
-
// TODO(WEB-1727): use proper
|
|
1310
|
+
// TODO(WEB-1727): use proper TypeScript syntax for overloaded functions
|
|
1313
1311
|
const change = function (newPropsOrSinglePropName, propValue, callback) {
|
|
1314
1312
|
if (___default["default"].isObject(newPropsOrSinglePropName) && callback === undefined) {
|
|
1315
1313
|
// Called with an object of multiple props to change
|
|
@@ -1393,8 +1391,6 @@ class TextListEditor extends React__namespace.Component {
|
|
|
1393
1391
|
// eslint-disable-next-line react/no-string-refs
|
|
1394
1392
|
// @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
1395
1393
|
this.refs["input_" + focusIndex]
|
|
1396
|
-
// $FlowFixMe[incompatible-use]
|
|
1397
|
-
// $FlowFixMe[prop-missing]
|
|
1398
1394
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'focus' does not exist on type 'Element | Text'.
|
|
1399
1395
|
).focus();
|
|
1400
1396
|
});
|
|
@@ -1430,8 +1426,6 @@ class TextListEditor extends React__namespace.Component {
|
|
|
1430
1426
|
// eslint-disable-next-line react/no-string-refs
|
|
1431
1427
|
// @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
1432
1428
|
this.refs["input_" + focusIndex]
|
|
1433
|
-
// $FlowFixMe[incompatible-use]
|
|
1434
|
-
// $FlowFixMe[prop-missing]
|
|
1435
1429
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'focus' does not exist on type 'Element | Text'.
|
|
1436
1430
|
).focus();
|
|
1437
1431
|
});
|
|
@@ -1735,7 +1729,6 @@ const KhanMath = {
|
|
|
1735
1729
|
}
|
|
1736
1730
|
return true;
|
|
1737
1731
|
},
|
|
1738
|
-
// $FlowFixMe[incompatible-return]
|
|
1739
1732
|
// @ts-expect-error [FEI-5003] - TS2366 - Function lacks ending return statement and return type does not include 'undefined'.
|
|
1740
1733
|
getPrimeFactorization: function (number) {
|
|
1741
1734
|
if (number === 1) {
|
|
@@ -1792,9 +1785,7 @@ const KhanMath = {
|
|
|
1792
1785
|
// toFraction(0.666, 0.001) => [2, 3]
|
|
1793
1786
|
//
|
|
1794
1787
|
// tolerance can't be bigger than 1, sorry
|
|
1795
|
-
toFraction: function (decimal,
|
|
1796
|
-
// $FlowFixMe[incompatible-return]
|
|
1797
|
-
tolerance) {
|
|
1788
|
+
toFraction: function (decimal, tolerance) {
|
|
1798
1789
|
if (tolerance == null) {
|
|
1799
1790
|
tolerance = Math.pow(2, -46);
|
|
1800
1791
|
}
|
|
@@ -2901,7 +2892,7 @@ class Expression extends React__namespace.Component {
|
|
|
2901
2892
|
var _this$props$keypadEle;
|
|
2902
2893
|
// this.props.keypadElement should always be set
|
|
2903
2894
|
// when apiOptions.customKeypad is set, but how
|
|
2904
|
-
// to convince
|
|
2895
|
+
// to convince TypeScript of this?
|
|
2905
2896
|
(_this$props$keypadEle = this.props.keypadElement) === null || _this$props$keypadEle === void 0 ? void 0 : _this$props$keypadEle.configure(this.props.keypadConfiguration, () => {
|
|
2906
2897
|
if (this._isMounted) {
|
|
2907
2898
|
this._handleFocus();
|
|
@@ -4230,16 +4221,10 @@ Zoom.prototype._calculateZoom = function () {
|
|
|
4230
4221
|
// Zoom to fit the viewport.
|
|
4231
4222
|
const imageAspectRatio = originalFullImageWidth / originalFullImageHeight;
|
|
4232
4223
|
const viewportAspectRatio = viewportWidth / viewportHeight;
|
|
4233
|
-
if (
|
|
4234
|
-
// $FlowFixMe[invalid-compare]
|
|
4235
|
-
originalFullImageWidth < viewportWidth &&
|
|
4236
|
-
// $FlowFixMe[invalid-compare]
|
|
4237
|
-
originalFullImageHeight < viewportHeight) {
|
|
4224
|
+
if (originalFullImageWidth < viewportWidth && originalFullImageHeight < viewportHeight) {
|
|
4238
4225
|
this._imgScaleFactor = maxScaleFactor;
|
|
4239
4226
|
} else if (imageAspectRatio < viewportAspectRatio) {
|
|
4240
|
-
this._imgScaleFactor =
|
|
4241
|
-
// $FlowFixMe[unsafe-addition]
|
|
4242
|
-
viewportHeight / originalFullImageHeight * maxScaleFactor;
|
|
4227
|
+
this._imgScaleFactor = viewportHeight / originalFullImageHeight * maxScaleFactor;
|
|
4243
4228
|
} else {
|
|
4244
4229
|
this._imgScaleFactor = viewportWidth / (originalFullImageWidth !== null && originalFullImageWidth !== void 0 ? originalFullImageWidth : 0) * maxScaleFactor;
|
|
4245
4230
|
}
|
|
@@ -4569,7 +4554,6 @@ const FixedToResponsive = createReactClass__default["default"]({
|
|
|
4569
4554
|
// Based on http://refills.bourbon.io/components/#video && medium.com
|
|
4570
4555
|
const spacer = /*#__PURE__*/React__namespace.createElement("div", {
|
|
4571
4556
|
style: {
|
|
4572
|
-
// $FlowFixMe[unsafe-addition]
|
|
4573
4557
|
// @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.
|
|
4574
4558
|
paddingBottom: (1 / aspectRatio).toFixed(4) * 100 + "%"
|
|
4575
4559
|
}
|
|
@@ -13630,9 +13614,7 @@ function Protractor(graph, center) {
|
|
|
13630
13614
|
const time = Math.abs(this.rotation - angle) * 5;
|
|
13631
13615
|
$__default["default"]({
|
|
13632
13616
|
0: this.rotation
|
|
13633
|
-
}).animate(
|
|
13634
|
-
// $FlowFixMe[unsupported-syntax]
|
|
13635
|
-
{
|
|
13617
|
+
}).animate({
|
|
13636
13618
|
0: angle
|
|
13637
13619
|
}, {
|
|
13638
13620
|
duration: time,
|
|
@@ -13685,11 +13667,8 @@ function Ruler(graphie, options) {
|
|
|
13685
13667
|
if (options.ticksPerUnit === 10) {
|
|
13686
13668
|
// decimal, as on a centimeter ruler
|
|
13687
13669
|
tickHeightMap = {
|
|
13688
|
-
// $FlowFixMe[unsupported-syntax]
|
|
13689
13670
|
10: tickHeight,
|
|
13690
|
-
// $FlowFixMe[unsupported-syntax]
|
|
13691
13671
|
5: tickHeight * 0.55,
|
|
13692
|
-
// $FlowFixMe[unsupported-syntax]
|
|
13693
13672
|
1: tickHeight * 0.35
|
|
13694
13673
|
};
|
|
13695
13674
|
} else {
|
|
@@ -17794,12 +17773,8 @@ _defineProperty(Zoomable, "defaultProps", {
|
|
|
17794
17773
|
computeChildBounds: parentNode => {
|
|
17795
17774
|
const firstChild = parentNode.firstElementChild;
|
|
17796
17775
|
return {
|
|
17797
|
-
// $FlowFixMe[incompatible-use]
|
|
17798
|
-
// $FlowFixMe[prop-missing]
|
|
17799
17776
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'. | TS2339 - Property 'offsetWidth' does not exist on type 'Element'.
|
|
17800
17777
|
width: firstChild.offsetWidth,
|
|
17801
|
-
// $FlowFixMe[incompatible-use]
|
|
17802
|
-
// $FlowFixMe[prop-missing]
|
|
17803
17778
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'. | TS2339 - Property 'offsetHeight' does not exist on type 'Element'.
|
|
17804
17779
|
height: firstChild.offsetHeight
|
|
17805
17780
|
};
|
|
@@ -17809,10 +17784,8 @@ _defineProperty(Zoomable, "defaultProps", {
|
|
|
17809
17784
|
const computeMathBounds = (parentNode, parentBounds) => {
|
|
17810
17785
|
const textElement = parentNode.querySelector(".katex-html") || parentNode.querySelector(".MathJax");
|
|
17811
17786
|
const textBounds = {
|
|
17812
|
-
// $FlowFixMe[incompatible-use]
|
|
17813
17787
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'. | TS2339 - Property 'offsetWidth' does not exist on type 'Element'.
|
|
17814
17788
|
width: textElement.offsetWidth,
|
|
17815
|
-
// $FlowFixMe[incompatible-use]
|
|
17816
17789
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'. | TS2339 - Property 'offsetHeight' does not exist on type 'Element'.
|
|
17817
17790
|
height: textElement.offsetHeight
|
|
17818
17791
|
};
|
|
@@ -18735,11 +18708,8 @@ var PerseusMarkdown = {
|
|
|
18735
18708
|
parse: parse$3,
|
|
18736
18709
|
parseInline: inlineParser,
|
|
18737
18710
|
reactFor: SimpleMarkdown__default["default"].reactFor,
|
|
18738
|
-
// $FlowFixMe[incompatible-use]
|
|
18739
18711
|
ruleOutput: SimpleMarkdown__default["default"].ruleOutput(rules$1, "react"),
|
|
18740
|
-
basicOutput: SimpleMarkdown__default["default"].reactFor(
|
|
18741
|
-
// $FlowFixMe[incompatible-use]
|
|
18742
|
-
SimpleMarkdown__default["default"].ruleOutput(rules$1, "react")),
|
|
18712
|
+
basicOutput: SimpleMarkdown__default["default"].reactFor(SimpleMarkdown__default["default"].ruleOutput(rules$1, "react")),
|
|
18743
18713
|
sanitizeUrl: SimpleMarkdown__default["default"].sanitizeUrl
|
|
18744
18714
|
};
|
|
18745
18715
|
|
|
@@ -19181,7 +19151,7 @@ const validAlignments = ["block", "inline-block", "inline", "float-left", "float
|
|
|
19181
19151
|
* invalid.
|
|
19182
19152
|
*/
|
|
19183
19153
|
// TODO(alex): Change this to run as a testcase (vs. being run at runtime)
|
|
19184
|
-
// TODO(LP-10707): I think this can be completely removed because our
|
|
19154
|
+
// TODO(LP-10707): I think this can be completely removed because our TypeScript types
|
|
19185
19155
|
// enforce this!
|
|
19186
19156
|
const validateAlignments = () => {
|
|
19187
19157
|
___default["default"].each(widgets, function (widgetInfo) {
|
|
@@ -19553,10 +19523,8 @@ class Renderer extends React__namespace.Component {
|
|
|
19553
19523
|
let interactionTracker = this._interactionTrackers[id];
|
|
19554
19524
|
if (!interactionTracker) {
|
|
19555
19525
|
interactionTracker = this._interactionTrackers[id] = new InteractionTracker(apiOptions.trackInteraction,
|
|
19556
|
-
// $FlowFixMe[incompatible-call]
|
|
19557
19526
|
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'string | null | undefined' is not assignable to parameter of type 'string'.
|
|
19558
19527
|
widgetInfo && widgetInfo.type, id,
|
|
19559
|
-
// $FlowFixMe[incompatible-call]
|
|
19560
19528
|
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'string | null | undefined' is not assignable to parameter of type 'string'.
|
|
19561
19529
|
getTracking(widgetInfo && widgetInfo.type));
|
|
19562
19530
|
}
|
|
@@ -19866,7 +19834,7 @@ class Renderer extends React__namespace.Component {
|
|
|
19866
19834
|
const isString = typeof nodeOut === "string";
|
|
19867
19835
|
if (typeof nodeOut === "string" && lastWasString) {
|
|
19868
19836
|
/**
|
|
19869
|
-
* We know that last was string, but
|
|
19837
|
+
* We know that last was string, but TypeScript can't see this
|
|
19870
19838
|
* refinement.
|
|
19871
19839
|
*/
|
|
19872
19840
|
result[result.length - 1] += nodeOut;
|
|
@@ -20034,7 +20002,6 @@ class Renderer extends React__namespace.Component {
|
|
|
20034
20002
|
} = _ref3;
|
|
20035
20003
|
return /*#__PURE__*/React__namespace.createElement(SvgImage, _extends({
|
|
20036
20004
|
setAssetStatus: setAssetStatus
|
|
20037
|
-
/* $FlowFixMe[incompatible-type]: sanitizeUrl() can return null */
|
|
20038
20005
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'string | null | undefined' is not assignable to type 'string | undefined'.
|
|
20039
20006
|
,
|
|
20040
20007
|
src: PerseusMarkdown.sanitizeUrl(node.target),
|
|
@@ -23351,7 +23318,7 @@ const BaseRadio = function (props) {
|
|
|
23351
23318
|
aphroditeClassName(true);
|
|
23352
23319
|
let correctnessClass;
|
|
23353
23320
|
// reviewMode is only true if there's a rubric
|
|
23354
|
-
// but
|
|
23321
|
+
// but TypeScript doesn't understand that
|
|
23355
23322
|
if (reviewMode && reviewModeRubric) {
|
|
23356
23323
|
correctnessClass = reviewModeRubric.choices[i].correct ? ClassNames.CORRECT : ClassNames.INCORRECT;
|
|
23357
23324
|
}
|
|
@@ -25130,7 +25097,6 @@ class GradedGroup extends React__namespace.Component {
|
|
|
25130
25097
|
}
|
|
25131
25098
|
const mobileClass = this.props.inGradedGroupSet ? aphrodite.css(styles$l.gradedGroupInSet) : aphrodite.css(styles$l.gradedGroup);
|
|
25132
25099
|
const classes = classNames__default["default"]({
|
|
25133
|
-
// $FlowFixMe[invalid-computed-prop]
|
|
25134
25100
|
[mobileClass]: apiOptions.isMobile,
|
|
25135
25101
|
"perseus-graded-group": true,
|
|
25136
25102
|
"answer-correct": apiOptions.isMobile ? false : this.state.status === GRADING_STATUSES.correct,
|
|
@@ -25392,7 +25358,6 @@ class GradedGroupSet extends React__namespace.Component {
|
|
|
25392
25358
|
/*#__PURE__*/
|
|
25393
25359
|
// TODO(jeremy): Don't spread this.props, instead
|
|
25394
25360
|
// pass in all props GradedGroup needs explicilty
|
|
25395
|
-
// $FlowFixMe[prop-missing]
|
|
25396
25361
|
// @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call.
|
|
25397
25362
|
React__namespace.createElement(GradedGroup, _extends({
|
|
25398
25363
|
key: i
|
|
@@ -25431,12 +25396,8 @@ class GradedGroupSet extends React__namespace.Component {
|
|
|
25431
25396
|
ref: comp => this._childGroup = comp
|
|
25432
25397
|
// We should pass in the set of props explicitly
|
|
25433
25398
|
}, this.props, currentGroup, {
|
|
25434
|
-
inGradedGroupSet: true
|
|
25435
|
-
|
|
25436
|
-
,
|
|
25437
|
-
title: null
|
|
25438
|
-
// $FlowFixMe[incompatible-type]
|
|
25439
|
-
,
|
|
25399
|
+
inGradedGroupSet: true,
|
|
25400
|
+
title: null,
|
|
25440
25401
|
onNextQuestion: handleNextQuestion,
|
|
25441
25402
|
linterContext: this.props.linterContext
|
|
25442
25403
|
})));
|
|
@@ -25709,7 +25670,6 @@ const Linear = ___default["default"].extend({}, PlotDefaults, {
|
|
|
25709
25670
|
const Quadratic = ___default["default"].extend({}, PlotDefaults, {
|
|
25710
25671
|
url: "https://ka-perseus-graphie.s3.amazonaws.com/e23d36e6fc29ee37174e92c9daba2a66677128ab.png",
|
|
25711
25672
|
defaultCoords: [[0.5, 0.5], [0.75, 0.75]],
|
|
25712
|
-
// $FlowFixMe[prop-missing]
|
|
25713
25673
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'Parabola' does not exist on type 'typeof Graphie'.
|
|
25714
25674
|
Movable: Graphie.Parabola,
|
|
25715
25675
|
getCoefficients: function (coords) {
|
|
@@ -25750,7 +25710,6 @@ const Quadratic = ___default["default"].extend({}, PlotDefaults, {
|
|
|
25750
25710
|
const Sinusoid = ___default["default"].extend({}, PlotDefaults, {
|
|
25751
25711
|
url: "https://ka-perseus-graphie.s3.amazonaws.com/3d68e7718498475f53b206c2ab285626baf8857e.png",
|
|
25752
25712
|
defaultCoords: [[0.5, 0.5], [0.6, 0.6]],
|
|
25753
|
-
// $FlowFixMe[prop-missing]
|
|
25754
25713
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'Sinusoid' does not exist on type 'typeof Graphie'.
|
|
25755
25714
|
Movable: Graphie.Sinusoid,
|
|
25756
25715
|
getCoefficients: function (coords) {
|
|
@@ -25990,7 +25949,7 @@ const functionTypeMapping = {
|
|
|
25990
25949
|
const allTypes = ___default["default"].keys(functionTypeMapping);
|
|
25991
25950
|
function functionForType(
|
|
25992
25951
|
// TODO(jeremy): Actually `$Keys<typeof functionTypeMapping>` but that
|
|
25993
|
-
// triggers
|
|
25952
|
+
// triggers TypeScript to require all of our Plot types to be fully typed which
|
|
25994
25953
|
// is a big amount of work/change.
|
|
25995
25954
|
type) {
|
|
25996
25955
|
return functionTypeMapping[type];
|
|
@@ -26240,10 +26199,8 @@ class FunctionGrapher extends React__namespace.Component {
|
|
|
26240
26199
|
});
|
|
26241
26200
|
},
|
|
26242
26201
|
constraints: [
|
|
26243
|
-
// $FlowFixMe[prop-missing]
|
|
26244
26202
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
26245
26203
|
Interactive2.MovableLine.constraints.bound(),
|
|
26246
|
-
// $FlowFixMe[prop-missing]
|
|
26247
26204
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
26248
26205
|
Interactive2.MovableLine.constraints.snap(), (newCoord, oldCoord) => {
|
|
26249
26206
|
// Calculate and apply proposed displacement
|
|
@@ -26277,10 +26234,8 @@ class FunctionGrapher extends React__namespace.Component {
|
|
|
26277
26234
|
coord: coord,
|
|
26278
26235
|
static: this.props.static,
|
|
26279
26236
|
constraints: [
|
|
26280
|
-
// $FlowFixMe[prop-missing]
|
|
26281
26237
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
26282
26238
|
Interactive2.MovablePoint.constraints.bound(),
|
|
26283
|
-
// $FlowFixMe[prop-missing]
|
|
26284
26239
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
26285
26240
|
Interactive2.MovablePoint.constraints.snap(), coord => {
|
|
26286
26241
|
// Always enforce that this is a function
|
|
@@ -26338,7 +26293,6 @@ class FunctionGrapher extends React__namespace.Component {
|
|
|
26338
26293
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'Element' is not assignable to type 'null'.
|
|
26339
26294
|
image =
|
|
26340
26295
|
/*#__PURE__*/
|
|
26341
|
-
// $FlowFixMe[prop-missing]: alt props is missing
|
|
26342
26296
|
// @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">'.
|
|
26343
26297
|
React__namespace.createElement(SvgImage, {
|
|
26344
26298
|
src: imageDescription.url,
|
|
@@ -27245,9 +27199,7 @@ class Interaction extends React__namespace.Component {
|
|
|
27245
27199
|
functions: this.state.functions
|
|
27246
27200
|
});
|
|
27247
27201
|
compiledVars[name] = function (x) {
|
|
27248
|
-
return func(
|
|
27249
|
-
// $FlowFixMe[extra-arg]
|
|
27250
|
-
___default["default"].extend({}, compiledVars, {
|
|
27202
|
+
return func(___default["default"].extend({}, compiledVars, {
|
|
27251
27203
|
x: x
|
|
27252
27204
|
}));
|
|
27253
27205
|
};
|
|
@@ -27960,7 +27912,6 @@ class Graph extends React__namespace.Component {
|
|
|
27960
27912
|
const scale = this.props.box[0] / interactiveSizes$1.defaultBoxSize;
|
|
27961
27913
|
image =
|
|
27962
27914
|
/*#__PURE__*/
|
|
27963
|
-
// $FlowFixMe[prop-missing]: `alt` is missing
|
|
27964
27915
|
// @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">'.
|
|
27965
27916
|
React__namespace.createElement(SvgImage, {
|
|
27966
27917
|
src: imageData.url,
|
|
@@ -27978,15 +27929,12 @@ class Graph extends React__namespace.Component {
|
|
|
27978
27929
|
width: this.props.box[0],
|
|
27979
27930
|
height: this.props.box[1]
|
|
27980
27931
|
}
|
|
27981
|
-
// $FlowFixMe[prop-missing]: This can probably be removed
|
|
27982
27932
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'onMouseOut' does not exist on type 'Graph'.
|
|
27983
27933
|
,
|
|
27984
27934
|
onMouseOut: this.onMouseOut
|
|
27985
|
-
// $FlowFixMe[prop-missing]: This can probably be removed
|
|
27986
27935
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'onMouseOver' does not exist on type 'Graph'.
|
|
27987
27936
|
,
|
|
27988
27937
|
onMouseOver: this.onMouseOver
|
|
27989
|
-
// $FlowFixMe[prop-missing]: This can probably be removed
|
|
27990
27938
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'onClick' does not exist on type 'Graph'.
|
|
27991
27939
|
,
|
|
27992
27940
|
onClick: this.onClick
|
|
@@ -28481,10 +28429,8 @@ class InteractiveGraph extends React__namespace.Component {
|
|
|
28481
28429
|
return Interactive2.addMaybeMobileMovablePoint(this, {
|
|
28482
28430
|
coord: coord,
|
|
28483
28431
|
constraints: [
|
|
28484
|
-
// $FlowFixMe[prop-missing]
|
|
28485
28432
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28486
28433
|
Interactive2.MovablePoint.constraints.bound(),
|
|
28487
|
-
// $FlowFixMe[prop-missing]
|
|
28488
28434
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28489
28435
|
Interactive2.MovablePoint.constraints.snap()],
|
|
28490
28436
|
onMove: () => {
|
|
@@ -28543,7 +28489,6 @@ class InteractiveGraph extends React__namespace.Component {
|
|
|
28543
28489
|
}
|
|
28544
28490
|
const onMoveHandler = () => {
|
|
28545
28491
|
const graph = ___default["default"].extend({}, this.props.graph, {
|
|
28546
|
-
// $FlowFixMe[incompatible-use]
|
|
28547
28492
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'. | TS2531 - Object is possibly 'null'. | TS2531 - Object is possibly 'null'.
|
|
28548
28493
|
coords: [pointA.coord(), pointB.coord(), pointC.coord()]
|
|
28549
28494
|
});
|
|
@@ -28560,17 +28505,13 @@ class InteractiveGraph extends React__namespace.Component {
|
|
|
28560
28505
|
pointA = this.pointA = Interactive2.addMaybeMobileMovablePoint(this, {
|
|
28561
28506
|
coord: coords[0],
|
|
28562
28507
|
constraints: [
|
|
28563
|
-
// $FlowFixMe[prop-missing]
|
|
28564
28508
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28565
28509
|
Interactive2.MovablePoint.constraints.bound(),
|
|
28566
|
-
// $FlowFixMe[prop-missing]
|
|
28567
28510
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28568
28511
|
Interactive2.MovablePoint.constraints.snap(), coord => {
|
|
28569
28512
|
return !pointA ||
|
|
28570
|
-
// $FlowFixMe[incompatible-use]
|
|
28571
28513
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
|
|
28572
28514
|
coord[0] !== pointB.coord()[0] &&
|
|
28573
|
-
// $FlowFixMe[incompatible-use]
|
|
28574
28515
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
|
|
28575
28516
|
coord[0] !== pointC.coord()[0];
|
|
28576
28517
|
}],
|
|
@@ -28584,17 +28525,13 @@ class InteractiveGraph extends React__namespace.Component {
|
|
|
28584
28525
|
pointB = this.pointB = Interactive2.addMaybeMobileMovablePoint(this, {
|
|
28585
28526
|
coord: coords[1],
|
|
28586
28527
|
constraints: [
|
|
28587
|
-
// $FlowFixMe[prop-missing]
|
|
28588
28528
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28589
28529
|
Interactive2.MovablePoint.constraints.bound(),
|
|
28590
|
-
// $FlowFixMe[prop-missing]
|
|
28591
28530
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28592
28531
|
Interactive2.MovablePoint.constraints.snap(), coord => {
|
|
28593
28532
|
return !pointB ||
|
|
28594
|
-
// $FlowFixMe[incompatible-use]
|
|
28595
28533
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
|
|
28596
28534
|
coord[0] !== pointA.coord()[0] &&
|
|
28597
|
-
// $FlowFixMe[incompatible-use]
|
|
28598
28535
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
|
|
28599
28536
|
coord[0] !== pointC.coord()[0];
|
|
28600
28537
|
}],
|
|
@@ -28608,17 +28545,13 @@ class InteractiveGraph extends React__namespace.Component {
|
|
|
28608
28545
|
pointC = this.pointC = Interactive2.addMaybeMobileMovablePoint(this, {
|
|
28609
28546
|
coord: coords[2],
|
|
28610
28547
|
constraints: [
|
|
28611
|
-
// $FlowFixMe[prop-missing]
|
|
28612
28548
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28613
28549
|
Interactive2.MovablePoint.constraints.bound(),
|
|
28614
|
-
// $FlowFixMe[prop-missing]
|
|
28615
28550
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28616
28551
|
Interactive2.MovablePoint.constraints.snap(), coord => {
|
|
28617
28552
|
return !pointC ||
|
|
28618
|
-
// $FlowFixMe[incompatible-use]
|
|
28619
28553
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
|
|
28620
28554
|
coord[0] !== pointA.coord()[0] &&
|
|
28621
|
-
// $FlowFixMe[incompatible-use]
|
|
28622
28555
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
|
|
28623
28556
|
coord[0] !== pointB.coord()[0];
|
|
28624
28557
|
}],
|
|
@@ -28674,7 +28607,6 @@ class InteractiveGraph extends React__namespace.Component {
|
|
|
28674
28607
|
}
|
|
28675
28608
|
const onMoveHandler = () => {
|
|
28676
28609
|
const graph = ___default["default"].extend({}, this.props.graph, {
|
|
28677
|
-
// $FlowFixMe[incompatible-use]
|
|
28678
28610
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
|
|
28679
28611
|
coords: [pointA.coord(), pointB.coord()]
|
|
28680
28612
|
});
|
|
@@ -28691,10 +28623,8 @@ class InteractiveGraph extends React__namespace.Component {
|
|
|
28691
28623
|
pointA = this.pointA = Interactive2.addMaybeMobileMovablePoint(this, {
|
|
28692
28624
|
coord: coords[0],
|
|
28693
28625
|
constraints: [
|
|
28694
|
-
// $FlowFixMe[prop-missing]
|
|
28695
28626
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28696
28627
|
Interactive2.MovablePoint.constraints.bound(),
|
|
28697
|
-
// $FlowFixMe[prop-missing]
|
|
28698
28628
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28699
28629
|
Interactive2.MovablePoint.constraints.snap(), coord => {
|
|
28700
28630
|
return !pointA || coord[0] !== pointB.coord()[0];
|
|
@@ -28704,10 +28634,8 @@ class InteractiveGraph extends React__namespace.Component {
|
|
|
28704
28634
|
const pointB = this.pointB = Interactive2.addMaybeMobileMovablePoint(this, {
|
|
28705
28635
|
coord: coords[1],
|
|
28706
28636
|
constraints: [
|
|
28707
|
-
// $FlowFixMe[prop-missing]
|
|
28708
28637
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28709
28638
|
Interactive2.MovablePoint.constraints.bound(),
|
|
28710
|
-
// $FlowFixMe[prop-missing]
|
|
28711
28639
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28712
28640
|
Interactive2.MovablePoint.constraints.snap(), coord => {
|
|
28713
28641
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'coord' does not exist on type 'never'.
|
|
@@ -28768,9 +28696,7 @@ class InteractiveGraph extends React__namespace.Component {
|
|
|
28768
28696
|
});
|
|
28769
28697
|
$__default["default"](circle).on("move", () => {
|
|
28770
28698
|
const graph = ___default["default"].extend({}, this.props.graph, {
|
|
28771
|
-
// $FlowFixMe[incompatible-use]
|
|
28772
28699
|
center: circle.center,
|
|
28773
|
-
// $FlowFixMe[incompatible-use]
|
|
28774
28700
|
radius: circle.radius
|
|
28775
28701
|
});
|
|
28776
28702
|
this.onChange({
|
|
@@ -28797,10 +28723,8 @@ class InteractiveGraph extends React__namespace.Component {
|
|
|
28797
28723
|
segmentPoints.push(Interactive2.addMaybeMobileMovablePoint(this, {
|
|
28798
28724
|
coord: coord,
|
|
28799
28725
|
constraints: [
|
|
28800
|
-
// $FlowFixMe[prop-missing]
|
|
28801
28726
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28802
28727
|
Interactive2.MovablePoint.constraints.bound(),
|
|
28803
|
-
// $FlowFixMe[prop-missing]
|
|
28804
28728
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28805
28729
|
Interactive2.MovablePoint.constraints.snap(), coord => {
|
|
28806
28730
|
const otherSegment = segmentPoints[1 - i];
|
|
@@ -28851,12 +28775,7 @@ class InteractiveGraph extends React__namespace.Component {
|
|
|
28851
28775
|
}
|
|
28852
28776
|
const graphie = this.graphie;
|
|
28853
28777
|
const screenPoint = graphie === null || graphie === void 0 ? void 0 : graphie.scalePoint(coord);
|
|
28854
|
-
return
|
|
28855
|
-
// $FlowFixMe[incompatible-use]
|
|
28856
|
-
screenPoint[0] >= graphie.xpixels - 40 &&
|
|
28857
|
-
// $FlowFixMe[incompatible-use]
|
|
28858
|
-
screenPoint[1] >= graphie.ypixels - 40
|
|
28859
|
-
);
|
|
28778
|
+
return screenPoint[0] >= graphie.xpixels - 40 && screenPoint[1] >= graphie.ypixels - 40;
|
|
28860
28779
|
});
|
|
28861
28780
|
_defineProperty(this, "createPointForPointsType", (coord, i) => {
|
|
28862
28781
|
const self = this;
|
|
@@ -28883,10 +28802,8 @@ class InteractiveGraph extends React__namespace.Component {
|
|
|
28883
28802
|
point = Interactive2.addMaybeMobileMovablePoint(this, {
|
|
28884
28803
|
coord: coord,
|
|
28885
28804
|
constraints: [
|
|
28886
|
-
// $FlowFixMe[prop-missing]
|
|
28887
28805
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28888
28806
|
Interactive2.MovablePoint.constraints.bound(),
|
|
28889
|
-
// $FlowFixMe[prop-missing]
|
|
28890
28807
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28891
28808
|
Interactive2.MovablePoint.constraints.snap(), function (coord) {
|
|
28892
28809
|
// TODO(jack): There ought to be a
|
|
@@ -29174,10 +29091,8 @@ class InteractiveGraph extends React__namespace.Component {
|
|
|
29174
29091
|
const point = Interactive2.addMaybeMobileMovablePoint(this, {
|
|
29175
29092
|
coord: coord,
|
|
29176
29093
|
constraints: [
|
|
29177
|
-
// $FlowFixMe[prop-missing]
|
|
29178
29094
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
29179
29095
|
Interactive2.MovablePoint.constraints.bound(), snapToGrid ?
|
|
29180
|
-
// $FlowFixMe[prop-missing]
|
|
29181
29096
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
29182
29097
|
Interactive2.MovablePoint.constraints.snap() : null, graphConstraint],
|
|
29183
29098
|
onMoveStart: () => {
|
|
@@ -29273,10 +29188,8 @@ class InteractiveGraph extends React__namespace.Component {
|
|
|
29273
29188
|
points.push(createPoint({
|
|
29274
29189
|
coord: coord,
|
|
29275
29190
|
constraints: [
|
|
29276
|
-
// $FlowFixMe[prop-missing]
|
|
29277
29191
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
29278
29192
|
Interactive2.MovablePoint.constraints.bound(),
|
|
29279
|
-
// $FlowFixMe[prop-missing]
|
|
29280
29193
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
29281
29194
|
Interactive2.MovablePoint.constraints.snap(), coord => {
|
|
29282
29195
|
const otherPoint = points[1 - i];
|
|
@@ -29298,14 +29211,11 @@ class InteractiveGraph extends React__namespace.Component {
|
|
|
29298
29211
|
points: points,
|
|
29299
29212
|
static: false,
|
|
29300
29213
|
constraints: [
|
|
29301
|
-
// $FlowFixMe[prop-missing]
|
|
29302
29214
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
29303
29215
|
Interactive2.MovableLine.constraints.bound(),
|
|
29304
|
-
// $FlowFixMe[prop-missing]
|
|
29305
29216
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
29306
29217
|
Interactive2.MovableLine.constraints.snap()],
|
|
29307
29218
|
onMove: [
|
|
29308
|
-
// $FlowFixMe[prop-missing]
|
|
29309
29219
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'onMove' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
29310
29220
|
Interactive2.MovableLine.onMove.updatePoints, updateCoordProps],
|
|
29311
29221
|
normalStyle: {
|
|
@@ -29402,10 +29312,8 @@ class InteractiveGraph extends React__namespace.Component {
|
|
|
29402
29312
|
const self = this;
|
|
29403
29313
|
self.polygon = Interactive2.addMovablePolygon(graphie, {
|
|
29404
29314
|
constraints: [
|
|
29405
|
-
// $FlowFixMe[prop-missing]
|
|
29406
29315
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => undefined'.
|
|
29407
29316
|
Interactive2.MovablePolygon.constraints.bound(), snapToGrid ?
|
|
29408
|
-
// $FlowFixMe[prop-missing]
|
|
29409
29317
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => undefined'.
|
|
29410
29318
|
Interactive2.MovablePolygon.constraints.snap() : null],
|
|
29411
29319
|
closed: closed,
|
|
@@ -29415,7 +29323,6 @@ class InteractiveGraph extends React__namespace.Component {
|
|
|
29415
29323
|
numArcs: numArcs,
|
|
29416
29324
|
sideLabels: sideLabels,
|
|
29417
29325
|
onMove: [
|
|
29418
|
-
// $FlowFixMe[prop-missing]
|
|
29419
29326
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'onMove' does not exist on type '(graphie: any, movable: any, options: any) => undefined'.
|
|
29420
29327
|
Interactive2.MovablePolygon.onMove.updatePoints, function () {
|
|
29421
29328
|
// @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
@@ -29647,7 +29554,6 @@ class InteractiveGraph extends React__namespace.Component {
|
|
|
29647
29554
|
*/
|
|
29648
29555
|
static getLineCoords(graph, props) {
|
|
29649
29556
|
return (
|
|
29650
|
-
// $FlowFixMe[incompatible-return]
|
|
29651
29557
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'coords' does not exist on type 'PerseusGraphType'.
|
|
29652
29558
|
graph.coords || InteractiveGraph.pointsFromNormalized(props, [[0.25, 0.75], [0.75, 0.75]])
|
|
29653
29559
|
);
|
|
@@ -29702,7 +29608,6 @@ class InteractiveGraph extends React__namespace.Component {
|
|
|
29702
29608
|
static getLinearSystemCoords(graph, props) {
|
|
29703
29609
|
return (
|
|
29704
29610
|
// The callers assume that we're return an array of points
|
|
29705
|
-
// $FlowFixMe[incompatible-return]
|
|
29706
29611
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'coords' does not exist on type 'PerseusGraphType'.
|
|
29707
29612
|
graph.coords || ___default["default"].map([[[0.25, 0.75], [0.75, 0.75]], [[0.25, 0.25], [0.75, 0.25]]], coords => {
|
|
29708
29613
|
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'number[][]' is not assignable to parameter of type 'readonly Coord[]'.
|
|
@@ -29758,17 +29663,11 @@ class InteractiveGraph extends React__namespace.Component {
|
|
|
29758
29663
|
const n = graph.numSegments || 1;
|
|
29759
29664
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'number[] | undefined' is not assignable to type 'readonly number[]'.
|
|
29760
29665
|
const ys = {
|
|
29761
|
-
// $FlowFixMe[unsupported-syntax]
|
|
29762
29666
|
1: [5],
|
|
29763
|
-
// $FlowFixMe[unsupported-syntax]
|
|
29764
29667
|
2: [5, -5],
|
|
29765
|
-
// $FlowFixMe[unsupported-syntax]
|
|
29766
29668
|
3: [5, 0, -5],
|
|
29767
|
-
// $FlowFixMe[unsupported-syntax]
|
|
29768
29669
|
4: [6, 2, -2, -6],
|
|
29769
|
-
// $FlowFixMe[unsupported-syntax]
|
|
29770
29670
|
5: [6, 3, 0, -3, -6],
|
|
29771
|
-
// $FlowFixMe[unsupported-syntax]
|
|
29772
29671
|
6: [5, 3, 1, -1, -3, -5]
|
|
29773
29672
|
}[n];
|
|
29774
29673
|
const range = [[-10, 10], [-10, 10]];
|
|
@@ -29972,7 +29871,6 @@ class InteractiveGraph extends React__namespace.Component {
|
|
|
29972
29871
|
// If both of the guess points are on the correct line, it's
|
|
29973
29872
|
// correct.
|
|
29974
29873
|
if (
|
|
29975
|
-
// $FlowFixMe[incompatible-use] - Fix type so coords can't be omitted
|
|
29976
29874
|
// @ts-expect-error [FEI-5003] - TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'.
|
|
29977
29875
|
collinear(correct[0], correct[1], guess[0]) &&
|
|
29978
29876
|
// @ts-expect-error [FEI-5003] - TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'.
|
|
@@ -29999,8 +29897,6 @@ class InteractiveGraph extends React__namespace.Component {
|
|
|
29999
29897
|
// If the parabola coefficients match, it's correct.
|
|
30000
29898
|
const guessCoeffs = this.getQuadraticCoefficients(state.coords);
|
|
30001
29899
|
const correctCoeffs = this.getQuadraticCoefficients(
|
|
30002
|
-
// $FlowFixMe[incompatible-call]
|
|
30003
|
-
// $FlowFixMe[prop-missing]
|
|
30004
29900
|
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'readonly Coord[] | undefined' is not assignable to parameter of type 'readonly Coord[]'.
|
|
30005
29901
|
rubric.correct.coords);
|
|
30006
29902
|
if (deepEq$2(guessCoeffs, correctCoeffs)) {
|
|
@@ -30014,8 +29910,6 @@ class InteractiveGraph extends React__namespace.Component {
|
|
|
30014
29910
|
} else if (state.type === "sinusoid" && rubric.correct.type === "sinusoid" && state.coords != null) {
|
|
30015
29911
|
const guessCoeffs = this.getSinusoidCoefficients(state.coords);
|
|
30016
29912
|
const correctCoeffs = this.getSinusoidCoefficients(
|
|
30017
|
-
// $FlowFixMe[incompatible-call]
|
|
30018
|
-
// $FlowFixMe[prop-missing]
|
|
30019
29913
|
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'readonly Coord[] | undefined' is not assignable to parameter of type 'readonly Coord[]'.
|
|
30020
29914
|
rubric.correct.coords);
|
|
30021
29915
|
const canonicalGuessCoeffs = canonicalSineCoefficients(guessCoeffs);
|
|
@@ -30030,9 +29924,7 @@ class InteractiveGraph extends React__namespace.Component {
|
|
|
30030
29924
|
};
|
|
30031
29925
|
}
|
|
30032
29926
|
} else if (state.type === "circle" && rubric.correct.type === "circle") {
|
|
30033
|
-
if (deepEq$2(state.center, rubric.correct.center) &&
|
|
30034
|
-
// $FlowFixMe[prop-missing]
|
|
30035
|
-
eq(state.radius, rubric.correct.radius)) {
|
|
29927
|
+
if (deepEq$2(state.center, rubric.correct.center) && eq(state.radius, rubric.correct.radius)) {
|
|
30036
29928
|
return {
|
|
30037
29929
|
type: "points",
|
|
30038
29930
|
earned: 1,
|
|
@@ -30105,10 +29997,8 @@ class InteractiveGraph extends React__namespace.Component {
|
|
|
30105
29997
|
const guess = state.coords;
|
|
30106
29998
|
const correct = rubric.correct.coords;
|
|
30107
29999
|
if (
|
|
30108
|
-
// $FlowFixMe[incompatible-use]
|
|
30109
30000
|
// @ts-expect-error [FEI-5003] - TS2532 - Object is possibly 'undefined'.
|
|
30110
30001
|
deepEq$2(guess[0], correct[0]) &&
|
|
30111
|
-
// $FlowFixMe[incompatible-use]
|
|
30112
30002
|
// @ts-expect-error [FEI-5003] - TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'.
|
|
30113
30003
|
collinear(correct[0], correct[1], guess[1])) {
|
|
30114
30004
|
return {
|
|
@@ -30138,13 +30028,10 @@ class InteractiveGraph extends React__namespace.Component {
|
|
|
30138
30028
|
} else {
|
|
30139
30029
|
/* exact */
|
|
30140
30030
|
match =
|
|
30141
|
-
// $FlowFixMe[incompatible-use]
|
|
30142
30031
|
// @ts-expect-error [FEI-5003] - TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'.
|
|
30143
30032
|
deepEq$2(guess[1], correct[1]) &&
|
|
30144
|
-
// $FlowFixMe[incompatible-use]
|
|
30145
30033
|
// @ts-expect-error [FEI-5003] - TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'.
|
|
30146
30034
|
collinear(correct[1], correct[0], guess[0]) &&
|
|
30147
|
-
// $FlowFixMe[incompatible-use]
|
|
30148
30035
|
// @ts-expect-error [FEI-5003] - TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'.
|
|
30149
30036
|
collinear(correct[1], correct[2], guess[2]);
|
|
30150
30037
|
}
|
|
@@ -30183,7 +30070,6 @@ _defineProperty(InteractiveGraph, "defaultProps", {
|
|
|
30183
30070
|
labels: ["x", "y"],
|
|
30184
30071
|
range: [[-10, 10], [-10, 10]],
|
|
30185
30072
|
step: [1, 1],
|
|
30186
|
-
// $FlowFixMe[prop-missing]
|
|
30187
30073
|
// @ts-expect-error [FEI-5003] - TS2739 - Type '{ readonly url: null; }' is missing the following properties from type 'PerseusImageBackground': width, height
|
|
30188
30074
|
backgroundImage: defaultBackgroundImage$1,
|
|
30189
30075
|
markings: "graph",
|
|
@@ -31863,7 +31749,7 @@ class LabelImage extends React__namespace.Component {
|
|
|
31863
31749
|
_defineProperty(this, "handleDocumentClick", e => {
|
|
31864
31750
|
// Dismiss open popup with answer choices if user clicks outside it.
|
|
31865
31751
|
if (this._selectedMarkerPopup && this._answerChoices) {
|
|
31866
|
-
const answerChoices =
|
|
31752
|
+
const answerChoices = ReactDOM__namespace.findDOMNode(this._answerChoices);
|
|
31867
31753
|
const targetElement = e.target;
|
|
31868
31754
|
// HACK(michaelpolyak): We want to determine if the click target is
|
|
31869
31755
|
// contained within the popup layer. As there's no public interface
|
|
@@ -31958,7 +31844,7 @@ class LabelImage extends React__namespace.Component {
|
|
|
31958
31844
|
// Set focus on the just-deselected-marker, to enable to resume
|
|
31959
31845
|
// navigating between the markers using the keyboard.
|
|
31960
31846
|
if (marker) {
|
|
31961
|
-
|
|
31847
|
+
ReactDOM__namespace.findDOMNode(marker).focus();
|
|
31962
31848
|
}
|
|
31963
31849
|
});
|
|
31964
31850
|
}
|
|
@@ -32049,7 +31935,7 @@ class LabelImage extends React__namespace.Component {
|
|
|
32049
31935
|
// @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'.
|
|
32050
31936
|
navigateDirection, markers, index)];
|
|
32051
31937
|
if (marker) {
|
|
32052
|
-
|
|
31938
|
+
ReactDOM__namespace.findDOMNode(marker).focus();
|
|
32053
31939
|
}
|
|
32054
31940
|
}
|
|
32055
31941
|
handleAnswerChoicesChangeForMarker(index, selection) {
|
|
@@ -33508,8 +33394,6 @@ class NumberInput extends React__namespace.Component {
|
|
|
33508
33394
|
});
|
|
33509
33395
|
_defineProperty(this, "getValue", () => {
|
|
33510
33396
|
return this.parseInputValue(
|
|
33511
|
-
// $FlowFixMe[incompatible-use]
|
|
33512
|
-
// $FlowFixMe[prop-missing]
|
|
33513
33397
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'. | TS2339 - Property 'value' does not exist on type 'Element | Text'.
|
|
33514
33398
|
ReactDOM__default["default"].findDOMNode(this.refs.input).value // eslint-disable-line react/no-string-refs
|
|
33515
33399
|
);
|
|
@@ -35334,14 +35218,10 @@ const TickMarks = Graphie.createSimpleClass((graphie, props) => {
|
|
|
35334
35218
|
// Render the text labels
|
|
35335
35219
|
results.push(graphie.style(props.isMobile ? {
|
|
35336
35220
|
color: KhanColors.BLUE_D
|
|
35337
|
-
} : {},
|
|
35338
|
-
// $FlowFixMe[incompatible-call]
|
|
35339
|
-
() => _label(graphie, props.labelStyle, leftLabel, leftLabel, base)));
|
|
35221
|
+
} : {}, () => _label(graphie, props.labelStyle, leftLabel, leftLabel, base)));
|
|
35340
35222
|
results.push(graphie.style(props.isMobile ? {
|
|
35341
35223
|
color: KhanColors.BLUE_D
|
|
35342
|
-
} : {}, () =>
|
|
35343
|
-
// $FlowFixMe[incompatible-call]
|
|
35344
|
-
_label(graphie, props.labelStyle, rightLabel, rightLabel, base)));
|
|
35224
|
+
} : {}, () => _label(graphie, props.labelStyle, rightLabel, rightLabel, base)));
|
|
35345
35225
|
|
|
35346
35226
|
// Render the labels' lines
|
|
35347
35227
|
graphie.style({
|
|
@@ -36028,10 +35908,7 @@ class Orderer extends React__namespace.Component {
|
|
|
36028
35908
|
current: list,
|
|
36029
35909
|
dragging: true,
|
|
36030
35910
|
placeholderIndex: placeholderIndex,
|
|
36031
|
-
// $FlowFixMe[prop-missing]
|
|
36032
|
-
// $FlowFixMe[incompatible-use]
|
|
36033
35911
|
dragKey: opt.key,
|
|
36034
|
-
// $FlowFixMe[incompatible-use]
|
|
36035
35912
|
dragContent: opt.content,
|
|
36036
35913
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'width' does not exist on type 'JQueryStatic'.
|
|
36037
35914
|
dragWidth: $draggable.width(),
|
|
@@ -37369,7 +37246,7 @@ class SelectionTracker extends React__namespace.PureComponent {
|
|
|
37369
37246
|
}
|
|
37370
37247
|
|
|
37371
37248
|
// NOTE(mdr): The focus node is guaranteed to exist, because
|
|
37372
|
-
// there's a range, but the
|
|
37249
|
+
// there's a range, but the type annotations for
|
|
37373
37250
|
// Selection don't know that. Cast it ourselves.
|
|
37374
37251
|
const focusNode = selection.focusNode;
|
|
37375
37252
|
const focusOffset = selection.focusOffset;
|
|
@@ -37491,23 +37368,8 @@ class HighlightingUI extends React__namespace.PureComponent {
|
|
|
37491
37368
|
zIndexes: this.props.zIndexes
|
|
37492
37369
|
}), this._selectionIsValid(trackedSelection) && !userIsMouseSelecting && /*#__PURE__*/React__namespace.createElement(HighlightTooltip, {
|
|
37493
37370
|
label: i18n__namespace._("Add highlight"),
|
|
37494
|
-
onClick: () => this._handleAddHighlight(
|
|
37495
|
-
|
|
37496
|
-
// "proposedHighlight (Cannot get `trackedSelection.proposedHighlight` because property `proposedHighlight` is missing in null or undefined [1].)"
|
|
37497
|
-
// $FlowFixMe[incompatible-use](0.57.3->0.75.0)
|
|
37498
|
-
// @ts-expect-error [FEI-5003] - TS2533 - Object is possibly 'null' or 'undefined'.
|
|
37499
|
-
trackedSelection.proposedHighlight)
|
|
37500
|
-
// TODO(mdr): We found a new Flow error when upgrading:
|
|
37501
|
-
// "focusNode (Cannot get `trackedSelection.focusNode` because property `focusNode` is missing in null or undefined [1].)"
|
|
37502
|
-
// $FlowFixMe[incompatible-use](0.57.3->0.75.0)
|
|
37503
|
-
// @ts-expect-error [FEI-5003] - TS2533 - Object is possibly 'null' or 'undefined'.
|
|
37504
|
-
,
|
|
37505
|
-
focusNode: trackedSelection.focusNode
|
|
37506
|
-
// TODO(mdr): We found a new Flow error when upgrading:
|
|
37507
|
-
// "focusOffset (Cannot get `trackedSelection.focusOffset` because property `focusOffset` is missing in null or undefined [1].)"
|
|
37508
|
-
// $FlowFixMe[incompatible-use](0.57.3->0.75.0)
|
|
37509
|
-
// @ts-expect-error [FEI-5003] - TS2533 - Object is possibly 'null' or 'undefined'.
|
|
37510
|
-
,
|
|
37371
|
+
onClick: () => this._handleAddHighlight(trackedSelection.proposedHighlight),
|
|
37372
|
+
focusNode: trackedSelection.focusNode,
|
|
37511
37373
|
focusOffset: trackedSelection.focusOffset,
|
|
37512
37374
|
offsetParent: this.props.offsetParent
|
|
37513
37375
|
})));
|
|
@@ -37581,11 +37443,7 @@ class WordIndexer extends React__namespace.PureComponent {
|
|
|
37581
37443
|
let newTrailingWordRange = null;
|
|
37582
37444
|
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'string | null' is not assignable to parameter of type 'string'.
|
|
37583
37445
|
while ((wordMatch = wordPattern.exec(text)) !== null) {
|
|
37584
|
-
// TODO(mdr): We found a new Flow error when upgrading:
|
|
37585
|
-
// "index (Cannot get `wordMatch.index` because property `index` is missing in null [1].)"
|
|
37586
37446
|
const startOffset = wordMatch.index;
|
|
37587
|
-
// TODO(mdr): We found a new Flow error when upgrading:
|
|
37588
|
-
// "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].)"
|
|
37589
37447
|
const endOffset = wordMatch.index + wordMatch[0].length;
|
|
37590
37448
|
let range;
|
|
37591
37449
|
if (startOffset === 0 && trailingWordRange) {
|
|
@@ -37869,7 +37727,7 @@ const rules = {
|
|
|
37869
37727
|
|
|
37870
37728
|
// A "magic" capture that matches the opening {{
|
|
37871
37729
|
// but captures the full ref text internally :D
|
|
37872
|
-
// unfortunately the "magic" makes
|
|
37730
|
+
// unfortunately the "magic" makes TypeScript upset,
|
|
37873
37731
|
// so there's this questionable workaround
|
|
37874
37732
|
capture[1] = source.slice(2, closeIndex);
|
|
37875
37733
|
return capture;
|
|
@@ -38247,7 +38105,7 @@ class Passage extends React__namespace.Component {
|
|
|
38247
38105
|
});
|
|
38248
38106
|
}
|
|
38249
38107
|
_measureLines() {
|
|
38250
|
-
const renderer =
|
|
38108
|
+
const renderer = ReactDOM__namespace.findDOMNode(this._contentRef);
|
|
38251
38109
|
// @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call. | TS2339 - Property 'height' does not exist on type 'JQueryStatic'.
|
|
38252
38110
|
const contentsHeight = $__default["default"](renderer).height();
|
|
38253
38111
|
const lineHeight = this._getLineHeight();
|
|
@@ -38301,7 +38159,7 @@ class Passage extends React__namespace.Component {
|
|
|
38301
38159
|
}
|
|
38302
38160
|
|
|
38303
38161
|
// @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call.
|
|
38304
|
-
const $ref = $__default["default"](
|
|
38162
|
+
const $ref = $__default["default"](ReactDOM__namespace.findDOMNode(ref));
|
|
38305
38163
|
// We really care about the first text after the ref, not the
|
|
38306
38164
|
// ref element itself:
|
|
38307
38165
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'next' does not exist on type 'JQueryStatic'.
|
|
@@ -38322,7 +38180,7 @@ class Passage extends React__namespace.Component {
|
|
|
38322
38180
|
}
|
|
38323
38181
|
|
|
38324
38182
|
// @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call.
|
|
38325
|
-
const $ref = $__default["default"](
|
|
38183
|
+
const $ref = $__default["default"](ReactDOM__namespace.findDOMNode(ref));
|
|
38326
38184
|
// We really care about the last text before the ref, not the
|
|
38327
38185
|
// ref element itself:
|
|
38328
38186
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'prev' does not exist on type 'JQueryStatic'.
|
|
@@ -38347,7 +38205,7 @@ class Passage extends React__namespace.Component {
|
|
|
38347
38205
|
return this.state.startLineNumbersAfter + line;
|
|
38348
38206
|
}
|
|
38349
38207
|
_convertPosToLineNumber(absoluteVPos) {
|
|
38350
|
-
const content =
|
|
38208
|
+
const content = ReactDOM__namespace.findDOMNode(this._contentRef);
|
|
38351
38209
|
// @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call. | TS2339 - Property 'offset' does not exist on type 'JQueryStatic'.
|
|
38352
38210
|
const relativeVPos = absoluteVPos - $__default["default"](content).offset().top;
|
|
38353
38211
|
const lineHeight = this._getLineHeight();
|
|
@@ -38575,18 +38433,14 @@ class PassageRefTarget extends React__namespace.Component {
|
|
|
38575
38433
|
};
|
|
38576
38434
|
}
|
|
38577
38435
|
render() {
|
|
38578
|
-
return (
|
|
38579
|
-
|
|
38580
|
-
//
|
|
38581
|
-
|
|
38582
|
-
|
|
38583
|
-
|
|
38584
|
-
|
|
38585
|
-
|
|
38586
|
-
apiOptions: this.props.apiOptions,
|
|
38587
|
-
linterContext: this.props.linterContext
|
|
38588
|
-
})
|
|
38589
|
-
);
|
|
38436
|
+
return /*#__PURE__*/React__namespace.createElement(Renderer, {
|
|
38437
|
+
content: this.props.content
|
|
38438
|
+
// @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<...>'.
|
|
38439
|
+
,
|
|
38440
|
+
inline: true,
|
|
38441
|
+
apiOptions: this.props.apiOptions,
|
|
38442
|
+
linterContext: this.props.linterContext
|
|
38443
|
+
});
|
|
38590
38444
|
}
|
|
38591
38445
|
}
|
|
38592
38446
|
_defineProperty(PassageRefTarget, "propTypes", {
|
|
@@ -39181,7 +39035,6 @@ class Plotter extends React__namespace.Component {
|
|
|
39181
39035
|
if (i > 0) {
|
|
39182
39036
|
c.graph.lines[i] = Interactive2.addMovableLine(graphie, {
|
|
39183
39037
|
points: [c.graph.points[i - 1], c.graph.points[i]],
|
|
39184
|
-
// $FlowFixMe[prop-missing]
|
|
39185
39038
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
39186
39039
|
constraints: Interactive2.MovablePoint.constraints.fixed(),
|
|
39187
39040
|
normalStyle: {
|
|
@@ -41921,9 +41774,7 @@ const ShapeTypes = {
|
|
|
41921
41774
|
fixed: !options.translatable && !options.editable
|
|
41922
41775
|
},
|
|
41923
41776
|
visible: options.showPoints,
|
|
41924
|
-
// $FlowFixMe[prop-missing]
|
|
41925
41777
|
snapX: options.snap && options.snap[0] || 0,
|
|
41926
|
-
// $FlowFixMe[prop-missing]
|
|
41927
41778
|
snapY: options.snap && options.snap[1] || 0,
|
|
41928
41779
|
bounded: false,
|
|
41929
41780
|
// Don't bound it when placing it on the graph
|
|
@@ -42497,7 +42348,6 @@ class Transformer extends React__namespace.Component {
|
|
|
42497
42348
|
transform = {
|
|
42498
42349
|
type: "translation",
|
|
42499
42350
|
// NOTE(kevib): these should be numbers
|
|
42500
|
-
// $FlowFixMe[incompatible-type]
|
|
42501
42351
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'null' is not assignable to type 'number'. | TS2322 - Type 'null' is not assignable to type 'number'.
|
|
42502
42352
|
vector: [null, null]
|
|
42503
42353
|
};
|
|
@@ -42506,11 +42356,9 @@ class Transformer extends React__namespace.Component {
|
|
|
42506
42356
|
transform = {
|
|
42507
42357
|
type: "rotation",
|
|
42508
42358
|
// NOTE(kevib): these should be numbers
|
|
42509
|
-
// $FlowFixMe[incompatible-type]
|
|
42510
42359
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'null' is not assignable to type 'number'. | TS2322 - Type 'null' is not assignable to type 'number'.
|
|
42511
42360
|
center: [null, null],
|
|
42512
42361
|
// NOTE(kevib): this should be a number
|
|
42513
|
-
// $FlowFixMe[incompatible-type]
|
|
42514
42362
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'null' is not assignable to type 'number'.
|
|
42515
42363
|
angleDeg: null
|
|
42516
42364
|
};
|
|
@@ -42521,11 +42369,9 @@ class Transformer extends React__namespace.Component {
|
|
|
42521
42369
|
type: "reflection",
|
|
42522
42370
|
line: [
|
|
42523
42371
|
// NOTE(kevib): these should be numbers
|
|
42524
|
-
// $FlowFixMe[incompatible-type]
|
|
42525
42372
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'null' is not assignable to type 'number'. | TS2322 - Type 'null' is not assignable to type 'number'.
|
|
42526
42373
|
[null, null],
|
|
42527
42374
|
// NOTE(kevib): these should be numbers
|
|
42528
|
-
// $FlowFixMe[incompatible-type]
|
|
42529
42375
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'null' is not assignable to type 'number'. | TS2322 - Type 'null' is not assignable to type 'number'.
|
|
42530
42376
|
[null, null]]
|
|
42531
42377
|
};
|
|
@@ -42534,11 +42380,9 @@ class Transformer extends React__namespace.Component {
|
|
|
42534
42380
|
transform = {
|
|
42535
42381
|
type: "dilation",
|
|
42536
42382
|
// NOTE(kevib): these should be numbers
|
|
42537
|
-
// $FlowFixMe[incompatible-type]
|
|
42538
42383
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'null' is not assignable to type 'number'. | TS2322 - Type 'null' is not assignable to type 'number'.
|
|
42539
42384
|
center: [null, null],
|
|
42540
42385
|
// NOTE(kevib): this should be a number
|
|
42541
|
-
// $FlowFixMe[incompatible-type]
|
|
42542
42386
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'null' is not assignable to type 'number'.
|
|
42543
42387
|
scale: null
|
|
42544
42388
|
};
|
|
@@ -42711,7 +42555,6 @@ class Transformer extends React__namespace.Component {
|
|
|
42711
42555
|
if (reflectRotateHandle) {
|
|
42712
42556
|
$__default["default"](reflectRotateHandle).on("move", function () {
|
|
42713
42557
|
const rotateHandleApprox = self.snapCoord(
|
|
42714
|
-
// $FlowFixMe[incompatible-use]
|
|
42715
42558
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
|
|
42716
42559
|
reflectRotateHandle.coord);
|
|
42717
42560
|
const rotateVector = kmath.vector.subtract(rotateHandleApprox, reflectButton.coord);
|
|
@@ -42779,9 +42622,7 @@ class Transformer extends React__namespace.Component {
|
|
|
42779
42622
|
width: this.scaleToCurrentRange(0.24),
|
|
42780
42623
|
hoverWidth: this.scaleToCurrentRange(0.4),
|
|
42781
42624
|
onMove: function (newAngle, oldAngle) {
|
|
42782
|
-
const transform = self.getRotationTransformFromAngle(
|
|
42783
|
-
// $FlowFixMe[incompatible-use]
|
|
42784
|
-
self.rotatePoint.coord, newAngle - oldAngle);
|
|
42625
|
+
const transform = self.getRotationTransformFromAngle(self.rotatePoint.coord, newAngle - oldAngle);
|
|
42785
42626
|
|
|
42786
42627
|
// Rotate polygon with rotateHandle
|
|
42787
42628
|
self.doTransform(transform);
|
|
@@ -42830,9 +42671,7 @@ class Transformer extends React__namespace.Component {
|
|
|
42830
42671
|
self.doTransform({
|
|
42831
42672
|
type: "dilation",
|
|
42832
42673
|
// NOTE(kevinb): It's hard to convince that this.dilationCircle
|
|
42833
|
-
// will still be defined here.
|
|
42834
|
-
// $FlowFixMe[incompatible-use]
|
|
42835
|
-
center: self.dilationCircle.centerPoint.coord,
|
|
42674
|
+
// will still be defined here. center: self.dilationCircle.centerPoint.coord,
|
|
42836
42675
|
scale: newRadius / oldRadius
|
|
42837
42676
|
});
|
|
42838
42677
|
},
|
|
@@ -42871,7 +42710,6 @@ class Transformer extends React__namespace.Component {
|
|
|
42871
42710
|
origOnMoveEnd(args);
|
|
42872
42711
|
}
|
|
42873
42712
|
self.changeTool("dilation", {
|
|
42874
|
-
// $FlowFixMe[incompatible-use]
|
|
42875
42713
|
coord: self.dilationCircle.centerPoint.coord
|
|
42876
42714
|
});
|
|
42877
42715
|
};
|
|
@@ -42991,7 +42829,6 @@ class Transformer extends React__namespace.Component {
|
|
|
42991
42829
|
// handle coordinates in formal mode without movement, since
|
|
42992
42830
|
// the movablepoints never move
|
|
42993
42831
|
shape: {
|
|
42994
|
-
// $FlowFixMe[incompatible-use]
|
|
42995
42832
|
type: this.shape.type,
|
|
42996
42833
|
coords: this.getCoords(),
|
|
42997
42834
|
options: (_this$shape5 = this.shape) === null || _this$shape5 === void 0 ? void 0 : _this$shape5.getOptions()
|
|
@@ -44950,7 +44787,7 @@ class HintsRenderer extends React__namespace.Component {
|
|
|
44950
44787
|
this._cacheHintImages();
|
|
44951
44788
|
}
|
|
44952
44789
|
|
|
44953
|
-
// Force number to make
|
|
44790
|
+
// Force number to make TypeScript happy
|
|
44954
44791
|
const prevHintsVisible = prevProps.hintsVisible || 0;
|
|
44955
44792
|
const nextHintsVisible = this.props.hintsVisible || 0;
|
|
44956
44793
|
|
|
@@ -45211,13 +45048,7 @@ class ItemRenderer extends React__namespace.Component {
|
|
|
45211
45048
|
// that have completely different places in the DOM, we have to do this
|
|
45212
45049
|
// strangeness instead of relying on React's normal render() method.
|
|
45213
45050
|
// TODO(alpert): Figure out how to clean this up somehow
|
|
45214
|
-
render(
|
|
45215
|
-
/*#__PURE__*/
|
|
45216
|
-
// metadata (from item.question, aka PerseusRenderer)
|
|
45217
|
-
// replace (also item.question, aka PerseusRenderer)
|
|
45218
|
-
// savedState (I _think_ this is serializedState on Renderer)
|
|
45219
|
-
// $FlowFixMe[prop-missing] metadata, replace, savedState (see above)
|
|
45220
|
-
React__namespace.createElement(Renderer, _extends({
|
|
45051
|
+
render( /*#__PURE__*/React__namespace.createElement(Renderer, _extends({
|
|
45221
45052
|
ref: node => {
|
|
45222
45053
|
if (!node) {
|
|
45223
45054
|
return;
|
|
@@ -45302,9 +45133,7 @@ class ItemRenderer extends React__namespace.Component {
|
|
|
45302
45133
|
return Util.inputPathsEqual(inputPath, this._currentFocus);
|
|
45303
45134
|
});
|
|
45304
45135
|
if (this.props.apiOptions.onFocusChange != null) {
|
|
45305
|
-
this.props.apiOptions.onFocusChange(this._currentFocus, prevFocus,
|
|
45306
|
-
// $FlowFixMe[incompatible-call]: onFocusChange expects an HTMLElement or nothing
|
|
45307
|
-
didFocusInput && keypadElement && keypadElement.getDOMNode());
|
|
45136
|
+
this.props.apiOptions.onFocusChange(this._currentFocus, prevFocus, didFocusInput && keypadElement && keypadElement.getDOMNode());
|
|
45308
45137
|
}
|
|
45309
45138
|
if (keypadElement) {
|
|
45310
45139
|
if (didFocusInput) {
|
|
@@ -45610,14 +45439,9 @@ class ServerItemRenderer extends React__namespace.Component {
|
|
|
45610
45439
|
return Util.inputPathsEqual(inputPath, this._currentFocus);
|
|
45611
45440
|
});
|
|
45612
45441
|
if (onFocusChange != null) {
|
|
45613
|
-
onFocusChange(this._currentFocus, prevFocus,
|
|
45614
|
-
// $FlowFixMe[incompatible-call]: onFocusChange expects an HTMLElement or nothing
|
|
45615
|
-
didFocusInput && keypadElement && keypadElement.getDOMNode(),
|
|
45616
|
-
// $FlowFixMe[incompatible-call]: onFocusChange expects an HTMLElement or nothing
|
|
45442
|
+
onFocusChange(this._currentFocus, prevFocus, didFocusInput && keypadElement && keypadElement.getDOMNode(),
|
|
45617
45443
|
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'false | Element | Text | null | undefined' is not assignable to parameter of type 'HTMLElement | undefined'.
|
|
45618
|
-
didFocusInput &&
|
|
45619
|
-
// $FlowFixMe[incompatible-call]: onFocusChange expects an HTMLElement or nothing
|
|
45620
|
-
this.questionRenderer.getDOMNodeForPath(newFocus));
|
|
45444
|
+
didFocusInput && this.questionRenderer.getDOMNodeForPath(newFocus));
|
|
45621
45445
|
}
|
|
45622
45446
|
if (keypadElement && isMobile) {
|
|
45623
45447
|
if (didFocusInput) {
|
|
@@ -46857,7 +46681,7 @@ class MultiRenderer extends React__namespace.Component {
|
|
|
46857
46681
|
// were to change every render, it would cause the Renderer to
|
|
46858
46682
|
// re-render a lot more than is necessary. Don't re-compute this
|
|
46859
46683
|
// element unless it is necessary!
|
|
46860
|
-
// HACK(mdr):
|
|
46684
|
+
// HACK(mdr): TypeScript can't prove that this is a ContentRendererData,
|
|
46861
46685
|
// because of how we awkwardly construct it in order to obtain a
|
|
46862
46686
|
// circular reference. But it is, I promise.
|
|
46863
46687
|
const data = {
|
|
@@ -46877,7 +46701,6 @@ class MultiRenderer extends React__namespace.Component {
|
|
|
46877
46701
|
* one to one could introduce a bug. Need to work out the exact
|
|
46878
46702
|
* type for ContentNode and then fix this.
|
|
46879
46703
|
*/
|
|
46880
|
-
// $FlowFixMe[cannot-spread-inexact]
|
|
46881
46704
|
// @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">>'.
|
|
46882
46705
|
React__namespace.createElement(Renderer, _extends({}, this._getRendererProps(), content, {
|
|
46883
46706
|
ref: refFunc,
|
|
@@ -47121,7 +46944,7 @@ const styles = aphrodite.StyleSheet.create({
|
|
|
47121
46944
|
* Utility functions to build React PropTypes for multi-items and shapes.
|
|
47122
46945
|
*
|
|
47123
46946
|
* If you're writing new components, though, consider using the Item and Shape
|
|
47124
|
-
*
|
|
46947
|
+
* types instead.
|
|
47125
46948
|
*/
|
|
47126
46949
|
|
|
47127
46950
|
/**
|