@khanacademy/perseus 19.1.4 → 19.1.6
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/dist/components/graphie.d.ts +9 -1
- package/dist/es/index.js +255 -122
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +261 -126
- package/dist/index.js.map +1 -1
- package/dist/interactive2/interactive-util.d.ts +1 -1
- package/dist/interactive2/movable-point-options.d.ts +5 -4
- package/dist/interactive2/movable.d.ts +90 -13
- package/dist/interactive2/types.d.ts +6 -0
- package/dist/util/graphie.d.ts +5 -0
- package/dist/widgets/expression.d.ts +4 -4
- package/package.json +11 -8
- package/.babelrc.js +0 -8
- package/.eslintrc.js +0 -12
- package/CHANGELOG.md +0 -1422
- package/src/__stories__/article-renderer.stories.tsx +0 -100
- package/src/__stories__/hints-renderer.stories.tsx +0 -55
- package/src/__stories__/server-item-renderer.stories.tsx +0 -44
- package/src/__testdata__/article-renderer.testdata.ts +0 -212
- package/src/__testdata__/graphie.testdata.ts +0 -51
- package/src/__testdata__/renderer.testdata.ts +0 -274
- package/src/__testdata__/server-item-renderer.testdata.ts +0 -171
- package/src/__tests__/__snapshots__/perseus-markdown.test.ts.snap +0 -507
- package/src/__tests__/__snapshots__/renderer.test.tsx.snap +0 -525
- package/src/__tests__/__snapshots__/server-item-renderer.test.tsx.snap +0 -285
- package/src/__tests__/a11y.test.ts +0 -303
- package/src/__tests__/article-renderer.test.tsx +0 -130
- package/src/__tests__/error-boundary.test.tsx +0 -76
- package/src/__tests__/extract-perseus-data.test.ts +0 -1027
- package/src/__tests__/init.test.ts +0 -10
- package/src/__tests__/jipt-paragraphs.test.ts +0 -32
- package/src/__tests__/mock-asset-loading-widget.tsx +0 -53
- package/src/__tests__/mock-widget.tsx +0 -33
- package/src/__tests__/perseus-markdown.test.ts +0 -764
- package/src/__tests__/renderability.test.ts +0 -480
- package/src/__tests__/renderer-api.test.tsx +0 -302
- package/src/__tests__/renderer.test.tsx +0 -1816
- package/src/__tests__/server-item-renderer.test.tsx +0 -582
- package/src/__tests__/test-items/image-item.ts +0 -24
- package/src/__tests__/test-items/input-number-1-item.ts +0 -26
- package/src/__tests__/test-items/input-number-2-item.ts +0 -38
- package/src/__tests__/test-items/table-item.ts +0 -29
- package/src/__tests__/tex-wrangler.test.ts +0 -82
- package/src/__tests__/util.test.ts +0 -40
- package/src/__tests__/widget-container.test.tsx +0 -126
- package/src/__tests__/widgets.test.ts +0 -91
- package/src/a11y.ts +0 -45
- package/src/all-widgets.ts +0 -9
- package/src/article-renderer.tsx +0 -237
- package/src/asset-context.ts +0 -30
- package/src/basic-widgets.ts +0 -16
- package/src/components/__stories__/button-group.stories.tsx +0 -55
- package/src/components/__stories__/fixed-to-responsive.stories.tsx +0 -141
- package/src/components/__stories__/graph.stories.tsx +0 -28
- package/src/components/__stories__/graphie.stories.tsx +0 -33
- package/src/components/__stories__/hud.stories.tsx +0 -35
- package/src/components/__stories__/icon.stories.tsx +0 -63
- package/src/components/__stories__/image-loader.stories.tsx +0 -63
- package/src/components/__stories__/info-tip.stories.tsx +0 -31
- package/src/components/__stories__/inline-icon.stories.tsx +0 -40
- package/src/components/__stories__/input-with-examples.stories.tsx +0 -53
- package/src/components/__stories__/lint.stories.tsx +0 -86
- package/src/components/__stories__/math-input.stories.tsx +0 -43
- package/src/components/__stories__/math-output.stories.tsx +0 -23
- package/src/components/__stories__/multi-button-group.stories.tsx +0 -66
- package/src/components/__stories__/number-input.stories.tsx +0 -41
- package/src/components/__stories__/prop-check-box.stories.tsx +0 -65
- package/src/components/__stories__/range-input.stories.tsx +0 -29
- package/src/components/__stories__/simple-keypad-input.stories.tsx +0 -27
- package/src/components/__stories__/sortable.stories.tsx +0 -77
- package/src/components/__stories__/stub-tag-editor.stories.tsx +0 -45
- package/src/components/__stories__/svg-image.stories.tsx +0 -74
- package/src/components/__stories__/tex.stories.tsx +0 -23
- package/src/components/__stories__/text-input.stories.tsx +0 -33
- package/src/components/__stories__/text-list-editor.stories.tsx +0 -32
- package/src/components/__stories__/tooltip.stories.tsx +0 -52
- package/src/components/__stories__/zoomable-tex.stories.tsx +0 -41
- package/src/components/__stories__/zoomable.stories.tsx +0 -49
- package/src/components/__testdata__/sorter.testdata.ts +0 -19
- package/src/components/__tests__/__snapshots__/sortable.test.tsx.snap +0 -163
- package/src/components/__tests__/__snapshots__/sorter.test.tsx.snap +0 -265
- package/src/components/__tests__/math-input.test.tsx +0 -147
- package/src/components/__tests__/number-input.test.tsx +0 -128
- package/src/components/__tests__/sortable.test.tsx +0 -269
- package/src/components/__tests__/sorter.test.tsx +0 -114
- package/src/components/__tests__/zoomable.test.tsx +0 -399
- package/src/components/button-group.tsx +0 -130
- package/src/components/constants.ts +0 -14
- package/src/components/fixed-to-responsive.tsx +0 -169
- package/src/components/graph.tsx +0 -444
- package/src/components/graphie-classes.ts +0 -153
- package/src/components/graphie-movables.ts +0 -338
- package/src/components/graphie.tsx +0 -392
- package/src/components/highlighting/highlightable-content.tsx +0 -240
- package/src/components/highlighting/highlights.ts +0 -207
- package/src/components/highlighting/ranges.ts +0 -304
- package/src/components/highlighting/types.ts +0 -73
- package/src/components/highlighting/ui/highlight-renderer.tsx +0 -172
- package/src/components/highlighting/ui/highlight-set-renderer.tsx +0 -185
- package/src/components/highlighting/ui/highlight-tooltip.tsx +0 -141
- package/src/components/highlighting/ui/highlighting-ui.tsx +0 -143
- package/src/components/highlighting/ui/selection-tracker.tsx +0 -186
- package/src/components/highlighting/ui/types.ts +0 -21
- package/src/components/highlighting/ui/util.ts +0 -165
- package/src/components/highlighting/word-indexer.tsx +0 -152
- package/src/components/hud.tsx +0 -167
- package/src/components/icon.tsx +0 -141
- package/src/components/image-loader.tsx +0 -177
- package/src/components/info-tip/info-tip.tsx +0 -144
- package/src/components/info-tip.tsx +0 -39
- package/src/components/inline-icon.tsx +0 -60
- package/src/components/input-with-examples.tsx +0 -249
- package/src/components/lint.tsx +0 -459
- package/src/components/math-input.tsx +0 -474
- package/src/components/math-output.tsx +0 -134
- package/src/components/multi-button-group.tsx +0 -135
- package/src/components/number-input.tsx +0 -249
- package/src/components/prop-check-box.tsx +0 -79
- package/src/components/range-input.tsx +0 -60
- package/src/components/simple-keypad-input.tsx +0 -88
- package/src/components/sortable.tsx +0 -958
- package/src/components/stub-tag-editor.tsx +0 -53
- package/src/components/svg-image.tsx +0 -779
- package/src/components/tex.tsx +0 -67
- package/src/components/text-input.tsx +0 -129
- package/src/components/text-list-editor.tsx +0 -166
- package/src/components/tooltip.tsx +0 -410
- package/src/components/visibility-observer/__stories__/visibility-observer.stories.tsx +0 -141
- package/src/components/visibility-observer/create-visibility-observer.ts +0 -108
- package/src/components/visibility-observer/get-scroll-parent.ts +0 -46
- package/src/components/visibility-observer/visibility-observer.tsx +0 -124
- package/src/components/zoomable-tex.tsx +0 -78
- package/src/components/zoomable.tsx +0 -304
- package/src/components.ts +0 -15
- package/src/definition-context.tsx +0 -59
- package/src/dependencies.ts +0 -40
- package/src/error-boundary.tsx +0 -70
- package/src/extra-widgets.ts +0 -75
- package/src/hint-renderer.tsx +0 -151
- package/src/hints-renderer.tsx +0 -372
- package/src/icon-paths.ts +0 -119
- package/src/index.ts +0 -171
- package/src/init.ts +0 -56
- package/src/interaction-tracker.ts +0 -62
- package/src/interactive2/__tests__/movable-mock.ts +0 -43
- package/src/interactive2/__tests__/movable-point.test.ts +0 -144
- package/src/interactive2/__tests__/movable.test.ts +0 -157
- package/src/interactive2/interactive-util.test.ts +0 -93
- package/src/interactive2/interactive-util.ts +0 -159
- package/src/interactive2/movable-helper-methods.ts +0 -166
- package/src/interactive2/movable-line-options.ts +0 -419
- package/src/interactive2/movable-line.ts +0 -307
- package/src/interactive2/movable-point-options.ts +0 -212
- package/src/interactive2/movable-point.tsx +0 -585
- package/src/interactive2/movable-polygon-options.ts +0 -389
- package/src/interactive2/movable-polygon.ts +0 -360
- package/src/interactive2/movable.ts +0 -279
- package/src/interactive2/objective_.ts +0 -79
- package/src/interactive2/types.ts +0 -2
- package/src/interactive2/wrapped-defaults.ts +0 -87
- package/src/interactive2/wrapped-ellipse.ts +0 -94
- package/src/interactive2/wrapped-line.ts +0 -116
- package/src/interactive2/wrapped-path.ts +0 -51
- package/src/interactive2.ts +0 -70
- package/src/item-version.ts +0 -10
- package/src/jipt-paragraphs.ts +0 -49
- package/src/jquery.mobile.vmouse.js +0 -545
- package/src/loading-context.ts +0 -21
- package/src/logging/log.test.ts +0 -39
- package/src/logging/log.ts +0 -97
- package/src/mixins/__tests__/widget-prop-denylist.test.ts +0 -21
- package/src/mixins/changeable.ts +0 -133
- package/src/mixins/editor-jsonify.ts +0 -13
- package/src/mixins/widget-jsonify-deprecated.ts +0 -23
- package/src/mixins/widget-prop-denylist.ts +0 -48
- package/src/multi-items/__stories__/multi-renderer.stories.tsx +0 -83
- package/src/multi-items/__testdata__/multi-renderer.testdata.ts +0 -172
- package/src/multi-items/__tests__/__snapshots__/multi-renderer.test.tsx.snap +0 -1164
- package/src/multi-items/__tests__/items.test.ts +0 -240
- package/src/multi-items/__tests__/multi-renderer.test.tsx +0 -914
- package/src/multi-items/__tests__/prop-type-builders.test.ts +0 -133
- package/src/multi-items/__tests__/shapes.test.ts +0 -43
- package/src/multi-items/__tests__/trees.test.ts +0 -317
- package/src/multi-items/item-types.ts +0 -56
- package/src/multi-items/items.ts +0 -176
- package/src/multi-items/multi-renderer.tsx +0 -569
- package/src/multi-items/prop-type-builders.ts +0 -106
- package/src/multi-items/shape-types.ts +0 -52
- package/src/multi-items/shapes.ts +0 -52
- package/src/multi-items/tree-types.ts +0 -47
- package/src/multi-items/trees.ts +0 -360
- package/src/multi-items.ts +0 -75
- package/src/perseus-api.tsx +0 -188
- package/src/perseus-env.ts +0 -27
- package/src/perseus-error.ts +0 -17
- package/src/perseus-markdown.tsx +0 -405
- package/src/perseus-types.ts +0 -1366
- package/src/perseus-version.ts +0 -9
- package/src/question-paragraph.tsx +0 -34
- package/src/renderability.ts +0 -109
- package/src/renderer.tsx +0 -2000
- package/src/server-item-renderer.tsx +0 -495
- package/src/sigfigs.ts +0 -490
- package/src/styles/articles.less +0 -749
- package/src/styles/constants.ts +0 -94
- package/src/styles/global-constants.ts +0 -343
- package/src/styles/global-styles.ts +0 -306
- package/src/styles/khan-exercise.css +0 -1468
- package/src/styles/media-queries.ts +0 -47
- package/src/styles/perseus-renderer.less +0 -732
- package/src/styles/shared.ts +0 -130
- package/src/styles/util.less +0 -47
- package/src/styles/variables.boostrap.less +0 -277
- package/src/styles/variables.less +0 -56
- package/src/styles/variables.shared.less +0 -340
- package/src/styles/widgets/categorizer.less +0 -38
- package/src/styles/widgets/dropdown.less +0 -3
- package/src/styles/widgets/expression.less +0 -65
- package/src/styles/widgets/graded-group.less +0 -36
- package/src/styles/widgets/grapher.less +0 -12
- package/src/styles/widgets/group.less +0 -19
- package/src/styles/widgets/image.less +0 -54
- package/src/styles/widgets/interactive-graph.less +0 -64
- package/src/styles/widgets/label-image.less +0 -57
- package/src/styles/widgets/matcher.less +0 -8
- package/src/styles/widgets/matrix.less +0 -126
- package/src/styles/widgets/measurer.less +0 -20
- package/src/styles/widgets/orderer.less +0 -98
- package/src/styles/widgets/passage.less +0 -154
- package/src/styles/widgets/plotter.less +0 -31
- package/src/styles/widgets/radio.less +0 -58
- package/src/styles/widgets/reaction-diagram.less +0 -35
- package/src/styles/widgets/sequence.less +0 -5
- package/src/styles/widgets/sortable.less +0 -113
- package/src/styles/widgets/table.less +0 -57
- package/src/styles/widgets/unit.less +0 -15
- package/src/tex-wrangler.ts +0 -182
- package/src/translation-linter.ts +0 -126
- package/src/traversal.ts +0 -138
- package/src/types.ts +0 -513
- package/src/util/a11y.ts +0 -23
- package/src/util/answer-types.test.ts +0 -114
- package/src/util/answer-types.ts +0 -876
- package/src/util/colors.ts +0 -93
- package/src/util/drawing-transform.test.ts +0 -67
- package/src/util/drawing-transform.ts +0 -102
- package/src/util/extract-perseus-data.ts +0 -539
- package/src/util/fix-passage-refs.ts +0 -121
- package/src/util/geometry.test.ts +0 -75
- package/src/util/geometry.ts +0 -312
- package/src/util/graph-bounds.ts +0 -23
- package/src/util/graph-utils.ts +0 -15
- package/src/util/graphie.test.ts +0 -1277
- package/src/util/graphie.ts +0 -1566
- package/src/util/interactive.ts +0 -4172
- package/src/util/interval.ts +0 -4
- package/src/util/katex-preprocess.ts +0 -14
- package/src/util/math.test.ts +0 -11
- package/src/util/math.ts +0 -294
- package/src/util/mobile-native-utils.test.ts +0 -22
- package/src/util/mobile-native-utils.ts +0 -12
- package/src/util/parse-perseus-json.test.ts +0 -10
- package/src/util/parse-perseus-json.ts +0 -13
- package/src/util/react-render.tsx +0 -27
- package/src/util/register-all-widgets-for-testing.ts +0 -13
- package/src/util/scroll-utils.ts +0 -155
- package/src/util/sizing-utils.ts +0 -46
- package/src/util/tex.ts +0 -73
- package/src/util/url-utils.ts +0 -34
- package/src/util.graphie.test.ts +0 -45
- package/src/util.graphie.ts +0 -59
- package/src/util.ts +0 -966
- package/src/version.ts +0 -10
- package/src/widget-container.tsx +0 -199
- package/src/widgets/__stories__/categorizer.stories.tsx +0 -14
- package/src/widgets/__stories__/cs-program.stories.tsx +0 -14
- package/src/widgets/__stories__/definition.stories.tsx +0 -114
- package/src/widgets/__stories__/dropdown.stories.tsx +0 -14
- package/src/widgets/__stories__/explanation.stories.tsx +0 -18
- package/src/widgets/__stories__/expression.stories.tsx +0 -145
- package/src/widgets/__stories__/graded-group-set.stories.tsx +0 -31
- package/src/widgets/__stories__/graded-group.stories.tsx +0 -31
- package/src/widgets/__stories__/grapher.stories.tsx +0 -46
- package/src/widgets/__stories__/group.stories.tsx +0 -14
- package/src/widgets/__stories__/iframe.stories.tsx +0 -14
- package/src/widgets/__stories__/image.stories.tsx +0 -85
- package/src/widgets/__stories__/input-number.stories.tsx +0 -101
- package/src/widgets/__stories__/interaction.stories.tsx +0 -14
- package/src/widgets/__stories__/interactive-graph.stories.tsx +0 -60
- package/src/widgets/__stories__/label-image.stories.tsx +0 -130
- package/src/widgets/__stories__/matcher.stories.tsx +0 -14
- package/src/widgets/__stories__/matrix.stories.tsx +0 -14
- package/src/widgets/__stories__/number-line.stories.tsx +0 -14
- package/src/widgets/__stories__/numeric-input.stories.tsx +0 -105
- package/src/widgets/__stories__/orderer.stories.tsx +0 -18
- package/src/widgets/__stories__/passage-ref.stories.tsx +0 -33
- package/src/widgets/__stories__/passage.stories.tsx +0 -39
- package/src/widgets/__stories__/plotter.stories.tsx +0 -27
- package/src/widgets/__stories__/radio.stories.tsx +0 -86
- package/src/widgets/__stories__/random-widgets.stories.tsx +0 -59
- package/src/widgets/__stories__/sorter.stories.tsx +0 -14
- package/src/widgets/__stories__/test-keypad-context-wrapper.tsx +0 -66
- package/src/widgets/__stories__/unit.stories.tsx +0 -28
- package/src/widgets/__stories__/video-transcript-link.stories.tsx +0 -23
- package/src/widgets/__stories__/video.stories.tsx +0 -22
- package/src/widgets/__testdata__/base-radio.testdata.ts +0 -21
- package/src/widgets/__testdata__/categorizer.testdata.ts +0 -89
- package/src/widgets/__testdata__/cs-program.testdata.ts +0 -27
- package/src/widgets/__testdata__/dropdown.testdata.ts +0 -71
- package/src/widgets/__testdata__/explanation.testdata.ts +0 -85
- package/src/widgets/__testdata__/expression.testdata.ts +0 -198
- package/src/widgets/__testdata__/graded-group-set.testdata.ts +0 -356
- package/src/widgets/__testdata__/graded-group.testdata.ts +0 -77
- package/src/widgets/__testdata__/grapher.testdata.ts +0 -374
- package/src/widgets/__testdata__/group.testdata.ts +0 -153
- package/src/widgets/__testdata__/iframe.testdata.ts +0 -35
- package/src/widgets/__testdata__/image.testdata.ts +0 -36
- package/src/widgets/__testdata__/input-number.testdata.ts +0 -72
- package/src/widgets/__testdata__/interaction.testdata.ts +0 -262
- package/src/widgets/__testdata__/interactive-graph-random.testdata.ts +0 -269
- package/src/widgets/__testdata__/interactive-graph.testdata.ts +0 -644
- package/src/widgets/__testdata__/label-image.testdata.ts +0 -308
- package/src/widgets/__testdata__/matcher.testdata.ts +0 -33
- package/src/widgets/__testdata__/matrix.testdata.ts +0 -28
- package/src/widgets/__testdata__/number-line.testdata.ts +0 -30
- package/src/widgets/__testdata__/numeric-input.testdata.ts +0 -265
- package/src/widgets/__testdata__/orderer.testdata.ts +0 -123
- package/src/widgets/__testdata__/passage-ref.testdata.ts +0 -101
- package/src/widgets/__testdata__/passage.testdata.ts +0 -95
- package/src/widgets/__testdata__/plotter.testdata.ts +0 -36
- package/src/widgets/__testdata__/radio.testdata.ts +0 -324
- package/src/widgets/__testdata__/randomizers.ts +0 -51
- package/src/widgets/__testdata__/sorter.testdata.ts +0 -19
- package/src/widgets/__testdata__/video.testdata.ts +0 -61
- package/src/widgets/__tests__/__snapshots__/categorizer.test.ts.snap +0 -940
- package/src/widgets/__tests__/__snapshots__/cs-program.test.ts.snap +0 -67
- package/src/widgets/__tests__/__snapshots__/definition.test.ts.snap +0 -97
- package/src/widgets/__tests__/__snapshots__/dropdown.test.ts.snap +0 -133
- package/src/widgets/__tests__/__snapshots__/explanation.test.ts.snap +0 -425
- package/src/widgets/__tests__/__snapshots__/graded-group-set-jipt.test.ts.snap +0 -729
- package/src/widgets/__tests__/__snapshots__/graded-group-set.test.ts.snap +0 -339
- package/src/widgets/__tests__/__snapshots__/graded-group.test.ts.snap +0 -801
- package/src/widgets/__tests__/__snapshots__/grapher.test.ts.snap +0 -2673
- package/src/widgets/__tests__/__snapshots__/group.test.tsx.snap +0 -1211
- package/src/widgets/__tests__/__snapshots__/iframe.test.ts.snap +0 -61
- package/src/widgets/__tests__/__snapshots__/image.test.ts.snap +0 -378
- package/src/widgets/__tests__/__snapshots__/input-number.test.ts.snap +0 -495
- package/src/widgets/__tests__/__snapshots__/interaction.test.ts.snap +0 -292
- package/src/widgets/__tests__/__snapshots__/interactive-graph.test.ts.snap +0 -2889
- package/src/widgets/__tests__/__snapshots__/matcher.test.tsx.snap +0 -883
- package/src/widgets/__tests__/__snapshots__/matrix.test.ts.snap +0 -514
- package/src/widgets/__tests__/__snapshots__/number-line.test.ts.snap +0 -814
- package/src/widgets/__tests__/__snapshots__/numeric-input.test.ts.snap +0 -470
- package/src/widgets/__tests__/__snapshots__/orderer.test.ts.snap +0 -243
- package/src/widgets/__tests__/__snapshots__/passage-ref.test.ts.snap +0 -434
- package/src/widgets/__tests__/__snapshots__/passage.test.tsx.snap +0 -1956
- package/src/widgets/__tests__/__snapshots__/plotter.test.tsx.snap +0 -827
- package/src/widgets/__tests__/__snapshots__/radio.test.ts.snap +0 -4237
- package/src/widgets/__tests__/__snapshots__/unit.test.tsx.snap +0 -20
- package/src/widgets/__tests__/__snapshots__/video.test.ts.snap +0 -153
- package/src/widgets/__tests__/categorizer.test.ts +0 -203
- package/src/widgets/__tests__/cs-program.test.ts +0 -43
- package/src/widgets/__tests__/definition.test.ts +0 -136
- package/src/widgets/__tests__/dropdown.test.ts +0 -105
- package/src/widgets/__tests__/explanation.test.ts +0 -198
- package/src/widgets/__tests__/expression-mobile.test.tsx +0 -363
- package/src/widgets/__tests__/expression.test.tsx +0 -484
- package/src/widgets/__tests__/graded-group-set-jipt.test.ts +0 -30
- package/src/widgets/__tests__/graded-group-set.test.ts +0 -288
- package/src/widgets/__tests__/graded-group.test.ts +0 -232
- package/src/widgets/__tests__/grapher.cypress.ts +0 -576
- package/src/widgets/__tests__/grapher.test.ts +0 -33
- package/src/widgets/__tests__/group.test.tsx +0 -510
- package/src/widgets/__tests__/iframe.test.ts +0 -45
- package/src/widgets/__tests__/image.test.ts +0 -62
- package/src/widgets/__tests__/input-number.test.ts +0 -354
- package/src/widgets/__tests__/interaction.test.ts +0 -31
- package/src/widgets/__tests__/interactive-graph.cypress.ts +0 -815
- package/src/widgets/__tests__/interactive-graph.test.ts +0 -106
- package/src/widgets/__tests__/matcher.test.tsx +0 -176
- package/src/widgets/__tests__/matrix.test.ts +0 -82
- package/src/widgets/__tests__/number-line.test.ts +0 -79
- package/src/widgets/__tests__/numeric-input.test.ts +0 -575
- package/src/widgets/__tests__/orderer.test.ts +0 -73
- package/src/widgets/__tests__/passage-ref.test.ts +0 -168
- package/src/widgets/__tests__/passage.test.tsx +0 -224
- package/src/widgets/__tests__/plotter.test.tsx +0 -69
- package/src/widgets/__tests__/radio/base-radio.test.tsx +0 -470
- package/src/widgets/__tests__/radio/choice-icon.test.tsx +0 -90
- package/src/widgets/__tests__/radio/choice.test.tsx +0 -310
- package/src/widgets/__tests__/radio/focus-ring.test.tsx +0 -22
- package/src/widgets/__tests__/radio/option-status.test.tsx +0 -77
- package/src/widgets/__tests__/radio.test.ts +0 -807
- package/src/widgets/__tests__/randomizers.test.ts +0 -53
- package/src/widgets/__tests__/renderQuestion.tsx +0 -101
- package/src/widgets/__tests__/unit.test.tsx +0 -168
- package/src/widgets/__tests__/video.test.ts +0 -69
- package/src/widgets/categorizer.tsx +0 -344
- package/src/widgets/cs-program.tsx +0 -227
- package/src/widgets/definition.tsx +0 -121
- package/src/widgets/deprecated-standin/__stories__/deprecated-standin.stories.tsx +0 -30
- package/src/widgets/deprecated-standin/__tests__/__snapshots__/deprecated-standin.test.ts.snap +0 -70
- package/src/widgets/deprecated-standin/__tests__/deprecated-standin.test.ts +0 -93
- package/src/widgets/deprecated-standin/index.tsx +0 -58
- package/src/widgets/dropdown.tsx +0 -142
- package/src/widgets/explanation.tsx +0 -317
- package/src/widgets/expression.tsx +0 -707
- package/src/widgets/graded-group-answer-bar.tsx +0 -142
- package/src/widgets/graded-group-set.tsx +0 -338
- package/src/widgets/graded-group.tsx +0 -471
- package/src/widgets/grapher/util.tsx +0 -799
- package/src/widgets/grapher.tsx +0 -660
- package/src/widgets/group.tsx +0 -195
- package/src/widgets/iframe.tsx +0 -195
- package/src/widgets/image.tsx +0 -312
- package/src/widgets/input-number.tsx +0 -412
- package/src/widgets/interaction/arrow-picker.tsx +0 -38
- package/src/widgets/interaction/color-picker.tsx +0 -69
- package/src/widgets/interaction/dash-picker.tsx +0 -45
- package/src/widgets/interaction/element-container.tsx +0 -100
- package/src/widgets/interaction.tsx +0 -826
- package/src/widgets/interactive-graph.tsx +0 -2597
- package/src/widgets/label-image/__stories__/answer-choices.stories.tsx +0 -91
- package/src/widgets/label-image/__stories__/answer-pill.stories.tsx +0 -62
- package/src/widgets/label-image/__stories__/marker.stories.tsx +0 -171
- package/src/widgets/label-image/__tests__/answer-pill.test.tsx +0 -75
- package/src/widgets/label-image/__tests__/hide-answers-toggle.test.tsx +0 -39
- package/src/widgets/label-image/answer-choices.tsx +0 -88
- package/src/widgets/label-image/answer-pill.tsx +0 -103
- package/src/widgets/label-image/hide-answers-toggle.tsx +0 -40
- package/src/widgets/label-image/marker.tsx +0 -268
- package/src/widgets/label-image/strings.ts +0 -5
- package/src/widgets/label-image/types.ts +0 -27
- package/src/widgets/label-image.test.ts +0 -928
- package/src/widgets/label-image.tsx +0 -819
- package/src/widgets/lights-puzzle.tsx +0 -359
- package/src/widgets/matcher.tsx +0 -298
- package/src/widgets/matrix.tsx +0 -634
- package/src/widgets/measurer.tsx +0 -222
- package/src/widgets/molecule/__tests__/layout.test.ts +0 -162
- package/src/widgets/molecule/__tests__/parser.test.ts +0 -155
- package/src/widgets/molecule/molecule-drawing.ts +0 -173
- package/src/widgets/molecule/molecule-layout.ts +0 -362
- package/src/widgets/molecule/smiles-parser.ts +0 -296
- package/src/widgets/molecule.tsx +0 -172
- package/src/widgets/number-line.tsx +0 -862
- package/src/widgets/numeric-input.tsx +0 -576
- package/src/widgets/orderer.tsx +0 -786
- package/src/widgets/passage/__tests__/passage-markdown.test.ts +0 -376
- package/src/widgets/passage/passage-markdown.tsx +0 -475
- package/src/widgets/passage-ref-target.tsx +0 -76
- package/src/widgets/passage-ref.tsx +0 -213
- package/src/widgets/passage.tsx +0 -582
- package/src/widgets/plotter.tsx +0 -1194
- package/src/widgets/radio/__stories__/base-radio.stories.tsx +0 -196
- package/src/widgets/radio/__stories__/choice-icon.stories.tsx +0 -166
- package/src/widgets/radio/__stories__/choice-none-above.stories.tsx +0 -40
- package/src/widgets/radio/__stories__/choice.stories.tsx +0 -137
- package/src/widgets/radio/__stories__/focus-ring.stories.tsx +0 -43
- package/src/widgets/radio/__stories__/option-status.stories.tsx +0 -103
- package/src/widgets/radio/base-radio.tsx +0 -511
- package/src/widgets/radio/choice-a11y-text.ts +0 -61
- package/src/widgets/radio/choice-icon/choice-icon.tsx +0 -218
- package/src/widgets/radio/choice-icon/cross-out-line.tsx +0 -51
- package/src/widgets/radio/choice-icon/shared-styles.ts +0 -15
- package/src/widgets/radio/choice-none-above.tsx +0 -56
- package/src/widgets/radio/choice.jsx.fixture.ts +0 -45
- package/src/widgets/radio/choice.tsx +0 -359
- package/src/widgets/radio/focus-ring.tsx +0 -57
- package/src/widgets/radio/option-status.tsx +0 -98
- package/src/widgets/radio/util.test.ts +0 -18
- package/src/widgets/radio/util.ts +0 -31
- package/src/widgets/radio/widget.tsx +0 -520
- package/src/widgets/radio.ts +0 -157
- package/src/widgets/reaction-diagram.tsx +0 -144
- package/src/widgets/sequence.tsx +0 -142
- package/src/widgets/simulator.tsx +0 -829
- package/src/widgets/sorter.tsx +0 -155
- package/src/widgets/table.tsx +0 -393
- package/src/widgets/unit.tsx +0 -374
- package/src/widgets/video-transcript-link.test.tsx +0 -213
- package/src/widgets/video-transcript-link.tsx +0 -84
- package/src/widgets/video.tsx +0 -135
- package/src/widgets.ts +0 -489
- package/src/zoom.ts +0 -555
- package/tsconfig-build.json +0 -26
- package/tsconfig-build.tsbuildinfo +0 -1
package/src/icon-paths.ts
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Icon paths to be used with `inline-icon.jsx`.
|
|
3
|
-
*
|
|
4
|
-
* These paths are taken directly from webapp's `icon-paths.js`. Unlike the
|
|
5
|
-
* webapp equivalent, these can be directly required within Perseus files since
|
|
6
|
-
* this is all bundled together anyway.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
export const iconCheck = {
|
|
10
|
-
path: `M8.70710678,12.2928932 C8.31658249,11.9023689 7.68341751,11.9023689 7.29289322,12.2928932 C6.90236893,12.6834175 6.90236893,13.3165825 7.29289322,13.7071068 L9.82842712,16.2426407 C10.2207367,16.6349502 10.8574274,16.6328935 11.2471942,16.2380576 L16.7116603,10.7025237 C17.0996535,10.3094846 17.0955629,9.67633279 16.7025237,9.28833966 C16.3094846,8.90034653 15.6763328,8.90443714 15.2883397,9.29747629 L10.5309507,14.1167372 L8.70710678,12.2928932 Z`,
|
|
11
|
-
width: 24,
|
|
12
|
-
height: 24,
|
|
13
|
-
} as const;
|
|
14
|
-
export const iconCheckMedium = {
|
|
15
|
-
path: "M6.072 10.4l6.175-7.058a1 1 0 1 1 1.506 1.317L6.769 12.64a1 1 0 0 1-1.55-.054L2.203 8.604a1 1 0 1 1 1.594-1.208L6.072 10.4z",
|
|
16
|
-
width: 16,
|
|
17
|
-
height: 16,
|
|
18
|
-
} as const;
|
|
19
|
-
export const iconChevronDown = {
|
|
20
|
-
path: "M99.669 13.048q0 3.36-2.352 5.712l-41.664 41.664q-2.408 2.408-5.88 2.408t-5.712-2.408l-41.664-41.664q-2.408-2.24-2.408-5.712t2.408-5.88l4.76-4.816q2.52-2.352 5.88-2.352t5.656 2.352l31.136 31.136 31.08-31.136q2.352-2.352 5.712-2.352t5.88 2.352l4.816 4.816q2.352 2.52 2.352 5.88z",
|
|
21
|
-
width: 100,
|
|
22
|
-
height: 63.034,
|
|
23
|
-
} as const;
|
|
24
|
-
export const iconChevronRight = {
|
|
25
|
-
path: "M62.808 49.728q0 3.36-2.352 5.88l-41.72 41.664q-2.352 2.408-5.768 2.408t-5.768-2.408l-4.872-4.76q-2.352-2.52-2.352-5.88t2.352-5.712l31.08-31.136-31.08-31.024q-2.352-2.52-2.352-5.88t2.352-5.712l4.872-4.76q2.296-2.408 5.768-2.408t5.768 2.408l41.72 41.664q2.352 2.296 2.352 5.656z",
|
|
26
|
-
width: 63.034,
|
|
27
|
-
height: 100,
|
|
28
|
-
} as const;
|
|
29
|
-
export const iconCircle = {
|
|
30
|
-
path: "M100.035 50.046q.057 13.623-6.669 25.137t-18.24 18.183-25.08 6.669-25.137-6.726q-11.514-6.726-18.183-18.183-6.726-11.571-6.726-25.137t6.726-25.08 18.24-18.24 25.08-6.669q13.566 0 25.08 6.726 11.514 6.669 18.24 18.183t6.669 25.137z",
|
|
31
|
-
width: 100,
|
|
32
|
-
height: 100,
|
|
33
|
-
} as const;
|
|
34
|
-
export const iconCircleArrowDown = {
|
|
35
|
-
path: "M50.046 83.676q1.767 0 2.907-1.14l29.526-29.526q1.197-1.197 1.197-2.907t-1.197-2.964l-5.928-5.928q-1.197-1.14-2.964-1.14t-2.907 1.14l-12.312 12.312l0-32.661q0-1.71-1.254-2.964t-2.907-1.254l-8.322 0q-1.71 0-2.964 1.254t-1.254 2.964l0 32.661l-12.312-12.312q-1.197-1.254-2.907-1.254t-2.907 1.254l-5.928 5.928q-1.197 1.197-1.197 2.964t1.197 2.907l29.469 29.526q1.197 1.14 2.964 1.14zm49.989-33.63q.057 13.623-6.669 25.137t-18.24 18.183-25.08 6.669-25.137-6.726q-11.514-6.726-18.183-18.183-6.726-11.571-6.726-25.137t6.726-25.08 18.24-18.24 25.08-6.669q13.566 0 25.08 6.726 11.514 6.669 18.24 18.183t6.669 25.137z",
|
|
36
|
-
width: 100,
|
|
37
|
-
height: 100,
|
|
38
|
-
} as const;
|
|
39
|
-
export const iconCircleArrowUp = {
|
|
40
|
-
path: "M54.207 83.391q1.653 0 2.907-1.254t1.254-2.907l0-32.718l12.312 12.312q1.254 1.254 2.964 1.254t2.907-1.254l5.928-5.928q1.197-1.197 1.14-2.964 0-1.767-1.14-2.907l-29.526-29.526q-1.197-1.14-2.907-1.14t-2.964 1.14l-29.469 29.526q-1.197 1.254-1.197 2.964t1.197 2.907l5.928 5.928q1.197 1.197 2.907 1.197t2.907-1.197l12.312-12.312l0 32.718q0 1.653 1.254 2.907t2.964 1.254l8.322 0zm45.828-33.345q.057 13.623-6.669 25.137t-18.24 18.183-25.08 6.669-25.137-6.726q-11.514-6.726-18.183-18.183-6.726-11.571-6.726-25.137t6.726-25.08 18.24-18.24 25.08-6.669q13.566 0 25.08 6.726 11.514 6.669 18.24 18.183t6.669 25.137z",
|
|
41
|
-
width: 100,
|
|
42
|
-
height: 100,
|
|
43
|
-
} as const;
|
|
44
|
-
export const iconCircleThin = {
|
|
45
|
-
path: "M50.046 8.322q-8.493 0-16.188 3.306-15.561 6.669-22.173 22.23-3.363 7.695-3.363 16.188t3.306 16.188 8.949 13.281q5.586 5.586 13.281 8.892t16.188 3.306 16.188-3.306 13.281-8.892 8.892-13.281 3.306-16.188-3.306-16.188-8.892-13.281-13.281-8.949q-7.695-3.306-16.188-3.306zm0 91.713q-13.623 0-25.137-6.726t-18.183-18.183q-6.726-11.571-6.726-25.137t6.726-25.08 18.24-18.24 25.08-6.669q13.566 0 25.08 6.726 11.514 6.669 18.24 18.183t6.726 25.137-6.726 25.137-18.24 18.126q-11.514 6.726-25.08 6.726z",
|
|
46
|
-
width: 100,
|
|
47
|
-
height: 99.944,
|
|
48
|
-
} as const;
|
|
49
|
-
export const iconDesktop = {
|
|
50
|
-
path: "M94.208 52.119l0-43.746q0-.69-.506-1.15t-1.196-.506l-84.088 0q-.69 0-1.196.506t-.506 1.15l0 43.746q0 .69.506 1.196t1.196.506l84.088 0q.69 0 1.196-.506t.506-1.196zm6.716-43.746l0 57.224q0 3.45-2.484 5.934t-5.934 2.484l-28.566 0q0 3.128 2.53 7.774.828 1.61.828 2.622t-1.012 2.07q-1.012 1.012-2.346.966l-26.91 0q-1.38 0-2.392-1.012t-1.012-2.024q0-1.058 1.656-4.14t1.748-6.256l-28.612 0q-3.45 0-5.934-2.484t-2.484-5.934l0-57.224q0-3.45 2.484-5.934t5.934-2.438l84.088 0q3.45 0 5.98 2.438 2.438 2.484 2.438 5.934z",
|
|
51
|
-
width: 100,
|
|
52
|
-
height: 86.648,
|
|
53
|
-
} as const;
|
|
54
|
-
export const iconDropdownArrow = {
|
|
55
|
-
path: "M9 9.8c0 .5.7 1.7 1.5 2.8 1.5 1.9 1.5 1.9 3 0C15.7 9.7 15.4 9 12 9c-1.6 0-3 .4-3 .8z",
|
|
56
|
-
width: 24,
|
|
57
|
-
height: 24,
|
|
58
|
-
} as const;
|
|
59
|
-
export const iconExclamationSign = {
|
|
60
|
-
path: "M58.368 81.225l0-12.369q0-.912-.57-1.539t-1.425-.627l-12.54 0q-.855-.057-1.482.627t-.684 1.539l0 12.369q-.057.855.627 1.482t1.539.684l12.54 0q.855 0 1.425-.627t.57-1.539zm1.026-62.871q0-1.596-2.223-1.71l-14.307 0q-2.109 0-2.223 1.71l1.14 40.47q0 .627.627 1.14t1.539.456l12.084 0q.912-.057 1.539-.513t.684-1.083zm-9.348-18.354q13.566 0 25.08 6.726 11.514 6.669 18.24 18.183t6.726 25.137-6.726 25.137-18.24 18.183-25.08 6.669-25.137-6.726q-11.514-6.726-18.183-18.183-6.726-11.571-6.726-25.137t6.726-25.08 18.24-18.24 25.08-6.669z",
|
|
61
|
-
width: 100,
|
|
62
|
-
height: 99.944,
|
|
63
|
-
} as const;
|
|
64
|
-
// Grabbed from https://github.com/encharm/Font-Awesome-SVG-PNG
|
|
65
|
-
export const iconGear = {
|
|
66
|
-
path: "M1152 896q0-106-75-181t-181-75-181 75-75 181 75 181 181 75 181-75 75-181zm512-109v222q0 12-8 23t-20 13l-185 28q-19 54-39 91 35 50 107 138 10 12 10 25t-9 23q-27 37-99 108t-94 71q-12 0-26-9l-138-108q-44 23-91 38-16 136-29 186-7 28-36 28h-222q-14 0-24.5-8.5t-11.5-21.5l-28-184q-49-16-90-37l-141 107q-10 9-25 9-14 0-25-11-126-114-165-168-7-10-7-23 0-12 8-23 15-21 51-66.5t54-70.5q-27-50-41-99l-183-27q-13-2-21-12.5t-8-23.5v-222q0-12 8-23t19-13l186-28q14-46 39-92-40-57-107-138-10-12-10-24 0-10 9-23 26-36 98.5-107.5t94.5-71.5q13 0 26 10l138 107q44-23 91-38 16-136 29-186 7-28 36-28h222q14 0 24.5 8.5t11.5 21.5l28 184q49 16 90 37l142-107q9-9 24-9 13 0 25 10 129 119 165 170 7 8 7 22 0 12-8 23-15 21-51 66.5t-54 70.5q26 50 41 98l183 28q13 2 21 12.5t8 23.5z",
|
|
67
|
-
width: 1792,
|
|
68
|
-
height: 1792,
|
|
69
|
-
} as const;
|
|
70
|
-
export const iconMobilePhone = {
|
|
71
|
-
path: "M36.04 89.557q0-2.584-1.836-4.42t-4.42-1.836-4.352 1.836q-1.836 1.836-1.836 4.42t1.836 4.352 4.42 1.836q2.652-.068 4.42-1.836t1.768-4.352zm16.184-12.444l0-54.74q0-1.088-.748-1.768t-1.768-.68l-39.78 0q-1.088 0-1.768.748t-.68 1.7l0 54.74q0 1.02.748 1.768t1.7.68l39.78 0q1.02-.068 1.768-.748t.748-1.7zm-14.892-65.892q0-1.224-1.292-1.292l-12.444 0q-1.224.068-1.224 1.292t1.224 1.224l12.444 0q1.292 0 1.292-1.224zm22.372-1.292l0 79.628q0 3.944-2.992 6.936t-7.004 2.992l-39.78 0q-4.012 0-7.004-2.924-2.924-2.924-2.924-7.004l0-79.628q0-4.012 2.924-6.936t7.004-2.992l39.78 0q4.012-.068 7.004 2.924t2.992 7.004z",
|
|
72
|
-
width: 60.013,
|
|
73
|
-
height: 100,
|
|
74
|
-
} as const;
|
|
75
|
-
export const iconOk = {
|
|
76
|
-
path: "M37.964 76.048q-2.576 0-4.368-1.792l-31.864-31.864q-1.792-1.792-1.792-4.368t1.792-4.368l8.736-8.68q1.792-1.792 4.368-1.792t4.312 1.792l18.816 18.872 42-42.056q1.792-1.792 4.368-1.792t4.312 1.792l8.736 8.736q1.792 1.792 1.792 4.368t-1.792 4.312l-55.048 55.048q-1.792 1.792-4.368 1.792z",
|
|
77
|
-
width: 100,
|
|
78
|
-
height: 76.637,
|
|
79
|
-
} as const;
|
|
80
|
-
export const iconPlus = {
|
|
81
|
-
path: "M99.758 43.09l0 13.578q0 2.852-1.984 4.836t-4.836 1.984l-29.45 0l0 29.45q0 2.852-1.984 4.836t-4.836 1.984l-13.578 0q-2.852 0-4.836-1.984t-1.984-4.836l0-29.45l-29.45 0q-2.852 0-4.836-1.984t-1.984-4.836l0-13.578q0-2.852 1.984-4.836t4.836-1.984l29.45 0l0-29.45q0-2.852 1.984-4.836t4.836-1.984l13.578 0q2.852 0 4.836 1.984t1.984 4.836l0 29.45l29.45 0q2.852 0 4.836 1.984t1.984 4.836z",
|
|
82
|
-
width: 100,
|
|
83
|
-
height: 100,
|
|
84
|
-
} as const;
|
|
85
|
-
export const iconRemove = {
|
|
86
|
-
path: "M100.464 80.808q0 3.404-2.368 5.772l-11.47 11.544q-2.368 2.368-5.772 2.368t-5.698-2.368l-24.864-24.864-24.864 24.864q-2.368 2.368-5.772 2.368t-5.772-2.368l-11.47-11.544q-2.368-2.368-2.368-5.772t2.368-5.698l24.864-24.864-24.864-24.864q-2.368-2.368-2.368-5.772t2.368-5.772l11.47-11.47q2.368-2.368 5.772-2.368t5.772 2.368l24.864 24.864 24.864-24.864q2.294-2.368 5.698-2.368t5.772 2.368l11.47 11.47q2.368 2.368 2.368 5.772t-2.368 5.772l-24.864 24.864 24.864 24.864q2.368 2.294 2.368 5.698z",
|
|
87
|
-
width: 100,
|
|
88
|
-
height: 100,
|
|
89
|
-
} as const;
|
|
90
|
-
export const iconStar = {
|
|
91
|
-
path: "M15.1052249,9.55978547 L22.0028147,9.55978545 C23.6568673,9.55978545 23.9349557,10.3753626 22.6181351,11.3858845 L16.9943688,15.7015366 L19.2518801,22.8294455 C19.7526645,24.4106317 19.0984455,24.8825885 17.769353,23.8673293 L12.0490577,19.4977438 L6.5116497,23.8422153 C5.20921411,24.8640642 4.53299569,24.4067544 5.00266927,22.8160582 L7.10332364,15.7015366 L1.42794544,11.3634306 C0.110226041,10.3562014 0.383967283,9.54239221 2.0409646,9.54574013 L8.9924676,9.55978547 L11.1485117,2.72669438 C11.6458693,1.15043244 12.4548928,1.15900049 12.9494787,2.72669438 L15.1052249,9.55978547 Z",
|
|
92
|
-
width: 24,
|
|
93
|
-
height: 24,
|
|
94
|
-
} as const;
|
|
95
|
-
export const iconTryAgain = {
|
|
96
|
-
path: "M3.74890556,17.9799506 C2.19251241,16.1970909 1.10103636,13.4971457 1.13090903,11.1491783 C1.17160478,7.95052637 4.01704076,0.865059407 11.7028044,0.865059407 C19.388568,0.865059407 22.3026521,7.35203035 22.3026521,11.5879453 C22.3026521,15.8238603 19.386629,20.5574509 13.6832464,21.7131548 L13.6757539,17.3722171 C17.0812986,16.2190517 18.331158,14.1944123 18.3311578,11.5879451 C18.3311574,8.16554692 15.6664205,5.03476549 11.7028048,5.20494205 C7.73918903,5.37511861 5.59244567,8.66930079 5.59244567,11.1491783 C5.59244567,12.9090077 6.11128139,14.1753512 6.93640437,15.3053215 L8.14052356,14.2949456 C8.98559348,13.5858477 9.6994861,13.9070448 9.73489556,15.0076413 L9.91284941,20.5388014 C9.94832683,21.6415103 9.09967118,22.3514475 8.02194403,22.1254594 L2.60571602,20.9897332 C1.5259204,20.7633114 1.34338662,19.9984207 2.18070755,19.295825 L3.74890556,17.9799506 Z",
|
|
97
|
-
width: 23,
|
|
98
|
-
height: 23,
|
|
99
|
-
} as const;
|
|
100
|
-
export const iconTablet = {
|
|
101
|
-
path: "M45.322 90.706q0-1.86-1.302-3.224-1.364-1.364-3.224-1.364t-3.224 1.364-1.302 3.224q0 1.86 1.364 3.224 1.302 1.364 3.162 1.302 1.86.062 3.224-1.302t1.302-3.224zm27.218-11.346l0-68.014q0-.93-.682-1.612t-1.55-.682l-58.962 0q-.93 0-1.612.682t-.682 1.612l0 68.014q0 .93.682 1.612t1.612.62l58.962 0q.992-.062 1.612-.682t.62-1.55zm9.114-68.014l0 77.066q0 4.65-3.348 7.998t-7.998 3.348l-58.962 0q-4.65 0-7.998-3.348t-3.348-7.998l0-77.066q0-4.65 3.348-7.998t7.998-3.348l58.962 0q4.65 0 7.998 3.348t3.348 7.998z",
|
|
102
|
-
width: 81.852,
|
|
103
|
-
height: 100,
|
|
104
|
-
} as const;
|
|
105
|
-
export const iconTrash = {
|
|
106
|
-
path: "M31.293 37.506q2.052 0 2.052 2.109l0 37.506q0 1.995-2.052 2.109l-4.218 0q-.912-.057-1.482-.627t-.57-1.482l0-37.506q0-2.109 2.052-2.109l4.218 0zm18.753 2.109l0 37.506q0 .912-.57 1.482t-1.539.627l-4.161 0q-1.995 0-2.109-2.109l0-37.506q.057-.912.627-1.482t1.482-.627l4.161 0q.969.057 1.539.627t.57 1.482zm14.592-2.109q2.052 0 2.052 2.109l0 37.506q0 1.995-2.052 2.109l-4.161 0q-.969-.057-1.539-.627t-.57-1.482l0-37.506q0-2.109 2.109-2.109l4.161 0zm10.431 49.248l0-61.731l-58.368 0l0 61.731q.057 2.679.969 3.819t1.083 1.14l54.207 0q.171 0 1.14-1.083t.969-3.876zm-43.776-70.11l29.184 0l-3.135-7.581q-.456-.57-1.14-.741l-20.634 0q-.627.114-1.083.741zm-31.293 2.109q0-1.995 2.109-2.109l20.121 0l4.56-10.83q.969-2.394 3.477-4.104 2.565-1.71 5.187-1.71l20.805 0q2.622 0 5.187 1.71t3.477 4.104l4.56 10.83l20.178 0q.912.057 1.482.627t.57 1.482l0 4.161q0 1.995-2.052 2.109l-6.27 0l0 61.731q0 5.415-3.078 9.348t-7.353 3.933l-54.207 0q-4.275 0-7.353-3.819t-3.078-9.177l0-62.016l-6.213 0q-.969 0-1.539-.57t-.57-1.539l0-4.161z",
|
|
107
|
-
width: 91.681,
|
|
108
|
-
height: 100,
|
|
109
|
-
} as const;
|
|
110
|
-
export const iconUndo = {
|
|
111
|
-
path: "M10,6.6C10,7.2,9.8,8,9.3,9.1c0,0,0,0.1-0.1,0.1S9.2,9.3,9.2,9.4c0,0,0,0.1-0.1,0.1C9,9.6,9,9.6,8.9,9.6 c-0.1,0-0.1,0-0.1-0.1c0,0,0-0.1,0-0.1c0,0,0-0.1,0-0.1s0-0.1,0-0.1c0-0.3,0-0.5,0-0.7c0-0.4,0-0.7-0.1-1C8.6,7.1,8.5,6.9,8.4,6.7S8.2,6.3,8,6.1C7.8,5.9,7.6,5.8,7.4,5.7S6.9,5.5,6.7,5.5S6.1,5.4,5.8,5.4c-0.3,0-0.6,0-1,0H3.6v1.4c0,0.1,0,0.2-0.1,0.3C3.4,7.1,3.3,7.1,3.2,7.1C3.1,7.1,3,7.1,3,7L0.1,4.1C0,4.1,0,4,0,3.9s0-0.2,0.1-0.3L3,0.8C3,0.7,3.1,0.7,3.2,0.7c0.1,0,0.2,0,0.3,0.1C3.5,0.9,3.6,0.9,3.6,1v1.4h1.2c2.6,0,4.3,0.7,4.9,2.2C9.9,5.2,10,5.8,10,6.6z",
|
|
112
|
-
width: 10,
|
|
113
|
-
height: 10,
|
|
114
|
-
} as const;
|
|
115
|
-
export const iconMinus = {
|
|
116
|
-
path: `M8,13 L16,13 C16.5522847,13 17,12.5522847 17,12 C17,11.4477153 16.5522847,11 16,11 L8,11 C7.44771525,11 7,11.4477153 7,12 C7,12.5522847 7.44771525,13 8,13 Z`,
|
|
117
|
-
width: 24,
|
|
118
|
-
height: 24,
|
|
119
|
-
} as const;
|
package/src/index.ts
DELETED
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Main entry point
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export {default as init} from "./init";
|
|
6
|
-
|
|
7
|
-
export {ApiOptions, ClassNames} from "./perseus-api";
|
|
8
|
-
|
|
9
|
-
export {libVersion} from "./version";
|
|
10
|
-
export {apiVersion, itemDataVersion} from "./perseus-version";
|
|
11
|
-
export {default as itemVersion} from "./item-version";
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Renderers
|
|
15
|
-
*/
|
|
16
|
-
export {default as ArticleRenderer} from "./article-renderer";
|
|
17
|
-
export {default as ServerItemRenderer} from "./server-item-renderer";
|
|
18
|
-
export {default as HintsRenderer} from "./hints-renderer";
|
|
19
|
-
export {default as HintRenderer} from "./hint-renderer";
|
|
20
|
-
export {default as Renderer} from "./renderer";
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Widgets
|
|
24
|
-
*/
|
|
25
|
-
export * as Widgets from "./widgets";
|
|
26
|
-
export {default as widgets} from "./all-widgets";
|
|
27
|
-
export {Expression} from "./widgets/expression";
|
|
28
|
-
export {default as InputNumber} from "./widgets/input-number";
|
|
29
|
-
export {default as NumericInput} from "./widgets/numeric-input";
|
|
30
|
-
export {default as Radio} from "./widgets/radio";
|
|
31
|
-
export {default as BaseRadio} from "./widgets/radio/base-radio";
|
|
32
|
-
export {default as Categorizer} from "./widgets/categorizer";
|
|
33
|
-
export {default as InteractiveGraphWidget} from "./widgets/interactive-graph";
|
|
34
|
-
export {default as MatrixWidget} from "./widgets/matrix";
|
|
35
|
-
export {default as TableWidget} from "./widgets/table";
|
|
36
|
-
export {default as PlotterWidget} from "./widgets/plotter";
|
|
37
|
-
export {default as GrapherWidget} from "./widgets/grapher";
|
|
38
|
-
|
|
39
|
-
export {default as ArrowPicker} from "./widgets/interaction/arrow-picker";
|
|
40
|
-
export {default as ColorPicker} from "./widgets/interaction/color-picker";
|
|
41
|
-
export {default as DashPicker} from "./widgets/interaction/dash-picker";
|
|
42
|
-
export {default as ElementContainer} from "./widgets/interaction/element-container";
|
|
43
|
-
export * as GrapherUtil from "./widgets/grapher/util";
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Misc
|
|
47
|
-
*/
|
|
48
|
-
export * as components from "./components";
|
|
49
|
-
export * as constants from "./components/constants";
|
|
50
|
-
// TODO(FEI-4504): Replace globalStyles with wonder-blocks where possible
|
|
51
|
-
export * as globalStyles from "./styles/global-styles";
|
|
52
|
-
// TODO(FEI-4504): Replace globalStyles with wonder-blocks where possible
|
|
53
|
-
export * as globalConstants from "./styles/global-constants";
|
|
54
|
-
export * as icons from "./icon-paths";
|
|
55
|
-
export * as Dependencies from "./dependencies";
|
|
56
|
-
export {Errors, Log} from "./logging/log";
|
|
57
|
-
export {PerseusError} from "./perseus-error";
|
|
58
|
-
export {default as JiptParagraphs} from "./jipt-paragraphs";
|
|
59
|
-
export {default as KhanMath} from "./util/math";
|
|
60
|
-
export {default as LoadingContext} from "./loading-context";
|
|
61
|
-
export {default as mediaQueries} from "./styles/media-queries";
|
|
62
|
-
export {default as PerseusMarkdown} from "./perseus-markdown";
|
|
63
|
-
export {
|
|
64
|
-
PerseusExpressionAnswerFormConsidered,
|
|
65
|
-
plotterPlotTypes,
|
|
66
|
-
ItemExtras,
|
|
67
|
-
} from "./perseus-types";
|
|
68
|
-
export {traverse} from "./traversal";
|
|
69
|
-
export {isItemRenderableByVersion} from "./renderability";
|
|
70
|
-
export {violatingWidgets} from "./a11y";
|
|
71
|
-
export {interactiveSizes} from "./styles/constants";
|
|
72
|
-
export {displaySigFigs} from "./sigfigs";
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Util
|
|
76
|
-
*/
|
|
77
|
-
export {default as Util} from "./util";
|
|
78
|
-
export {default as KhanColors} from "./util/colors";
|
|
79
|
-
export {default as preprocessTex} from "./util/katex-preprocess";
|
|
80
|
-
export {registerAllWidgetsForTesting} from "./util/register-all-widgets-for-testing";
|
|
81
|
-
export * as SizingUtils from "./util/sizing-utils";
|
|
82
|
-
export {
|
|
83
|
-
getAnswersFromWidgets,
|
|
84
|
-
injectWidgets,
|
|
85
|
-
} from "./util/extract-perseus-data";
|
|
86
|
-
export {parsePerseusItem} from "./util/parse-perseus-json";
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Mixins
|
|
90
|
-
*/
|
|
91
|
-
export * as Changeable from "./mixins/changeable";
|
|
92
|
-
export {default as EditorJsonify} from "./mixins/editor-jsonify";
|
|
93
|
-
export {default as WidgetJsonifyDeprecated} from "./mixins/widget-jsonify-deprecated";
|
|
94
|
-
export {default as WIDGET_PROP_DENYLIST} from "./mixins/widget-prop-denylist";
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Types
|
|
98
|
-
*/
|
|
99
|
-
export type {PerseusOptions} from "./init";
|
|
100
|
-
export type {ILogger, LogErrorOptions, ErrorKind} from "./logging/log";
|
|
101
|
-
export type {ServerItemRenderer as ServerItemRendererComponent} from "./server-item-renderer";
|
|
102
|
-
export type {
|
|
103
|
-
Alignment,
|
|
104
|
-
APIOptions,
|
|
105
|
-
APIOptionsWithDefaults,
|
|
106
|
-
ChangeHandler,
|
|
107
|
-
DeviceType,
|
|
108
|
-
DomInsertCheckFn,
|
|
109
|
-
EditorMode,
|
|
110
|
-
FocusPath,
|
|
111
|
-
Hint,
|
|
112
|
-
ImageDict,
|
|
113
|
-
ImageUploader,
|
|
114
|
-
JiptLabelStore,
|
|
115
|
-
JiptRenderer,
|
|
116
|
-
PerseusDependencies,
|
|
117
|
-
PerseusScore,
|
|
118
|
-
Version,
|
|
119
|
-
VideoData,
|
|
120
|
-
VideoKind,
|
|
121
|
-
WidgetDict,
|
|
122
|
-
WidgetExports,
|
|
123
|
-
} from "./types";
|
|
124
|
-
export type {ParsedValue} from "./util";
|
|
125
|
-
export type {
|
|
126
|
-
PerseusAnswerArea,
|
|
127
|
-
PerseusExpressionWidgetOptions,
|
|
128
|
-
// Utility types
|
|
129
|
-
Range,
|
|
130
|
-
Size,
|
|
131
|
-
MathFormat,
|
|
132
|
-
InputNumberWidget, // TODO(jeremy): remove?
|
|
133
|
-
// Widget configuration types
|
|
134
|
-
PerseusImageBackground,
|
|
135
|
-
PerseusInputNumberWidgetOptions,
|
|
136
|
-
PerseusInteractiveGraphWidgetOptions,
|
|
137
|
-
PerseusItem,
|
|
138
|
-
PerseusPlotterWidgetOptions,
|
|
139
|
-
PerseusRadioWidgetOptions,
|
|
140
|
-
PerseusRenderer,
|
|
141
|
-
PerseusWidget,
|
|
142
|
-
} from "./perseus-types";
|
|
143
|
-
export type {Coord} from "./interactive2/types";
|
|
144
|
-
export type {MarkerType} from "./widgets/label-image/types";
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Multi-items
|
|
148
|
-
*/
|
|
149
|
-
export {default as MultiItems} from "./multi-items";
|
|
150
|
-
export {buildEmptyItemTreeForShape, itemToTree} from "./multi-items/items";
|
|
151
|
-
export {default as shapes} from "./multi-items/shapes";
|
|
152
|
-
export {buildMapper} from "./multi-items/trees";
|
|
153
|
-
|
|
154
|
-
export type {
|
|
155
|
-
ContentNode,
|
|
156
|
-
HintNode,
|
|
157
|
-
Item,
|
|
158
|
-
ItemTree,
|
|
159
|
-
ItemObjectNode,
|
|
160
|
-
ItemArrayNode,
|
|
161
|
-
TagsNode,
|
|
162
|
-
} from "./multi-items/item-types";
|
|
163
|
-
export type {
|
|
164
|
-
Shape,
|
|
165
|
-
ArrayShape,
|
|
166
|
-
ObjectShape,
|
|
167
|
-
ContentShape,
|
|
168
|
-
HintShape,
|
|
169
|
-
TagsShape,
|
|
170
|
-
} from "./multi-items/shape-types";
|
|
171
|
-
export type {Path} from "./multi-items/trees";
|
package/src/init.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import basicWidgets from "./basic-widgets";
|
|
2
|
-
import extraWidgets from "./extra-widgets";
|
|
3
|
-
import * as Widgets from "./widgets";
|
|
4
|
-
|
|
5
|
-
declare const MathJax: any;
|
|
6
|
-
|
|
7
|
-
export type PerseusOptions = {
|
|
8
|
-
skipMathJax: boolean;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* This should be called by all clients, specifying whether extra widgets are
|
|
13
|
-
* needed via `loadExtraWidgets`. It is idempotent, so it's not a problem to
|
|
14
|
-
* call it multiple times.
|
|
15
|
-
*
|
|
16
|
-
* skipMathJax:
|
|
17
|
-
* If false/undefined, MathJax will be configured, and the
|
|
18
|
-
* promise will wait for MathJax to load (if it hasn't already).
|
|
19
|
-
*/
|
|
20
|
-
const init = function (options: PerseusOptions): Promise<undefined> {
|
|
21
|
-
Widgets.registerWidgets(basicWidgets);
|
|
22
|
-
Widgets.registerWidgets(extraWidgets);
|
|
23
|
-
|
|
24
|
-
Widgets.replaceWidget("transformer", "deprecated-standin");
|
|
25
|
-
|
|
26
|
-
// Pass skipMathJax: true if MathJax is already loaded and configured.
|
|
27
|
-
const skipMathJax = options.skipMathJax;
|
|
28
|
-
|
|
29
|
-
if (skipMathJax) {
|
|
30
|
-
// @ts-expect-error - TS2322 - Type 'Promise<void>' is not assignable to type 'Promise<undefined>'.
|
|
31
|
-
return Promise.resolve();
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return new Promise(
|
|
35
|
-
(
|
|
36
|
-
resolve: (result: Promise<never>) => void,
|
|
37
|
-
reject: (error?: any) => void,
|
|
38
|
-
) => {
|
|
39
|
-
MathJax.Hub.Config({
|
|
40
|
-
messageStyle: "none",
|
|
41
|
-
skipStartupTypeset: "none",
|
|
42
|
-
"HTML-CSS": {
|
|
43
|
-
availableFonts: ["TeX"],
|
|
44
|
-
imageFont: null,
|
|
45
|
-
scale: 100,
|
|
46
|
-
showMathMenu: false,
|
|
47
|
-
},
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
MathJax.Hub.Configured();
|
|
51
|
-
MathJax.Hub.Queue(resolve);
|
|
52
|
-
},
|
|
53
|
-
);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export default init;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import type {APIOptions, Tracking} from "./types";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* This alternate version of `.track` does nothing as an optimization.
|
|
5
|
-
*/
|
|
6
|
-
function _noop() {}
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Wrapper for the trackInteraction apiOption.
|
|
10
|
-
*/
|
|
11
|
-
class InteractionTracker<T> {
|
|
12
|
-
// @ts-expect-error - TS2564 - Property '_tracked' has no initializer and is not definitely assigned in the constructor.
|
|
13
|
-
_tracked: boolean;
|
|
14
|
-
// @ts-expect-error - TS2564 - Property 'setting' has no initializer and is not definitely assigned in the constructor.
|
|
15
|
-
setting: Tracking;
|
|
16
|
-
track: (extraData?: T) => void;
|
|
17
|
-
trackApi: any;
|
|
18
|
-
// @ts-expect-error - TS2564 - Property 'widgetID' has no initializer and is not definitely assigned in the constructor.
|
|
19
|
-
widgetID: string;
|
|
20
|
-
// @ts-expect-error - TS2564 - Property 'widgetType' has no initializer and is not definitely assigned in the constructor.
|
|
21
|
-
widgetType: string;
|
|
22
|
-
|
|
23
|
-
constructor(
|
|
24
|
-
trackApi: APIOptions["trackInteraction"],
|
|
25
|
-
widgetType: string,
|
|
26
|
-
widgetID: string,
|
|
27
|
-
setting: Tracking,
|
|
28
|
-
) {
|
|
29
|
-
if (!trackApi) {
|
|
30
|
-
this.track = _noop;
|
|
31
|
-
} else {
|
|
32
|
-
this._tracked = false;
|
|
33
|
-
this.trackApi = trackApi;
|
|
34
|
-
this.widgetType = widgetType;
|
|
35
|
-
this.widgetID = widgetID;
|
|
36
|
-
this.setting = setting;
|
|
37
|
-
this.track = this._track;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Function that actually calls the API to mark the interaction. This is
|
|
43
|
-
* private. The public version is just `.track` and is bound to this object
|
|
44
|
-
* for easy use in other context.
|
|
45
|
-
*
|
|
46
|
-
* @param extraData Any extra data to track about the event.
|
|
47
|
-
* @private
|
|
48
|
-
*/
|
|
49
|
-
_track: (extraData: T) => void = (extraData) => {
|
|
50
|
-
if (this._tracked && !this.setting) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
this._tracked = true;
|
|
54
|
-
this.trackApi({
|
|
55
|
-
type: this.widgetType,
|
|
56
|
-
id: this.widgetID,
|
|
57
|
-
...extraData,
|
|
58
|
-
});
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export default InteractionTracker;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Create a Mocked Movable
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import _ from "underscore";
|
|
6
|
-
|
|
7
|
-
import {Graphie} from "../../util/graphie";
|
|
8
|
-
import Movable from "../movable";
|
|
9
|
-
|
|
10
|
-
const createMock = function (): any {
|
|
11
|
-
const movable = new Movable(new Graphie(document.createElement("div")), {
|
|
12
|
-
mouseTarget: null,
|
|
13
|
-
});
|
|
14
|
-
movable.modify = function (options: any) {
|
|
15
|
-
Movable.prototype.modify.call(movable, _.omit(options, "mouseTarget"));
|
|
16
|
-
};
|
|
17
|
-
_.each(
|
|
18
|
-
["onMoveStart", "onMove", "onMoveEnd", "onClick"],
|
|
19
|
-
function (eventName) {
|
|
20
|
-
movable[eventName] = function (coord: any, prevCoord) {
|
|
21
|
-
this._fireEvent(this.state[eventName], coord, prevCoord);
|
|
22
|
-
};
|
|
23
|
-
},
|
|
24
|
-
);
|
|
25
|
-
movable.move = function (...args) {
|
|
26
|
-
const startPoint = _.first(args);
|
|
27
|
-
// TODO(jack): Move these into onMoveStart, onMove, and onMoveEnd
|
|
28
|
-
movable.state.isMouseOver = true;
|
|
29
|
-
movable.state.isHovering = true;
|
|
30
|
-
movable.onMoveStart(startPoint, startPoint);
|
|
31
|
-
_.each(_.rest(args), function (point, i) {
|
|
32
|
-
movable.state.isDragging = true;
|
|
33
|
-
movable.onMove(point, args[i]);
|
|
34
|
-
});
|
|
35
|
-
movable.onMoveEnd(_.last(args), startPoint);
|
|
36
|
-
movable.state.dragging = false;
|
|
37
|
-
movable.state.isMouseOver = false;
|
|
38
|
-
movable.state.isHovering = false;
|
|
39
|
-
};
|
|
40
|
-
return movable;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export default createMock;
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
// System requires
|
|
2
|
-
import _ from "underscore";
|
|
3
|
-
|
|
4
|
-
// Interactive2 requires
|
|
5
|
-
import MovablePoint from "../movable-point";
|
|
6
|
-
|
|
7
|
-
import _createMockMovable from "./movable-mock";
|
|
8
|
-
|
|
9
|
-
// Create a testable MovablePoint with a mocked out Movable
|
|
10
|
-
const createPoint = function (options) {
|
|
11
|
-
const movable = _createMockMovable();
|
|
12
|
-
const point = new MovablePoint(
|
|
13
|
-
null,
|
|
14
|
-
movable,
|
|
15
|
-
_.extend(options, {
|
|
16
|
-
static: true,
|
|
17
|
-
draw: null,
|
|
18
|
-
showHairlines: () => {},
|
|
19
|
-
hideHairlines: () => {},
|
|
20
|
-
|
|
21
|
-
// Mock visibleShape which is only added when a movable point is used
|
|
22
|
-
// with a shape.
|
|
23
|
-
// TODO(kevinb): update MovablePoint to require a visibleShape
|
|
24
|
-
visibleShape: {
|
|
25
|
-
wrapper: {},
|
|
26
|
-
},
|
|
27
|
-
}),
|
|
28
|
-
);
|
|
29
|
-
return {
|
|
30
|
-
movable: movable,
|
|
31
|
-
point: point,
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Convenience function to fill in the no-drawing defaults
|
|
35
|
-
* for a modify call
|
|
36
|
-
*/
|
|
37
|
-
modify: function (options) {
|
|
38
|
-
point.modify(
|
|
39
|
-
_.extend(
|
|
40
|
-
{
|
|
41
|
-
static: true,
|
|
42
|
-
draw: null,
|
|
43
|
-
},
|
|
44
|
-
options,
|
|
45
|
-
),
|
|
46
|
-
);
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
describe("MovablePoint", function () {
|
|
52
|
-
describe("add", function () {
|
|
53
|
-
it("should snap to the grid when a snap is specified", function () {
|
|
54
|
-
const point = createPoint({
|
|
55
|
-
coord: [1.1, 1.1],
|
|
56
|
-
// @ts-expect-error - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
57
|
-
constraints: MovablePoint.constraints.snap([1, 1]),
|
|
58
|
-
}).point;
|
|
59
|
-
|
|
60
|
-
expect(point.coord()).toEqual([1, 1]);
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
describe("modify", function () {
|
|
65
|
-
it("should reset the point's size", function () {
|
|
66
|
-
const defaultPointSize = createPoint({
|
|
67
|
-
coord: [1, 1], // uses the default pointSize
|
|
68
|
-
}).point.pointSize();
|
|
69
|
-
|
|
70
|
-
// verify that 10 was not, in fact, the default, or we should
|
|
71
|
-
// change 10 to something else
|
|
72
|
-
expect(defaultPointSize).not.toEqual(10);
|
|
73
|
-
|
|
74
|
-
const handle = createPoint({
|
|
75
|
-
coord: [0, 0],
|
|
76
|
-
pointSize: 10, // arbitrary size larger than the default
|
|
77
|
-
});
|
|
78
|
-
expect(handle.point.pointSize()).toBe(10);
|
|
79
|
-
|
|
80
|
-
handle.modify({
|
|
81
|
-
coord: [0, 0], // reset to the default pointSize
|
|
82
|
-
});
|
|
83
|
-
expect(handle.point.pointSize()).toBe(defaultPointSize);
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
it("should allow you to change the point's size", function () {
|
|
87
|
-
const handle = createPoint({
|
|
88
|
-
coord: [0, 0],
|
|
89
|
-
pointSize: 5,
|
|
90
|
-
});
|
|
91
|
-
expect(handle.point.pointSize()).toBe(5);
|
|
92
|
-
|
|
93
|
-
handle.modify({
|
|
94
|
-
pointSize: 6,
|
|
95
|
-
});
|
|
96
|
-
expect(handle.point.pointSize()).toBe(6);
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
describe("onMove", function () {
|
|
101
|
-
it("should be called when movable is moved", function () {
|
|
102
|
-
let movedToCoord;
|
|
103
|
-
const handle = createPoint({
|
|
104
|
-
coord: [1, 2],
|
|
105
|
-
onMove: function (newCoord, prevCoord) {
|
|
106
|
-
expect(prevCoord).toEqual([1, 2]);
|
|
107
|
-
movedToCoord = newCoord;
|
|
108
|
-
},
|
|
109
|
-
});
|
|
110
|
-
// move mouse from [2.5, 4] to [3, 4]
|
|
111
|
-
handle.movable.move([2.5, 4], [3, 4]);
|
|
112
|
-
expect(movedToCoord).toEqual([3, 4]);
|
|
113
|
-
expect(handle.point.coord()).toEqual([3, 4]);
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
describe("onClick", function () {
|
|
118
|
-
it("should be called if the point didn't move", function () {
|
|
119
|
-
let clickCoord;
|
|
120
|
-
const handle = createPoint({
|
|
121
|
-
coord: [1, 2],
|
|
122
|
-
onClick: function (coord) {
|
|
123
|
-
clickCoord = coord;
|
|
124
|
-
},
|
|
125
|
-
});
|
|
126
|
-
// move mouse from [1, 2] to [1, 2]
|
|
127
|
-
handle.movable.move([1, 2], [1, 2]);
|
|
128
|
-
expect(clickCoord).toEqual([1, 2]);
|
|
129
|
-
expect(handle.point.coord()).toEqual([1, 2]);
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
it("should not be called if the point did move", function () {
|
|
133
|
-
const handle = createPoint({
|
|
134
|
-
coord: [1, 2],
|
|
135
|
-
onClick: function (coord) {
|
|
136
|
-
expect(false).toBeTruthy();
|
|
137
|
-
},
|
|
138
|
-
});
|
|
139
|
-
// move mouse from [1, 2] to [3, 4]
|
|
140
|
-
handle.movable.move([1, 2], [3, 4]);
|
|
141
|
-
expect(handle.point.coord()).toEqual([3, 4]);
|
|
142
|
-
});
|
|
143
|
-
});
|
|
144
|
-
});
|