@khanacademy/math-input 14.0.0 → 14.0.1

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.
@@ -0,0 +1 @@
1
+ export declare const libVersion = "__lib_version__";
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Khan Academy's new expression editor for the mobile web.",
4
4
  "author": "Khan Academy",
5
5
  "license": "MIT",
6
- "version": "14.0.0",
6
+ "version": "14.0.1",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -20,7 +20,7 @@
20
20
  "source": "src/index.ts",
21
21
  "scripts": {},
22
22
  "dependencies": {
23
- "@khanacademy/perseus-core": "1.1.0",
23
+ "@khanacademy/perseus-core": "1.1.1",
24
24
  "mathquill": "git+https://git@github.com/Khan/mathquill.git#32d9f351aaa68537170b3120a52e99b8def3a2c3",
25
25
  "performance-now": "^0.2.0"
26
26
  },
@@ -34,7 +34,7 @@
34
34
  "aphrodite": "^1.1.0",
35
35
  "jquery": "^2.1.1",
36
36
  "katex": "^0.11.1",
37
- "perseus-build-settings": "^0.2.0",
37
+ "perseus-build-settings": "^0.2.1",
38
38
  "prop-types": "15.6.1",
39
39
  "react": "^16.8.0",
40
40
  "react-dom": "^16.8.0",
@@ -170,7 +170,6 @@ exports[`keypad should snapshot expanded: first render 1`] = `
170
170
  <div
171
171
  aria-label="Keypad"
172
172
  class="default_xu2jcg-o_O-keypadGrid_ztxlrb-o_O-expressionGrid_1fuqhx9"
173
- role="grid"
174
173
  tabindex="0"
175
174
  >
176
175
  <div
@@ -1223,7 +1222,6 @@ exports[`keypad should snapshot unexpanded: first render 1`] = `
1223
1222
  <div
1224
1223
  aria-label="Keypad"
1225
1224
  class="default_xu2jcg-o_O-keypadGrid_ztxlrb-o_O-expressionGrid_1fuqhx9"
1226
- role="grid"
1227
1225
  tabindex="0"
1228
1226
  >
1229
1227
  <div
@@ -151,7 +151,6 @@ export default function Keypad(props: Props) {
151
151
  <View style={styles.keypadInnerContainer}>
152
152
  <View
153
153
  style={[styles.keypadGrid, gridStyle]}
154
- role="grid"
155
154
  tabIndex={0}
156
155
  aria-label="Keypad"
157
156
  >
@@ -85,43 +85,47 @@ class ProvidedKeypad extends React.Component<Props> implements KeypadAPI {
85
85
  return ReactDOM.findDOMNode(this);
86
86
  };
87
87
 
88
+ onElementMounted: (element: any) => void = (element) => {
89
+ this.props.onAnalyticsEvent({
90
+ type: "math-input:keypad-opened",
91
+ payload: {
92
+ virtualKeypadVersion: "MATH_INPUT_KEYPAD_V1",
93
+ },
94
+ });
95
+
96
+ // Append the dispatch methods that we want to expose
97
+ // externally to the returned React element.
98
+ const elementWithDispatchMethods = {
99
+ ...element,
100
+ activate: this.activate,
101
+ dismiss: this.dismiss,
102
+ configure: this.configure,
103
+ setCursor: this.setCursor,
104
+ setKeyHandler: this.setKeyHandler,
105
+ getDOMNode: this.getDOMNode,
106
+ } as const;
107
+ this.props.onElementMounted?.(elementWithDispatchMethods);
108
+ };
109
+
110
+ onDismiss: () => void = () => {
111
+ this.props.onAnalyticsEvent({
112
+ type: "math-input:keypad-closed",
113
+ payload: {
114
+ virtualKeypadVersion: "MATH_INPUT_KEYPAD_V1",
115
+ },
116
+ });
117
+
118
+ this.props.onDismiss?.();
119
+ };
120
+
88
121
  render(): React.ReactNode {
89
- const {onElementMounted, onDismiss, style} = this.props;
122
+ const {style} = this.props;
90
123
 
91
124
  return (
92
125
  <Provider store={this.store}>
93
126
  <KeypadContainer
94
- onElementMounted={(element) => {
95
- this.props.onAnalyticsEvent({
96
- type: "math-input:keypad-opened",
97
- payload: {
98
- virtualKeypadVersion: "MATH_INPUT_KEYPAD_V1",
99
- },
100
- });
101
-
102
- // Append the dispatch methods that we want to expose
103
- // externally to the returned React element.
104
- const elementWithDispatchMethods = {
105
- ...element,
106
- activate: this.activate,
107
- dismiss: this.dismiss,
108
- configure: this.configure,
109
- setCursor: this.setCursor,
110
- setKeyHandler: this.setKeyHandler,
111
- getDOMNode: this.getDOMNode,
112
- } as const;
113
- onElementMounted?.(elementWithDispatchMethods);
114
- }}
115
- onDismiss={() => {
116
- this.props.onAnalyticsEvent({
117
- type: "math-input:keypad-closed",
118
- payload: {
119
- virtualKeypadVersion: "MATH_INPUT_KEYPAD_V1",
120
- },
121
- });
122
-
123
- onDismiss?.();
124
- }}
127
+ onElementMounted={this.onElementMounted}
128
+ onDismiss={this.onDismiss}
125
129
  style={style}
126
130
  />
127
131
  </Provider>
package/src/index.ts CHANGED
@@ -4,6 +4,8 @@
4
4
 
5
5
  import "../less/main.less";
6
6
 
7
+ export {libVersion} from "./version";
8
+
7
9
  // MathInput input field (MathQuill wrapper)
8
10
  export {default as KeypadInput} from "./components/input/math-input";
9
11
 
package/src/version.ts ADDED
@@ -0,0 +1,10 @@
1
+ // This file is processed by a Rollup plugin (replace) to inject the production
2
+ // version number during the release build.
3
+ // In dev, you'll never see the version number.
4
+
5
+ import {addLibraryVersionToPerseusDebug} from "@khanacademy/perseus-core";
6
+
7
+ const libName = "@khanacademy/math-input";
8
+ export const libVersion = "__lib_version__";
9
+
10
+ addLibraryVersionToPerseusDebug(libName, libVersion);
@@ -6,5 +6,6 @@
6
6
  },
7
7
  "references": [
8
8
  {"path": "../perseus-core/tsconfig-build.json"},
9
+ {"path": "../perseus-core/tsconfig-build.json"},
9
10
  ]
10
11
  }