@khanacademy/math-input 23.0.6 → 25.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/dist/es/index.js CHANGED
@@ -18,8 +18,11 @@ import { withActionScheduler } from '@khanacademy/wonder-blocks-timing';
18
18
  import PropTypes from 'prop-types';
19
19
 
20
20
  // This file is processed by a Rollup plugin (replace) to inject the production
21
+ // version number during the release build.
22
+ // In dev, you'll never see the version number.
23
+
21
24
  const libName = "@khanacademy/math-input";
22
- const libVersion = "23.0.6";
25
+ const libVersion = "25.0.0";
23
26
  addLibraryVersionToPerseusDebug(libName, libVersion);
24
27
 
25
28
  class View extends React.Component {
@@ -76,6 +79,7 @@ View.styles = StyleSheet.create({
76
79
  * The translated strings that are used to render the Math Input.
77
80
  */
78
81
 
82
+
79
83
  /**
80
84
  * Mock strings for the Math Input package, to be used for tests and Storybook.
81
85
  */
@@ -220,7 +224,7 @@ class CursorHandle extends React.Component {
220
224
  // This is essentially webapp's interactiveComponent + 1.
221
225
  // TODO(charlie): Pull in those styles somehow to avoid breakages.
222
226
  zIndex: 4,
223
- left: -touchTargetWidthPx / 2,
227
+ left: -44 / 2,
224
228
  top: 0,
225
229
  transform: transformString,
226
230
  width: touchTargetWidthPx,
@@ -691,6 +695,7 @@ function getCursorContext(mathField) {
691
695
 
692
696
  // If that didn't work, check if the parent or grandparent is a special
693
697
  // context, so that we can jump outwards.
698
+ // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
694
699
  if (isParens(cursor.parent && cursor.parent.parent)) {
695
700
  return CursorContext.IN_PARENS;
696
701
  } else if (isNumerator(cursor.parent)) {
@@ -1292,6 +1297,8 @@ class MathWrapper {
1292
1297
  pressKey(key) {
1293
1298
  const cursor = this.getCursor();
1294
1299
  const translator = this.mobileKeyTranslator[key];
1300
+
1301
+ // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
1295
1302
  if (translator) {
1296
1303
  translator(this.mathField, key);
1297
1304
  }
@@ -1322,7 +1329,10 @@ class MathWrapper {
1322
1329
  * should be placed
1323
1330
  */
1324
1331
  setCursorPosition(x, y, hitNode) {
1332
+ // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
1325
1333
  const el = hitNode || document.elementFromPoint(x, y);
1334
+
1335
+ // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
1326
1336
  if (el) {
1327
1337
  const cursor = this.getCursor();
1328
1338
  if (el.hasAttribute("mq-root-block")) {
@@ -1644,6 +1654,8 @@ class MathInput extends React.Component {
1644
1654
  // @ts-expect-error - TS2531 - Object is possibly 'null'.
1645
1655
  const id = element.getAttribute("mathquill-command-id");
1646
1656
  if (id != null) {
1657
+
1658
+ // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
1647
1659
  counts[id] = (counts[id] || 0) + 1;
1648
1660
  elementsById[id] = element;
1649
1661
  } else {
@@ -4533,6 +4545,7 @@ const expandedViewThreshold = 500;
4533
4545
  // based on the cursorContext prop. It is used in the keypad to determine
4534
4546
  // which key to render as the "jump out" key.
4535
4547
  function getCursorContextConfig(strings, cursorContext) {
4548
+ // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
4536
4549
  if (!cursorContext) {
4537
4550
  return null;
4538
4551
  }
@@ -5179,6 +5192,8 @@ const styles$1 = StyleSheet.create({
5179
5192
 
5180
5193
  function flatten(list) {
5181
5194
  const result = [];
5195
+
5196
+ // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
5182
5197
  if (!list) {
5183
5198
  return result;
5184
5199
  }
@@ -5194,6 +5209,8 @@ function flatten(list) {
5194
5209
  function processStyleType(style) {
5195
5210
  const stylesheetStyles = [];
5196
5211
  const inlineStyles = [];
5212
+
5213
+ // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
5197
5214
  if (!style) {
5198
5215
  return {
5199
5216
  style: {},
@@ -5512,6 +5529,7 @@ class MobileKeypadInternals extends React.Component {
5512
5529
  // callback into `configureKeypad`. However, implementing this properly
5513
5530
  // would require middleware, etc., so we just hack it on with
5514
5531
  // `setTimeout` for now.
5532
+ // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
5515
5533
  setTimeout(() => cb && cb());
5516
5534
  };
5517
5535
  this.setCursor = cursor => {
@@ -5647,6 +5665,7 @@ function MobileKeypad(props) {
5647
5665
  * React PropTypes that may be shared between components.
5648
5666
  */
5649
5667
 
5668
+
5650
5669
  // NOTE(jared): This is no longer guaranteed to be React element
5651
5670
  // @deprecated Use `KeypadAPI` Typescript interface instead.
5652
5671
  const keypadElementPropType = PropTypes.shape({