@khanacademy/perseus 7.2.0 → 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 +38 -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.css +61 -61
- package/dist/es/index.js +1189 -1308
- package/dist/es/index.js.map +1 -1
- package/dist/hints-renderer.d.ts +1 -1
- package/dist/index.css +61 -61
- package/dist/index.js +1180 -1269
- 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/plotter.d.ts +47 -13
- 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 +2 -2
- 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/__stories__/image-loader.stories.tsx +1 -0
- 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 +12 -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 +2 -1
- package/src/components/image-loader.tsx +5 -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 +11 -10
- package/src/components/prop-check-box.tsx +1 -1
- package/src/components/simple-keypad-input.tsx +4 -4
- package/src/components/sortable.tsx +43 -41
- package/src/components/svg-image.tsx +13 -12
- package/src/components/tex-buttons.tsx +5 -3
- package/src/components/text-input.tsx +9 -8
- package/src/components/text-list-editor.tsx +12 -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 +9 -8
- package/src/hint-renderer.tsx +3 -3
- package/src/hints-renderer.tsx +12 -11
- package/src/index.ts +1 -0
- 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 +6 -5
- package/src/mixins/changeable.ts +2 -2
- package/src/mixins/editor-jsonify.ts +1 -1
- package/src/mixins/provide-keypad.tsx +24 -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 +15 -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 +39 -38
- package/src/server-item-renderer.tsx +6 -5
- package/src/sigfigs.ts +1 -1
- package/src/styles/articles.less +8 -4
- package/src/styles/perseus-renderer.less +47 -38
- package/src/styles/util.less +1 -1
- package/src/styles/variables.boostrap.less +158 -182
- package/src/styles/variables.less +20 -20
- package/src/styles/variables.shared.less +162 -168
- package/src/styles/widgets/categorizer.less +1 -2
- package/src/styles/widgets/expression.less +7 -4
- package/src/styles/widgets/grapher.less +2 -1
- package/src/styles/widgets/image.less +3 -2
- package/src/styles/widgets/interactive-graph.less +4 -2
- package/src/styles/widgets/label-image.less +2 -1
- package/src/styles/widgets/matrix.less +11 -7
- package/src/styles/widgets/orderer.less +2 -1
- package/src/styles/widgets/passage.less +2 -1
- package/src/styles/widgets/plotter.less +4 -3
- package/src/styles/widgets/radio.less +4 -2
- package/src/styles/widgets/sortable.less +1 -1
- package/src/styles/widgets/table.less +2 -1
- package/src/styles/widgets/transformer.less +2 -1
- package/src/styles/widgets/unit.less +2 -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__/plotter.stories.tsx +27 -0
- package/src/widgets/__stories__/test-keypad-context-wrapper.tsx +3 -3
- package/src/widgets/__testdata__/numeric-input.testdata.ts +1 -1
- package/src/widgets/__testdata__/plotter.testdata.ts +36 -0
- package/src/widgets/__tests__/__snapshots__/plotter.test.tsx.snap +863 -0
- 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 +66 -0
- package/src/widgets/__tests__/radio/base-radio.test.tsx +7 -7
- package/src/widgets/__tests__/renderQuestion.tsx +3 -3
- package/src/widgets/categorizer.tsx +5 -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 +6 -5
- package/src/widgets/graded-group.tsx +19 -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 +78 -77
- package/src/widgets/interactive-graph.tsx +109 -107
- package/src/widgets/label-image/marker.tsx +3 -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 +7 -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 +39 -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 +2 -1
- package/src/widgets/passage-ref.tsx +4 -6
- package/src/widgets/passage.tsx +11 -11
- package/src/widgets/plotter.tsx +117 -107
- package/src/widgets/radio/base-radio.tsx +12 -11
- package/src/widgets/radio/choice-icon/choice-icon.tsx +3 -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 +5 -4
- package/src/widgets/table.tsx +8 -8
- package/src/widgets/transformer.tsx +93 -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 -78
- 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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable @khanacademy/ts-no-error-suppressions */
|
|
1
2
|
/* eslint-disable @babel/no-invalid-this */
|
|
2
3
|
/* eslint-disable camelcase */
|
|
3
4
|
/* eslint-disable react/no-did-update-set-state */
|
|
@@ -272,11 +273,11 @@ const TransformOps = {
|
|
|
272
273
|
// TODO (jack): Merge this just into reflections now that other
|
|
273
274
|
// transforms are always valid (after merging transformation
|
|
274
275
|
// collapsing, which may use isValid)
|
|
275
|
-
// @ts-expect-error
|
|
276
|
+
// @ts-expect-error - TS2345 - Argument of type 'PerseusTransformerTransformation' is not assignable to parameter of type 'never'.
|
|
276
277
|
if (!Transformations[transform.type].isValid(transform)) {
|
|
277
278
|
return _.identity; // do not transform the coord
|
|
278
279
|
}
|
|
279
|
-
// @ts-expect-error
|
|
280
|
+
// @ts-expect-error - TS2345 - Argument of type 'PerseusTransformerTransformation' is not assignable to parameter of type 'never'.
|
|
280
281
|
return Transformations[transform.type].apply(transform);
|
|
281
282
|
},
|
|
282
283
|
|
|
@@ -343,12 +344,12 @@ const TransformOps = {
|
|
|
343
344
|
},
|
|
344
345
|
|
|
345
346
|
isValid: function (transform: TransformerTransformation): boolean {
|
|
346
|
-
// @ts-expect-error
|
|
347
|
+
// @ts-expect-error - TS2345 - Argument of type 'PerseusTransformerTransformation' is not assignable to parameter of type 'never'.
|
|
347
348
|
return Transformations[transform.type].isValid(transform);
|
|
348
349
|
},
|
|
349
350
|
|
|
350
351
|
isEmpty: function (transform: TransformerTransformation): boolean {
|
|
351
|
-
// @ts-expect-error
|
|
352
|
+
// @ts-expect-error - TS2345 - Argument of type 'PerseusTransformerTransformation' is not assignable to parameter of type 'never'.
|
|
352
353
|
return Transformations[transform.type].isEmpty(transform);
|
|
353
354
|
},
|
|
354
355
|
|
|
@@ -420,7 +421,7 @@ const TransformOps = {
|
|
|
420
421
|
},
|
|
421
422
|
|
|
422
423
|
handleChange: _.debounce(function (callback) {
|
|
423
|
-
// @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.
|
|
424
425
|
this.props.onChange(this.value(), callback);
|
|
425
426
|
}, RENDER_TRANSFORM_DELAY_IN_MS),
|
|
426
427
|
|
|
@@ -464,9 +465,9 @@ const TransformOps = {
|
|
|
464
465
|
// We let through the empty string so that "Clear" works -- in
|
|
465
466
|
// that case, the transformer widget will just act as if there is
|
|
466
467
|
// no input, which is what we want.
|
|
467
|
-
// @ts-expect-error
|
|
468
|
+
// @ts-expect-error - TS2339 - Property 'length' does not exist on type 'string | number'.
|
|
468
469
|
if (value.length) {
|
|
469
|
-
// @ts-expect-error
|
|
470
|
+
// @ts-expect-error - TS2345 - Argument of type 'string | number' is not assignable to parameter of type 'string'.
|
|
470
471
|
value = parseFloat(value);
|
|
471
472
|
if (isNaN(value)) {
|
|
472
473
|
return;
|
|
@@ -590,10 +591,10 @@ const Transformations = {
|
|
|
590
591
|
|
|
591
592
|
value = () => {
|
|
592
593
|
// eslint-disable-next-line react/no-string-refs
|
|
593
|
-
// @ts-expect-error
|
|
594
|
+
// @ts-expect-error - TS2339 - Property 'getValue' does not exist on type 'ReactInstance'.
|
|
594
595
|
const x = this.refs.x.getValue();
|
|
595
596
|
// eslint-disable-next-line react/no-string-refs
|
|
596
|
-
// @ts-expect-error
|
|
597
|
+
// @ts-expect-error - TS2339 - Property 'getValue' does not exist on type 'ReactInstance'.
|
|
597
598
|
const y = this.refs.y.getValue();
|
|
598
599
|
return {
|
|
599
600
|
vector: [x, y],
|
|
@@ -762,13 +763,13 @@ const Transformations = {
|
|
|
762
763
|
|
|
763
764
|
value = () => {
|
|
764
765
|
// eslint-disable-next-line react/no-string-refs
|
|
765
|
-
// @ts-expect-error
|
|
766
|
+
// @ts-expect-error - TS2339 - Property 'getValue' does not exist on type 'ReactInstance'.
|
|
766
767
|
const angleDeg = this.refs.angleDeg.getValue();
|
|
767
768
|
// eslint-disable-next-line react/no-string-refs
|
|
768
|
-
// @ts-expect-error
|
|
769
|
+
// @ts-expect-error - TS2339 - Property 'getValue' does not exist on type 'ReactInstance'.
|
|
769
770
|
const centerX = this.refs.centerX.getValue();
|
|
770
771
|
// eslint-disable-next-line react/no-string-refs
|
|
771
|
-
// @ts-expect-error
|
|
772
|
+
// @ts-expect-error - TS2339 - Property 'getValue' does not exist on type 'ReactInstance'.
|
|
772
773
|
const centerY = this.refs.centerY.getValue();
|
|
773
774
|
return {
|
|
774
775
|
angleDeg: angleDeg,
|
|
@@ -941,7 +942,7 @@ const Transformations = {
|
|
|
941
942
|
cb,
|
|
942
943
|
) => {
|
|
943
944
|
const line = _.map(this.state.line, _.clone);
|
|
944
|
-
// @ts-expect-error
|
|
945
|
+
// @ts-expect-error - TS2538 - Type 'undefined' cannot be used as an index type.
|
|
945
946
|
line[i][j] = val;
|
|
946
947
|
this.setState({line: line}, () => {
|
|
947
948
|
this.props.onChange(cb);
|
|
@@ -950,16 +951,16 @@ const Transformations = {
|
|
|
950
951
|
|
|
951
952
|
value = () => {
|
|
952
953
|
// eslint-disable-next-line react/no-string-refs
|
|
953
|
-
// @ts-expect-error
|
|
954
|
+
// @ts-expect-error - TS2339 - Property 'getValue' does not exist on type 'ReactInstance'.
|
|
954
955
|
const x1 = this.refs.x1.getValue();
|
|
955
956
|
// eslint-disable-next-line react/no-string-refs
|
|
956
|
-
// @ts-expect-error
|
|
957
|
+
// @ts-expect-error - TS2339 - Property 'getValue' does not exist on type 'ReactInstance'.
|
|
957
958
|
const y1 = this.refs.y1.getValue();
|
|
958
959
|
// eslint-disable-next-line react/no-string-refs
|
|
959
|
-
// @ts-expect-error
|
|
960
|
+
// @ts-expect-error - TS2339 - Property 'getValue' does not exist on type 'ReactInstance'.
|
|
960
961
|
const x2 = this.refs.x2.getValue();
|
|
961
962
|
// eslint-disable-next-line react/no-string-refs
|
|
962
|
-
// @ts-expect-error
|
|
963
|
+
// @ts-expect-error - TS2339 - Property 'getValue' does not exist on type 'ReactInstance'.
|
|
963
964
|
const y2 = this.refs.y2.getValue();
|
|
964
965
|
return {
|
|
965
966
|
line: [
|
|
@@ -1132,13 +1133,13 @@ const Transformations = {
|
|
|
1132
1133
|
|
|
1133
1134
|
value = () => {
|
|
1134
1135
|
// eslint-disable-next-line react/no-string-refs
|
|
1135
|
-
// @ts-expect-error
|
|
1136
|
+
// @ts-expect-error - TS2339 - Property 'getValue' does not exist on type 'ReactInstance'.
|
|
1136
1137
|
const scale = this.refs.scale.getValue();
|
|
1137
1138
|
// eslint-disable-next-line react/no-string-refs
|
|
1138
|
-
// @ts-expect-error
|
|
1139
|
+
// @ts-expect-error - TS2339 - Property 'getValue' does not exist on type 'ReactInstance'.
|
|
1139
1140
|
const x = this.refs.x.getValue();
|
|
1140
1141
|
// eslint-disable-next-line react/no-string-refs
|
|
1141
|
-
// @ts-expect-error
|
|
1142
|
+
// @ts-expect-error - TS2339 - Property 'getValue' does not exist on type 'ReactInstance'.
|
|
1142
1143
|
const y = this.refs.y.getValue();
|
|
1143
1144
|
return {
|
|
1144
1145
|
scale: scale,
|
|
@@ -1312,7 +1313,7 @@ const ShapeTypes = {
|
|
|
1312
1313
|
const typeOptions =
|
|
1313
1314
|
options.shape.options || ShapeTypes.defaultOptions(types);
|
|
1314
1315
|
|
|
1315
|
-
// @ts-expect-error
|
|
1316
|
+
// @ts-expect-error - TS2554 - Expected 4 arguments, but got 3.
|
|
1316
1317
|
const shapes = ShapeTypes._mapTypes(
|
|
1317
1318
|
types,
|
|
1318
1319
|
points,
|
|
@@ -1371,13 +1372,13 @@ const ShapeTypes = {
|
|
|
1371
1372
|
if (types1.length !== types2.length) {
|
|
1372
1373
|
return false;
|
|
1373
1374
|
}
|
|
1374
|
-
// @ts-expect-error
|
|
1375
|
+
// @ts-expect-error - TS2554 - Expected 4 arguments, but got 3.
|
|
1375
1376
|
const shapes1 = ShapeTypes._mapTypes(
|
|
1376
1377
|
types1,
|
|
1377
1378
|
shape1.coords,
|
|
1378
1379
|
ShapeTypes._combine,
|
|
1379
1380
|
);
|
|
1380
|
-
// @ts-expect-error
|
|
1381
|
+
// @ts-expect-error - TS2554 - Expected 4 arguments, but got 3.
|
|
1381
1382
|
const shapes2 = ShapeTypes._mapTypes(
|
|
1382
1383
|
types2,
|
|
1383
1384
|
shape2.coords,
|
|
@@ -1519,7 +1520,7 @@ const ShapeTypes = {
|
|
|
1519
1520
|
const coord0 = points[0].coord || points[0];
|
|
1520
1521
|
const coord1 = points[1].coord || points[1];
|
|
1521
1522
|
const radius = kpoint.distanceToPoint(coord0, coord1);
|
|
1522
|
-
// @ts-expect-error
|
|
1523
|
+
// @ts-expect-error - TS2554 - Expected 1 arguments, but got 0.
|
|
1523
1524
|
perimeter.remove();
|
|
1524
1525
|
perimeter = graphie.circle(
|
|
1525
1526
|
coord0,
|
|
@@ -1544,7 +1545,7 @@ const ShapeTypes = {
|
|
|
1544
1545
|
remove: function () {
|
|
1545
1546
|
// Not _.bind because the remove function changes
|
|
1546
1547
|
// when the perimeter is redrawn
|
|
1547
|
-
// @ts-expect-error
|
|
1548
|
+
// @ts-expect-error - TS2554 - Expected 1 arguments, but got 0.
|
|
1548
1549
|
perimeter.remove();
|
|
1549
1550
|
},
|
|
1550
1551
|
};
|
|
@@ -1593,10 +1594,10 @@ const ShapeTypes = {
|
|
|
1593
1594
|
const line2_2 = [points2[1], points2[2]];
|
|
1594
1595
|
|
|
1595
1596
|
const equalUnflipped =
|
|
1596
|
-
// @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'.
|
|
1597
1598
|
kray.equal(line1_0, line2_0) && kray.equal(line1_2, line2_2);
|
|
1598
1599
|
const equalFlipped =
|
|
1599
|
-
// @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'.
|
|
1600
1601
|
kray.equal(line1_0, line2_2) && kray.equal(line1_2, line2_0);
|
|
1601
1602
|
|
|
1602
1603
|
return equalUnflipped || equalFlipped;
|
|
@@ -1639,17 +1640,17 @@ class TransformationList extends React.Component<any, any> {
|
|
|
1639
1640
|
ref={"transformation" + i}
|
|
1640
1641
|
key={"transformation" + i}
|
|
1641
1642
|
transform={transform}
|
|
1642
|
-
// @ts-expect-error
|
|
1643
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
1643
1644
|
mode={this.props.mode}
|
|
1644
|
-
// @ts-expect-error
|
|
1645
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
1645
1646
|
onChange={this.handleChange}
|
|
1646
|
-
// @ts-expect-error
|
|
1647
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
1647
1648
|
onFocus={_.partial(this.props.onFocus, "" + i)}
|
|
1648
|
-
// @ts-expect-error
|
|
1649
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
1649
1650
|
onBlur={_.partial(this.props.onBlur, "" + i)}
|
|
1650
|
-
// @ts-expect-error
|
|
1651
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
1651
1652
|
keypadElement={this.props.keypadElement}
|
|
1652
|
-
// @ts-expect-error
|
|
1653
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
1653
1654
|
apiOptions={this.props.apiOptions}
|
|
1654
1655
|
/>
|
|
1655
1656
|
);
|
|
@@ -1682,7 +1683,7 @@ class TransformationList extends React.Component<any, any> {
|
|
|
1682
1683
|
focusLast = () => {
|
|
1683
1684
|
const transformationRefs = this._transformationRefs();
|
|
1684
1685
|
if (transformationRefs.length !== 0) {
|
|
1685
|
-
// @ts-expect-error
|
|
1686
|
+
// @ts-expect-error - TS2532 - Object is possibly 'undefined'. | TS2339 - Property 'focus' does not exist on type 'ReactInstance'.
|
|
1686
1687
|
_.last(transformationRefs).focus();
|
|
1687
1688
|
}
|
|
1688
1689
|
};
|
|
@@ -1700,7 +1701,7 @@ class ToolButton extends React.Component<any, any> {
|
|
|
1700
1701
|
className={classes}
|
|
1701
1702
|
disabled={this.props.disabled}
|
|
1702
1703
|
onClick={this.props.onClick}
|
|
1703
|
-
// @ts-expect-error
|
|
1704
|
+
// @ts-expect-error - TS2322 - Type '(e: TouchEvent) => void' is not assignable to type 'TouchEventHandler<HTMLButtonElement>'.
|
|
1704
1705
|
onTouchStart={captureScratchpadTouchStart}
|
|
1705
1706
|
>
|
|
1706
1707
|
{this.props.children}
|
|
@@ -1718,17 +1719,17 @@ class ToolsBar extends React.Component<any, any> {
|
|
|
1718
1719
|
const tools = _.map(
|
|
1719
1720
|
Transformations,
|
|
1720
1721
|
function (tool, type) {
|
|
1721
|
-
// @ts-expect-error
|
|
1722
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
1722
1723
|
if (this.props.enabled[type]) {
|
|
1723
1724
|
return (
|
|
1724
1725
|
<ToolButton
|
|
1725
1726
|
key={type}
|
|
1726
|
-
// @ts-expect-error
|
|
1727
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
1727
1728
|
disabled={this.props.apiOptions.readOnly}
|
|
1728
|
-
// @ts-expect-error
|
|
1729
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
1729
1730
|
toggled={this.state.selected === type}
|
|
1730
1731
|
// eslint-disable-next-line react/jsx-no-bind
|
|
1731
|
-
// @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.
|
|
1732
1733
|
onClick={this.changeSelected.bind(this, type)}
|
|
1733
1734
|
>
|
|
1734
1735
|
{tool.verbName}
|
|
@@ -1747,7 +1748,7 @@ class ToolsBar extends React.Component<any, any> {
|
|
|
1747
1748
|
type="button"
|
|
1748
1749
|
disabled={this.props.apiOptions.readOnly}
|
|
1749
1750
|
onClick={this.props.onUndoClick}
|
|
1750
|
-
// @ts-expect-error
|
|
1751
|
+
// @ts-expect-error - TS2322 - Type '(e: TouchEvent) => void' is not assignable to type 'TouchEventHandler<HTMLButtonElement>'.
|
|
1751
1752
|
onTouchStart={captureScratchpadTouchStart}
|
|
1752
1753
|
>
|
|
1753
1754
|
<InlineIcon {...iconUndo} />
|
|
@@ -1779,16 +1780,16 @@ class AddTransformBar extends React.Component<any, any> {
|
|
|
1779
1780
|
const tools = _.map(
|
|
1780
1781
|
Transformations,
|
|
1781
1782
|
function (tool, type) {
|
|
1782
|
-
// @ts-expect-error
|
|
1783
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
1783
1784
|
if (this.props.enabled[type]) {
|
|
1784
1785
|
return (
|
|
1785
1786
|
<ToolButton
|
|
1786
1787
|
key={type}
|
|
1787
1788
|
toggled={false}
|
|
1788
|
-
// @ts-expect-error
|
|
1789
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
1789
1790
|
disabled={this.props.apiOptions.readOnly}
|
|
1790
1791
|
// eslint-disable-next-line react/jsx-no-bind
|
|
1791
|
-
// @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.
|
|
1792
1793
|
onClick={this.changeSelected.bind(this, type)}
|
|
1793
1794
|
>
|
|
1794
1795
|
<InlineIcon {...iconPlus} /> {tool.nounName}
|
|
@@ -1807,7 +1808,7 @@ class AddTransformBar extends React.Component<any, any> {
|
|
|
1807
1808
|
type="button"
|
|
1808
1809
|
onClick={this.props.onUndoClick}
|
|
1809
1810
|
disabled={this.props.apiOptions.readOnly}
|
|
1810
|
-
// @ts-expect-error
|
|
1811
|
+
// @ts-expect-error - TS2322 - Type '(e: TouchEvent) => void' is not assignable to type 'TouchEventHandler<HTMLButtonElement>'.
|
|
1811
1812
|
onTouchStart={captureScratchpadTouchStart}
|
|
1812
1813
|
>
|
|
1813
1814
|
<InlineIcon {...iconUndo} />
|
|
@@ -1838,12 +1839,12 @@ type Props = WidgetProps<RenderProps, Rubric> & {
|
|
|
1838
1839
|
};
|
|
1839
1840
|
|
|
1840
1841
|
class Transformer extends React.Component<Props> {
|
|
1841
|
-
// @ts-expect-error
|
|
1842
|
+
// @ts-expect-error - TS2564 - Property 'tools' has no initializer and is not definitely assigned in the constructor.
|
|
1842
1843
|
tools: {
|
|
1843
1844
|
[key: string]: Tool;
|
|
1844
1845
|
};
|
|
1845
1846
|
currentTool: Tool | null | undefined;
|
|
1846
|
-
// @ts-expect-error
|
|
1847
|
+
// @ts-expect-error - TS2564 - Property 'transformations' has no initializer and is not definitely assigned in the constructor.
|
|
1847
1848
|
transformations: ReadonlyArray<TransformerTransformation>;
|
|
1848
1849
|
shape: any | null | undefined; // This is not the same as TransformerShape
|
|
1849
1850
|
dilationCircle: any | null | undefined;
|
|
@@ -1945,7 +1946,7 @@ class Transformer extends React.Component<Props> {
|
|
|
1945
1946
|
componentDidUpdate(prevProps: Props) {
|
|
1946
1947
|
if (this.shouldSetupGraphie(this.props, prevProps)) {
|
|
1947
1948
|
// eslint-disable-next-line react/no-string-refs
|
|
1948
|
-
// @ts-expect-error
|
|
1949
|
+
// @ts-expect-error - TS2339 - Property 'reset' does not exist on type 'ReactInstance'.
|
|
1949
1950
|
this.refs.graph.reset();
|
|
1950
1951
|
} else if (!deepEq(this.props.transformations, this.transformations)) {
|
|
1951
1952
|
this.setTransformations(this.props.transformations);
|
|
@@ -1982,7 +1983,7 @@ class Transformer extends React.Component<Props> {
|
|
|
1982
1983
|
|
|
1983
1984
|
graphie: () => Graphie = () => {
|
|
1984
1985
|
// eslint-disable-next-line react/no-string-refs
|
|
1985
|
-
// @ts-expect-error
|
|
1986
|
+
// @ts-expect-error - TS2339 - Property 'graphie' does not exist on type 'ReactInstance'.
|
|
1986
1987
|
return this.refs.graph.graphie();
|
|
1987
1988
|
};
|
|
1988
1989
|
|
|
@@ -1993,7 +1994,7 @@ class Transformer extends React.Component<Props> {
|
|
|
1993
1994
|
this.props.correct.shape &&
|
|
1994
1995
|
this.props.correct.shape.coords
|
|
1995
1996
|
) {
|
|
1996
|
-
// @ts-expect-error
|
|
1997
|
+
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 2.
|
|
1997
1998
|
ShapeTypes.addShape(graphie, {
|
|
1998
1999
|
fixed: true,
|
|
1999
2000
|
shape: this.props.correct.shape,
|
|
@@ -2007,7 +2008,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2007
2008
|
|
|
2008
2009
|
this.currentTool = null;
|
|
2009
2010
|
// eslint-disable-next-line react/no-string-refs
|
|
2010
|
-
// @ts-expect-error
|
|
2011
|
+
// @ts-expect-error - TS2339 - Property 'changeSelected' does not exist on type 'ReactInstance'.
|
|
2011
2012
|
this.refs.toolsBar.changeSelected(null);
|
|
2012
2013
|
this.addTransformerShape(
|
|
2013
2014
|
this.props.starting.shape,
|
|
@@ -2061,7 +2062,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2061
2062
|
dX = KhanMath.roundToNearest(graphie.snap[0], dX);
|
|
2062
2063
|
dY = KhanMath.roundToNearest(graphie.snap[1], dY);
|
|
2063
2064
|
// NOTE(kevinb): object is missing .constraints property
|
|
2064
|
-
// @ts-expect-error
|
|
2065
|
+
// @ts-expect-error - TS2345 - Argument of type '{ type: "translation"; vector: [any, any]; }' is not assignable to parameter of type 'PerseusTransformerTransformation'.
|
|
2065
2066
|
self.addTransform({
|
|
2066
2067
|
type: "translation",
|
|
2067
2068
|
vector: [dX, dY],
|
|
@@ -2108,7 +2109,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2108
2109
|
transform = {
|
|
2109
2110
|
type: "translation",
|
|
2110
2111
|
// NOTE(kevib): these should be numbers
|
|
2111
|
-
// @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'.
|
|
2112
2113
|
vector: [null, null],
|
|
2113
2114
|
};
|
|
2114
2115
|
} else if (toolId === "rotation") {
|
|
@@ -2116,10 +2117,10 @@ class Transformer extends React.Component<Props> {
|
|
|
2116
2117
|
transform = {
|
|
2117
2118
|
type: "rotation",
|
|
2118
2119
|
// NOTE(kevib): these should be numbers
|
|
2119
|
-
// @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'.
|
|
2120
2121
|
center: [null, null],
|
|
2121
2122
|
// NOTE(kevib): this should be a number
|
|
2122
|
-
// @ts-expect-error
|
|
2123
|
+
// @ts-expect-error - TS2322 - Type 'null' is not assignable to type 'number'.
|
|
2123
2124
|
angleDeg: null,
|
|
2124
2125
|
};
|
|
2125
2126
|
} else if (toolId === "reflection") {
|
|
@@ -2129,10 +2130,10 @@ class Transformer extends React.Component<Props> {
|
|
|
2129
2130
|
type: "reflection",
|
|
2130
2131
|
line: [
|
|
2131
2132
|
// NOTE(kevib): these should be numbers
|
|
2132
|
-
// @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'.
|
|
2133
2134
|
[null, null],
|
|
2134
2135
|
// NOTE(kevib): these should be numbers
|
|
2135
|
-
// @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'.
|
|
2136
2137
|
[null, null],
|
|
2137
2138
|
],
|
|
2138
2139
|
};
|
|
@@ -2141,10 +2142,10 @@ class Transformer extends React.Component<Props> {
|
|
|
2141
2142
|
transform = {
|
|
2142
2143
|
type: "dilation",
|
|
2143
2144
|
// NOTE(kevib): these should be numbers
|
|
2144
|
-
// @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'.
|
|
2145
2146
|
center: [null, null],
|
|
2146
2147
|
// NOTE(kevib): this should be a number
|
|
2147
|
-
// @ts-expect-error
|
|
2148
|
+
// @ts-expect-error - TS2322 - Type 'null' is not assignable to type 'number'.
|
|
2148
2149
|
scale: null,
|
|
2149
2150
|
};
|
|
2150
2151
|
} else {
|
|
@@ -2155,7 +2156,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2155
2156
|
}
|
|
2156
2157
|
|
|
2157
2158
|
this.doTransform(transform, function () {
|
|
2158
|
-
// @ts-expect-error
|
|
2159
|
+
// @ts-expect-error - TS2339 - Property 'focusLast' does not exist on type 'ReactInstance'.
|
|
2159
2160
|
self.refs.transformationList.focusLast();
|
|
2160
2161
|
});
|
|
2161
2162
|
}
|
|
@@ -2185,7 +2186,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2185
2186
|
};
|
|
2186
2187
|
|
|
2187
2188
|
// Snaps a coord to this.graphie()'s snap
|
|
2188
|
-
// @ts-expect-error
|
|
2189
|
+
// @ts-expect-error - TS2322 - Type '(coord: Coord) => number[]' is not assignable to type '(arg1: Coord) => Coord'.
|
|
2189
2190
|
snapCoord: (arg1: Coord) => Coord = (coord) => {
|
|
2190
2191
|
const graphie = this.graphie();
|
|
2191
2192
|
return _.map(coord, function (val, dim) {
|
|
@@ -2195,11 +2196,11 @@ class Transformer extends React.Component<Props> {
|
|
|
2195
2196
|
|
|
2196
2197
|
// Normalize the coords into something that fits the new 45 degree
|
|
2197
2198
|
// reflection line.
|
|
2198
|
-
// @ts-expect-error
|
|
2199
|
+
// @ts-expect-error - TS2322 - Type '(messyCoords: [Coord, Coord]) => any[]' is not assignable to type '(arg1: [Coord, Coord]) => [Coord, Coord]'.
|
|
2199
2200
|
normalizeReflectionCoords: (arg1: [Coord, Coord]) => [Coord, Coord] = (
|
|
2200
2201
|
messyCoords,
|
|
2201
2202
|
) => {
|
|
2202
|
-
// @ts-expect-error
|
|
2203
|
+
// @ts-expect-error - TS2345 - Argument of type 'Point' is not assignable to parameter of type 'Coord'.
|
|
2203
2204
|
const midpoint = this.snapCoord(kline.midpoint(messyCoords));
|
|
2204
2205
|
const origDirectionPolar = kvector.polarDegFromCart(
|
|
2205
2206
|
kvector.subtract(messyCoords[0], messyCoords[1]),
|
|
@@ -2217,13 +2218,13 @@ class Transformer extends React.Component<Props> {
|
|
|
2217
2218
|
kvector.scale(
|
|
2218
2219
|
direction,
|
|
2219
2220
|
directionCoefficient *
|
|
2220
|
-
// @ts-expect-error
|
|
2221
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
2221
2222
|
this.scaleToCurrentRange(
|
|
2222
2223
|
REFLECT_ROTATE_HANDLE_DIST,
|
|
2223
2224
|
),
|
|
2224
2225
|
),
|
|
2225
2226
|
);
|
|
2226
|
-
// @ts-expect-error
|
|
2227
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
2227
2228
|
return this.snapCoord(coord);
|
|
2228
2229
|
},
|
|
2229
2230
|
this,
|
|
@@ -2238,7 +2239,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2238
2239
|
}
|
|
2239
2240
|
const self = this;
|
|
2240
2241
|
// eslint-disable-next-line react/no-string-refs
|
|
2241
|
-
// @ts-expect-error
|
|
2242
|
+
// @ts-expect-error - TS2339 - Property 'graphie' does not exist on type 'ReactInstance'.
|
|
2242
2243
|
const graphie = this.refs.graph.graphie();
|
|
2243
2244
|
|
|
2244
2245
|
const updateReflectionTool = function () {
|
|
@@ -2302,23 +2303,23 @@ class Transformer extends React.Component<Props> {
|
|
|
2302
2303
|
onClick: function () {
|
|
2303
2304
|
self.doTransform({
|
|
2304
2305
|
type: "reflection",
|
|
2305
|
-
// @ts-expect-error
|
|
2306
|
+
// @ts-expect-error - TS2322 - Type 'any[]' is not assignable to type '[Coord, Coord]'.
|
|
2306
2307
|
line: _.pluck(reflectPoints, "coord"),
|
|
2307
2308
|
});
|
|
2308
2309
|
if (reflectRotateHandle) {
|
|
2309
2310
|
// flip the rotation handle
|
|
2310
|
-
// @ts-expect-error
|
|
2311
|
+
// @ts-expect-error - TS2339 - Property 'setCoord' does not exist on type 'never'.
|
|
2311
2312
|
reflectRotateHandle.setCoord(
|
|
2312
2313
|
kvector.add(
|
|
2313
2314
|
reflectButton.coord,
|
|
2314
2315
|
kvector.subtract(
|
|
2315
2316
|
reflectButton.coord,
|
|
2316
|
-
// @ts-expect-error
|
|
2317
|
+
// @ts-expect-error - TS2339 - Property 'coord' does not exist on type 'never'.
|
|
2317
2318
|
reflectRotateHandle.coord,
|
|
2318
2319
|
),
|
|
2319
2320
|
),
|
|
2320
2321
|
);
|
|
2321
|
-
// @ts-expect-error
|
|
2322
|
+
// @ts-expect-error - TS2339 - Property 'update' does not exist on type 'never'.
|
|
2322
2323
|
reflectRotateHandle.update();
|
|
2323
2324
|
}
|
|
2324
2325
|
},
|
|
@@ -2371,7 +2372,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2371
2372
|
if (reflectRotateHandle) {
|
|
2372
2373
|
$(reflectRotateHandle).on("move", function () {
|
|
2373
2374
|
const rotateHandleApprox = self.snapCoord(
|
|
2374
|
-
// @ts-expect-error
|
|
2375
|
+
// @ts-expect-error - TS2531 - Object is possibly 'null'.
|
|
2375
2376
|
reflectRotateHandle.coord,
|
|
2376
2377
|
);
|
|
2377
2378
|
|
|
@@ -2403,7 +2404,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2403
2404
|
remove: function () {
|
|
2404
2405
|
reflectButton.remove();
|
|
2405
2406
|
if (reflectRotateHandle) {
|
|
2406
|
-
// @ts-expect-error
|
|
2407
|
+
// @ts-expect-error - TS2339 - Property 'remove' does not exist on type 'never'.
|
|
2407
2408
|
reflectRotateHandle.remove();
|
|
2408
2409
|
}
|
|
2409
2410
|
reflectLine.remove();
|
|
@@ -2421,7 +2422,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2421
2422
|
*/
|
|
2422
2423
|
scaleToCurrentRange: (arg1: number) => number = (dist) => {
|
|
2423
2424
|
// eslint-disable-next-line react/no-string-refs
|
|
2424
|
-
// @ts-expect-error
|
|
2425
|
+
// @ts-expect-error - TS2339 - Property 'props' does not exist on type 'ReactInstance'.
|
|
2425
2426
|
return scaleToRange(dist, this.refs.graph.props.range);
|
|
2426
2427
|
};
|
|
2427
2428
|
|
|
@@ -2432,7 +2433,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2432
2433
|
}
|
|
2433
2434
|
const self = this;
|
|
2434
2435
|
// eslint-disable-next-line react/no-string-refs
|
|
2435
|
-
// @ts-expect-error
|
|
2436
|
+
// @ts-expect-error - TS2339 - Property 'graphie' does not exist on type 'ReactInstance'.
|
|
2436
2437
|
const graphie = this.refs.graph.graphie();
|
|
2437
2438
|
|
|
2438
2439
|
const pointColor = colorForTool(options);
|
|
@@ -2472,7 +2473,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2472
2473
|
// Rotate polygon with rotateHandle
|
|
2473
2474
|
self.doTransform(transform);
|
|
2474
2475
|
|
|
2475
|
-
// @ts-expect-error
|
|
2476
|
+
// @ts-expect-error - TS2339 - Property 'angleDeg' does not exist on type 'PerseusTransformerTransformation'.
|
|
2476
2477
|
return oldAngle + transform.angleDeg;
|
|
2477
2478
|
},
|
|
2478
2479
|
});
|
|
@@ -2499,7 +2500,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2499
2500
|
}
|
|
2500
2501
|
const self = this;
|
|
2501
2502
|
// eslint-disable-next-line react/no-string-refs
|
|
2502
|
-
// @ts-expect-error
|
|
2503
|
+
// @ts-expect-error - TS2339 - Property 'graphie' does not exist on type 'ReactInstance'.
|
|
2503
2504
|
const graphie = this.refs.graph.graphie();
|
|
2504
2505
|
|
|
2505
2506
|
const pointColor = colorForTool(options);
|
|
@@ -2514,7 +2515,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2514
2515
|
snapRadius: self.scaleToCurrentRange(0.5),
|
|
2515
2516
|
onResize: function (newRadius, oldRadius) {
|
|
2516
2517
|
// NOTE(kevinb): object is missing .constraints property
|
|
2517
|
-
// @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'.
|
|
2518
2519
|
self.doTransform({
|
|
2519
2520
|
type: "dilation",
|
|
2520
2521
|
// NOTE(kevinb): It's hard to convince that this.dilationCircle
|
|
@@ -2568,7 +2569,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2568
2569
|
|
|
2569
2570
|
// returns a transformation object representing a rotation
|
|
2570
2571
|
// rounds the angle to the nearest 15 degrees
|
|
2571
|
-
// @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'.
|
|
2572
2573
|
getRotationTransformFromAngle: (
|
|
2573
2574
|
arg1: Coord,
|
|
2574
2575
|
arg2: number,
|
|
@@ -2603,7 +2604,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2603
2604
|
applyTransform: (arg1: TransformerTransformation) => void = (transform) => {
|
|
2604
2605
|
if (this.props.graphMode !== "static") {
|
|
2605
2606
|
const transformFunc = TransformOps.apply(transform);
|
|
2606
|
-
// @ts-expect-error
|
|
2607
|
+
// @ts-expect-error - TS2345 - Argument of type '(coord: any) => any' is not assignable to parameter of type 'PerseusTransformerTransformation'.
|
|
2607
2608
|
this.applyCoordTransformation(transformFunc);
|
|
2608
2609
|
}
|
|
2609
2610
|
};
|
|
@@ -2613,7 +2614,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2613
2614
|
pointTransform,
|
|
2614
2615
|
) => {
|
|
2615
2616
|
_.each(this.shape.points, function (point) {
|
|
2616
|
-
// @ts-expect-error
|
|
2617
|
+
// @ts-expect-error - TS2349 - This expression is not callable.
|
|
2617
2618
|
const newCoord = pointTransform(point.coord);
|
|
2618
2619
|
point.setCoord(newCoord);
|
|
2619
2620
|
});
|
|
@@ -2631,7 +2632,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2631
2632
|
// Remove the last transformation
|
|
2632
2633
|
handleUndoClick: () => void = () => {
|
|
2633
2634
|
// eslint-disable-next-line react/no-string-refs
|
|
2634
|
-
// @ts-expect-error
|
|
2635
|
+
// @ts-expect-error - TS2339 - Property 'changeSelected' does not exist on type 'ReactInstance'.
|
|
2635
2636
|
this.refs.toolsBar.changeSelected(null);
|
|
2636
2637
|
if (this.props.transformations.length) {
|
|
2637
2638
|
this.props.onChange({
|
|
@@ -2648,7 +2649,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2648
2649
|
{
|
|
2649
2650
|
transformations: newTransfomationList,
|
|
2650
2651
|
},
|
|
2651
|
-
// @ts-expect-error
|
|
2652
|
+
// @ts-expect-error - TS2345 - Argument of type '(arg1: any) => unknown' is not assignable to parameter of type '() => unknown'.
|
|
2652
2653
|
callback,
|
|
2653
2654
|
);
|
|
2654
2655
|
};
|
|
@@ -2666,7 +2667,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2666
2667
|
{
|
|
2667
2668
|
transformations: _.clone(this.transformations),
|
|
2668
2669
|
},
|
|
2669
|
-
// @ts-expect-error
|
|
2670
|
+
// @ts-expect-error - TS2345 - Argument of type '((arg1: any) => unknown) | undefined' is not assignable to parameter of type '(() => unknown) | undefined'.
|
|
2670
2671
|
callback,
|
|
2671
2672
|
);
|
|
2672
2673
|
};
|
|
@@ -2676,7 +2677,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2676
2677
|
newTools[tool] = _.extend({}, this.props.tools[tool], changes);
|
|
2677
2678
|
this.tools[tool] = _.clone(newTools[tool]);
|
|
2678
2679
|
this.props.onChange({
|
|
2679
|
-
// @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.
|
|
2680
2681
|
tools: newTools,
|
|
2681
2682
|
});
|
|
2682
2683
|
this.props.trackInteraction();
|
|
@@ -2691,7 +2692,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2691
2692
|
* moved, even if we're in formal mode with no movement
|
|
2692
2693
|
* (and thus the actual movablepoints may not have moved
|
|
2693
2694
|
*/
|
|
2694
|
-
// @ts-expect-error
|
|
2695
|
+
// @ts-expect-error - TS2322 - Type '() => [Coord, Coord] | readonly Coord[] | [Coord, Coord, Coord]' is not assignable to type '() => Coord'.
|
|
2695
2696
|
getCoords: () => Coord = () => {
|
|
2696
2697
|
const startCoords = this.props.starting.shape.coords;
|
|
2697
2698
|
const transforms = this.props.transformations;
|
|
@@ -2716,14 +2717,14 @@ class Transformer extends React.Component<Props> {
|
|
|
2716
2717
|
"gradeEmpty",
|
|
2717
2718
|
);
|
|
2718
2719
|
// eslint-disable-next-line react/no-string-refs
|
|
2719
|
-
// @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'.
|
|
2720
2721
|
json.graph = this.refs.graph.toJSON();
|
|
2721
|
-
// @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">'.
|
|
2722
2723
|
json.version = 1.2; // Give us some safety to change the format
|
|
2723
2724
|
// when we realize that I wrote
|
|
2724
2725
|
// a horrible json spec for this widget
|
|
2725
2726
|
|
|
2726
|
-
// @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">'.
|
|
2727
2728
|
json.answer = this.getUserInput();
|
|
2728
2729
|
return json;
|
|
2729
2730
|
};
|
|
@@ -2762,7 +2763,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2762
2763
|
// Follow the path of references
|
|
2763
2764
|
let component = this;
|
|
2764
2765
|
_.each(refPath, (ref) => {
|
|
2765
|
-
// @ts-expect-error
|
|
2766
|
+
// @ts-expect-error - TS2322 - Type 'ReactInstance' is not assignable to type 'this'.
|
|
2766
2767
|
component = component.refs[ref];
|
|
2767
2768
|
});
|
|
2768
2769
|
return component;
|
|
@@ -2777,14 +2778,14 @@ class Transformer extends React.Component<Props> {
|
|
|
2777
2778
|
|
|
2778
2779
|
let inputPaths: Array<never> | Array<any> = [];
|
|
2779
2780
|
_.each(this.props.transformations, (transformation, i) => {
|
|
2780
|
-
// @ts-expect-error
|
|
2781
|
+
// @ts-expect-error - TS2345 - Argument of type 'number' is not assignable to parameter of type 'string'.
|
|
2781
2782
|
transformation = this._getTransformationForID(i);
|
|
2782
|
-
// @ts-expect-error
|
|
2783
|
+
// @ts-expect-error - TS2339 - Property 'getInputPaths' does not exist on type 'PerseusTransformerTransformation'.
|
|
2783
2784
|
const innerPaths = transformation.getInputPaths();
|
|
2784
2785
|
const fullPaths = _.map(innerPaths, (innerPath) => {
|
|
2785
2786
|
return ["" + i].concat(innerPath);
|
|
2786
2787
|
});
|
|
2787
|
-
// @ts-expect-error
|
|
2788
|
+
// @ts-expect-error - TS2345 - Argument of type 'string[][]' is not assignable to parameter of type 'ConcatArray<never>'.
|
|
2788
2789
|
inputPaths = inputPaths.concat(fullPaths);
|
|
2789
2790
|
});
|
|
2790
2791
|
return inputPaths;
|
|
@@ -2807,7 +2808,7 @@ class Transformer extends React.Component<Props> {
|
|
|
2807
2808
|
|
|
2808
2809
|
// Pass arguments down to appropriate 'transformation' component
|
|
2809
2810
|
const transformationID = _.head(path);
|
|
2810
|
-
// @ts-expect-error
|
|
2811
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
2811
2812
|
const caller = this._getTransformationForID(transformationID);
|
|
2812
2813
|
return caller[functionName](innerPath, ...args);
|
|
2813
2814
|
};
|