@khanacademy/perseus 7.2.1 → 8.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/article-renderer.d.ts +26 -40
- package/dist/components/math-input.d.ts +1 -1
- package/dist/components/sortable.d.ts +1 -1
- package/dist/components/tex-buttons.d.ts +1 -1
- package/dist/es/index.js +1139 -1189
- package/dist/es/index.js.map +1 -1
- package/dist/hints-renderer.d.ts +1 -1
- package/dist/index.js +1141 -1192
- package/dist/index.js.map +1 -1
- package/dist/mixins/provide-keypad.d.ts +15 -12
- package/dist/perseus-api.d.ts +1 -1
- package/dist/types.d.ts +3 -2
- package/dist/widgets/expression.d.ts +1 -1
- package/dist/widgets/graded-group.d.ts +1 -1
- package/dist/widgets/interactive-graph.d.ts +1 -1
- package/dist/widgets/sequence.d.ts +1 -1
- package/dist/widgets/table.d.ts +8 -1
- package/dist/widgets.d.ts +1 -1
- package/package.json +33 -33
- package/src/__testdata__/article-renderer.testdata.ts +3 -1
- 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 -1
- package/src/__tests__/mock-asset-loading-widget.tsx +1 -1
- package/src/__tests__/perseus-markdown.test.ts +17 -17
- package/src/__tests__/renderer-api.test.tsx +21 -21
- package/src/__tests__/renderer.test.tsx +13 -13
- package/src/__tests__/server-item-renderer.test.tsx +3 -3
- package/src/__tests__/tex-wrangler.test.ts +1 -1
- package/src/article-renderer.tsx +39 -38
- package/src/components/__tests__/number-input.test.tsx +4 -4
- package/src/components/__tests__/sortable.test.tsx +2 -2
- package/src/components/fixed-to-responsive.tsx +1 -1
- package/src/components/graph.tsx +11 -11
- package/src/components/graphie-classes.ts +7 -7
- package/src/components/graphie.tsx +14 -14
- package/src/components/highlighting/highlightable-content.tsx +1 -1
- package/src/components/highlighting/ui/highlight-renderer.tsx +1 -1
- package/src/components/highlighting/ui/util.ts +2 -2
- package/src/components/highlighting/word-indexer.tsx +4 -4
- package/src/components/icon.tsx +1 -1
- package/src/components/image-loader.tsx +4 -4
- package/src/components/input-with-examples.tsx +2 -2
- package/src/components/lint.tsx +1 -1
- package/src/components/math-input.tsx +5 -5
- package/src/components/math-output.tsx +1 -1
- package/src/components/multi-button-group.tsx +1 -1
- package/src/components/number-input.tsx +10 -10
- package/src/components/prop-check-box.tsx +1 -1
- package/src/components/simple-keypad-input.tsx +4 -4
- package/src/components/sortable.tsx +42 -41
- package/src/components/svg-image.tsx +12 -12
- package/src/components/tex-buttons.tsx +4 -3
- package/src/components/text-input.tsx +8 -8
- package/src/components/text-list-editor.tsx +11 -11
- package/src/components/visibility-observer/create-visibility-observer.ts +1 -1
- package/src/components/visibility-observer/visibility-observer.tsx +2 -2
- package/src/components/zoomable-tex.tsx +3 -3
- package/src/components/zoomable.tsx +8 -8
- package/src/hint-renderer.tsx +3 -3
- package/src/hints-renderer.tsx +11 -11
- package/src/init.ts +1 -1
- package/src/interaction-tracker.ts +4 -4
- package/src/interactive2/__tests__/movable-point.test.ts +1 -1
- package/src/interactive2/interactive-util.ts +6 -6
- package/src/interactive2/movable-helper-methods.ts +2 -2
- package/src/interactive2/movable-line-options.ts +37 -37
- package/src/interactive2/movable-line.ts +2 -2
- package/src/interactive2/movable-point-options.ts +29 -29
- package/src/interactive2/movable-point.tsx +2 -2
- package/src/interactive2/movable-polygon-options.ts +45 -45
- package/src/interactive2/movable-polygon.ts +2 -2
- package/src/interactive2/movable.ts +2 -2
- package/src/interactive2/objective_.ts +1 -1
- package/src/interactive2/wrapped-defaults.ts +2 -2
- package/src/interactive2/wrapped-ellipse.ts +9 -9
- package/src/interactive2/wrapped-line.ts +8 -8
- package/src/interactive2/wrapped-path.ts +5 -5
- package/src/item-renderer.tsx +5 -5
- package/src/mixins/changeable.ts +2 -2
- package/src/mixins/editor-jsonify.ts +1 -1
- package/src/mixins/provide-keypad.tsx +23 -37
- package/src/mixins/widget-jsonify-deprecated.ts +1 -1
- package/src/multi-items/__tests__/items.test.ts +1 -1
- package/src/multi-items/__tests__/multi-renderer.test.tsx +7 -7
- package/src/multi-items/__tests__/trees.test.ts +12 -12
- package/src/multi-items/item-types.ts +2 -2
- package/src/multi-items/items.ts +1 -1
- package/src/multi-items/multi-renderer.tsx +14 -14
- package/src/multi-items/prop-type-builders.ts +2 -2
- package/src/multi-items/tree-types.ts +4 -4
- package/src/multi-items/trees.ts +16 -16
- package/src/perseus-env.ts +2 -2
- package/src/perseus-markdown.tsx +5 -5
- package/src/renderer.tsx +38 -38
- package/src/server-item-renderer.tsx +5 -5
- package/src/sigfigs.ts +1 -1
- package/src/traversal.ts +1 -1
- package/src/types.ts +3 -3
- package/src/util/answer-types.ts +14 -14
- package/src/util/geometry.ts +7 -7
- package/src/util/graphie.ts +32 -32
- package/src/util/interactive.ts +118 -118
- package/src/util/math.ts +4 -4
- package/src/util/react-render.tsx +1 -1
- package/src/util/scroll-utils.ts +2 -2
- package/src/util/tex.ts +3 -3
- package/src/util.ts +15 -15
- package/src/widget-container.tsx +1 -1
- package/src/widgets/__stories__/test-keypad-context-wrapper.tsx +3 -3
- package/src/widgets/__testdata__/numeric-input.testdata.ts +1 -1
- package/src/widgets/__tests__/__snapshots__/video.test.ts.snap +2 -2
- package/src/widgets/__tests__/expression.test.ts +4 -3
- package/src/widgets/__tests__/grapher.cypress.ts +32 -32
- package/src/widgets/__tests__/group.test.tsx +1 -1
- package/src/widgets/__tests__/interactive-graph.cypress.ts +40 -40
- package/src/widgets/__tests__/interactive-graph.test.ts +1 -1
- package/src/widgets/__tests__/numeric-input.test.ts +1 -1
- package/src/widgets/__tests__/passage.test.tsx +2 -2
- package/src/widgets/__tests__/plotter.test.tsx +2 -1
- package/src/widgets/__tests__/radio/base-radio.test.tsx +7 -7
- package/src/widgets/__tests__/renderQuestion.tsx +3 -3
- package/src/widgets/categorizer.tsx +4 -4
- package/src/widgets/cs-program.tsx +2 -2
- package/src/widgets/dropdown.tsx +1 -1
- package/src/widgets/expression.tsx +10 -9
- package/src/widgets/graded-group-set.tsx +5 -5
- package/src/widgets/graded-group.tsx +18 -19
- package/src/widgets/grapher/util.tsx +6 -6
- package/src/widgets/grapher.tsx +10 -10
- package/src/widgets/group.tsx +3 -3
- package/src/widgets/iframe.tsx +2 -2
- package/src/widgets/image.tsx +1 -1
- package/src/widgets/input-number.tsx +4 -4
- package/src/widgets/interaction.tsx +77 -77
- package/src/widgets/interactive-graph.tsx +109 -107
- package/src/widgets/label-image/marker.tsx +2 -2
- package/src/widgets/label-image.test.ts +1 -1
- package/src/widgets/label-image.tsx +7 -7
- package/src/widgets/lights-puzzle.tsx +2 -2
- package/src/widgets/matcher.tsx +6 -6
- package/src/widgets/matrix.tsx +20 -20
- package/src/widgets/measurer.tsx +3 -3
- package/src/widgets/molecule/__tests__/layout.test.ts +4 -4
- package/src/widgets/molecule/__tests__/parser.test.ts +14 -14
- package/src/widgets/molecule/smiles-parser.ts +3 -3
- package/src/widgets/molecule.tsx +4 -4
- package/src/widgets/number-line.tsx +11 -11
- package/src/widgets/numeric-input.tsx +11 -11
- package/src/widgets/orderer.tsx +38 -38
- package/src/widgets/passage/__tests__/passage-markdown.test.ts +1 -1
- package/src/widgets/passage/passage-markdown.tsx +4 -4
- package/src/widgets/passage-ref-target.tsx +1 -1
- package/src/widgets/passage-ref.tsx +4 -6
- package/src/widgets/passage.tsx +11 -11
- package/src/widgets/plotter.tsx +9 -9
- package/src/widgets/radio/base-radio.tsx +11 -11
- package/src/widgets/radio/choice-icon/choice-icon.tsx +2 -2
- package/src/widgets/radio/choice.tsx +1 -1
- package/src/widgets/radio/option-status.tsx +1 -1
- package/src/widgets/radio/widget.tsx +6 -6
- package/src/widgets/radio.ts +1 -1
- package/src/widgets/reaction-diagram.tsx +8 -8
- package/src/widgets/sequence.tsx +2 -2
- package/src/widgets/simulator.tsx +14 -14
- package/src/widgets/sorter.tsx +4 -4
- package/src/widgets/table.tsx +8 -8
- package/src/widgets/transformer.tsx +92 -92
- package/src/widgets/unit.tsx +17 -17
- package/src/widgets/video-transcript-link.test.tsx +3 -3
- package/src/widgets/video-transcript-link.tsx +1 -1
- package/src/widgets/video.tsx +1 -1
- package/src/widgets.ts +5 -5
- package/src/zoom.ts +22 -22
- package/tsconfig-build.tsbuildinfo +1 -1
- package/dist/a11y.js.flow +0 -11
- package/dist/all-widgets.js.flow +0 -33
- package/dist/article-renderer.js.flow +0 -73
- package/dist/asset-context.js.flow +0 -15
- package/dist/basic-widgets.js.flow +0 -33
- package/dist/components/button-group.js.flow +0 -33
- package/dist/components/constants.js.flow +0 -13
- package/dist/components/fixed-to-responsive.js.flow +0 -34
- package/dist/components/graph.js.flow +0 -66
- package/dist/components/graphie-classes.js.flow +0 -19
- package/dist/components/graphie-movables.js.flow +0 -22
- package/dist/components/graphie.js.flow +0 -69
- package/dist/components/highlighting/highlightable-content.js.flow +0 -56
- package/dist/components/highlighting/highlights.js.flow +0 -54
- package/dist/components/highlighting/ranges.js.flow +0 -60
- package/dist/components/highlighting/types.js.flow +0 -70
- package/dist/components/highlighting/ui/highlight-renderer.js.flow +0 -43
- package/dist/components/highlighting/ui/highlight-set-renderer.js.flow +0 -41
- package/dist/components/highlighting/ui/highlight-tooltip.js.flow +0 -22
- package/dist/components/highlighting/ui/highlighting-ui.js.flow +0 -30
- package/dist/components/highlighting/ui/selection-tracker.js.flow +0 -54
- package/dist/components/highlighting/ui/types.js.flow +0 -22
- package/dist/components/highlighting/ui/util.js.flow +0 -42
- package/dist/components/highlighting/word-indexer.js.flow +0 -21
- package/dist/components/hud.js.flow +0 -14
- package/dist/components/icon.js.flow +0 -31
- package/dist/components/image-loader.js.flow +0 -49
- package/dist/components/info-tip/info-tip.js.flow +0 -20
- package/dist/components/info-tip.js.flow +0 -18
- package/dist/components/inline-icon.js.flow +0 -39
- package/dist/components/input-with-examples.js.flow +0 -58
- package/dist/components/lint.js.flow +0 -58
- package/dist/components/math-input.js.flow +0 -49
- package/dist/components/math-output.js.flow +0 -33
- package/dist/components/multi-button-group.js.flow +0 -35
- package/dist/components/number-input.js.flow +0 -42
- package/dist/components/prop-check-box.js.flow +0 -8
- package/dist/components/range-input.js.flow +0 -20
- package/dist/components/simple-keypad-input.js.flow +0 -16
- package/dist/components/sortable.js.flow +0 -91
- package/dist/components/stub-tag-editor.js.flow +0 -18
- package/dist/components/svg-image.js.flow +0 -85
- package/dist/components/tex-buttons.js.flow +0 -26
- package/dist/components/tex.js.flow +0 -25
- package/dist/components/text-input.js.flow +0 -39
- package/dist/components/text-list-editor.js.flow +0 -22
- package/dist/components/tooltip.js.flow +0 -51
- package/dist/components/visibility-observer/create-visibility-observer.js.flow +0 -23
- package/dist/components/visibility-observer/get-scroll-parent.js.flow +0 -7
- package/dist/components/visibility-observer/visibility-observer.js.flow +0 -36
- package/dist/components/zoomable-tex.js.flow +0 -18
- package/dist/components/zoomable.js.flow +0 -70
- package/dist/components.js.flow +0 -22
- package/dist/definition-context.js.flow +0 -25
- package/dist/dependencies.js.flow +0 -9
- package/dist/error-boundary.js.flow +0 -19
- package/dist/extra-widgets.js.flow +0 -33
- package/dist/hint-renderer.js.flow +0 -32
- package/dist/hints-renderer.js.flow +0 -41
- package/dist/icon-paths.js.flow +0 -123
- package/dist/index.js.flow +0 -134
- package/dist/init.js.flow +0 -20
- package/dist/interaction-tracker.js.flow +0 -35
- package/dist/interactive2/interactive-util.js.flow +0 -50
- package/dist/interactive2/movable-helper-methods.js.flow +0 -15
- package/dist/interactive2/movable-line-options.js.flow +0 -44
- package/dist/interactive2/movable-line.js.flow +0 -8
- package/dist/interactive2/movable-point-options.js.flow +0 -44
- package/dist/interactive2/movable-point.js.flow +0 -8
- package/dist/interactive2/movable-polygon-options.js.flow +0 -47
- package/dist/interactive2/movable-polygon.js.flow +0 -8
- package/dist/interactive2/movable.js.flow +0 -8
- package/dist/interactive2/objective_.js.flow +0 -25
- package/dist/interactive2/types.js.flow +0 -8
- package/dist/interactive2/wrapped-defaults.js.flow +0 -11
- package/dist/interactive2/wrapped-ellipse.js.flow +0 -14
- package/dist/interactive2/wrapped-line.js.flow +0 -14
- package/dist/interactive2/wrapped-path.js.flow +0 -13
- package/dist/interactive2.js.flow +0 -16
- package/dist/item-renderer.js.flow +0 -132
- package/dist/item-version.js.flow +0 -11
- package/dist/jipt-paragraphs.js.flow +0 -14
- package/dist/loading-context.js.flow +0 -12
- package/dist/logging/log.js.flow +0 -62
- package/dist/mixins/changeable.js.flow +0 -33
- package/dist/mixins/editor-jsonify.js.flow +0 -10
- package/dist/mixins/provide-keypad.js.flow +0 -33
- package/dist/mixins/widget-jsonify-deprecated.js.flow +0 -11
- package/dist/mixins/widget-prop-denylist.js.flow +0 -20
- package/dist/multi-items/item-types.js.flow +0 -55
- package/dist/multi-items/items.js.flow +0 -66
- package/dist/multi-items/multi-renderer.js.flow +0 -213
- package/dist/multi-items/prop-type-builders.js.flow +0 -22
- package/dist/multi-items/shape-types.js.flow +0 -60
- package/dist/multi-items/shapes.js.flow +0 -25
- package/dist/multi-items/tree-types.js.flow +0 -45
- package/dist/multi-items/trees.js.flow +0 -147
- package/dist/multi-items.js.flow +0 -36
- package/dist/perseus-api.js.flow +0 -151
- package/dist/perseus-env.js.flow +0 -6
- package/dist/perseus-error.js.flow +0 -16
- package/dist/perseus-markdown.js.flow +0 -20
- package/dist/perseus-types.js.flow +0 -1041
- package/dist/question-paragraph.js.flow +0 -17
- package/dist/renderability.js.flow +0 -19
- package/dist/renderer.js.flow +0 -325
- package/dist/server-item-renderer.js.flow +0 -132
- package/dist/sigfigs.js.flow +0 -41
- package/dist/styles/constants.js.flow +0 -62
- package/dist/styles/global-constants.js.flow +0 -348
- package/dist/styles/global-styles.js.flow +0 -53
- package/dist/styles/media-queries.js.flow +0 -35
- package/dist/styles/shared.js.flow +0 -8
- package/dist/tex-wrangler.js.flow +0 -13
- package/dist/translation-linter.js.flow +0 -32
- package/dist/traversal.js.flow +0 -26
- package/dist/types.js.flow +0 -318
- package/dist/util/a11y.js.flow +0 -8
- package/dist/util/answer-types.js.flow +0 -49
- package/dist/util/colors.js.flow +0 -95
- package/dist/util/fix-passage-refs.js.flow +0 -8
- package/dist/util/geometry.js.flow +0 -37
- package/dist/util/graph-utils.js.flow +0 -9
- package/dist/util/graphie.js.flow +0 -8
- package/dist/util/interactive.js.flow +0 -11
- package/dist/util/katex-preprocess.js.flow +0 -12
- package/dist/util/math.js.flow +0 -62
- package/dist/util/mobile-native-utils.js.flow +0 -12
- package/dist/util/react-render.js.flow +0 -12
- package/dist/util/register-all-widgets-for-testing.js.flow +0 -7
- package/dist/util/scroll-utils.js.flow +0 -19
- package/dist/util/sizing-utils.js.flow +0 -20
- package/dist/util/tex.js.flow +0 -17
- package/dist/util/url-utils.js.flow +0 -11
- package/dist/util.graphie.js.flow +0 -14
- package/dist/util.js.flow +0 -319
- package/dist/version.js.flow +0 -17
- package/dist/widget-container.js.flow +0 -33
- package/dist/widgets/categorizer.js.flow +0 -70
- package/dist/widgets/cs-program.js.flow +0 -54
- package/dist/widgets/definition.js.flow +0 -57
- package/dist/widgets/dropdown.js.flow +0 -63
- package/dist/widgets/explanation.js.flow +0 -58
- package/dist/widgets/expression.js.flow +0 -116
- package/dist/widgets/graded-group-answer-bar.js.flow +0 -24
- package/dist/widgets/graded-group-set.js.flow +0 -65
- package/dist/widgets/graded-group.js.flow +0 -78
- package/dist/widgets/grapher/util.js.flow +0 -38
- package/dist/widgets/grapher.js.flow +0 -102
- package/dist/widgets/group.js.flow +0 -60
- package/dist/widgets/iframe.js.flow +0 -53
- package/dist/widgets/image.js.flow +0 -73
- package/dist/widgets/input-number.js.flow +0 -94
- package/dist/widgets/interaction/arrow-picker.js.flow +0 -21
- package/dist/widgets/interaction/color-picker.js.flow +0 -23
- package/dist/widgets/interaction/dash-picker.js.flow +0 -21
- package/dist/widgets/interaction/element-container.js.flow +0 -28
- package/dist/widgets/interaction.js.flow +0 -60
- package/dist/widgets/interactive-graph.js.flow +0 -239
- package/dist/widgets/label-image/answer-choices.js.flow +0 -55
- package/dist/widgets/label-image/marker.js.flow +0 -31
- package/dist/widgets/label-image/types.js.flow +0 -23
- package/dist/widgets/label-image.js.flow +0 -142
- package/dist/widgets/lights-puzzle.js.flow +0 -58
- package/dist/widgets/matcher.js.flow +0 -106
- package/dist/widgets/matrix.js.flow +0 -80
- package/dist/widgets/measurer.js.flow +0 -30
- package/dist/widgets/molecule/molecule-drawing.js.flow +0 -11
- package/dist/widgets/molecule/molecule-layout.js.flow +0 -96
- package/dist/widgets/molecule/smiles-parser.js.flow +0 -26
- package/dist/widgets/molecule.js.flow +0 -60
- package/dist/widgets/number-line.js.flow +0 -102
- package/dist/widgets/numeric-input.js.flow +0 -105
- package/dist/widgets/orderer.js.flow +0 -81
- package/dist/widgets/passage/passage-markdown.js.flow +0 -33
- package/dist/widgets/passage-ref-target.js.flow +0 -52
- package/dist/widgets/passage-ref.js.flow +0 -85
- package/dist/widgets/passage.js.flow +0 -157
- package/dist/widgets/plotter.js.flow +0 -112
- package/dist/widgets/radio/base-radio.js.flow +0 -50
- package/dist/widgets/radio/choice-a11y-text.js.flow +0 -14
- package/dist/widgets/radio/choice-icon/choice-icon.js.flow +0 -22
- package/dist/widgets/radio/choice-icon/cross-out-line.js.flow +0 -16
- package/dist/widgets/radio/choice-icon/shared-styles.js.flow +0 -11
- package/dist/widgets/radio/choice-none-above.js.flow +0 -16
- package/dist/widgets/radio/choice.js.flow +0 -29
- package/dist/widgets/radio/choice.jsx.fixture.js.flow +0 -7
- package/dist/widgets/radio/focus-ring.js.flow +0 -22
- package/dist/widgets/radio/option-status.js.flow +0 -16
- package/dist/widgets/radio/util.js.flow +0 -12
- package/dist/widgets/radio/widget.js.flow +0 -80
- package/dist/widgets/radio.js.flow +0 -31
- package/dist/widgets/reaction-diagram.js.flow +0 -46
- package/dist/widgets/sequence.js.flow +0 -53
- package/dist/widgets/simulator.js.flow +0 -107
- package/dist/widgets/sorter.js.flow +0 -102
- package/dist/widgets/table.js.flow +0 -67
- package/dist/widgets/transformer.js.flow +0 -127
- package/dist/widgets/unit.js.flow +0 -93
- package/dist/widgets/video-transcript-link.js.flow +0 -15
- package/dist/widgets/video.js.flow +0 -57
- package/dist/widgets.js.flow +0 -108
- package/dist/zoom.js.flow +0 -7
- package/src/multi-items/item-types.js.flow +0 -55
|
@@ -273,11 +273,11 @@ const TransformOps = {
|
|
|
273
273
|
// TODO (jack): Merge this just into reflections now that other
|
|
274
274
|
// transforms are always valid (after merging transformation
|
|
275
275
|
// collapsing, which may use isValid)
|
|
276
|
-
// @ts-expect-error
|
|
276
|
+
// @ts-expect-error - TS2345 - Argument of type 'PerseusTransformerTransformation' is not assignable to parameter of type 'never'.
|
|
277
277
|
if (!Transformations[transform.type].isValid(transform)) {
|
|
278
278
|
return _.identity; // do not transform the coord
|
|
279
279
|
}
|
|
280
|
-
// @ts-expect-error
|
|
280
|
+
// @ts-expect-error - TS2345 - Argument of type 'PerseusTransformerTransformation' is not assignable to parameter of type 'never'.
|
|
281
281
|
return Transformations[transform.type].apply(transform);
|
|
282
282
|
},
|
|
283
283
|
|
|
@@ -344,12 +344,12 @@ const TransformOps = {
|
|
|
344
344
|
},
|
|
345
345
|
|
|
346
346
|
isValid: function (transform: TransformerTransformation): boolean {
|
|
347
|
-
// @ts-expect-error
|
|
347
|
+
// @ts-expect-error - TS2345 - Argument of type 'PerseusTransformerTransformation' is not assignable to parameter of type 'never'.
|
|
348
348
|
return Transformations[transform.type].isValid(transform);
|
|
349
349
|
},
|
|
350
350
|
|
|
351
351
|
isEmpty: function (transform: TransformerTransformation): boolean {
|
|
352
|
-
// @ts-expect-error
|
|
352
|
+
// @ts-expect-error - TS2345 - Argument of type 'PerseusTransformerTransformation' is not assignable to parameter of type 'never'.
|
|
353
353
|
return Transformations[transform.type].isEmpty(transform);
|
|
354
354
|
},
|
|
355
355
|
|
|
@@ -421,7 +421,7 @@ const TransformOps = {
|
|
|
421
421
|
},
|
|
422
422
|
|
|
423
423
|
handleChange: _.debounce(function (callback) {
|
|
424
|
-
// @ts-expect-error
|
|
424
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation. | TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
425
425
|
this.props.onChange(this.value(), callback);
|
|
426
426
|
}, RENDER_TRANSFORM_DELAY_IN_MS),
|
|
427
427
|
|
|
@@ -465,9 +465,9 @@ const TransformOps = {
|
|
|
465
465
|
// We let through the empty string so that "Clear" works -- in
|
|
466
466
|
// that case, the transformer widget will just act as if there is
|
|
467
467
|
// no input, which is what we want.
|
|
468
|
-
// @ts-expect-error
|
|
468
|
+
// @ts-expect-error - TS2339 - Property 'length' does not exist on type 'string | number'.
|
|
469
469
|
if (value.length) {
|
|
470
|
-
// @ts-expect-error
|
|
470
|
+
// @ts-expect-error - TS2345 - Argument of type 'string | number' is not assignable to parameter of type 'string'.
|
|
471
471
|
value = parseFloat(value);
|
|
472
472
|
if (isNaN(value)) {
|
|
473
473
|
return;
|
|
@@ -591,10 +591,10 @@ const Transformations = {
|
|
|
591
591
|
|
|
592
592
|
value = () => {
|
|
593
593
|
// eslint-disable-next-line react/no-string-refs
|
|
594
|
-
// @ts-expect-error
|
|
594
|
+
// @ts-expect-error - TS2339 - Property 'getValue' does not exist on type 'ReactInstance'.
|
|
595
595
|
const x = this.refs.x.getValue();
|
|
596
596
|
// eslint-disable-next-line react/no-string-refs
|
|
597
|
-
// @ts-expect-error
|
|
597
|
+
// @ts-expect-error - TS2339 - Property 'getValue' does not exist on type 'ReactInstance'.
|
|
598
598
|
const y = this.refs.y.getValue();
|
|
599
599
|
return {
|
|
600
600
|
vector: [x, y],
|
|
@@ -763,13 +763,13 @@ const Transformations = {
|
|
|
763
763
|
|
|
764
764
|
value = () => {
|
|
765
765
|
// eslint-disable-next-line react/no-string-refs
|
|
766
|
-
// @ts-expect-error
|
|
766
|
+
// @ts-expect-error - TS2339 - Property 'getValue' does not exist on type 'ReactInstance'.
|
|
767
767
|
const angleDeg = this.refs.angleDeg.getValue();
|
|
768
768
|
// eslint-disable-next-line react/no-string-refs
|
|
769
|
-
// @ts-expect-error
|
|
769
|
+
// @ts-expect-error - TS2339 - Property 'getValue' does not exist on type 'ReactInstance'.
|
|
770
770
|
const centerX = this.refs.centerX.getValue();
|
|
771
771
|
// eslint-disable-next-line react/no-string-refs
|
|
772
|
-
// @ts-expect-error
|
|
772
|
+
// @ts-expect-error - TS2339 - Property 'getValue' does not exist on type 'ReactInstance'.
|
|
773
773
|
const centerY = this.refs.centerY.getValue();
|
|
774
774
|
return {
|
|
775
775
|
angleDeg: angleDeg,
|
|
@@ -942,7 +942,7 @@ const Transformations = {
|
|
|
942
942
|
cb,
|
|
943
943
|
) => {
|
|
944
944
|
const line = _.map(this.state.line, _.clone);
|
|
945
|
-
// @ts-expect-error
|
|
945
|
+
// @ts-expect-error - TS2538 - Type 'undefined' cannot be used as an index type.
|
|
946
946
|
line[i][j] = val;
|
|
947
947
|
this.setState({line: line}, () => {
|
|
948
948
|
this.props.onChange(cb);
|
|
@@ -951,16 +951,16 @@ const Transformations = {
|
|
|
951
951
|
|
|
952
952
|
value = () => {
|
|
953
953
|
// eslint-disable-next-line react/no-string-refs
|
|
954
|
-
// @ts-expect-error
|
|
954
|
+
// @ts-expect-error - TS2339 - Property 'getValue' does not exist on type 'ReactInstance'.
|
|
955
955
|
const x1 = this.refs.x1.getValue();
|
|
956
956
|
// eslint-disable-next-line react/no-string-refs
|
|
957
|
-
// @ts-expect-error
|
|
957
|
+
// @ts-expect-error - TS2339 - Property 'getValue' does not exist on type 'ReactInstance'.
|
|
958
958
|
const y1 = this.refs.y1.getValue();
|
|
959
959
|
// eslint-disable-next-line react/no-string-refs
|
|
960
|
-
// @ts-expect-error
|
|
960
|
+
// @ts-expect-error - TS2339 - Property 'getValue' does not exist on type 'ReactInstance'.
|
|
961
961
|
const x2 = this.refs.x2.getValue();
|
|
962
962
|
// eslint-disable-next-line react/no-string-refs
|
|
963
|
-
// @ts-expect-error
|
|
963
|
+
// @ts-expect-error - TS2339 - Property 'getValue' does not exist on type 'ReactInstance'.
|
|
964
964
|
const y2 = this.refs.y2.getValue();
|
|
965
965
|
return {
|
|
966
966
|
line: [
|
|
@@ -1133,13 +1133,13 @@ const Transformations = {
|
|
|
1133
1133
|
|
|
1134
1134
|
value = () => {
|
|
1135
1135
|
// eslint-disable-next-line react/no-string-refs
|
|
1136
|
-
// @ts-expect-error
|
|
1136
|
+
// @ts-expect-error - TS2339 - Property 'getValue' does not exist on type 'ReactInstance'.
|
|
1137
1137
|
const scale = this.refs.scale.getValue();
|
|
1138
1138
|
// eslint-disable-next-line react/no-string-refs
|
|
1139
|
-
// @ts-expect-error
|
|
1139
|
+
// @ts-expect-error - TS2339 - Property 'getValue' does not exist on type 'ReactInstance'.
|
|
1140
1140
|
const x = this.refs.x.getValue();
|
|
1141
1141
|
// eslint-disable-next-line react/no-string-refs
|
|
1142
|
-
// @ts-expect-error
|
|
1142
|
+
// @ts-expect-error - TS2339 - Property 'getValue' does not exist on type 'ReactInstance'.
|
|
1143
1143
|
const y = this.refs.y.getValue();
|
|
1144
1144
|
return {
|
|
1145
1145
|
scale: scale,
|
|
@@ -1313,7 +1313,7 @@ const ShapeTypes = {
|
|
|
1313
1313
|
const typeOptions =
|
|
1314
1314
|
options.shape.options || ShapeTypes.defaultOptions(types);
|
|
1315
1315
|
|
|
1316
|
-
// @ts-expect-error
|
|
1316
|
+
// @ts-expect-error - TS2554 - Expected 4 arguments, but got 3.
|
|
1317
1317
|
const shapes = ShapeTypes._mapTypes(
|
|
1318
1318
|
types,
|
|
1319
1319
|
points,
|
|
@@ -1372,13 +1372,13 @@ const ShapeTypes = {
|
|
|
1372
1372
|
if (types1.length !== types2.length) {
|
|
1373
1373
|
return false;
|
|
1374
1374
|
}
|
|
1375
|
-
// @ts-expect-error
|
|
1375
|
+
// @ts-expect-error - TS2554 - Expected 4 arguments, but got 3.
|
|
1376
1376
|
const shapes1 = ShapeTypes._mapTypes(
|
|
1377
1377
|
types1,
|
|
1378
1378
|
shape1.coords,
|
|
1379
1379
|
ShapeTypes._combine,
|
|
1380
1380
|
);
|
|
1381
|
-
// @ts-expect-error
|
|
1381
|
+
// @ts-expect-error - TS2554 - Expected 4 arguments, but got 3.
|
|
1382
1382
|
const shapes2 = ShapeTypes._mapTypes(
|
|
1383
1383
|
types2,
|
|
1384
1384
|
shape2.coords,
|
|
@@ -1520,7 +1520,7 @@ const ShapeTypes = {
|
|
|
1520
1520
|
const coord0 = points[0].coord || points[0];
|
|
1521
1521
|
const coord1 = points[1].coord || points[1];
|
|
1522
1522
|
const radius = kpoint.distanceToPoint(coord0, coord1);
|
|
1523
|
-
// @ts-expect-error
|
|
1523
|
+
// @ts-expect-error - TS2554 - Expected 1 arguments, but got 0.
|
|
1524
1524
|
perimeter.remove();
|
|
1525
1525
|
perimeter = graphie.circle(
|
|
1526
1526
|
coord0,
|
|
@@ -1545,7 +1545,7 @@ const ShapeTypes = {
|
|
|
1545
1545
|
remove: function () {
|
|
1546
1546
|
// Not _.bind because the remove function changes
|
|
1547
1547
|
// when the perimeter is redrawn
|
|
1548
|
-
// @ts-expect-error
|
|
1548
|
+
// @ts-expect-error - TS2554 - Expected 1 arguments, but got 0.
|
|
1549
1549
|
perimeter.remove();
|
|
1550
1550
|
},
|
|
1551
1551
|
};
|
|
@@ -1594,10 +1594,10 @@ const ShapeTypes = {
|
|
|
1594
1594
|
const line2_2 = [points2[1], points2[2]];
|
|
1595
1595
|
|
|
1596
1596
|
const equalUnflipped =
|
|
1597
|
-
// @ts-expect-error
|
|
1597
|
+
// @ts-expect-error - TS2345 - Argument of type 'any[]' is not assignable to parameter of type 'Ray'. | TS2345 - Argument of type 'any[]' is not assignable to parameter of type 'Ray'.
|
|
1598
1598
|
kray.equal(line1_0, line2_0) && kray.equal(line1_2, line2_2);
|
|
1599
1599
|
const equalFlipped =
|
|
1600
|
-
// @ts-expect-error
|
|
1600
|
+
// @ts-expect-error - TS2345 - Argument of type 'any[]' is not assignable to parameter of type 'Ray'. | TS2345 - Argument of type 'any[]' is not assignable to parameter of type 'Ray'.
|
|
1601
1601
|
kray.equal(line1_0, line2_2) && kray.equal(line1_2, line2_0);
|
|
1602
1602
|
|
|
1603
1603
|
return equalUnflipped || equalFlipped;
|
|
@@ -1640,17 +1640,17 @@ class TransformationList extends React.Component<any, any> {
|
|
|
1640
1640
|
ref={"transformation" + i}
|
|
1641
1641
|
key={"transformation" + i}
|
|
1642
1642
|
transform={transform}
|
|
1643
|
-
// @ts-expect-error
|
|
1643
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
1644
1644
|
mode={this.props.mode}
|
|
1645
|
-
// @ts-expect-error
|
|
1645
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
1646
1646
|
onChange={this.handleChange}
|
|
1647
|
-
// @ts-expect-error
|
|
1647
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
1648
1648
|
onFocus={_.partial(this.props.onFocus, "" + i)}
|
|
1649
|
-
// @ts-expect-error
|
|
1649
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
1650
1650
|
onBlur={_.partial(this.props.onBlur, "" + i)}
|
|
1651
|
-
// @ts-expect-error
|
|
1651
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
1652
1652
|
keypadElement={this.props.keypadElement}
|
|
1653
|
-
// @ts-expect-error
|
|
1653
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
1654
1654
|
apiOptions={this.props.apiOptions}
|
|
1655
1655
|
/>
|
|
1656
1656
|
);
|
|
@@ -1683,7 +1683,7 @@ class TransformationList extends React.Component<any, any> {
|
|
|
1683
1683
|
focusLast = () => {
|
|
1684
1684
|
const transformationRefs = this._transformationRefs();
|
|
1685
1685
|
if (transformationRefs.length !== 0) {
|
|
1686
|
-
// @ts-expect-error
|
|
1686
|
+
// @ts-expect-error - TS2532 - Object is possibly 'undefined'. | TS2339 - Property 'focus' does not exist on type 'ReactInstance'.
|
|
1687
1687
|
_.last(transformationRefs).focus();
|
|
1688
1688
|
}
|
|
1689
1689
|
};
|
|
@@ -1701,7 +1701,7 @@ class ToolButton extends React.Component<any, any> {
|
|
|
1701
1701
|
className={classes}
|
|
1702
1702
|
disabled={this.props.disabled}
|
|
1703
1703
|
onClick={this.props.onClick}
|
|
1704
|
-
// @ts-expect-error
|
|
1704
|
+
// @ts-expect-error - TS2322 - Type '(e: TouchEvent) => void' is not assignable to type 'TouchEventHandler<HTMLButtonElement>'.
|
|
1705
1705
|
onTouchStart={captureScratchpadTouchStart}
|
|
1706
1706
|
>
|
|
1707
1707
|
{this.props.children}
|
|
@@ -1719,17 +1719,17 @@ class ToolsBar extends React.Component<any, any> {
|
|
|
1719
1719
|
const tools = _.map(
|
|
1720
1720
|
Transformations,
|
|
1721
1721
|
function (tool, type) {
|
|
1722
|
-
// @ts-expect-error
|
|
1722
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
1723
1723
|
if (this.props.enabled[type]) {
|
|
1724
1724
|
return (
|
|
1725
1725
|
<ToolButton
|
|
1726
1726
|
key={type}
|
|
1727
|
-
// @ts-expect-error
|
|
1727
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
1728
1728
|
disabled={this.props.apiOptions.readOnly}
|
|
1729
|
-
// @ts-expect-error
|
|
1729
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
1730
1730
|
toggled={this.state.selected === type}
|
|
1731
1731
|
// eslint-disable-next-line react/jsx-no-bind
|
|
1732
|
-
// @ts-expect-error
|
|
1732
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation. | TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
1733
1733
|
onClick={this.changeSelected.bind(this, type)}
|
|
1734
1734
|
>
|
|
1735
1735
|
{tool.verbName}
|
|
@@ -1748,7 +1748,7 @@ class ToolsBar extends React.Component<any, any> {
|
|
|
1748
1748
|
type="button"
|
|
1749
1749
|
disabled={this.props.apiOptions.readOnly}
|
|
1750
1750
|
onClick={this.props.onUndoClick}
|
|
1751
|
-
// @ts-expect-error
|
|
1751
|
+
// @ts-expect-error - TS2322 - Type '(e: TouchEvent) => void' is not assignable to type 'TouchEventHandler<HTMLButtonElement>'.
|
|
1752
1752
|
onTouchStart={captureScratchpadTouchStart}
|
|
1753
1753
|
>
|
|
1754
1754
|
<InlineIcon {...iconUndo} />
|
|
@@ -1780,16 +1780,16 @@ class AddTransformBar extends React.Component<any, any> {
|
|
|
1780
1780
|
const tools = _.map(
|
|
1781
1781
|
Transformations,
|
|
1782
1782
|
function (tool, type) {
|
|
1783
|
-
// @ts-expect-error
|
|
1783
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
1784
1784
|
if (this.props.enabled[type]) {
|
|
1785
1785
|
return (
|
|
1786
1786
|
<ToolButton
|
|
1787
1787
|
key={type}
|
|
1788
1788
|
toggled={false}
|
|
1789
|
-
// @ts-expect-error
|
|
1789
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
1790
1790
|
disabled={this.props.apiOptions.readOnly}
|
|
1791
1791
|
// eslint-disable-next-line react/jsx-no-bind
|
|
1792
|
-
// @ts-expect-error
|
|
1792
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation. | TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
1793
1793
|
onClick={this.changeSelected.bind(this, type)}
|
|
1794
1794
|
>
|
|
1795
1795
|
<InlineIcon {...iconPlus} /> {tool.nounName}
|
|
@@ -1808,7 +1808,7 @@ class AddTransformBar extends React.Component<any, any> {
|
|
|
1808
1808
|
type="button"
|
|
1809
1809
|
onClick={this.props.onUndoClick}
|
|
1810
1810
|
disabled={this.props.apiOptions.readOnly}
|
|
1811
|
-
// @ts-expect-error
|
|
1811
|
+
// @ts-expect-error - TS2322 - Type '(e: TouchEvent) => void' is not assignable to type 'TouchEventHandler<HTMLButtonElement>'.
|
|
1812
1812
|
onTouchStart={captureScratchpadTouchStart}
|
|
1813
1813
|
>
|
|
1814
1814
|
<InlineIcon {...iconUndo} />
|
|
@@ -1839,12 +1839,12 @@ type Props = WidgetProps<RenderProps, Rubric> & {
|
|
|
1839
1839
|
};
|
|
1840
1840
|
|
|
1841
1841
|
class Transformer extends React.Component<Props> {
|
|
1842
|
-
// @ts-expect-error
|
|
1842
|
+
// @ts-expect-error - TS2564 - Property 'tools' has no initializer and is not definitely assigned in the constructor.
|
|
1843
1843
|
tools: {
|
|
1844
1844
|
[key: string]: Tool;
|
|
1845
1845
|
};
|
|
1846
1846
|
currentTool: Tool | null | undefined;
|
|
1847
|
-
// @ts-expect-error
|
|
1847
|
+
// @ts-expect-error - TS2564 - Property 'transformations' has no initializer and is not definitely assigned in the constructor.
|
|
1848
1848
|
transformations: ReadonlyArray<TransformerTransformation>;
|
|
1849
1849
|
shape: any | null | undefined; // This is not the same as TransformerShape
|
|
1850
1850
|
dilationCircle: any | null | undefined;
|
|
@@ -1946,7 +1946,7 @@ class Transformer extends React.Component<Props> {
|
|
|
1946
1946
|
componentDidUpdate(prevProps: Props) {
|
|
1947
1947
|
if (this.shouldSetupGraphie(this.props, prevProps)) {
|
|
1948
1948
|
// eslint-disable-next-line react/no-string-refs
|
|
1949
|
-
// @ts-expect-error
|
|
1949
|
+
// @ts-expect-error - TS2339 - Property 'reset' does not exist on type 'ReactInstance'.
|
|
1950
1950
|
this.refs.graph.reset();
|
|
1951
1951
|
} else if (!deepEq(this.props.transformations, this.transformations)) {
|
|
1952
1952
|
this.setTransformations(this.props.transformations);
|
|
@@ -1983,7 +1983,7 @@ class Transformer extends React.Component<Props> {
|
|
|
1983
1983
|
|
|
1984
1984
|
graphie: () => Graphie = () => {
|
|
1985
1985
|
// eslint-disable-next-line react/no-string-refs
|
|
1986
|
-
// @ts-expect-error
|
|
1986
|
+
// @ts-expect-error - TS2339 - Property 'graphie' does not exist on type 'ReactInstance'.
|
|
1987
1987
|
return this.refs.graph.graphie();
|
|
1988
1988
|
};
|
|
1989
1989
|
|
|
@@ -1994,7 +1994,7 @@ class Transformer extends React.Component<Props> {
|
|
|
1994
1994
|
this.props.correct.shape &&
|
|
1995
1995
|
this.props.correct.shape.coords
|
|
1996
1996
|
) {
|
|
1997
|
-
// @ts-expect-error
|
|
1997
|
+
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 2.
|
|
1998
1998
|
ShapeTypes.addShape(graphie, {
|
|
1999
1999
|
fixed: true,
|
|
2000
2000
|
shape: this.props.correct.shape,
|
|
@@ -2008,7 +2008,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2008
2008
|
|
|
2009
2009
|
this.currentTool = null;
|
|
2010
2010
|
// eslint-disable-next-line react/no-string-refs
|
|
2011
|
-
// @ts-expect-error
|
|
2011
|
+
// @ts-expect-error - TS2339 - Property 'changeSelected' does not exist on type 'ReactInstance'.
|
|
2012
2012
|
this.refs.toolsBar.changeSelected(null);
|
|
2013
2013
|
this.addTransformerShape(
|
|
2014
2014
|
this.props.starting.shape,
|
|
@@ -2062,7 +2062,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2062
2062
|
dX = KhanMath.roundToNearest(graphie.snap[0], dX);
|
|
2063
2063
|
dY = KhanMath.roundToNearest(graphie.snap[1], dY);
|
|
2064
2064
|
// NOTE(kevinb): object is missing .constraints property
|
|
2065
|
-
// @ts-expect-error
|
|
2065
|
+
// @ts-expect-error - TS2345 - Argument of type '{ type: "translation"; vector: [any, any]; }' is not assignable to parameter of type 'PerseusTransformerTransformation'.
|
|
2066
2066
|
self.addTransform({
|
|
2067
2067
|
type: "translation",
|
|
2068
2068
|
vector: [dX, dY],
|
|
@@ -2109,7 +2109,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2109
2109
|
transform = {
|
|
2110
2110
|
type: "translation",
|
|
2111
2111
|
// NOTE(kevib): these should be numbers
|
|
2112
|
-
// @ts-expect-error
|
|
2112
|
+
// @ts-expect-error - TS2322 - Type 'null' is not assignable to type 'number'. | TS2322 - Type 'null' is not assignable to type 'number'.
|
|
2113
2113
|
vector: [null, null],
|
|
2114
2114
|
};
|
|
2115
2115
|
} else if (toolId === "rotation") {
|
|
@@ -2117,10 +2117,10 @@ class Transformer extends React.Component<Props> {
|
|
|
2117
2117
|
transform = {
|
|
2118
2118
|
type: "rotation",
|
|
2119
2119
|
// NOTE(kevib): these should be numbers
|
|
2120
|
-
// @ts-expect-error
|
|
2120
|
+
// @ts-expect-error - TS2322 - Type 'null' is not assignable to type 'number'. | TS2322 - Type 'null' is not assignable to type 'number'.
|
|
2121
2121
|
center: [null, null],
|
|
2122
2122
|
// NOTE(kevib): this should be a number
|
|
2123
|
-
// @ts-expect-error
|
|
2123
|
+
// @ts-expect-error - TS2322 - Type 'null' is not assignable to type 'number'.
|
|
2124
2124
|
angleDeg: null,
|
|
2125
2125
|
};
|
|
2126
2126
|
} else if (toolId === "reflection") {
|
|
@@ -2130,10 +2130,10 @@ class Transformer extends React.Component<Props> {
|
|
|
2130
2130
|
type: "reflection",
|
|
2131
2131
|
line: [
|
|
2132
2132
|
// NOTE(kevib): these should be numbers
|
|
2133
|
-
// @ts-expect-error
|
|
2133
|
+
// @ts-expect-error - TS2322 - Type 'null' is not assignable to type 'number'. | TS2322 - Type 'null' is not assignable to type 'number'.
|
|
2134
2134
|
[null, null],
|
|
2135
2135
|
// NOTE(kevib): these should be numbers
|
|
2136
|
-
// @ts-expect-error
|
|
2136
|
+
// @ts-expect-error - TS2322 - Type 'null' is not assignable to type 'number'. | TS2322 - Type 'null' is not assignable to type 'number'.
|
|
2137
2137
|
[null, null],
|
|
2138
2138
|
],
|
|
2139
2139
|
};
|
|
@@ -2142,10 +2142,10 @@ class Transformer extends React.Component<Props> {
|
|
|
2142
2142
|
transform = {
|
|
2143
2143
|
type: "dilation",
|
|
2144
2144
|
// NOTE(kevib): these should be numbers
|
|
2145
|
-
// @ts-expect-error
|
|
2145
|
+
// @ts-expect-error - TS2322 - Type 'null' is not assignable to type 'number'. | TS2322 - Type 'null' is not assignable to type 'number'.
|
|
2146
2146
|
center: [null, null],
|
|
2147
2147
|
// NOTE(kevib): this should be a number
|
|
2148
|
-
// @ts-expect-error
|
|
2148
|
+
// @ts-expect-error - TS2322 - Type 'null' is not assignable to type 'number'.
|
|
2149
2149
|
scale: null,
|
|
2150
2150
|
};
|
|
2151
2151
|
} else {
|
|
@@ -2156,7 +2156,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2156
2156
|
}
|
|
2157
2157
|
|
|
2158
2158
|
this.doTransform(transform, function () {
|
|
2159
|
-
// @ts-expect-error
|
|
2159
|
+
// @ts-expect-error - TS2339 - Property 'focusLast' does not exist on type 'ReactInstance'.
|
|
2160
2160
|
self.refs.transformationList.focusLast();
|
|
2161
2161
|
});
|
|
2162
2162
|
}
|
|
@@ -2186,7 +2186,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2186
2186
|
};
|
|
2187
2187
|
|
|
2188
2188
|
// Snaps a coord to this.graphie()'s snap
|
|
2189
|
-
// @ts-expect-error
|
|
2189
|
+
// @ts-expect-error - TS2322 - Type '(coord: Coord) => number[]' is not assignable to type '(arg1: Coord) => Coord'.
|
|
2190
2190
|
snapCoord: (arg1: Coord) => Coord = (coord) => {
|
|
2191
2191
|
const graphie = this.graphie();
|
|
2192
2192
|
return _.map(coord, function (val, dim) {
|
|
@@ -2196,11 +2196,11 @@ class Transformer extends React.Component<Props> {
|
|
|
2196
2196
|
|
|
2197
2197
|
// Normalize the coords into something that fits the new 45 degree
|
|
2198
2198
|
// reflection line.
|
|
2199
|
-
// @ts-expect-error
|
|
2199
|
+
// @ts-expect-error - TS2322 - Type '(messyCoords: [Coord, Coord]) => any[]' is not assignable to type '(arg1: [Coord, Coord]) => [Coord, Coord]'.
|
|
2200
2200
|
normalizeReflectionCoords: (arg1: [Coord, Coord]) => [Coord, Coord] = (
|
|
2201
2201
|
messyCoords,
|
|
2202
2202
|
) => {
|
|
2203
|
-
// @ts-expect-error
|
|
2203
|
+
// @ts-expect-error - TS2345 - Argument of type 'Point' is not assignable to parameter of type 'Coord'.
|
|
2204
2204
|
const midpoint = this.snapCoord(kline.midpoint(messyCoords));
|
|
2205
2205
|
const origDirectionPolar = kvector.polarDegFromCart(
|
|
2206
2206
|
kvector.subtract(messyCoords[0], messyCoords[1]),
|
|
@@ -2218,13 +2218,13 @@ class Transformer extends React.Component<Props> {
|
|
|
2218
2218
|
kvector.scale(
|
|
2219
2219
|
direction,
|
|
2220
2220
|
directionCoefficient *
|
|
2221
|
-
// @ts-expect-error
|
|
2221
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
2222
2222
|
this.scaleToCurrentRange(
|
|
2223
2223
|
REFLECT_ROTATE_HANDLE_DIST,
|
|
2224
2224
|
),
|
|
2225
2225
|
),
|
|
2226
2226
|
);
|
|
2227
|
-
// @ts-expect-error
|
|
2227
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
2228
2228
|
return this.snapCoord(coord);
|
|
2229
2229
|
},
|
|
2230
2230
|
this,
|
|
@@ -2239,7 +2239,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2239
2239
|
}
|
|
2240
2240
|
const self = this;
|
|
2241
2241
|
// eslint-disable-next-line react/no-string-refs
|
|
2242
|
-
// @ts-expect-error
|
|
2242
|
+
// @ts-expect-error - TS2339 - Property 'graphie' does not exist on type 'ReactInstance'.
|
|
2243
2243
|
const graphie = this.refs.graph.graphie();
|
|
2244
2244
|
|
|
2245
2245
|
const updateReflectionTool = function () {
|
|
@@ -2303,23 +2303,23 @@ class Transformer extends React.Component<Props> {
|
|
|
2303
2303
|
onClick: function () {
|
|
2304
2304
|
self.doTransform({
|
|
2305
2305
|
type: "reflection",
|
|
2306
|
-
// @ts-expect-error
|
|
2306
|
+
// @ts-expect-error - TS2322 - Type 'any[]' is not assignable to type '[Coord, Coord]'.
|
|
2307
2307
|
line: _.pluck(reflectPoints, "coord"),
|
|
2308
2308
|
});
|
|
2309
2309
|
if (reflectRotateHandle) {
|
|
2310
2310
|
// flip the rotation handle
|
|
2311
|
-
// @ts-expect-error
|
|
2311
|
+
// @ts-expect-error - TS2339 - Property 'setCoord' does not exist on type 'never'.
|
|
2312
2312
|
reflectRotateHandle.setCoord(
|
|
2313
2313
|
kvector.add(
|
|
2314
2314
|
reflectButton.coord,
|
|
2315
2315
|
kvector.subtract(
|
|
2316
2316
|
reflectButton.coord,
|
|
2317
|
-
// @ts-expect-error
|
|
2317
|
+
// @ts-expect-error - TS2339 - Property 'coord' does not exist on type 'never'.
|
|
2318
2318
|
reflectRotateHandle.coord,
|
|
2319
2319
|
),
|
|
2320
2320
|
),
|
|
2321
2321
|
);
|
|
2322
|
-
// @ts-expect-error
|
|
2322
|
+
// @ts-expect-error - TS2339 - Property 'update' does not exist on type 'never'.
|
|
2323
2323
|
reflectRotateHandle.update();
|
|
2324
2324
|
}
|
|
2325
2325
|
},
|
|
@@ -2372,7 +2372,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2372
2372
|
if (reflectRotateHandle) {
|
|
2373
2373
|
$(reflectRotateHandle).on("move", function () {
|
|
2374
2374
|
const rotateHandleApprox = self.snapCoord(
|
|
2375
|
-
// @ts-expect-error
|
|
2375
|
+
// @ts-expect-error - TS2531 - Object is possibly 'null'.
|
|
2376
2376
|
reflectRotateHandle.coord,
|
|
2377
2377
|
);
|
|
2378
2378
|
|
|
@@ -2404,7 +2404,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2404
2404
|
remove: function () {
|
|
2405
2405
|
reflectButton.remove();
|
|
2406
2406
|
if (reflectRotateHandle) {
|
|
2407
|
-
// @ts-expect-error
|
|
2407
|
+
// @ts-expect-error - TS2339 - Property 'remove' does not exist on type 'never'.
|
|
2408
2408
|
reflectRotateHandle.remove();
|
|
2409
2409
|
}
|
|
2410
2410
|
reflectLine.remove();
|
|
@@ -2422,7 +2422,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2422
2422
|
*/
|
|
2423
2423
|
scaleToCurrentRange: (arg1: number) => number = (dist) => {
|
|
2424
2424
|
// eslint-disable-next-line react/no-string-refs
|
|
2425
|
-
// @ts-expect-error
|
|
2425
|
+
// @ts-expect-error - TS2339 - Property 'props' does not exist on type 'ReactInstance'.
|
|
2426
2426
|
return scaleToRange(dist, this.refs.graph.props.range);
|
|
2427
2427
|
};
|
|
2428
2428
|
|
|
@@ -2433,7 +2433,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2433
2433
|
}
|
|
2434
2434
|
const self = this;
|
|
2435
2435
|
// eslint-disable-next-line react/no-string-refs
|
|
2436
|
-
// @ts-expect-error
|
|
2436
|
+
// @ts-expect-error - TS2339 - Property 'graphie' does not exist on type 'ReactInstance'.
|
|
2437
2437
|
const graphie = this.refs.graph.graphie();
|
|
2438
2438
|
|
|
2439
2439
|
const pointColor = colorForTool(options);
|
|
@@ -2473,7 +2473,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2473
2473
|
// Rotate polygon with rotateHandle
|
|
2474
2474
|
self.doTransform(transform);
|
|
2475
2475
|
|
|
2476
|
-
// @ts-expect-error
|
|
2476
|
+
// @ts-expect-error - TS2339 - Property 'angleDeg' does not exist on type 'PerseusTransformerTransformation'.
|
|
2477
2477
|
return oldAngle + transform.angleDeg;
|
|
2478
2478
|
},
|
|
2479
2479
|
});
|
|
@@ -2500,7 +2500,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2500
2500
|
}
|
|
2501
2501
|
const self = this;
|
|
2502
2502
|
// eslint-disable-next-line react/no-string-refs
|
|
2503
|
-
// @ts-expect-error
|
|
2503
|
+
// @ts-expect-error - TS2339 - Property 'graphie' does not exist on type 'ReactInstance'.
|
|
2504
2504
|
const graphie = this.refs.graph.graphie();
|
|
2505
2505
|
|
|
2506
2506
|
const pointColor = colorForTool(options);
|
|
@@ -2515,7 +2515,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2515
2515
|
snapRadius: self.scaleToCurrentRange(0.5),
|
|
2516
2516
|
onResize: function (newRadius, oldRadius) {
|
|
2517
2517
|
// NOTE(kevinb): object is missing .constraints property
|
|
2518
|
-
// @ts-expect-error
|
|
2518
|
+
// @ts-expect-error - TS2345 - Argument of type '{ type: "dilation"; center: any; scale: number; }' is not assignable to parameter of type 'PerseusTransformerTransformation'.
|
|
2519
2519
|
self.doTransform({
|
|
2520
2520
|
type: "dilation",
|
|
2521
2521
|
// NOTE(kevinb): It's hard to convince that this.dilationCircle
|
|
@@ -2569,7 +2569,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2569
2569
|
|
|
2570
2570
|
// returns a transformation object representing a rotation
|
|
2571
2571
|
// rounds the angle to the nearest 15 degrees
|
|
2572
|
-
// @ts-expect-error
|
|
2572
|
+
// @ts-expect-error - TS2322 - Type '(center: Coord, angleChanged: number) => { type: "rotation"; center: Coord; angleDeg: number; }' is not assignable to type '(arg1: Coord, arg2: number) => PerseusTransformerTransformation'.
|
|
2573
2573
|
getRotationTransformFromAngle: (
|
|
2574
2574
|
arg1: Coord,
|
|
2575
2575
|
arg2: number,
|
|
@@ -2604,7 +2604,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2604
2604
|
applyTransform: (arg1: TransformerTransformation) => void = (transform) => {
|
|
2605
2605
|
if (this.props.graphMode !== "static") {
|
|
2606
2606
|
const transformFunc = TransformOps.apply(transform);
|
|
2607
|
-
// @ts-expect-error
|
|
2607
|
+
// @ts-expect-error - TS2345 - Argument of type '(coord: any) => any' is not assignable to parameter of type 'PerseusTransformerTransformation'.
|
|
2608
2608
|
this.applyCoordTransformation(transformFunc);
|
|
2609
2609
|
}
|
|
2610
2610
|
};
|
|
@@ -2614,7 +2614,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2614
2614
|
pointTransform,
|
|
2615
2615
|
) => {
|
|
2616
2616
|
_.each(this.shape.points, function (point) {
|
|
2617
|
-
// @ts-expect-error
|
|
2617
|
+
// @ts-expect-error - TS2349 - This expression is not callable.
|
|
2618
2618
|
const newCoord = pointTransform(point.coord);
|
|
2619
2619
|
point.setCoord(newCoord);
|
|
2620
2620
|
});
|
|
@@ -2632,7 +2632,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2632
2632
|
// Remove the last transformation
|
|
2633
2633
|
handleUndoClick: () => void = () => {
|
|
2634
2634
|
// eslint-disable-next-line react/no-string-refs
|
|
2635
|
-
// @ts-expect-error
|
|
2635
|
+
// @ts-expect-error - TS2339 - Property 'changeSelected' does not exist on type 'ReactInstance'.
|
|
2636
2636
|
this.refs.toolsBar.changeSelected(null);
|
|
2637
2637
|
if (this.props.transformations.length) {
|
|
2638
2638
|
this.props.onChange({
|
|
@@ -2649,7 +2649,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2649
2649
|
{
|
|
2650
2650
|
transformations: newTransfomationList,
|
|
2651
2651
|
},
|
|
2652
|
-
// @ts-expect-error
|
|
2652
|
+
// @ts-expect-error - TS2345 - Argument of type '(arg1: any) => unknown' is not assignable to parameter of type '() => unknown'.
|
|
2653
2653
|
callback,
|
|
2654
2654
|
);
|
|
2655
2655
|
};
|
|
@@ -2667,7 +2667,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2667
2667
|
{
|
|
2668
2668
|
transformations: _.clone(this.transformations),
|
|
2669
2669
|
},
|
|
2670
|
-
// @ts-expect-error
|
|
2670
|
+
// @ts-expect-error - TS2345 - Argument of type '((arg1: any) => unknown) | undefined' is not assignable to parameter of type '(() => unknown) | undefined'.
|
|
2671
2671
|
callback,
|
|
2672
2672
|
);
|
|
2673
2673
|
};
|
|
@@ -2677,7 +2677,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2677
2677
|
newTools[tool] = _.extend({}, this.props.tools[tool], changes);
|
|
2678
2678
|
this.tools[tool] = _.clone(newTools[tool]);
|
|
2679
2679
|
this.props.onChange({
|
|
2680
|
-
// @ts-expect-error
|
|
2680
|
+
// @ts-expect-error - TS2740 - Type '{ dilation: DilationTool; reflection: ReflectionTool; rotation: RotationTool; translation: TranslationTool; }' is missing the following properties from type 'readonly any[]': length, concat, join, slice, and 18 more.
|
|
2681
2681
|
tools: newTools,
|
|
2682
2682
|
});
|
|
2683
2683
|
this.props.trackInteraction();
|
|
@@ -2692,7 +2692,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2692
2692
|
* moved, even if we're in formal mode with no movement
|
|
2693
2693
|
* (and thus the actual movablepoints may not have moved
|
|
2694
2694
|
*/
|
|
2695
|
-
// @ts-expect-error
|
|
2695
|
+
// @ts-expect-error - TS2322 - Type '() => [Coord, Coord] | readonly Coord[] | [Coord, Coord, Coord]' is not assignable to type '() => Coord'.
|
|
2696
2696
|
getCoords: () => Coord = () => {
|
|
2697
2697
|
const startCoords = this.props.starting.shape.coords;
|
|
2698
2698
|
const transforms = this.props.transformations;
|
|
@@ -2717,14 +2717,14 @@ class Transformer extends React.Component<Props> {
|
|
|
2717
2717
|
"gradeEmpty",
|
|
2718
2718
|
);
|
|
2719
2719
|
// eslint-disable-next-line react/no-string-refs
|
|
2720
|
-
// @ts-expect-error
|
|
2720
|
+
// @ts-expect-error - TS2339 - Property 'graph' does not exist on type 'Pick<Readonly<Props> & Readonly<{ children?: ReactNode; }>, "tools" | "starting" | "drawSolutionShape" | "gradeEmpty" | "graphMode" | "listMode">'. | TS2339 - Property 'toJSON' does not exist on type 'ReactInstance'.
|
|
2721
2721
|
json.graph = this.refs.graph.toJSON();
|
|
2722
|
-
// @ts-expect-error
|
|
2722
|
+
// @ts-expect-error - TS2339 - Property 'version' does not exist on type 'Pick<Readonly<Props> & Readonly<{ children?: ReactNode; }>, "tools" | "starting" | "drawSolutionShape" | "gradeEmpty" | "graphMode" | "listMode">'.
|
|
2723
2723
|
json.version = 1.2; // Give us some safety to change the format
|
|
2724
2724
|
// when we realize that I wrote
|
|
2725
2725
|
// a horrible json spec for this widget
|
|
2726
2726
|
|
|
2727
|
-
// @ts-expect-error
|
|
2727
|
+
// @ts-expect-error - TS2339 - Property 'answer' does not exist on type 'Pick<Readonly<Props> & Readonly<{ children?: ReactNode; }>, "tools" | "starting" | "drawSolutionShape" | "gradeEmpty" | "graphMode" | "listMode">'.
|
|
2728
2728
|
json.answer = this.getUserInput();
|
|
2729
2729
|
return json;
|
|
2730
2730
|
};
|
|
@@ -2763,7 +2763,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2763
2763
|
// Follow the path of references
|
|
2764
2764
|
let component = this;
|
|
2765
2765
|
_.each(refPath, (ref) => {
|
|
2766
|
-
// @ts-expect-error
|
|
2766
|
+
// @ts-expect-error - TS2322 - Type 'ReactInstance' is not assignable to type 'this'.
|
|
2767
2767
|
component = component.refs[ref];
|
|
2768
2768
|
});
|
|
2769
2769
|
return component;
|
|
@@ -2778,14 +2778,14 @@ class Transformer extends React.Component<Props> {
|
|
|
2778
2778
|
|
|
2779
2779
|
let inputPaths: Array<never> | Array<any> = [];
|
|
2780
2780
|
_.each(this.props.transformations, (transformation, i) => {
|
|
2781
|
-
// @ts-expect-error
|
|
2781
|
+
// @ts-expect-error - TS2345 - Argument of type 'number' is not assignable to parameter of type 'string'.
|
|
2782
2782
|
transformation = this._getTransformationForID(i);
|
|
2783
|
-
// @ts-expect-error
|
|
2783
|
+
// @ts-expect-error - TS2339 - Property 'getInputPaths' does not exist on type 'PerseusTransformerTransformation'.
|
|
2784
2784
|
const innerPaths = transformation.getInputPaths();
|
|
2785
2785
|
const fullPaths = _.map(innerPaths, (innerPath) => {
|
|
2786
2786
|
return ["" + i].concat(innerPath);
|
|
2787
2787
|
});
|
|
2788
|
-
// @ts-expect-error
|
|
2788
|
+
// @ts-expect-error - TS2345 - Argument of type 'string[][]' is not assignable to parameter of type 'ConcatArray<never>'.
|
|
2789
2789
|
inputPaths = inputPaths.concat(fullPaths);
|
|
2790
2790
|
});
|
|
2791
2791
|
return inputPaths;
|
|
@@ -2808,7 +2808,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2808
2808
|
|
|
2809
2809
|
// Pass arguments down to appropriate 'transformation' component
|
|
2810
2810
|
const transformationID = _.head(path);
|
|
2811
|
-
// @ts-expect-error
|
|
2811
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
2812
2812
|
const caller = this._getTransformationForID(transformationID);
|
|
2813
2813
|
return caller[functionName](innerPath, ...args);
|
|
2814
2814
|
};
|