@khanacademy/math-input 0.0.0-PR443-20230328215601
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/.eslintrc.js +12 -0
- package/CHANGELOG.md +104 -0
- package/README.md +39 -0
- package/dist/es/index.css +587 -0
- package/dist/es/index.js +7291 -0
- package/dist/es/index.js.map +1 -0
- package/dist/index.css +587 -0
- package/dist/index.js +7333 -0
- package/dist/index.js.map +1 -0
- package/dist/strings +71 -0
- package/index.html +20 -0
- package/less/echo.less +56 -0
- package/less/main.less +5 -0
- package/less/overrides.less +129 -0
- package/less/popover.less +22 -0
- package/less/tabbar.less +6 -0
- package/package.json +64 -0
- package/src/actions/index.js +57 -0
- package/src/components/__tests__/gesture-state-machine_test.js +437 -0
- package/src/components/__tests__/node-manager_test.js +89 -0
- package/src/components/__tests__/two-page-keypad_test.js +42 -0
- package/src/components/app.js +73 -0
- package/src/components/common-style.ts +46 -0
- package/src/components/compute-layout-parameters.js +157 -0
- package/src/components/corner-decal.js +56 -0
- package/src/components/echo-manager.js +160 -0
- package/src/components/empty-keypad-button.js +49 -0
- package/src/components/expression-keypad.js +323 -0
- package/src/components/fraction-keypad.js +176 -0
- package/src/components/gesture-manager.js +226 -0
- package/src/components/gesture-state-machine.js +283 -0
- package/src/components/icon.js +74 -0
- package/src/components/iconography/arrow.js +22 -0
- package/src/components/iconography/backspace.js +29 -0
- package/src/components/iconography/cdot.js +29 -0
- package/src/components/iconography/cos.js +30 -0
- package/src/components/iconography/cube-root.js +36 -0
- package/src/components/iconography/dismiss.js +25 -0
- package/src/components/iconography/divide.js +34 -0
- package/src/components/iconography/down.js +16 -0
- package/src/components/iconography/equal.js +33 -0
- package/src/components/iconography/exp-2.js +29 -0
- package/src/components/iconography/exp-3.js +29 -0
- package/src/components/iconography/exp.js +29 -0
- package/src/components/iconography/frac.js +44 -0
- package/src/components/iconography/geq.js +33 -0
- package/src/components/iconography/gt.js +33 -0
- package/src/components/iconography/index.js +45 -0
- package/src/components/iconography/jump-into-numerator.js +41 -0
- package/src/components/iconography/jump-out-base.js +30 -0
- package/src/components/iconography/jump-out-denominator.js +41 -0
- package/src/components/iconography/jump-out-exponent.js +30 -0
- package/src/components/iconography/jump-out-numerator.js +41 -0
- package/src/components/iconography/jump-out-parentheses.js +33 -0
- package/src/components/iconography/left-paren.js +33 -0
- package/src/components/iconography/left.js +16 -0
- package/src/components/iconography/leq.js +33 -0
- package/src/components/iconography/ln.js +29 -0
- package/src/components/iconography/log-n.js +29 -0
- package/src/components/iconography/log.js +29 -0
- package/src/components/iconography/lt.js +33 -0
- package/src/components/iconography/minus.js +32 -0
- package/src/components/iconography/neq.js +33 -0
- package/src/components/iconography/parens.js +33 -0
- package/src/components/iconography/percent.js +49 -0
- package/src/components/iconography/period.js +26 -0
- package/src/components/iconography/plus.js +32 -0
- package/src/components/iconography/radical.js +36 -0
- package/src/components/iconography/right-paren.js +33 -0
- package/src/components/iconography/right.js +16 -0
- package/src/components/iconography/sin.js +30 -0
- package/src/components/iconography/sqrt.js +32 -0
- package/src/components/iconography/tan.js +30 -0
- package/src/components/iconography/times.js +33 -0
- package/src/components/iconography/up.js +16 -0
- package/src/components/input/__tests__/context-tracking_test.js +177 -0
- package/src/components/input/__tests__/mathquill_test.js +747 -0
- package/src/components/input/__tests__/test-math-wrapper.jsx +33 -0
- package/src/components/input/cursor-contexts.ts +44 -0
- package/src/components/input/cursor-handle.tsx +137 -0
- package/src/components/input/drag-listener.js +75 -0
- package/src/components/input/math-input.tsx +993 -0
- package/src/components/input/math-wrapper.js +959 -0
- package/src/components/input/scroll-into-view.js +72 -0
- package/src/components/keypad/button-assets.tsx +493 -0
- package/src/components/keypad/button.stories.js +29 -0
- package/src/components/keypad/button.tsx +106 -0
- package/src/components/keypad/index.tsx +65 -0
- package/src/components/keypad/keypad-page-items.tsx +91 -0
- package/src/components/keypad/keypad-pages.stories.tsx +30 -0
- package/src/components/keypad/keypad.stories.tsx +33 -0
- package/src/components/keypad/numeric-input-page.tsx +99 -0
- package/src/components/keypad/pre-algebra-page.tsx +97 -0
- package/src/components/keypad/trigonometry-page.tsx +89 -0
- package/src/components/keypad-button.js +362 -0
- package/src/components/keypad-container.js +299 -0
- package/src/components/keypad.js +154 -0
- package/src/components/many-keypad-button.js +44 -0
- package/src/components/math-icon.js +65 -0
- package/src/components/multi-symbol-grid.js +182 -0
- package/src/components/multi-symbol-popover.js +59 -0
- package/src/components/navigation-pad.js +139 -0
- package/src/components/node-manager.js +129 -0
- package/src/components/popover-manager.js +76 -0
- package/src/components/popover-state-machine.js +173 -0
- package/src/components/prop-types.js +82 -0
- package/src/components/provided-keypad.tsx +105 -0
- package/src/components/styles.js +38 -0
- package/src/components/svg-icon.js +25 -0
- package/src/components/tabbar/__tests__/tabbar_test.js +65 -0
- package/src/components/tabbar/icons.tsx +64 -0
- package/src/components/tabbar/item.tsx +136 -0
- package/src/components/tabbar/tabbar.stories.js +60 -0
- package/src/components/tabbar/tabbar.tsx +59 -0
- package/src/components/tabbar/types.ts +1 -0
- package/src/components/text-icon.js +52 -0
- package/src/components/touchable-keypad-button.js +146 -0
- package/src/components/two-page-keypad.js +99 -0
- package/src/components/velocity-tracker.js +76 -0
- package/src/components/z-indexes.ts +8 -0
- package/src/consts.ts +91 -0
- package/src/data/key-configs.ts +349 -0
- package/src/data/keys.ts +124 -0
- package/src/demo.js +9 -0
- package/src/fake-react-native-web/index.ts +11 -0
- package/src/fake-react-native-web/text.tsx +54 -0
- package/src/fake-react-native-web/view.tsx +89 -0
- package/src/index.ts +22 -0
- package/src/native-app.js +85 -0
- package/src/store/index.ts +534 -0
- package/src/utils.ts +14 -0
- package/tools/svg-to-react/convert.py +111 -0
- package/tools/svg-to-react/icons/math-keypad-icon-0.svg +32 -0
- package/tools/svg-to-react/icons/math-keypad-icon-1.svg +32 -0
- package/tools/svg-to-react/icons/math-keypad-icon-2.svg +32 -0
- package/tools/svg-to-react/icons/math-keypad-icon-3.svg +32 -0
- package/tools/svg-to-react/icons/math-keypad-icon-4.svg +32 -0
- package/tools/svg-to-react/icons/math-keypad-icon-5.svg +32 -0
- package/tools/svg-to-react/icons/math-keypad-icon-6.svg +32 -0
- package/tools/svg-to-react/icons/math-keypad-icon-7.svg +32 -0
- package/tools/svg-to-react/icons/math-keypad-icon-8.svg +32 -0
- package/tools/svg-to-react/icons/math-keypad-icon-9.svg +32 -0
- package/tools/svg-to-react/icons/math-keypad-icon-addition.svg +34 -0
- package/tools/svg-to-react/icons/math-keypad-icon-cos.svg +38 -0
- package/tools/svg-to-react/icons/math-keypad-icon-delete.svg +36 -0
- package/tools/svg-to-react/icons/math-keypad-icon-dismiss.svg +36 -0
- package/tools/svg-to-react/icons/math-keypad-icon-division.svg +36 -0
- package/tools/svg-to-react/icons/math-keypad-icon-equals-not.svg +50 -0
- package/tools/svg-to-react/icons/math-keypad-icon-equals.svg +48 -0
- package/tools/svg-to-react/icons/math-keypad-icon-exponent-2.svg +38 -0
- package/tools/svg-to-react/icons/math-keypad-icon-exponent-3.svg +38 -0
- package/tools/svg-to-react/icons/math-keypad-icon-exponent.svg +38 -0
- package/tools/svg-to-react/icons/math-keypad-icon-fraction.svg +42 -0
- package/tools/svg-to-react/icons/math-keypad-icon-greater-than.svg +46 -0
- package/tools/svg-to-react/icons/math-keypad-icon-jump-out-base.svg +44 -0
- package/tools/svg-to-react/icons/math-keypad-icon-jump-out-denominator.svg +48 -0
- package/tools/svg-to-react/icons/math-keypad-icon-jump-out-exponent.svg +44 -0
- package/tools/svg-to-react/icons/math-keypad-icon-jump-out-parentheses.svg +44 -0
- package/tools/svg-to-react/icons/math-keypad-icon-less-than.svg +46 -0
- package/tools/svg-to-react/icons/math-keypad-icon-log-10.svg +36 -0
- package/tools/svg-to-react/icons/math-keypad-icon-log-e.svg +36 -0
- package/tools/svg-to-react/icons/math-keypad-icon-log.svg +38 -0
- package/tools/svg-to-react/icons/math-keypad-icon-multiplication-cross.svg +40 -0
- package/tools/svg-to-react/icons/math-keypad-icon-multiplication-dot.svg +38 -0
- package/tools/svg-to-react/icons/math-keypad-icon-percent.svg +42 -0
- package/tools/svg-to-react/icons/math-keypad-icon-radical-2.svg +36 -0
- package/tools/svg-to-react/icons/math-keypad-icon-radical-3.svg +38 -0
- package/tools/svg-to-react/icons/math-keypad-icon-radical.svg +38 -0
- package/tools/svg-to-react/icons/math-keypad-icon-radix-character.svg +32 -0
- package/tools/svg-to-react/icons/math-keypad-icon-sin.svg +38 -0
- package/tools/svg-to-react/icons/math-keypad-icon-subtraction.svg +32 -0
- package/tools/svg-to-react/icons/math-keypad-icon-tan.svg +38 -0
- package/tools/svg-to-react/symbol_map.py +41 -0
- package/tsconfig.json +9 -0
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
+
/* eslint-disable import/no-commonjs */
|
|
3
|
+
const path = require("path");
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
rules: {
|
|
7
|
+
"import/no-extraneous-dependencies": [
|
|
8
|
+
"error",
|
|
9
|
+
{packageDir: [__dirname, path.join(__dirname, "../../")]},
|
|
10
|
+
],
|
|
11
|
+
},
|
|
12
|
+
};
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# @khanacademy/math-input
|
|
2
|
+
|
|
3
|
+
## 0.0.0-PR443-20230328215601
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 4ef5607d: Migrate source code to TypeScript
|
|
8
|
+
|
|
9
|
+
## 0.6.8
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 2c843b38: Update to use wonder-blocks deps after migrating wonder-blocks to TS
|
|
14
|
+
|
|
15
|
+
## 0.6.7
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- a1b4ab3c: Update wonder-blocks and wonder-stuff deps to fix an issue with wonder-stuff's generated flow types
|
|
20
|
+
|
|
21
|
+
## 0.6.6
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- 6a7f36be: Update wonder-stuff and wonder-blocks dependencies
|
|
26
|
+
|
|
27
|
+
## 0.6.5
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- c238d540: Wrap all ReactDOM.render() calls in `<RenderStateRoot>` to ensure it propagates properly
|
|
32
|
+
|
|
33
|
+
## 0.6.4
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- 113953e8: Exports new types to support custom keypads: `CursorContext`, `KeypadType`, `KeyType`, and `Key`
|
|
38
|
+
|
|
39
|
+
## 0.6.3
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- f567f660: Update the eslint config to look at both the package.json for the package and the one from the root
|
|
44
|
+
|
|
45
|
+
## 0.6.2
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- bf180fe1: Fix our use of import/no-extraneous-dependencies
|
|
50
|
+
|
|
51
|
+
## 0.6.1
|
|
52
|
+
|
|
53
|
+
### Patch Changes
|
|
54
|
+
|
|
55
|
+
- 1a91b6c2: Adds missing wonder-blocks deps, makes wonder-blocks peerDeps
|
|
56
|
+
|
|
57
|
+
## 0.6.0
|
|
58
|
+
|
|
59
|
+
### Minor Changes
|
|
60
|
+
|
|
61
|
+
- 8fcd2a28: Inline the import of mathquill.css in math-input's main.less
|
|
62
|
+
|
|
63
|
+
## 0.5.6
|
|
64
|
+
|
|
65
|
+
### Patch Changes
|
|
66
|
+
|
|
67
|
+
- 98d283ff: Fix storybook
|
|
68
|
+
|
|
69
|
+
## 0.5.5
|
|
70
|
+
|
|
71
|
+
### Patch Changes
|
|
72
|
+
|
|
73
|
+
- 6f8f1ac9: Use wonder-blocks-i18n to determine the decimal separator
|
|
74
|
+
|
|
75
|
+
## 0.5.4
|
|
76
|
+
|
|
77
|
+
### Patch Changes
|
|
78
|
+
|
|
79
|
+
- f29b4975: Export the KeyConfigs type
|
|
80
|
+
|
|
81
|
+
## 0.5.3
|
|
82
|
+
|
|
83
|
+
### Patch Changes
|
|
84
|
+
|
|
85
|
+
- 96288b87: Export CursorContexts
|
|
86
|
+
|
|
87
|
+
## 0.5.2
|
|
88
|
+
|
|
89
|
+
### Patch Changes
|
|
90
|
+
|
|
91
|
+
- a15b0e86: Add 'perseus-build-settings' as a dev dep to packages that were missing it
|
|
92
|
+
|
|
93
|
+
## 0.5.1
|
|
94
|
+
|
|
95
|
+
### Patch Changes
|
|
96
|
+
|
|
97
|
+
- 591420a6: Add @flow comment to math-input's index.js and missing props to ProvidedKeypad
|
|
98
|
+
|
|
99
|
+
## 0.5.0
|
|
100
|
+
|
|
101
|
+
### Minor Changes
|
|
102
|
+
|
|
103
|
+
- ea57be17: Move math-input into khan/perseus repo (name changes to @khanacademy/math-input)
|
|
104
|
+
- 116df39b: Extract math-input strings from source and save them to packages/math-input/dist
|
package/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# math-input
|
|
2
|
+
|
|
3
|
+
Khan Academy's expression editor for the mobile web. Used in the [Perseus](https://github.com/khan/perseus) exercise framework to power math input and expression editing on small screens.
|
|
4
|
+
|
|
5
|
+
Built with [React](https://github.com/facebook/react), [Redux](https://github.com/reactjs/redux), [MathQuill](https://github.com/mathquill/mathquill), [Aphrodite](https://github.com/khan/aphrodite), and more.
|
|
6
|
+
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
Try it yourself on [Khan Academy](https://www.khanacademy.org/math/algebra-basics/alg-basics-algebraic-expressions/alg-basics-distributive-property/e/distributive-property-with-variables). (Note: you'll need to enable mobile emulation, if you're accessing the site from a desktop browser.)
|
|
10
|
+
|
|
11
|
+
## Getting started
|
|
12
|
+
|
|
13
|
+
- Clone the project: `git clone git@github.com:Khan/math-input.git`
|
|
14
|
+
- Install dependencies: `yarn install`
|
|
15
|
+
- Start the development server: `yarn start`
|
|
16
|
+
|
|
17
|
+
When you start the project you'll need to be on a device that supports touch or touch emulation to see the keyboard. The easiest way to get started is open the developer tools on Google Chrome.
|
|
18
|
+
|
|
19
|
+
## Supported Features
|
|
20
|
+
|
|
21
|
+
- Multiple keypad configurations, so as to accommodate a range of input types (i.e., fractions/mixed numbers, algebraic expressions).
|
|
22
|
+
- Multi-page keypads, with swipeable page navigation.
|
|
23
|
+
- Touch-and-drag interactions (as supported by the stock iOS and Android keypads).
|
|
24
|
+
- A draggable cursor with a detached handle, for fine-grained control on touch devices.
|
|
25
|
+
- Custom state transitions for the editing experience, to streamline expression entry.
|
|
26
|
+
|
|
27
|
+

|
|
28
|
+
|
|
29
|
+
## Demo
|
|
30
|
+
|
|
31
|
+
A live demo is available via [GitHub Pages](http://khan.github.io/math-input/). You can configure some of the keypad's behaviors, along with the set of active keys, via the [editor](http://khan.github.io/math-input/custom.html).
|
|
32
|
+
|
|
33
|
+
Note that, as the input and keypad only respond to touch events, you'll need to enable mobile emulation (e.g., as supported by Chrome) in order to use the keypad in a desktop browser.
|
|
34
|
+
|
|
35
|
+
To run the demo locally, clone the repo, `yarn install`, `yarn watch`, and open the `index.html` page. The local behaviors can similarly be customized via the editor @ `custom.html`.
|
|
36
|
+
|
|
37
|
+
## License
|
|
38
|
+
|
|
39
|
+
[MIT License](http://opensource.org/licenses/MIT)
|