@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/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
|
}
|
|
@@ -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
|
}
|
|
@@ -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),
|
|
@@ -23274,7 +23241,7 @@ const BaseRadio = function BaseRadio(props) {
|
|
|
23274
23241
|
aphroditeClassName(true);
|
|
23275
23242
|
let correctnessClass;
|
|
23276
23243
|
// reviewMode is only true if there's a rubric
|
|
23277
|
-
// but
|
|
23244
|
+
// but TypeScript doesn't understand that
|
|
23278
23245
|
if (reviewMode && reviewModeRubric) {
|
|
23279
23246
|
correctnessClass = reviewModeRubric.choices[i].correct ? ClassNames.CORRECT : ClassNames.INCORRECT;
|
|
23280
23247
|
}
|
|
@@ -25018,7 +24985,6 @@ class GradedGroup extends React.Component {
|
|
|
25018
24985
|
}
|
|
25019
24986
|
const mobileClass = this.props.inGradedGroupSet ? css(styles$l.gradedGroupInSet) : css(styles$l.gradedGroup);
|
|
25020
24987
|
const classes = classNames({
|
|
25021
|
-
// $FlowFixMe[invalid-computed-prop]
|
|
25022
24988
|
[mobileClass]: apiOptions.isMobile,
|
|
25023
24989
|
"perseus-graded-group": true,
|
|
25024
24990
|
"answer-correct": apiOptions.isMobile ? false : this.state.status === GRADING_STATUSES.correct,
|
|
@@ -25271,7 +25237,6 @@ class GradedGroupSet extends React.Component {
|
|
|
25271
25237
|
/*#__PURE__*/
|
|
25272
25238
|
// TODO(jeremy): Don't spread this.props, instead
|
|
25273
25239
|
// pass in all props GradedGroup needs explicilty
|
|
25274
|
-
// $FlowFixMe[prop-missing]
|
|
25275
25240
|
// @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call.
|
|
25276
25241
|
React.createElement(GradedGroup, _extends({
|
|
25277
25242
|
key: i
|
|
@@ -25310,12 +25275,8 @@ class GradedGroupSet extends React.Component {
|
|
|
25310
25275
|
ref: comp => this._childGroup = comp
|
|
25311
25276
|
// We should pass in the set of props explicitly
|
|
25312
25277
|
}, this.props, currentGroup, {
|
|
25313
|
-
inGradedGroupSet: true
|
|
25314
|
-
|
|
25315
|
-
,
|
|
25316
|
-
title: null
|
|
25317
|
-
// $FlowFixMe[incompatible-type]
|
|
25318
|
-
,
|
|
25278
|
+
inGradedGroupSet: true,
|
|
25279
|
+
title: null,
|
|
25319
25280
|
onNextQuestion: handleNextQuestion,
|
|
25320
25281
|
linterContext: this.props.linterContext
|
|
25321
25282
|
})));
|
|
@@ -25588,7 +25549,6 @@ const Linear = _.extend({}, PlotDefaults, {
|
|
|
25588
25549
|
const Quadratic = _.extend({}, PlotDefaults, {
|
|
25589
25550
|
url: "https://ka-perseus-graphie.s3.amazonaws.com/e23d36e6fc29ee37174e92c9daba2a66677128ab.png",
|
|
25590
25551
|
defaultCoords: [[0.5, 0.5], [0.75, 0.75]],
|
|
25591
|
-
// $FlowFixMe[prop-missing]
|
|
25592
25552
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'Parabola' does not exist on type 'typeof Graphie'.
|
|
25593
25553
|
Movable: Graphie.Parabola,
|
|
25594
25554
|
getCoefficients: function (coords) {
|
|
@@ -25629,7 +25589,6 @@ const Quadratic = _.extend({}, PlotDefaults, {
|
|
|
25629
25589
|
const Sinusoid = _.extend({}, PlotDefaults, {
|
|
25630
25590
|
url: "https://ka-perseus-graphie.s3.amazonaws.com/3d68e7718498475f53b206c2ab285626baf8857e.png",
|
|
25631
25591
|
defaultCoords: [[0.5, 0.5], [0.6, 0.6]],
|
|
25632
|
-
// $FlowFixMe[prop-missing]
|
|
25633
25592
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'Sinusoid' does not exist on type 'typeof Graphie'.
|
|
25634
25593
|
Movable: Graphie.Sinusoid,
|
|
25635
25594
|
getCoefficients: function (coords) {
|
|
@@ -25869,7 +25828,7 @@ const functionTypeMapping = {
|
|
|
25869
25828
|
const allTypes = _.keys(functionTypeMapping);
|
|
25870
25829
|
function functionForType(
|
|
25871
25830
|
// TODO(jeremy): Actually `$Keys<typeof functionTypeMapping>` but that
|
|
25872
|
-
// triggers
|
|
25831
|
+
// triggers TypeScript to require all of our Plot types to be fully typed which
|
|
25873
25832
|
// is a big amount of work/change.
|
|
25874
25833
|
type) {
|
|
25875
25834
|
return functionTypeMapping[type];
|
|
@@ -26113,10 +26072,8 @@ class FunctionGrapher extends React.Component {
|
|
|
26113
26072
|
});
|
|
26114
26073
|
},
|
|
26115
26074
|
constraints: [
|
|
26116
|
-
// $FlowFixMe[prop-missing]
|
|
26117
26075
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
26118
26076
|
Interactive2.MovableLine.constraints.bound(),
|
|
26119
|
-
// $FlowFixMe[prop-missing]
|
|
26120
26077
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
26121
26078
|
Interactive2.MovableLine.constraints.snap(), (newCoord, oldCoord) => {
|
|
26122
26079
|
// Calculate and apply proposed displacement
|
|
@@ -26150,10 +26107,8 @@ class FunctionGrapher extends React.Component {
|
|
|
26150
26107
|
coord: coord,
|
|
26151
26108
|
static: this.props.static,
|
|
26152
26109
|
constraints: [
|
|
26153
|
-
// $FlowFixMe[prop-missing]
|
|
26154
26110
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
26155
26111
|
Interactive2.MovablePoint.constraints.bound(),
|
|
26156
|
-
// $FlowFixMe[prop-missing]
|
|
26157
26112
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
26158
26113
|
Interactive2.MovablePoint.constraints.snap(), coord => {
|
|
26159
26114
|
// Always enforce that this is a function
|
|
@@ -26211,7 +26166,6 @@ class FunctionGrapher extends React.Component {
|
|
|
26211
26166
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'Element' is not assignable to type 'null'.
|
|
26212
26167
|
image =
|
|
26213
26168
|
/*#__PURE__*/
|
|
26214
|
-
// $FlowFixMe[prop-missing]: alt props is missing
|
|
26215
26169
|
// @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
26170
|
React.createElement(SvgImage, {
|
|
26217
26171
|
src: imageDescription.url,
|
|
@@ -27091,9 +27045,7 @@ class Interaction extends React.Component {
|
|
|
27091
27045
|
functions: this.state.functions
|
|
27092
27046
|
});
|
|
27093
27047
|
compiledVars[name] = function (x) {
|
|
27094
|
-
return func(
|
|
27095
|
-
// $FlowFixMe[extra-arg]
|
|
27096
|
-
_.extend({}, compiledVars, {
|
|
27048
|
+
return func(_.extend({}, compiledVars, {
|
|
27097
27049
|
x: x
|
|
27098
27050
|
}));
|
|
27099
27051
|
};
|
|
@@ -27804,7 +27756,6 @@ class Graph extends React.Component {
|
|
|
27804
27756
|
const scale = this.props.box[0] / interactiveSizes$1.defaultBoxSize;
|
|
27805
27757
|
image =
|
|
27806
27758
|
/*#__PURE__*/
|
|
27807
|
-
// $FlowFixMe[prop-missing]: `alt` is missing
|
|
27808
27759
|
// @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
27760
|
React.createElement(SvgImage, {
|
|
27810
27761
|
src: imageData.url,
|
|
@@ -27822,15 +27773,12 @@ class Graph extends React.Component {
|
|
|
27822
27773
|
width: this.props.box[0],
|
|
27823
27774
|
height: this.props.box[1]
|
|
27824
27775
|
}
|
|
27825
|
-
// $FlowFixMe[prop-missing]: This can probably be removed
|
|
27826
27776
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'onMouseOut' does not exist on type 'Graph'.
|
|
27827
27777
|
,
|
|
27828
27778
|
onMouseOut: this.onMouseOut
|
|
27829
|
-
// $FlowFixMe[prop-missing]: This can probably be removed
|
|
27830
27779
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'onMouseOver' does not exist on type 'Graph'.
|
|
27831
27780
|
,
|
|
27832
27781
|
onMouseOver: this.onMouseOver
|
|
27833
|
-
// $FlowFixMe[prop-missing]: This can probably be removed
|
|
27834
27782
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'onClick' does not exist on type 'Graph'.
|
|
27835
27783
|
,
|
|
27836
27784
|
onClick: this.onClick
|
|
@@ -28324,10 +28272,8 @@ class InteractiveGraph extends React.Component {
|
|
|
28324
28272
|
return Interactive2.addMaybeMobileMovablePoint(this, {
|
|
28325
28273
|
coord: coord,
|
|
28326
28274
|
constraints: [
|
|
28327
|
-
// $FlowFixMe[prop-missing]
|
|
28328
28275
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28329
28276
|
Interactive2.MovablePoint.constraints.bound(),
|
|
28330
|
-
// $FlowFixMe[prop-missing]
|
|
28331
28277
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28332
28278
|
Interactive2.MovablePoint.constraints.snap()],
|
|
28333
28279
|
onMove: () => {
|
|
@@ -28385,7 +28331,6 @@ class InteractiveGraph extends React.Component {
|
|
|
28385
28331
|
}
|
|
28386
28332
|
const onMoveHandler = () => {
|
|
28387
28333
|
const graph = _.extend({}, this.props.graph, {
|
|
28388
|
-
// $FlowFixMe[incompatible-use]
|
|
28389
28334
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'. | TS2531 - Object is possibly 'null'. | TS2531 - Object is possibly 'null'.
|
|
28390
28335
|
coords: [pointA.coord(), pointB.coord(), pointC.coord()]
|
|
28391
28336
|
});
|
|
@@ -28402,17 +28347,13 @@ class InteractiveGraph extends React.Component {
|
|
|
28402
28347
|
pointA = this.pointA = Interactive2.addMaybeMobileMovablePoint(this, {
|
|
28403
28348
|
coord: coords[0],
|
|
28404
28349
|
constraints: [
|
|
28405
|
-
// $FlowFixMe[prop-missing]
|
|
28406
28350
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28407
28351
|
Interactive2.MovablePoint.constraints.bound(),
|
|
28408
|
-
// $FlowFixMe[prop-missing]
|
|
28409
28352
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28410
28353
|
Interactive2.MovablePoint.constraints.snap(), coord => {
|
|
28411
28354
|
return !pointA ||
|
|
28412
|
-
// $FlowFixMe[incompatible-use]
|
|
28413
28355
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
|
|
28414
28356
|
coord[0] !== pointB.coord()[0] &&
|
|
28415
|
-
// $FlowFixMe[incompatible-use]
|
|
28416
28357
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
|
|
28417
28358
|
coord[0] !== pointC.coord()[0];
|
|
28418
28359
|
}],
|
|
@@ -28426,17 +28367,13 @@ class InteractiveGraph extends React.Component {
|
|
|
28426
28367
|
pointB = this.pointB = Interactive2.addMaybeMobileMovablePoint(this, {
|
|
28427
28368
|
coord: coords[1],
|
|
28428
28369
|
constraints: [
|
|
28429
|
-
// $FlowFixMe[prop-missing]
|
|
28430
28370
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28431
28371
|
Interactive2.MovablePoint.constraints.bound(),
|
|
28432
|
-
// $FlowFixMe[prop-missing]
|
|
28433
28372
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28434
28373
|
Interactive2.MovablePoint.constraints.snap(), coord => {
|
|
28435
28374
|
return !pointB ||
|
|
28436
|
-
// $FlowFixMe[incompatible-use]
|
|
28437
28375
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
|
|
28438
28376
|
coord[0] !== pointA.coord()[0] &&
|
|
28439
|
-
// $FlowFixMe[incompatible-use]
|
|
28440
28377
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
|
|
28441
28378
|
coord[0] !== pointC.coord()[0];
|
|
28442
28379
|
}],
|
|
@@ -28450,17 +28387,13 @@ class InteractiveGraph extends React.Component {
|
|
|
28450
28387
|
pointC = this.pointC = Interactive2.addMaybeMobileMovablePoint(this, {
|
|
28451
28388
|
coord: coords[2],
|
|
28452
28389
|
constraints: [
|
|
28453
|
-
// $FlowFixMe[prop-missing]
|
|
28454
28390
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28455
28391
|
Interactive2.MovablePoint.constraints.bound(),
|
|
28456
|
-
// $FlowFixMe[prop-missing]
|
|
28457
28392
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28458
28393
|
Interactive2.MovablePoint.constraints.snap(), coord => {
|
|
28459
28394
|
return !pointC ||
|
|
28460
|
-
// $FlowFixMe[incompatible-use]
|
|
28461
28395
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
|
|
28462
28396
|
coord[0] !== pointA.coord()[0] &&
|
|
28463
|
-
// $FlowFixMe[incompatible-use]
|
|
28464
28397
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
|
|
28465
28398
|
coord[0] !== pointB.coord()[0];
|
|
28466
28399
|
}],
|
|
@@ -28515,7 +28448,6 @@ class InteractiveGraph extends React.Component {
|
|
|
28515
28448
|
}
|
|
28516
28449
|
const onMoveHandler = () => {
|
|
28517
28450
|
const graph = _.extend({}, this.props.graph, {
|
|
28518
|
-
// $FlowFixMe[incompatible-use]
|
|
28519
28451
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
|
|
28520
28452
|
coords: [pointA.coord(), pointB.coord()]
|
|
28521
28453
|
});
|
|
@@ -28532,10 +28464,8 @@ class InteractiveGraph extends React.Component {
|
|
|
28532
28464
|
pointA = this.pointA = Interactive2.addMaybeMobileMovablePoint(this, {
|
|
28533
28465
|
coord: coords[0],
|
|
28534
28466
|
constraints: [
|
|
28535
|
-
// $FlowFixMe[prop-missing]
|
|
28536
28467
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28537
28468
|
Interactive2.MovablePoint.constraints.bound(),
|
|
28538
|
-
// $FlowFixMe[prop-missing]
|
|
28539
28469
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28540
28470
|
Interactive2.MovablePoint.constraints.snap(), coord => {
|
|
28541
28471
|
return !pointA || coord[0] !== pointB.coord()[0];
|
|
@@ -28545,10 +28475,8 @@ class InteractiveGraph extends React.Component {
|
|
|
28545
28475
|
const pointB = this.pointB = Interactive2.addMaybeMobileMovablePoint(this, {
|
|
28546
28476
|
coord: coords[1],
|
|
28547
28477
|
constraints: [
|
|
28548
|
-
// $FlowFixMe[prop-missing]
|
|
28549
28478
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28550
28479
|
Interactive2.MovablePoint.constraints.bound(),
|
|
28551
|
-
// $FlowFixMe[prop-missing]
|
|
28552
28480
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28553
28481
|
Interactive2.MovablePoint.constraints.snap(), coord => {
|
|
28554
28482
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'coord' does not exist on type 'never'.
|
|
@@ -28608,9 +28536,7 @@ class InteractiveGraph extends React.Component {
|
|
|
28608
28536
|
});
|
|
28609
28537
|
$(circle).on("move", () => {
|
|
28610
28538
|
const graph = _.extend({}, this.props.graph, {
|
|
28611
|
-
// $FlowFixMe[incompatible-use]
|
|
28612
28539
|
center: circle.center,
|
|
28613
|
-
// $FlowFixMe[incompatible-use]
|
|
28614
28540
|
radius: circle.radius
|
|
28615
28541
|
});
|
|
28616
28542
|
this.onChange({
|
|
@@ -28637,10 +28563,8 @@ class InteractiveGraph extends React.Component {
|
|
|
28637
28563
|
segmentPoints.push(Interactive2.addMaybeMobileMovablePoint(this, {
|
|
28638
28564
|
coord: coord,
|
|
28639
28565
|
constraints: [
|
|
28640
|
-
// $FlowFixMe[prop-missing]
|
|
28641
28566
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28642
28567
|
Interactive2.MovablePoint.constraints.bound(),
|
|
28643
|
-
// $FlowFixMe[prop-missing]
|
|
28644
28568
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28645
28569
|
Interactive2.MovablePoint.constraints.snap(), coord => {
|
|
28646
28570
|
const otherSegment = segmentPoints[1 - i];
|
|
@@ -28691,12 +28615,7 @@ class InteractiveGraph extends React.Component {
|
|
|
28691
28615
|
}
|
|
28692
28616
|
const graphie = this.graphie;
|
|
28693
28617
|
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
|
-
);
|
|
28618
|
+
return screenPoint[0] >= graphie.xpixels - 40 && screenPoint[1] >= graphie.ypixels - 40;
|
|
28700
28619
|
};
|
|
28701
28620
|
this.createPointForPointsType = (coord, i) => {
|
|
28702
28621
|
const self = this;
|
|
@@ -28723,10 +28642,8 @@ class InteractiveGraph extends React.Component {
|
|
|
28723
28642
|
point$1 = Interactive2.addMaybeMobileMovablePoint(this, _extends({
|
|
28724
28643
|
coord: coord,
|
|
28725
28644
|
constraints: [
|
|
28726
|
-
// $FlowFixMe[prop-missing]
|
|
28727
28645
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28728
28646
|
Interactive2.MovablePoint.constraints.bound(),
|
|
28729
|
-
// $FlowFixMe[prop-missing]
|
|
28730
28647
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
28731
28648
|
Interactive2.MovablePoint.constraints.snap(), function (coord) {
|
|
28732
28649
|
// TODO(jack): There ought to be a
|
|
@@ -29013,10 +28930,8 @@ class InteractiveGraph extends React.Component {
|
|
|
29013
28930
|
const point$1 = Interactive2.addMaybeMobileMovablePoint(this, _extends({
|
|
29014
28931
|
coord: coord,
|
|
29015
28932
|
constraints: [
|
|
29016
|
-
// $FlowFixMe[prop-missing]
|
|
29017
28933
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
29018
28934
|
Interactive2.MovablePoint.constraints.bound(), snapToGrid ?
|
|
29019
|
-
// $FlowFixMe[prop-missing]
|
|
29020
28935
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
29021
28936
|
Interactive2.MovablePoint.constraints.snap() : null, graphConstraint],
|
|
29022
28937
|
onMoveStart: () => {
|
|
@@ -29111,10 +29026,8 @@ class InteractiveGraph extends React.Component {
|
|
|
29111
29026
|
points.push(createPoint({
|
|
29112
29027
|
coord: coord,
|
|
29113
29028
|
constraints: [
|
|
29114
|
-
// $FlowFixMe[prop-missing]
|
|
29115
29029
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
29116
29030
|
Interactive2.MovablePoint.constraints.bound(),
|
|
29117
|
-
// $FlowFixMe[prop-missing]
|
|
29118
29031
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
29119
29032
|
Interactive2.MovablePoint.constraints.snap(), coord => {
|
|
29120
29033
|
const otherPoint = points[1 - _i];
|
|
@@ -29136,14 +29049,11 @@ class InteractiveGraph extends React.Component {
|
|
|
29136
29049
|
points: points,
|
|
29137
29050
|
static: false,
|
|
29138
29051
|
constraints: [
|
|
29139
|
-
// $FlowFixMe[prop-missing]
|
|
29140
29052
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
29141
29053
|
Interactive2.MovableLine.constraints.bound(),
|
|
29142
|
-
// $FlowFixMe[prop-missing]
|
|
29143
29054
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
29144
29055
|
Interactive2.MovableLine.constraints.snap()],
|
|
29145
29056
|
onMove: [
|
|
29146
|
-
// $FlowFixMe[prop-missing]
|
|
29147
29057
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'onMove' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
29148
29058
|
Interactive2.MovableLine.onMove.updatePoints, updateCoordProps],
|
|
29149
29059
|
normalStyle: _extends({
|
|
@@ -29236,10 +29146,8 @@ class InteractiveGraph extends React.Component {
|
|
|
29236
29146
|
const self = this;
|
|
29237
29147
|
self.polygon = Interactive2.addMovablePolygon(graphie, {
|
|
29238
29148
|
constraints: [
|
|
29239
|
-
// $FlowFixMe[prop-missing]
|
|
29240
29149
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => undefined'.
|
|
29241
29150
|
Interactive2.MovablePolygon.constraints.bound(), snapToGrid ?
|
|
29242
|
-
// $FlowFixMe[prop-missing]
|
|
29243
29151
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => undefined'.
|
|
29244
29152
|
Interactive2.MovablePolygon.constraints.snap() : null],
|
|
29245
29153
|
closed: closed,
|
|
@@ -29249,7 +29157,6 @@ class InteractiveGraph extends React.Component {
|
|
|
29249
29157
|
numArcs: numArcs,
|
|
29250
29158
|
sideLabels: sideLabels,
|
|
29251
29159
|
onMove: [
|
|
29252
|
-
// $FlowFixMe[prop-missing]
|
|
29253
29160
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'onMove' does not exist on type '(graphie: any, movable: any, options: any) => undefined'.
|
|
29254
29161
|
Interactive2.MovablePolygon.onMove.updatePoints, function () {
|
|
29255
29162
|
// @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
@@ -29479,7 +29386,6 @@ class InteractiveGraph extends React.Component {
|
|
|
29479
29386
|
*/
|
|
29480
29387
|
static getLineCoords(graph, props) {
|
|
29481
29388
|
return (
|
|
29482
|
-
// $FlowFixMe[incompatible-return]
|
|
29483
29389
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'coords' does not exist on type 'PerseusGraphType'.
|
|
29484
29390
|
graph.coords || InteractiveGraph.pointsFromNormalized(props, [[0.25, 0.75], [0.75, 0.75]])
|
|
29485
29391
|
);
|
|
@@ -29534,7 +29440,6 @@ class InteractiveGraph extends React.Component {
|
|
|
29534
29440
|
static getLinearSystemCoords(graph, props) {
|
|
29535
29441
|
return (
|
|
29536
29442
|
// The callers assume that we're return an array of points
|
|
29537
|
-
// $FlowFixMe[incompatible-return]
|
|
29538
29443
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'coords' does not exist on type 'PerseusGraphType'.
|
|
29539
29444
|
graph.coords || _.map([[[0.25, 0.75], [0.75, 0.75]], [[0.25, 0.25], [0.75, 0.25]]], coords => {
|
|
29540
29445
|
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'number[][]' is not assignable to parameter of type 'readonly Coord[]'.
|
|
@@ -29590,17 +29495,11 @@ class InteractiveGraph extends React.Component {
|
|
|
29590
29495
|
const n = graph.numSegments || 1;
|
|
29591
29496
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'number[] | undefined' is not assignable to type 'readonly number[]'.
|
|
29592
29497
|
const ys = {
|
|
29593
|
-
// $FlowFixMe[unsupported-syntax]
|
|
29594
29498
|
1: [5],
|
|
29595
|
-
// $FlowFixMe[unsupported-syntax]
|
|
29596
29499
|
2: [5, -5],
|
|
29597
|
-
// $FlowFixMe[unsupported-syntax]
|
|
29598
29500
|
3: [5, 0, -5],
|
|
29599
|
-
// $FlowFixMe[unsupported-syntax]
|
|
29600
29501
|
4: [6, 2, -2, -6],
|
|
29601
|
-
// $FlowFixMe[unsupported-syntax]
|
|
29602
29502
|
5: [6, 3, 0, -3, -6],
|
|
29603
|
-
// $FlowFixMe[unsupported-syntax]
|
|
29604
29503
|
6: [5, 3, 1, -1, -3, -5]
|
|
29605
29504
|
}[n];
|
|
29606
29505
|
const range = [[-10, 10], [-10, 10]];
|
|
@@ -29804,7 +29703,6 @@ class InteractiveGraph extends React.Component {
|
|
|
29804
29703
|
// If both of the guess points are on the correct line, it's
|
|
29805
29704
|
// correct.
|
|
29806
29705
|
if (
|
|
29807
|
-
// $FlowFixMe[incompatible-use] - Fix type so coords can't be omitted
|
|
29808
29706
|
// @ts-expect-error [FEI-5003] - TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'.
|
|
29809
29707
|
collinear(correct[0], correct[1], guess[0]) &&
|
|
29810
29708
|
// @ts-expect-error [FEI-5003] - TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'.
|
|
@@ -29831,8 +29729,6 @@ class InteractiveGraph extends React.Component {
|
|
|
29831
29729
|
// If the parabola coefficients match, it's correct.
|
|
29832
29730
|
const guessCoeffs = this.getQuadraticCoefficients(state.coords);
|
|
29833
29731
|
const correctCoeffs = this.getQuadraticCoefficients(
|
|
29834
|
-
// $FlowFixMe[incompatible-call]
|
|
29835
|
-
// $FlowFixMe[prop-missing]
|
|
29836
29732
|
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'readonly Coord[] | undefined' is not assignable to parameter of type 'readonly Coord[]'.
|
|
29837
29733
|
rubric.correct.coords);
|
|
29838
29734
|
if (deepEq$2(guessCoeffs, correctCoeffs)) {
|
|
@@ -29846,8 +29742,6 @@ class InteractiveGraph extends React.Component {
|
|
|
29846
29742
|
} else if (state.type === "sinusoid" && rubric.correct.type === "sinusoid" && state.coords != null) {
|
|
29847
29743
|
const guessCoeffs = this.getSinusoidCoefficients(state.coords);
|
|
29848
29744
|
const correctCoeffs = this.getSinusoidCoefficients(
|
|
29849
|
-
// $FlowFixMe[incompatible-call]
|
|
29850
|
-
// $FlowFixMe[prop-missing]
|
|
29851
29745
|
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'readonly Coord[] | undefined' is not assignable to parameter of type 'readonly Coord[]'.
|
|
29852
29746
|
rubric.correct.coords);
|
|
29853
29747
|
const canonicalGuessCoeffs = canonicalSineCoefficients(guessCoeffs);
|
|
@@ -29862,9 +29756,7 @@ class InteractiveGraph extends React.Component {
|
|
|
29862
29756
|
};
|
|
29863
29757
|
}
|
|
29864
29758
|
} 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)) {
|
|
29759
|
+
if (deepEq$2(state.center, rubric.correct.center) && eq(state.radius, rubric.correct.radius)) {
|
|
29868
29760
|
return {
|
|
29869
29761
|
type: "points",
|
|
29870
29762
|
earned: 1,
|
|
@@ -29937,10 +29829,8 @@ class InteractiveGraph extends React.Component {
|
|
|
29937
29829
|
const guess = state.coords;
|
|
29938
29830
|
const correct = rubric.correct.coords;
|
|
29939
29831
|
if (
|
|
29940
|
-
// $FlowFixMe[incompatible-use]
|
|
29941
29832
|
// @ts-expect-error [FEI-5003] - TS2532 - Object is possibly 'undefined'.
|
|
29942
29833
|
deepEq$2(guess[0], correct[0]) &&
|
|
29943
|
-
// $FlowFixMe[incompatible-use]
|
|
29944
29834
|
// @ts-expect-error [FEI-5003] - TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'.
|
|
29945
29835
|
collinear(correct[0], correct[1], guess[1])) {
|
|
29946
29836
|
return {
|
|
@@ -29970,13 +29860,10 @@ class InteractiveGraph extends React.Component {
|
|
|
29970
29860
|
} else {
|
|
29971
29861
|
/* exact */
|
|
29972
29862
|
match =
|
|
29973
|
-
// $FlowFixMe[incompatible-use]
|
|
29974
29863
|
// @ts-expect-error [FEI-5003] - TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'.
|
|
29975
29864
|
deepEq$2(guess[1], correct[1]) &&
|
|
29976
|
-
// $FlowFixMe[incompatible-use]
|
|
29977
29865
|
// @ts-expect-error [FEI-5003] - TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'.
|
|
29978
29866
|
collinear(correct[1], correct[0], guess[0]) &&
|
|
29979
|
-
// $FlowFixMe[incompatible-use]
|
|
29980
29867
|
// @ts-expect-error [FEI-5003] - TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'.
|
|
29981
29868
|
collinear(correct[1], correct[2], guess[2]);
|
|
29982
29869
|
}
|
|
@@ -30015,7 +29902,6 @@ InteractiveGraph.defaultProps = {
|
|
|
30015
29902
|
labels: ["x", "y"],
|
|
30016
29903
|
range: [[-10, 10], [-10, 10]],
|
|
30017
29904
|
step: [1, 1],
|
|
30018
|
-
// $FlowFixMe[prop-missing]
|
|
30019
29905
|
// @ts-expect-error [FEI-5003] - TS2739 - Type '{ readonly url: null; }' is missing the following properties from type 'PerseusImageBackground': width, height
|
|
30020
29906
|
backgroundImage: defaultBackgroundImage$1,
|
|
30021
29907
|
markings: "graph",
|
|
@@ -31697,7 +31583,7 @@ class LabelImage extends React.Component {
|
|
|
31697
31583
|
this.handleDocumentClick = e => {
|
|
31698
31584
|
// Dismiss open popup with answer choices if user clicks outside it.
|
|
31699
31585
|
if (this._selectedMarkerPopup && this._answerChoices) {
|
|
31700
|
-
const answerChoices =
|
|
31586
|
+
const answerChoices = ReactDOM.findDOMNode(this._answerChoices);
|
|
31701
31587
|
const targetElement = e.target;
|
|
31702
31588
|
// HACK(michaelpolyak): We want to determine if the click target is
|
|
31703
31589
|
// contained within the popup layer. As there's no public interface
|
|
@@ -31788,7 +31674,7 @@ class LabelImage extends React.Component {
|
|
|
31788
31674
|
// Set focus on the just-deselected-marker, to enable to resume
|
|
31789
31675
|
// navigating between the markers using the keyboard.
|
|
31790
31676
|
if (marker) {
|
|
31791
|
-
|
|
31677
|
+
ReactDOM.findDOMNode(marker).focus();
|
|
31792
31678
|
}
|
|
31793
31679
|
});
|
|
31794
31680
|
}
|
|
@@ -31878,7 +31764,7 @@ class LabelImage extends React.Component {
|
|
|
31878
31764
|
// @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
31765
|
navigateDirection, markers, index)];
|
|
31880
31766
|
if (marker) {
|
|
31881
|
-
|
|
31767
|
+
ReactDOM.findDOMNode(marker).focus();
|
|
31882
31768
|
}
|
|
31883
31769
|
}
|
|
31884
31770
|
handleAnswerChoicesChangeForMarker(index, selection) {
|
|
@@ -33327,8 +33213,6 @@ class NumberInput extends React.Component {
|
|
|
33327
33213
|
};
|
|
33328
33214
|
this.getValue = () => {
|
|
33329
33215
|
return this.parseInputValue(
|
|
33330
|
-
// $FlowFixMe[incompatible-use]
|
|
33331
|
-
// $FlowFixMe[prop-missing]
|
|
33332
33216
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'. | TS2339 - Property 'value' does not exist on type 'Element | Text'.
|
|
33333
33217
|
ReactDOM__default.findDOMNode(this.refs.input).value // eslint-disable-line react/no-string-refs
|
|
33334
33218
|
);
|
|
@@ -35141,14 +35025,10 @@ const TickMarks = Graphie.createSimpleClass((graphie, props) => {
|
|
|
35141
35025
|
// Render the text labels
|
|
35142
35026
|
results.push(graphie.style(props.isMobile ? {
|
|
35143
35027
|
color: KhanColors.BLUE_D
|
|
35144
|
-
} : {},
|
|
35145
|
-
// $FlowFixMe[incompatible-call]
|
|
35146
|
-
() => _label(graphie, props.labelStyle, leftLabel, leftLabel, base)));
|
|
35028
|
+
} : {}, () => _label(graphie, props.labelStyle, leftLabel, leftLabel, base)));
|
|
35147
35029
|
results.push(graphie.style(props.isMobile ? {
|
|
35148
35030
|
color: KhanColors.BLUE_D
|
|
35149
|
-
} : {}, () =>
|
|
35150
|
-
// $FlowFixMe[incompatible-call]
|
|
35151
|
-
_label(graphie, props.labelStyle, rightLabel, rightLabel, base)));
|
|
35031
|
+
} : {}, () => _label(graphie, props.labelStyle, rightLabel, rightLabel, base)));
|
|
35152
35032
|
|
|
35153
35033
|
// Render the labels' lines
|
|
35154
35034
|
graphie.style({
|
|
@@ -35830,10 +35710,7 @@ class Orderer extends React.Component {
|
|
|
35830
35710
|
current: list,
|
|
35831
35711
|
dragging: true,
|
|
35832
35712
|
placeholderIndex: placeholderIndex,
|
|
35833
|
-
// $FlowFixMe[prop-missing]
|
|
35834
|
-
// $FlowFixMe[incompatible-use]
|
|
35835
35713
|
dragKey: opt.key,
|
|
35836
|
-
// $FlowFixMe[incompatible-use]
|
|
35837
35714
|
dragContent: opt.content,
|
|
35838
35715
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'width' does not exist on type 'JQueryStatic'.
|
|
35839
35716
|
dragWidth: $draggable.width(),
|
|
@@ -37169,7 +37046,7 @@ class SelectionTracker extends React.PureComponent {
|
|
|
37169
37046
|
}
|
|
37170
37047
|
|
|
37171
37048
|
// NOTE(mdr): The focus node is guaranteed to exist, because
|
|
37172
|
-
// there's a range, but the
|
|
37049
|
+
// there's a range, but the type annotations for
|
|
37173
37050
|
// Selection don't know that. Cast it ourselves.
|
|
37174
37051
|
const focusNode = selection.focusNode;
|
|
37175
37052
|
const focusOffset = selection.focusOffset;
|
|
@@ -37291,23 +37168,8 @@ class HighlightingUI extends React.PureComponent {
|
|
|
37291
37168
|
zIndexes: this.props.zIndexes
|
|
37292
37169
|
}), this._selectionIsValid(trackedSelection) && !userIsMouseSelecting && /*#__PURE__*/React.createElement(HighlightTooltip, {
|
|
37293
37170
|
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
|
-
,
|
|
37171
|
+
onClick: () => this._handleAddHighlight(trackedSelection.proposedHighlight),
|
|
37172
|
+
focusNode: trackedSelection.focusNode,
|
|
37311
37173
|
focusOffset: trackedSelection.focusOffset,
|
|
37312
37174
|
offsetParent: this.props.offsetParent
|
|
37313
37175
|
})));
|
|
@@ -37394,11 +37256,7 @@ class WordIndexer extends React.PureComponent {
|
|
|
37394
37256
|
let newTrailingWordRange = null;
|
|
37395
37257
|
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'string | null' is not assignable to parameter of type 'string'.
|
|
37396
37258
|
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
37259
|
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
37260
|
const endOffset = wordMatch.index + wordMatch[0].length;
|
|
37403
37261
|
let range;
|
|
37404
37262
|
if (startOffset === 0 && trailingWordRange) {
|
|
@@ -37680,7 +37538,7 @@ const rules = {
|
|
|
37680
37538
|
|
|
37681
37539
|
// A "magic" capture that matches the opening {{
|
|
37682
37540
|
// but captures the full ref text internally :D
|
|
37683
|
-
// unfortunately the "magic" makes
|
|
37541
|
+
// unfortunately the "magic" makes TypeScript upset,
|
|
37684
37542
|
// so there's this questionable workaround
|
|
37685
37543
|
capture[1] = source.slice(2, closeIndex);
|
|
37686
37544
|
return capture;
|
|
@@ -38057,7 +37915,7 @@ class Passage extends React.Component {
|
|
|
38057
37915
|
});
|
|
38058
37916
|
}
|
|
38059
37917
|
_measureLines() {
|
|
38060
|
-
const renderer =
|
|
37918
|
+
const renderer = ReactDOM.findDOMNode(this._contentRef);
|
|
38061
37919
|
// @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call. | TS2339 - Property 'height' does not exist on type 'JQueryStatic'.
|
|
38062
37920
|
const contentsHeight = $(renderer).height();
|
|
38063
37921
|
const lineHeight = this._getLineHeight();
|
|
@@ -38111,7 +37969,7 @@ class Passage extends React.Component {
|
|
|
38111
37969
|
}
|
|
38112
37970
|
|
|
38113
37971
|
// @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call.
|
|
38114
|
-
const $ref = $(
|
|
37972
|
+
const $ref = $(ReactDOM.findDOMNode(ref));
|
|
38115
37973
|
// We really care about the first text after the ref, not the
|
|
38116
37974
|
// ref element itself:
|
|
38117
37975
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'next' does not exist on type 'JQueryStatic'.
|
|
@@ -38132,7 +37990,7 @@ class Passage extends React.Component {
|
|
|
38132
37990
|
}
|
|
38133
37991
|
|
|
38134
37992
|
// @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call.
|
|
38135
|
-
const $ref = $(
|
|
37993
|
+
const $ref = $(ReactDOM.findDOMNode(ref));
|
|
38136
37994
|
// We really care about the last text before the ref, not the
|
|
38137
37995
|
// ref element itself:
|
|
38138
37996
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'prev' does not exist on type 'JQueryStatic'.
|
|
@@ -38157,7 +38015,7 @@ class Passage extends React.Component {
|
|
|
38157
38015
|
return this.state.startLineNumbersAfter + line;
|
|
38158
38016
|
}
|
|
38159
38017
|
_convertPosToLineNumber(absoluteVPos) {
|
|
38160
|
-
const content =
|
|
38018
|
+
const content = ReactDOM.findDOMNode(this._contentRef);
|
|
38161
38019
|
// @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call. | TS2339 - Property 'offset' does not exist on type 'JQueryStatic'.
|
|
38162
38020
|
const relativeVPos = absoluteVPos - $(content).offset().top;
|
|
38163
38021
|
const lineHeight = this._getLineHeight();
|
|
@@ -38380,18 +38238,14 @@ class PassageRefTarget extends React.Component {
|
|
|
38380
38238
|
};
|
|
38381
38239
|
}
|
|
38382
38240
|
render() {
|
|
38383
|
-
return (
|
|
38384
|
-
|
|
38385
|
-
//
|
|
38386
|
-
|
|
38387
|
-
|
|
38388
|
-
|
|
38389
|
-
|
|
38390
|
-
|
|
38391
|
-
apiOptions: this.props.apiOptions,
|
|
38392
|
-
linterContext: this.props.linterContext
|
|
38393
|
-
})
|
|
38394
|
-
);
|
|
38241
|
+
return /*#__PURE__*/React.createElement(Renderer, {
|
|
38242
|
+
content: this.props.content
|
|
38243
|
+
// @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<...>'.
|
|
38244
|
+
,
|
|
38245
|
+
inline: true,
|
|
38246
|
+
apiOptions: this.props.apiOptions,
|
|
38247
|
+
linterContext: this.props.linterContext
|
|
38248
|
+
});
|
|
38395
38249
|
}
|
|
38396
38250
|
}
|
|
38397
38251
|
PassageRefTarget.propTypes = _extends({}, propTypes, {
|
|
@@ -38983,7 +38837,6 @@ class Plotter extends React.Component {
|
|
|
38983
38837
|
if (i > 0) {
|
|
38984
38838
|
c.graph.lines[i] = Interactive2.addMovableLine(graphie, {
|
|
38985
38839
|
points: [c.graph.points[i - 1], c.graph.points[i]],
|
|
38986
|
-
// $FlowFixMe[prop-missing]
|
|
38987
38840
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
38988
38841
|
constraints: Interactive2.MovablePoint.constraints.fixed(),
|
|
38989
38842
|
normalStyle: {
|
|
@@ -41715,9 +41568,7 @@ const ShapeTypes = {
|
|
|
41715
41568
|
fixed: !options.translatable && !options.editable
|
|
41716
41569
|
},
|
|
41717
41570
|
visible: options.showPoints,
|
|
41718
|
-
// $FlowFixMe[prop-missing]
|
|
41719
41571
|
snapX: options.snap && options.snap[0] || 0,
|
|
41720
|
-
// $FlowFixMe[prop-missing]
|
|
41721
41572
|
snapY: options.snap && options.snap[1] || 0,
|
|
41722
41573
|
bounded: false,
|
|
41723
41574
|
// Don't bound it when placing it on the graph
|
|
@@ -42289,7 +42140,6 @@ class Transformer extends React.Component {
|
|
|
42289
42140
|
transform = {
|
|
42290
42141
|
type: "translation",
|
|
42291
42142
|
// NOTE(kevib): these should be numbers
|
|
42292
|
-
// $FlowFixMe[incompatible-type]
|
|
42293
42143
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'null' is not assignable to type 'number'. | TS2322 - Type 'null' is not assignable to type 'number'.
|
|
42294
42144
|
vector: [null, null]
|
|
42295
42145
|
};
|
|
@@ -42298,11 +42148,9 @@ class Transformer extends React.Component {
|
|
|
42298
42148
|
transform = {
|
|
42299
42149
|
type: "rotation",
|
|
42300
42150
|
// NOTE(kevib): these should be numbers
|
|
42301
|
-
// $FlowFixMe[incompatible-type]
|
|
42302
42151
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'null' is not assignable to type 'number'. | TS2322 - Type 'null' is not assignable to type 'number'.
|
|
42303
42152
|
center: [null, null],
|
|
42304
42153
|
// NOTE(kevib): this should be a number
|
|
42305
|
-
// $FlowFixMe[incompatible-type]
|
|
42306
42154
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'null' is not assignable to type 'number'.
|
|
42307
42155
|
angleDeg: null
|
|
42308
42156
|
};
|
|
@@ -42313,11 +42161,9 @@ class Transformer extends React.Component {
|
|
|
42313
42161
|
type: "reflection",
|
|
42314
42162
|
line: [
|
|
42315
42163
|
// NOTE(kevib): these should be numbers
|
|
42316
|
-
// $FlowFixMe[incompatible-type]
|
|
42317
42164
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'null' is not assignable to type 'number'. | TS2322 - Type 'null' is not assignable to type 'number'.
|
|
42318
42165
|
[null, null],
|
|
42319
42166
|
// NOTE(kevib): these should be numbers
|
|
42320
|
-
// $FlowFixMe[incompatible-type]
|
|
42321
42167
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'null' is not assignable to type 'number'. | TS2322 - Type 'null' is not assignable to type 'number'.
|
|
42322
42168
|
[null, null]]
|
|
42323
42169
|
};
|
|
@@ -42326,11 +42172,9 @@ class Transformer extends React.Component {
|
|
|
42326
42172
|
transform = {
|
|
42327
42173
|
type: "dilation",
|
|
42328
42174
|
// NOTE(kevib): these should be numbers
|
|
42329
|
-
// $FlowFixMe[incompatible-type]
|
|
42330
42175
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'null' is not assignable to type 'number'. | TS2322 - Type 'null' is not assignable to type 'number'.
|
|
42331
42176
|
center: [null, null],
|
|
42332
42177
|
// NOTE(kevib): this should be a number
|
|
42333
|
-
// $FlowFixMe[incompatible-type]
|
|
42334
42178
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'null' is not assignable to type 'number'.
|
|
42335
42179
|
scale: null
|
|
42336
42180
|
};
|
|
@@ -42503,7 +42347,6 @@ class Transformer extends React.Component {
|
|
|
42503
42347
|
if (reflectRotateHandle) {
|
|
42504
42348
|
$(reflectRotateHandle).on("move", function () {
|
|
42505
42349
|
const rotateHandleApprox = self.snapCoord(
|
|
42506
|
-
// $FlowFixMe[incompatible-use]
|
|
42507
42350
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
|
|
42508
42351
|
reflectRotateHandle.coord);
|
|
42509
42352
|
const rotateVector = vector$1.subtract(rotateHandleApprox, reflectButton.coord);
|
|
@@ -42571,9 +42414,7 @@ class Transformer extends React.Component {
|
|
|
42571
42414
|
width: this.scaleToCurrentRange(0.24),
|
|
42572
42415
|
hoverWidth: this.scaleToCurrentRange(0.4),
|
|
42573
42416
|
onMove: function (newAngle, oldAngle) {
|
|
42574
|
-
const transform = self.getRotationTransformFromAngle(
|
|
42575
|
-
// $FlowFixMe[incompatible-use]
|
|
42576
|
-
self.rotatePoint.coord, newAngle - oldAngle);
|
|
42417
|
+
const transform = self.getRotationTransformFromAngle(self.rotatePoint.coord, newAngle - oldAngle);
|
|
42577
42418
|
|
|
42578
42419
|
// Rotate polygon with rotateHandle
|
|
42579
42420
|
self.doTransform(transform);
|
|
@@ -42622,9 +42463,7 @@ class Transformer extends React.Component {
|
|
|
42622
42463
|
self.doTransform({
|
|
42623
42464
|
type: "dilation",
|
|
42624
42465
|
// 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,
|
|
42466
|
+
// will still be defined here. center: self.dilationCircle.centerPoint.coord,
|
|
42628
42467
|
scale: newRadius / oldRadius
|
|
42629
42468
|
});
|
|
42630
42469
|
},
|
|
@@ -42660,7 +42499,6 @@ class Transformer extends React.Component {
|
|
|
42660
42499
|
origOnMoveEnd(args);
|
|
42661
42500
|
}
|
|
42662
42501
|
self.changeTool("dilation", {
|
|
42663
|
-
// $FlowFixMe[incompatible-use]
|
|
42664
42502
|
coord: self.dilationCircle.centerPoint.coord
|
|
42665
42503
|
});
|
|
42666
42504
|
};
|
|
@@ -42780,7 +42618,6 @@ class Transformer extends React.Component {
|
|
|
42780
42618
|
// handle coordinates in formal mode without movement, since
|
|
42781
42619
|
// the movablepoints never move
|
|
42782
42620
|
shape: {
|
|
42783
|
-
// $FlowFixMe[incompatible-use]
|
|
42784
42621
|
type: this.shape.type,
|
|
42785
42622
|
coords: this.getCoords(),
|
|
42786
42623
|
options: (_this$shape5 = this.shape) == null ? void 0 : _this$shape5.getOptions()
|
|
@@ -44716,7 +44553,7 @@ class HintsRenderer extends React.Component {
|
|
|
44716
44553
|
this._cacheHintImages();
|
|
44717
44554
|
}
|
|
44718
44555
|
|
|
44719
|
-
// Force number to make
|
|
44556
|
+
// Force number to make TypeScript happy
|
|
44720
44557
|
const prevHintsVisible = prevProps.hintsVisible || 0;
|
|
44721
44558
|
const nextHintsVisible = this.props.hintsVisible || 0;
|
|
44722
44559
|
|
|
@@ -44972,13 +44809,7 @@ class ItemRenderer extends React.Component {
|
|
|
44972
44809
|
// that have completely different places in the DOM, we have to do this
|
|
44973
44810
|
// strangeness instead of relying on React's normal render() method.
|
|
44974
44811
|
// 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({
|
|
44812
|
+
render( /*#__PURE__*/React.createElement(Renderer, _extends({
|
|
44982
44813
|
ref: node => {
|
|
44983
44814
|
if (!node) {
|
|
44984
44815
|
return;
|
|
@@ -45063,9 +44894,7 @@ class ItemRenderer extends React.Component {
|
|
|
45063
44894
|
return Util.inputPathsEqual(inputPath, this._currentFocus);
|
|
45064
44895
|
});
|
|
45065
44896
|
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());
|
|
44897
|
+
this.props.apiOptions.onFocusChange(this._currentFocus, prevFocus, didFocusInput && keypadElement && keypadElement.getDOMNode());
|
|
45069
44898
|
}
|
|
45070
44899
|
if (keypadElement) {
|
|
45071
44900
|
if (didFocusInput) {
|
|
@@ -45370,14 +45199,9 @@ class ServerItemRenderer extends React.Component {
|
|
|
45370
45199
|
return Util.inputPathsEqual(inputPath, this._currentFocus);
|
|
45371
45200
|
});
|
|
45372
45201
|
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
|
|
45202
|
+
onFocusChange(this._currentFocus, prevFocus, didFocusInput && keypadElement && keypadElement.getDOMNode(),
|
|
45377
45203
|
// @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));
|
|
45204
|
+
didFocusInput && this.questionRenderer.getDOMNodeForPath(newFocus));
|
|
45381
45205
|
}
|
|
45382
45206
|
if (keypadElement && isMobile) {
|
|
45383
45207
|
if (didFocusInput) {
|
|
@@ -46660,7 +46484,7 @@ class MultiRenderer extends React.Component {
|
|
|
46660
46484
|
// were to change every render, it would cause the Renderer to
|
|
46661
46485
|
// re-render a lot more than is necessary. Don't re-compute this
|
|
46662
46486
|
// element unless it is necessary!
|
|
46663
|
-
// HACK(mdr):
|
|
46487
|
+
// HACK(mdr): TypeScript can't prove that this is a ContentRendererData,
|
|
46664
46488
|
// because of how we awkwardly construct it in order to obtain a
|
|
46665
46489
|
// circular reference. But it is, I promise.
|
|
46666
46490
|
const data = {
|
|
@@ -46680,7 +46504,6 @@ class MultiRenderer extends React.Component {
|
|
|
46680
46504
|
* one to one could introduce a bug. Need to work out the exact
|
|
46681
46505
|
* type for ContentNode and then fix this.
|
|
46682
46506
|
*/
|
|
46683
|
-
// $FlowFixMe[cannot-spread-inexact]
|
|
46684
46507
|
// @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
46508
|
React.createElement(Renderer, _extends({}, this._getRendererProps(), content, {
|
|
46686
46509
|
ref: refFunc,
|
|
@@ -46924,7 +46747,7 @@ const styles = StyleSheet.create({
|
|
|
46924
46747
|
* Utility functions to build React PropTypes for multi-items and shapes.
|
|
46925
46748
|
*
|
|
46926
46749
|
* If you're writing new components, though, consider using the Item and Shape
|
|
46927
|
-
*
|
|
46750
|
+
* types instead.
|
|
46928
46751
|
*/
|
|
46929
46752
|
|
|
46930
46753
|
/**
|