@khanacademy/perseus 4.0.1 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/dist/components/highlighting/highlightable-content.d.ts +4 -4
- package/dist/components/highlighting/highlightable-content.js.flow +4 -7
- package/dist/components/highlighting/ui/highlight-renderer.d.ts +6 -6
- package/dist/components/highlighting/ui/highlight-renderer.js.flow +6 -8
- package/dist/components/highlighting/ui/highlight-set-renderer.d.ts +5 -5
- package/dist/components/highlighting/ui/highlight-set-renderer.js.flow +5 -8
- package/dist/components/highlighting/ui/highlight-tooltip.d.ts +2 -2
- package/dist/components/highlighting/ui/highlight-tooltip.js.flow +2 -4
- package/dist/components/highlighting/ui/highlighting-ui.d.ts +3 -3
- package/dist/components/highlighting/ui/highlighting-ui.js.flow +2 -2
- package/dist/components/highlighting/ui/selection-tracker.d.ts +5 -5
- package/dist/components/highlighting/ui/selection-tracker.js.flow +5 -7
- package/dist/components/highlighting/word-indexer.d.ts +2 -2
- package/dist/components/highlighting/word-indexer.js.flow +2 -2
- package/dist/components/inline-icon.d.ts +35 -1
- package/dist/components/inline-icon.js.flow +11 -1
- package/dist/components/simple-keypad-input.d.ts +1 -1
- package/dist/components/simple-keypad-input.js.flow +1 -1
- package/dist/components/tex-buttons.d.ts +2 -2
- package/dist/components/tex-buttons.js.flow +2 -2
- package/dist/error-boundary.d.ts +4 -4
- package/dist/error-boundary.js.flow +4 -6
- package/dist/es/index.js +53 -233
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +53 -233
- package/dist/index.js.map +1 -1
- package/dist/multi-items/multi-renderer.d.ts +1 -1
- package/dist/multi-items/multi-renderer.js.flow +1 -1
- package/dist/multi-items/prop-type-builders.d.ts +1 -1
- package/dist/multi-items/shape-types.d.ts +1 -1
- package/dist/multi-items/shape-types.js.flow +1 -1
- package/dist/multi-items/tree-types.d.ts +1 -1
- package/dist/multi-items/tree-types.js.flow +1 -1
- package/dist/perseus-types.d.ts +0 -1
- package/dist/perseus-types.js.flow +0 -1
- package/dist/widgets/__stories__/test-keypad-context-wrapper.d.ts +6 -0
- package/dist/widgets/__stories__/test-keypad-context-wrapper.js.flow +12 -0
- package/dist/widgets/expression.d.ts +2 -2
- package/dist/widgets/expression.js.flow +2 -2
- package/dist/widgets/interaction/element-container.d.ts +5 -4
- package/dist/widgets/interaction/element-container.js.flow +6 -11
- package/dist/widgets/label-image/marker.d.ts +4 -4
- package/dist/widgets/label-image/marker.js.flow +4 -6
- package/dist/widgets/numeric-input.d.ts +0 -2
- package/dist/widgets/numeric-input.js.flow +0 -4
- package/dist/widgets/radio/base-radio.d.ts +7 -1
- package/dist/widgets/radio/base-radio.js.flow +7 -1
- package/dist/widgets/radio/choice-icon/choice-icon.d.ts +1 -1
- package/dist/widgets/radio/choice-icon/choice-icon.js.flow +1 -1
- package/dist/widgets/radio/choice-icon/cross-out-line.d.ts +2 -2
- package/dist/widgets/radio/choice-icon/cross-out-line.js.flow +2 -2
- package/dist/widgets/radio/focus-ring.d.ts +8 -1
- package/dist/widgets/radio/focus-ring.js.flow +8 -1
- package/dist/widgets/radio/option-status.d.ts +2 -2
- package/dist/widgets/radio/option-status.js.flow +2 -2
- package/dist/widgets/video-transcript-link.d.ts +1 -1
- package/dist/widgets/video-transcript-link.js.flow +1 -1
- package/package.json +4 -4
- package/src/__stories__/item-renderer.stories.tsx +2 -6
- package/src/__stories__/server-item-renderer.stories.tsx +2 -6
- package/src/__testdata__/item-renderer.testdata.ts +1 -1
- package/src/__testdata__/renderer.testdata.ts +1 -1
- package/src/__tests__/item-renderer.test.tsx +1 -2
- package/src/__tests__/renderer-api.test.tsx +1 -5
- package/src/__tests__/renderer.test.tsx +1 -1
- package/src/components/__stories__/button-group.stories.tsx +2 -6
- package/src/components/__stories__/fixed-to-responsive.stories.tsx +14 -16
- package/src/components/__stories__/graph.stories.tsx +3 -5
- package/src/components/__stories__/graphie.stories.tsx +3 -5
- package/src/components/__stories__/hud.stories.tsx +2 -6
- package/src/components/__stories__/icon.stories.tsx +1 -1
- package/src/components/__stories__/image-loader.stories.tsx +4 -4
- package/src/components/__stories__/info-tip.stories.tsx +2 -6
- package/src/components/__stories__/inline-icon.stories.tsx +4 -8
- package/src/components/__stories__/input-with-examples.stories.tsx +6 -10
- package/src/components/__stories__/lint.stories.tsx +12 -12
- package/src/components/__stories__/math-input.stories.tsx +4 -8
- package/src/components/__stories__/math-output.stories.tsx +3 -5
- package/src/components/__stories__/multi-button-group.stories.tsx +2 -6
- package/src/components/__stories__/number-input.stories.tsx +6 -8
- package/src/components/__stories__/prop-check-box.stories.tsx +9 -9
- package/src/components/__stories__/range-input.stories.tsx +4 -6
- package/src/components/__stories__/simple-keypad-input.stories.tsx +2 -4
- package/src/components/__stories__/sortable.stories.tsx +15 -15
- package/src/components/__stories__/stub-tag-editor.stories.tsx +5 -9
- package/src/components/__stories__/svg-image.stories.tsx +10 -18
- package/src/components/__stories__/tex.stories.tsx +1 -3
- package/src/components/__stories__/text-buttons.stories.tsx +10 -22
- package/src/components/__stories__/text-input.stories.tsx +4 -10
- package/src/components/__stories__/text-list-editor.stories.tsx +1 -3
- package/src/components/__stories__/zoomable-tex.stories.tsx +6 -4
- package/src/components/__stories__/zoomable.stories.tsx +1 -3
- package/src/components/fixed-to-responsive.tsx +0 -1
- package/src/components/graph.tsx +0 -4
- package/src/components/highlighting/highlightable-content.tsx +4 -7
- package/src/components/highlighting/ui/highlight-renderer.tsx +6 -9
- package/src/components/highlighting/ui/highlight-set-renderer.tsx +5 -8
- package/src/components/highlighting/ui/highlight-tooltip.tsx +2 -2
- package/src/components/highlighting/ui/highlighting-ui.tsx +5 -15
- package/src/components/highlighting/ui/selection-tracker.tsx +6 -9
- package/src/components/highlighting/word-indexer.tsx +2 -6
- package/src/components/inline-icon.tsx +2 -2
- package/src/components/math-input.tsx +0 -2
- package/src/components/number-input.tsx +0 -2
- package/src/components/simple-keypad-input.tsx +2 -2
- package/src/components/tex-buttons.tsx +2 -2
- package/src/components/text-list-editor.tsx +0 -4
- package/src/components/visibility-observer/__stories__/visibility-observer.stories.tsx +1 -3
- package/src/components/zoomable-tex.tsx +0 -2
- package/src/components/zoomable.tsx +0 -4
- package/src/definition-context.tsx +0 -1
- package/src/error-boundary.tsx +4 -7
- package/src/hints-renderer.tsx +1 -1
- package/src/interactive2/__tests__/movable-point.test.ts +0 -1
- package/src/item-renderer.tsx +0 -5
- package/src/mixins/changeable.ts +1 -1
- package/src/multi-items/__stories__/multi-renderer.stories.tsx +1 -5
- package/src/multi-items/__tests__/items.test.ts +3 -13
- package/src/multi-items/__tests__/multi-renderer.test.tsx +3 -4
- package/src/multi-items/__tests__/prop-type-builders.test.ts +1 -1
- package/src/multi-items/__tests__/trees.test.ts +2 -10
- package/src/multi-items/multi-renderer.tsx +7 -10
- package/src/multi-items/prop-type-builders.ts +1 -1
- package/src/multi-items/shape-types.ts +1 -1
- package/src/multi-items/tree-types.ts +1 -1
- package/src/perseus-markdown.tsx +0 -2
- package/src/perseus-types.ts +1 -4
- package/src/renderer.tsx +2 -5
- package/src/server-item-renderer.tsx +0 -3
- package/src/util/graphie.ts +3 -3
- package/src/util/interactive.ts +0 -4
- package/src/util/math.ts +0 -3
- package/src/widgets/__stories__/categorizer.stories.tsx +1 -1
- package/src/widgets/__stories__/cs-program.stories.tsx +1 -1
- package/src/widgets/__stories__/definition.stories.tsx +3 -7
- package/src/widgets/__stories__/dropdown.stories.tsx +1 -1
- package/src/widgets/__stories__/explanation.stories.tsx +2 -2
- package/src/widgets/__stories__/expression.stories.tsx +113 -13
- package/src/widgets/__stories__/graded-group-set.stories.tsx +1 -1
- package/src/widgets/__stories__/graded-group.stories.tsx +1 -1
- package/src/widgets/__stories__/grapher.stories.tsx +7 -21
- package/src/widgets/__stories__/group.stories.tsx +1 -1
- package/src/widgets/__stories__/iframe.stories.tsx +1 -1
- package/src/widgets/__stories__/image.stories.tsx +2 -2
- package/src/widgets/__stories__/input-number.stories.tsx +3 -12
- package/src/widgets/__stories__/interaction.stories.tsx +1 -1
- package/src/widgets/__stories__/interactive-graph.stories.tsx +9 -9
- package/src/widgets/__stories__/matcher.stories.tsx +1 -1
- package/src/widgets/__stories__/matrix.stories.tsx +1 -1
- package/src/widgets/__stories__/number-line.stories.tsx +1 -1
- package/src/widgets/__stories__/numeric-input.stories.tsx +3 -5
- package/src/widgets/__stories__/orderer.stories.tsx +1 -1
- package/src/widgets/__stories__/passage-ref.stories.tsx +2 -2
- package/src/widgets/__stories__/passage.stories.tsx +3 -9
- package/src/widgets/__stories__/radio.stories.tsx +3 -5
- package/src/widgets/__stories__/sorter.stories.tsx +1 -1
- package/src/widgets/__stories__/{on-screen-keypad.stories.tsx → test-keypad-context-wrapper.tsx} +15 -57
- package/src/widgets/__stories__/transformer.stories.tsx +1 -1
- package/src/widgets/__stories__/unit.stories.tsx +1 -3
- package/src/widgets/__stories__/video-transcript-link.stories.tsx +2 -6
- package/src/widgets/__stories__/video.stories.tsx +1 -1
- package/src/widgets/__testdata__/expression.testdata.ts +16 -12
- package/src/widgets/__testdata__/group.testdata.ts +0 -2
- package/src/widgets/__testdata__/numeric-input.testdata.ts +0 -1
- package/src/widgets/__testdata__/transformer.testdata.ts +0 -1
- package/src/widgets/__tests__/group.test.tsx +0 -2
- package/src/widgets/__tests__/radio/focus-ring.test.tsx +0 -1
- package/src/widgets/__tests__/radio.test.ts +1 -1
- package/src/widgets/expression.tsx +4 -4
- package/src/widgets/graded-group-set.tsx +0 -4
- package/src/widgets/graded-group.tsx +0 -4
- package/src/widgets/grapher/util.tsx +1 -5
- package/src/widgets/grapher.tsx +0 -5
- package/src/widgets/group.tsx +0 -1
- package/src/widgets/interaction/element-container.tsx +7 -8
- package/src/widgets/interaction.tsx +0 -1
- package/src/widgets/interactive-graph.tsx +3 -62
- package/src/widgets/label-image/__stories__/answer-choices.stories.tsx +2 -4
- package/src/widgets/label-image/__stories__/marker.stories.tsx +9 -19
- package/src/widgets/label-image/marker.tsx +4 -4
- package/src/widgets/label-image.tsx +1 -1
- package/src/widgets/measurer.tsx +0 -1
- package/src/widgets/number-line.tsx +0 -2
- package/src/widgets/numeric-input.tsx +0 -3
- package/src/widgets/orderer.tsx +0 -3
- package/src/widgets/passage/passage-markdown.tsx +3 -3
- package/src/widgets/passage-ref-target.tsx +0 -1
- package/src/widgets/passage.tsx +1 -1
- package/src/widgets/plotter.tsx +0 -1
- package/src/widgets/radio/__stories__/base-radio.stories.tsx +13 -21
- package/src/widgets/radio/__stories__/choice-icon.stories.tsx +9 -11
- package/src/widgets/radio/__stories__/choice-none-above.stories.tsx +1 -1
- package/src/widgets/radio/__stories__/choice.stories.tsx +4 -4
- package/src/widgets/radio/__stories__/focus-ring.stories.tsx +1 -1
- package/src/widgets/radio/__stories__/option-status.stories.tsx +2 -4
- package/src/widgets/radio/base-radio.tsx +2 -2
- package/src/widgets/radio/choice-icon/choice-icon.tsx +5 -5
- package/src/widgets/radio/choice-icon/cross-out-line.tsx +1 -3
- package/src/widgets/radio/choice-none-above.tsx +2 -2
- package/src/widgets/radio/choice.tsx +1 -3
- package/src/widgets/radio/focus-ring.tsx +1 -1
- package/src/widgets/radio/option-status.tsx +2 -4
- package/src/widgets/radio/widget.tsx +0 -1
- package/src/widgets/reaction-diagram.tsx +2 -2
- package/src/widgets/transformer.tsx +1 -16
- package/src/widgets/video-transcript-link.tsx +1 -1
- package/src/widgets.ts +1 -1
- package/src/zoom.ts +0 -3
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
PerseusRenderer,
|
|
3
2
|
PerseusExpressionWidgetOptions,
|
|
4
3
|
Version,
|
|
4
|
+
PerseusItem,
|
|
5
5
|
} from "../../perseus-types";
|
|
6
6
|
|
|
7
|
-
type Item = {
|
|
8
|
-
question: PerseusRenderer;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
7
|
const createItemJson = (
|
|
12
8
|
widgetOptions: PerseusExpressionWidgetOptions,
|
|
13
9
|
version: Version,
|
|
14
|
-
):
|
|
10
|
+
): PerseusItem => {
|
|
15
11
|
return {
|
|
16
12
|
question: {
|
|
17
13
|
content: "[[☃ expression 1]]",
|
|
@@ -25,9 +21,14 @@ const createItemJson = (
|
|
|
25
21
|
},
|
|
26
22
|
},
|
|
27
23
|
},
|
|
28
|
-
|
|
24
|
+
_multi: null,
|
|
25
|
+
answer: null,
|
|
29
26
|
answerArea: {
|
|
27
|
+
zTable: false,
|
|
28
|
+
chi2Table: false,
|
|
29
|
+
tTable: false,
|
|
30
30
|
calculator: false,
|
|
31
|
+
periodicTable: false,
|
|
31
32
|
},
|
|
32
33
|
itemDataVersion: {
|
|
33
34
|
major: 0,
|
|
@@ -37,7 +38,7 @@ const createItemJson = (
|
|
|
37
38
|
};
|
|
38
39
|
};
|
|
39
40
|
|
|
40
|
-
export const expressionItem2:
|
|
41
|
+
export const expressionItem2: PerseusItem = createItemJson(
|
|
41
42
|
{
|
|
42
43
|
answerForms: [
|
|
43
44
|
{
|
|
@@ -88,7 +89,10 @@ export const expressionItem3Options: PerseusExpressionWidgetOptions = {
|
|
|
88
89
|
buttonsVisible: "focused",
|
|
89
90
|
};
|
|
90
91
|
|
|
91
|
-
export const expressionItem3:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
export const expressionItem3: PerseusItem = createItemJson(
|
|
93
|
+
expressionItem3Options,
|
|
94
|
+
{
|
|
95
|
+
major: 1,
|
|
96
|
+
minor: 0,
|
|
97
|
+
},
|
|
98
|
+
);
|
|
@@ -93,7 +93,6 @@ export const question1: PerseusRenderer = {
|
|
|
93
93
|
],
|
|
94
94
|
coefficient: false,
|
|
95
95
|
labelText: "value rounded to the nearest ten",
|
|
96
|
-
multipleNumberInput: false,
|
|
97
96
|
rightAlign: false,
|
|
98
97
|
size: "normal",
|
|
99
98
|
static: false,
|
|
@@ -118,7 +117,6 @@ export const question1: PerseusRenderer = {
|
|
|
118
117
|
],
|
|
119
118
|
coefficient: false,
|
|
120
119
|
labelText: "value rounded to the nearest hundred",
|
|
121
|
-
multipleNumberInput: false,
|
|
122
120
|
rightAlign: false,
|
|
123
121
|
size: "normal",
|
|
124
122
|
static: false,
|
|
@@ -279,7 +279,6 @@ describe("group widget", () => {
|
|
|
279
279
|
"coefficient": false,
|
|
280
280
|
"currentValue": "99",
|
|
281
281
|
"labelText": "value rounded to the nearest ten",
|
|
282
|
-
"multipleNumberInput": false,
|
|
283
282
|
"rightAlign": false,
|
|
284
283
|
"size": "normal",
|
|
285
284
|
"static": false,
|
|
@@ -288,7 +287,6 @@ describe("group widget", () => {
|
|
|
288
287
|
"answerForms": [],
|
|
289
288
|
"coefficient": false,
|
|
290
289
|
"labelText": "value rounded to the nearest hundred",
|
|
291
|
-
"multipleNumberInput": false,
|
|
292
290
|
"rightAlign": false,
|
|
293
291
|
"size": "normal",
|
|
294
292
|
"static": false,
|
|
@@ -10,7 +10,6 @@ describe("choice icon", () => {
|
|
|
10
10
|
describe.each([[true], [false]])("multipleSelect: %s", (multipleSelect) => {
|
|
11
11
|
it("renders with the correct border radius", () => {
|
|
12
12
|
// Arrange/Act
|
|
13
|
-
// @ts-expect-error [FEI-5003] - TS2739 - Type '{ multipleSelect: any; }' is missing the following properties from type 'Props': visible, color
|
|
14
13
|
render(<FocusRing multipleSelect={multipleSelect} />);
|
|
15
14
|
|
|
16
15
|
const focusRing = screen.getByTestId("focus-ring");
|
|
@@ -309,7 +309,7 @@ describe("single-choice question", () => {
|
|
|
309
309
|
questionWithPassage.content = `[[\u2603 passage 1]]\n\nNow what's the answer?\n\n[[\u2603 radio 1]]`;
|
|
310
310
|
questionWithPassage.widgets["passage 1"] = passageWidget;
|
|
311
311
|
const radioOptions = questionWithPassage.widgets["radio 1"];
|
|
312
|
-
// HACK(jeremy):
|
|
312
|
+
// HACK(jeremy): TypeScript doesn't know what type these options are because
|
|
313
313
|
// we've extracted them out of a generic `PerseusJson` blob and all the
|
|
314
314
|
// `widget` items are just type `Widget`.
|
|
315
315
|
(radioOptions.options as any).choices[0].content =
|
|
@@ -87,6 +87,9 @@ type OnInputErrorFunctionType = (
|
|
|
87
87
|
|
|
88
88
|
// The new, MathQuill input expression widget
|
|
89
89
|
export class Expression extends React.Component<Props, ExpressionState> {
|
|
90
|
+
_isMounted = false;
|
|
91
|
+
errorTimeout: null | number = null;
|
|
92
|
+
|
|
90
93
|
//#region Previously a class extension
|
|
91
94
|
/* Content creators input a list of answers which are matched from top to
|
|
92
95
|
* bottom. The intent is that they can include spcific solutions which should
|
|
@@ -334,9 +337,6 @@ export class Expression extends React.Component<Props, ExpressionState> {
|
|
|
334
337
|
this._isMounted = false;
|
|
335
338
|
};
|
|
336
339
|
|
|
337
|
-
_isMounted = false;
|
|
338
|
-
errorTimeout: null | number = null;
|
|
339
|
-
|
|
340
340
|
simpleValidate: (
|
|
341
341
|
rubric: Rubric,
|
|
342
342
|
onInputError: OnInputErrorFunctionType,
|
|
@@ -458,7 +458,7 @@ export class Expression extends React.Component<Props, ExpressionState> {
|
|
|
458
458
|
onFocus={() => {
|
|
459
459
|
// this.props.keypadElement should always be set
|
|
460
460
|
// when apiOptions.customKeypad is set, but how
|
|
461
|
-
// to convince
|
|
461
|
+
// to convince TypeScript of this?
|
|
462
462
|
this.props.keypadElement?.configure(
|
|
463
463
|
this.props.keypadConfiguration,
|
|
464
464
|
() => {
|
|
@@ -156,7 +156,6 @@ class GradedGroupSet extends React.Component<Props, State> {
|
|
|
156
156
|
return (
|
|
157
157
|
// TODO(jeremy): Don't spread this.props, instead
|
|
158
158
|
// pass in all props GradedGroup needs explicilty
|
|
159
|
-
// $FlowFixMe[prop-missing]
|
|
160
159
|
// @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call.
|
|
161
160
|
<GradedGroup
|
|
162
161
|
key={i}
|
|
@@ -200,7 +199,6 @@ class GradedGroupSet extends React.Component<Props, State> {
|
|
|
200
199
|
</div>
|
|
201
200
|
{/* TODO(jeremy): Don't spread this.props, instead
|
|
202
201
|
pass in all props GradedGroup needs explicitly */}
|
|
203
|
-
{/* $FlowFixMe[prop-missing] */}
|
|
204
202
|
{/* @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call. */}
|
|
205
203
|
<GradedGroup
|
|
206
204
|
key={this.state.currentGroup}
|
|
@@ -211,9 +209,7 @@ class GradedGroupSet extends React.Component<Props, State> {
|
|
|
211
209
|
{...this.props}
|
|
212
210
|
{...currentGroup}
|
|
213
211
|
inGradedGroupSet={true}
|
|
214
|
-
// $FlowFixMe[incompatible-type]
|
|
215
212
|
title={null}
|
|
216
|
-
// $FlowFixMe[incompatible-type]
|
|
217
213
|
onNextQuestion={handleNextQuestion}
|
|
218
214
|
linterContext={this.props.linterContext}
|
|
219
215
|
/>
|
|
@@ -252,7 +252,6 @@ export class GradedGroup extends React.Component<Props, State> {
|
|
|
252
252
|
: css(styles.gradedGroup);
|
|
253
253
|
|
|
254
254
|
const classes = classNames({
|
|
255
|
-
// $FlowFixMe[invalid-computed-prop]
|
|
256
255
|
[mobileClass]: apiOptions.isMobile,
|
|
257
256
|
"perseus-graded-group": true,
|
|
258
257
|
"answer-correct": apiOptions.isMobile
|
|
@@ -283,8 +282,6 @@ export class GradedGroup extends React.Component<Props, State> {
|
|
|
283
282
|
* props that are needed.
|
|
284
283
|
* TODO(FEI-4034): Only pass what the Renderer expects.
|
|
285
284
|
*/}
|
|
286
|
-
{/* $FlowFixMe[prop-missing] */}
|
|
287
|
-
{/* $FlowFixMe[incompatible-type] */}
|
|
288
285
|
{/* @ts-expect-error [FEI-5003] - TS2322 - Type '{ ref: string; apiOptions: any; onInteractWithWidget: (arg1: string) => void; linterContext: LinterContextProps; title: string; hasHint?: boolean | null | undefined; ... 22 more ...; children?: ReactNode; }' is not assignable to type 'Pick<Readonly<Props> & Readonly<{ children?: ReactNode; }>, "children" | "keypadElement" | "problemNum" | "apiOptions" | "legacyPerseusLint">'. */}
|
|
289
286
|
<Renderer
|
|
290
287
|
{...this.props}
|
|
@@ -355,7 +352,6 @@ export class GradedGroup extends React.Component<Props, State> {
|
|
|
355
352
|
* We're passing a couple of props to Renderer that it doesn't
|
|
356
353
|
* require as part of {...this.props.hint}.
|
|
357
354
|
*/}
|
|
358
|
-
{/* $FlowFixMe[prop-missing] */}
|
|
359
355
|
<Renderer
|
|
360
356
|
{...this.props.hint}
|
|
361
357
|
// eslint-disable-next-line react/no-string-refs
|
|
@@ -149,8 +149,6 @@ const Quadratic = _.extend({}, PlotDefaults, {
|
|
|
149
149
|
[0.5, 0.5],
|
|
150
150
|
[0.75, 0.75],
|
|
151
151
|
],
|
|
152
|
-
|
|
153
|
-
// $FlowFixMe[prop-missing]
|
|
154
152
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'Parabola' does not exist on type 'typeof Graphie'.
|
|
155
153
|
Movable: Graphie.Parabola,
|
|
156
154
|
|
|
@@ -208,8 +206,6 @@ const Sinusoid = _.extend({}, PlotDefaults, {
|
|
|
208
206
|
[0.5, 0.5],
|
|
209
207
|
[0.6, 0.6],
|
|
210
208
|
],
|
|
211
|
-
|
|
212
|
-
// $FlowFixMe[prop-missing]
|
|
213
209
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'Sinusoid' does not exist on type 'typeof Graphie'.
|
|
214
210
|
Movable: Graphie.Sinusoid,
|
|
215
211
|
|
|
@@ -593,7 +589,7 @@ export const allTypes: any = _.keys(functionTypeMapping);
|
|
|
593
589
|
|
|
594
590
|
export function functionForType(
|
|
595
591
|
// TODO(jeremy): Actually `$Keys<typeof functionTypeMapping>` but that
|
|
596
|
-
// triggers
|
|
592
|
+
// triggers TypeScript to require all of our Plot types to be fully typed which
|
|
597
593
|
// is a big amount of work/change.
|
|
598
594
|
type: string,
|
|
599
595
|
): any {
|
package/src/widgets/grapher.tsx
CHANGED
|
@@ -119,10 +119,8 @@ class FunctionGrapher extends React.Component<FunctionGrapherProps> {
|
|
|
119
119
|
coord={coord}
|
|
120
120
|
static={this.props.static}
|
|
121
121
|
constraints={[
|
|
122
|
-
// $FlowFixMe[prop-missing]
|
|
123
122
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
124
123
|
Interactive2.MovablePoint.constraints.bound(),
|
|
125
|
-
// $FlowFixMe[prop-missing]
|
|
126
124
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
127
125
|
Interactive2.MovablePoint.constraints.snap(),
|
|
128
126
|
(coord: any) => {
|
|
@@ -205,7 +203,6 @@ class FunctionGrapher extends React.Component<FunctionGrapherProps> {
|
|
|
205
203
|
const scale = box[0] / interactiveSizes.defaultBoxSize;
|
|
206
204
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'Element' is not assignable to type 'null'.
|
|
207
205
|
image = (
|
|
208
|
-
// $FlowFixMe[prop-missing]: alt props is missing
|
|
209
206
|
// @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">'.
|
|
210
207
|
<SvgImage
|
|
211
208
|
src={imageDescription.url}
|
|
@@ -295,10 +292,8 @@ class FunctionGrapher extends React.Component<FunctionGrapherProps> {
|
|
|
295
292
|
});
|
|
296
293
|
}}
|
|
297
294
|
constraints={[
|
|
298
|
-
// $FlowFixMe[prop-missing]
|
|
299
295
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
300
296
|
Interactive2.MovableLine.constraints.bound(),
|
|
301
|
-
// $FlowFixMe[prop-missing]
|
|
302
297
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
303
298
|
Interactive2.MovableLine.constraints.snap(),
|
|
304
299
|
(newCoord, oldCoord: any) => {
|
package/src/widgets/group.tsx
CHANGED
|
@@ -171,7 +171,6 @@ class Group extends React.Component<Props> {
|
|
|
171
171
|
onInteractWithWidget={onInteractWithWidget}
|
|
172
172
|
linterContext={this.props.linterContext}
|
|
173
173
|
/>
|
|
174
|
-
{/* $FlowFixMe[prop-missing] */}
|
|
175
174
|
{/* @ts-expect-error [FEI-5003] - TS2339 - Property 'icon' does not exist on type 'Readonly<Props> & Readonly<{ children?: ReactNode; }>'. */}
|
|
176
175
|
{this.props.icon && (
|
|
177
176
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'icon' does not exist on type 'Readonly<Props> & Readonly<{ children?: ReactNode; }>'.
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
iconTrash,
|
|
11
11
|
} from "../../icon-paths";
|
|
12
12
|
|
|
13
|
-
type
|
|
13
|
+
type Props = {
|
|
14
14
|
children: React.ReactElement<any> | ReadonlyArray<React.ReactElement<any>>;
|
|
15
15
|
initiallyVisible: boolean;
|
|
16
16
|
onDelete?: () => void | null | undefined;
|
|
@@ -19,12 +19,11 @@ type ElementContainerProps = {
|
|
|
19
19
|
title: string | React.ReactElement<any>;
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
> {
|
|
22
|
+
type State = {
|
|
23
|
+
show: boolean;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
class ElementContainer extends React.Component<Props, State> {
|
|
28
27
|
static defaultProps: {
|
|
29
28
|
initiallyVisible: boolean;
|
|
30
29
|
title: string;
|
|
@@ -33,7 +32,7 @@ class ElementContainer extends React.Component<
|
|
|
33
32
|
title: "More",
|
|
34
33
|
};
|
|
35
34
|
|
|
36
|
-
constructor(props:
|
|
35
|
+
constructor(props: Props) {
|
|
37
36
|
super(props);
|
|
38
37
|
|
|
39
38
|
this.state = {
|
|
@@ -417,7 +417,6 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
417
417
|
[-10, 10],
|
|
418
418
|
],
|
|
419
419
|
step: [1, 1],
|
|
420
|
-
// $FlowFixMe[prop-missing]
|
|
421
420
|
// @ts-expect-error [FEI-5003] - TS2739 - Type '{ readonly url: null; }' is missing the following properties from type 'PerseusImageBackground': width, height
|
|
422
421
|
backgroundImage: defaultBackgroundImage,
|
|
423
422
|
markings: "graph",
|
|
@@ -727,10 +726,8 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
727
726
|
return Interactive2.addMaybeMobileMovablePoint(this, {
|
|
728
727
|
coord: coord,
|
|
729
728
|
constraints: [
|
|
730
|
-
// $FlowFixMe[prop-missing]
|
|
731
729
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
732
730
|
Interactive2.MovablePoint.constraints.bound(),
|
|
733
|
-
// $FlowFixMe[prop-missing]
|
|
734
731
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
735
732
|
Interactive2.MovablePoint.constraints.snap(),
|
|
736
733
|
],
|
|
@@ -798,7 +795,6 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
798
795
|
|
|
799
796
|
const onMoveHandler = () => {
|
|
800
797
|
const graph = _.extend({}, this.props.graph, {
|
|
801
|
-
// $FlowFixMe[incompatible-use]
|
|
802
798
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'. | TS2531 - Object is possibly 'null'. | TS2531 - Object is possibly 'null'.
|
|
803
799
|
coords: [pointA.coord(), pointB.coord(), pointC.coord()],
|
|
804
800
|
});
|
|
@@ -813,19 +809,15 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
813
809
|
pointA = this.pointA = Interactive2.addMaybeMobileMovablePoint(this, {
|
|
814
810
|
coord: coords[0],
|
|
815
811
|
constraints: [
|
|
816
|
-
// $FlowFixMe[prop-missing]
|
|
817
812
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
818
813
|
Interactive2.MovablePoint.constraints.bound(),
|
|
819
|
-
// $FlowFixMe[prop-missing]
|
|
820
814
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
821
815
|
Interactive2.MovablePoint.constraints.snap(),
|
|
822
816
|
(coord) => {
|
|
823
817
|
return (
|
|
824
818
|
!pointA ||
|
|
825
|
-
// $FlowFixMe[incompatible-use]
|
|
826
819
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
|
|
827
820
|
(coord[0] !== pointB.coord()[0] &&
|
|
828
|
-
// $FlowFixMe[incompatible-use]
|
|
829
821
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
|
|
830
822
|
coord[0] !== pointC.coord()[0])
|
|
831
823
|
);
|
|
@@ -841,19 +833,15 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
841
833
|
pointB = this.pointB = Interactive2.addMaybeMobileMovablePoint(this, {
|
|
842
834
|
coord: coords[1],
|
|
843
835
|
constraints: [
|
|
844
|
-
// $FlowFixMe[prop-missing]
|
|
845
836
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
846
837
|
Interactive2.MovablePoint.constraints.bound(),
|
|
847
|
-
// $FlowFixMe[prop-missing]
|
|
848
838
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
849
839
|
Interactive2.MovablePoint.constraints.snap(),
|
|
850
840
|
(coord: any) => {
|
|
851
841
|
return (
|
|
852
842
|
!pointB ||
|
|
853
|
-
// $FlowFixMe[incompatible-use]
|
|
854
843
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
|
|
855
844
|
(coord[0] !== pointA.coord()[0] &&
|
|
856
|
-
// $FlowFixMe[incompatible-use]
|
|
857
845
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
|
|
858
846
|
coord[0] !== pointC.coord()[0])
|
|
859
847
|
);
|
|
@@ -869,19 +857,15 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
869
857
|
pointC = this.pointC = Interactive2.addMaybeMobileMovablePoint(this, {
|
|
870
858
|
coord: coords[2],
|
|
871
859
|
constraints: [
|
|
872
|
-
// $FlowFixMe[prop-missing]
|
|
873
860
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
874
861
|
Interactive2.MovablePoint.constraints.bound(),
|
|
875
|
-
// $FlowFixMe[prop-missing]
|
|
876
862
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
877
863
|
Interactive2.MovablePoint.constraints.snap(),
|
|
878
864
|
(coord: any) => {
|
|
879
865
|
return (
|
|
880
866
|
!pointC ||
|
|
881
|
-
// $FlowFixMe[incompatible-use]
|
|
882
867
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
|
|
883
868
|
(coord[0] !== pointA.coord()[0] &&
|
|
884
|
-
// $FlowFixMe[incompatible-use]
|
|
885
869
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
|
|
886
870
|
coord[0] !== pointB.coord()[0])
|
|
887
871
|
);
|
|
@@ -943,7 +927,6 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
943
927
|
|
|
944
928
|
const onMoveHandler = () => {
|
|
945
929
|
const graph = _.extend({}, this.props.graph, {
|
|
946
|
-
// $FlowFixMe[incompatible-use]
|
|
947
930
|
// @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'.
|
|
948
931
|
coords: [pointA.coord(), pointB.coord()],
|
|
949
932
|
});
|
|
@@ -958,10 +941,8 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
958
941
|
pointA = this.pointA = Interactive2.addMaybeMobileMovablePoint(this, {
|
|
959
942
|
coord: coords[0],
|
|
960
943
|
constraints: [
|
|
961
|
-
// $FlowFixMe[prop-missing]
|
|
962
944
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
963
945
|
Interactive2.MovablePoint.constraints.bound(),
|
|
964
|
-
// $FlowFixMe[prop-missing]
|
|
965
946
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
966
947
|
Interactive2.MovablePoint.constraints.snap(),
|
|
967
948
|
(coord: any) => {
|
|
@@ -976,10 +957,8 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
976
957
|
{
|
|
977
958
|
coord: coords[1],
|
|
978
959
|
constraints: [
|
|
979
|
-
// $FlowFixMe[prop-missing]
|
|
980
960
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
981
961
|
Interactive2.MovablePoint.constraints.bound(),
|
|
982
|
-
// $FlowFixMe[prop-missing]
|
|
983
962
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
984
963
|
Interactive2.MovablePoint.constraints.snap(),
|
|
985
964
|
(coord: any) => {
|
|
@@ -1049,9 +1028,7 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
1049
1028
|
|
|
1050
1029
|
$(circle).on("move", () => {
|
|
1051
1030
|
const graph = _.extend({}, this.props.graph, {
|
|
1052
|
-
// $FlowFixMe[incompatible-use]
|
|
1053
1031
|
center: circle.center,
|
|
1054
|
-
// $FlowFixMe[incompatible-use]
|
|
1055
1032
|
radius: circle.radius,
|
|
1056
1033
|
});
|
|
1057
1034
|
this.onChange({graph: graph});
|
|
@@ -1085,10 +1062,8 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
1085
1062
|
Interactive2.addMaybeMobileMovablePoint(this, {
|
|
1086
1063
|
coord: coord,
|
|
1087
1064
|
constraints: [
|
|
1088
|
-
// $FlowFixMe[prop-missing]
|
|
1089
1065
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
1090
1066
|
Interactive2.MovablePoint.constraints.bound(),
|
|
1091
|
-
// $FlowFixMe[prop-missing]
|
|
1092
1067
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
1093
1068
|
Interactive2.MovablePoint.constraints.snap(),
|
|
1094
1069
|
(coord) => {
|
|
@@ -1152,9 +1127,7 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
1152
1127
|
const graphie = this.graphie;
|
|
1153
1128
|
const screenPoint = graphie?.scalePoint(coord);
|
|
1154
1129
|
return (
|
|
1155
|
-
// $FlowFixMe[incompatible-use]
|
|
1156
1130
|
screenPoint[0] >= graphie.xpixels - 40 &&
|
|
1157
|
-
// $FlowFixMe[incompatible-use]
|
|
1158
1131
|
screenPoint[1] >= graphie.ypixels - 40
|
|
1159
1132
|
);
|
|
1160
1133
|
};
|
|
@@ -1188,10 +1161,8 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
1188
1161
|
point = Interactive2.addMaybeMobileMovablePoint(this, {
|
|
1189
1162
|
coord: coord,
|
|
1190
1163
|
constraints: [
|
|
1191
|
-
// $FlowFixMe[prop-missing]
|
|
1192
1164
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
1193
1165
|
Interactive2.MovablePoint.constraints.bound(),
|
|
1194
|
-
// $FlowFixMe[prop-missing]
|
|
1195
1166
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
1196
1167
|
Interactive2.MovablePoint.constraints.snap(),
|
|
1197
1168
|
function (coord) {
|
|
@@ -1563,12 +1534,10 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
1563
1534
|
const point = Interactive2.addMaybeMobileMovablePoint(this, {
|
|
1564
1535
|
coord: coord,
|
|
1565
1536
|
constraints: [
|
|
1566
|
-
// $FlowFixMe[prop-missing]
|
|
1567
1537
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
1568
1538
|
Interactive2.MovablePoint.constraints.bound(),
|
|
1569
1539
|
snapToGrid
|
|
1570
|
-
? //
|
|
1571
|
-
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
1540
|
+
? // @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
1572
1541
|
Interactive2.MovablePoint.constraints.snap()
|
|
1573
1542
|
: null,
|
|
1574
1543
|
graphConstraint,
|
|
@@ -1686,10 +1655,8 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
1686
1655
|
createPoint({
|
|
1687
1656
|
coord: coord,
|
|
1688
1657
|
constraints: [
|
|
1689
|
-
// $FlowFixMe[prop-missing]
|
|
1690
1658
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
1691
1659
|
Interactive2.MovablePoint.constraints.bound(),
|
|
1692
|
-
// $FlowFixMe[prop-missing]
|
|
1693
1660
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
1694
1661
|
Interactive2.MovablePoint.constraints.snap(),
|
|
1695
1662
|
(coord: any) => {
|
|
@@ -1718,15 +1685,12 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
1718
1685
|
points: points,
|
|
1719
1686
|
static: false,
|
|
1720
1687
|
constraints: [
|
|
1721
|
-
// $FlowFixMe[prop-missing]
|
|
1722
1688
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
1723
1689
|
Interactive2.MovableLine.constraints.bound(),
|
|
1724
|
-
// $FlowFixMe[prop-missing]
|
|
1725
1690
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
1726
1691
|
Interactive2.MovableLine.constraints.snap(),
|
|
1727
1692
|
],
|
|
1728
1693
|
onMove: [
|
|
1729
|
-
// $FlowFixMe[prop-missing]
|
|
1730
1694
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'onMove' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
1731
1695
|
Interactive2.MovableLine.onMove.updatePoints,
|
|
1732
1696
|
updateCoordProps,
|
|
@@ -1870,12 +1834,10 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
1870
1834
|
const self = this;
|
|
1871
1835
|
self.polygon = Interactive2.addMovablePolygon(graphie, {
|
|
1872
1836
|
constraints: [
|
|
1873
|
-
// $FlowFixMe[prop-missing]
|
|
1874
1837
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => undefined'.
|
|
1875
1838
|
Interactive2.MovablePolygon.constraints.bound(),
|
|
1876
1839
|
snapToGrid
|
|
1877
|
-
? //
|
|
1878
|
-
// @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => undefined'.
|
|
1840
|
+
? // @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => undefined'.
|
|
1879
1841
|
Interactive2.MovablePolygon.constraints.snap()
|
|
1880
1842
|
: null,
|
|
1881
1843
|
],
|
|
@@ -1886,7 +1848,6 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
1886
1848
|
numArcs: numArcs,
|
|
1887
1849
|
sideLabels: sideLabels,
|
|
1888
1850
|
onMove: [
|
|
1889
|
-
// $FlowFixMe[prop-missing]
|
|
1890
1851
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'onMove' does not exist on type '(graphie: any, movable: any, options: any) => undefined'.
|
|
1891
1852
|
Interactive2.MovablePolygon.onMove.updatePoints,
|
|
1892
1853
|
function () {
|
|
@@ -2135,7 +2096,6 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
2135
2096
|
props: Props,
|
|
2136
2097
|
): ReadonlyArray<Coord> {
|
|
2137
2098
|
return (
|
|
2138
|
-
// $FlowFixMe[incompatible-return]
|
|
2139
2099
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'coords' does not exist on type 'PerseusGraphType'.
|
|
2140
2100
|
graph.coords ||
|
|
2141
2101
|
InteractiveGraph.pointsFromNormalized(props, [
|
|
@@ -2230,7 +2190,6 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
2230
2190
|
): ReadonlyArray<ReadonlyArray<Coord>> {
|
|
2231
2191
|
return (
|
|
2232
2192
|
// The callers assume that we're return an array of points
|
|
2233
|
-
// $FlowFixMe[incompatible-return]
|
|
2234
2193
|
// @ts-expect-error [FEI-5003] - TS2339 - Property 'coords' does not exist on type 'PerseusGraphType'.
|
|
2235
2194
|
graph.coords ||
|
|
2236
2195
|
_.map(
|
|
@@ -2323,17 +2282,11 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
2323
2282
|
const n = graph.numSegments || 1;
|
|
2324
2283
|
// @ts-expect-error [FEI-5003] - TS2322 - Type 'number[] | undefined' is not assignable to type 'readonly number[]'.
|
|
2325
2284
|
const ys: ReadonlyArray<number> = {
|
|
2326
|
-
// $FlowFixMe[unsupported-syntax]
|
|
2327
2285
|
1: [5],
|
|
2328
|
-
// $FlowFixMe[unsupported-syntax]
|
|
2329
2286
|
2: [5, -5],
|
|
2330
|
-
// $FlowFixMe[unsupported-syntax]
|
|
2331
2287
|
3: [5, 0, -5],
|
|
2332
|
-
// $FlowFixMe[unsupported-syntax]
|
|
2333
2288
|
4: [6, 2, -2, -6],
|
|
2334
|
-
// $FlowFixMe[unsupported-syntax]
|
|
2335
2289
|
5: [6, 3, 0, -3, -6],
|
|
2336
|
-
// $FlowFixMe[unsupported-syntax]
|
|
2337
2290
|
6: [5, 3, 1, -1, -3, -5],
|
|
2338
2291
|
}[n];
|
|
2339
2292
|
const range = [
|
|
@@ -2645,7 +2598,6 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
2645
2598
|
// If both of the guess points are on the correct line, it's
|
|
2646
2599
|
// correct.
|
|
2647
2600
|
if (
|
|
2648
|
-
// $FlowFixMe[incompatible-use] - Fix type so coords can't be omitted
|
|
2649
2601
|
// @ts-expect-error [FEI-5003] - TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'.
|
|
2650
2602
|
collinear(correct[0], correct[1], guess[0]) &&
|
|
2651
2603
|
// @ts-expect-error [FEI-5003] - TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'.
|
|
@@ -2693,8 +2645,6 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
2693
2645
|
// If the parabola coefficients match, it's correct.
|
|
2694
2646
|
const guessCoeffs = this.getQuadraticCoefficients(state.coords);
|
|
2695
2647
|
const correctCoeffs = this.getQuadraticCoefficients(
|
|
2696
|
-
// $FlowFixMe[incompatible-call]
|
|
2697
|
-
// $FlowFixMe[prop-missing]
|
|
2698
2648
|
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'readonly Coord[] | undefined' is not assignable to parameter of type 'readonly Coord[]'.
|
|
2699
2649
|
rubric.correct.coords,
|
|
2700
2650
|
);
|
|
@@ -2713,8 +2663,6 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
2713
2663
|
) {
|
|
2714
2664
|
const guessCoeffs = this.getSinusoidCoefficients(state.coords);
|
|
2715
2665
|
const correctCoeffs = this.getSinusoidCoefficients(
|
|
2716
|
-
// $FlowFixMe[incompatible-call]
|
|
2717
|
-
// $FlowFixMe[prop-missing]
|
|
2718
2666
|
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'readonly Coord[] | undefined' is not assignable to parameter of type 'readonly Coord[]'.
|
|
2719
2667
|
rubric.correct.coords,
|
|
2720
2668
|
);
|
|
@@ -2738,7 +2686,6 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
2738
2686
|
) {
|
|
2739
2687
|
if (
|
|
2740
2688
|
deepEq(state.center, rubric.correct.center) &&
|
|
2741
|
-
// $FlowFixMe[prop-missing]
|
|
2742
2689
|
eq(state.radius, rubric.correct.radius)
|
|
2743
2690
|
) {
|
|
2744
2691
|
return {
|
|
@@ -2831,10 +2778,8 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
2831
2778
|
const guess = state.coords;
|
|
2832
2779
|
const correct = rubric.correct.coords;
|
|
2833
2780
|
if (
|
|
2834
|
-
// $FlowFixMe[incompatible-use]
|
|
2835
2781
|
// @ts-expect-error [FEI-5003] - TS2532 - Object is possibly 'undefined'.
|
|
2836
2782
|
deepEq(guess[0], correct[0]) &&
|
|
2837
|
-
// $FlowFixMe[incompatible-use]
|
|
2838
2783
|
// @ts-expect-error [FEI-5003] - TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'.
|
|
2839
2784
|
collinear(correct[0], correct[1], guess[1])
|
|
2840
2785
|
) {
|
|
@@ -2869,14 +2814,10 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
2869
2814
|
match = eq(...angles);
|
|
2870
2815
|
} else {
|
|
2871
2816
|
/* exact */
|
|
2872
|
-
match =
|
|
2873
|
-
// $FlowFixMe[incompatible-use]
|
|
2874
|
-
// @ts-expect-error [FEI-5003] - TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'.
|
|
2817
|
+
match = // @ts-expect-error [FEI-5003] - TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'.
|
|
2875
2818
|
deepEq(guess[1], correct[1]) &&
|
|
2876
|
-
// $FlowFixMe[incompatible-use]
|
|
2877
2819
|
// @ts-expect-error [FEI-5003] - TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'.
|
|
2878
2820
|
collinear(correct[1], correct[0], guess[0]) &&
|
|
2879
|
-
// $FlowFixMe[incompatible-use]
|
|
2880
2821
|
// @ts-expect-error [FEI-5003] - TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'.
|
|
2881
2822
|
collinear(correct[1], correct[2], guess[2]);
|
|
2882
2823
|
}
|