@khanacademy/math-input 4.1.1 → 4.3.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.
Files changed (99) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/components/input/math-wrapper.d.ts +1 -1
  3. package/dist/components/input/math-wrapper.js.flow +1 -1
  4. package/dist/components/input/mathquill-instance.d.ts +14 -3
  5. package/dist/components/input/mathquill-instance.js.flow +18 -3
  6. package/dist/components/input/mathquill-types.d.ts +30 -6
  7. package/dist/components/input/mathquill-types.js.flow +33 -7
  8. package/dist/components/key-handlers/handle-arrow.d.ts +3 -0
  9. package/dist/components/{input/key-handlers → key-handlers}/handle-arrow.js.flow +2 -2
  10. package/dist/components/{input/key-handlers → key-handlers}/handle-backspace.d.ts +1 -1
  11. package/dist/components/{input/key-handlers → key-handlers}/handle-backspace.js.flow +1 -1
  12. package/dist/components/key-handlers/handle-exponent.d.ts +3 -0
  13. package/dist/components/{input/key-handlers → key-handlers}/handle-exponent.js.flow +2 -2
  14. package/dist/components/{input/key-handlers → key-handlers}/handle-jump-out.d.ts +2 -2
  15. package/dist/components/{input/key-handlers → key-handlers}/handle-jump-out.js.flow +2 -2
  16. package/dist/components/key-handlers/key-translator.d.ts +4 -0
  17. package/dist/components/{key-translator.js.flow → key-handlers/key-translator.js.flow} +3 -3
  18. package/dist/components/keypad/index.d.ts +8 -16
  19. package/dist/components/keypad/index.js.flow +10 -22
  20. package/dist/components/keypad/keypad-button.d.ts +12 -0
  21. package/dist/components/keypad/keypad-button.js.flow +18 -0
  22. package/dist/components/keypad/keypad-pages/extras-page.d.ts +9 -0
  23. package/dist/components/keypad/{operators-page/basic-relations-buttons.js.flow → keypad-pages/extras-page.js.flow} +3 -3
  24. package/dist/components/keypad/keypad-pages/geometry-page.d.ts +7 -0
  25. package/dist/components/keypad/{operators-page/logarithms-buttons.js.flow → keypad-pages/geometry-page.js.flow} +1 -3
  26. package/dist/components/keypad/keypad-pages/numbers-page.d.ts +7 -0
  27. package/dist/components/keypad/{operators-page/pre-algebra-buttons.js.flow → keypad-pages/numbers-page.js.flow} +1 -3
  28. package/dist/components/keypad/keypad-pages/operators-page.d.ts +11 -0
  29. package/dist/components/keypad/{geometry-page/index.js.flow → keypad-pages/operators-page.js.flow} +5 -4
  30. package/dist/components/keypad/shared-keys.d.ts +9 -0
  31. package/dist/components/keypad/{numbers-page/types.js.flow → shared-keys.js.flow} +4 -1
  32. package/dist/es/index.js +763 -878
  33. package/dist/es/index.js.map +1 -1
  34. package/dist/index.d.ts +3 -1
  35. package/dist/index.js +740 -878
  36. package/dist/index.js.flow +6 -1
  37. package/dist/index.js.map +1 -1
  38. package/package.json +2 -3
  39. package/src/components/input/__tests__/test-math-wrapper.ts +2 -5
  40. package/src/components/input/math-input.tsx +10 -14
  41. package/src/components/input/math-wrapper.ts +23 -49
  42. package/src/components/input/mathquill-helpers.ts +11 -11
  43. package/src/components/input/mathquill-instance.ts +57 -2
  44. package/src/components/input/mathquill-types.ts +43 -7
  45. package/src/components/{input/key-handlers → key-handlers}/handle-arrow.ts +6 -6
  46. package/src/components/{input/key-handlers → key-handlers}/handle-backspace.ts +19 -17
  47. package/src/components/{input/key-handlers → key-handlers}/handle-exponent.ts +8 -5
  48. package/src/components/{input/key-handlers → key-handlers}/handle-jump-out.ts +15 -10
  49. package/src/components/{key-translator.ts → key-handlers/key-translator.ts} +43 -28
  50. package/src/components/keypad/__tests__/{KeypadButton.test.tsx → keypad-button.test.tsx} +7 -5
  51. package/src/components/keypad/__tests__/keypad-v2-mathquill.test.tsx +231 -0
  52. package/src/components/keypad/__tests__/keypad-v2.cypress.ts +19 -6
  53. package/src/components/keypad/index.tsx +73 -49
  54. package/src/components/keypad/{button.stories.tsx → keypad-button.stories.tsx} +2 -1
  55. package/src/components/keypad/keypad-button.tsx +128 -0
  56. package/src/components/keypad/keypad-mathquill.stories.tsx +24 -26
  57. package/src/components/keypad/keypad-pages/extras-page.tsx +34 -0
  58. package/src/components/keypad/keypad-pages/geometry-page.tsx +33 -0
  59. package/src/components/keypad/keypad-pages/numbers-page.tsx +84 -0
  60. package/src/components/keypad/keypad-pages/operators-page.tsx +116 -0
  61. package/src/components/keypad/shared-keys.tsx +78 -0
  62. package/src/index.ts +6 -1
  63. package/tsconfig-build.tsbuildinfo +1 -1
  64. package/dist/components/input/key-handlers/handle-arrow.d.ts +0 -3
  65. package/dist/components/input/key-handlers/handle-exponent.d.ts +0 -3
  66. package/dist/components/key-translator.d.ts +0 -4
  67. package/dist/components/keypad/button.d.ts +0 -12
  68. package/dist/components/keypad/button.js.flow +0 -18
  69. package/dist/components/keypad/extras-page/index.d.ts +0 -10
  70. package/dist/components/keypad/extras-page/index.js.flow +0 -15
  71. package/dist/components/keypad/geometry-page/index.d.ts +0 -9
  72. package/dist/components/keypad/keypad-page-items.d.ts +0 -26
  73. package/dist/components/keypad/keypad-page-items.js.flow +0 -40
  74. package/dist/components/keypad/numbers-page/index.d.ts +0 -10
  75. package/dist/components/keypad/numbers-page/index.js.flow +0 -18
  76. package/dist/components/keypad/numbers-page/types.d.ts +0 -4
  77. package/dist/components/keypad/operators-page/advanced-relations-buttons.d.ts +0 -8
  78. package/dist/components/keypad/operators-page/advanced-relations-buttons.js.flow +0 -13
  79. package/dist/components/keypad/operators-page/basic-relations-buttons.d.ts +0 -8
  80. package/dist/components/keypad/operators-page/index.d.ts +0 -10
  81. package/dist/components/keypad/operators-page/index.js.flow +0 -18
  82. package/dist/components/keypad/operators-page/logarithms-buttons.d.ts +0 -8
  83. package/dist/components/keypad/operators-page/pre-algebra-buttons.d.ts +0 -8
  84. package/dist/components/keypad/operators-page/types.d.ts +0 -6
  85. package/dist/components/keypad/operators-page/types.js.flow +0 -12
  86. package/src/components/keypad/__tests__/Button.test.tsx +0 -51
  87. package/src/components/keypad/button.tsx +0 -108
  88. package/src/components/keypad/extras-page/index.tsx +0 -27
  89. package/src/components/keypad/geometry-page/index.tsx +0 -89
  90. package/src/components/keypad/keypad-page-items.tsx +0 -118
  91. package/src/components/keypad/numbers-page/index.tsx +0 -136
  92. package/src/components/keypad/numbers-page/types.ts +0 -4
  93. package/src/components/keypad/operators-page/advanced-relations-buttons.tsx +0 -33
  94. package/src/components/keypad/operators-page/basic-relations-buttons.tsx +0 -33
  95. package/src/components/keypad/operators-page/index.tsx +0 -94
  96. package/src/components/keypad/operators-page/logarithms-buttons.tsx +0 -33
  97. package/src/components/keypad/operators-page/pre-algebra-buttons.tsx +0 -37
  98. package/src/components/keypad/operators-page/types.ts +0 -6
  99. /package/src/components/keypad/{keypad-pages.stories.tsx → keypad-pages/keypad-pages.stories.tsx} +0 -0
package/dist/index.js CHANGED
@@ -41,7 +41,6 @@ function _interopNamespace(e) {
41
41
  var Color__default = /*#__PURE__*/_interopDefaultLegacy(Color);
42
42
  var i18n__namespace = /*#__PURE__*/_interopNamespace(i18n);
43
43
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
44
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
45
44
  var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
46
45
  var $__default = /*#__PURE__*/_interopDefaultLegacy($);
47
46
  var MathQuill__default = /*#__PURE__*/_interopDefaultLegacy(MathQuill);
@@ -401,274 +400,52 @@ class DragListener {
401
400
  }
402
401
  }
403
402
 
404
- /**
405
- * Constants that are shared between multiple files.
406
- */
407
-
408
- let KeypadType = /*#__PURE__*/function (KeypadType) {
409
- KeypadType["FRACTION"] = "FRACTION";
410
- KeypadType["EXPRESSION"] = "EXPRESSION";
411
- return KeypadType;
412
- }({});
413
- const KeyTypes = ["EMPTY",
414
- // For numerals, variables, and any other characters that themselves
415
- // compose 'values'.
416
- "VALUE",
417
- // For buttons that insert or adjust math in an input.
418
- "OPERATOR",
419
- // For buttons that move the cursor in an input (including via
420
- // deletion).
421
- "INPUT_NAVIGATION",
422
- // For buttons that modify the broader keypad state (e.g., by changing
423
- // the visible pane).
424
- "KEYPAD_NAVIGATION",
425
- // For buttons that house multiple buttons and have no action
426
- // themselves.
427
- "MANY",
428
- // For the echo animation that appears on press.
429
- "ECHO"];
430
- let DeviceOrientation = /*#__PURE__*/function (DeviceOrientation) {
431
- DeviceOrientation["LANDSCAPE"] = "LANDSCAPE";
432
- DeviceOrientation["PORTRAIT"] = "PORTRAIT";
433
- return DeviceOrientation;
434
- }({});
435
- let DeviceType = /*#__PURE__*/function (DeviceType) {
436
- DeviceType["PHONE"] = "PHONE";
437
- DeviceType["TABLET"] = "TABLET";
438
- return DeviceType;
439
- }({});
440
- let LayoutMode = /*#__PURE__*/function (LayoutMode) {
441
- LayoutMode["FULLSCREEN"] = "FULLSCREEN";
442
- LayoutMode["COMPACT"] = "COMPACT";
443
- return LayoutMode;
444
- }({});
445
- let BorderDirection = /*#__PURE__*/function (BorderDirection) {
446
- BorderDirection["LEFT"] = "LEFT";
447
- BorderDirection["BOTTOM"] = "BOTTOM";
448
- return BorderDirection;
449
- }({});
450
- const BorderStyles = {
451
- LEFT: [BorderDirection.LEFT],
452
- BOTTOM: [BorderDirection.BOTTOM],
453
- ALL: [BorderDirection.LEFT, BorderDirection.BOTTOM],
454
- NONE: []
455
- };
456
- let IconType = /*#__PURE__*/function (IconType) {
457
- IconType["MATH"] = "MATH";
458
- IconType["SVG"] = "SVG";
459
- IconType["TEXT"] = "TEXT";
460
- return IconType;
461
- }({});
462
- let DecimalSeparator = /*#__PURE__*/function (DecimalSeparator) {
463
- DecimalSeparator["COMMA"] = "COMMA";
464
- DecimalSeparator["PERIOD"] = "PERIOD";
465
- return DecimalSeparator;
466
- }({});
467
- let EchoAnimationType = /*#__PURE__*/function (EchoAnimationType) {
468
- EchoAnimationType["SLIDE_AND_FADE"] = "SLIDE_AND_FADE";
469
- EchoAnimationType["FADE_ONLY"] = "FADE_ONLY";
470
- EchoAnimationType["LONG_FADE_ONLY"] = "LONG_FADE_ONLY";
471
- return EchoAnimationType;
472
- }({});
473
-
474
- // NOTES(kevinb):
475
- // - In order to get the correct decimal separator for the current locale,
476
- // the locale must bet set using `setLocale(kaLocale)` which can be
477
- // imported from wonder-blocks-i18n.
478
- // - Some languages/locales use different decimal separators than the ones
479
- // listed here. Much of the Arab world uses U+066C.
480
- const decimalSeparator = i18n.getDecimalSeparator() === "," ? DecimalSeparator.COMMA : DecimalSeparator.PERIOD;
481
-
482
- var MQ = MathQuill__default["default"].getInterface(2);
483
-
484
- var ActionType = /*#__PURE__*/function (ActionType) {
485
- ActionType["WRITE"] = "write";
486
- ActionType["CMD"] = "cmd";
487
- ActionType["KEYSTROKE"] = "keystroke";
488
- ActionType[ActionType["MQ_END"] = 0] = "MQ_END";
489
- return ActionType;
490
- }(ActionType || {});
491
- const decimalSymbol = decimalSeparator === DecimalSeparator.COMMA ? "," : ".";
492
- function buildGenericCallback(str) {
493
- let type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ActionType.WRITE;
494
- return function (mathQuill) {
495
- switch (type) {
496
- case ActionType.WRITE:
497
- {
498
- mathQuill.write(str);
499
- return;
500
- }
501
- case ActionType.CMD:
502
- {
503
- mathQuill.cmd(str);
504
- return;
505
- }
506
- case ActionType.KEYSTROKE:
507
- {
508
- mathQuill.keystroke(str);
509
- return;
510
- }
511
- }
403
+ // We only need one MathQuill instance (referred to as MQ in the docs)
404
+ // and that contains some MQ constants and the MathField constructor
405
+ const mathQuillInstance = MathQuill__default["default"].getInterface(2);
406
+ function createBaseConfig() {
407
+ return {
408
+ // LaTeX commands that, when typed, are immediately replaced by the
409
+ // appropriate symbol. This does not include ln, log, or any of the
410
+ // trig functions; those are always interpreted as commands.
411
+ autoCommands: "pi theta phi sqrt nthroot",
412
+ // Pop the cursor out of super/subscripts on arithmetic operators
413
+ // or (in)equalities.
414
+ charsThatBreakOutOfSupSub: "+-*/=<>≠≤≥",
415
+ // Prevent excessive super/subscripts or fractions from being
416
+ // created without operands, e.g. when somebody holds down a key
417
+ supSubsRequireOperand: true,
418
+ // The name of this option is somewhat misleading, as tabbing in
419
+ // MathQuill breaks you out of a nested context (fraction/script)
420
+ // if you're in one, but moves focus to the next input if you're
421
+ // not. Spaces (with this option enabled) are just ignored in the
422
+ // latter case.
423
+ //
424
+ // TODO(alex): In order to allow inputting mixed numbers, we will
425
+ // have to accept spaces in certain cases. The desired behavior is
426
+ // still to escape nested contexts if currently in one, but to
427
+ // insert a space if not (we don't expect mixed numbers in nested
428
+ // contexts). We should also limit to one consecutive space.
429
+ spaceBehavesLikeTab: true
512
430
  };
513
431
  }
514
- const keyToMathquillMap = {
515
- CDOT: buildGenericCallback("\\cdot"),
516
- COS: buildGenericCallback("cos"),
517
- DECIMAL: buildGenericCallback(decimalSymbol),
518
- DIVIDE: buildGenericCallback("\\div"),
519
- EQUAL: buildGenericCallback("="),
520
- EXP: buildGenericCallback("^"),
521
- EXP_2: buildGenericCallback("^2"),
522
- EXP_3: buildGenericCallback("^3"),
523
- GEQ: buildGenericCallback("\\geq"),
524
- GT: buildGenericCallback(">"),
525
- LEQ: buildGenericCallback("\\leq"),
526
- LN: buildGenericCallback("\\ln"),
527
- LOG: buildGenericCallback("\\log"),
528
- LT: buildGenericCallback("<"),
529
- MINUS: buildGenericCallback("-"),
530
- NEGATIVE: buildGenericCallback("-"),
531
- NEQ: buildGenericCallback("\\neq"),
532
- PERCENT: buildGenericCallback("%"),
533
- PERIOD: buildGenericCallback("."),
534
- PLUS: buildGenericCallback("+"),
535
- SIN: buildGenericCallback("sin"),
536
- TAN: buildGenericCallback("tan"),
537
- TIMES: buildGenericCallback("\\times"),
538
- // The `FRAC_EXCLUSIVE` variant is handled manually, since we may need to do
539
- // some additional navigation depending on the cursor position.
540
- FRAC_INCLUSIVE: buildGenericCallback("/", ActionType.CMD),
541
- LEFT_PAREN: buildGenericCallback("(", ActionType.CMD),
542
- RIGHT_PAREN: buildGenericCallback(")", ActionType.CMD),
543
- SQRT: buildGenericCallback("sqrt", ActionType.CMD),
544
- PHI: buildGenericCallback("\\phi", ActionType.CMD),
545
- PI: buildGenericCallback("pi", ActionType.CMD),
546
- THETA: buildGenericCallback("theta", ActionType.CMD),
547
- RADICAL: buildGenericCallback("nthroot", ActionType.CMD),
548
- UP: buildGenericCallback("Up", ActionType.KEYSTROKE),
549
- DOWN: buildGenericCallback("Down", ActionType.KEYSTROKE),
550
- CUBE_ROOT: mathQuill => {
551
- mathQuill.write("\\sqrt[3]{}");
552
- mathQuill.keystroke("Left"); // under the root
553
- },
554
-
555
- FRAC_EXCLUSIVE: mathQuill => {
556
- const cursor = mathQuill.__controller.cursor;
557
- // If there's nothing to the left of the cursor, then we want to
558
- // leave the cursor to the left of the fraction after creating it.
559
- const shouldNavigateLeft = cursor[MQ.L] === ActionType.MQ_END;
560
- mathQuill.cmd("\\frac");
561
- if (shouldNavigateLeft) {
562
- mathQuill.keystroke("Left");
563
- }
564
- },
565
- LOG_B: mathQuill => {
566
- mathQuill.typedText("log_");
567
- mathQuill.keystroke("Right");
568
- mathQuill.typedText("(");
569
- mathQuill.keystroke("Left");
570
- mathQuill.keystroke("Left");
571
- },
572
- LOG_N: mathQuill => {
573
- mathQuill.write("log_{ }\\left(\\right)");
574
- mathQuill.keystroke("Left"); // into parentheses
575
- mathQuill.keystroke("Left"); // out of parentheses
576
- mathQuill.keystroke("Left"); // into index
577
- },
578
-
579
- NTHROOT3: mathQuill => {
580
- mathQuill.typedText("nthroot3");
581
- mathQuill.keystroke("Right");
582
- },
583
- POW: mathQuill => {
584
- const contents = mathQuill.latex();
585
- mathQuill.typedText("^");
586
432
 
587
- // If the input hasn't changed (for example, if we're
588
- // attempting to add an exponent on an empty input or an empty
589
- // denominator), insert our own "a^b"
590
- if (mathQuill.latex() === contents) {
591
- mathQuill.typedText("a^b");
592
- }
593
- },
594
- // These need to be overwritten by the consumer
595
- // if they're going to be used
596
- FRAC: () => {},
597
- RIGHT: () => {},
598
- LEFT: () => {},
599
- BACKSPACE: () => {},
600
- DISMISS: () => {},
601
- JUMP_OUT_PARENTHESES: () => {},
602
- JUMP_OUT_EXPONENT: () => {},
603
- JUMP_OUT_BASE: () => {},
604
- JUMP_INTO_NUMERATOR: () => {},
605
- JUMP_OUT_NUMERATOR: () => {},
606
- JUMP_OUT_DENOMINATOR: () => {},
607
- NOOP: () => {},
608
- MANY: () => {},
609
- NUM_0: buildGenericCallback("0"),
610
- NUM_1: buildGenericCallback("1"),
611
- NUM_2: buildGenericCallback("2"),
612
- NUM_3: buildGenericCallback("3"),
613
- NUM_4: buildGenericCallback("4"),
614
- NUM_5: buildGenericCallback("5"),
615
- NUM_6: buildGenericCallback("6"),
616
- NUM_7: buildGenericCallback("7"),
617
- NUM_8: buildGenericCallback("8"),
618
- NUM_9: buildGenericCallback("9"),
619
- a: buildGenericCallback("a"),
620
- b: buildGenericCallback("b"),
621
- c: buildGenericCallback("c"),
622
- d: buildGenericCallback("d"),
623
- e: buildGenericCallback("e"),
624
- f: buildGenericCallback("f"),
625
- g: buildGenericCallback("g"),
626
- h: buildGenericCallback("h"),
627
- i: buildGenericCallback("i"),
628
- j: buildGenericCallback("j"),
629
- k: buildGenericCallback("k"),
630
- l: buildGenericCallback("l"),
631
- m: buildGenericCallback("m"),
632
- n: buildGenericCallback("n"),
633
- o: buildGenericCallback("o"),
634
- p: buildGenericCallback("p"),
635
- q: buildGenericCallback("q"),
636
- r: buildGenericCallback("r"),
637
- s: buildGenericCallback("s"),
638
- t: buildGenericCallback("t"),
639
- u: buildGenericCallback("u"),
640
- v: buildGenericCallback("v"),
641
- w: buildGenericCallback("w"),
642
- x: buildGenericCallback("x"),
643
- y: buildGenericCallback("y"),
644
- z: buildGenericCallback("z"),
645
- A: buildGenericCallback("A"),
646
- B: buildGenericCallback("B"),
647
- C: buildGenericCallback("C"),
648
- D: buildGenericCallback("D"),
649
- E: buildGenericCallback("E"),
650
- F: buildGenericCallback("F"),
651
- G: buildGenericCallback("G"),
652
- H: buildGenericCallback("H"),
653
- I: buildGenericCallback("I"),
654
- J: buildGenericCallback("J"),
655
- K: buildGenericCallback("K"),
656
- L: buildGenericCallback("L"),
657
- M: buildGenericCallback("M"),
658
- N: buildGenericCallback("N"),
659
- O: buildGenericCallback("O"),
660
- P: buildGenericCallback("P"),
661
- Q: buildGenericCallback("Q"),
662
- R: buildGenericCallback("R"),
663
- S: buildGenericCallback("S"),
664
- T: buildGenericCallback("T"),
665
- U: buildGenericCallback("U"),
666
- V: buildGenericCallback("V"),
667
- W: buildGenericCallback("W"),
668
- X: buildGenericCallback("X"),
669
- Y: buildGenericCallback("Y"),
670
- Z: buildGenericCallback("Z")
671
- };
433
+ /**
434
+ * Creates a new [MathField](http://docs.mathquill.com/en/latest/Api_Methods/#mqmathfieldhtml_element-config)
435
+ * instance within the given `container`.
436
+ *
437
+ * An optional configuration callback can be provided to customize
438
+ * the created MathField. A default configuration is passed to this
439
+ * callback which can then be adjusted as needed. The configuration
440
+ * returned from this callback is used to create the MathField.
441
+ * This allows callers to do minimal configuration as only configs
442
+ * that vary from the default need to be provided.
443
+ */
444
+ function createMathField(container, configCallback) {
445
+ const baseConfig = createBaseConfig();
446
+ const config = configCallback ? configCallback(baseConfig) : baseConfig;
447
+ return mathQuillInstance.MathField(container, config);
448
+ }
672
449
 
673
450
  let MathFieldActionType = /*#__PURE__*/function (MathFieldActionType) {
674
451
  MathFieldActionType["WRITE"] = "write";
@@ -739,7 +516,7 @@ function isInsideLogIndex(cursor) {
739
516
  return false;
740
517
  }
741
518
  function isInsideEmptyNode(cursor) {
742
- return cursor[MQ.L] === MathFieldActionType.MQ_END && cursor[MQ.R] === MathFieldActionType.MQ_END;
519
+ return cursor[mathQuillInstance.L] === MathFieldActionType.MQ_END && cursor[mathQuillInstance.R] === MathFieldActionType.MQ_END;
743
520
  }
744
521
  function selectNode(node, cursor) {
745
522
  cursor.insLeftOf(node);
@@ -799,7 +576,7 @@ function maybeFindCommand(initialNode) {
799
576
  } else {
800
577
  break;
801
578
  }
802
- node = node[MQ.L];
579
+ node = node[mathQuillInstance.L];
803
580
  }
804
581
 
805
582
  // If we hit the start of a command, then grab the rest of it by
@@ -807,7 +584,7 @@ function maybeFindCommand(initialNode) {
807
584
  // with its terminal node.
808
585
  if (startNode) {
809
586
  // Next, iterate from the start to the right.
810
- node = initialNode[MQ.R];
587
+ node = initialNode[mathQuillInstance.R];
811
588
  while (node !== 0) {
812
589
  const ctrlSeq = node.ctrlSeq.trim();
813
590
  if (commandCharRegex.test(ctrlSeq)) {
@@ -820,7 +597,7 @@ function maybeFindCommand(initialNode) {
820
597
  endNode = node;
821
598
  break;
822
599
  }
823
- node = node[MQ.R];
600
+ node = node[mathQuillInstance.R];
824
601
  }
825
602
  if (validCommands.includes(name)) {
826
603
  return {
@@ -846,18 +623,18 @@ function maybeFindCommand(initialNode) {
846
623
  * name (`name`) of the command
847
624
  */
848
625
  function maybeFindCommandBeforeParens(leftParenNode) {
849
- return maybeFindCommand(leftParenNode[MQ.L]);
626
+ return maybeFindCommand(leftParenNode[mathQuillInstance.L]);
850
627
  }
851
628
  function contextForCursor(cursor) {
852
629
  // First, try to find any fraction to the right, unimpeded.
853
630
  let visitor = cursor;
854
- while (visitor[MQ.R] !== MathFieldActionType.MQ_END) {
855
- if (isFraction(visitor[MQ.R])) {
631
+ while (visitor[mathQuillInstance.R] !== MathFieldActionType.MQ_END) {
632
+ if (isFraction(visitor[mathQuillInstance.R])) {
856
633
  return CursorContext.BEFORE_FRACTION;
857
- } else if (!isLeaf(visitor[MQ.R])) {
634
+ } else if (!isLeaf(visitor[mathQuillInstance.R])) {
858
635
  break;
859
636
  }
860
- visitor = visitor[MQ.R];
637
+ visitor = visitor[mathQuillInstance.R];
861
638
  }
862
639
 
863
640
  // If that didn't work, check if the parent or grandparent is a special
@@ -877,57 +654,8 @@ function contextForCursor(cursor) {
877
654
  }
878
655
  }
879
656
 
880
- function handleLeftArrow(mathField, cursor) {
881
- // If we're inside a function, and just after the left parentheses, we
882
- // need to skip the entire function name, rather than move the cursor
883
- // inside of it. For example, when hitting left from within the
884
- // parentheses in `cos()`, we want to place the cursor to the left of
885
- // the entire expression, rather than between the `s` and the left
886
- // parenthesis.
887
- // From the cursor's perspective, this requires that our left node is
888
- // the ActionType.MQ_END node, that our grandparent is the left parenthesis, and
889
- // the nodes to the left of our grandparent comprise a valid function
890
- // name.
891
- if (cursor[MQ.L] === MathFieldActionType.MQ_END) {
892
- const parent = cursor.parent;
893
- const grandparent = parent.parent;
894
- if (grandparent.ctrlSeq === "\\left(") {
895
- const command = maybeFindCommandBeforeParens(grandparent);
896
- if (command) {
897
- cursor.insLeftOf(command.startNode);
898
- return;
899
- }
900
- }
901
- }
902
-
903
- // Otherwise, we default to the standard MathQull left behavior.
904
- mathField.keystroke("Left");
905
- }
906
- function handleRightArrow(mathField, cursor) {
907
- const command = maybeFindCommand(cursor[MQ.R]);
908
- if (command) {
909
- // Similarly, if a function is to our right, then we need to place
910
- // the cursor at the start of its parenthetical content, which is
911
- // done by putting it to the left of ites parentheses and then
912
- // moving right once.
913
- cursor.insLeftOf(command.endNode);
914
- mathField.keystroke("Right");
915
- } else {
916
- // Otherwise, we default to the standard MathQull right behavior.
917
- mathField.keystroke("Right");
918
- }
919
- }
920
- function handleArrow(mathField, key) {
921
- const cursor = getCursor(mathField);
922
- if (key === "LEFT") {
923
- handleLeftArrow(mathField, cursor);
924
- } else if (key === "RIGHT") {
925
- handleRightArrow(mathField, cursor);
926
- }
927
- }
928
-
929
657
  function handleBackspaceInNthRoot(mathField, cursor) {
930
- const isAtLeftEnd = cursor[MQ.L] === MathFieldActionType.MQ_END;
658
+ const isAtLeftEnd = cursor[mathQuillInstance.L] === MathFieldActionType.MQ_END;
931
659
  const isRootEmpty = isInsideEmptyNode(cursor.parent.parent.blocks[0].ends);
932
660
  if (isAtLeftEnd) {
933
661
  selectNode(cursor.parent.parent, cursor);
@@ -946,7 +674,7 @@ function handleBackspaceInRootIndex(mathField, cursor) {
946
674
 
947
675
  const grandparent = cursor.parent.parent;
948
676
  const latex = grandparent.latex();
949
- const reinsertionPoint = grandparent[MQ.L];
677
+ const reinsertionPoint = grandparent[mathQuillInstance.L];
950
678
  selectNode(grandparent, cursor);
951
679
  const rootIsEmpty = grandparent.blocks[1].jQ.text() === "";
952
680
  if (rootIsEmpty) {
@@ -965,13 +693,13 @@ function handleBackspaceInRootIndex(mathField, cursor) {
965
693
 
966
694
  // Adjust the cursor to be to the left the sqrt.
967
695
  if (reinsertionPoint === MathFieldActionType.MQ_END) {
968
- mathField.moveToDirEnd(MQ.L);
696
+ mathField.moveToDirEnd(mathQuillInstance.L);
969
697
  } else {
970
698
  cursor.insRightOf(reinsertionPoint);
971
699
  }
972
700
  }
973
701
  } else {
974
- if (cursor[MQ.L] !== MathFieldActionType.MQ_END) {
702
+ if (cursor[mathQuillInstance.L] !== MathFieldActionType.MQ_END) {
975
703
  // If the cursor is not at the leftmost position inside the
976
704
  // root's index, delete a character.
977
705
  mathField.keystroke("Backspace");
@@ -984,14 +712,14 @@ function handleBackspaceInLogIndex(mathField, cursor) {
984
712
  const command = maybeFindCommandBeforeParens(grandparent);
985
713
  cursor.insLeftOf(command === null || command === void 0 ? void 0 : command.startNode);
986
714
  cursor.startSelection();
987
- if (grandparent[MQ.R] !== MathFieldActionType.MQ_END) {
988
- cursor.insRightOf(grandparent[MQ.R]);
715
+ if (grandparent[mathQuillInstance.R] !== MathFieldActionType.MQ_END) {
716
+ cursor.insRightOf(grandparent[mathQuillInstance.R]);
989
717
  } else {
990
718
  cursor.insRightOf(grandparent);
991
719
  }
992
720
  cursor.select();
993
721
  cursor.endSelection();
994
- const isLogBodyEmpty = grandparent[MQ.R].contentjQ.text() === "";
722
+ const isLogBodyEmpty = grandparent[mathQuillInstance.R].contentjQ.text() === "";
995
723
  if (isLogBodyEmpty) {
996
724
  // If there's no content inside the log's parens then delete the
997
725
  // whole thing.
@@ -1010,8 +738,8 @@ function handleBackspaceOutsideParens(cursor) {
1010
738
  // (x+1)| => |(x+1)|
1011
739
  // \log(x+1)| => |\log(x+1)|
1012
740
 
1013
- const leftNode = cursor[MQ.L];
1014
- const rightNode = cursor[MQ.R];
741
+ const leftNode = cursor[mathQuillInstance.L];
742
+ const rightNode = cursor[mathQuillInstance.R];
1015
743
  const command = maybeFindCommandBeforeParens(leftNode);
1016
744
  if (command && command.startNode) {
1017
745
  // There's a command before the parens so we select it as well as
@@ -1057,7 +785,7 @@ function handleBackspaceInsideParens(mathField, cursor) {
1057
785
  // - \log(|x+1) => |\log(x+1)|
1058
786
  // - \log(|) => |
1059
787
 
1060
- if (cursor[MQ.L] !== MathFieldActionType.MQ_END) {
788
+ if (cursor[mathQuillInstance.L] !== MathFieldActionType.MQ_END) {
1061
789
  // This command contains math and there's some math to
1062
790
  // the left of the cursor that we should delete normally
1063
791
  // before doing anything special.
@@ -1070,12 +798,12 @@ function handleBackspaceInsideParens(mathField, cursor) {
1070
798
  // has a subscript as is the case in log_n then move the cursor into
1071
799
  // the subscript, e.g. \log_{5}(|x+1) => \log_{5|}(x+1)
1072
800
 
1073
- if (grandparent[MQ.L].sub) {
801
+ if (grandparent[mathQuillInstance.L].sub) {
1074
802
  // if there is a subscript
1075
- if (grandparent[MQ.L].sub.jQ.text()) {
803
+ if (grandparent[mathQuillInstance.L].sub.jQ.text()) {
1076
804
  // and it contains text
1077
805
  // move the cursor to the right end of the subscript
1078
- cursor.insAtRightEnd(grandparent[MQ.L].sub);
806
+ cursor.insAtRightEnd(grandparent[mathQuillInstance.L].sub);
1079
807
  return;
1080
808
  }
1081
809
  }
@@ -1113,7 +841,7 @@ function handleBackspace(mathField) {
1113
841
  if (!cursor.selection) {
1114
842
  const parent = cursor.parent;
1115
843
  const grandparent = parent.parent;
1116
- const leftNode = cursor[MQ.L];
844
+ const leftNode = cursor[mathQuillInstance.L];
1117
845
  if (isFraction(leftNode)) {
1118
846
  selectNode(leftNode, cursor);
1119
847
  } else if (isSquareRoot(leftNode)) {
@@ -1140,6 +868,133 @@ function handleBackspace(mathField) {
1140
868
  }
1141
869
  }
1142
870
 
871
+ /**
872
+ * Constants that are shared between multiple files.
873
+ */
874
+
875
+ let KeypadType = /*#__PURE__*/function (KeypadType) {
876
+ KeypadType["FRACTION"] = "FRACTION";
877
+ KeypadType["EXPRESSION"] = "EXPRESSION";
878
+ return KeypadType;
879
+ }({});
880
+ const KeyTypes = ["EMPTY",
881
+ // For numerals, variables, and any other characters that themselves
882
+ // compose 'values'.
883
+ "VALUE",
884
+ // For buttons that insert or adjust math in an input.
885
+ "OPERATOR",
886
+ // For buttons that move the cursor in an input (including via
887
+ // deletion).
888
+ "INPUT_NAVIGATION",
889
+ // For buttons that modify the broader keypad state (e.g., by changing
890
+ // the visible pane).
891
+ "KEYPAD_NAVIGATION",
892
+ // For buttons that house multiple buttons and have no action
893
+ // themselves.
894
+ "MANY",
895
+ // For the echo animation that appears on press.
896
+ "ECHO"];
897
+ let DeviceOrientation = /*#__PURE__*/function (DeviceOrientation) {
898
+ DeviceOrientation["LANDSCAPE"] = "LANDSCAPE";
899
+ DeviceOrientation["PORTRAIT"] = "PORTRAIT";
900
+ return DeviceOrientation;
901
+ }({});
902
+ let DeviceType = /*#__PURE__*/function (DeviceType) {
903
+ DeviceType["PHONE"] = "PHONE";
904
+ DeviceType["TABLET"] = "TABLET";
905
+ return DeviceType;
906
+ }({});
907
+ let LayoutMode = /*#__PURE__*/function (LayoutMode) {
908
+ LayoutMode["FULLSCREEN"] = "FULLSCREEN";
909
+ LayoutMode["COMPACT"] = "COMPACT";
910
+ return LayoutMode;
911
+ }({});
912
+ let BorderDirection = /*#__PURE__*/function (BorderDirection) {
913
+ BorderDirection["LEFT"] = "LEFT";
914
+ BorderDirection["BOTTOM"] = "BOTTOM";
915
+ return BorderDirection;
916
+ }({});
917
+ const BorderStyles = {
918
+ LEFT: [BorderDirection.LEFT],
919
+ BOTTOM: [BorderDirection.BOTTOM],
920
+ ALL: [BorderDirection.LEFT, BorderDirection.BOTTOM],
921
+ NONE: []
922
+ };
923
+ let IconType = /*#__PURE__*/function (IconType) {
924
+ IconType["MATH"] = "MATH";
925
+ IconType["SVG"] = "SVG";
926
+ IconType["TEXT"] = "TEXT";
927
+ return IconType;
928
+ }({});
929
+ let DecimalSeparator = /*#__PURE__*/function (DecimalSeparator) {
930
+ DecimalSeparator["COMMA"] = "COMMA";
931
+ DecimalSeparator["PERIOD"] = "PERIOD";
932
+ return DecimalSeparator;
933
+ }({});
934
+ let EchoAnimationType = /*#__PURE__*/function (EchoAnimationType) {
935
+ EchoAnimationType["SLIDE_AND_FADE"] = "SLIDE_AND_FADE";
936
+ EchoAnimationType["FADE_ONLY"] = "FADE_ONLY";
937
+ EchoAnimationType["LONG_FADE_ONLY"] = "LONG_FADE_ONLY";
938
+ return EchoAnimationType;
939
+ }({});
940
+
941
+ // NOTES(kevinb):
942
+ // - In order to get the correct decimal separator for the current locale,
943
+ // the locale must bet set using `setLocale(kaLocale)` which can be
944
+ // imported from wonder-blocks-i18n.
945
+ // - Some languages/locales use different decimal separators than the ones
946
+ // listed here. Much of the Arab world uses U+066C.
947
+ const decimalSeparator = i18n.getDecimalSeparator() === "," ? DecimalSeparator.COMMA : DecimalSeparator.PERIOD;
948
+
949
+ function handleLeftArrow(mathField, cursor) {
950
+ // If we're inside a function, and just after the left parentheses, we
951
+ // need to skip the entire function name, rather than move the cursor
952
+ // inside of it. For example, when hitting left from within the
953
+ // parentheses in `cos()`, we want to place the cursor to the left of
954
+ // the entire expression, rather than between the `s` and the left
955
+ // parenthesis.
956
+ // From the cursor's perspective, this requires that our left node is
957
+ // the ActionType.MQ_END node, that our grandparent is the left parenthesis, and
958
+ // the nodes to the left of our grandparent comprise a valid function
959
+ // name.
960
+ if (cursor[mathQuillInstance.L] === MathFieldActionType.MQ_END) {
961
+ const parent = cursor.parent;
962
+ const grandparent = parent.parent;
963
+ if (grandparent.ctrlSeq === "\\left(") {
964
+ const command = maybeFindCommandBeforeParens(grandparent);
965
+ if (command) {
966
+ cursor.insLeftOf(command.startNode);
967
+ return;
968
+ }
969
+ }
970
+ }
971
+
972
+ // Otherwise, we default to the standard MathQull left behavior.
973
+ mathField.keystroke("Left");
974
+ }
975
+ function handleRightArrow(mathField, cursor) {
976
+ const command = maybeFindCommand(cursor[mathQuillInstance.R]);
977
+ if (command) {
978
+ // Similarly, if a function is to our right, then we need to place
979
+ // the cursor at the start of its parenthetical content, which is
980
+ // done by putting it to the left of ites parentheses and then
981
+ // moving right once.
982
+ cursor.insLeftOf(command.endNode);
983
+ mathField.keystroke("Right");
984
+ } else {
985
+ // Otherwise, we default to the standard MathQull right behavior.
986
+ mathField.keystroke("Right");
987
+ }
988
+ }
989
+ function handleArrow(mathField, key) {
990
+ const cursor = getCursor(mathField);
991
+ if (key === "LEFT") {
992
+ handleLeftArrow(mathField, cursor);
993
+ } else if (key === "RIGHT") {
994
+ handleRightArrow(mathField, cursor);
995
+ }
996
+ }
997
+
1143
998
  const ArithmeticOperators = ["+", "-", "\\cdot", "\\times", "\\div"];
1144
999
  const EqualityOperators = ["=", "\\neq", "<", "\\leq", ">", "\\geq"];
1145
1000
  function handleExponent(mathField, key) {
@@ -1148,7 +1003,7 @@ function handleExponent(mathField, key) {
1148
1003
  // knowingly cannot be raised to a power), add an empty set of
1149
1004
  // parentheses and apply the exponent to that.
1150
1005
  const invalidPrefixes = [...ArithmeticOperators, ...EqualityOperators];
1151
- const precedingNode = cursor[MQ.L];
1006
+ const precedingNode = cursor[mathQuillInstance.L];
1152
1007
  const shouldPrefixWithParens = precedingNode === MathFieldActionType.MQ_END || invalidPrefixes.includes(precedingNode.ctrlSeq.trim());
1153
1008
  if (shouldPrefixWithParens) {
1154
1009
  mathField.write("\\left(\\right)");
@@ -1214,11 +1069,11 @@ function handleJumpOut(mathField, key) {
1214
1069
  // Find the nearest fraction to the right of the cursor.
1215
1070
  let fractionNode;
1216
1071
  let visitor = cursor;
1217
- while (visitor[MQ.R] !== MathFieldActionType.MQ_END) {
1218
- if (isFraction(visitor[MQ.R])) {
1219
- fractionNode = visitor[MQ.R];
1072
+ while (visitor[mathQuillInstance.R] !== MathFieldActionType.MQ_END) {
1073
+ if (isFraction(visitor[mathQuillInstance.R])) {
1074
+ fractionNode = visitor[mathQuillInstance.R];
1220
1075
  }
1221
- visitor = visitor[MQ.R];
1076
+ visitor = visitor[mathQuillInstance.R];
1222
1077
  }
1223
1078
 
1224
1079
  // Jump into it!
@@ -1247,7 +1102,7 @@ function handleJumpOut(mathField, key) {
1247
1102
  // Navigate right once more, if we're right before parens. This
1248
1103
  // is to handle the standard case in which the subscript is the
1249
1104
  // base of a custom log.
1250
- if (isParens(cursor[MQ.R])) {
1105
+ if (isParens(cursor[mathQuillInstance.R])) {
1251
1106
  mathField.keystroke("Right");
1252
1107
  }
1253
1108
  break;
@@ -1260,26 +1115,46 @@ function handleJumpOut(mathField, key) {
1260
1115
  }
1261
1116
  }
1262
1117
 
1118
+ var ActionType = /*#__PURE__*/function (ActionType) {
1119
+ ActionType["WRITE"] = "write";
1120
+ ActionType["CMD"] = "cmd";
1121
+ ActionType["KEYSTROKE"] = "keystroke";
1122
+ ActionType[ActionType["MQ_END"] = 0] = "MQ_END";
1123
+ return ActionType;
1124
+ }(ActionType || {});
1125
+ const decimalSymbol = decimalSeparator === DecimalSeparator.COMMA ? "," : ".";
1126
+ function buildGenericCallback(str) {
1127
+ let type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ActionType.WRITE;
1128
+ return function (mathQuill) {
1129
+ switch (type) {
1130
+ case ActionType.WRITE:
1131
+ {
1132
+ mathQuill.write(str);
1133
+ return;
1134
+ }
1135
+ case ActionType.CMD:
1136
+ {
1137
+ mathQuill.cmd(str);
1138
+ return;
1139
+ }
1140
+ case ActionType.KEYSTROKE:
1141
+ {
1142
+ mathQuill.keystroke(str);
1143
+ return;
1144
+ }
1145
+ }
1146
+ };
1147
+ }
1263
1148
  function buildNormalFunctionCallback(command) {
1264
1149
  return function (mathField) {
1265
1150
  mathField.write("\\".concat(command, "\\left(\\right)"));
1266
1151
  mathField.keystroke("Left");
1267
1152
  };
1268
1153
  }
1269
- const customKeyTranslator = {
1270
- ...keyToMathquillMap,
1271
- // note(Matthew): in all likelihood, this should be moved
1272
- // to the shared key2MathQuill translator. During this refactor
1273
- // I tried to keep logic the same while deduplicating code.
1274
- // Perseus' Expression MathInput treats this stuff differently
1275
- // (or doesn't do anything with them at all), so I kept it that way
1276
- BACKSPACE: handleBackspace,
1154
+ const keyToMathquillMap = {
1277
1155
  EXP: handleExponent,
1278
1156
  EXP_2: handleExponent,
1279
1157
  EXP_3: handleExponent,
1280
- FRAC: mathQuill => {
1281
- mathQuill.cmd("\\frac");
1282
- },
1283
1158
  JUMP_OUT_PARENTHESES: handleJumpOut,
1284
1159
  JUMP_OUT_EXPONENT: handleJumpOut,
1285
1160
  JUMP_OUT_BASE: handleJumpOut,
@@ -1292,40 +1167,193 @@ const customKeyTranslator = {
1292
1167
  LN: buildNormalFunctionCallback("ln"),
1293
1168
  SIN: buildNormalFunctionCallback("sin"),
1294
1169
  COS: buildNormalFunctionCallback("cos"),
1295
- TAN: buildNormalFunctionCallback("tan")
1296
- };
1297
-
1298
- /**
1299
- * This file contains a wrapper around MathQuill so that we can provide a
1300
- * more regular interface for the functionality we need while insulating us
1301
- * from MathQuill changes.
1302
- */
1303
- class MathWrapper {
1304
- // MathQuill input
1305
-
1306
- constructor(element) {
1307
- let callbacks = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1308
- _defineProperty(this, "mathField", void 0);
1309
- _defineProperty(this, "callbacks", void 0);
1310
- this.mathField = MQ.MathField(element, {
1311
- // use a span instead of a textarea so that we don't bring up the
1312
- // native keyboard on mobile when selecting the input
1313
- substituteTextarea: function () {
1314
- return document.createElement("span");
1315
- }
1316
- });
1317
- this.callbacks = callbacks;
1318
- }
1319
- focus() {
1320
- // HACK(charlie): We shouldn't reaching into MathQuill internals like
1321
- // this, but it's the easiest way to allow us to manage the focus state
1322
- // ourselves.
1323
- const controller = this.mathField.__controller;
1324
- controller.cursor.show();
1170
+ TAN: buildNormalFunctionCallback("tan"),
1171
+ CDOT: buildGenericCallback("\\cdot"),
1172
+ DECIMAL: buildGenericCallback(decimalSymbol),
1173
+ DIVIDE: buildGenericCallback("\\div"),
1174
+ EQUAL: buildGenericCallback("="),
1175
+ GEQ: buildGenericCallback("\\geq"),
1176
+ GT: buildGenericCallback(">"),
1177
+ LEQ: buildGenericCallback("\\leq"),
1178
+ LT: buildGenericCallback("<"),
1179
+ MINUS: buildGenericCallback("-"),
1180
+ NEGATIVE: buildGenericCallback("-"),
1181
+ NEQ: buildGenericCallback("\\neq"),
1182
+ PERCENT: buildGenericCallback("%"),
1183
+ PERIOD: buildGenericCallback("."),
1184
+ PLUS: buildGenericCallback("+"),
1185
+ TIMES: buildGenericCallback("\\times"),
1186
+ // The `FRAC_EXCLUSIVE` variant is handled manually, since we may need to do
1187
+ // some additional navigation depending on the cursor position.
1188
+ FRAC_INCLUSIVE: buildGenericCallback("/", ActionType.CMD),
1189
+ FRAC: buildGenericCallback("\\frac", ActionType.CMD),
1190
+ LEFT_PAREN: buildGenericCallback("(", ActionType.CMD),
1191
+ RIGHT_PAREN: buildGenericCallback(")", ActionType.CMD),
1192
+ SQRT: buildGenericCallback("sqrt", ActionType.CMD),
1193
+ PHI: buildGenericCallback("\\phi", ActionType.CMD),
1194
+ PI: buildGenericCallback("pi", ActionType.CMD),
1195
+ THETA: buildGenericCallback("theta", ActionType.CMD),
1196
+ RADICAL: buildGenericCallback("nthroot", ActionType.CMD),
1197
+ BACKSPACE: buildGenericCallback("Backspace", ActionType.KEYSTROKE),
1198
+ UP: buildGenericCallback("Up", ActionType.KEYSTROKE),
1199
+ DOWN: buildGenericCallback("Down", ActionType.KEYSTROKE),
1200
+ CUBE_ROOT: mathQuill => {
1201
+ mathQuill.write("\\sqrt[3]{}");
1202
+ mathQuill.keystroke("Left"); // under the root
1203
+ },
1325
1204
 
1326
- // Set MathQuill's internal state to reflect the focus, otherwise it
1327
- // will consistently try to hide the cursor on key-press and introduce
1328
- // layout jank.
1205
+ FRAC_EXCLUSIVE: mathQuill => {
1206
+ const cursor = mathQuill.__controller.cursor;
1207
+ // If there's nothing to the left of the cursor, then we want to
1208
+ // leave the cursor to the left of the fraction after creating it.
1209
+ const shouldNavigateLeft = cursor[mathQuillInstance.L] === ActionType.MQ_END;
1210
+ mathQuill.cmd("\\frac");
1211
+ if (shouldNavigateLeft) {
1212
+ mathQuill.keystroke("Left");
1213
+ }
1214
+ },
1215
+ LOG_B: mathQuill => {
1216
+ mathQuill.typedText("log_");
1217
+ mathQuill.keystroke("Right");
1218
+ mathQuill.typedText("(");
1219
+ mathQuill.keystroke("Left");
1220
+ mathQuill.keystroke("Left");
1221
+ },
1222
+ LOG_N: mathQuill => {
1223
+ mathQuill.write("log_{ }\\left(\\right)");
1224
+ mathQuill.keystroke("Left"); // into parentheses
1225
+ mathQuill.keystroke("Left"); // out of parentheses
1226
+ mathQuill.keystroke("Left"); // into index
1227
+ },
1228
+
1229
+ NTHROOT3: mathQuill => {
1230
+ mathQuill.typedText("nthroot3");
1231
+ mathQuill.keystroke("Right");
1232
+ },
1233
+ POW: mathQuill => {
1234
+ const contents = mathQuill.latex();
1235
+ mathQuill.typedText("^");
1236
+
1237
+ // If the input hasn't changed (for example, if we're
1238
+ // attempting to add an exponent on an empty input or an empty
1239
+ // denominator), insert our own "a^b"
1240
+ if (mathQuill.latex() === contents) {
1241
+ mathQuill.typedText("a^b");
1242
+ }
1243
+ },
1244
+ // These need to be overwritten by the consumer
1245
+ // if they're going to be used
1246
+ DISMISS: () => {},
1247
+ NOOP: () => {},
1248
+ MANY: () => {},
1249
+ NUM_0: buildGenericCallback("0"),
1250
+ NUM_1: buildGenericCallback("1"),
1251
+ NUM_2: buildGenericCallback("2"),
1252
+ NUM_3: buildGenericCallback("3"),
1253
+ NUM_4: buildGenericCallback("4"),
1254
+ NUM_5: buildGenericCallback("5"),
1255
+ NUM_6: buildGenericCallback("6"),
1256
+ NUM_7: buildGenericCallback("7"),
1257
+ NUM_8: buildGenericCallback("8"),
1258
+ NUM_9: buildGenericCallback("9"),
1259
+ a: buildGenericCallback("a"),
1260
+ b: buildGenericCallback("b"),
1261
+ c: buildGenericCallback("c"),
1262
+ d: buildGenericCallback("d"),
1263
+ e: buildGenericCallback("e"),
1264
+ f: buildGenericCallback("f"),
1265
+ g: buildGenericCallback("g"),
1266
+ h: buildGenericCallback("h"),
1267
+ i: buildGenericCallback("i"),
1268
+ j: buildGenericCallback("j"),
1269
+ k: buildGenericCallback("k"),
1270
+ l: buildGenericCallback("l"),
1271
+ m: buildGenericCallback("m"),
1272
+ n: buildGenericCallback("n"),
1273
+ o: buildGenericCallback("o"),
1274
+ p: buildGenericCallback("p"),
1275
+ q: buildGenericCallback("q"),
1276
+ r: buildGenericCallback("r"),
1277
+ s: buildGenericCallback("s"),
1278
+ t: buildGenericCallback("t"),
1279
+ u: buildGenericCallback("u"),
1280
+ v: buildGenericCallback("v"),
1281
+ w: buildGenericCallback("w"),
1282
+ x: buildGenericCallback("x"),
1283
+ y: buildGenericCallback("y"),
1284
+ z: buildGenericCallback("z"),
1285
+ A: buildGenericCallback("A"),
1286
+ B: buildGenericCallback("B"),
1287
+ C: buildGenericCallback("C"),
1288
+ D: buildGenericCallback("D"),
1289
+ E: buildGenericCallback("E"),
1290
+ F: buildGenericCallback("F"),
1291
+ G: buildGenericCallback("G"),
1292
+ H: buildGenericCallback("H"),
1293
+ I: buildGenericCallback("I"),
1294
+ J: buildGenericCallback("J"),
1295
+ K: buildGenericCallback("K"),
1296
+ L: buildGenericCallback("L"),
1297
+ M: buildGenericCallback("M"),
1298
+ N: buildGenericCallback("N"),
1299
+ O: buildGenericCallback("O"),
1300
+ P: buildGenericCallback("P"),
1301
+ Q: buildGenericCallback("Q"),
1302
+ R: buildGenericCallback("R"),
1303
+ S: buildGenericCallback("S"),
1304
+ T: buildGenericCallback("T"),
1305
+ U: buildGenericCallback("U"),
1306
+ V: buildGenericCallback("V"),
1307
+ W: buildGenericCallback("W"),
1308
+ X: buildGenericCallback("X"),
1309
+ Y: buildGenericCallback("Y"),
1310
+ Z: buildGenericCallback("Z")
1311
+ };
1312
+
1313
+ const mobileKeyTranslator = {
1314
+ ...keyToMathquillMap,
1315
+ // note(Matthew): our mobile backspace logic is really complicated
1316
+ // and for some reason doesn't really work in the desktop experience.
1317
+ // So we default to the basic backspace functionality in the
1318
+ // key translator and overwrite it with the complicated logic here
1319
+ // until we can unify the experiences (if we even want to).
1320
+ // https://khanacademy.atlassian.net/browse/LC-906
1321
+ BACKSPACE: handleBackspace
1322
+ };
1323
+
1324
+ /**
1325
+ * This file contains a wrapper around MathQuill so that we can provide a
1326
+ * more regular interface for the functionality we need while insulating us
1327
+ * from MathQuill changes.
1328
+ */
1329
+ class MathWrapper {
1330
+ // MathQuill MathField input
1331
+
1332
+ constructor(element) {
1333
+ let callbacks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1334
+ _defineProperty(this, "mathField", void 0);
1335
+ _defineProperty(this, "callbacks", void 0);
1336
+ this.mathField = createMathField(element, () => {
1337
+ return {
1338
+ // use a span instead of a textarea so that we don't bring up the
1339
+ // native keyboard on mobile when selecting the input
1340
+ substituteTextarea: function () {
1341
+ return document.createElement("span");
1342
+ }
1343
+ };
1344
+ });
1345
+ this.callbacks = callbacks;
1346
+ }
1347
+ focus() {
1348
+ // HACK(charlie): We shouldn't reaching into MathQuill internals like
1349
+ // this, but it's the easiest way to allow us to manage the focus state
1350
+ // ourselves.
1351
+ const controller = this.mathField.__controller;
1352
+ controller.cursor.show();
1353
+
1354
+ // Set MathQuill's internal state to reflect the focus, otherwise it
1355
+ // will consistently try to hide the cursor on key-press and introduce
1356
+ // layout jank.
1329
1357
  controller.blurred = false;
1330
1358
  }
1331
1359
  blur() {
@@ -1342,7 +1370,7 @@ class MathWrapper {
1342
1370
  */
1343
1371
  pressKey(key) {
1344
1372
  const cursor = this.getCursor();
1345
- const translator = customKeyTranslator[key];
1373
+ const translator = mobileKeyTranslator[key];
1346
1374
  if (translator) {
1347
1375
  translator(this.mathField, key);
1348
1376
  }
@@ -1390,7 +1418,7 @@ class MathWrapper {
1390
1418
  // Unless that would leave us mid-command, in which case, we
1391
1419
  // need to adjust and place the cursor inside the parens
1392
1420
  // following the command.
1393
- const command = maybeFindCommand(cursor[MQ.L]);
1421
+ const command = maybeFindCommand(cursor[mathQuillInstance.L]);
1394
1422
  if (command && command.endNode) {
1395
1423
  // NOTE(charlie): endNode should definitely be \left(.
1396
1424
  cursor.insLeftOf(command.endNode);
@@ -1961,7 +1989,7 @@ class MathInput extends React__namespace.Component {
1961
1989
  }
1962
1990
  componentDidMount() {
1963
1991
  this._isMounted = true;
1964
- this.mathField = new MathWrapper(this._mathContainer, {}, {
1992
+ this.mathField = new MathWrapper(this._mathContainer, {
1965
1993
  onCursorMove: cursor => {
1966
1994
  // TODO(charlie): It's not great that there is so much coupling
1967
1995
  // between this keypad and the input behavior. We should wrap
@@ -7495,89 +7523,6 @@ class ProvidedKeypad extends React__namespace.Component {
7495
7523
  }
7496
7524
  }
7497
7525
 
7498
- const styles$1 = aphrodite.StyleSheet.create({
7499
- base: {
7500
- display: "flex",
7501
- justifyContent: "center",
7502
- alignItems: "center",
7503
- boxShadow: "0px 1px 0px rgba(33, 36, 44, 0.32)",
7504
- boxSizing: "border-box",
7505
- background: Color__default["default"].white,
7506
- borderRadius: 4,
7507
- border: "1px solid transparent",
7508
- flex: 1,
7509
- minHeight: 42,
7510
- minWidth: 42,
7511
- padding: 1
7512
- },
7513
- hovered: {
7514
- border: "1px solid ".concat(Color__default["default"].blue),
7515
- padding: 1,
7516
- boxShadow: "none"
7517
- },
7518
- focused: {
7519
- border: "2px solid ".concat(Color__default["default"].blue),
7520
- padding: 0,
7521
- boxShadow: "none"
7522
- },
7523
- pressed: {
7524
- border: "2px solid #1B50B3",
7525
- padding: 0,
7526
- background: "linear-gradient(0deg, rgba(24, 101, 242, 0.32), rgba(24, 101, 242, 0.32)), ".concat(Color__default["default"].white),
7527
- boxShadow: "none"
7528
- },
7529
- outerBoxBase: {
7530
- padding: 1,
7531
- height: "100%",
7532
- width: "100%",
7533
- boxSizing: "border-box",
7534
- borderRadius: 7,
7535
- border: "2px solid transparent"
7536
- },
7537
- outerBoxHover: {
7538
- border: "2px solid ".concat(Color__default["default"].blue)
7539
- },
7540
- outerBoxPressed: {
7541
- border: "2px solid #1B50B3"
7542
- },
7543
- clickable: {
7544
- width: "100%",
7545
- height: "100%",
7546
- boxSizing: "border-box"
7547
- }
7548
- });
7549
- class Button extends React__namespace.Component {
7550
- render() {
7551
- const {
7552
- onPress,
7553
- ariaLabel,
7554
- children,
7555
- style,
7556
- tintColor
7557
- } = this.props;
7558
- return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
7559
- style: style
7560
- }, /*#__PURE__*/React__namespace.createElement(Clickable__default["default"], {
7561
- onClick: onPress,
7562
- style: styles$1.clickable,
7563
- "aria-label": ariaLabel
7564
- }, _ref => {
7565
- let {
7566
- hovered,
7567
- focused,
7568
- pressed
7569
- } = _ref;
7570
- return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
7571
- style: [styles$1.outerBoxBase, hovered && styles$1.outerBoxHover, pressed && styles$1.outerBoxPressed]
7572
- }, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
7573
- style: [styles$1.base, tintColor != null ? {
7574
- background: tintColor
7575
- } : undefined, hovered && styles$1.hovered, focused && styles$1.focused, pressed && styles$1.pressed]
7576
- }, children));
7577
- }));
7578
- }
7579
- }
7580
-
7581
7526
  /*
7582
7527
  The SVGs in this file should be treated as binary assets. If, in the future,
7583
7528
  we need to make changes to update the color or size or shape of the glyph
@@ -8337,413 +8282,303 @@ function ButtonAsset(_ref) {
8337
8282
  }
8338
8283
  }
8339
8284
 
8340
- const KeypadPageContainer = _ref => {
8285
+ const KeypadButton = _ref => {
8341
8286
  let {
8342
- children
8287
+ coord,
8288
+ keyConfig,
8289
+ onClickKey,
8290
+ style,
8291
+ secondary,
8292
+ action
8343
8293
  } = _ref;
8294
+ const tintColor = secondary ? "#F6F6F7" : action ? "#DBDCDD" : undefined;
8344
8295
  return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
8345
8296
  style: {
8346
- backgroundColor: "#DBDCDD",
8347
- width: "100%",
8348
- height: 192,
8349
- display: "grid",
8350
- gridTemplateColumns: "repeat(6, 1fr)",
8351
- gridTemplateRows: "repeat(4, 1fr)"
8297
+ gridColumn: coord[0] + 1,
8298
+ gridRow: coord[1] + 1,
8299
+ ...style
8352
8300
  }
8353
- }, children);
8354
- };
8355
- const KeypadButton = _ref2 => {
8356
- let {
8357
- keyConfig,
8358
- onClickKey,
8359
- tintColor,
8360
- style
8361
- } = _ref2;
8362
- return /*#__PURE__*/React__namespace.createElement(Button, {
8363
- onPress: () => onClickKey(keyConfig.id),
8364
- tintColor: tintColor,
8365
- style: style,
8366
- ariaLabel: keyConfig.id
8367
- }, /*#__PURE__*/React__namespace.createElement(ButtonAsset, {
8368
- id: keyConfig.id
8301
+ }, /*#__PURE__*/React__namespace.createElement(Clickable__default["default"], {
8302
+ onClick: () => onClickKey(keyConfig.id),
8303
+ style: styles$1.clickable,
8304
+ "aria-label": keyConfig.ariaLabel
8305
+ }, _ref2 => {
8306
+ let {
8307
+ hovered,
8308
+ focused,
8309
+ pressed
8310
+ } = _ref2;
8311
+ return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
8312
+ style: [styles$1.outerBoxBase, hovered && styles$1.outerBoxHover, pressed && styles$1.outerBoxPressed]
8313
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
8314
+ style: [styles$1.base, tintColor != null ? {
8315
+ background: tintColor
8316
+ } : undefined, hovered && styles$1.hovered, focused && styles$1.focused, pressed && styles$1.pressed]
8317
+ }, /*#__PURE__*/React__namespace.createElement(ButtonAsset, {
8318
+ id: keyConfig.id
8319
+ })));
8369
8320
  }));
8370
8321
  };
8371
- const SecondaryKeypadButton = _ref3 => {
8372
- let {
8373
- keyConfig,
8374
- onClickKey,
8375
- style
8376
- } = _ref3;
8377
- return /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8378
- keyConfig: keyConfig,
8379
- onClickKey: onClickKey,
8380
- style: style,
8381
- tintColor: "#F6F6F7"
8382
- });
8383
- };
8384
- const KeypadActionButton = _ref4 => {
8385
- let {
8386
- keyConfig,
8387
- onClickKey,
8388
- style
8389
- } = _ref4;
8390
- return /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8391
- keyConfig: keyConfig,
8392
- onClickKey: onClickKey,
8393
- style: style,
8394
- tintColor: "#DBDCDD"
8395
- });
8396
- };
8397
-
8398
- /**
8399
- * A placeholder button for the keypad. Optional count prop to render multiple
8400
- * buttons. Defaults to 1.
8401
- */
8402
- const PlaceHolderButtons = _ref5 => {
8403
- let {
8404
- count = 1
8405
- } = _ref5;
8406
- return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, Array.from({
8407
- length: count
8408
- }).map((_, index) => /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
8409
- key: index,
8410
- style: {
8411
- height: "100%",
8412
- width: "100%",
8413
- boxSizing: "border-box",
8414
- borderRadius: 7,
8415
- border: "4px solid transparent"
8416
- }
8417
- }, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
8418
- style: {
8419
- background: "rgba(33, 36, 44, 0.04)",
8420
- width: "100%",
8421
- height: "100%",
8422
- borderRadius: 4,
8423
- border: "1px solid transparent"
8424
- }
8425
- }))));
8426
- };
8322
+ const styles$1 = aphrodite.StyleSheet.create({
8323
+ base: {
8324
+ display: "flex",
8325
+ justifyContent: "center",
8326
+ alignItems: "center",
8327
+ boxShadow: "0px 1px 0px rgba(33, 36, 44, 0.32)",
8328
+ boxSizing: "border-box",
8329
+ background: Color__default["default"].white,
8330
+ borderRadius: 4,
8331
+ border: "1px solid transparent",
8332
+ flex: 1,
8333
+ minHeight: 42,
8334
+ minWidth: 42,
8335
+ padding: 1
8336
+ },
8337
+ hovered: {
8338
+ border: "1px solid ".concat(Color__default["default"].blue),
8339
+ padding: 1,
8340
+ boxShadow: "none"
8341
+ },
8342
+ focused: {
8343
+ border: "2px solid ".concat(Color__default["default"].blue),
8344
+ padding: 0,
8345
+ boxShadow: "none"
8346
+ },
8347
+ pressed: {
8348
+ border: "2px solid #1B50B3",
8349
+ padding: 0,
8350
+ background: "linear-gradient(0deg, rgba(24, 101, 242, 0.32), rgba(24, 101, 242, 0.32)), ".concat(Color__default["default"].white),
8351
+ boxShadow: "none"
8352
+ },
8353
+ outerBoxBase: {
8354
+ padding: 1,
8355
+ height: "100%",
8356
+ width: "100%",
8357
+ boxSizing: "border-box",
8358
+ borderRadius: 7,
8359
+ border: "2px solid transparent"
8360
+ },
8361
+ outerBoxHover: {
8362
+ border: "2px solid ".concat(Color__default["default"].blue)
8363
+ },
8364
+ outerBoxPressed: {
8365
+ border: "2px solid #1B50B3"
8366
+ },
8367
+ clickable: {
8368
+ width: "100%",
8369
+ height: "100%",
8370
+ boxSizing: "border-box"
8371
+ }
8372
+ });
8427
8373
 
8428
- class ExtrasPage extends React__namespace.Component {
8429
- render() {
8430
- const {
8431
- extraKeys,
8432
- onClickKey
8433
- } = this.props;
8434
- return /*#__PURE__*/React__namespace.createElement(KeypadPageContainer, null, extraKeys.map(key => /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8374
+ const columns = 4;
8375
+ function ExtrasPage(props) {
8376
+ const {
8377
+ extraKeys,
8378
+ onClickKey
8379
+ } = props;
8380
+ return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, extraKeys.map((key, i) => {
8381
+ // Map 1D array to Cartesian coordinates
8382
+ const coordX = i % columns;
8383
+ const coordY = i / columns;
8384
+ return /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8435
8385
  key: key,
8436
8386
  keyConfig: KeyConfigs[key],
8437
- onClickKey: onClickKey
8438
- })));
8439
- }
8440
- }
8441
-
8442
- class GeometryPage extends React__namespace.Component {
8443
- render() {
8444
- const {
8445
- onClickKey
8446
- } = this.props;
8447
- return /*#__PURE__*/React__namespace.createElement(KeypadPageContainer, null, /*#__PURE__*/React__namespace.createElement(SecondaryKeypadButton, {
8448
- keyConfig: KeyConfigs.SIN,
8449
- onClickKey: onClickKey
8450
- }), /*#__PURE__*/React__namespace.createElement(SecondaryKeypadButton, {
8451
- keyConfig: KeyConfigs.COS,
8452
- onClickKey: onClickKey
8453
- }), /*#__PURE__*/React__namespace.createElement(SecondaryKeypadButton, {
8454
- keyConfig: KeyConfigs.TAN,
8455
- onClickKey: onClickKey
8456
- }), /*#__PURE__*/React__namespace.createElement(SecondaryKeypadButton, {
8457
- keyConfig: KeyConfigs.LEFT_PAREN,
8458
- onClickKey: onClickKey,
8459
- style: {
8460
- gridColumn: 5
8461
- }
8462
- }), /*#__PURE__*/React__namespace.createElement(SecondaryKeypadButton, {
8463
- keyConfig: KeyConfigs.RIGHT_PAREN,
8464
- onClickKey: onClickKey,
8465
- style: {
8466
- gridColumn: 6
8467
- }
8468
- }), /*#__PURE__*/React__namespace.createElement(SecondaryKeypadButton, {
8469
- keyConfig: KeyConfigs.x,
8470
- onClickKey: onClickKey,
8471
- style: {
8472
- gridColumn: 5
8473
- }
8474
- }), /*#__PURE__*/React__namespace.createElement(SecondaryKeypadButton, {
8475
- keyConfig: KeyConfigs.FRAC_INCLUSIVE,
8476
- onClickKey: onClickKey,
8477
- style: {
8478
- gridColumn: 6
8479
- }
8480
- }), /*#__PURE__*/React__namespace.createElement(SecondaryKeypadButton, {
8481
- keyConfig: KeyConfigs.PI,
8482
- onClickKey: onClickKey,
8483
- style: {
8484
- gridColumn: 5
8485
- }
8486
- }), /*#__PURE__*/React__namespace.createElement(KeypadActionButton, {
8487
- keyConfig: KeyConfigs.BACKSPACE,
8488
- style: {
8489
- gridColumn: "6"
8490
- },
8491
- onClickKey: onClickKey
8492
- }), /*#__PURE__*/React__namespace.createElement(KeypadActionButton, {
8493
- keyConfig: KeyConfigs.DISMISS,
8494
- style: {
8495
- gridColumn: "6"
8496
- },
8497
- onClickKey: onClickKey
8498
- }));
8499
- }
8500
- }
8501
-
8502
- class NumbersPage extends React__namespace.Component {
8503
- render() {
8504
- const {
8505
- onClickKey
8506
- } = this.props;
8507
- return /*#__PURE__*/React__namespace.createElement(KeypadPageContainer, null, /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8508
- keyConfig: KeyConfigs.NUM_7,
8509
- onClickKey: onClickKey
8510
- }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8511
- keyConfig: KeyConfigs.NUM_8,
8512
- onClickKey: onClickKey
8513
- }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8514
- keyConfig: KeyConfigs.NUM_9,
8515
- onClickKey: onClickKey
8516
- }), /*#__PURE__*/React__namespace.createElement(SecondaryKeypadButton, {
8517
- keyConfig: KeyConfigs.DIVIDE,
8518
- style: this.props.divisionKey ? {
8519
- gridColumn: "4",
8520
- gridRow: "1"
8521
- } : {
8522
- display: "none"
8523
- },
8524
- onClickKey: onClickKey
8525
- }), /*#__PURE__*/React__namespace.createElement(SecondaryKeypadButton, {
8526
- keyConfig: this.props.multiplicationDot ? KeyConfigs.CDOT : KeyConfigs.TIMES,
8527
- style: this.props.divisionKey && {
8528
- gridColumn: "4",
8529
- gridRow: "2"
8530
- },
8531
- onClickKey: onClickKey
8532
- }), /*#__PURE__*/React__namespace.createElement(SecondaryKeypadButton, {
8533
- keyConfig: KeyConfigs.LEFT_PAREN,
8534
- onClickKey: onClickKey
8535
- }), /*#__PURE__*/React__namespace.createElement(SecondaryKeypadButton, {
8536
- keyConfig: KeyConfigs.RIGHT_PAREN,
8537
- onClickKey: onClickKey
8538
- }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8539
- keyConfig: KeyConfigs.NUM_4,
8540
- onClickKey: onClickKey
8541
- }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8542
- keyConfig: KeyConfigs.NUM_5,
8543
- onClickKey: onClickKey
8544
- }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8545
- keyConfig: KeyConfigs.NUM_6,
8546
- onClickKey: onClickKey
8547
- }), /*#__PURE__*/React__namespace.createElement(SecondaryKeypadButton, {
8548
- keyConfig: KeyConfigs.MINUS,
8549
- style: this.props.divisionKey && {
8550
- gridColumn: "4",
8551
- gridRow: "3"
8552
- },
8553
- onClickKey: onClickKey
8554
- }), /*#__PURE__*/React__namespace.createElement(SecondaryKeypadButton, {
8555
- keyConfig: KeyConfigs.FRAC_INCLUSIVE,
8556
8387
  onClickKey: onClickKey,
8557
- style: {
8558
- gridColumn: "5 / 7"
8559
- }
8560
- }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8561
- keyConfig: KeyConfigs.NUM_1,
8562
- onClickKey: onClickKey
8563
- }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8564
- keyConfig: KeyConfigs.NUM_2,
8565
- onClickKey: onClickKey
8566
- }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8567
- keyConfig: KeyConfigs.NUM_3,
8568
- onClickKey: onClickKey
8569
- }), /*#__PURE__*/React__namespace.createElement(SecondaryKeypadButton, {
8570
- keyConfig: KeyConfigs.PLUS,
8571
- style: this.props.divisionKey ? {
8572
- gridColumn: "4",
8573
- gridRow: "4"
8574
- } : {
8575
- gridColumn: "4",
8576
- gridRowStart: "3",
8577
- gridRowEnd: "5"
8578
- },
8579
- onClickKey: onClickKey
8580
- }), /*#__PURE__*/React__namespace.createElement(KeypadActionButton, {
8581
- keyConfig: KeyConfigs.BACKSPACE,
8582
- style: {
8583
- gridColumn: "6"
8584
- },
8585
- onClickKey: onClickKey
8586
- }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8587
- keyConfig: KeyConfigs.NUM_0,
8588
- onClickKey: onClickKey
8589
- }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8590
- keyConfig: KeyConfigs.DECIMAL,
8591
- onClickKey: onClickKey
8592
- }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8593
- keyConfig: KeyConfigs.NEGATIVE,
8594
- onClickKey: onClickKey
8595
- }), /*#__PURE__*/React__namespace.createElement(KeypadActionButton, {
8596
- keyConfig: KeyConfigs.DISMISS,
8597
- style: {
8598
- gridColumn: "6"
8599
- },
8600
- onClickKey: onClickKey
8601
- }));
8602
- }
8388
+ coord: [coordX, coordY]
8389
+ });
8390
+ }));
8603
8391
  }
8604
8392
 
8605
- const AdvancedRelations = _ref => {
8606
- let {
8607
- onClickKey,
8608
- placeholder
8609
- } = _ref;
8610
- return placeholder ? /*#__PURE__*/React__default["default"].createElement(PlaceHolderButtons, {
8611
- count: 3
8612
- }) : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(SecondaryKeypadButton, {
8613
- keyConfig: KeyConfigs.NEQ,
8614
- onClickKey: onClickKey
8615
- }), /*#__PURE__*/React__default["default"].createElement(SecondaryKeypadButton, {
8616
- keyConfig: KeyConfigs.LEQ,
8617
- onClickKey: onClickKey
8618
- }), /*#__PURE__*/React__default["default"].createElement(SecondaryKeypadButton, {
8619
- keyConfig: KeyConfigs.GEQ,
8620
- onClickKey: onClickKey
8393
+ function GeometryPage(props) {
8394
+ const {
8395
+ onClickKey
8396
+ } = props;
8397
+ return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8398
+ keyConfig: KeyConfigs.SIN,
8399
+ onClickKey: onClickKey,
8400
+ coord: [0, 0]
8401
+ }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8402
+ keyConfig: KeyConfigs.COS,
8403
+ onClickKey: onClickKey,
8404
+ coord: [1, 0]
8405
+ }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8406
+ keyConfig: KeyConfigs.TAN,
8407
+ onClickKey: onClickKey,
8408
+ coord: [2, 0]
8621
8409
  }));
8622
- };
8410
+ }
8623
8411
 
8624
- const BasicRelations = _ref => {
8625
- let {
8626
- onClickKey,
8627
- placeholder
8628
- } = _ref;
8629
- return placeholder ? /*#__PURE__*/React__default["default"].createElement(PlaceHolderButtons, {
8630
- count: 3
8631
- }) : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(SecondaryKeypadButton, {
8632
- keyConfig: KeyConfigs.EQUAL,
8633
- onClickKey: onClickKey
8634
- }), /*#__PURE__*/React__default["default"].createElement(SecondaryKeypadButton, {
8635
- keyConfig: KeyConfigs.LT,
8636
- onClickKey: onClickKey
8637
- }), /*#__PURE__*/React__default["default"].createElement(SecondaryKeypadButton, {
8638
- keyConfig: KeyConfigs.GT,
8639
- onClickKey: onClickKey
8412
+ function NumbersPage(props) {
8413
+ const {
8414
+ onClickKey
8415
+ } = props;
8416
+ return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8417
+ keyConfig: KeyConfigs.NUM_7,
8418
+ onClickKey: onClickKey,
8419
+ coord: [0, 0]
8420
+ }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8421
+ keyConfig: KeyConfigs.NUM_8,
8422
+ onClickKey: onClickKey,
8423
+ coord: [1, 0]
8424
+ }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8425
+ keyConfig: KeyConfigs.NUM_9,
8426
+ onClickKey: onClickKey,
8427
+ coord: [2, 0]
8428
+ }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8429
+ keyConfig: KeyConfigs.NUM_4,
8430
+ onClickKey: onClickKey,
8431
+ coord: [0, 1]
8432
+ }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8433
+ keyConfig: KeyConfigs.NUM_5,
8434
+ onClickKey: onClickKey,
8435
+ coord: [1, 1]
8436
+ }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8437
+ keyConfig: KeyConfigs.NUM_6,
8438
+ onClickKey: onClickKey,
8439
+ coord: [2, 1]
8440
+ }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8441
+ keyConfig: KeyConfigs.NUM_1,
8442
+ onClickKey: onClickKey,
8443
+ coord: [0, 2]
8444
+ }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8445
+ keyConfig: KeyConfigs.NUM_2,
8446
+ onClickKey: onClickKey,
8447
+ coord: [1, 2]
8448
+ }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8449
+ keyConfig: KeyConfigs.NUM_3,
8450
+ onClickKey: onClickKey,
8451
+ coord: [2, 2]
8452
+ }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8453
+ keyConfig: KeyConfigs.NUM_0,
8454
+ onClickKey: onClickKey,
8455
+ coord: [0, 3]
8456
+ }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8457
+ keyConfig: KeyConfigs.DECIMAL,
8458
+ onClickKey: onClickKey,
8459
+ coord: [1, 3]
8460
+ }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8461
+ keyConfig: KeyConfigs.NEGATIVE,
8462
+ onClickKey: onClickKey,
8463
+ coord: [2, 3]
8640
8464
  }));
8641
- };
8465
+ }
8642
8466
 
8643
- const Logarithms = _ref => {
8644
- let {
8467
+ function OperatorsPage(props) {
8468
+ const {
8645
8469
  onClickKey,
8646
- placeholder
8647
- } = _ref;
8648
- return placeholder ? /*#__PURE__*/React__default["default"].createElement(PlaceHolderButtons, {
8649
- count: 3
8650
- }) : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(SecondaryKeypadButton, {
8470
+ preAlgebra,
8471
+ logarithms,
8472
+ basicRelations,
8473
+ advancedRelations
8474
+ } = props;
8475
+ return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, preAlgebra && /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8476
+ keyConfig: KeyConfigs.EXP_2,
8477
+ onClickKey: onClickKey,
8478
+ coord: [0, 0]
8479
+ }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8480
+ keyConfig: KeyConfigs.EXP,
8481
+ onClickKey: onClickKey,
8482
+ coord: [1, 0]
8483
+ }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8484
+ keyConfig: KeyConfigs.SQRT,
8485
+ onClickKey: onClickKey,
8486
+ coord: [2, 0]
8487
+ }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8488
+ keyConfig: KeyConfigs.RADICAL,
8489
+ onClickKey: onClickKey,
8490
+ coord: [3, 0]
8491
+ })), logarithms && /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8651
8492
  keyConfig: KeyConfigs.LOG,
8652
- onClickKey: onClickKey
8653
- }), /*#__PURE__*/React__default["default"].createElement(SecondaryKeypadButton, {
8493
+ onClickKey: onClickKey,
8494
+ coord: [0, 1]
8495
+ }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8654
8496
  keyConfig: KeyConfigs.LOG_N,
8655
- onClickKey: onClickKey
8656
- }), /*#__PURE__*/React__default["default"].createElement(SecondaryKeypadButton, {
8497
+ onClickKey: onClickKey,
8498
+ coord: [1, 1]
8499
+ }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8657
8500
  keyConfig: KeyConfigs.LN,
8658
- onClickKey: onClickKey
8659
- }));
8660
- };
8501
+ onClickKey: onClickKey,
8502
+ coord: [2, 1]
8503
+ })), basicRelations && /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8504
+ keyConfig: KeyConfigs.EQUAL,
8505
+ onClickKey: onClickKey,
8506
+ coord: [0, 2]
8507
+ }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8508
+ keyConfig: KeyConfigs.LT,
8509
+ onClickKey: onClickKey,
8510
+ coord: [1, 2]
8511
+ }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8512
+ keyConfig: KeyConfigs.GT,
8513
+ onClickKey: onClickKey,
8514
+ coord: [2, 2]
8515
+ })), advancedRelations && /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8516
+ keyConfig: KeyConfigs.NEQ,
8517
+ onClickKey: onClickKey,
8518
+ coord: [0, 3]
8519
+ }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8520
+ keyConfig: KeyConfigs.LEQ,
8521
+ onClickKey: onClickKey,
8522
+ coord: [1, 3]
8523
+ }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8524
+ keyConfig: KeyConfigs.GEQ,
8525
+ onClickKey: onClickKey,
8526
+ coord: [2, 3]
8527
+ })));
8528
+ }
8661
8529
 
8662
- const PreAlgebra = _ref => {
8663
- let {
8530
+ function SharedKeys(props) {
8531
+ const {
8664
8532
  onClickKey,
8665
- placeholder
8666
- } = _ref;
8667
- return placeholder ? /*#__PURE__*/React__default["default"].createElement(PlaceHolderButtons, {
8668
- count: 4
8669
- }) : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(SecondaryKeypadButton, {
8670
- keyConfig: KeyConfigs.EXP_2,
8671
- onClickKey: onClickKey
8672
- }), /*#__PURE__*/React__default["default"].createElement(SecondaryKeypadButton, {
8673
- keyConfig: KeyConfigs.EXP,
8674
- onClickKey: onClickKey
8675
- }), /*#__PURE__*/React__default["default"].createElement(SecondaryKeypadButton, {
8676
- keyConfig: KeyConfigs.SQRT,
8677
- onClickKey: onClickKey
8678
- }), /*#__PURE__*/React__default["default"].createElement(SecondaryKeypadButton, {
8679
- keyConfig: KeyConfigs.RADICAL,
8680
- onClickKey: onClickKey
8533
+ divisionKey,
8534
+ multiplicationDot
8535
+ } = props;
8536
+ return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8537
+ keyConfig: KeyConfigs.PLUS,
8538
+ onClickKey: onClickKey,
8539
+ coord: [4, 0],
8540
+ secondary: true
8541
+ }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8542
+ keyConfig: KeyConfigs.MINUS,
8543
+ onClickKey: onClickKey,
8544
+ coord: [5, 0],
8545
+ secondary: true
8546
+ }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8547
+ keyConfig: multiplicationDot ? KeyConfigs.CDOT : KeyConfigs.TIMES,
8548
+ onClickKey: onClickKey,
8549
+ coord: [4, 1],
8550
+ secondary: true
8551
+ }), divisionKey && /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8552
+ keyConfig: KeyConfigs.DIVIDE,
8553
+ onClickKey: onClickKey,
8554
+ coord: [5, 1],
8555
+ secondary: true
8556
+ }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8557
+ keyConfig: KeyConfigs.LEFT_PAREN,
8558
+ onClickKey: onClickKey,
8559
+ coord: [4, 2],
8560
+ secondary: true
8561
+ }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8562
+ keyConfig: KeyConfigs.RIGHT_PAREN,
8563
+ onClickKey: onClickKey,
8564
+ coord: [5, 2],
8565
+ secondary: true
8566
+ }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8567
+ keyConfig: KeyConfigs.FRAC_INCLUSIVE,
8568
+ onClickKey: onClickKey,
8569
+ coord: [4, 3],
8570
+ secondary: true
8571
+ }), /*#__PURE__*/React__namespace.createElement(KeypadButton, {
8572
+ keyConfig: KeyConfigs.BACKSPACE,
8573
+ onClickKey: onClickKey,
8574
+ coord: [5, 3],
8575
+ action: true
8681
8576
  }));
8682
- };
8683
-
8684
- class OperatorsPage extends React__namespace.Component {
8685
- render() {
8686
- const {
8687
- onClickKey
8688
- } = this.props;
8689
- return /*#__PURE__*/React__namespace.createElement(KeypadPageContainer, null, /*#__PURE__*/React__namespace.createElement(PreAlgebra, {
8690
- onClickKey: onClickKey,
8691
- placeholder: !this.props.preAlgebra
8692
- }), /*#__PURE__*/React__namespace.createElement(SecondaryKeypadButton, {
8693
- keyConfig: KeyConfigs.LEFT_PAREN,
8694
- onClickKey: onClickKey
8695
- }), /*#__PURE__*/React__namespace.createElement(SecondaryKeypadButton, {
8696
- keyConfig: KeyConfigs.RIGHT_PAREN,
8697
- onClickKey: onClickKey
8698
- }), /*#__PURE__*/React__namespace.createElement(Logarithms, {
8699
- onClickKey: onClickKey,
8700
- placeholder: !this.props.logarithms
8701
- }), /*#__PURE__*/React__namespace.createElement(SecondaryKeypadButton, {
8702
- keyConfig: KeyConfigs.x,
8703
- onClickKey: onClickKey,
8704
- style: {
8705
- gridColumn: 5
8706
- }
8707
- }), /*#__PURE__*/React__namespace.createElement(SecondaryKeypadButton, {
8708
- keyConfig: KeyConfigs.FRAC_INCLUSIVE,
8709
- onClickKey: onClickKey,
8710
- style: {
8711
- gridColumn: 6
8712
- }
8713
- }), /*#__PURE__*/React__namespace.createElement(BasicRelations, {
8714
- onClickKey: onClickKey,
8715
- placeholder: !this.props.basicRelations
8716
- }), /*#__PURE__*/React__namespace.createElement(SecondaryKeypadButton, {
8717
- keyConfig: KeyConfigs.PI,
8718
- onClickKey: onClickKey,
8719
- style: {
8720
- gridColumn: 5
8721
- }
8722
- }), /*#__PURE__*/React__namespace.createElement(KeypadActionButton, {
8723
- keyConfig: KeyConfigs.BACKSPACE,
8724
- style: {
8725
- gridColumn: 6
8726
- },
8727
- onClickKey: onClickKey
8728
- }), /*#__PURE__*/React__namespace.createElement(AdvancedRelations, {
8729
- onClickKey: onClickKey,
8730
- placeholder: !this.props.advancedRelations
8731
- }), /*#__PURE__*/React__namespace.createElement(KeypadActionButton, {
8732
- keyConfig: KeyConfigs.DISMISS,
8733
- style: {
8734
- gridColumn: "6"
8735
- },
8736
- onClickKey: onClickKey
8737
- }));
8738
- }
8739
8577
  }
8740
8578
 
8741
8579
  function allPages(props) {
8742
8580
  var _props$extraKeys;
8743
8581
  const pages = ["Numbers"];
8744
- if ((_props$extraKeys = props.extraKeys) !== null && _props$extraKeys !== void 0 && _props$extraKeys.length) {
8745
- pages.push("Extras");
8746
- }
8747
8582
  if (
8748
8583
  // OperatorsButtonSets
8749
8584
  props.preAlgebra || props.logarithms || props.basicRelations || props.advancedRelations) {
@@ -8752,38 +8587,63 @@ function allPages(props) {
8752
8587
  if (props.trigonometry) {
8753
8588
  pages.push("Geometry");
8754
8589
  }
8590
+ if ((_props$extraKeys = props.extraKeys) !== null && _props$extraKeys !== void 0 && _props$extraKeys.length) {
8591
+ pages.push("Extras");
8592
+ }
8755
8593
  return pages;
8756
8594
  }
8757
- class Keypad extends React__namespace.Component {
8758
- constructor() {
8759
- super(...arguments);
8760
- _defineProperty(this, "state", {
8761
- selectedPage: "Numbers"
8762
- });
8763
- }
8764
- render() {
8765
- const {
8766
- selectedPage
8767
- } = this.state;
8768
- const availablePages = allPages(this.props);
8769
- return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, null, /*#__PURE__*/React__namespace.createElement(Tabbar, {
8770
- items: availablePages,
8771
- selectedItem: selectedPage,
8772
- onSelectItem: tabbarItem => {
8773
- this.setState({
8774
- selectedPage: tabbarItem
8775
- });
8776
- },
8777
- style: styles.tabbar
8778
- }), selectedPage === "Numbers" && /*#__PURE__*/React__namespace.createElement(NumbersPage, this.props), selectedPage === "Extras" && /*#__PURE__*/React__namespace.createElement(ExtrasPage, this.props), selectedPage === "Operators" && /*#__PURE__*/React__namespace.createElement(OperatorsPage, this.props), selectedPage === "Geometry" && /*#__PURE__*/React__namespace.createElement(GeometryPage, this.props));
8779
- }
8595
+ function Keypad(props) {
8596
+ const [selectedPage, setSelectedPage] = React__namespace.useState("Numbers");
8597
+ const availablePages = allPages(props);
8598
+ const {
8599
+ onClickKey,
8600
+ extraKeys = [],
8601
+ multiplicationDot,
8602
+ divisionKey,
8603
+ preAlgebra,
8604
+ logarithms,
8605
+ basicRelations,
8606
+ advancedRelations
8607
+ } = props;
8608
+ return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, null, /*#__PURE__*/React__namespace.createElement(Tabbar, {
8609
+ items: availablePages,
8610
+ selectedItem: selectedPage,
8611
+ onSelectItem: tabbarItem => {
8612
+ setSelectedPage(tabbarItem);
8613
+ },
8614
+ style: styles.tabbar
8615
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
8616
+ style: styles.grid
8617
+ }, selectedPage === "Numbers" && /*#__PURE__*/React__namespace.createElement(NumbersPage, {
8618
+ onClickKey: onClickKey
8619
+ }), selectedPage === "Extras" && /*#__PURE__*/React__namespace.createElement(ExtrasPage, {
8620
+ onClickKey: onClickKey,
8621
+ extraKeys: extraKeys
8622
+ }), selectedPage === "Operators" && /*#__PURE__*/React__namespace.createElement(OperatorsPage, {
8623
+ onClickKey: onClickKey,
8624
+ preAlgebra: preAlgebra,
8625
+ logarithms: logarithms,
8626
+ basicRelations: basicRelations,
8627
+ advancedRelations: advancedRelations
8628
+ }), selectedPage === "Geometry" && /*#__PURE__*/React__namespace.createElement(GeometryPage, {
8629
+ onClickKey: onClickKey
8630
+ }), /*#__PURE__*/React__namespace.createElement(SharedKeys, {
8631
+ onClickKey: onClickKey,
8632
+ multiplicationDot: multiplicationDot,
8633
+ divisionKey: divisionKey
8634
+ })));
8780
8635
  }
8781
- _defineProperty(Keypad, "defaultProps", {
8782
- extraKeys: []
8783
- });
8784
8636
  const styles = aphrodite.StyleSheet.create({
8785
8637
  tabbar: {
8786
8638
  background: Color__default["default"].white
8639
+ },
8640
+ grid: {
8641
+ display: "grid",
8642
+ gridTemplateColumns: "repeat(6, 1fr)",
8643
+ gridTemplateRows: "repeat(4, 1fr)",
8644
+ backgroundColor: "#DBDCDD",
8645
+ maxHeight: 200,
8646
+ maxWidth: 300
8787
8647
  }
8788
8648
  });
8789
8649
 
@@ -8793,6 +8653,8 @@ exports.Keypad = Keypad;
8793
8653
  exports.KeypadInput = MathInput;
8794
8654
  exports.KeypadType = KeypadType;
8795
8655
  exports.LegacyKeypad = ProvidedKeypad;
8656
+ exports.createMathField = createMathField;
8796
8657
  exports.keyTranslator = keyToMathquillMap;
8797
8658
  exports.keypadElementPropType = keypadElementPropType;
8659
+ exports.mathQuillInstance = mathQuillInstance;
8798
8660
  //# sourceMappingURL=index.js.map