@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,142 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Flowtype definitions for data
|
|
3
|
-
* Generated by Flowgen from a Typescript Definition
|
|
4
|
-
* Flowgen v1.21.0
|
|
5
|
-
* @flow
|
|
6
|
-
*/
|
|
7
|
-
import * as $Flowgen$Import$_2e__2e__2f_types from "../types";
|
|
8
|
-
import { Popover } from "@khanacademy/wonder-blocks-popover";
|
|
9
|
-
import * as React from "react";
|
|
10
|
-
import AnswerChoices from "./label-image/answer-choices";
|
|
11
|
-
import Marker from "./label-image/marker";
|
|
12
|
-
import type { ChangeableProps } from "../mixins/changeable";
|
|
13
|
-
import type { APIOptions, PerseusScore } from "../types";
|
|
14
|
-
import type {
|
|
15
|
-
InteractiveMarkerType,
|
|
16
|
-
InteractiveMarkerScore,
|
|
17
|
-
} from "./label-image/types";
|
|
18
|
-
declare type MarkersState = {|
|
|
19
|
-
markers: $ReadOnlyArray<InteractiveMarkerType>,
|
|
20
|
-
|};
|
|
21
|
-
/**
|
|
22
|
-
* Represents a direction vector.
|
|
23
|
-
* No diagonals allowed.
|
|
24
|
-
*/
|
|
25
|
-
declare type Direction =
|
|
26
|
-
| {|
|
|
27
|
-
x: 0,
|
|
28
|
-
y: 1 | -1,
|
|
29
|
-
|}
|
|
30
|
-
| {|
|
|
31
|
-
x: 1 | -1,
|
|
32
|
-
y: 0,
|
|
33
|
-
|}
|
|
34
|
-
| {|
|
|
35
|
-
x: 0,
|
|
36
|
-
y: 0,
|
|
37
|
-
|};
|
|
38
|
-
declare type Point = {|
|
|
39
|
-
x: number,
|
|
40
|
-
y: number,
|
|
41
|
-
|};
|
|
42
|
-
declare type LabelImageProps = {|
|
|
43
|
-
...ChangeableProps,
|
|
44
|
-
...{|
|
|
45
|
-
apiOptions: APIOptions,
|
|
46
|
-
choices: $ReadOnlyArray<string>,
|
|
47
|
-
imageAlt: string,
|
|
48
|
-
imageUrl: string,
|
|
49
|
-
imageWidth: number,
|
|
50
|
-
imageHeight: number,
|
|
51
|
-
markers: $ReadOnlyArray<InteractiveMarkerType>,
|
|
52
|
-
multipleAnswers: boolean,
|
|
53
|
-
hideChoicesFromInstructions: boolean,
|
|
54
|
-
questionCompleted: boolean,
|
|
55
|
-
|},
|
|
56
|
-
|};
|
|
57
|
-
declare type LabelImageState = {|
|
|
58
|
-
selectedMarkerIndex: number,
|
|
59
|
-
markersInteracted: boolean,
|
|
60
|
-
|};
|
|
61
|
-
declare class LabelImage
|
|
62
|
-
extends React.Component<LabelImageProps, LabelImageState>
|
|
63
|
-
{
|
|
64
|
-
_markers: Array<Marker | null | void>;
|
|
65
|
-
_selectedMarkerPopup: Popover | null | void;
|
|
66
|
-
_answerChoices: AnswerChoices | null | void;
|
|
67
|
-
static gradeMarker(marker: InteractiveMarkerType): InteractiveMarkerScore;
|
|
68
|
-
static validate(state: MarkersState, rubric?: LabelImageProps): PerseusScore;
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Test whether point is contained within triangle.
|
|
72
|
-
*
|
|
73
|
-
* Implementation taken from: https://stackoverflow.com/a/2049593
|
|
74
|
-
*/
|
|
75
|
-
static pointInTriangle(p: Point, a: Point, b: Point, c: Point): boolean;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Determine the image side given a marker position (as percent of size).
|
|
79
|
-
*/
|
|
80
|
-
static imageSideForMarkerPosition(
|
|
81
|
-
x: number,
|
|
82
|
-
y: number
|
|
83
|
-
): "bottom" | "left" | "right" | "top" | "center";
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Calculate the next marker to navigate to, from the "this marker".
|
|
87
|
-
*
|
|
88
|
-
* Given a cardinal navigation direction (in the x or y axis), return the
|
|
89
|
-
* next marker index to visit.
|
|
90
|
-
*/
|
|
91
|
-
static navigateToMarkerIndex(
|
|
92
|
-
navigateDirection: Direction,
|
|
93
|
-
markers: $ReadOnlyArray<InteractiveMarkerType>,
|
|
94
|
-
thisIndex: number
|
|
95
|
-
): number;
|
|
96
|
-
constructor(props: LabelImageProps): this;
|
|
97
|
-
componentDidMount(): void;
|
|
98
|
-
componentWillUnmount(): void;
|
|
99
|
-
simpleValidate(rubric: LabelImageProps): PerseusScore;
|
|
100
|
-
getUserInput(): MarkersState;
|
|
101
|
-
showRationalesForCurrentlySelectedChoices(rubric: LabelImageProps): void;
|
|
102
|
-
dismissMarkerPopup(): void;
|
|
103
|
-
handleDocumentClick: (e: MouseEvent) => void;
|
|
104
|
-
handleDocumentKeyDown: (e: KeyboardEvent) => void;
|
|
105
|
-
handleMarkerChange(index: number, marker: InteractiveMarkerType): void;
|
|
106
|
-
handleMarkerClick(index: number, e: MouseEvent): void;
|
|
107
|
-
handleMarkerKeyDown(index: number, e: KeyboardEvent): void;
|
|
108
|
-
handleAnswerChoicesChangeForMarker(
|
|
109
|
-
index: number,
|
|
110
|
-
selection: $ReadOnlyArray<boolean>
|
|
111
|
-
): void;
|
|
112
|
-
renderAnswerChoicesForMarker(
|
|
113
|
-
index: number,
|
|
114
|
-
marker: InteractiveMarkerType
|
|
115
|
-
): React.Element<"div">;
|
|
116
|
-
renderMarkers(): $ReadOnlyArray<React.Node>;
|
|
117
|
-
renderInstructions(): React.Node;
|
|
118
|
-
render(): React.Node;
|
|
119
|
-
}
|
|
120
|
-
declare var _default: $ReadOnly<{|
|
|
121
|
-
name: string,
|
|
122
|
-
displayName: string,
|
|
123
|
-
getWidget?: (() => typeof LabelImage) | void,
|
|
124
|
-
accessible?: boolean | ((props: any) => boolean) | void,
|
|
125
|
-
hidden?: boolean | void,
|
|
126
|
-
version?: $Flowgen$Import$_2e__2e__2f_types.Version | void,
|
|
127
|
-
supportedAlignments?: $ReadOnlyArray<$Flowgen$Import$_2e__2e__2f_types.Alignment> | void,
|
|
128
|
-
defaultAlignment?: $Flowgen$Import$_2e__2e__2f_types.Alignment | void,
|
|
129
|
-
getDefaultAlignment?:
|
|
130
|
-
| (() => $Flowgen$Import$_2e__2e__2f_types.Alignment)
|
|
131
|
-
| void,
|
|
132
|
-
isLintable?: boolean | void,
|
|
133
|
-
tracking?: $Flowgen$Import$_2e__2e__2f_types.Tracking | void,
|
|
134
|
-
traverseChildWidgets?: any,
|
|
135
|
-
transform?: $Flowgen$Import$_2e__2e__2f_types.WidgetTransform | void,
|
|
136
|
-
staticTransform?: $Flowgen$Import$_2e__2e__2f_types.WidgetTransform | void,
|
|
137
|
-
propUpgrades?: {
|
|
138
|
-
[key: string]: (arg1: any) => any,
|
|
139
|
-
} | void,
|
|
140
|
-
widget: typeof LabelImage,
|
|
141
|
-
|}>;
|
|
142
|
-
declare export default typeof _default;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Flowtype definitions for data
|
|
3
|
-
* Generated by Flowgen from a Typescript Definition
|
|
4
|
-
* Flowgen v1.21.0
|
|
5
|
-
* @flow
|
|
6
|
-
*/
|
|
7
|
-
import * as $Flowgen$Import$_2e__2e__2f_types from "../types";
|
|
8
|
-
import PropTypes from "prop-types";
|
|
9
|
-
import * as React from "react";
|
|
10
|
-
declare class LightsPuzzle extends React.Component<any> {
|
|
11
|
-
_currPattern: any;
|
|
12
|
-
_nextPattern: any;
|
|
13
|
-
_patternIndex: number;
|
|
14
|
-
static propTypes: {|
|
|
15
|
-
cells: PropTypes.Requireable<((boolean | null | void)[] | null | void)[]>,
|
|
16
|
-
startCells: PropTypes.Requireable<
|
|
17
|
-
((boolean | null | void)[] | null | void)[]
|
|
18
|
-
>,
|
|
19
|
-
flipPattern: PropTypes.Validator<string>,
|
|
20
|
-
moveCount: PropTypes.Validator<number>,
|
|
21
|
-
onChange: PropTypes.Validator<(...args: any[]) => any>,
|
|
22
|
-
|};
|
|
23
|
-
static defaultProps: any;
|
|
24
|
-
getUserInput: () => any;
|
|
25
|
-
render(): React.Node;
|
|
26
|
-
change: (...args: $ReadOnlyArray<mixed>) => any;
|
|
27
|
-
_width: () => number;
|
|
28
|
-
componentDidMount(): void;
|
|
29
|
-
componentDidUpdate(prevProps: any): void;
|
|
30
|
-
_initNextPatterns: () => void;
|
|
31
|
-
_shiftPatterns: () => void;
|
|
32
|
-
_flipTile: (arg1: any, arg2: any) => void;
|
|
33
|
-
_reset: () => void;
|
|
34
|
-
simpleValidate: (arg1: any) => any;
|
|
35
|
-
}
|
|
36
|
-
declare var _default: $ReadOnly<{|
|
|
37
|
-
name: string,
|
|
38
|
-
displayName: string,
|
|
39
|
-
getWidget?: (() => typeof LightsPuzzle) | void,
|
|
40
|
-
accessible?: boolean | ((props: any) => boolean) | void,
|
|
41
|
-
hidden?: boolean | void,
|
|
42
|
-
version?: $Flowgen$Import$_2e__2e__2f_types.Version | void,
|
|
43
|
-
supportedAlignments?: $ReadOnlyArray<$Flowgen$Import$_2e__2e__2f_types.Alignment> | void,
|
|
44
|
-
defaultAlignment?: $Flowgen$Import$_2e__2e__2f_types.Alignment | void,
|
|
45
|
-
getDefaultAlignment?:
|
|
46
|
-
| (() => $Flowgen$Import$_2e__2e__2f_types.Alignment)
|
|
47
|
-
| void,
|
|
48
|
-
isLintable?: boolean | void,
|
|
49
|
-
tracking?: $Flowgen$Import$_2e__2e__2f_types.Tracking | void,
|
|
50
|
-
traverseChildWidgets?: any,
|
|
51
|
-
transform?: $Flowgen$Import$_2e__2e__2f_types.WidgetTransform | void,
|
|
52
|
-
staticTransform?: $Flowgen$Import$_2e__2e__2f_types.WidgetTransform | void,
|
|
53
|
-
propUpgrades?: {
|
|
54
|
-
[key: string]: (arg1: any) => any,
|
|
55
|
-
} | void,
|
|
56
|
-
widget: typeof LightsPuzzle,
|
|
57
|
-
|}>;
|
|
58
|
-
declare export default typeof _default;
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Flowtype definitions for data
|
|
3
|
-
* Generated by Flowgen from a Typescript Definition
|
|
4
|
-
* Flowgen v1.21.0
|
|
5
|
-
* @flow
|
|
6
|
-
*/
|
|
7
|
-
import * as $Flowgen$Import$_2e__2e__2f_types from "../types";
|
|
8
|
-
import PropTypes from "prop-types";
|
|
9
|
-
import * as React from "react";
|
|
10
|
-
import type { SortableOption } from "../components/sortable";
|
|
11
|
-
declare type State = {|
|
|
12
|
-
leftHeight: number,
|
|
13
|
-
rightHeight: number,
|
|
14
|
-
texRendererLoaded: boolean,
|
|
15
|
-
|};
|
|
16
|
-
declare class Matcher extends React.Component<any, any> {
|
|
17
|
-
static propTypes: {|
|
|
18
|
-
apiOptions: PropTypes.Validator<
|
|
19
|
-
$NonMaybeType<
|
|
20
|
-
PropTypes.InferProps<{|
|
|
21
|
-
isArticle: PropTypes.Validator<boolean>,
|
|
22
|
-
onInputError: PropTypes.Validator<(...args: any[]) => any>,
|
|
23
|
-
onFocusChange: PropTypes.Validator<(...args: any[]) => any>,
|
|
24
|
-
GroupMetadataEditor: PropTypes.Validator<(...args: any[]) => any>,
|
|
25
|
-
showAlignmentOptions: PropTypes.Validator<boolean>,
|
|
26
|
-
readOnly: PropTypes.Validator<boolean>,
|
|
27
|
-
answerableCallback: PropTypes.Requireable<(...args: any[]) => any>,
|
|
28
|
-
getAnotherHint: PropTypes.Requireable<(...args: any[]) => any>,
|
|
29
|
-
interactionCallback: PropTypes.Requireable<(...args: any[]) => any>,
|
|
30
|
-
groupAnnotator: PropTypes.Validator<(...args: any[]) => any>,
|
|
31
|
-
imagePlaceholder: PropTypes.Requireable<PropTypes.ReactNodeLike>,
|
|
32
|
-
widgetPlaceholder: PropTypes.Requireable<PropTypes.ReactNodeLike>,
|
|
33
|
-
baseElements: PropTypes.Requireable<
|
|
34
|
-
PropTypes.InferProps<{|
|
|
35
|
-
Link: PropTypes.Requireable<(...args: any[]) => any>,
|
|
36
|
-
|}>
|
|
37
|
-
>,
|
|
38
|
-
imagePreloader: PropTypes.Requireable<(...args: any[]) => any>,
|
|
39
|
-
trackInteraction: PropTypes.Requireable<(...args: any[]) => any>,
|
|
40
|
-
customKeypad: PropTypes.Requireable<boolean>,
|
|
41
|
-
nativeKeypadProxy: PropTypes.Requireable<(...args: any[]) => any>,
|
|
42
|
-
isMobile: PropTypes.Requireable<boolean>,
|
|
43
|
-
useV2Keypad: PropTypes.Requireable<boolean>,
|
|
44
|
-
setDrawingAreaAvailable: PropTypes.Requireable<
|
|
45
|
-
(...args: any[]) => any
|
|
46
|
-
>,
|
|
47
|
-
useDraftEditor: PropTypes.Requireable<boolean>,
|
|
48
|
-
hintProgressColor: PropTypes.Requireable<string>,
|
|
49
|
-
canScrollPage: PropTypes.Requireable<boolean>,
|
|
50
|
-
inModal: PropTypes.Requireable<boolean>,
|
|
51
|
-
crossOutEnabled: PropTypes.Requireable<boolean>,
|
|
52
|
-
editorChangeDelay: PropTypes.Requireable<number>,
|
|
53
|
-
|}>
|
|
54
|
-
>
|
|
55
|
-
>,
|
|
56
|
-
labels: PropTypes.Requireable<any[]>,
|
|
57
|
-
left: PropTypes.Requireable<any[]>,
|
|
58
|
-
onChange: PropTypes.Requireable<(...args: any[]) => any>,
|
|
59
|
-
orderMatters: PropTypes.Requireable<boolean>,
|
|
60
|
-
padding: PropTypes.Requireable<boolean>,
|
|
61
|
-
problemNum: PropTypes.Requireable<number>,
|
|
62
|
-
right: PropTypes.Requireable<any[]>,
|
|
63
|
-
trackInteraction: PropTypes.Validator<(...args: any[]) => any>,
|
|
64
|
-
linterContext: PropTypes.Requireable<
|
|
65
|
-
PropTypes.InferProps<{|
|
|
66
|
-
contentType: PropTypes.Requireable<string>,
|
|
67
|
-
highlightLint: PropTypes.Requireable<boolean>,
|
|
68
|
-
paths: PropTypes.Requireable<(string | null | void)[]>,
|
|
69
|
-
stack: PropTypes.Requireable<(string | null | void)[]>,
|
|
70
|
-
|}>
|
|
71
|
-
>,
|
|
72
|
-
|};
|
|
73
|
-
static defaultProps: any;
|
|
74
|
-
state: State;
|
|
75
|
-
render(): React.Element<any>;
|
|
76
|
-
changeAndTrack: (arg1: any) => void;
|
|
77
|
-
onMeasureLeft: (arg1: any) => void;
|
|
78
|
-
onMeasureRight: (arg1: any) => void;
|
|
79
|
-
getUserInput: () => any;
|
|
80
|
-
moveLeftOptionToIndex: (option: SortableOption, index: number) => void;
|
|
81
|
-
moveRightOptionToIndex: (option: SortableOption, index: number) => void;
|
|
82
|
-
simpleValidate: (arg1: any) => any;
|
|
83
|
-
}
|
|
84
|
-
declare var _default: $ReadOnly<{|
|
|
85
|
-
name: string,
|
|
86
|
-
displayName: string,
|
|
87
|
-
getWidget?: (() => typeof Matcher) | void,
|
|
88
|
-
accessible?: boolean | ((props: any) => boolean) | void,
|
|
89
|
-
hidden?: boolean | void,
|
|
90
|
-
version?: $Flowgen$Import$_2e__2e__2f_types.Version | void,
|
|
91
|
-
supportedAlignments?: $ReadOnlyArray<$Flowgen$Import$_2e__2e__2f_types.Alignment> | void,
|
|
92
|
-
defaultAlignment?: $Flowgen$Import$_2e__2e__2f_types.Alignment | void,
|
|
93
|
-
getDefaultAlignment?:
|
|
94
|
-
| (() => $Flowgen$Import$_2e__2e__2f_types.Alignment)
|
|
95
|
-
| void,
|
|
96
|
-
isLintable?: boolean | void,
|
|
97
|
-
tracking?: $Flowgen$Import$_2e__2e__2f_types.Tracking | void,
|
|
98
|
-
traverseChildWidgets?: any,
|
|
99
|
-
transform?: $Flowgen$Import$_2e__2e__2f_types.WidgetTransform | void,
|
|
100
|
-
staticTransform?: $Flowgen$Import$_2e__2e__2f_types.WidgetTransform | void,
|
|
101
|
-
propUpgrades?: {
|
|
102
|
-
[key: string]: (arg1: any) => any,
|
|
103
|
-
} | void,
|
|
104
|
-
widget: typeof Matcher,
|
|
105
|
-
|}>;
|
|
106
|
-
declare export default typeof _default;
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Flowtype definitions for data
|
|
3
|
-
* Generated by Flowgen from a Typescript Definition
|
|
4
|
-
* Flowgen v1.21.0
|
|
5
|
-
* @flow
|
|
6
|
-
*/
|
|
7
|
-
import * as $Flowgen$Import$_2e__2e__2f_types from "../types";
|
|
8
|
-
import * as React from "react";
|
|
9
|
-
import type { PerseusMatrixWidgetOptions } from "../perseus-types";
|
|
10
|
-
import type { WidgetProps } from "../types";
|
|
11
|
-
declare type Rubric = PerseusMatrixWidgetOptions;
|
|
12
|
-
declare type ExternalProps = WidgetProps<PerseusMatrixWidgetOptions, Rubric>;
|
|
13
|
-
declare type Props = {|
|
|
14
|
-
...ExternalProps,
|
|
15
|
-
...{|
|
|
16
|
-
onChange: (
|
|
17
|
-
arg1: {|
|
|
18
|
-
cursorPosition?: $ReadOnlyArray<number>,
|
|
19
|
-
answers?: $ReadOnlyArray<$ReadOnlyArray<number | string>>,
|
|
20
|
-
|},
|
|
21
|
-
arg2: () => boolean
|
|
22
|
-
) => void,
|
|
23
|
-
numericInput?: boolean,
|
|
24
|
-
|},
|
|
25
|
-
|};
|
|
26
|
-
declare type DefaultProps = {|
|
|
27
|
-
matrixBoardSize: $PropertyType<Props, "matrixBoardSize">,
|
|
28
|
-
answers: $PropertyType<Props, "answers">,
|
|
29
|
-
prefix: $PropertyType<Props, "prefix">,
|
|
30
|
-
suffix: $PropertyType<Props, "suffix">,
|
|
31
|
-
cursorPosition: $PropertyType<Props, "cursorPosition">,
|
|
32
|
-
apiOptions: $PropertyType<Props, "apiOptions">,
|
|
33
|
-
linterContext: $PropertyType<Props, "linterContext">,
|
|
34
|
-
|};
|
|
35
|
-
declare type State = {|
|
|
36
|
-
enterTheMatrix: number,
|
|
37
|
-
|};
|
|
38
|
-
declare class Matrix extends React.Component<Props, State> {
|
|
39
|
-
cursorPosition: [number, number];
|
|
40
|
-
static defaultProps: DefaultProps;
|
|
41
|
-
state: State;
|
|
42
|
-
componentDidMount(): void;
|
|
43
|
-
render(): React.Node;
|
|
44
|
-
getInputPaths: () => $ReadOnlyArray<$ReadOnlyArray<string>>;
|
|
45
|
-
getGrammarTypeForPath: (arg1: any) => string;
|
|
46
|
-
_handleFocus: (arg1: any, arg2: any) => void;
|
|
47
|
-
_handleBlur: (arg1: any, arg2: any) => void;
|
|
48
|
-
focus: () => boolean;
|
|
49
|
-
focusInputPath: (arg1: any) => void;
|
|
50
|
-
blurInputPath: (arg1: any) => void;
|
|
51
|
-
getDOMNodeForPath: (arg1: any) => Element | Text | null | void;
|
|
52
|
-
setInputValue: (arg1: any, arg2: any, arg3: any) => void;
|
|
53
|
-
handleKeyDown: (arg1: any, arg2: any, arg3: any) => void;
|
|
54
|
-
onValueChange: (arg1: any, arg2: any, arg3: any, arg4: any) => void;
|
|
55
|
-
getUserInput: () => any;
|
|
56
|
-
simpleValidate: (arg1: any) => any;
|
|
57
|
-
}
|
|
58
|
-
declare var _default: $ReadOnly<{|
|
|
59
|
-
name: string,
|
|
60
|
-
displayName: string,
|
|
61
|
-
getWidget?: (() => typeof Matrix) | void,
|
|
62
|
-
accessible?: boolean | ((props: any) => boolean) | void,
|
|
63
|
-
hidden?: boolean | void,
|
|
64
|
-
version?: $Flowgen$Import$_2e__2e__2f_types.Version | void,
|
|
65
|
-
supportedAlignments?: $ReadOnlyArray<$Flowgen$Import$_2e__2e__2f_types.Alignment> | void,
|
|
66
|
-
defaultAlignment?: $Flowgen$Import$_2e__2e__2f_types.Alignment | void,
|
|
67
|
-
getDefaultAlignment?:
|
|
68
|
-
| (() => $Flowgen$Import$_2e__2e__2f_types.Alignment)
|
|
69
|
-
| void,
|
|
70
|
-
isLintable?: boolean | void,
|
|
71
|
-
tracking?: $Flowgen$Import$_2e__2e__2f_types.Tracking | void,
|
|
72
|
-
traverseChildWidgets?: any,
|
|
73
|
-
transform?: $Flowgen$Import$_2e__2e__2f_types.WidgetTransform | void,
|
|
74
|
-
staticTransform?: $Flowgen$Import$_2e__2e__2f_types.WidgetTransform | void,
|
|
75
|
-
propUpgrades?: {
|
|
76
|
-
[key: string]: (arg1: any) => any,
|
|
77
|
-
} | void,
|
|
78
|
-
widget: typeof Matrix,
|
|
79
|
-
|}>;
|
|
80
|
-
declare export default typeof _default;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Flowtype definitions for data
|
|
3
|
-
* Generated by Flowgen from a Typescript Definition
|
|
4
|
-
* Flowgen v1.21.0
|
|
5
|
-
* @flow
|
|
6
|
-
*/
|
|
7
|
-
import * as $Flowgen$Import$_2e__2e__2f_types from "../types";
|
|
8
|
-
declare var _default: $ReadOnly<{|
|
|
9
|
-
name: string,
|
|
10
|
-
displayName: string,
|
|
11
|
-
getWidget?: (() => any) | void,
|
|
12
|
-
accessible?: boolean | ((props: any) => boolean) | void,
|
|
13
|
-
hidden?: boolean | void,
|
|
14
|
-
version?: $Flowgen$Import$_2e__2e__2f_types.Version | void,
|
|
15
|
-
supportedAlignments?: $ReadOnlyArray<$Flowgen$Import$_2e__2e__2f_types.Alignment> | void,
|
|
16
|
-
defaultAlignment?: $Flowgen$Import$_2e__2e__2f_types.Alignment | void,
|
|
17
|
-
getDefaultAlignment?:
|
|
18
|
-
| (() => $Flowgen$Import$_2e__2e__2f_types.Alignment)
|
|
19
|
-
| void,
|
|
20
|
-
isLintable?: boolean | void,
|
|
21
|
-
tracking?: $Flowgen$Import$_2e__2e__2f_types.Tracking | void,
|
|
22
|
-
traverseChildWidgets?: any,
|
|
23
|
-
transform?: $Flowgen$Import$_2e__2e__2f_types.WidgetTransform | void,
|
|
24
|
-
staticTransform?: $Flowgen$Import$_2e__2e__2f_types.WidgetTransform | void,
|
|
25
|
-
propUpgrades?: {
|
|
26
|
-
[key: string]: (arg1: any) => any,
|
|
27
|
-
} | void,
|
|
28
|
-
widget: any,
|
|
29
|
-
|}>;
|
|
30
|
-
declare export default typeof _default;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Flowtype definitions for data
|
|
3
|
-
* Generated by Flowgen from a Typescript Definition
|
|
4
|
-
* Flowgen v1.21.0
|
|
5
|
-
* @flow
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Draw an array of rendering instructions into a 2D canvas drawing context.
|
|
9
|
-
*/
|
|
10
|
-
declare function draw(ctx: any, items: Array<any>): void;
|
|
11
|
-
declare export default typeof draw;
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Flowtype definitions for data
|
|
3
|
-
* Generated by Flowgen from a Typescript Definition
|
|
4
|
-
* Flowgen v1.21.0
|
|
5
|
-
* @flow
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* A molecule layout engine.
|
|
9
|
-
*
|
|
10
|
-
* This module transforms the SMILES syntax tree into a set of rendering
|
|
11
|
-
* instructions. A rendering instruction is an object indicating what type of
|
|
12
|
-
* thing to render (e.g. text or line), where to render it, and any other style
|
|
13
|
-
* properties needed.
|
|
14
|
-
*
|
|
15
|
-
* For instance, an oxygen atom might be rendered as
|
|
16
|
-
* {type: "text", value: "O", pos: [0, 0], idx: "1,0"}
|
|
17
|
-
*/
|
|
18
|
-
/**
|
|
19
|
-
* Compute the layout for a single atom.
|
|
20
|
-
*
|
|
21
|
-
* Args:
|
|
22
|
-
* atom: the atom node for which layout is being created, as returned from
|
|
23
|
-
* convertTree; the computed position of this atom is added to this
|
|
24
|
-
* object in place, in addition to being returned in the layout
|
|
25
|
-
* instruction.
|
|
26
|
-
* TODO(colin): refactor so that we don't need to modify this in place
|
|
27
|
-
* atoms: the list of all atoms, as returned from convertTree, used to
|
|
28
|
-
* position this atom appropriately relative to its neighbors
|
|
29
|
-
* bonds: the list of all bonds, as returned from convertTree, used to
|
|
30
|
-
* determine the geometry based on bond type
|
|
31
|
-
* rotationAngle: a constant rotation for the whole molecule (in degrees)
|
|
32
|
-
*
|
|
33
|
-
* Return:
|
|
34
|
-
* a rendering instruction for the atom, containing a type (text), the text
|
|
35
|
-
* to render, the position, and the atom index
|
|
36
|
-
*/
|
|
37
|
-
declare function atomLayout(
|
|
38
|
-
atom: any,
|
|
39
|
-
atoms: any,
|
|
40
|
-
bonds: $ReadOnlyArray<any>,
|
|
41
|
-
rotationAngle: number
|
|
42
|
-
): any;
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Compute the layout for a bond between two atoms.
|
|
46
|
-
*
|
|
47
|
-
* Args:
|
|
48
|
-
* bond: the bond node for which the layout is being computed, as returned
|
|
49
|
-
* by convertTree
|
|
50
|
-
* atoms: the list of all atoms returned by convertTree, which should
|
|
51
|
-
* already have been processed for layout and thus have positions set
|
|
52
|
-
*
|
|
53
|
-
* Return:
|
|
54
|
-
* a rendering instruction for the bond containing a type
|
|
55
|
-
* (line:{single,double,triple}) and the line's endpoints
|
|
56
|
-
*/
|
|
57
|
-
declare function bondLayout(bond: any, atoms: any): any;
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Convert the parse tree output by the parser into an ordered list of atoms
|
|
61
|
-
* and bonds to render.
|
|
62
|
-
*
|
|
63
|
-
* Args:
|
|
64
|
-
* atoms: the output list of atoms that we're in the process of building.
|
|
65
|
-
* This should be the empty list if not being called recursively.
|
|
66
|
-
* bonds: the output list of bonds that we're in the process of building.
|
|
67
|
-
* This should be the empty list if not being called recursively.
|
|
68
|
-
* tree: the parse tree generated by the SMILES parser module.
|
|
69
|
-
*
|
|
70
|
-
* Return:
|
|
71
|
-
* the final value of atoms and bonds, which are lists of all the atom
|
|
72
|
-
* nodes and bond nodes, respectively, that need to be rendered.
|
|
73
|
-
*/
|
|
74
|
-
declare function convertTree(atoms: any, bonds: any, tree: any): [any, any];
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Compute an array of rendering instructions from the parse tree of a molecule.
|
|
78
|
-
*
|
|
79
|
-
* Args:
|
|
80
|
-
* tree: the parse tree as returned by the SMILES parser module
|
|
81
|
-
* rotationAngle: a global rotation (in degrees) to be applied to the whole
|
|
82
|
-
* molecule; this is manually adjustable in the widget.
|
|
83
|
-
*
|
|
84
|
-
* Return:
|
|
85
|
-
* an array of rendering instructions for all the atoms and bonds in the
|
|
86
|
-
* molecule suitable for processing by the renderer
|
|
87
|
-
*/
|
|
88
|
-
declare function layout(tree: any, rotationAngle: any): any;
|
|
89
|
-
declare var _default: {|
|
|
90
|
-
layout: typeof layout,
|
|
91
|
-
_atomLayout: typeof atomLayout,
|
|
92
|
-
_bondLayout: typeof bondLayout,
|
|
93
|
-
_bondLength: number,
|
|
94
|
-
_convertTree: typeof convertTree,
|
|
95
|
-
|};
|
|
96
|
-
declare export default typeof _default;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Flowtype definitions for data
|
|
3
|
-
* Generated by Flowgen from a Typescript Definition
|
|
4
|
-
* Flowgen v1.21.0
|
|
5
|
-
* @flow
|
|
6
|
-
*/
|
|
7
|
-
declare function ParseError(message: string): void;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Parse a SMILES string to an internal tree representation.
|
|
11
|
-
*
|
|
12
|
-
* Args:
|
|
13
|
-
* smiles [string]: a string representing the molecule.
|
|
14
|
-
*
|
|
15
|
-
* Returns: the parse tree (see top-of file docstring for details).
|
|
16
|
-
*
|
|
17
|
-
* Throws:
|
|
18
|
-
* ParseError: if the input is not valid SMILES or contains features not
|
|
19
|
-
* yet implemented.
|
|
20
|
-
*/
|
|
21
|
-
declare function parse(smiles: any, ctx: any): any;
|
|
22
|
-
declare var _default: {|
|
|
23
|
-
parse: typeof parse,
|
|
24
|
-
ParseError: typeof ParseError,
|
|
25
|
-
|};
|
|
26
|
-
declare export default typeof _default;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Flowtype definitions for data
|
|
3
|
-
* Generated by Flowgen from a Typescript Definition
|
|
4
|
-
* Flowgen v1.21.0
|
|
5
|
-
* @flow
|
|
6
|
-
*/
|
|
7
|
-
import * as $Flowgen$Import$_2e__2e__2f_types from "../types";
|
|
8
|
-
import PropTypes from "prop-types";
|
|
9
|
-
import * as React from "react";
|
|
10
|
-
declare export class Molecule extends React.Component<any, any> {
|
|
11
|
-
static propTypes: {|
|
|
12
|
-
id: PropTypes.Validator<string>,
|
|
13
|
-
rotationAngle: PropTypes.Requireable<number>,
|
|
14
|
-
smiles: PropTypes.Requireable<string>,
|
|
15
|
-
|};
|
|
16
|
-
state: any;
|
|
17
|
-
UNSAFE_componentWillMount(): void;
|
|
18
|
-
componentDidMount(): void;
|
|
19
|
-
UNSAFE_componentWillReceiveProps(nextProps: any): void;
|
|
20
|
-
componentDidUpdate(): void;
|
|
21
|
-
stateFromSmiles: (arg1: any) => void;
|
|
22
|
-
setCanvasBounds: (arg1: any, arg2: any) => any;
|
|
23
|
-
canvasRender: () => void;
|
|
24
|
-
render(): React.Node;
|
|
25
|
-
}
|
|
26
|
-
declare class MoleculeWidget extends React.Component<any> {
|
|
27
|
-
static propTypes: {|
|
|
28
|
-
rotationAngle: PropTypes.Requireable<number>,
|
|
29
|
-
smiles: PropTypes.Requireable<string>,
|
|
30
|
-
widgetId: PropTypes.Requireable<string>,
|
|
31
|
-
|};
|
|
32
|
-
static defaultProps: any;
|
|
33
|
-
simpleValidate: (arg1: any) => any;
|
|
34
|
-
getUserInput: () => $ReadOnlyArray<$ReadOnlyArray<string>>;
|
|
35
|
-
validate: (arg1: any, arg2: any) => any;
|
|
36
|
-
render(): React.Node;
|
|
37
|
-
}
|
|
38
|
-
declare var _default: $ReadOnly<{|
|
|
39
|
-
name: string,
|
|
40
|
-
displayName: string,
|
|
41
|
-
getWidget?: (() => typeof MoleculeWidget) | void,
|
|
42
|
-
accessible?: boolean | ((props: any) => boolean) | void,
|
|
43
|
-
hidden?: boolean | void,
|
|
44
|
-
version?: $Flowgen$Import$_2e__2e__2f_types.Version | void,
|
|
45
|
-
supportedAlignments?: $ReadOnlyArray<$Flowgen$Import$_2e__2e__2f_types.Alignment> | void,
|
|
46
|
-
defaultAlignment?: $Flowgen$Import$_2e__2e__2f_types.Alignment | void,
|
|
47
|
-
getDefaultAlignment?:
|
|
48
|
-
| (() => $Flowgen$Import$_2e__2e__2f_types.Alignment)
|
|
49
|
-
| void,
|
|
50
|
-
isLintable?: boolean | void,
|
|
51
|
-
tracking?: $Flowgen$Import$_2e__2e__2f_types.Tracking | void,
|
|
52
|
-
traverseChildWidgets?: any,
|
|
53
|
-
transform?: $Flowgen$Import$_2e__2e__2f_types.WidgetTransform | void,
|
|
54
|
-
staticTransform?: $Flowgen$Import$_2e__2e__2f_types.WidgetTransform | void,
|
|
55
|
-
propUpgrades?: {
|
|
56
|
-
[key: string]: (arg1: any) => any,
|
|
57
|
-
} | void,
|
|
58
|
-
widget: typeof MoleculeWidget,
|
|
59
|
-
|}>;
|
|
60
|
-
declare export default typeof _default;
|