@khanacademy/math-input 3.0.0 → 4.1.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/.eslintrc.js +7 -1
- package/CHANGELOG.md +42 -0
- package/dist/components/input/__tests__/test-math-wrapper.d.ts +1 -1
- package/dist/components/input/__tests__/test-math-wrapper.js.flow +1 -1
- package/dist/components/input/key-handlers/handle-arrow.d.ts +3 -0
- package/dist/components/input/key-handlers/handle-arrow.js.flow +12 -0
- package/dist/components/input/key-handlers/handle-backspace.d.ts +7 -0
- package/dist/components/input/key-handlers/handle-backspace.js.flow +14 -0
- package/dist/components/input/key-handlers/handle-exponent.d.ts +3 -0
- package/dist/components/input/key-handlers/handle-exponent.js.flow +12 -0
- package/dist/components/input/key-handlers/handle-jump-out.d.ts +7 -0
- package/dist/components/input/key-handlers/handle-jump-out.js.flow +14 -0
- package/dist/components/input/math-wrapper.d.ts +7 -78
- package/dist/components/input/math-wrapper.js.flow +16 -78
- package/dist/components/input/mathquill-helpers.d.ts +46 -0
- package/dist/components/input/mathquill-helpers.js.flow +56 -0
- package/dist/components/input/mathquill-instance.d.ts +3 -0
- package/dist/components/input/mathquill-instance.js.flow +9 -0
- package/dist/components/input/mathquill-types.d.ts +25 -0
- package/dist/components/input/mathquill-types.js.flow +34 -0
- package/dist/components/key-translator.d.ts +4 -0
- package/dist/components/key-translator.js.flow +10 -0
- package/dist/components/keypad/button-assets.d.ts +2 -2
- package/dist/components/keypad/button-assets.js.flow +2 -2
- package/dist/components/keypad/button.d.ts +1 -0
- package/dist/components/keypad/button.js.flow +1 -0
- package/dist/components/keypad/extras-page/index.d.ts +10 -0
- package/dist/components/keypad/extras-page/index.js.flow +15 -0
- package/dist/components/keypad/index.d.ts +7 -1
- package/dist/components/keypad/index.js.flow +7 -1
- package/dist/components/keypad/keypad-page-items.d.ts +1 -1
- package/dist/components/keypad/keypad-page-items.js.flow +1 -1
- package/dist/components/keypad-legacy/gesture-manager.d.ts +21 -9
- package/dist/components/keypad-legacy/gesture-manager.js.flow +27 -12
- package/dist/components/keypad-legacy/gesture-state-machine.d.ts +9 -9
- package/dist/components/keypad-legacy/gesture-state-machine.js.flow +10 -10
- package/dist/components/keypad-legacy/keypad-button.d.ts +2 -2
- package/dist/components/keypad-legacy/keypad-button.js.flow +3 -3
- package/dist/components/keypad-legacy/store/actions.d.ts +4 -14
- package/dist/components/keypad-legacy/store/actions.js.flow +3 -15
- package/dist/components/keypad-legacy/store/types.d.ts +2 -2
- package/dist/components/keypad-legacy/store/types.js.flow +2 -2
- package/dist/components/keypad-legacy/touchable-keypad-button.d.ts +6 -6
- package/dist/components/keypad-legacy/touchable-keypad-button.js.flow +9 -14
- package/dist/components/keypad-legacy/two-page-keypad.d.ts +6 -4
- package/dist/components/keypad-legacy/two-page-keypad.js.flow +6 -4
- package/dist/components/tabbar/tabbar.d.ts +6 -9
- package/dist/components/tabbar/tabbar.js.flow +6 -9
- package/dist/components/tabbar/types.d.ts +1 -1
- package/dist/components/tabbar/types.js.flow +1 -1
- package/dist/data/key-configs.d.ts +3 -6
- package/dist/data/key-configs.js.flow +3 -8
- package/dist/data/keys.d.ts +2 -54
- package/dist/data/keys.js.flow +116 -55
- package/dist/enums.d.ts +2 -9
- package/dist/enums.js.flow +2 -11
- package/dist/es/index.js +2000 -1346
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2288 -1392
- package/dist/index.js.flow +4 -2
- package/dist/index.js.map +1 -1
- package/dist/strings.js +26 -10
- package/dist/types.d.ts +10 -12
- package/dist/types.js.flow +13 -12
- package/package.json +2 -1
- package/src/components/input/__tests__/context-tracking.test.ts +43 -44
- package/src/components/input/__tests__/mathquill.test.ts +133 -135
- package/src/components/input/key-handlers/handle-arrow.ts +70 -0
- package/src/components/input/key-handlers/handle-backspace.ts +275 -0
- package/src/components/input/key-handlers/handle-exponent.ts +52 -0
- package/src/components/input/key-handlers/handle-jump-out.ts +103 -0
- package/src/components/input/math-input.tsx +11 -12
- package/src/components/input/math-wrapper.ts +88 -837
- package/src/components/input/mathquill-helpers.ts +268 -0
- package/src/components/input/mathquill-instance.ts +5 -0
- package/src/components/input/mathquill-types.ts +55 -0
- package/src/components/key-translator.ts +209 -0
- package/src/components/keypad/button-assets.tsx +441 -100
- package/src/components/keypad/button.tsx +7 -2
- package/src/components/keypad/extras-page/index.tsx +27 -0
- package/src/components/keypad/geometry-page/index.tsx +1 -1
- package/src/components/keypad/index.tsx +34 -7
- package/src/components/keypad/keypad-mathquill.stories.tsx +82 -0
- package/src/components/keypad/keypad-page-items.tsx +3 -1
- package/src/components/keypad/operators-page/index.tsx +1 -1
- package/src/components/keypad-legacy/echo-manager.tsx +4 -4
- package/src/components/keypad-legacy/empty-keypad-button.tsx +6 -4
- package/src/components/keypad-legacy/gesture-manager.ts +32 -9
- package/src/components/keypad-legacy/gesture-state-machine.ts +14 -14
- package/src/components/keypad-legacy/keypad-button.tsx +15 -18
- package/src/components/keypad-legacy/many-keypad-button.tsx +9 -2
- package/src/components/keypad-legacy/store/actions.ts +3 -29
- package/src/components/keypad-legacy/store/echo-reducer.ts +2 -5
- package/src/components/keypad-legacy/store/index.ts +4 -10
- package/src/components/keypad-legacy/store/input-reducer.ts +1 -2
- package/src/components/keypad-legacy/store/keypad-reducer.ts +2 -3
- package/src/components/keypad-legacy/store/types.ts +2 -2
- package/src/components/keypad-legacy/touchable-keypad-button.tsx +8 -13
- package/src/components/keypad-legacy/two-page-keypad.tsx +18 -6
- package/src/components/tabbar/__tests__/tabbar.test.tsx +36 -36
- package/src/components/tabbar/icons.tsx +68 -52
- package/src/components/tabbar/item.tsx +5 -1
- package/src/components/tabbar/tabbar.stories.tsx +23 -12
- package/src/components/tabbar/tabbar.tsx +22 -38
- package/src/components/tabbar/types.ts +1 -1
- package/src/data/key-configs.ts +751 -304
- package/src/data/keys.ts +118 -65
- package/src/enums.ts +10 -9
- package/src/index.ts +3 -2
- package/src/math-input.stories.tsx +1 -1
- package/src/types.ts +10 -12
- package/tsconfig-build.tsbuildinfo +1 -1
package/dist/index.js
CHANGED
|
@@ -116,71 +116,13 @@ function _toPropertyKey(arg) {
|
|
|
116
116
|
return typeof key === "symbol" ? key : String(key);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
/**
|
|
120
|
-
* This file contains constants for keypad buttons that aren't single
|
|
121
|
-
* alphanumeric characters.
|
|
122
|
-
*/
|
|
123
|
-
// TODO(charlie): There's duplication between this file and key-configs.js.
|
|
124
|
-
// We should clean it up by removing this file and requiring clients to use the
|
|
125
|
-
// `id` field on the key configurations.
|
|
126
|
-
var Keys = /*#__PURE__*/function (Keys) {
|
|
127
|
-
Keys["PLUS"] = "PLUS";
|
|
128
|
-
Keys["MINUS"] = "MINUS";
|
|
129
|
-
Keys["NEGATIVE"] = "NEGATIVE";
|
|
130
|
-
Keys["TIMES"] = "TIMES";
|
|
131
|
-
Keys["DIVIDE"] = "DIVIDE";
|
|
132
|
-
Keys["DECIMAL"] = "DECIMAL";
|
|
133
|
-
Keys["PERIOD"] = "PERIOD";
|
|
134
|
-
Keys["PERCENT"] = "PERCENT";
|
|
135
|
-
Keys["CDOT"] = "CDOT";
|
|
136
|
-
Keys["EQUAL"] = "EQUAL";
|
|
137
|
-
Keys["NEQ"] = "NEQ";
|
|
138
|
-
Keys["GT"] = "GT";
|
|
139
|
-
Keys["LT"] = "LT";
|
|
140
|
-
Keys["GEQ"] = "GEQ";
|
|
141
|
-
Keys["LEQ"] = "LEQ";
|
|
142
|
-
Keys["FRAC_INCLUSIVE"] = "FRAC_INCLUSIVE";
|
|
143
|
-
Keys["FRAC_EXCLUSIVE"] = "FRAC_EXCLUSIVE";
|
|
144
|
-
Keys["FRAC"] = "FRAC";
|
|
145
|
-
Keys["EXP"] = "EXP";
|
|
146
|
-
Keys["EXP_2"] = "EXP_2";
|
|
147
|
-
Keys["EXP_3"] = "EXP_3";
|
|
148
|
-
Keys["SQRT"] = "SQRT";
|
|
149
|
-
Keys["CUBE_ROOT"] = "CUBE_ROOT";
|
|
150
|
-
Keys["RADICAL"] = "RADICAL";
|
|
151
|
-
Keys["LEFT_PAREN"] = "LEFT_PAREN";
|
|
152
|
-
Keys["RIGHT_PAREN"] = "RIGHT_PAREN";
|
|
153
|
-
Keys["LN"] = "LN";
|
|
154
|
-
Keys["LOG"] = "LOG";
|
|
155
|
-
Keys["LOG_N"] = "LOG_N";
|
|
156
|
-
Keys["SIN"] = "SIN";
|
|
157
|
-
Keys["COS"] = "COS";
|
|
158
|
-
Keys["TAN"] = "TAN";
|
|
159
|
-
Keys["PI"] = "PI";
|
|
160
|
-
Keys["THETA"] = "THETA";
|
|
161
|
-
Keys["UP"] = "UP";
|
|
162
|
-
Keys["RIGHT"] = "RIGHT";
|
|
163
|
-
Keys["DOWN"] = "DOWN";
|
|
164
|
-
Keys["LEFT"] = "LEFT";
|
|
165
|
-
Keys["BACKSPACE"] = "BACKSPACE";
|
|
166
|
-
Keys["DISMISS"] = "DISMISS";
|
|
167
|
-
Keys["JUMP_OUT_PARENTHESES"] = "JUMP_OUT_PARENTHESES";
|
|
168
|
-
Keys["JUMP_OUT_EXPONENT"] = "JUMP_OUT_EXPONENT";
|
|
169
|
-
Keys["JUMP_OUT_BASE"] = "JUMP_OUT_BASE";
|
|
170
|
-
Keys["JUMP_INTO_NUMERATOR"] = "JUMP_INTO_NUMERATOR";
|
|
171
|
-
Keys["JUMP_OUT_NUMERATOR"] = "JUMP_OUT_NUMERATOR";
|
|
172
|
-
Keys["JUMP_OUT_DENOMINATOR"] = "JUMP_OUT_DENOMINATOR";
|
|
173
|
-
Keys["NOOP"] = "NOOP";
|
|
174
|
-
return Keys;
|
|
175
|
-
}(Keys || {}); // mobile native only
|
|
176
|
-
|
|
177
119
|
class Text extends React__namespace.Component {
|
|
178
120
|
render() {
|
|
179
121
|
const {
|
|
180
122
|
numberOfLines,
|
|
181
123
|
style
|
|
182
124
|
} = this.props;
|
|
183
|
-
const className = aphrodite.css(styles$
|
|
125
|
+
const className = aphrodite.css(styles$h.initial, ...(Array.isArray(style) ? style : [style]), numberOfLines === 1 && styles$h.singleLineStyle);
|
|
184
126
|
return /*#__PURE__*/React__namespace.createElement("span", {
|
|
185
127
|
className: className,
|
|
186
128
|
style: this.props.dynamicStyle
|
|
@@ -189,7 +131,7 @@ class Text extends React__namespace.Component {
|
|
|
189
131
|
}
|
|
190
132
|
|
|
191
133
|
// https://github.com/necolas/react-native-web/blob/master/src/components/Text/index.js
|
|
192
|
-
const styles$
|
|
134
|
+
const styles$h = aphrodite.StyleSheet.create({
|
|
193
135
|
initial: {
|
|
194
136
|
color: "inherit",
|
|
195
137
|
display: "inline",
|
|
@@ -468,16 +410,23 @@ let KeypadType = /*#__PURE__*/function (KeypadType) {
|
|
|
468
410
|
KeypadType["EXPRESSION"] = "EXPRESSION";
|
|
469
411
|
return KeypadType;
|
|
470
412
|
}({});
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
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"];
|
|
481
430
|
let DeviceOrientation = /*#__PURE__*/function (DeviceOrientation) {
|
|
482
431
|
DeviceOrientation["LANDSCAPE"] = "LANDSCAPE";
|
|
483
432
|
DeviceOrientation["PORTRAIT"] = "PORTRAIT";
|
|
@@ -530,125 +479,209 @@ let EchoAnimationType = /*#__PURE__*/function (EchoAnimationType) {
|
|
|
530
479
|
// listed here. Much of the Arab world uses U+066C.
|
|
531
480
|
const decimalSeparator = i18n.getDecimalSeparator() === "," ? DecimalSeparator.COMMA : DecimalSeparator.PERIOD;
|
|
532
481
|
|
|
533
|
-
|
|
534
|
-
// If it does not exist, fall back to CommonJS require. - jsatk
|
|
482
|
+
var MQ = MathQuill__default["default"].getInterface(2);
|
|
535
483
|
|
|
536
|
-
const decimalSymbol = decimalSeparator === DecimalSeparator.COMMA ? "," : ".";
|
|
537
484
|
var ActionType = /*#__PURE__*/function (ActionType) {
|
|
538
485
|
ActionType["WRITE"] = "write";
|
|
539
486
|
ActionType["CMD"] = "cmd";
|
|
540
487
|
ActionType["KEYSTROKE"] = "keystroke";
|
|
541
488
|
ActionType[ActionType["MQ_END"] = 0] = "MQ_END";
|
|
542
489
|
return ActionType;
|
|
543
|
-
}(ActionType || {});
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
},
|
|
592
|
-
[Keys.RIGHT_PAREN]: {
|
|
593
|
-
str: ")",
|
|
594
|
-
fn: ActionType.CMD
|
|
595
|
-
},
|
|
596
|
-
[Keys.SQRT]: {
|
|
597
|
-
str: "sqrt",
|
|
598
|
-
fn: ActionType.CMD
|
|
599
|
-
},
|
|
600
|
-
[Keys.PI]: {
|
|
601
|
-
str: "pi",
|
|
602
|
-
fn: ActionType.CMD
|
|
603
|
-
},
|
|
604
|
-
[Keys.THETA]: {
|
|
605
|
-
str: "theta",
|
|
606
|
-
fn: ActionType.CMD
|
|
607
|
-
},
|
|
608
|
-
[Keys.RADICAL]: {
|
|
609
|
-
str: "nthroot",
|
|
610
|
-
fn: ActionType.CMD
|
|
611
|
-
},
|
|
612
|
-
[Keys.LT]: {
|
|
613
|
-
str: "<",
|
|
614
|
-
fn: ActionType.WRITE
|
|
615
|
-
},
|
|
616
|
-
[Keys.LEQ]: {
|
|
617
|
-
str: "\\leq",
|
|
618
|
-
fn: ActionType.WRITE
|
|
619
|
-
},
|
|
620
|
-
[Keys.GT]: {
|
|
621
|
-
str: ">",
|
|
622
|
-
fn: ActionType.WRITE
|
|
623
|
-
},
|
|
624
|
-
[Keys.GEQ]: {
|
|
625
|
-
str: "\\geq",
|
|
626
|
-
fn: ActionType.WRITE
|
|
627
|
-
},
|
|
628
|
-
[Keys.UP]: {
|
|
629
|
-
str: "Up",
|
|
630
|
-
fn: ActionType.KEYSTROKE
|
|
631
|
-
},
|
|
632
|
-
[Keys.DOWN]: {
|
|
633
|
-
str: "Down",
|
|
634
|
-
fn: ActionType.KEYSTROKE
|
|
635
|
-
},
|
|
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
|
+
}
|
|
512
|
+
};
|
|
513
|
+
}
|
|
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"),
|
|
636
538
|
// The `FRAC_EXCLUSIVE` variant is handled manually, since we may need to do
|
|
637
539
|
// some additional navigation depending on the cursor position.
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
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
|
+
|
|
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")
|
|
649
671
|
};
|
|
650
|
-
|
|
651
|
-
|
|
672
|
+
|
|
673
|
+
let MathFieldActionType = /*#__PURE__*/function (MathFieldActionType) {
|
|
674
|
+
MathFieldActionType["WRITE"] = "write";
|
|
675
|
+
MathFieldActionType["CMD"] = "cmd";
|
|
676
|
+
MathFieldActionType["KEYSTROKE"] = "keystroke";
|
|
677
|
+
MathFieldActionType[MathFieldActionType["MQ_END"] = 0] = "MQ_END";
|
|
678
|
+
return MathFieldActionType;
|
|
679
|
+
}({});
|
|
680
|
+
|
|
681
|
+
// The MathQuill MathField Cursor
|
|
682
|
+
// it's not part of the public API for MathQuill,
|
|
683
|
+
// we reach into the internals to get it
|
|
684
|
+
|
|
652
685
|
const Numerals = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
|
|
653
686
|
const GreekLetters = ["\\theta", "\\pi"];
|
|
654
687
|
const Letters = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"];
|
|
@@ -656,25 +689,625 @@ const Letters = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M"
|
|
|
656
689
|
// We only consider numerals, variables, and Greek Letters to be proper
|
|
657
690
|
// leaf nodes.
|
|
658
691
|
const ValidLeaves = [...Numerals, ...GreekLetters, ...Letters.map(letter => letter.toLowerCase()), ...Letters.map(letter => letter.toUpperCase())];
|
|
692
|
+
function getCursor(mathField) {
|
|
693
|
+
return mathField.__controller.cursor;
|
|
694
|
+
}
|
|
695
|
+
function isFraction(node) {
|
|
696
|
+
return node.jQ && node.jQ.hasClass("mq-fraction");
|
|
697
|
+
}
|
|
698
|
+
function isNumerator(node) {
|
|
699
|
+
return node.jQ && node.jQ.hasClass("mq-numerator");
|
|
700
|
+
}
|
|
701
|
+
function isDenominator(node) {
|
|
702
|
+
return node.jQ && node.jQ.hasClass("mq-denominator");
|
|
703
|
+
}
|
|
704
|
+
function isSubScript(node) {
|
|
705
|
+
// NOTE(charlie): MyScript has a structure whereby its superscripts seem
|
|
706
|
+
// to be represented as a parent node with 'mq-sup-only' containing a
|
|
707
|
+
// single child with 'mq-sup'.
|
|
708
|
+
return node.jQ && (node.jQ.hasClass("mq-sub-only") || node.jQ.hasClass("mq-sub"));
|
|
709
|
+
}
|
|
710
|
+
function isSuperScript(node) {
|
|
711
|
+
// NOTE(charlie): MyScript has a structure whereby its superscripts seem
|
|
712
|
+
// to be represented as a parent node with 'mq-sup-only' containing a
|
|
713
|
+
// single child with 'mq-sup'.
|
|
714
|
+
return node.jQ && (node.jQ.hasClass("mq-sup-only") || node.jQ.hasClass("mq-sup"));
|
|
715
|
+
}
|
|
716
|
+
function isParens(node) {
|
|
717
|
+
return node && node.ctrlSeq === "\\left(";
|
|
718
|
+
}
|
|
719
|
+
function isLeaf(node) {
|
|
720
|
+
return node && node.ctrlSeq && ValidLeaves.includes(node.ctrlSeq.trim());
|
|
721
|
+
}
|
|
722
|
+
function isSquareRoot(node) {
|
|
723
|
+
return node.blocks && node.blocks[0].jQ && node.blocks[0].jQ.hasClass("mq-sqrt-stem");
|
|
724
|
+
}
|
|
725
|
+
function isNthRoot(node) {
|
|
726
|
+
return node.blocks && node.blocks[0].jQ && node.blocks[0].jQ.hasClass("mq-nthroot");
|
|
727
|
+
}
|
|
728
|
+
function isNthRootIndex(node) {
|
|
729
|
+
return node.jQ && node.jQ.hasClass("mq-nthroot");
|
|
730
|
+
}
|
|
731
|
+
function isInsideLogIndex(cursor) {
|
|
732
|
+
const grandparent = cursor.parent.parent;
|
|
733
|
+
if (grandparent && grandparent.jQ.hasClass("mq-supsub")) {
|
|
734
|
+
const command = maybeFindCommandBeforeParens(grandparent);
|
|
735
|
+
if (command && command.name === "\\log") {
|
|
736
|
+
return true;
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
return false;
|
|
740
|
+
}
|
|
741
|
+
function isInsideEmptyNode(cursor) {
|
|
742
|
+
return cursor[MQ.L] === MathFieldActionType.MQ_END && cursor[MQ.R] === MathFieldActionType.MQ_END;
|
|
743
|
+
}
|
|
744
|
+
function selectNode(node, cursor) {
|
|
745
|
+
cursor.insLeftOf(node);
|
|
746
|
+
cursor.startSelection();
|
|
747
|
+
cursor.insRightOf(node);
|
|
748
|
+
cursor.select();
|
|
749
|
+
cursor.endSelection();
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
/**
|
|
753
|
+
* Return the start node, end node, and full name of the command of which
|
|
754
|
+
* the initial node is a part, or `null` if the node is not part of a
|
|
755
|
+
* command.
|
|
756
|
+
*
|
|
757
|
+
* @param {node} initialNode - the node to included as part of the command
|
|
758
|
+
* @returns {null|object} - `null` or an object containing the start node
|
|
759
|
+
* (`startNode`), end node (`endNode`), and full
|
|
760
|
+
* name (`name`) of the command
|
|
761
|
+
*/
|
|
762
|
+
function maybeFindCommand(initialNode) {
|
|
763
|
+
if (!initialNode) {
|
|
764
|
+
return null;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
// MathQuill stores commands as separate characters so that
|
|
768
|
+
// users can delete commands one character at a time. We iterate over
|
|
769
|
+
// the nodes from right to left until we hit a sequence starting with a
|
|
770
|
+
// '\\', which signifies the start of a command; then we iterate from
|
|
771
|
+
// left to right until we hit a '\\left(', which signifies the end of a
|
|
772
|
+
// command. If we encounter any character that doesn't belong in a
|
|
773
|
+
// command, we return null. We match a single character at a time.
|
|
774
|
+
// Ex) ['\\l', 'o', 'g ', '\\left(', ...]
|
|
775
|
+
const commandCharRegex = /^[a-z]$/;
|
|
776
|
+
const commandStartRegex = /^\\[a-z]$/;
|
|
777
|
+
const commandEndSeq = "\\left(";
|
|
778
|
+
|
|
779
|
+
// Note: We allowlist the set of valid commands, since relying solely on
|
|
780
|
+
// a command being prefixed with a backslash leads to undesired
|
|
781
|
+
// behavior. For example, Greek symbols, left parentheses, and square
|
|
782
|
+
// roots all get treated as commands.
|
|
783
|
+
const validCommands = ["\\log", "\\ln", "\\cos", "\\sin", "\\tan"];
|
|
784
|
+
let name = "";
|
|
785
|
+
let startNode;
|
|
786
|
+
let endNode;
|
|
787
|
+
|
|
788
|
+
// Collect the portion of the command from the current node, leftwards
|
|
789
|
+
// until the start of the command.
|
|
790
|
+
let node = initialNode;
|
|
791
|
+
while (node !== 0) {
|
|
792
|
+
const ctrlSeq = node.ctrlSeq.trim();
|
|
793
|
+
if (commandCharRegex.test(ctrlSeq)) {
|
|
794
|
+
name = ctrlSeq + name;
|
|
795
|
+
} else if (commandStartRegex.test(ctrlSeq)) {
|
|
796
|
+
name = ctrlSeq + name;
|
|
797
|
+
startNode = node;
|
|
798
|
+
break;
|
|
799
|
+
} else {
|
|
800
|
+
break;
|
|
801
|
+
}
|
|
802
|
+
node = node[MQ.L];
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
// If we hit the start of a command, then grab the rest of it by
|
|
806
|
+
// iterating rightwards to compute the full name of the command, along
|
|
807
|
+
// with its terminal node.
|
|
808
|
+
if (startNode) {
|
|
809
|
+
// Next, iterate from the start to the right.
|
|
810
|
+
node = initialNode[MQ.R];
|
|
811
|
+
while (node !== 0) {
|
|
812
|
+
const ctrlSeq = node.ctrlSeq.trim();
|
|
813
|
+
if (commandCharRegex.test(ctrlSeq)) {
|
|
814
|
+
// If we have a single character, add it to the command
|
|
815
|
+
// name.
|
|
816
|
+
name = name + ctrlSeq;
|
|
817
|
+
} else if (ctrlSeq === commandEndSeq) {
|
|
818
|
+
// If we hit the command end delimiter (the left
|
|
819
|
+
// parentheses surrounding its arguments), stop.
|
|
820
|
+
endNode = node;
|
|
821
|
+
break;
|
|
822
|
+
}
|
|
823
|
+
node = node[MQ.R];
|
|
824
|
+
}
|
|
825
|
+
if (validCommands.includes(name)) {
|
|
826
|
+
return {
|
|
827
|
+
name,
|
|
828
|
+
startNode,
|
|
829
|
+
endNode
|
|
830
|
+
};
|
|
831
|
+
} else {
|
|
832
|
+
return null;
|
|
833
|
+
}
|
|
834
|
+
} else {
|
|
835
|
+
return null;
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
/**
|
|
840
|
+
* Return the start node, end node, and full name of the command to the left
|
|
841
|
+
* of `\\left(`, or `null` if there is no command.
|
|
842
|
+
*
|
|
843
|
+
* @param {node} leftParenNode - node where .ctrlSeq == `\\left(`
|
|
844
|
+
* @returns {null|object} - `null` or an object containing the start node
|
|
845
|
+
* (`startNode`), end node (`endNode`), and full
|
|
846
|
+
* name (`name`) of the command
|
|
847
|
+
*/
|
|
848
|
+
function maybeFindCommandBeforeParens(leftParenNode) {
|
|
849
|
+
return maybeFindCommand(leftParenNode[MQ.L]);
|
|
850
|
+
}
|
|
851
|
+
function contextForCursor(cursor) {
|
|
852
|
+
// First, try to find any fraction to the right, unimpeded.
|
|
853
|
+
let visitor = cursor;
|
|
854
|
+
while (visitor[MQ.R] !== MathFieldActionType.MQ_END) {
|
|
855
|
+
if (isFraction(visitor[MQ.R])) {
|
|
856
|
+
return CursorContext.BEFORE_FRACTION;
|
|
857
|
+
} else if (!isLeaf(visitor[MQ.R])) {
|
|
858
|
+
break;
|
|
859
|
+
}
|
|
860
|
+
visitor = visitor[MQ.R];
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
// If that didn't work, check if the parent or grandparent is a special
|
|
864
|
+
// context, so that we can jump outwards.
|
|
865
|
+
if (isParens(cursor.parent && cursor.parent.parent)) {
|
|
866
|
+
return CursorContext.IN_PARENS;
|
|
867
|
+
} else if (isNumerator(cursor.parent)) {
|
|
868
|
+
return CursorContext.IN_NUMERATOR;
|
|
869
|
+
} else if (isDenominator(cursor.parent)) {
|
|
870
|
+
return CursorContext.IN_DENOMINATOR;
|
|
871
|
+
} else if (isSubScript(cursor.parent)) {
|
|
872
|
+
return CursorContext.IN_SUB_SCRIPT;
|
|
873
|
+
} else if (isSuperScript(cursor.parent)) {
|
|
874
|
+
return CursorContext.IN_SUPER_SCRIPT;
|
|
875
|
+
} else {
|
|
876
|
+
return CursorContext.NONE;
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
|
|
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
|
+
function handleBackspaceInNthRoot(mathField, cursor) {
|
|
930
|
+
const isAtLeftEnd = cursor[MQ.L] === MathFieldActionType.MQ_END;
|
|
931
|
+
const isRootEmpty = isInsideEmptyNode(cursor.parent.parent.blocks[0].ends);
|
|
932
|
+
if (isAtLeftEnd) {
|
|
933
|
+
selectNode(cursor.parent.parent, cursor);
|
|
934
|
+
if (isRootEmpty) {
|
|
935
|
+
mathField.keystroke("Backspace");
|
|
936
|
+
}
|
|
937
|
+
} else {
|
|
938
|
+
mathField.keystroke("Backspace");
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
function handleBackspaceInRootIndex(mathField, cursor) {
|
|
942
|
+
if (isInsideEmptyNode(cursor)) {
|
|
943
|
+
// When deleting the index in a nthroot, we change from the nthroot
|
|
944
|
+
// to a sqrt, e.g. \sqrt[|]{35x-5} => |\sqrt{35x-5}. If there's no
|
|
945
|
+
// content under the root, then we delete the whole thing.
|
|
946
|
+
|
|
947
|
+
const grandparent = cursor.parent.parent;
|
|
948
|
+
const latex = grandparent.latex();
|
|
949
|
+
const reinsertionPoint = grandparent[MQ.L];
|
|
950
|
+
selectNode(grandparent, cursor);
|
|
951
|
+
const rootIsEmpty = grandparent.blocks[1].jQ.text() === "";
|
|
952
|
+
if (rootIsEmpty) {
|
|
953
|
+
// If there is not content under the root then simply delete
|
|
954
|
+
// the whole thing.
|
|
955
|
+
mathField.keystroke("Backspace");
|
|
956
|
+
} else {
|
|
957
|
+
// Replace the nthroot with a sqrt if there was content under
|
|
958
|
+
// the root.
|
|
959
|
+
|
|
960
|
+
// Start by deleting the selection.
|
|
961
|
+
mathField.keystroke("Backspace");
|
|
962
|
+
|
|
963
|
+
// Replace the nth-root with a sqrt.
|
|
964
|
+
mathField.write(latex.replace(/^\\sqrt\[\]/, "\\sqrt"));
|
|
965
|
+
|
|
966
|
+
// Adjust the cursor to be to the left the sqrt.
|
|
967
|
+
if (reinsertionPoint === MathFieldActionType.MQ_END) {
|
|
968
|
+
mathField.moveToDirEnd(MQ.L);
|
|
969
|
+
} else {
|
|
970
|
+
cursor.insRightOf(reinsertionPoint);
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
} else {
|
|
974
|
+
if (cursor[MQ.L] !== MathFieldActionType.MQ_END) {
|
|
975
|
+
// If the cursor is not at the leftmost position inside the
|
|
976
|
+
// root's index, delete a character.
|
|
977
|
+
mathField.keystroke("Backspace");
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
function handleBackspaceInLogIndex(mathField, cursor) {
|
|
982
|
+
if (isInsideEmptyNode(cursor)) {
|
|
983
|
+
const grandparent = cursor.parent.parent;
|
|
984
|
+
const command = maybeFindCommandBeforeParens(grandparent);
|
|
985
|
+
cursor.insLeftOf(command === null || command === void 0 ? void 0 : command.startNode);
|
|
986
|
+
cursor.startSelection();
|
|
987
|
+
if (grandparent[MQ.R] !== MathFieldActionType.MQ_END) {
|
|
988
|
+
cursor.insRightOf(grandparent[MQ.R]);
|
|
989
|
+
} else {
|
|
990
|
+
cursor.insRightOf(grandparent);
|
|
991
|
+
}
|
|
992
|
+
cursor.select();
|
|
993
|
+
cursor.endSelection();
|
|
994
|
+
const isLogBodyEmpty = grandparent[MQ.R].contentjQ.text() === "";
|
|
995
|
+
if (isLogBodyEmpty) {
|
|
996
|
+
// If there's no content inside the log's parens then delete the
|
|
997
|
+
// whole thing.
|
|
998
|
+
mathField.keystroke("Backspace");
|
|
999
|
+
}
|
|
1000
|
+
} else {
|
|
1001
|
+
mathField.keystroke("Backspace");
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
function handleBackspaceOutsideParens(cursor) {
|
|
1005
|
+
// In this case the node with '\\left(' for its ctrlSeq
|
|
1006
|
+
// is the parent of the expression contained within the
|
|
1007
|
+
// parentheses.
|
|
1008
|
+
//
|
|
1009
|
+
// Handle selecting an expression before deleting:
|
|
1010
|
+
// (x+1)| => |(x+1)|
|
|
1011
|
+
// \log(x+1)| => |\log(x+1)|
|
|
1012
|
+
|
|
1013
|
+
const leftNode = cursor[MQ.L];
|
|
1014
|
+
const rightNode = cursor[MQ.R];
|
|
1015
|
+
const command = maybeFindCommandBeforeParens(leftNode);
|
|
1016
|
+
if (command && command.startNode) {
|
|
1017
|
+
// There's a command before the parens so we select it as well as
|
|
1018
|
+
// the parens.
|
|
1019
|
+
cursor.insLeftOf(command.startNode);
|
|
1020
|
+
cursor.startSelection();
|
|
1021
|
+
if (rightNode === MathFieldActionType.MQ_END) {
|
|
1022
|
+
cursor.insAtRightEnd(cursor.parent);
|
|
1023
|
+
} else {
|
|
1024
|
+
cursor.insLeftOf(rightNode);
|
|
1025
|
+
}
|
|
1026
|
+
cursor.select();
|
|
1027
|
+
cursor.endSelection();
|
|
1028
|
+
} else {
|
|
1029
|
+
cursor.startSelection();
|
|
1030
|
+
cursor.insLeftOf(leftNode); // left of \\left(
|
|
1031
|
+
cursor.select();
|
|
1032
|
+
cursor.endSelection();
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
function handleBackspaceInsideParens(mathField, cursor) {
|
|
1036
|
+
// Handle situations when the cursor is inside parens or a
|
|
1037
|
+
// command that uses parens, e.g. \log() or \tan()
|
|
1038
|
+
//
|
|
1039
|
+
// MathQuill represents log(x+1) in roughly the following way
|
|
1040
|
+
// [l, o, g, \\left[parent:[x, +, 1]]]
|
|
1041
|
+
//
|
|
1042
|
+
// If the cursor is inside the parentheses it's next to one of:
|
|
1043
|
+
// x, +, or 1. This makes sub_sub_expr its parent and sub_expr
|
|
1044
|
+
// it's parent.
|
|
1045
|
+
//
|
|
1046
|
+
// Interestingly parent doesn't have any nodes to the left or
|
|
1047
|
+
// right of it (even though the corresponding DOM node has
|
|
1048
|
+
// ( and ) characters on either side.
|
|
1049
|
+
//
|
|
1050
|
+
// The grandparent's ctrlSeq is `\\left(`. The `\\right)` isn't
|
|
1051
|
+
// stored anywhere. NOTE(kevinb): I believe this is because
|
|
1052
|
+
// MathQuill knows what the close paren should be and does the
|
|
1053
|
+
// right thing at render time.
|
|
1054
|
+
//
|
|
1055
|
+
// This conditional branch handles the following cases:
|
|
1056
|
+
// - \log(x+1|) => \log(x+|)
|
|
1057
|
+
// - \log(|x+1) => |\log(x+1)|
|
|
1058
|
+
// - \log(|) => |
|
|
1059
|
+
|
|
1060
|
+
if (cursor[MQ.L] !== MathFieldActionType.MQ_END) {
|
|
1061
|
+
// This command contains math and there's some math to
|
|
1062
|
+
// the left of the cursor that we should delete normally
|
|
1063
|
+
// before doing anything special.
|
|
1064
|
+
mathField.keystroke("Backspace");
|
|
1065
|
+
return;
|
|
1066
|
+
}
|
|
1067
|
+
const grandparent = cursor.parent.parent;
|
|
1068
|
+
|
|
1069
|
+
// If the cursors is inside the parens at the start but the command
|
|
1070
|
+
// has a subscript as is the case in log_n then move the cursor into
|
|
1071
|
+
// the subscript, e.g. \log_{5}(|x+1) => \log_{5|}(x+1)
|
|
1072
|
+
|
|
1073
|
+
if (grandparent[MQ.L].sub) {
|
|
1074
|
+
// if there is a subscript
|
|
1075
|
+
if (grandparent[MQ.L].sub.jQ.text()) {
|
|
1076
|
+
// and it contains text
|
|
1077
|
+
// move the cursor to the right end of the subscript
|
|
1078
|
+
cursor.insAtRightEnd(grandparent[MQ.L].sub);
|
|
1079
|
+
return;
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
// Determine if the parens are empty before we modify the
|
|
1084
|
+
// cursor's position.
|
|
1085
|
+
const isEmpty = isInsideEmptyNode(cursor);
|
|
1086
|
+
|
|
1087
|
+
// Insert the cursor to the left of the command if there is one
|
|
1088
|
+
// or before the '\\left(` if there isn't
|
|
1089
|
+
const command = maybeFindCommandBeforeParens(grandparent);
|
|
1090
|
+
cursor.insLeftOf(command && command.startNode || grandparent);
|
|
1091
|
+
cursor.startSelection();
|
|
1092
|
+
cursor.insRightOf(grandparent);
|
|
1093
|
+
cursor.select();
|
|
1094
|
+
cursor.endSelection();
|
|
1095
|
+
|
|
1096
|
+
// Delete the selection, but only if the parens were empty to
|
|
1097
|
+
// begin with.
|
|
1098
|
+
if (isEmpty) {
|
|
1099
|
+
mathField.keystroke("Backspace");
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
function handleBackspaceAfterLigaturedSymbol(mathField) {
|
|
1103
|
+
mathField.keystroke("Backspace");
|
|
1104
|
+
mathField.keystroke("Backspace");
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
/**
|
|
1108
|
+
* Selects and deletes part of the expression based on the cursor location.
|
|
1109
|
+
* See inline comments for precise behavior of different cases.
|
|
1110
|
+
*/
|
|
1111
|
+
function handleBackspace(mathField) {
|
|
1112
|
+
const cursor = getCursor(mathField);
|
|
1113
|
+
if (!cursor.selection) {
|
|
1114
|
+
const parent = cursor.parent;
|
|
1115
|
+
const grandparent = parent.parent;
|
|
1116
|
+
const leftNode = cursor[MQ.L];
|
|
1117
|
+
if (isFraction(leftNode)) {
|
|
1118
|
+
selectNode(leftNode, cursor);
|
|
1119
|
+
} else if (isSquareRoot(leftNode)) {
|
|
1120
|
+
selectNode(leftNode, cursor);
|
|
1121
|
+
} else if (isNthRoot(leftNode)) {
|
|
1122
|
+
selectNode(leftNode, cursor);
|
|
1123
|
+
} else if (isNthRootIndex(parent)) {
|
|
1124
|
+
handleBackspaceInRootIndex(mathField, cursor);
|
|
1125
|
+
} else if (leftNode.ctrlSeq === "\\left(") {
|
|
1126
|
+
handleBackspaceOutsideParens(cursor);
|
|
1127
|
+
} else if (grandparent.ctrlSeq === "\\left(") {
|
|
1128
|
+
handleBackspaceInsideParens(mathField, cursor);
|
|
1129
|
+
} else if (isInsideLogIndex(cursor)) {
|
|
1130
|
+
handleBackspaceInLogIndex(mathField, cursor);
|
|
1131
|
+
} else if (leftNode.ctrlSeq === "\\ge " || leftNode.ctrlSeq === "\\le ") {
|
|
1132
|
+
handleBackspaceAfterLigaturedSymbol(mathField);
|
|
1133
|
+
} else if (isNthRoot(grandparent) && leftNode === MathFieldActionType.MQ_END) {
|
|
1134
|
+
handleBackspaceInNthRoot(mathField, cursor);
|
|
1135
|
+
} else {
|
|
1136
|
+
mathField.keystroke("Backspace");
|
|
1137
|
+
}
|
|
1138
|
+
} else {
|
|
1139
|
+
mathField.keystroke("Backspace");
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
const ArithmeticOperators = ["+", "-", "\\cdot", "\\times", "\\div"];
|
|
1144
|
+
const EqualityOperators = ["=", "\\neq", "<", "\\leq", ">", "\\geq"];
|
|
1145
|
+
function handleExponent(mathField, key) {
|
|
1146
|
+
const cursor = getCursor(mathField);
|
|
1147
|
+
// If there's an invalid operator preceding the cursor (anything that
|
|
1148
|
+
// knowingly cannot be raised to a power), add an empty set of
|
|
1149
|
+
// parentheses and apply the exponent to that.
|
|
1150
|
+
const invalidPrefixes = [...ArithmeticOperators, ...EqualityOperators];
|
|
1151
|
+
const precedingNode = cursor[MQ.L];
|
|
1152
|
+
const shouldPrefixWithParens = precedingNode === MathFieldActionType.MQ_END || invalidPrefixes.includes(precedingNode.ctrlSeq.trim());
|
|
1153
|
+
if (shouldPrefixWithParens) {
|
|
1154
|
+
mathField.write("\\left(\\right)");
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
// Insert the appropriate exponent operator.
|
|
1158
|
+
switch (key) {
|
|
1159
|
+
case "EXP":
|
|
1160
|
+
mathField.cmd("^");
|
|
1161
|
+
break;
|
|
1162
|
+
case "EXP_2":
|
|
1163
|
+
case "EXP_3":
|
|
1164
|
+
mathField.write("^".concat(key === "EXP_2" ? 2 : 3));
|
|
1165
|
+
|
|
1166
|
+
// If we enter a square or a cube, we should leave the cursor
|
|
1167
|
+
// within the newly inserted parens, if they exist. This takes
|
|
1168
|
+
// exactly four left strokes, since the cursor by default would
|
|
1169
|
+
// end up to the right of the exponent.
|
|
1170
|
+
if (shouldPrefixWithParens) {
|
|
1171
|
+
mathField.keystroke("Left");
|
|
1172
|
+
mathField.keystroke("Left");
|
|
1173
|
+
mathField.keystroke("Left");
|
|
1174
|
+
mathField.keystroke("Left");
|
|
1175
|
+
}
|
|
1176
|
+
break;
|
|
1177
|
+
default:
|
|
1178
|
+
throw new Error("Invalid exponent key: ".concat(key));
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
|
|
659
1182
|
const KeysForJumpContext = {
|
|
660
|
-
[CursorContext.IN_PARENS]:
|
|
661
|
-
[CursorContext.IN_SUPER_SCRIPT]:
|
|
662
|
-
[CursorContext.IN_SUB_SCRIPT]:
|
|
663
|
-
[CursorContext.BEFORE_FRACTION]:
|
|
664
|
-
[CursorContext.IN_NUMERATOR]:
|
|
665
|
-
[CursorContext.IN_DENOMINATOR]:
|
|
1183
|
+
[CursorContext.IN_PARENS]: "JUMP_OUT_PARENTHESES",
|
|
1184
|
+
[CursorContext.IN_SUPER_SCRIPT]: "JUMP_OUT_EXPONENT",
|
|
1185
|
+
[CursorContext.IN_SUB_SCRIPT]: "JUMP_OUT_BASE",
|
|
1186
|
+
[CursorContext.BEFORE_FRACTION]: "JUMP_INTO_NUMERATOR",
|
|
1187
|
+
[CursorContext.IN_NUMERATOR]: "JUMP_OUT_NUMERATOR",
|
|
1188
|
+
[CursorContext.IN_DENOMINATOR]: "JUMP_OUT_DENOMINATOR"
|
|
666
1189
|
};
|
|
1190
|
+
|
|
1191
|
+
/**
|
|
1192
|
+
* Advances the cursor to the next logical position.
|
|
1193
|
+
*/
|
|
1194
|
+
function handleJumpOut(mathField, key) {
|
|
1195
|
+
const cursor = getCursor(mathField);
|
|
1196
|
+
const context = contextForCursor(cursor);
|
|
1197
|
+
|
|
1198
|
+
// Validate that the current cursor context matches the key's intent.
|
|
1199
|
+
if (KeysForJumpContext[context] !== key) {
|
|
1200
|
+
// If we don't have a valid cursor context, yet the user was able
|
|
1201
|
+
// to trigger a jump-out key, that's a broken invariant. Rather
|
|
1202
|
+
// than throw an error (which would kick the user out of the
|
|
1203
|
+
// exercise), we do nothing, as a fallback strategy. The user can
|
|
1204
|
+
// still move the cursor manually.
|
|
1205
|
+
return;
|
|
1206
|
+
}
|
|
1207
|
+
switch (context) {
|
|
1208
|
+
case CursorContext.IN_PARENS:
|
|
1209
|
+
// Insert at the end of the parentheses, and then navigate right
|
|
1210
|
+
// once more to get 'beyond' the parentheses.
|
|
1211
|
+
cursor.insRightOf(cursor.parent.parent);
|
|
1212
|
+
break;
|
|
1213
|
+
case CursorContext.BEFORE_FRACTION:
|
|
1214
|
+
// Find the nearest fraction to the right of the cursor.
|
|
1215
|
+
let fractionNode;
|
|
1216
|
+
let visitor = cursor;
|
|
1217
|
+
while (visitor[MQ.R] !== MathFieldActionType.MQ_END) {
|
|
1218
|
+
if (isFraction(visitor[MQ.R])) {
|
|
1219
|
+
fractionNode = visitor[MQ.R];
|
|
1220
|
+
}
|
|
1221
|
+
visitor = visitor[MQ.R];
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
// Jump into it!
|
|
1225
|
+
cursor.insLeftOf(fractionNode);
|
|
1226
|
+
mathField.keystroke("Right");
|
|
1227
|
+
break;
|
|
1228
|
+
case CursorContext.IN_NUMERATOR:
|
|
1229
|
+
// HACK(charlie): I can't find a better way to do this. The goal
|
|
1230
|
+
// is to place the cursor at the start of the matching
|
|
1231
|
+
// denominator. So, we identify the appropriate node, and
|
|
1232
|
+
// continue rightwards until we find ourselves inside of it.
|
|
1233
|
+
// It's possible that there are cases in which we don't reach
|
|
1234
|
+
// the denominator, though I can't think of any.
|
|
1235
|
+
const siblingDenominator = cursor.parent.parent.blocks[1];
|
|
1236
|
+
while (cursor.parent !== siblingDenominator) {
|
|
1237
|
+
mathField.keystroke("Right");
|
|
1238
|
+
}
|
|
1239
|
+
break;
|
|
1240
|
+
case CursorContext.IN_DENOMINATOR:
|
|
1241
|
+
cursor.insRightOf(cursor.parent.parent);
|
|
1242
|
+
break;
|
|
1243
|
+
case CursorContext.IN_SUB_SCRIPT:
|
|
1244
|
+
// Insert just beyond the superscript.
|
|
1245
|
+
cursor.insRightOf(cursor.parent.parent);
|
|
1246
|
+
|
|
1247
|
+
// Navigate right once more, if we're right before parens. This
|
|
1248
|
+
// is to handle the standard case in which the subscript is the
|
|
1249
|
+
// base of a custom log.
|
|
1250
|
+
if (isParens(cursor[MQ.R])) {
|
|
1251
|
+
mathField.keystroke("Right");
|
|
1252
|
+
}
|
|
1253
|
+
break;
|
|
1254
|
+
case CursorContext.IN_SUPER_SCRIPT:
|
|
1255
|
+
// Insert just beyond the superscript.
|
|
1256
|
+
cursor.insRightOf(cursor.parent.parent);
|
|
1257
|
+
break;
|
|
1258
|
+
default:
|
|
1259
|
+
throw new Error("Attempted to 'Jump Out' from node, but found no " + "appropriate cursor context: ".concat(context));
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
function buildNormalFunctionCallback(command) {
|
|
1264
|
+
return function (mathField) {
|
|
1265
|
+
mathField.write("\\".concat(command, "\\left(\\right)"));
|
|
1266
|
+
mathField.keystroke("Left");
|
|
1267
|
+
};
|
|
1268
|
+
}
|
|
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,
|
|
1277
|
+
EXP: handleExponent,
|
|
1278
|
+
EXP_2: handleExponent,
|
|
1279
|
+
EXP_3: handleExponent,
|
|
1280
|
+
FRAC: mathQuill => {
|
|
1281
|
+
mathQuill.cmd("\\frac");
|
|
1282
|
+
},
|
|
1283
|
+
JUMP_OUT_PARENTHESES: handleJumpOut,
|
|
1284
|
+
JUMP_OUT_EXPONENT: handleJumpOut,
|
|
1285
|
+
JUMP_OUT_BASE: handleJumpOut,
|
|
1286
|
+
JUMP_INTO_NUMERATOR: handleJumpOut,
|
|
1287
|
+
JUMP_OUT_NUMERATOR: handleJumpOut,
|
|
1288
|
+
JUMP_OUT_DENOMINATOR: handleJumpOut,
|
|
1289
|
+
LEFT: handleArrow,
|
|
1290
|
+
RIGHT: handleArrow,
|
|
1291
|
+
LOG: buildNormalFunctionCallback("log"),
|
|
1292
|
+
LN: buildNormalFunctionCallback("ln"),
|
|
1293
|
+
SIN: buildNormalFunctionCallback("sin"),
|
|
1294
|
+
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
|
+
*/
|
|
667
1303
|
class MathWrapper {
|
|
668
|
-
// MathQuill interface
|
|
669
1304
|
// MathQuill input
|
|
670
1305
|
|
|
671
1306
|
constructor(element) {
|
|
672
1307
|
let callbacks = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
673
|
-
_defineProperty(this, "MQ", void 0);
|
|
674
1308
|
_defineProperty(this, "mathField", void 0);
|
|
675
1309
|
_defineProperty(this, "callbacks", void 0);
|
|
676
|
-
this.
|
|
677
|
-
this.mathField = this.MQ.MathField(element, {
|
|
1310
|
+
this.mathField = MQ.MathField(element, {
|
|
678
1311
|
// use a span instead of a textarea so that we don't bring up the
|
|
679
1312
|
// native keyboard on mobile when selecting the input
|
|
680
1313
|
substituteTextarea: function () {
|
|
@@ -700,10 +1333,6 @@ class MathWrapper {
|
|
|
700
1333
|
controller.cursor.hide();
|
|
701
1334
|
controller.blurred = true;
|
|
702
1335
|
}
|
|
703
|
-
_writeNormalFunction(name) {
|
|
704
|
-
this.mathField.write("\\".concat(name, "\\left(\\right)"));
|
|
705
|
-
this.mathField.keystroke("Left");
|
|
706
|
-
}
|
|
707
1336
|
|
|
708
1337
|
/**
|
|
709
1338
|
* Handle a key press and return the resulting cursor state.
|
|
@@ -712,51 +1341,10 @@ class MathWrapper {
|
|
|
712
1341
|
* @returns {object} a cursor object, consisting of a cursor context
|
|
713
1342
|
*/
|
|
714
1343
|
pressKey(key) {
|
|
715
|
-
const cursor = this.
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
fn
|
|
720
|
-
} = KeyActions[key];
|
|
721
|
-
if (str && fn) {
|
|
722
|
-
this.mathField[fn](str);
|
|
723
|
-
}
|
|
724
|
-
} else if (Object.keys(NormalCommands).includes(key)) {
|
|
725
|
-
this._writeNormalFunction(NormalCommands[key]);
|
|
726
|
-
} else if (key === Keys.FRAC_EXCLUSIVE) {
|
|
727
|
-
// If there's nothing to the left of the cursor, then we want to
|
|
728
|
-
// leave the cursor to the left of the fraction after creating it.
|
|
729
|
-
const shouldNavigateLeft = cursor[this.MQ.L] === ActionType.MQ_END;
|
|
730
|
-
this.mathField.cmd("\\frac");
|
|
731
|
-
if (shouldNavigateLeft) {
|
|
732
|
-
this.mathField.keystroke("Left");
|
|
733
|
-
}
|
|
734
|
-
} else if (key === Keys.FRAC) {
|
|
735
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
736
|
-
cursor[this.MQ.L] === ActionType.MQ_END;
|
|
737
|
-
this.mathField.cmd("\\frac");
|
|
738
|
-
} else if (key === Keys.LOG_N) {
|
|
739
|
-
this.mathField.write("log_{ }\\left(\\right)");
|
|
740
|
-
this.mathField.keystroke("Left"); // into parentheses
|
|
741
|
-
this.mathField.keystroke("Left"); // out of parentheses
|
|
742
|
-
this.mathField.keystroke("Left"); // into index
|
|
743
|
-
} else if (key === Keys.CUBE_ROOT) {
|
|
744
|
-
this.mathField.write("\\sqrt[3]{}");
|
|
745
|
-
this.mathField.keystroke("Left"); // under the root
|
|
746
|
-
} else if (key === Keys.EXP || key === Keys.EXP_2 || key === Keys.EXP_3) {
|
|
747
|
-
this._handleExponent(cursor, key);
|
|
748
|
-
} else if (key === Keys.JUMP_OUT_PARENTHESES || key === Keys.JUMP_OUT_EXPONENT || key === Keys.JUMP_OUT_BASE || key === Keys.JUMP_INTO_NUMERATOR || key === Keys.JUMP_OUT_NUMERATOR || key === Keys.JUMP_OUT_DENOMINATOR) {
|
|
749
|
-
this._handleJumpOut(cursor, key);
|
|
750
|
-
} else if (key === Keys.BACKSPACE) {
|
|
751
|
-
this._handleBackspace(cursor);
|
|
752
|
-
} else if (key === Keys.LEFT) {
|
|
753
|
-
this._handleLeftArrow(cursor);
|
|
754
|
-
} else if (key === Keys.RIGHT) {
|
|
755
|
-
this._handleRightArrow(cursor);
|
|
756
|
-
} else if (/^[a-zA-Z]$/.test(key)) {
|
|
757
|
-
this.mathField[ActionType.WRITE](key);
|
|
758
|
-
} else if (/^NUM_\d/.test(key)) {
|
|
759
|
-
this.mathField[ActionType.WRITE](key[4]);
|
|
1344
|
+
const cursor = this.getCursor();
|
|
1345
|
+
const translator = customKeyTranslator[key];
|
|
1346
|
+
if (translator) {
|
|
1347
|
+
translator(this.mathField, key);
|
|
760
1348
|
}
|
|
761
1349
|
if (!cursor.selection) {
|
|
762
1350
|
// don't show the cursor for selections
|
|
@@ -802,7 +1390,7 @@ class MathWrapper {
|
|
|
802
1390
|
// Unless that would leave us mid-command, in which case, we
|
|
803
1391
|
// need to adjust and place the cursor inside the parens
|
|
804
1392
|
// following the command.
|
|
805
|
-
const command =
|
|
1393
|
+
const command = maybeFindCommand(cursor[MQ.L]);
|
|
806
1394
|
if (command && command.endNode) {
|
|
807
1395
|
// NOTE(charlie): endNode should definitely be \left(.
|
|
808
1396
|
cursor.insLeftOf(command.endNode);
|
|
@@ -816,8 +1404,17 @@ class MathWrapper {
|
|
|
816
1404
|
}
|
|
817
1405
|
}
|
|
818
1406
|
}
|
|
1407
|
+
|
|
1408
|
+
// note(Matthew): extracted this logic to share it elsewhere,
|
|
1409
|
+
// but it's part of the public MathWrapper API
|
|
819
1410
|
getCursor() {
|
|
820
|
-
return this.mathField
|
|
1411
|
+
return getCursor(this.mathField);
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1414
|
+
// note(Matthew): extracted this logic to keep this file focused,
|
|
1415
|
+
// but it's part of the public MathWrapper API
|
|
1416
|
+
contextForCursor(cursor) {
|
|
1417
|
+
return contextForCursor(cursor);
|
|
821
1418
|
}
|
|
822
1419
|
getSelection() {
|
|
823
1420
|
return this.getCursor().selection;
|
|
@@ -832,576 +1429,6 @@ class MathWrapper {
|
|
|
832
1429
|
const cursor = this.getCursor();
|
|
833
1430
|
return cursor.parent.id === 1 && cursor[1] === 0 && cursor[-1] === 0;
|
|
834
1431
|
}
|
|
835
|
-
|
|
836
|
-
// Notes about MathQuill
|
|
837
|
-
//
|
|
838
|
-
// MathQuill's stores its layout as nested linked lists. Each node in the
|
|
839
|
-
// list has this.MQ.L '-1' and this.MQ.R '1' properties that define links to
|
|
840
|
-
// the left and right nodes respectively. They also have
|
|
841
|
-
//
|
|
842
|
-
// ctrlSeq: contains the latex code snippet that defines that node.
|
|
843
|
-
// jQ: jQuery object for the DOM node(s) for this MathQuill node.
|
|
844
|
-
// ends: pointers to the nodes at the ends of the container.
|
|
845
|
-
// parent: parent node.
|
|
846
|
-
// blocks: an array containing one or more nodes that make up the node.
|
|
847
|
-
// sub?: subscript node if there is one as is the case in log_n
|
|
848
|
-
//
|
|
849
|
-
// All of the code below is super fragile. Please be especially careful
|
|
850
|
-
// when upgrading MathQuill.
|
|
851
|
-
|
|
852
|
-
_handleBackspaceInNthRoot(cursor) {
|
|
853
|
-
const isAtLeftEnd = cursor[this.MQ.L] === ActionType.MQ_END;
|
|
854
|
-
const isRootEmpty = this._isInsideEmptyNode(cursor.parent.parent.blocks[0].ends);
|
|
855
|
-
if (isAtLeftEnd) {
|
|
856
|
-
this._selectNode(cursor.parent.parent, cursor);
|
|
857
|
-
if (isRootEmpty) {
|
|
858
|
-
this.mathField.keystroke("Backspace");
|
|
859
|
-
}
|
|
860
|
-
} else {
|
|
861
|
-
this.mathField.keystroke("Backspace");
|
|
862
|
-
}
|
|
863
|
-
}
|
|
864
|
-
|
|
865
|
-
/**
|
|
866
|
-
* Advances the cursor to the next logical position.
|
|
867
|
-
*
|
|
868
|
-
* @param {cursor} cursor
|
|
869
|
-
* @private
|
|
870
|
-
*/
|
|
871
|
-
_handleJumpOut(cursor, key) {
|
|
872
|
-
const context = this.contextForCursor(cursor);
|
|
873
|
-
|
|
874
|
-
// Validate that the current cursor context matches the key's intent.
|
|
875
|
-
if (KeysForJumpContext[context] !== key) {
|
|
876
|
-
// If we don't have a valid cursor context, yet the user was able
|
|
877
|
-
// to trigger a jump-out key, that's a broken invariant. Rather
|
|
878
|
-
// than throw an error (which would kick the user out of the
|
|
879
|
-
// exercise), we do nothing, as a fallback strategy. The user can
|
|
880
|
-
// still move the cursor manually.
|
|
881
|
-
return;
|
|
882
|
-
}
|
|
883
|
-
switch (context) {
|
|
884
|
-
case CursorContext.IN_PARENS:
|
|
885
|
-
// Insert at the end of the parentheses, and then navigate right
|
|
886
|
-
// once more to get 'beyond' the parentheses.
|
|
887
|
-
cursor.insRightOf(cursor.parent.parent);
|
|
888
|
-
break;
|
|
889
|
-
case CursorContext.BEFORE_FRACTION:
|
|
890
|
-
// Find the nearest fraction to the right of the cursor.
|
|
891
|
-
let fractionNode;
|
|
892
|
-
let visitor = cursor;
|
|
893
|
-
while (visitor[this.MQ.R] !== ActionType.MQ_END) {
|
|
894
|
-
if (this._isFraction(visitor[this.MQ.R])) {
|
|
895
|
-
fractionNode = visitor[this.MQ.R];
|
|
896
|
-
}
|
|
897
|
-
visitor = visitor[this.MQ.R];
|
|
898
|
-
}
|
|
899
|
-
|
|
900
|
-
// Jump into it!
|
|
901
|
-
cursor.insLeftOf(fractionNode);
|
|
902
|
-
this.mathField.keystroke("Right");
|
|
903
|
-
break;
|
|
904
|
-
case CursorContext.IN_NUMERATOR:
|
|
905
|
-
// HACK(charlie): I can't find a better way to do this. The goal
|
|
906
|
-
// is to place the cursor at the start of the matching
|
|
907
|
-
// denominator. So, we identify the appropriate node, and
|
|
908
|
-
// continue rightwards until we find ourselves inside of it.
|
|
909
|
-
// It's possible that there are cases in which we don't reach
|
|
910
|
-
// the denominator, though I can't think of any.
|
|
911
|
-
const siblingDenominator = cursor.parent.parent.blocks[1];
|
|
912
|
-
while (cursor.parent !== siblingDenominator) {
|
|
913
|
-
this.mathField.keystroke("Right");
|
|
914
|
-
}
|
|
915
|
-
break;
|
|
916
|
-
case CursorContext.IN_DENOMINATOR:
|
|
917
|
-
cursor.insRightOf(cursor.parent.parent);
|
|
918
|
-
break;
|
|
919
|
-
case CursorContext.IN_SUB_SCRIPT:
|
|
920
|
-
// Insert just beyond the superscript.
|
|
921
|
-
cursor.insRightOf(cursor.parent.parent);
|
|
922
|
-
|
|
923
|
-
// Navigate right once more, if we're right before parens. This
|
|
924
|
-
// is to handle the standard case in which the subscript is the
|
|
925
|
-
// base of a custom log.
|
|
926
|
-
if (this._isParens(cursor[this.MQ.R])) {
|
|
927
|
-
this.mathField.keystroke("Right");
|
|
928
|
-
}
|
|
929
|
-
break;
|
|
930
|
-
case CursorContext.IN_SUPER_SCRIPT:
|
|
931
|
-
// Insert just beyond the superscript.
|
|
932
|
-
cursor.insRightOf(cursor.parent.parent);
|
|
933
|
-
break;
|
|
934
|
-
default:
|
|
935
|
-
throw new Error("Attempted to 'Jump Out' from node, but found no " + "appropriate cursor context: ".concat(context));
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
|
|
939
|
-
/**
|
|
940
|
-
* Selects and deletes part of the expression based on the cursor location.
|
|
941
|
-
* See inline comments for precise behavior of different cases.
|
|
942
|
-
*
|
|
943
|
-
* @param {cursor} cursor
|
|
944
|
-
* @private
|
|
945
|
-
*/
|
|
946
|
-
_handleBackspace(cursor) {
|
|
947
|
-
if (!cursor.selection) {
|
|
948
|
-
const parent = cursor.parent;
|
|
949
|
-
const grandparent = parent.parent;
|
|
950
|
-
const leftNode = cursor[this.MQ.L];
|
|
951
|
-
if (this._isFraction(leftNode)) {
|
|
952
|
-
this._selectNode(leftNode, cursor);
|
|
953
|
-
} else if (this._isSquareRoot(leftNode)) {
|
|
954
|
-
this._selectNode(leftNode, cursor);
|
|
955
|
-
} else if (this._isNthRoot(leftNode)) {
|
|
956
|
-
this._selectNode(leftNode, cursor);
|
|
957
|
-
} else if (this._isNthRootIndex(parent)) {
|
|
958
|
-
this._handleBackspaceInRootIndex(cursor);
|
|
959
|
-
} else if (leftNode.ctrlSeq === "\\left(") {
|
|
960
|
-
this._handleBackspaceOutsideParens(cursor);
|
|
961
|
-
} else if (grandparent.ctrlSeq === "\\left(") {
|
|
962
|
-
this._handleBackspaceInsideParens(cursor);
|
|
963
|
-
} else if (this._isInsideLogIndex(cursor)) {
|
|
964
|
-
this._handleBackspaceInLogIndex(cursor);
|
|
965
|
-
} else if (leftNode.ctrlSeq === "\\ge " || leftNode.ctrlSeq === "\\le ") {
|
|
966
|
-
this._handleBackspaceAfterLigaturedSymbol(cursor);
|
|
967
|
-
} else if (this._isNthRoot(grandparent) && leftNode === ActionType.MQ_END) {
|
|
968
|
-
this._handleBackspaceInNthRoot(cursor);
|
|
969
|
-
} else {
|
|
970
|
-
this.mathField.keystroke("Backspace");
|
|
971
|
-
}
|
|
972
|
-
} else {
|
|
973
|
-
this.mathField.keystroke("Backspace");
|
|
974
|
-
}
|
|
975
|
-
}
|
|
976
|
-
_handleLeftArrow(cursor) {
|
|
977
|
-
// If we're inside a function, and just after the left parentheses, we
|
|
978
|
-
// need to skip the entire function name, rather than move the cursor
|
|
979
|
-
// inside of it. For example, when hitting left from within the
|
|
980
|
-
// parentheses in `cos()`, we want to place the cursor to the left of
|
|
981
|
-
// the entire expression, rather than between the `s` and the left
|
|
982
|
-
// parenthesis.
|
|
983
|
-
// From the cursor's perspective, this requires that our left node is
|
|
984
|
-
// the ActionType.MQ_END node, that our grandparent is the left parenthesis, and
|
|
985
|
-
// the nodes to the left of our grandparent comprise a valid function
|
|
986
|
-
// name.
|
|
987
|
-
if (cursor[this.MQ.L] === ActionType.MQ_END) {
|
|
988
|
-
const parent = cursor.parent;
|
|
989
|
-
const grandparent = parent.parent;
|
|
990
|
-
if (grandparent.ctrlSeq === "\\left(") {
|
|
991
|
-
const command = this._maybeFindCommandBeforeParens(grandparent);
|
|
992
|
-
if (command) {
|
|
993
|
-
cursor.insLeftOf(command.startNode);
|
|
994
|
-
return;
|
|
995
|
-
}
|
|
996
|
-
}
|
|
997
|
-
}
|
|
998
|
-
|
|
999
|
-
// Otherwise, we default to the standard MathQull left behavior.
|
|
1000
|
-
this.mathField.keystroke("Left");
|
|
1001
|
-
}
|
|
1002
|
-
_handleRightArrow(cursor) {
|
|
1003
|
-
const command = this._maybeFindCommand(cursor[this.MQ.R]);
|
|
1004
|
-
if (command) {
|
|
1005
|
-
// Similarly, if a function is to our right, then we need to place
|
|
1006
|
-
// the cursor at the start of its parenthetical content, which is
|
|
1007
|
-
// done by putting it to the left of ites parentheses and then
|
|
1008
|
-
// moving right once.
|
|
1009
|
-
cursor.insLeftOf(command.endNode);
|
|
1010
|
-
this.mathField.keystroke("Right");
|
|
1011
|
-
} else {
|
|
1012
|
-
// Otherwise, we default to the standard MathQull right behavior.
|
|
1013
|
-
this.mathField.keystroke("Right");
|
|
1014
|
-
}
|
|
1015
|
-
}
|
|
1016
|
-
_handleExponent(cursor, key) {
|
|
1017
|
-
// If there's an invalid operator preceding the cursor (anything that
|
|
1018
|
-
// knowingly cannot be raised to a power), add an empty set of
|
|
1019
|
-
// parentheses and apply the exponent to that.
|
|
1020
|
-
const invalidPrefixes = [...ArithmeticOperators, ...EqualityOperators];
|
|
1021
|
-
const precedingNode = cursor[this.MQ.L];
|
|
1022
|
-
const shouldPrefixWithParens = precedingNode === ActionType.MQ_END || invalidPrefixes.includes(precedingNode.ctrlSeq.trim());
|
|
1023
|
-
if (shouldPrefixWithParens) {
|
|
1024
|
-
this.mathField.write("\\left(\\right)");
|
|
1025
|
-
}
|
|
1026
|
-
|
|
1027
|
-
// Insert the appropriate exponent operator.
|
|
1028
|
-
switch (key) {
|
|
1029
|
-
case Keys.EXP:
|
|
1030
|
-
this.mathField.cmd("^");
|
|
1031
|
-
break;
|
|
1032
|
-
case Keys.EXP_2:
|
|
1033
|
-
case Keys.EXP_3:
|
|
1034
|
-
this.mathField.write("^".concat(key === Keys.EXP_2 ? 2 : 3));
|
|
1035
|
-
|
|
1036
|
-
// If we enter a square or a cube, we should leave the cursor
|
|
1037
|
-
// within the newly inserted parens, if they exist. This takes
|
|
1038
|
-
// exactly four left strokes, since the cursor by default would
|
|
1039
|
-
// end up to the right of the exponent.
|
|
1040
|
-
if (shouldPrefixWithParens) {
|
|
1041
|
-
this.mathField.keystroke("Left");
|
|
1042
|
-
this.mathField.keystroke("Left");
|
|
1043
|
-
this.mathField.keystroke("Left");
|
|
1044
|
-
this.mathField.keystroke("Left");
|
|
1045
|
-
}
|
|
1046
|
-
break;
|
|
1047
|
-
default:
|
|
1048
|
-
throw new Error("Invalid exponent key: ".concat(key));
|
|
1049
|
-
}
|
|
1050
|
-
}
|
|
1051
|
-
|
|
1052
|
-
/**
|
|
1053
|
-
* Return the start node, end node, and full name of the command of which
|
|
1054
|
-
* the initial node is a part, or `null` if the node is not part of a
|
|
1055
|
-
* command.
|
|
1056
|
-
*
|
|
1057
|
-
* @param {node} initialNode - the node to included as part of the command
|
|
1058
|
-
* @returns {null|object} - `null` or an object containing the start node
|
|
1059
|
-
* (`startNode`), end node (`endNode`), and full
|
|
1060
|
-
* name (`name`) of the command
|
|
1061
|
-
* @private
|
|
1062
|
-
*/
|
|
1063
|
-
_maybeFindCommand(initialNode) {
|
|
1064
|
-
if (!initialNode) {
|
|
1065
|
-
return null;
|
|
1066
|
-
}
|
|
1067
|
-
|
|
1068
|
-
// MathQuill stores commands as separate characters so that
|
|
1069
|
-
// users can delete commands one character at a time. We iterate over
|
|
1070
|
-
// the nodes from right to left until we hit a sequence starting with a
|
|
1071
|
-
// '\\', which signifies the start of a command; then we iterate from
|
|
1072
|
-
// left to right until we hit a '\\left(', which signifies the end of a
|
|
1073
|
-
// command. If we encounter any character that doesn't belong in a
|
|
1074
|
-
// command, we return null. We match a single character at a time.
|
|
1075
|
-
// Ex) ['\\l', 'o', 'g ', '\\left(', ...]
|
|
1076
|
-
const commandCharRegex = /^[a-z]$/;
|
|
1077
|
-
const commandStartRegex = /^\\[a-z]$/;
|
|
1078
|
-
const commandEndSeq = "\\left(";
|
|
1079
|
-
|
|
1080
|
-
// Note: We allowlist the set of valid commands, since relying solely on
|
|
1081
|
-
// a command being prefixed with a backslash leads to undesired
|
|
1082
|
-
// behavior. For example, Greek symbols, left parentheses, and square
|
|
1083
|
-
// roots all get treated as commands.
|
|
1084
|
-
const validCommands = ["\\log", "\\ln", "\\cos", "\\sin", "\\tan"];
|
|
1085
|
-
let name = "";
|
|
1086
|
-
let startNode;
|
|
1087
|
-
let endNode;
|
|
1088
|
-
|
|
1089
|
-
// Collect the portion of the command from the current node, leftwards
|
|
1090
|
-
// until the start of the command.
|
|
1091
|
-
let node = initialNode;
|
|
1092
|
-
while (node !== 0) {
|
|
1093
|
-
const ctrlSeq = node.ctrlSeq.trim();
|
|
1094
|
-
if (commandCharRegex.test(ctrlSeq)) {
|
|
1095
|
-
name = ctrlSeq + name;
|
|
1096
|
-
} else if (commandStartRegex.test(ctrlSeq)) {
|
|
1097
|
-
name = ctrlSeq + name;
|
|
1098
|
-
startNode = node;
|
|
1099
|
-
break;
|
|
1100
|
-
} else {
|
|
1101
|
-
break;
|
|
1102
|
-
}
|
|
1103
|
-
node = node[this.MQ.L];
|
|
1104
|
-
}
|
|
1105
|
-
|
|
1106
|
-
// If we hit the start of a command, then grab the rest of it by
|
|
1107
|
-
// iterating rightwards to compute the full name of the command, along
|
|
1108
|
-
// with its terminal node.
|
|
1109
|
-
if (startNode) {
|
|
1110
|
-
// Next, iterate from the start to the right.
|
|
1111
|
-
node = initialNode[this.MQ.R];
|
|
1112
|
-
while (node !== 0) {
|
|
1113
|
-
const ctrlSeq = node.ctrlSeq.trim();
|
|
1114
|
-
if (commandCharRegex.test(ctrlSeq)) {
|
|
1115
|
-
// If we have a single character, add it to the command
|
|
1116
|
-
// name.
|
|
1117
|
-
name = name + ctrlSeq;
|
|
1118
|
-
} else if (ctrlSeq === commandEndSeq) {
|
|
1119
|
-
// If we hit the command end delimiter (the left
|
|
1120
|
-
// parentheses surrounding its arguments), stop.
|
|
1121
|
-
endNode = node;
|
|
1122
|
-
break;
|
|
1123
|
-
}
|
|
1124
|
-
node = node[this.MQ.R];
|
|
1125
|
-
}
|
|
1126
|
-
if (validCommands.includes(name)) {
|
|
1127
|
-
return {
|
|
1128
|
-
name,
|
|
1129
|
-
startNode,
|
|
1130
|
-
endNode
|
|
1131
|
-
};
|
|
1132
|
-
} else {
|
|
1133
|
-
return null;
|
|
1134
|
-
}
|
|
1135
|
-
} else {
|
|
1136
|
-
return null;
|
|
1137
|
-
}
|
|
1138
|
-
}
|
|
1139
|
-
|
|
1140
|
-
/**
|
|
1141
|
-
* Return the start node, end node, and full name of the command to the left
|
|
1142
|
-
* of `\\left(`, or `null` if there is no command.
|
|
1143
|
-
*
|
|
1144
|
-
* @param {node} leftParenNode - node where .ctrlSeq == `\\left(`
|
|
1145
|
-
* @returns {null|object} - `null` or an object containing the start node
|
|
1146
|
-
* (`startNode`), end node (`endNode`), and full
|
|
1147
|
-
* name (`name`) of the command
|
|
1148
|
-
* @private
|
|
1149
|
-
*/
|
|
1150
|
-
_maybeFindCommandBeforeParens(leftParenNode) {
|
|
1151
|
-
return this._maybeFindCommand(leftParenNode[this.MQ.L]);
|
|
1152
|
-
}
|
|
1153
|
-
_selectNode(node, cursor) {
|
|
1154
|
-
cursor.insLeftOf(node);
|
|
1155
|
-
cursor.startSelection();
|
|
1156
|
-
cursor.insRightOf(node);
|
|
1157
|
-
cursor.select();
|
|
1158
|
-
cursor.endSelection();
|
|
1159
|
-
}
|
|
1160
|
-
_isFraction(node) {
|
|
1161
|
-
return node.jQ && node.jQ.hasClass("mq-fraction");
|
|
1162
|
-
}
|
|
1163
|
-
_isNumerator(node) {
|
|
1164
|
-
return node.jQ && node.jQ.hasClass("mq-numerator");
|
|
1165
|
-
}
|
|
1166
|
-
_isDenominator(node) {
|
|
1167
|
-
return node.jQ && node.jQ.hasClass("mq-denominator");
|
|
1168
|
-
}
|
|
1169
|
-
_isSubScript(node) {
|
|
1170
|
-
// NOTE(charlie): MyScript has a structure whereby its superscripts seem
|
|
1171
|
-
// to be represented as a parent node with 'mq-sup-only' containing a
|
|
1172
|
-
// single child with 'mq-sup'.
|
|
1173
|
-
return node.jQ && (node.jQ.hasClass("mq-sub-only") || node.jQ.hasClass("mq-sub"));
|
|
1174
|
-
}
|
|
1175
|
-
_isSuperScript(node) {
|
|
1176
|
-
// NOTE(charlie): MyScript has a structure whereby its superscripts seem
|
|
1177
|
-
// to be represented as a parent node with 'mq-sup-only' containing a
|
|
1178
|
-
// single child with 'mq-sup'.
|
|
1179
|
-
return node.jQ && (node.jQ.hasClass("mq-sup-only") || node.jQ.hasClass("mq-sup"));
|
|
1180
|
-
}
|
|
1181
|
-
_isParens(node) {
|
|
1182
|
-
return node && node.ctrlSeq === "\\left(";
|
|
1183
|
-
}
|
|
1184
|
-
_isLeaf(node) {
|
|
1185
|
-
return node && node.ctrlSeq && ValidLeaves.includes(node.ctrlSeq.trim());
|
|
1186
|
-
}
|
|
1187
|
-
_isSquareRoot(node) {
|
|
1188
|
-
return node.blocks && node.blocks[0].jQ && node.blocks[0].jQ.hasClass("mq-sqrt-stem");
|
|
1189
|
-
}
|
|
1190
|
-
_isNthRoot(node) {
|
|
1191
|
-
return node.blocks && node.blocks[0].jQ && node.blocks[0].jQ.hasClass("mq-nthroot");
|
|
1192
|
-
}
|
|
1193
|
-
_isNthRootIndex(node) {
|
|
1194
|
-
return node.jQ && node.jQ.hasClass("mq-nthroot");
|
|
1195
|
-
}
|
|
1196
|
-
_isInsideLogIndex(cursor) {
|
|
1197
|
-
const grandparent = cursor.parent.parent;
|
|
1198
|
-
if (grandparent && grandparent.jQ.hasClass("mq-supsub")) {
|
|
1199
|
-
const command = this._maybeFindCommandBeforeParens(grandparent);
|
|
1200
|
-
if (command && command.name === "\\log") {
|
|
1201
|
-
return true;
|
|
1202
|
-
}
|
|
1203
|
-
}
|
|
1204
|
-
return false;
|
|
1205
|
-
}
|
|
1206
|
-
_isInsideEmptyNode(cursor) {
|
|
1207
|
-
return cursor[this.MQ.L] === ActionType.MQ_END && cursor[this.MQ.R] === ActionType.MQ_END;
|
|
1208
|
-
}
|
|
1209
|
-
_handleBackspaceInRootIndex(cursor) {
|
|
1210
|
-
if (this._isInsideEmptyNode(cursor)) {
|
|
1211
|
-
// When deleting the index in a nthroot, we change from the nthroot
|
|
1212
|
-
// to a sqrt, e.g. \sqrt[|]{35x-5} => |\sqrt{35x-5}. If there's no
|
|
1213
|
-
// content under the root, then we delete the whole thing.
|
|
1214
|
-
|
|
1215
|
-
const grandparent = cursor.parent.parent;
|
|
1216
|
-
const latex = grandparent.latex();
|
|
1217
|
-
const reinsertionPoint = grandparent[this.MQ.L];
|
|
1218
|
-
this._selectNode(grandparent, cursor);
|
|
1219
|
-
const rootIsEmpty = grandparent.blocks[1].jQ.text() === "";
|
|
1220
|
-
if (rootIsEmpty) {
|
|
1221
|
-
// If there is not content under the root then simply delete
|
|
1222
|
-
// the whole thing.
|
|
1223
|
-
this.mathField.keystroke("Backspace");
|
|
1224
|
-
} else {
|
|
1225
|
-
// Replace the nthroot with a sqrt if there was content under
|
|
1226
|
-
// the root.
|
|
1227
|
-
|
|
1228
|
-
// Start by deleting the selection.
|
|
1229
|
-
this.mathField.keystroke("Backspace");
|
|
1230
|
-
|
|
1231
|
-
// Replace the nth-root with a sqrt.
|
|
1232
|
-
this.mathField.write(latex.replace(/^\\sqrt\[\]/, "\\sqrt"));
|
|
1233
|
-
|
|
1234
|
-
// Adjust the cursor to be to the left the sqrt.
|
|
1235
|
-
if (reinsertionPoint === ActionType.MQ_END) {
|
|
1236
|
-
this.mathField.moveToDirEnd(this.MQ.L);
|
|
1237
|
-
} else {
|
|
1238
|
-
cursor.insRightOf(reinsertionPoint);
|
|
1239
|
-
}
|
|
1240
|
-
}
|
|
1241
|
-
} else {
|
|
1242
|
-
if (cursor[this.MQ.L] !== ActionType.MQ_END) {
|
|
1243
|
-
// If the cursor is not at the leftmost position inside the
|
|
1244
|
-
// root's index, delete a character.
|
|
1245
|
-
this.mathField.keystroke("Backspace");
|
|
1246
|
-
}
|
|
1247
|
-
}
|
|
1248
|
-
}
|
|
1249
|
-
_handleBackspaceInLogIndex(cursor) {
|
|
1250
|
-
if (this._isInsideEmptyNode(cursor)) {
|
|
1251
|
-
const grandparent = cursor.parent.parent;
|
|
1252
|
-
const command = this._maybeFindCommandBeforeParens(grandparent);
|
|
1253
|
-
cursor.insLeftOf(command === null || command === void 0 ? void 0 : command.startNode);
|
|
1254
|
-
cursor.startSelection();
|
|
1255
|
-
if (grandparent[this.MQ.R] !== ActionType.MQ_END) {
|
|
1256
|
-
cursor.insRightOf(grandparent[this.MQ.R]);
|
|
1257
|
-
} else {
|
|
1258
|
-
cursor.insRightOf(grandparent);
|
|
1259
|
-
}
|
|
1260
|
-
cursor.select();
|
|
1261
|
-
cursor.endSelection();
|
|
1262
|
-
const isLogBodyEmpty = grandparent[this.MQ.R].contentjQ.text() === "";
|
|
1263
|
-
if (isLogBodyEmpty) {
|
|
1264
|
-
// If there's no content inside the log's parens then delete the
|
|
1265
|
-
// whole thing.
|
|
1266
|
-
this.mathField.keystroke("Backspace");
|
|
1267
|
-
}
|
|
1268
|
-
} else {
|
|
1269
|
-
this.mathField.keystroke("Backspace");
|
|
1270
|
-
}
|
|
1271
|
-
}
|
|
1272
|
-
_handleBackspaceOutsideParens(cursor) {
|
|
1273
|
-
// In this case the node with '\\left(' for its ctrlSeq
|
|
1274
|
-
// is the parent of the expression contained within the
|
|
1275
|
-
// parentheses.
|
|
1276
|
-
//
|
|
1277
|
-
// Handle selecting an expression before deleting:
|
|
1278
|
-
// (x+1)| => |(x+1)|
|
|
1279
|
-
// \log(x+1)| => |\log(x+1)|
|
|
1280
|
-
|
|
1281
|
-
const leftNode = cursor[this.MQ.L];
|
|
1282
|
-
const rightNode = cursor[this.MQ.R];
|
|
1283
|
-
const command = this._maybeFindCommandBeforeParens(leftNode);
|
|
1284
|
-
if (command && command.startNode) {
|
|
1285
|
-
// There's a command before the parens so we select it as well as
|
|
1286
|
-
// the parens.
|
|
1287
|
-
cursor.insLeftOf(command.startNode);
|
|
1288
|
-
cursor.startSelection();
|
|
1289
|
-
if (rightNode === ActionType.MQ_END) {
|
|
1290
|
-
cursor.insAtRightEnd(cursor.parent);
|
|
1291
|
-
} else {
|
|
1292
|
-
cursor.insLeftOf(rightNode);
|
|
1293
|
-
}
|
|
1294
|
-
cursor.select();
|
|
1295
|
-
cursor.endSelection();
|
|
1296
|
-
} else {
|
|
1297
|
-
cursor.startSelection();
|
|
1298
|
-
cursor.insLeftOf(leftNode); // left of \\left(
|
|
1299
|
-
cursor.select();
|
|
1300
|
-
cursor.endSelection();
|
|
1301
|
-
}
|
|
1302
|
-
}
|
|
1303
|
-
_handleBackspaceInsideParens(cursor) {
|
|
1304
|
-
// Handle situations when the cursor is inside parens or a
|
|
1305
|
-
// command that uses parens, e.g. \log() or \tan()
|
|
1306
|
-
//
|
|
1307
|
-
// MathQuill represents log(x+1) in roughly the following way
|
|
1308
|
-
// [l, o, g, \\left[parent:[x, +, 1]]]
|
|
1309
|
-
//
|
|
1310
|
-
// If the cursor is inside the parentheses it's next to one of:
|
|
1311
|
-
// x, +, or 1. This makes sub_sub_expr its parent and sub_expr
|
|
1312
|
-
// it's parent.
|
|
1313
|
-
//
|
|
1314
|
-
// Interestingly parent doesn't have any nodes to the left or
|
|
1315
|
-
// right of it (even though the corresponding DOM node has
|
|
1316
|
-
// ( and ) characters on either side.
|
|
1317
|
-
//
|
|
1318
|
-
// The grandparent's ctrlSeq is `\\left(`. The `\\right)` isn't
|
|
1319
|
-
// stored anywhere. NOTE(kevinb): I believe this is because
|
|
1320
|
-
// MathQuill knows what the close paren should be and does the
|
|
1321
|
-
// right thing at render time.
|
|
1322
|
-
//
|
|
1323
|
-
// This conditional branch handles the following cases:
|
|
1324
|
-
// - \log(x+1|) => \log(x+|)
|
|
1325
|
-
// - \log(|x+1) => |\log(x+1)|
|
|
1326
|
-
// - \log(|) => |
|
|
1327
|
-
|
|
1328
|
-
if (cursor[this.MQ.L] !== ActionType.MQ_END) {
|
|
1329
|
-
// This command contains math and there's some math to
|
|
1330
|
-
// the left of the cursor that we should delete normally
|
|
1331
|
-
// before doing anything special.
|
|
1332
|
-
this.mathField.keystroke("Backspace");
|
|
1333
|
-
return;
|
|
1334
|
-
}
|
|
1335
|
-
const grandparent = cursor.parent.parent;
|
|
1336
|
-
|
|
1337
|
-
// If the cursors is inside the parens at the start but the command
|
|
1338
|
-
// has a subscript as is the case in log_n then move the cursor into
|
|
1339
|
-
// the subscript, e.g. \log_{5}(|x+1) => \log_{5|}(x+1)
|
|
1340
|
-
|
|
1341
|
-
if (grandparent[this.MQ.L].sub) {
|
|
1342
|
-
// if there is a subscript
|
|
1343
|
-
if (grandparent[this.MQ.L].sub.jQ.text()) {
|
|
1344
|
-
// and it contains text
|
|
1345
|
-
// move the cursor to the right end of the subscript
|
|
1346
|
-
cursor.insAtRightEnd(grandparent[this.MQ.L].sub);
|
|
1347
|
-
return;
|
|
1348
|
-
}
|
|
1349
|
-
}
|
|
1350
|
-
|
|
1351
|
-
// Determine if the parens are empty before we modify the
|
|
1352
|
-
// cursor's position.
|
|
1353
|
-
const isEmpty = this._isInsideEmptyNode(cursor);
|
|
1354
|
-
|
|
1355
|
-
// Insert the cursor to the left of the command if there is one
|
|
1356
|
-
// or before the '\\left(` if there isn't
|
|
1357
|
-
const command = this._maybeFindCommandBeforeParens(grandparent);
|
|
1358
|
-
cursor.insLeftOf(command && command.startNode || grandparent);
|
|
1359
|
-
cursor.startSelection();
|
|
1360
|
-
cursor.insRightOf(grandparent);
|
|
1361
|
-
cursor.select();
|
|
1362
|
-
cursor.endSelection();
|
|
1363
|
-
|
|
1364
|
-
// Delete the selection, but only if the parens were empty to
|
|
1365
|
-
// begin with.
|
|
1366
|
-
if (isEmpty) {
|
|
1367
|
-
this.mathField.keystroke("Backspace");
|
|
1368
|
-
}
|
|
1369
|
-
}
|
|
1370
|
-
_handleBackspaceAfterLigaturedSymbol(cursor) {
|
|
1371
|
-
this.mathField.keystroke("Backspace");
|
|
1372
|
-
this.mathField.keystroke("Backspace");
|
|
1373
|
-
}
|
|
1374
|
-
contextForCursor(cursor) {
|
|
1375
|
-
// First, try to find any fraction to the right, unimpeded.
|
|
1376
|
-
let visitor = cursor;
|
|
1377
|
-
while (visitor[this.MQ.R] !== ActionType.MQ_END) {
|
|
1378
|
-
if (this._isFraction(visitor[this.MQ.R])) {
|
|
1379
|
-
return CursorContext.BEFORE_FRACTION;
|
|
1380
|
-
} else if (!this._isLeaf(visitor[this.MQ.R])) {
|
|
1381
|
-
break;
|
|
1382
|
-
}
|
|
1383
|
-
visitor = visitor[this.MQ.R];
|
|
1384
|
-
}
|
|
1385
|
-
|
|
1386
|
-
// If that didn't work, check if the parent or grandparent is a special
|
|
1387
|
-
// context, so that we can jump outwards.
|
|
1388
|
-
if (this._isParens(cursor.parent && cursor.parent.parent)) {
|
|
1389
|
-
return CursorContext.IN_PARENS;
|
|
1390
|
-
} else if (this._isNumerator(cursor.parent)) {
|
|
1391
|
-
return CursorContext.IN_NUMERATOR;
|
|
1392
|
-
} else if (this._isDenominator(cursor.parent)) {
|
|
1393
|
-
return CursorContext.IN_DENOMINATOR;
|
|
1394
|
-
} else if (this._isSubScript(cursor.parent)) {
|
|
1395
|
-
return CursorContext.IN_SUB_SCRIPT;
|
|
1396
|
-
} else if (this._isSuperScript(cursor.parent)) {
|
|
1397
|
-
return CursorContext.IN_SUPER_SCRIPT;
|
|
1398
|
-
} else {
|
|
1399
|
-
return CursorContext.NONE;
|
|
1400
|
-
}
|
|
1401
|
-
}
|
|
1402
|
-
_isAtTopLevel(cursor) {
|
|
1403
|
-
return !cursor.parent.parent;
|
|
1404
|
-
}
|
|
1405
1432
|
}
|
|
1406
1433
|
|
|
1407
1434
|
/**
|
|
@@ -1860,16 +1887,16 @@ class MathInput extends React__namespace.Component {
|
|
|
1860
1887
|
});
|
|
1861
1888
|
_defineProperty(this, "domKeyToMathQuillKey", key => {
|
|
1862
1889
|
const keyMap = {
|
|
1863
|
-
"+":
|
|
1864
|
-
"-":
|
|
1865
|
-
"*":
|
|
1866
|
-
"/":
|
|
1867
|
-
".":
|
|
1868
|
-
"%":
|
|
1869
|
-
"=":
|
|
1870
|
-
">":
|
|
1871
|
-
"<":
|
|
1872
|
-
"^":
|
|
1890
|
+
"+": "PLUS",
|
|
1891
|
+
"-": "MINUS",
|
|
1892
|
+
"*": "TIMES",
|
|
1893
|
+
"/": "DIVIDE",
|
|
1894
|
+
".": "DECIMAL",
|
|
1895
|
+
"%": "PERCENT",
|
|
1896
|
+
"=": "EQUAL",
|
|
1897
|
+
">": "GT",
|
|
1898
|
+
"<": "LT",
|
|
1899
|
+
"^": "EXP"
|
|
1873
1900
|
};
|
|
1874
1901
|
|
|
1875
1902
|
// Numbers
|
|
@@ -1879,7 +1906,7 @@ class MathInput extends React__namespace.Component {
|
|
|
1879
1906
|
|
|
1880
1907
|
// Movement keys
|
|
1881
1908
|
else if (key === "Backspace") {
|
|
1882
|
-
return
|
|
1909
|
+
return "BACKSPACE";
|
|
1883
1910
|
}
|
|
1884
1911
|
|
|
1885
1912
|
// Operators
|
|
@@ -2081,7 +2108,7 @@ class MathInput extends React__namespace.Component {
|
|
|
2081
2108
|
// to the open the keyboard, and then remove the second half of this label.
|
|
2082
2109
|
const ariaLabel = i18n__namespace._("Math input box") + " " + i18n__namespace._("Tap with one or two fingers to open keyboard");
|
|
2083
2110
|
return /*#__PURE__*/React__namespace.createElement(View, {
|
|
2084
|
-
style: styles$
|
|
2111
|
+
style: styles$g.input,
|
|
2085
2112
|
onTouchStart: this.handleTouchStart,
|
|
2086
2113
|
onTouchMove: this.handleTouchMove,
|
|
2087
2114
|
onTouchEnd: this.handleTouchEnd,
|
|
@@ -2127,7 +2154,7 @@ const numeralHeightPx = 20;
|
|
|
2127
2154
|
const totalDesiredPadding = 12;
|
|
2128
2155
|
const minHeightPx = numeralHeightPx + totalDesiredPadding * 2;
|
|
2129
2156
|
const minWidthPx = 64;
|
|
2130
|
-
const styles$
|
|
2157
|
+
const styles$g = aphrodite.StyleSheet.create({
|
|
2131
2158
|
input: {
|
|
2132
2159
|
position: "relative",
|
|
2133
2160
|
display: "inline-block",
|
|
@@ -2177,40 +2204,104 @@ const keypadElementPropType = PropTypes__default["default"].shape({
|
|
|
2177
2204
|
/**
|
|
2178
2205
|
* This file contains configuration settings for the buttons in the keypad.
|
|
2179
2206
|
*/
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2207
|
+
const getDefaultOperatorFields = _ref => {
|
|
2208
|
+
let {
|
|
2209
|
+
key,
|
|
2210
|
+
keyType = "OPERATOR",
|
|
2211
|
+
iconType = IconType.SVG,
|
|
2212
|
+
ariaLabel = key,
|
|
2213
|
+
data = key
|
|
2214
|
+
} = _ref;
|
|
2215
|
+
return {
|
|
2216
|
+
id: key,
|
|
2217
|
+
type: keyType,
|
|
2218
|
+
ariaLabel,
|
|
2219
|
+
icon: {
|
|
2220
|
+
type: iconType,
|
|
2221
|
+
data
|
|
2222
|
+
}
|
|
2223
|
+
};
|
|
2224
|
+
};
|
|
2225
|
+
const getDefaultValueFields = _ref2 => {
|
|
2226
|
+
let {
|
|
2227
|
+
key,
|
|
2228
|
+
keyType = "VALUE",
|
|
2229
|
+
iconType = IconType.MATH,
|
|
2230
|
+
ariaLabel = key,
|
|
2231
|
+
data = key
|
|
2232
|
+
} = _ref2;
|
|
2233
|
+
return {
|
|
2234
|
+
id: key,
|
|
2235
|
+
type: keyType,
|
|
2236
|
+
ariaLabel,
|
|
2237
|
+
icon: {
|
|
2238
|
+
type: iconType,
|
|
2239
|
+
data
|
|
2240
|
+
}
|
|
2241
|
+
};
|
|
2242
|
+
};
|
|
2243
|
+
const getDefaultNumberFields = _ref3 => {
|
|
2244
|
+
let {
|
|
2245
|
+
key,
|
|
2246
|
+
data = key.replace("NUM_", ""),
|
|
2247
|
+
keyType = "VALUE",
|
|
2248
|
+
iconType = IconType.TEXT,
|
|
2249
|
+
ariaLabel = data
|
|
2250
|
+
} = _ref3;
|
|
2251
|
+
return {
|
|
2252
|
+
id: key,
|
|
2253
|
+
type: keyType,
|
|
2254
|
+
ariaLabel,
|
|
2255
|
+
icon: {
|
|
2256
|
+
type: iconType,
|
|
2257
|
+
data
|
|
2258
|
+
}
|
|
2259
|
+
};
|
|
2260
|
+
};
|
|
2183
2261
|
const KeyConfigs = {
|
|
2184
|
-
// Basic math
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2262
|
+
// Basic math
|
|
2263
|
+
PLUS: {
|
|
2264
|
+
...getDefaultOperatorFields({
|
|
2265
|
+
key: "PLUS",
|
|
2266
|
+
// I18N: A label for a 'plus' sign.
|
|
2267
|
+
ariaLabel: i18n__namespace._("Plus")
|
|
2268
|
+
})
|
|
2269
|
+
},
|
|
2270
|
+
MINUS: {
|
|
2271
|
+
...getDefaultOperatorFields({
|
|
2272
|
+
key: "MINUS",
|
|
2273
|
+
// I18N: A label for a 'minus' sign.
|
|
2274
|
+
ariaLabel: i18n__namespace._("Minus")
|
|
2275
|
+
})
|
|
2276
|
+
},
|
|
2277
|
+
NEGATIVE: {
|
|
2278
|
+
...getDefaultOperatorFields({
|
|
2279
|
+
key: "NEGATIVE",
|
|
2280
|
+
// I18N: A label for a 'negative' sign.
|
|
2281
|
+
ariaLabel: i18n__namespace._("Negative")
|
|
2282
|
+
})
|
|
2283
|
+
},
|
|
2284
|
+
TIMES: {
|
|
2285
|
+
...getDefaultOperatorFields({
|
|
2286
|
+
key: "TIMES",
|
|
2287
|
+
// I18N: A label for a 'multiply' sign.
|
|
2288
|
+
ariaLabel: i18n__namespace._("Multiply")
|
|
2289
|
+
})
|
|
2290
|
+
},
|
|
2291
|
+
DIVIDE: {
|
|
2292
|
+
...getDefaultOperatorFields({
|
|
2293
|
+
key: "DIVIDE",
|
|
2294
|
+
// I18N: A label for a 'divide' sign.
|
|
2295
|
+
ariaLabel: i18n__namespace._("Divide")
|
|
2296
|
+
})
|
|
2297
|
+
},
|
|
2298
|
+
DECIMAL: {
|
|
2299
|
+
...getDefaultOperatorFields({
|
|
2300
|
+
key: "DECIMAL",
|
|
2301
|
+
keyType: "VALUE",
|
|
2302
|
+
// I18N: A label for a 'decimal' sign (represented as '.' or ',').
|
|
2303
|
+
ariaLabel: i18n__namespace._("Decimal")
|
|
2304
|
+
}),
|
|
2214
2305
|
icon: decimalSeparator === DecimalSeparator.COMMA ? {
|
|
2215
2306
|
// TODO(charlie): Get an SVG icon for the comma, or verify with
|
|
2216
2307
|
// design that the text-rendered version is acceptable.
|
|
@@ -2218,252 +2309,662 @@ const KeyConfigs = {
|
|
|
2218
2309
|
data: ","
|
|
2219
2310
|
} : {
|
|
2220
2311
|
type: IconType.SVG,
|
|
2221
|
-
data:
|
|
2312
|
+
data: "PERIOD"
|
|
2222
2313
|
}
|
|
2223
2314
|
},
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
},
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
},
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2315
|
+
PERIOD: {
|
|
2316
|
+
...getDefaultOperatorFields({
|
|
2317
|
+
key: "PERIOD",
|
|
2318
|
+
keyType: "VALUE",
|
|
2319
|
+
ariaLabel: "."
|
|
2320
|
+
})
|
|
2321
|
+
},
|
|
2322
|
+
PERCENT: {
|
|
2323
|
+
...getDefaultOperatorFields({
|
|
2324
|
+
key: "PERCENT",
|
|
2325
|
+
// I18N: A label for a 'percent' sign (represented as '%').
|
|
2326
|
+
ariaLabel: i18n__namespace._("Percent")
|
|
2327
|
+
})
|
|
2328
|
+
},
|
|
2329
|
+
CDOT: {
|
|
2330
|
+
...getDefaultOperatorFields({
|
|
2331
|
+
key: "CDOT",
|
|
2332
|
+
// I18N: A label for a 'centered dot' multiplication sign (represented as '⋅').
|
|
2333
|
+
ariaLabel: i18n__namespace._("Multiply")
|
|
2334
|
+
})
|
|
2335
|
+
},
|
|
2336
|
+
EQUAL: {
|
|
2337
|
+
...getDefaultOperatorFields({
|
|
2338
|
+
key: "EQUAL",
|
|
2339
|
+
// I18N: A label for an 'equals' sign (represented as '=').
|
|
2340
|
+
ariaLabel: i18n__namespace._("Equals sign")
|
|
2341
|
+
})
|
|
2342
|
+
},
|
|
2343
|
+
NEQ: {
|
|
2344
|
+
...getDefaultOperatorFields({
|
|
2345
|
+
key: "NEQ",
|
|
2346
|
+
// I18N: A label for a 'not-equals' sign (represented as '≠').
|
|
2347
|
+
ariaLabel: i18n__namespace._("Not-equals sign")
|
|
2348
|
+
})
|
|
2349
|
+
},
|
|
2350
|
+
GT: {
|
|
2351
|
+
...getDefaultOperatorFields({
|
|
2352
|
+
key: "GT",
|
|
2353
|
+
// I18N: A label for a 'greater than' sign (represented as '>').
|
|
2354
|
+
ariaLabel: i18n__namespace._("Greater than sign")
|
|
2355
|
+
})
|
|
2356
|
+
},
|
|
2357
|
+
LT: {
|
|
2358
|
+
...getDefaultOperatorFields({
|
|
2359
|
+
key: "LT",
|
|
2360
|
+
// I18N: A label for a 'less than' sign (represented as '<').
|
|
2361
|
+
ariaLabel: i18n__namespace._("Less than sign")
|
|
2362
|
+
})
|
|
2363
|
+
},
|
|
2364
|
+
GEQ: {
|
|
2365
|
+
...getDefaultOperatorFields({
|
|
2366
|
+
key: "GEQ",
|
|
2367
|
+
// I18N: A label for a 'greater than or equal to' sign (represented as '≥').
|
|
2368
|
+
ariaLabel: i18n__namespace._("Greater than or equal to sign")
|
|
2369
|
+
})
|
|
2370
|
+
},
|
|
2371
|
+
LEQ: {
|
|
2372
|
+
...getDefaultOperatorFields({
|
|
2373
|
+
key: "LEQ",
|
|
2374
|
+
// I18N: A label for a 'less than or equal to' sign (represented as '≤').
|
|
2375
|
+
ariaLabel: i18n__namespace._("Less than or equal to sign")
|
|
2376
|
+
})
|
|
2259
2377
|
},
|
|
2260
2378
|
// mobile native
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2379
|
+
FRAC_INCLUSIVE: {
|
|
2380
|
+
...getDefaultOperatorFields({
|
|
2381
|
+
key: "FRAC_INCLUSIVE",
|
|
2382
|
+
// I18N: A label for a button that creates a new fraction and puts the
|
|
2383
|
+
// current expression in the numerator of that fraction.
|
|
2384
|
+
ariaLabel: i18n__namespace._("Fraction, with current expression in numerator")
|
|
2385
|
+
})
|
|
2266
2386
|
},
|
|
2267
2387
|
// mobile native
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2388
|
+
FRAC_EXCLUSIVE: {
|
|
2389
|
+
...getDefaultOperatorFields({
|
|
2390
|
+
key: "FRAC_EXCLUSIVE",
|
|
2391
|
+
// I18N: A label for a button that creates a new fraction next to the
|
|
2392
|
+
// cursor.
|
|
2393
|
+
ariaLabel: i18n__namespace._("Fraction, excluding the current expression")
|
|
2394
|
+
})
|
|
2273
2395
|
},
|
|
2274
2396
|
// mobile web
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
},
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
},
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
},
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
},
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
},
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
},
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
},
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
},
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
},
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
},
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2397
|
+
FRAC: {
|
|
2398
|
+
...getDefaultOperatorFields({
|
|
2399
|
+
key: "FRAC",
|
|
2400
|
+
// I18N: A label for a button that creates a new fraction next to the
|
|
2401
|
+
// cursor.
|
|
2402
|
+
ariaLabel: i18n__namespace._("Fraction, excluding the current expression")
|
|
2403
|
+
})
|
|
2404
|
+
},
|
|
2405
|
+
EXP: {
|
|
2406
|
+
...getDefaultOperatorFields({
|
|
2407
|
+
key: "EXP",
|
|
2408
|
+
// I18N: A label for a button that will allow the user to input a
|
|
2409
|
+
// custom exponent.
|
|
2410
|
+
ariaLabel: i18n__namespace._("Custom exponent")
|
|
2411
|
+
})
|
|
2412
|
+
},
|
|
2413
|
+
EXP_2: {
|
|
2414
|
+
...getDefaultOperatorFields({
|
|
2415
|
+
key: "EXP_2",
|
|
2416
|
+
// I18N: A label for a button that will square (take to the second
|
|
2417
|
+
// power) some math.
|
|
2418
|
+
ariaLabel: i18n__namespace._("Square")
|
|
2419
|
+
})
|
|
2420
|
+
},
|
|
2421
|
+
EXP_3: {
|
|
2422
|
+
...getDefaultOperatorFields({
|
|
2423
|
+
key: "EXP_3",
|
|
2424
|
+
// I18N: A label for a button that will cube (take to the third power)
|
|
2425
|
+
// some math.
|
|
2426
|
+
ariaLabel: i18n__namespace._("Cube")
|
|
2427
|
+
})
|
|
2428
|
+
},
|
|
2429
|
+
SQRT: {
|
|
2430
|
+
...getDefaultOperatorFields({
|
|
2431
|
+
key: "SQRT",
|
|
2432
|
+
// I18N: A label for a button that will allow the user to input a
|
|
2433
|
+
// square root.
|
|
2434
|
+
ariaLabel: i18n__namespace._("Square root")
|
|
2435
|
+
})
|
|
2436
|
+
},
|
|
2437
|
+
CUBE_ROOT: {
|
|
2438
|
+
...getDefaultOperatorFields({
|
|
2439
|
+
key: "CUBE_ROOT",
|
|
2440
|
+
// I18N: A label for a button that will allow the user to input a
|
|
2441
|
+
// cube root.
|
|
2442
|
+
ariaLabel: i18n__namespace._("Cube root")
|
|
2443
|
+
})
|
|
2444
|
+
},
|
|
2445
|
+
RADICAL: {
|
|
2446
|
+
...getDefaultOperatorFields({
|
|
2447
|
+
key: "RADICAL",
|
|
2448
|
+
// I18N: A label for a button that will allow the user to input a
|
|
2449
|
+
// radical with a custom root.
|
|
2450
|
+
ariaLabel: i18n__namespace._("Radical with custom root")
|
|
2451
|
+
})
|
|
2452
|
+
},
|
|
2453
|
+
LEFT_PAREN: {
|
|
2454
|
+
...getDefaultOperatorFields({
|
|
2455
|
+
key: "LEFT_PAREN",
|
|
2456
|
+
// I18N: A label for a button that will allow the user to input a
|
|
2457
|
+
// left parenthesis (i.e. '(')
|
|
2458
|
+
ariaLabel: i18n__namespace._("Left parenthesis")
|
|
2459
|
+
})
|
|
2460
|
+
},
|
|
2461
|
+
RIGHT_PAREN: {
|
|
2462
|
+
...getDefaultOperatorFields({
|
|
2463
|
+
key: "RIGHT_PAREN",
|
|
2464
|
+
// I18N: A label for a button that will allow the user to input a
|
|
2465
|
+
// right parenthesis (i.e. ')')
|
|
2466
|
+
ariaLabel: i18n__namespace._("Right parenthesis")
|
|
2467
|
+
})
|
|
2468
|
+
},
|
|
2469
|
+
LN: {
|
|
2470
|
+
...getDefaultOperatorFields({
|
|
2471
|
+
key: "LN",
|
|
2472
|
+
// I18N: A label for a button that will allow the user to input a
|
|
2473
|
+
// natural logarithm.
|
|
2474
|
+
ariaLabel: i18n__namespace._("Natural logarithm")
|
|
2475
|
+
})
|
|
2476
|
+
},
|
|
2477
|
+
LOG: {
|
|
2478
|
+
...getDefaultOperatorFields({
|
|
2479
|
+
key: "LOG",
|
|
2480
|
+
// I18N: A label for a button that will allow the user to input a
|
|
2481
|
+
// logarithm with base 10.
|
|
2482
|
+
ariaLabel: i18n__namespace._("Logarithm with base 10")
|
|
2483
|
+
})
|
|
2484
|
+
},
|
|
2485
|
+
LOG_N: {
|
|
2486
|
+
...getDefaultOperatorFields({
|
|
2487
|
+
key: "LOG_N",
|
|
2488
|
+
// I18N: A label for a button that will allow the user to input a
|
|
2489
|
+
// logarithm with a custom base.
|
|
2490
|
+
ariaLabel: i18n__namespace._("Logarithm with custom base")
|
|
2491
|
+
})
|
|
2492
|
+
},
|
|
2493
|
+
SIN: {
|
|
2494
|
+
...getDefaultOperatorFields({
|
|
2495
|
+
key: "SIN",
|
|
2496
|
+
// I18N: A label for a button that will allow the user to input a
|
|
2497
|
+
// sine function.
|
|
2498
|
+
ariaLabel: i18n__namespace._("Sine")
|
|
2499
|
+
})
|
|
2500
|
+
},
|
|
2501
|
+
COS: {
|
|
2502
|
+
...getDefaultOperatorFields({
|
|
2503
|
+
key: "COS",
|
|
2504
|
+
// I18N: A label for a button that will allow the user to input a
|
|
2505
|
+
// cosine function.
|
|
2506
|
+
ariaLabel: i18n__namespace._("Cosine")
|
|
2507
|
+
})
|
|
2508
|
+
},
|
|
2509
|
+
TAN: {
|
|
2510
|
+
...getDefaultOperatorFields({
|
|
2511
|
+
key: "TAN",
|
|
2512
|
+
// I18N: A label for a button that will allow the user to input a
|
|
2513
|
+
// tangent function.
|
|
2514
|
+
ariaLabel: i18n__namespace._("Tangent")
|
|
2515
|
+
})
|
|
2516
|
+
},
|
|
2517
|
+
PI: {
|
|
2518
|
+
...getDefaultValueFields({
|
|
2519
|
+
key: "PI",
|
|
2520
|
+
data: "\\pi",
|
|
2521
|
+
// I18N: A label for a button that will allow the user to input the
|
|
2522
|
+
// mathematical constant pi (i.e., π)
|
|
2523
|
+
ariaLabel: i18n__namespace._("Pi")
|
|
2524
|
+
})
|
|
2525
|
+
},
|
|
2526
|
+
THETA: {
|
|
2527
|
+
...getDefaultValueFields({
|
|
2528
|
+
key: "THETA",
|
|
2529
|
+
data: "\\theta",
|
|
2530
|
+
// I18N: A label for a button that will allow the user to input the
|
|
2531
|
+
// mathematical constant theta (i.e., θ)
|
|
2532
|
+
ariaLabel: i18n__namespace._("Theta")
|
|
2533
|
+
})
|
|
2534
|
+
},
|
|
2535
|
+
NOOP: {
|
|
2536
|
+
...getDefaultOperatorFields({
|
|
2537
|
+
key: "NOOP",
|
|
2538
|
+
keyType: "EMPTY"
|
|
2539
|
+
})
|
|
2540
|
+
},
|
|
2541
|
+
// Input navigation
|
|
2542
|
+
UP: {
|
|
2543
|
+
...getDefaultOperatorFields({
|
|
2544
|
+
key: "UP",
|
|
2545
|
+
keyType: "INPUT_NAVIGATION",
|
|
2546
|
+
ariaLabel: i18n__namespace._("Up arrow")
|
|
2547
|
+
})
|
|
2548
|
+
},
|
|
2549
|
+
RIGHT: {
|
|
2550
|
+
...getDefaultOperatorFields({
|
|
2551
|
+
key: "RIGHT",
|
|
2552
|
+
keyType: "INPUT_NAVIGATION",
|
|
2553
|
+
ariaLabel: i18n__namespace._("Right arrow")
|
|
2554
|
+
})
|
|
2555
|
+
},
|
|
2556
|
+
DOWN: {
|
|
2557
|
+
...getDefaultOperatorFields({
|
|
2558
|
+
key: "DOWN",
|
|
2559
|
+
keyType: "INPUT_NAVIGATION",
|
|
2560
|
+
ariaLabel: i18n__namespace._("Down arrow")
|
|
2561
|
+
})
|
|
2562
|
+
},
|
|
2563
|
+
LEFT: {
|
|
2564
|
+
...getDefaultOperatorFields({
|
|
2565
|
+
key: "LEFT",
|
|
2566
|
+
keyType: "INPUT_NAVIGATION",
|
|
2567
|
+
ariaLabel: i18n__namespace._("Left arrow")
|
|
2568
|
+
})
|
|
2569
|
+
},
|
|
2570
|
+
JUMP_OUT_PARENTHESES: {
|
|
2571
|
+
...getDefaultOperatorFields({
|
|
2572
|
+
key: "JUMP_OUT_PARENTHESES",
|
|
2573
|
+
keyType: "INPUT_NAVIGATION",
|
|
2574
|
+
ariaLabel: i18n__namespace._("Navigate right out of a set of parentheses")
|
|
2575
|
+
})
|
|
2576
|
+
},
|
|
2577
|
+
JUMP_OUT_EXPONENT: {
|
|
2578
|
+
...getDefaultOperatorFields({
|
|
2579
|
+
key: "JUMP_OUT_EXPONENT",
|
|
2580
|
+
keyType: "INPUT_NAVIGATION",
|
|
2581
|
+
ariaLabel: i18n__namespace._("Navigate right out of an exponent")
|
|
2582
|
+
})
|
|
2583
|
+
},
|
|
2584
|
+
JUMP_OUT_BASE: {
|
|
2585
|
+
...getDefaultOperatorFields({
|
|
2586
|
+
key: "JUMP_OUT_BASE",
|
|
2587
|
+
keyType: "INPUT_NAVIGATION",
|
|
2588
|
+
ariaLabel: i18n__namespace._("Navigate right out of a base")
|
|
2589
|
+
})
|
|
2590
|
+
},
|
|
2591
|
+
JUMP_INTO_NUMERATOR: {
|
|
2592
|
+
...getDefaultOperatorFields({
|
|
2593
|
+
key: "JUMP_INTO_NUMERATOR",
|
|
2594
|
+
keyType: "INPUT_NAVIGATION",
|
|
2595
|
+
ariaLabel: i18n__namespace._("Navigate right into the numerator of a fraction")
|
|
2596
|
+
})
|
|
2597
|
+
},
|
|
2598
|
+
JUMP_OUT_NUMERATOR: {
|
|
2599
|
+
...getDefaultOperatorFields({
|
|
2600
|
+
key: "JUMP_OUT_NUMERATOR",
|
|
2601
|
+
keyType: "INPUT_NAVIGATION",
|
|
2602
|
+
ariaLabel: i18n__namespace._("Navigate right out of the numerator and into the denominator")
|
|
2603
|
+
})
|
|
2604
|
+
},
|
|
2605
|
+
JUMP_OUT_DENOMINATOR: {
|
|
2606
|
+
...getDefaultOperatorFields({
|
|
2607
|
+
key: "JUMP_OUT_DENOMINATOR",
|
|
2608
|
+
keyType: "INPUT_NAVIGATION",
|
|
2609
|
+
ariaLabel: i18n__namespace._("Navigate right out of the denominator of a fraction")
|
|
2610
|
+
})
|
|
2611
|
+
},
|
|
2612
|
+
BACKSPACE: {
|
|
2613
|
+
...getDefaultOperatorFields({
|
|
2614
|
+
key: "BACKSPACE",
|
|
2615
|
+
keyType: "INPUT_NAVIGATION",
|
|
2616
|
+
ariaLabel: i18n__namespace._("Delete")
|
|
2617
|
+
})
|
|
2618
|
+
},
|
|
2619
|
+
// Keypad navigation
|
|
2620
|
+
DISMISS: {
|
|
2621
|
+
...getDefaultOperatorFields({
|
|
2622
|
+
key: "DISMISS",
|
|
2623
|
+
keyType: "KEYPAD_NAVIGATION",
|
|
2624
|
+
// I18N: A label for a button that will dismiss/hide a keypad.
|
|
2625
|
+
ariaLabel: i18n__namespace._("Dismiss")
|
|
2626
|
+
})
|
|
2413
2627
|
},
|
|
2414
2628
|
// TODO(charlie): Use the numeral color for the 'Many' key.
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2629
|
+
MANY: {
|
|
2630
|
+
...getDefaultOperatorFields({
|
|
2631
|
+
key: "MANY",
|
|
2632
|
+
keyType: "MANY"
|
|
2633
|
+
})
|
|
2634
|
+
},
|
|
2635
|
+
// NUMBERS
|
|
2636
|
+
NUM_0: {
|
|
2637
|
+
...getDefaultNumberFields({
|
|
2638
|
+
key: "NUM_0"
|
|
2639
|
+
})
|
|
2640
|
+
},
|
|
2641
|
+
NUM_1: {
|
|
2642
|
+
...getDefaultNumberFields({
|
|
2643
|
+
key: "NUM_1"
|
|
2644
|
+
})
|
|
2645
|
+
},
|
|
2646
|
+
NUM_2: {
|
|
2647
|
+
...getDefaultNumberFields({
|
|
2648
|
+
key: "NUM_2"
|
|
2649
|
+
})
|
|
2650
|
+
},
|
|
2651
|
+
NUM_3: {
|
|
2652
|
+
...getDefaultNumberFields({
|
|
2653
|
+
key: "NUM_3"
|
|
2654
|
+
})
|
|
2655
|
+
},
|
|
2656
|
+
NUM_4: {
|
|
2657
|
+
...getDefaultNumberFields({
|
|
2658
|
+
key: "NUM_4"
|
|
2659
|
+
})
|
|
2660
|
+
},
|
|
2661
|
+
NUM_5: {
|
|
2662
|
+
...getDefaultNumberFields({
|
|
2663
|
+
key: "NUM_5"
|
|
2664
|
+
})
|
|
2665
|
+
},
|
|
2666
|
+
NUM_6: {
|
|
2667
|
+
...getDefaultNumberFields({
|
|
2668
|
+
key: "NUM_6"
|
|
2669
|
+
})
|
|
2670
|
+
},
|
|
2671
|
+
NUM_7: {
|
|
2672
|
+
...getDefaultNumberFields({
|
|
2673
|
+
key: "NUM_7"
|
|
2674
|
+
})
|
|
2675
|
+
},
|
|
2676
|
+
NUM_8: {
|
|
2677
|
+
...getDefaultNumberFields({
|
|
2678
|
+
key: "NUM_8"
|
|
2679
|
+
})
|
|
2680
|
+
},
|
|
2681
|
+
NUM_9: {
|
|
2682
|
+
...getDefaultNumberFields({
|
|
2683
|
+
key: "NUM_9"
|
|
2684
|
+
})
|
|
2685
|
+
},
|
|
2686
|
+
// LETTERS
|
|
2687
|
+
A: {
|
|
2688
|
+
...getDefaultValueFields({
|
|
2689
|
+
key: "A"
|
|
2690
|
+
})
|
|
2691
|
+
},
|
|
2692
|
+
B: {
|
|
2693
|
+
...getDefaultValueFields({
|
|
2694
|
+
key: "B"
|
|
2695
|
+
})
|
|
2696
|
+
},
|
|
2697
|
+
C: {
|
|
2698
|
+
...getDefaultValueFields({
|
|
2699
|
+
key: "C"
|
|
2700
|
+
})
|
|
2701
|
+
},
|
|
2702
|
+
D: {
|
|
2703
|
+
...getDefaultValueFields({
|
|
2704
|
+
key: "D"
|
|
2705
|
+
})
|
|
2706
|
+
},
|
|
2707
|
+
E: {
|
|
2708
|
+
...getDefaultValueFields({
|
|
2709
|
+
key: "E"
|
|
2710
|
+
})
|
|
2711
|
+
},
|
|
2712
|
+
F: {
|
|
2713
|
+
...getDefaultValueFields({
|
|
2714
|
+
key: "F"
|
|
2715
|
+
})
|
|
2716
|
+
},
|
|
2717
|
+
G: {
|
|
2718
|
+
...getDefaultValueFields({
|
|
2719
|
+
key: "G"
|
|
2720
|
+
})
|
|
2721
|
+
},
|
|
2722
|
+
H: {
|
|
2723
|
+
...getDefaultValueFields({
|
|
2724
|
+
key: "H"
|
|
2725
|
+
})
|
|
2726
|
+
},
|
|
2727
|
+
I: {
|
|
2728
|
+
...getDefaultValueFields({
|
|
2729
|
+
key: "I"
|
|
2730
|
+
})
|
|
2731
|
+
},
|
|
2732
|
+
J: {
|
|
2733
|
+
...getDefaultValueFields({
|
|
2734
|
+
key: "J"
|
|
2735
|
+
})
|
|
2736
|
+
},
|
|
2737
|
+
K: {
|
|
2738
|
+
...getDefaultValueFields({
|
|
2739
|
+
key: "K"
|
|
2740
|
+
})
|
|
2741
|
+
},
|
|
2742
|
+
L: {
|
|
2743
|
+
...getDefaultValueFields({
|
|
2744
|
+
key: "L"
|
|
2745
|
+
})
|
|
2746
|
+
},
|
|
2747
|
+
M: {
|
|
2748
|
+
...getDefaultValueFields({
|
|
2749
|
+
key: "M"
|
|
2750
|
+
})
|
|
2751
|
+
},
|
|
2752
|
+
N: {
|
|
2753
|
+
...getDefaultValueFields({
|
|
2754
|
+
key: "N"
|
|
2755
|
+
})
|
|
2756
|
+
},
|
|
2757
|
+
O: {
|
|
2758
|
+
...getDefaultValueFields({
|
|
2759
|
+
key: "O"
|
|
2760
|
+
})
|
|
2761
|
+
},
|
|
2762
|
+
P: {
|
|
2763
|
+
...getDefaultValueFields({
|
|
2764
|
+
key: "P"
|
|
2765
|
+
})
|
|
2766
|
+
},
|
|
2767
|
+
Q: {
|
|
2768
|
+
...getDefaultValueFields({
|
|
2769
|
+
key: "Q"
|
|
2770
|
+
})
|
|
2771
|
+
},
|
|
2772
|
+
R: {
|
|
2773
|
+
...getDefaultValueFields({
|
|
2774
|
+
key: "R"
|
|
2775
|
+
})
|
|
2776
|
+
},
|
|
2777
|
+
S: {
|
|
2778
|
+
...getDefaultValueFields({
|
|
2779
|
+
key: "S"
|
|
2780
|
+
})
|
|
2781
|
+
},
|
|
2782
|
+
T: {
|
|
2783
|
+
...getDefaultValueFields({
|
|
2784
|
+
key: "T"
|
|
2785
|
+
})
|
|
2786
|
+
},
|
|
2787
|
+
U: {
|
|
2788
|
+
...getDefaultValueFields({
|
|
2789
|
+
key: "U"
|
|
2790
|
+
})
|
|
2791
|
+
},
|
|
2792
|
+
V: {
|
|
2793
|
+
...getDefaultValueFields({
|
|
2794
|
+
key: "V"
|
|
2795
|
+
})
|
|
2796
|
+
},
|
|
2797
|
+
W: {
|
|
2798
|
+
...getDefaultValueFields({
|
|
2799
|
+
key: "W"
|
|
2800
|
+
})
|
|
2801
|
+
},
|
|
2802
|
+
X: {
|
|
2803
|
+
...getDefaultValueFields({
|
|
2804
|
+
key: "X"
|
|
2805
|
+
})
|
|
2806
|
+
},
|
|
2807
|
+
Y: {
|
|
2808
|
+
...getDefaultValueFields({
|
|
2809
|
+
key: "Y"
|
|
2810
|
+
})
|
|
2811
|
+
},
|
|
2812
|
+
Z: {
|
|
2813
|
+
...getDefaultValueFields({
|
|
2814
|
+
key: "Z"
|
|
2815
|
+
})
|
|
2816
|
+
},
|
|
2817
|
+
a: {
|
|
2818
|
+
...getDefaultValueFields({
|
|
2819
|
+
key: "a"
|
|
2820
|
+
})
|
|
2821
|
+
},
|
|
2822
|
+
b: {
|
|
2823
|
+
...getDefaultValueFields({
|
|
2824
|
+
key: "b"
|
|
2825
|
+
})
|
|
2826
|
+
},
|
|
2827
|
+
c: {
|
|
2828
|
+
...getDefaultValueFields({
|
|
2829
|
+
key: "c"
|
|
2830
|
+
})
|
|
2831
|
+
},
|
|
2832
|
+
d: {
|
|
2833
|
+
...getDefaultValueFields({
|
|
2834
|
+
key: "d"
|
|
2835
|
+
})
|
|
2836
|
+
},
|
|
2837
|
+
e: {
|
|
2838
|
+
...getDefaultValueFields({
|
|
2839
|
+
key: "e"
|
|
2840
|
+
})
|
|
2841
|
+
},
|
|
2842
|
+
f: {
|
|
2843
|
+
...getDefaultValueFields({
|
|
2844
|
+
key: "f"
|
|
2845
|
+
})
|
|
2846
|
+
},
|
|
2847
|
+
g: {
|
|
2848
|
+
...getDefaultValueFields({
|
|
2849
|
+
key: "g"
|
|
2850
|
+
})
|
|
2851
|
+
},
|
|
2852
|
+
h: {
|
|
2853
|
+
...getDefaultValueFields({
|
|
2854
|
+
key: "h"
|
|
2855
|
+
})
|
|
2856
|
+
},
|
|
2857
|
+
i: {
|
|
2858
|
+
...getDefaultValueFields({
|
|
2859
|
+
key: "i"
|
|
2860
|
+
})
|
|
2861
|
+
},
|
|
2862
|
+
j: {
|
|
2863
|
+
...getDefaultValueFields({
|
|
2864
|
+
key: "j"
|
|
2865
|
+
})
|
|
2866
|
+
},
|
|
2867
|
+
k: {
|
|
2868
|
+
...getDefaultValueFields({
|
|
2869
|
+
key: "k"
|
|
2870
|
+
})
|
|
2871
|
+
},
|
|
2872
|
+
l: {
|
|
2873
|
+
...getDefaultValueFields({
|
|
2874
|
+
key: "l"
|
|
2875
|
+
})
|
|
2876
|
+
},
|
|
2877
|
+
m: {
|
|
2878
|
+
...getDefaultValueFields({
|
|
2879
|
+
key: "m"
|
|
2880
|
+
})
|
|
2881
|
+
},
|
|
2882
|
+
n: {
|
|
2883
|
+
...getDefaultValueFields({
|
|
2884
|
+
key: "n"
|
|
2885
|
+
})
|
|
2886
|
+
},
|
|
2887
|
+
o: {
|
|
2888
|
+
...getDefaultValueFields({
|
|
2889
|
+
key: "o"
|
|
2890
|
+
})
|
|
2891
|
+
},
|
|
2892
|
+
p: {
|
|
2893
|
+
...getDefaultValueFields({
|
|
2894
|
+
key: "p"
|
|
2895
|
+
})
|
|
2896
|
+
},
|
|
2897
|
+
q: {
|
|
2898
|
+
...getDefaultValueFields({
|
|
2899
|
+
key: "q"
|
|
2900
|
+
})
|
|
2901
|
+
},
|
|
2902
|
+
r: {
|
|
2903
|
+
...getDefaultValueFields({
|
|
2904
|
+
key: "r"
|
|
2905
|
+
})
|
|
2906
|
+
},
|
|
2907
|
+
s: {
|
|
2908
|
+
...getDefaultValueFields({
|
|
2909
|
+
key: "s"
|
|
2910
|
+
})
|
|
2911
|
+
},
|
|
2912
|
+
t: {
|
|
2913
|
+
...getDefaultValueFields({
|
|
2914
|
+
key: "t"
|
|
2915
|
+
})
|
|
2916
|
+
},
|
|
2917
|
+
u: {
|
|
2918
|
+
...getDefaultValueFields({
|
|
2919
|
+
key: "u"
|
|
2920
|
+
})
|
|
2921
|
+
},
|
|
2922
|
+
v: {
|
|
2923
|
+
...getDefaultValueFields({
|
|
2924
|
+
key: "v"
|
|
2925
|
+
})
|
|
2926
|
+
},
|
|
2927
|
+
w: {
|
|
2928
|
+
...getDefaultValueFields({
|
|
2929
|
+
key: "w"
|
|
2930
|
+
})
|
|
2931
|
+
},
|
|
2932
|
+
x: {
|
|
2933
|
+
...getDefaultValueFields({
|
|
2934
|
+
key: "x"
|
|
2935
|
+
})
|
|
2936
|
+
},
|
|
2937
|
+
y: {
|
|
2938
|
+
...getDefaultValueFields({
|
|
2939
|
+
key: "y"
|
|
2940
|
+
})
|
|
2941
|
+
},
|
|
2942
|
+
z: {
|
|
2943
|
+
...getDefaultValueFields({
|
|
2944
|
+
key: "z"
|
|
2945
|
+
})
|
|
2946
|
+
},
|
|
2947
|
+
PHI: {
|
|
2948
|
+
...getDefaultValueFields({
|
|
2949
|
+
key: "PHI"
|
|
2950
|
+
})
|
|
2951
|
+
},
|
|
2952
|
+
NTHROOT3: {
|
|
2953
|
+
...getDefaultValueFields({
|
|
2954
|
+
key: "NTHROOT3"
|
|
2955
|
+
})
|
|
2956
|
+
},
|
|
2957
|
+
POW: {
|
|
2958
|
+
...getDefaultValueFields({
|
|
2959
|
+
key: "POW"
|
|
2960
|
+
})
|
|
2961
|
+
},
|
|
2962
|
+
LOG_B: {
|
|
2963
|
+
...getDefaultValueFields({
|
|
2964
|
+
key: "LOG_B"
|
|
2965
|
+
})
|
|
2454
2966
|
}
|
|
2455
|
-
}
|
|
2456
|
-
for (const key of Object.keys(KeyConfigs)) {
|
|
2457
|
-
KeyConfigs[key] = {
|
|
2458
|
-
id: key,
|
|
2459
|
-
// Default to an SVG icon indexed by the key name.
|
|
2460
|
-
icon: {
|
|
2461
|
-
type: IconType.SVG,
|
|
2462
|
-
data: key
|
|
2463
|
-
},
|
|
2464
|
-
...KeyConfigs[key]
|
|
2465
|
-
};
|
|
2466
|
-
}
|
|
2967
|
+
};
|
|
2467
2968
|
|
|
2468
2969
|
/**
|
|
2469
2970
|
* A small triangular decal to sit in the corner of a parent component.
|
|
@@ -2473,7 +2974,7 @@ class CornerDecal extends React__namespace.Component {
|
|
|
2473
2974
|
const {
|
|
2474
2975
|
style
|
|
2475
2976
|
} = this.props;
|
|
2476
|
-
const containerStyle = [styles$
|
|
2977
|
+
const containerStyle = [styles$f.container, ...(Array.isArray(style) ? style : [style])];
|
|
2477
2978
|
return /*#__PURE__*/React__namespace.createElement(View, {
|
|
2478
2979
|
style: containerStyle
|
|
2479
2980
|
}, /*#__PURE__*/React__namespace.createElement("svg", {
|
|
@@ -2489,7 +2990,7 @@ class CornerDecal extends React__namespace.Component {
|
|
|
2489
2990
|
}
|
|
2490
2991
|
|
|
2491
2992
|
const triangleSizePx = 7;
|
|
2492
|
-
const styles$
|
|
2993
|
+
const styles$f = aphrodite.StyleSheet.create({
|
|
2493
2994
|
container: {
|
|
2494
2995
|
position: "absolute",
|
|
2495
2996
|
top: 0,
|
|
@@ -2559,13 +3060,13 @@ class MathIcon extends React__namespace.Component {
|
|
|
2559
3060
|
const {
|
|
2560
3061
|
style
|
|
2561
3062
|
} = this.props;
|
|
2562
|
-
const containerStyle = [row$7, centered$4, styles$
|
|
3063
|
+
const containerStyle = [row$7, centered$4, styles$e.size, styles$e.base, ...(Array.isArray(style) ? style : [style])];
|
|
2563
3064
|
return /*#__PURE__*/React__namespace.createElement(View, {
|
|
2564
3065
|
style: containerStyle
|
|
2565
3066
|
});
|
|
2566
3067
|
}
|
|
2567
3068
|
}
|
|
2568
|
-
const styles$
|
|
3069
|
+
const styles$e = aphrodite.StyleSheet.create({
|
|
2569
3070
|
size: {
|
|
2570
3071
|
height: iconSizeHeightPx,
|
|
2571
3072
|
width: iconSizeWidthPx
|
|
@@ -3748,13 +4249,13 @@ class TextIcon extends React__namespace.Component {
|
|
|
3748
4249
|
character,
|
|
3749
4250
|
style
|
|
3750
4251
|
} = this.props;
|
|
3751
|
-
const containerStyle = [row$6, centered$3, styles$
|
|
4252
|
+
const containerStyle = [row$6, centered$3, styles$d.size, styles$d.base, ...(Array.isArray(style) ? style : [style])];
|
|
3752
4253
|
return /*#__PURE__*/React__namespace.createElement(View, {
|
|
3753
4254
|
style: containerStyle
|
|
3754
4255
|
}, /*#__PURE__*/React__namespace.createElement(Text, null, character));
|
|
3755
4256
|
}
|
|
3756
4257
|
}
|
|
3757
|
-
const styles$
|
|
4258
|
+
const styles$d = aphrodite.StyleSheet.create({
|
|
3758
4259
|
size: {
|
|
3759
4260
|
height: iconSizeHeightPx,
|
|
3760
4261
|
width: iconSizeWidthPx
|
|
@@ -3777,7 +4278,7 @@ class Icon extends React__namespace.PureComponent {
|
|
|
3777
4278
|
icon,
|
|
3778
4279
|
style
|
|
3779
4280
|
} = this.props;
|
|
3780
|
-
const styleWithFocus = [focused ? styles$
|
|
4281
|
+
const styleWithFocus = [focused ? styles$c.focused : styles$c.unfocused, ...(Array.isArray(style) ? style : [style])];
|
|
3781
4282
|
switch (icon.type) {
|
|
3782
4283
|
case IconType.MATH:
|
|
3783
4284
|
return /*#__PURE__*/React__namespace.createElement(MathIcon, {
|
|
@@ -3803,7 +4304,7 @@ class Icon extends React__namespace.PureComponent {
|
|
|
3803
4304
|
}
|
|
3804
4305
|
}
|
|
3805
4306
|
}
|
|
3806
|
-
const styles$
|
|
4307
|
+
const styles$c = aphrodite.StyleSheet.create({
|
|
3807
4308
|
unfocused: {
|
|
3808
4309
|
color: unfocusedColor
|
|
3809
4310
|
},
|
|
@@ -3845,19 +4346,19 @@ class MultiSymbolGrid extends React__namespace.Component {
|
|
|
3845
4346
|
focused: focused
|
|
3846
4347
|
});
|
|
3847
4348
|
} else {
|
|
3848
|
-
const primaryIconStyle = styles$
|
|
3849
|
-
const secondaryIconStyle = [styles$
|
|
4349
|
+
const primaryIconStyle = styles$b.base;
|
|
4350
|
+
const secondaryIconStyle = [styles$b.base, styles$b.secondary];
|
|
3850
4351
|
if (icons.length === 2) {
|
|
3851
4352
|
return /*#__PURE__*/React__namespace.createElement(View, {
|
|
3852
|
-
style: [row$5, styles$
|
|
4353
|
+
style: [row$5, styles$b.size]
|
|
3853
4354
|
}, /*#__PURE__*/React__namespace.createElement(View, {
|
|
3854
|
-
style: [column$3, centered$2, fullWidth$3, styles$
|
|
4355
|
+
style: [column$3, centered$2, fullWidth$3, styles$b.middleLeft]
|
|
3855
4356
|
}, /*#__PURE__*/React__namespace.createElement(Icon, {
|
|
3856
4357
|
style: primaryIconStyle,
|
|
3857
4358
|
icon: icons[0],
|
|
3858
4359
|
focused: focused
|
|
3859
4360
|
})), /*#__PURE__*/React__namespace.createElement(View, {
|
|
3860
|
-
style: [column$3, centered$2, fullWidth$3, styles$
|
|
4361
|
+
style: [column$3, centered$2, fullWidth$3, styles$b.middleRight]
|
|
3861
4362
|
}, /*#__PURE__*/React__namespace.createElement(Icon, {
|
|
3862
4363
|
style: secondaryIconStyle,
|
|
3863
4364
|
icon: icons[1],
|
|
@@ -3865,17 +4366,17 @@ class MultiSymbolGrid extends React__namespace.Component {
|
|
|
3865
4366
|
})));
|
|
3866
4367
|
} else if (icons.length >= 3) {
|
|
3867
4368
|
return /*#__PURE__*/React__namespace.createElement(View, {
|
|
3868
|
-
style: [column$3, styles$
|
|
4369
|
+
style: [column$3, styles$b.size]
|
|
3869
4370
|
}, /*#__PURE__*/React__namespace.createElement(View, {
|
|
3870
4371
|
style: row$5
|
|
3871
4372
|
}, /*#__PURE__*/React__namespace.createElement(View, {
|
|
3872
|
-
style: [centered$2, fullWidth$3, styles$
|
|
4373
|
+
style: [centered$2, fullWidth$3, styles$b.topLeft]
|
|
3873
4374
|
}, /*#__PURE__*/React__namespace.createElement(Icon, {
|
|
3874
4375
|
style: primaryIconStyle,
|
|
3875
4376
|
icon: icons[0],
|
|
3876
4377
|
focused: focused
|
|
3877
4378
|
})), /*#__PURE__*/React__namespace.createElement(View, {
|
|
3878
|
-
style: [centered$2, fullWidth$3, styles$
|
|
4379
|
+
style: [centered$2, fullWidth$3, styles$b.topRight]
|
|
3879
4380
|
}, /*#__PURE__*/React__namespace.createElement(Icon, {
|
|
3880
4381
|
style: secondaryIconStyle,
|
|
3881
4382
|
icon: icons[1],
|
|
@@ -3883,13 +4384,13 @@ class MultiSymbolGrid extends React__namespace.Component {
|
|
|
3883
4384
|
}))), /*#__PURE__*/React__namespace.createElement(View, {
|
|
3884
4385
|
style: row$5
|
|
3885
4386
|
}, /*#__PURE__*/React__namespace.createElement(View, {
|
|
3886
|
-
style: [centered$2, fullWidth$3, styles$
|
|
4387
|
+
style: [centered$2, fullWidth$3, styles$b.bottomLeft]
|
|
3887
4388
|
}, /*#__PURE__*/React__namespace.createElement(Icon, {
|
|
3888
4389
|
style: secondaryIconStyle,
|
|
3889
4390
|
icon: icons[2],
|
|
3890
4391
|
focused: focused
|
|
3891
4392
|
})), /*#__PURE__*/React__namespace.createElement(View, {
|
|
3892
|
-
style: [centered$2, fullWidth$3, styles$
|
|
4393
|
+
style: [centered$2, fullWidth$3, styles$b.bottomRight]
|
|
3893
4394
|
}, icons[3] && /*#__PURE__*/React__namespace.createElement(Icon, {
|
|
3894
4395
|
style: secondaryIconStyle,
|
|
3895
4396
|
icon: icons[3],
|
|
@@ -3902,7 +4403,7 @@ class MultiSymbolGrid extends React__namespace.Component {
|
|
|
3902
4403
|
}
|
|
3903
4404
|
const verticalInsetPx = 2;
|
|
3904
4405
|
const horizontalInsetPx = 4;
|
|
3905
|
-
const styles$
|
|
4406
|
+
const styles$b = aphrodite.StyleSheet.create({
|
|
3906
4407
|
size: {
|
|
3907
4408
|
height: iconSizeHeightPx,
|
|
3908
4409
|
width: iconSizeWidthPx
|
|
@@ -3953,7 +4454,7 @@ class KeypadButton$1 extends React__namespace.PureComponent {
|
|
|
3953
4454
|
// object. This method must be called whenever a property that
|
|
3954
4455
|
// influences the possible outcomes of `this._getFocusStyle` and
|
|
3955
4456
|
// `this._getButtonStyle` changes (such as `this.buttonSizeStyle`).
|
|
3956
|
-
for (const type of
|
|
4457
|
+
for (const type of KeyTypes) {
|
|
3957
4458
|
aphrodite.css(View.styles.initial, ...this._getFocusStyle(type));
|
|
3958
4459
|
for (const borders of Object.values(BorderStyles)) {
|
|
3959
4460
|
aphrodite.css(View.styles.initial, ...this._getButtonStyle(type, borders));
|
|
@@ -3962,45 +4463,45 @@ class KeypadButton$1 extends React__namespace.PureComponent {
|
|
|
3962
4463
|
});
|
|
3963
4464
|
_defineProperty(this, "_getFocusStyle", type => {
|
|
3964
4465
|
let focusBackgroundStyle;
|
|
3965
|
-
if (type ===
|
|
3966
|
-
focusBackgroundStyle = styles$
|
|
4466
|
+
if (type === "INPUT_NAVIGATION" || type === "KEYPAD_NAVIGATION") {
|
|
4467
|
+
focusBackgroundStyle = styles$a.light;
|
|
3967
4468
|
} else {
|
|
3968
|
-
focusBackgroundStyle = styles$
|
|
4469
|
+
focusBackgroundStyle = styles$a.bright;
|
|
3969
4470
|
}
|
|
3970
|
-
return [styles$
|
|
4471
|
+
return [styles$a.focusBox, focusBackgroundStyle];
|
|
3971
4472
|
});
|
|
3972
4473
|
_defineProperty(this, "_getButtonStyle", (type, borders, style) => {
|
|
3973
4474
|
// Select the appropriate style for the button.
|
|
3974
4475
|
let backgroundStyle;
|
|
3975
4476
|
switch (type) {
|
|
3976
|
-
case
|
|
3977
|
-
backgroundStyle = styles$
|
|
4477
|
+
case "EMPTY":
|
|
4478
|
+
backgroundStyle = styles$a.empty;
|
|
3978
4479
|
break;
|
|
3979
|
-
case
|
|
3980
|
-
case
|
|
3981
|
-
backgroundStyle = styles$
|
|
4480
|
+
case "MANY":
|
|
4481
|
+
case "VALUE":
|
|
4482
|
+
backgroundStyle = styles$a.value;
|
|
3982
4483
|
break;
|
|
3983
|
-
case
|
|
3984
|
-
backgroundStyle = styles$
|
|
4484
|
+
case "OPERATOR":
|
|
4485
|
+
backgroundStyle = styles$a.operator;
|
|
3985
4486
|
break;
|
|
3986
|
-
case
|
|
3987
|
-
case
|
|
3988
|
-
backgroundStyle = styles$
|
|
4487
|
+
case "INPUT_NAVIGATION":
|
|
4488
|
+
case "KEYPAD_NAVIGATION":
|
|
4489
|
+
backgroundStyle = styles$a.control;
|
|
3989
4490
|
break;
|
|
3990
|
-
case
|
|
4491
|
+
case "ECHO":
|
|
3991
4492
|
backgroundStyle = null;
|
|
3992
4493
|
break;
|
|
3993
4494
|
}
|
|
3994
4495
|
const borderStyle = [];
|
|
3995
4496
|
if (borders.includes(BorderDirection.LEFT)) {
|
|
3996
4497
|
// @ts-expect-error TS2345
|
|
3997
|
-
borderStyle.push(styles$
|
|
4498
|
+
borderStyle.push(styles$a.leftBorder);
|
|
3998
4499
|
}
|
|
3999
4500
|
if (borders.includes(BorderDirection.BOTTOM)) {
|
|
4000
4501
|
// @ts-expect-error TS2345
|
|
4001
|
-
borderStyle.push(styles$
|
|
4502
|
+
borderStyle.push(styles$a.bottomBorder);
|
|
4002
4503
|
}
|
|
4003
|
-
return [styles$
|
|
4504
|
+
return [styles$a.buttonBase, backgroundStyle, ...borderStyle, type === "ECHO" && styles$a.echo, this.buttonSizeStyle,
|
|
4004
4505
|
// React Native allows you to set the 'style' props on user defined
|
|
4005
4506
|
// components.
|
|
4006
4507
|
// See: https://facebook.github.io/react-native/docs/style.html
|
|
@@ -4042,10 +4543,10 @@ class KeypadButton$1 extends React__namespace.PureComponent {
|
|
|
4042
4543
|
|
|
4043
4544
|
// We render in the focus state if the key is focused, or if it's an
|
|
4044
4545
|
// echo.
|
|
4045
|
-
const renderFocused = !disabled && focused || popoverEnabled || type ===
|
|
4546
|
+
const renderFocused = !disabled && focused || popoverEnabled || type === "ECHO";
|
|
4046
4547
|
const buttonStyle = this._getButtonStyle(type, borders, style);
|
|
4047
4548
|
const focusStyle = this._getFocusStyle(type);
|
|
4048
|
-
const iconWrapperStyle = [styles$
|
|
4549
|
+
const iconWrapperStyle = [styles$a.iconWrapper, disabled ? styles$a.disabled : undefined];
|
|
4049
4550
|
const eventHandlers = {
|
|
4050
4551
|
onTouchCancel,
|
|
4051
4552
|
onTouchEnd,
|
|
@@ -4056,13 +4557,13 @@ class KeypadButton$1 extends React__namespace.PureComponent {
|
|
|
4056
4557
|
style: focusStyle
|
|
4057
4558
|
});
|
|
4058
4559
|
const maybeCornerDecal = !renderFocused && !disabled && childKeys && childKeys.length > 0 && /*#__PURE__*/React__namespace.createElement(CornerDecal, {
|
|
4059
|
-
style: styles$
|
|
4560
|
+
style: styles$a.decalInset
|
|
4060
4561
|
});
|
|
4061
|
-
if (type ===
|
|
4562
|
+
if (type === "EMPTY") {
|
|
4062
4563
|
return /*#__PURE__*/React__namespace.createElement(View, _extends({
|
|
4063
4564
|
style: buttonStyle
|
|
4064
4565
|
}, eventHandlers));
|
|
4065
|
-
} else if (type ===
|
|
4566
|
+
} else if (type === "MANY") {
|
|
4066
4567
|
// TODO(charlie): Make the long-press interaction accessible. See
|
|
4067
4568
|
// the TODO in key-configs.js for more.
|
|
4068
4569
|
const manyButtonA11yMarkup = {
|
|
@@ -4105,7 +4606,7 @@ _defineProperty(KeypadButton$1, "defaultProps", {
|
|
|
4105
4606
|
});
|
|
4106
4607
|
const focusInsetPx = 4;
|
|
4107
4608
|
const focusBoxZIndex = 0;
|
|
4108
|
-
const styles$
|
|
4609
|
+
const styles$a = aphrodite.StyleSheet.create({
|
|
4109
4610
|
buttonBase: {
|
|
4110
4611
|
flex: 1,
|
|
4111
4612
|
cursor: "pointer",
|
|
@@ -4258,7 +4759,7 @@ class TouchableKeypadButton extends React__namespace.Component {
|
|
|
4258
4759
|
onTouchMove: evt => gestureManager.onTouchMove(evt),
|
|
4259
4760
|
onTouchCancel: evt => gestureManager.onTouchCancel(evt)
|
|
4260
4761
|
};
|
|
4261
|
-
const styleWithAddons = [...(Array.isArray(style) ? style : [style]), styles$
|
|
4762
|
+
const styleWithAddons = [...(Array.isArray(style) ? style : [style]), styles$9.preventScrolls];
|
|
4262
4763
|
return /*#__PURE__*/React__namespace.createElement(KeypadButton$2, _extends({
|
|
4263
4764
|
ref: node => gestureManager.registerDOMNode(id, ReactDOM__default["default"].findDOMNode(node), childKeyIds),
|
|
4264
4765
|
borders: borders,
|
|
@@ -4297,7 +4798,7 @@ const mapStateToProps$5 = (state, ownProps) => {
|
|
|
4297
4798
|
|
|
4298
4799
|
// Override with the default child props, if the key is a multi-symbol key
|
|
4299
4800
|
// (but not a many-symbol key, which operates under different rules).
|
|
4300
|
-
const useFirstChildProps = type !==
|
|
4801
|
+
const useFirstChildProps = type !== "MANY" && childKeys && childKeys.length > 0;
|
|
4301
4802
|
return {
|
|
4302
4803
|
...rest,
|
|
4303
4804
|
childKeyIds: childKeyIds,
|
|
@@ -4311,7 +4812,7 @@ const mapStateToProps$5 = (state, ownProps) => {
|
|
|
4311
4812
|
...extractProps(useFirstChildProps ? childKeys[0] : keyConfig)
|
|
4312
4813
|
};
|
|
4313
4814
|
};
|
|
4314
|
-
const styles$
|
|
4815
|
+
const styles$9 = aphrodite.StyleSheet.create({
|
|
4315
4816
|
preventScrolls: {
|
|
4316
4817
|
// Touch events that start in the touchable buttons shouldn't be
|
|
4317
4818
|
// allowed to produce page scrolls.
|
|
@@ -4342,8 +4843,13 @@ class ManyKeypadButton extends React__namespace.Component {
|
|
|
4342
4843
|
} else {
|
|
4343
4844
|
const keyConfig = {
|
|
4344
4845
|
id: "MANY",
|
|
4345
|
-
type:
|
|
4346
|
-
childKeyIds: keys
|
|
4846
|
+
type: "MANY",
|
|
4847
|
+
childKeyIds: keys,
|
|
4848
|
+
ariaLabel: keys.map(key => KeyConfigs[key].ariaLabel).join(", "),
|
|
4849
|
+
icon: {
|
|
4850
|
+
type: IconType.SVG,
|
|
4851
|
+
data: "many"
|
|
4852
|
+
}
|
|
4347
4853
|
};
|
|
4348
4854
|
return /*#__PURE__*/React__namespace.createElement(TouchableKeypadButton$1, _extends({
|
|
4349
4855
|
keyConfig: keyConfig
|
|
@@ -4360,50 +4866,69 @@ const IconAsset = function (_ref) {
|
|
|
4360
4866
|
tintColor,
|
|
4361
4867
|
type
|
|
4362
4868
|
} = _ref;
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4869
|
+
switch (type) {
|
|
4870
|
+
case "Geometry":
|
|
4871
|
+
{
|
|
4872
|
+
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
4873
|
+
width: "32",
|
|
4874
|
+
height: "32",
|
|
4875
|
+
viewBox: "0 0 32 32",
|
|
4876
|
+
fill: "none",
|
|
4877
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
4878
|
+
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
4879
|
+
fillRule: "evenodd",
|
|
4880
|
+
clipRule: "evenodd",
|
|
4881
|
+
d: "M7.57584 7.09442C7.92723 6.92984 8.3421 6.98339 8.64018 7.23179L26.6402 22.2318C26.9636 22.5013 27.0836 22.9446 26.9403 23.3404C26.7969 23.7363 26.421 24 26 24H8C7.44772 24 7 23.5523 7 23V8.00001C7 7.61199 7.22446 7.259 7.57584 7.09442ZM9 10.1351V17H13C13.5523 17 14 17.4477 14 18V22H23.238L9 10.1351ZM12 22V19H9V22H12Z",
|
|
4882
|
+
fill: tintColor
|
|
4883
|
+
}));
|
|
4884
|
+
}
|
|
4885
|
+
case "Operators":
|
|
4886
|
+
{
|
|
4887
|
+
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
4888
|
+
viewBox: "0 0 32 32",
|
|
4889
|
+
fill: "none",
|
|
4890
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
4891
|
+
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
4892
|
+
fillRule: "evenodd",
|
|
4893
|
+
clipRule: "evenodd",
|
|
4894
|
+
d: "M29 6H30V7H29V6ZM27 6C27 4.89543 27.8954 4 29 4H30C31.1046 4 32 4.89543 32 6V7C32 8.10457 31.1046 9 30 9H29C27.8954 9 27 8.10457 27 7V6ZM11.1318 6.50386C11.3098 6.19229 11.6411 6 12 6H14C14.5523 6 15 6.44772 15 7C15 7.55228 14.5523 8 14 8H12.5803L8.86824 14.4961C8.68527 14.8163 8.34091 15.0098 7.97225 14.9996C7.6036 14.9894 7.2705 14.7771 7.10557 14.4472L5.10557 10.4472C4.85858 9.95324 5.05881 9.35256 5.55279 9.10557C6.04676 8.85858 6.64744 9.05881 6.89443 9.55279L8.0588 11.8815L11.1318 6.50386ZM7.70676 16.2925C8.09748 16.6829 8.09779 17.316 7.70745 17.7068C7.28543 18.1292 6.84383 18.7303 6.51157 19.3658C6.17039 20.0184 6 20.601 6 21C6 21.3789 6.17235 21.9897 6.51638 22.6649C6.85315 23.3259 7.28488 23.9121 7.66786 24.2557C8.07892 24.6246 8.11314 25.2568 7.74429 25.6679C7.37544 26.0789 6.7432 26.1131 6.33214 25.7443C5.7161 25.1915 5.14783 24.3844 4.73434 23.5728C4.32813 22.7755 3.99999 21.8345 4 21C4.00001 20.1391 4.3301 19.2217 4.73917 18.4392C5.15715 17.6397 5.71554 16.8708 6.29255 16.2932C6.68288 15.9025 7.31605 15.9022 7.70676 16.2925ZM11.2932 16.2925C11.684 15.9022 12.3171 15.9025 12.7075 16.2932C13.2845 16.8708 13.8428 17.6397 14.2608 18.4392C14.6699 19.2217 15 20.1391 15 21C15 21.8345 14.6719 22.7755 14.2657 23.5728C13.8522 24.3844 13.2839 25.1915 12.6679 25.7443C12.2568 26.1131 11.6246 26.0789 11.2557 25.6679C10.8869 25.2568 10.9211 24.6246 11.3321 24.2557C11.7151 23.9121 12.1469 23.3259 12.4836 22.6649C12.8276 21.9897 13 21.3789 13 21C13 20.601 12.8296 20.0184 12.4884 19.3658C12.1562 18.7303 11.7146 18.1292 11.2925 17.7068C10.9022 17.316 10.9025 16.6829 11.2932 16.2925ZM27.9363 17.6489C28.1302 18.166 27.8682 18.7424 27.3511 18.9363L21.848 21L27.3511 23.0637C27.8682 23.2576 28.1302 23.834 27.9363 24.3511C27.7424 24.8682 27.166 25.1302 26.6489 24.9363L18.6489 21.9363C18.2586 21.79 18 21.4168 18 21C18 20.5832 18.2586 20.21 18.6489 20.0637L26.6489 17.0637C27.166 16.8698 27.7424 17.1318 27.9363 17.6489ZM21 8V13H24V8H21ZM20 6C19.4477 6 19 6.44772 19 7V14C19 14.5523 19.4477 15 20 15H25C25.5523 15 26 14.5523 26 14V7C26 6.44772 25.5523 6 25 6H20Z",
|
|
4895
|
+
fill: tintColor
|
|
4896
|
+
}));
|
|
4897
|
+
}
|
|
4898
|
+
case "Numbers":
|
|
4899
|
+
{
|
|
4900
|
+
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
4901
|
+
width: "32",
|
|
4902
|
+
height: "32",
|
|
4903
|
+
viewBox: "0 0 32 32",
|
|
4904
|
+
fill: "none",
|
|
4905
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
4906
|
+
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
4907
|
+
d: "M10.4123 19.5794V21.0004H4.71434V19.5794H6.73034V14.0214C6.73034 13.9001 6.73267 13.7764 6.73734 13.6504C6.742 13.5244 6.749 13.3961 6.75834 13.2654L5.42834 14.3714C5.335 14.4414 5.244 14.4858 5.15534 14.5044C5.06667 14.5231 4.98267 14.5254 4.90334 14.5114C4.824 14.4928 4.754 14.4648 4.69334 14.4274C4.63267 14.3854 4.586 14.3434 4.55334 14.3014L3.94434 13.4824L7.06634 10.8364H8.65534V19.5794H10.4123ZM18.7924 19.2294C19.0024 19.2294 19.1658 19.2878 19.2824 19.4044C19.4038 19.5211 19.4644 19.6751 19.4644 19.8664V21.0004H12.4224V20.3704C12.4224 20.2491 12.4481 20.1184 12.4994 19.9784C12.5508 19.8338 12.6371 19.7031 12.7584 19.5864L15.7684 16.5694C16.0251 16.3128 16.2514 16.0678 16.4474 15.8344C16.6434 15.5964 16.8068 15.3654 16.9374 15.1414C17.0681 14.9128 17.1661 14.6818 17.2314 14.4484C17.2968 14.2151 17.3294 13.9701 17.3294 13.7134C17.3294 13.2608 17.2128 12.9178 16.9794 12.6844C16.7461 12.4464 16.4171 12.3274 15.9924 12.3274C15.8058 12.3274 15.6331 12.3554 15.4744 12.4114C15.3204 12.4628 15.1804 12.5351 15.0544 12.6284C14.9331 12.7218 14.8281 12.8314 14.7394 12.9574C14.6508 13.0834 14.5854 13.2211 14.5434 13.3704C14.4594 13.6038 14.3451 13.7601 14.2004 13.8394C14.0604 13.9141 13.8598 13.9304 13.5984 13.8884L12.5764 13.7064C12.6511 13.2118 12.7911 12.7778 12.9964 12.4044C13.2018 12.0311 13.4584 11.7208 13.7664 11.4734C14.0744 11.2261 14.4268 11.0418 14.8234 10.9204C15.2201 10.7944 15.6471 10.7314 16.1044 10.7314C16.5851 10.7314 17.0214 10.8038 17.4134 10.9484C17.8101 11.0884 18.1484 11.2868 18.4284 11.5434C18.7084 11.7954 18.9254 12.1011 19.0794 12.4604C19.2334 12.8198 19.3104 13.2164 19.3104 13.6504C19.3104 14.0238 19.2568 14.3691 19.1494 14.6864C19.0421 15.0038 18.8951 15.3071 18.7084 15.5964C18.5264 15.8811 18.3141 16.1588 18.0714 16.4294C17.8288 16.7001 17.5721 16.9731 17.3014 17.2484L15.1454 19.4534C15.3834 19.3834 15.6191 19.3298 15.8524 19.2924C16.0858 19.2504 16.3051 19.2294 16.5104 19.2294H18.7924ZM21.4535 13.7064C21.5282 13.2118 21.6682 12.7778 21.8735 12.4044C22.0789 12.0311 22.3355 11.7208 22.6435 11.4734C22.9515 11.2261 23.3015 11.0418 23.6935 10.9204C24.0902 10.7944 24.5172 10.7314 24.9745 10.7314C25.4599 10.7314 25.8939 10.8014 26.2765 10.9414C26.6639 11.0768 26.9905 11.2634 27.2565 11.5014C27.5225 11.7394 27.7255 12.0171 27.8655 12.3344C28.0102 12.6518 28.0825 12.9924 28.0825 13.3564C28.0825 13.6784 28.0475 13.9631 27.9775 14.2104C27.9122 14.4531 27.8119 14.6654 27.6765 14.8474C27.5459 15.0294 27.3825 15.1834 27.1865 15.3094C26.9952 15.4354 26.7735 15.5404 26.5215 15.6244C27.6882 16.0071 28.2715 16.7841 28.2715 17.9554C28.2715 18.4734 28.1759 18.9308 27.9845 19.3274C27.7932 19.7194 27.5365 20.0484 27.2145 20.3144C26.8925 20.5804 26.5169 20.7811 26.0875 20.9164C25.6629 21.0471 25.2172 21.1124 24.7505 21.1124C24.2559 21.1124 23.8195 21.0564 23.4415 20.9444C23.0635 20.8324 22.7299 20.6644 22.4405 20.4404C22.1559 20.2164 21.9109 19.9364 21.7055 19.6004C21.5002 19.2598 21.3205 18.8631 21.1665 18.4104L22.0205 18.0604C22.2445 17.9671 22.4522 17.9414 22.6435 17.9834C22.8395 18.0254 22.9795 18.1281 23.0635 18.2914C23.1569 18.4688 23.2549 18.6321 23.3575 18.7814C23.4649 18.9308 23.5839 19.0614 23.7145 19.1734C23.8452 19.2808 23.9922 19.3648 24.1555 19.4254C24.3235 19.4861 24.5149 19.5164 24.7295 19.5164C25.0002 19.5164 25.2359 19.4721 25.4365 19.3834C25.6372 19.2948 25.8052 19.1804 25.9405 19.0404C26.0759 18.8958 26.1762 18.7348 26.2415 18.5574C26.3115 18.3754 26.3465 18.1958 26.3465 18.0184C26.3465 17.7851 26.3255 17.5751 26.2835 17.3884C26.2415 17.1971 26.1435 17.0361 25.9895 16.9054C25.8402 16.7701 25.6162 16.6674 25.3175 16.5974C25.0235 16.5228 24.6222 16.4854 24.1135 16.4854V15.1274C24.5382 15.1274 24.8859 15.0924 25.1565 15.0224C25.4272 14.9524 25.6395 14.8544 25.7935 14.7284C25.9475 14.6024 26.0525 14.4508 26.1085 14.2734C26.1692 14.0961 26.1995 13.9024 26.1995 13.6924C26.1995 13.2491 26.0829 12.9108 25.8495 12.6774C25.6209 12.4441 25.2942 12.3274 24.8695 12.3274C24.6829 12.3274 24.5102 12.3554 24.3515 12.4114C24.1975 12.4628 24.0575 12.5351 23.9315 12.6284C23.8102 12.7218 23.7052 12.8314 23.6165 12.9574C23.5279 13.0834 23.4625 13.2211 23.4205 13.3704C23.3319 13.6038 23.2175 13.7601 23.0775 13.8394C22.9375 13.9141 22.7345 13.9304 22.4685 13.8884L21.4535 13.7064Z",
|
|
4908
|
+
fill: tintColor
|
|
4909
|
+
}));
|
|
4910
|
+
}
|
|
4911
|
+
case "Extras":
|
|
4912
|
+
{
|
|
4913
|
+
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
4914
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4915
|
+
width: "20",
|
|
4916
|
+
height: "20",
|
|
4917
|
+
fill: "currentColor",
|
|
4918
|
+
viewBox: "0 0 256 256"
|
|
4919
|
+
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
4920
|
+
d: "M232,172a36,36,0,0,1-72,0V72H96V200a8,8,0,0,1-16,0V72H72a40,40,0,0,0-40,40,8,8,0,0,1-16,0A56.06,56.06,0,0,1,72,56H224a8,8,0,0,1,0,16H176V172a20,20,0,0,0,40,0,8,8,0,0,1,16,0Z"
|
|
4921
|
+
}));
|
|
4922
|
+
}
|
|
4923
|
+
default:
|
|
4924
|
+
{
|
|
4925
|
+
// type as never;
|
|
4926
|
+
throw new Error("Invalid icon type");
|
|
4927
|
+
}
|
|
4400
4928
|
}
|
|
4401
|
-
|
|
4402
|
-
// type as never;
|
|
4403
|
-
throw new Error("Invalid icon type");
|
|
4404
4929
|
};
|
|
4405
4930
|
|
|
4406
|
-
const styles$
|
|
4931
|
+
const styles$8 = aphrodite.StyleSheet.create({
|
|
4407
4932
|
base: {
|
|
4408
4933
|
display: "flex",
|
|
4409
4934
|
width: 44,
|
|
@@ -4467,7 +4992,8 @@ class TabbarItem extends React__namespace.Component {
|
|
|
4467
4992
|
} = this.props;
|
|
4468
4993
|
return /*#__PURE__*/React__namespace.createElement(Clickable__default["default"], {
|
|
4469
4994
|
onClick: onClick,
|
|
4470
|
-
disabled: itemState === "disabled"
|
|
4995
|
+
disabled: itemState === "disabled",
|
|
4996
|
+
"aria-label": itemType
|
|
4471
4997
|
}, _ref => {
|
|
4472
4998
|
let {
|
|
4473
4999
|
hovered,
|
|
@@ -4476,14 +5002,14 @@ class TabbarItem extends React__namespace.Component {
|
|
|
4476
5002
|
} = _ref;
|
|
4477
5003
|
const tintColor = imageTintColor(itemState, hovered, focused, pressed);
|
|
4478
5004
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
4479
|
-
style: [styles$
|
|
5005
|
+
style: [styles$8.base, itemState !== "disabled" && hovered && styles$8.hovered, focused && styles$8.focused, pressed && styles$8.pressed]
|
|
4480
5006
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
4481
|
-
style: [styles$
|
|
5007
|
+
style: [styles$8.innerBox, pressed && styles$8.innerBoxPressed]
|
|
4482
5008
|
}, /*#__PURE__*/React__namespace.createElement(IconAsset, {
|
|
4483
5009
|
type: itemType,
|
|
4484
5010
|
tintColor: tintColor
|
|
4485
5011
|
})), itemState === "active" && /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
4486
|
-
style: [styles$
|
|
5012
|
+
style: [styles$8.activeIndicator, {
|
|
4487
5013
|
backgroundColor: tintColor
|
|
4488
5014
|
}]
|
|
4489
5015
|
}));
|
|
@@ -4491,43 +5017,31 @@ class TabbarItem extends React__namespace.Component {
|
|
|
4491
5017
|
}
|
|
4492
5018
|
}
|
|
4493
5019
|
|
|
4494
|
-
const styles$
|
|
5020
|
+
const styles$7 = aphrodite.StyleSheet.create({
|
|
4495
5021
|
tabbar: {
|
|
4496
5022
|
display: "flex",
|
|
4497
5023
|
flexDirection: "row",
|
|
4498
|
-
background: Color__default["default"].offWhite,
|
|
4499
5024
|
paddingTop: 2,
|
|
4500
|
-
paddingBottom: 2
|
|
4501
|
-
borderTop: "1px solid ".concat(Color__default["default"].offBlack50),
|
|
4502
|
-
borderBottom: "1px solid ".concat(Color__default["default"].offBlack50)
|
|
5025
|
+
paddingBottom: 2
|
|
4503
5026
|
}
|
|
4504
5027
|
});
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
}
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
itemType: item,
|
|
4523
|
-
onClick: () => {
|
|
4524
|
-
this.setState({
|
|
4525
|
-
selectedItem: index
|
|
4526
|
-
});
|
|
4527
|
-
onSelect(item);
|
|
4528
|
-
}
|
|
4529
|
-
})));
|
|
4530
|
-
}
|
|
5028
|
+
function Tabbar(props) {
|
|
5029
|
+
const {
|
|
5030
|
+
items,
|
|
5031
|
+
selectedItem,
|
|
5032
|
+
onSelectItem,
|
|
5033
|
+
style
|
|
5034
|
+
} = props;
|
|
5035
|
+
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
5036
|
+
style: [styles$7.tabbar, style]
|
|
5037
|
+
}, items.map(item => /*#__PURE__*/React__namespace.createElement(TabbarItem, {
|
|
5038
|
+
key: "tabbar-item-".concat(item),
|
|
5039
|
+
itemState: item === selectedItem ? "active" : "inactive",
|
|
5040
|
+
itemType: item,
|
|
5041
|
+
onClick: () => {
|
|
5042
|
+
onSelectItem(item);
|
|
5043
|
+
}
|
|
5044
|
+
})));
|
|
4531
5045
|
}
|
|
4532
5046
|
|
|
4533
5047
|
/**
|
|
@@ -4576,7 +5090,7 @@ class Echo extends React__namespace.Component {
|
|
|
4576
5090
|
style: containerStyle
|
|
4577
5091
|
}, /*#__PURE__*/React__namespace.createElement(KeypadButton$2, {
|
|
4578
5092
|
icon: icon,
|
|
4579
|
-
type:
|
|
5093
|
+
type: "ECHO"
|
|
4580
5094
|
}));
|
|
4581
5095
|
}
|
|
4582
5096
|
}
|
|
@@ -4666,7 +5180,7 @@ class MultiSymbolPopover extends React__namespace.Component {
|
|
|
4666
5180
|
// TODO(charlie): We have to require this lazily because of a cyclic
|
|
4667
5181
|
// dependence in our components.
|
|
4668
5182
|
return /*#__PURE__*/React__namespace.createElement(View, {
|
|
4669
|
-
style: styles$
|
|
5183
|
+
style: styles$6.container
|
|
4670
5184
|
}, keys.map(key => {
|
|
4671
5185
|
return /*#__PURE__*/React__namespace.createElement(TouchableKeypadButton$1, {
|
|
4672
5186
|
keyConfig: key,
|
|
@@ -4675,7 +5189,7 @@ class MultiSymbolPopover extends React__namespace.Component {
|
|
|
4675
5189
|
}));
|
|
4676
5190
|
}
|
|
4677
5191
|
}
|
|
4678
|
-
const styles$
|
|
5192
|
+
const styles$6 = aphrodite.StyleSheet.create({
|
|
4679
5193
|
container: {
|
|
4680
5194
|
flexDirection: "column-reverse",
|
|
4681
5195
|
position: "relative",
|
|
@@ -4795,18 +5309,6 @@ const setCursor = cursor => {
|
|
|
4795
5309
|
|
|
4796
5310
|
// Gesture actions
|
|
4797
5311
|
|
|
4798
|
-
const onSwipeChange = dx => {
|
|
4799
|
-
return {
|
|
4800
|
-
type: "OnSwipeChange",
|
|
4801
|
-
dx
|
|
4802
|
-
};
|
|
4803
|
-
};
|
|
4804
|
-
const onSwipeEnd = dx => {
|
|
4805
|
-
return {
|
|
4806
|
-
type: "OnSwipeEnd",
|
|
4807
|
-
dx
|
|
4808
|
-
};
|
|
4809
|
-
};
|
|
4810
5312
|
const setActiveNodes = activeNodes => {
|
|
4811
5313
|
return {
|
|
4812
5314
|
type: "SetActiveNodes",
|
|
@@ -4973,31 +5475,33 @@ class TwoPageKeypad extends React__namespace.Component {
|
|
|
4973
5475
|
} = this.state;
|
|
4974
5476
|
if (paginationEnabled) {
|
|
4975
5477
|
return /*#__PURE__*/React__namespace.createElement(Keypad$2, {
|
|
4976
|
-
style: [column$2, styles$
|
|
5478
|
+
style: [column$2, styles$5.keypad]
|
|
4977
5479
|
}, /*#__PURE__*/React__namespace.createElement(Tabbar, {
|
|
4978
5480
|
items: ["Numbers", "Operators"],
|
|
4979
|
-
|
|
5481
|
+
selectedItem: selectedPage,
|
|
5482
|
+
onSelectItem: selectedItem => {
|
|
4980
5483
|
this.setState({
|
|
4981
5484
|
selectedPage: selectedItem
|
|
4982
5485
|
});
|
|
4983
|
-
}
|
|
5486
|
+
},
|
|
5487
|
+
style: styles$5.tabbar
|
|
4984
5488
|
}), /*#__PURE__*/React__namespace.createElement(View, {
|
|
4985
|
-
style: styles$
|
|
5489
|
+
style: styles$5.borderTop
|
|
4986
5490
|
}, selectedPage === "Numbers" && rightPage, selectedPage === "Operators" && leftPage));
|
|
4987
5491
|
} else {
|
|
4988
5492
|
return /*#__PURE__*/React__namespace.createElement(Keypad$2, {
|
|
4989
|
-
style: styles$
|
|
5493
|
+
style: styles$5.keypad
|
|
4990
5494
|
}, /*#__PURE__*/React__namespace.createElement(View, {
|
|
4991
5495
|
style: row$4
|
|
4992
5496
|
}, /*#__PURE__*/React__namespace.createElement(View, {
|
|
4993
5497
|
style: fullWidth$2
|
|
4994
5498
|
}, leftPage), /*#__PURE__*/React__namespace.createElement(View, {
|
|
4995
|
-
style: [styles$
|
|
5499
|
+
style: [styles$5.borderLeft, fullWidth$2]
|
|
4996
5500
|
}, rightPage)));
|
|
4997
5501
|
}
|
|
4998
5502
|
}
|
|
4999
5503
|
}
|
|
5000
|
-
const styles$
|
|
5504
|
+
const styles$5 = aphrodite.StyleSheet.create({
|
|
5001
5505
|
keypad: {
|
|
5002
5506
|
// Set the background to light grey, so that when the user drags the
|
|
5003
5507
|
// keypad pages past the edges, there's a grey backdrop.
|
|
@@ -5009,6 +5513,11 @@ const styles$4 = aphrodite.StyleSheet.create({
|
|
|
5009
5513
|
borderLeft: {
|
|
5010
5514
|
borderLeft: "".concat(innerBorderWidthPx, "px ").concat(innerBorderStyle, " ") + "".concat(innerBorderColor),
|
|
5011
5515
|
boxSizing: "content-box"
|
|
5516
|
+
},
|
|
5517
|
+
tabbar: {
|
|
5518
|
+
background: Color__default["default"].offWhite,
|
|
5519
|
+
borderTop: "1px solid ".concat(Color__default["default"].offBlack50),
|
|
5520
|
+
borderBottom: "1px solid ".concat(Color__default["default"].offBlack50)
|
|
5012
5521
|
}
|
|
5013
5522
|
});
|
|
5014
5523
|
const mapStateToProps$3 = state => {
|
|
@@ -5078,7 +5587,7 @@ class ExpressionKeypad extends React__namespace.Component {
|
|
|
5078
5587
|
} else {
|
|
5079
5588
|
dismissOrJumpOutKey = KeyConfigs.DISMISS;
|
|
5080
5589
|
}
|
|
5081
|
-
const rightPageStyle = [row$3, fullWidth$1, styles$
|
|
5590
|
+
const rightPageStyle = [row$3, fullWidth$1, styles$4.rightPage, roundTopRight && roundedTopRight$1];
|
|
5082
5591
|
const rightPage = /*#__PURE__*/React__namespace.createElement(View, {
|
|
5083
5592
|
style: rightPageStyle
|
|
5084
5593
|
}, /*#__PURE__*/React__namespace.createElement(View, {
|
|
@@ -5150,7 +5659,7 @@ class ExpressionKeypad extends React__namespace.Component {
|
|
|
5150
5659
|
keyConfig: dismissOrJumpOutKey,
|
|
5151
5660
|
borders: BorderStyles.LEFT
|
|
5152
5661
|
})));
|
|
5153
|
-
const leftPageStyle = [row$3, fullWidth$1, styles$
|
|
5662
|
+
const leftPageStyle = [row$3, fullWidth$1, styles$4.leftPage, roundTopLeft && roundedTopLeft$2];
|
|
5154
5663
|
const leftPage = /*#__PURE__*/React__namespace.createElement(View, {
|
|
5155
5664
|
style: leftPageStyle
|
|
5156
5665
|
}, /*#__PURE__*/React__namespace.createElement(View, {
|
|
@@ -5230,7 +5739,7 @@ class ExpressionKeypad extends React__namespace.Component {
|
|
|
5230
5739
|
});
|
|
5231
5740
|
}
|
|
5232
5741
|
}
|
|
5233
|
-
const styles$
|
|
5742
|
+
const styles$4 = aphrodite.StyleSheet.create({
|
|
5234
5743
|
// NOTE(charlie): These backgrounds are applied to as to fill in some
|
|
5235
5744
|
// unfortunate 'cracks' in the layout. However, not all keys in the first
|
|
5236
5745
|
// page use this background color (namely, the 'command' keys, backspace and
|
|
@@ -5406,7 +5915,7 @@ class NavigationPad extends React__namespace.Component {
|
|
|
5406
5915
|
roundTopLeft,
|
|
5407
5916
|
style
|
|
5408
5917
|
} = this.props;
|
|
5409
|
-
const containerStyle = [column, centered$1, styles$
|
|
5918
|
+
const containerStyle = [column, centered$1, styles$3.container, roundTopLeft && roundedTopLeft, ...(Array.isArray(style) ? style : [style])];
|
|
5410
5919
|
return /*#__PURE__*/React__namespace.createElement(View, {
|
|
5411
5920
|
style: containerStyle
|
|
5412
5921
|
}, /*#__PURE__*/React__namespace.createElement(View, {
|
|
@@ -5414,32 +5923,32 @@ class NavigationPad extends React__namespace.Component {
|
|
|
5414
5923
|
}, /*#__PURE__*/React__namespace.createElement(TouchableKeypadButton$1, {
|
|
5415
5924
|
keyConfig: KeyConfigs.UP,
|
|
5416
5925
|
borders: BorderStyles.NONE,
|
|
5417
|
-
style: [styles$
|
|
5926
|
+
style: [styles$3.navigationKey, styles$3.topArrow]
|
|
5418
5927
|
})), /*#__PURE__*/React__namespace.createElement(View, {
|
|
5419
5928
|
style: [row$1, centered$1, stretch]
|
|
5420
5929
|
}, /*#__PURE__*/React__namespace.createElement(TouchableKeypadButton$1, {
|
|
5421
5930
|
keyConfig: KeyConfigs.LEFT,
|
|
5422
5931
|
borders: BorderStyles.NONE,
|
|
5423
|
-
style: [styles$
|
|
5932
|
+
style: [styles$3.navigationKey, styles$3.leftArrow]
|
|
5424
5933
|
}), /*#__PURE__*/React__namespace.createElement(View, {
|
|
5425
|
-
style: styles$
|
|
5934
|
+
style: styles$3.horizontalSpacer
|
|
5426
5935
|
}), /*#__PURE__*/React__namespace.createElement(TouchableKeypadButton$1, {
|
|
5427
5936
|
keyConfig: KeyConfigs.RIGHT,
|
|
5428
5937
|
borders: BorderStyles.NONE,
|
|
5429
|
-
style: [styles$
|
|
5938
|
+
style: [styles$3.navigationKey, styles$3.rightArrow]
|
|
5430
5939
|
})), /*#__PURE__*/React__namespace.createElement(View, {
|
|
5431
5940
|
style: [row$1, centered$1]
|
|
5432
5941
|
}, /*#__PURE__*/React__namespace.createElement(TouchableKeypadButton$1, {
|
|
5433
5942
|
keyConfig: KeyConfigs.DOWN,
|
|
5434
5943
|
borders: BorderStyles.NONE,
|
|
5435
|
-
style: [styles$
|
|
5944
|
+
style: [styles$3.navigationKey, styles$3.bottomArrow]
|
|
5436
5945
|
})));
|
|
5437
5946
|
}
|
|
5438
5947
|
}
|
|
5439
5948
|
const buttonSizePx = 48;
|
|
5440
5949
|
const borderRadiusPx = 4;
|
|
5441
5950
|
const borderWidthPx$1 = 1;
|
|
5442
|
-
const styles$
|
|
5951
|
+
const styles$3 = aphrodite.StyleSheet.create({
|
|
5443
5952
|
container: {
|
|
5444
5953
|
backgroundColor: controlGrey,
|
|
5445
5954
|
width: navigationPadWidthPx
|
|
@@ -5612,8 +6121,8 @@ class KeypadContainer extends React__namespace.Component {
|
|
|
5612
6121
|
...inlineStyles.invisible
|
|
5613
6122
|
};
|
|
5614
6123
|
}
|
|
5615
|
-
const keypadContainerStyle = [row, centered, fullWidth, styles$
|
|
5616
|
-
const keypadStyle = [row, styles$
|
|
6124
|
+
const keypadContainerStyle = [row, centered, fullWidth, styles$2.keypadContainer, ...(Array.isArray(style) ? style : [style])];
|
|
6125
|
+
const keypadStyle = [row, styles$2.keypadBorder, layoutMode === LayoutMode.FULLSCREEN ? styles$2.fullscreen : styles$2.compact];
|
|
5617
6126
|
|
|
5618
6127
|
// TODO(charlie): When the keypad is shorter than the width of the
|
|
5619
6128
|
// screen, add a border on its left and right edges, and round out the
|
|
@@ -5632,15 +6141,15 @@ class KeypadContainer extends React__namespace.Component {
|
|
|
5632
6141
|
}
|
|
5633
6142
|
}, navigationPadEnabled && /*#__PURE__*/React__namespace.createElement(NavigationPad, {
|
|
5634
6143
|
roundTopLeft: layoutMode === LayoutMode.COMPACT,
|
|
5635
|
-
style: styles$
|
|
6144
|
+
style: styles$2.navigationPadContainer
|
|
5636
6145
|
}), /*#__PURE__*/React__namespace.createElement(View, {
|
|
5637
|
-
style: styles$
|
|
6146
|
+
style: styles$2.keypadLayout
|
|
5638
6147
|
}, this.renderKeypad())));
|
|
5639
6148
|
}
|
|
5640
6149
|
}
|
|
5641
6150
|
const keypadAnimationDurationMs = 300;
|
|
5642
6151
|
const borderWidthPx = 1;
|
|
5643
|
-
const styles$
|
|
6152
|
+
const styles$2 = aphrodite.StyleSheet.create({
|
|
5644
6153
|
keypadContainer: {
|
|
5645
6154
|
bottom: 0,
|
|
5646
6155
|
left: 0,
|
|
@@ -5910,7 +6419,8 @@ class GestureStateMachine {
|
|
|
5910
6419
|
// Only respect the finger that started a swipe. Any other lingering
|
|
5911
6420
|
// gestures are ignored.
|
|
5912
6421
|
if (this.swipeState.touchId === touchId) {
|
|
5913
|
-
|
|
6422
|
+
var _this$handlers$onSwip, _this$handlers;
|
|
6423
|
+
(_this$handlers$onSwip = (_this$handlers = this.handlers).onSwipeChange) === null || _this$handlers$onSwip === void 0 ? void 0 : _this$handlers$onSwip.call(_this$handlers, pageX - this.swipeState.startX);
|
|
5914
6424
|
}
|
|
5915
6425
|
} else if (this.touchState[touchId]) {
|
|
5916
6426
|
// It could be touch events started outside the keypad and
|
|
@@ -5923,6 +6433,7 @@ class GestureStateMachine {
|
|
|
5923
6433
|
const dx = pageX - startX;
|
|
5924
6434
|
const shouldBeginSwiping = swipeEnabled && !swipeLocked && Math.abs(dx) > this.options.swipeThresholdPx;
|
|
5925
6435
|
if (shouldBeginSwiping) {
|
|
6436
|
+
var _this$handlers$onSwip2, _this$handlers2;
|
|
5926
6437
|
this._onSwipeStart();
|
|
5927
6438
|
|
|
5928
6439
|
// Trigger the swipe.
|
|
@@ -5930,7 +6441,7 @@ class GestureStateMachine {
|
|
|
5930
6441
|
touchId,
|
|
5931
6442
|
startX
|
|
5932
6443
|
};
|
|
5933
|
-
this.handlers.onSwipeChange(pageX - this.swipeState.startX);
|
|
6444
|
+
(_this$handlers$onSwip2 = (_this$handlers2 = this.handlers).onSwipeChange) === null || _this$handlers$onSwip2 === void 0 ? void 0 : _this$handlers$onSwip2.call(_this$handlers2, pageX - this.swipeState.startX);
|
|
5934
6445
|
} else {
|
|
5935
6446
|
const id = getId();
|
|
5936
6447
|
if (id !== activeNodeId) {
|
|
@@ -5953,7 +6464,8 @@ class GestureStateMachine {
|
|
|
5953
6464
|
// Only respect the finger that started a swipe. Any other lingering
|
|
5954
6465
|
// gestures are ignored.
|
|
5955
6466
|
if (this.swipeState.touchId === touchId) {
|
|
5956
|
-
|
|
6467
|
+
var _this$handlers$onSwip3, _this$handlers3;
|
|
6468
|
+
(_this$handlers$onSwip3 = (_this$handlers3 = this.handlers).onSwipeEnd) === null || _this$handlers$onSwip3 === void 0 ? void 0 : _this$handlers$onSwip3.call(_this$handlers3, pageX - this.swipeState.startX);
|
|
5957
6469
|
this.swipeState = null;
|
|
5958
6470
|
}
|
|
5959
6471
|
} else if (this.touchState[touchId]) {
|
|
@@ -5987,7 +6499,8 @@ class GestureStateMachine {
|
|
|
5987
6499
|
// displacement.
|
|
5988
6500
|
if (this.swipeState) {
|
|
5989
6501
|
if (this.swipeState.touchId === touchId) {
|
|
5990
|
-
|
|
6502
|
+
var _this$handlers$onSwip4, _this$handlers4;
|
|
6503
|
+
(_this$handlers$onSwip4 = (_this$handlers4 = this.handlers).onSwipeEnd) === null || _this$handlers$onSwip4 === void 0 ? void 0 : _this$handlers$onSwip4.call(_this$handlers4, 0);
|
|
5991
6504
|
this.swipeState = null;
|
|
5992
6505
|
}
|
|
5993
6506
|
} else if (this.touchState[touchId]) {
|
|
@@ -6365,7 +6878,7 @@ class GestureManager {
|
|
|
6365
6878
|
* Handle a touch-start event that originated in a node registered with the
|
|
6366
6879
|
* gesture system.
|
|
6367
6880
|
*
|
|
6368
|
-
* @param {TouchEvent} evt - the raw touch event from the browser
|
|
6881
|
+
* @param {React.TouchEvent<HTMLDivElement>} evt - the raw touch event from the browser
|
|
6369
6882
|
* @param {string} id - the identifier of the DOM node in which the touch
|
|
6370
6883
|
* occurred
|
|
6371
6884
|
*/
|
|
@@ -6392,7 +6905,7 @@ class GestureManager {
|
|
|
6392
6905
|
* Handle a touch-move event that originated in a node registered with the
|
|
6393
6906
|
* gesture system.
|
|
6394
6907
|
*
|
|
6395
|
-
* @param {TouchEvent} evt - the raw touch event from the browser
|
|
6908
|
+
* @param {React.TouchEvent<HTMLDivElement>} evt - the raw touch event from the browser
|
|
6396
6909
|
*/
|
|
6397
6910
|
onTouchMove(evt) {
|
|
6398
6911
|
if (!this.trackEvents) {
|
|
@@ -6410,7 +6923,7 @@ class GestureManager {
|
|
|
6410
6923
|
* Handle a touch-end event that originated in a node registered with the
|
|
6411
6924
|
* gesture system.
|
|
6412
6925
|
*
|
|
6413
|
-
* @param {TouchEvent} evt - the raw touch event from the browser
|
|
6926
|
+
* @param {React.TouchEvent<HTMLDivElement>} evt - the raw touch event from the browser
|
|
6414
6927
|
*/
|
|
6415
6928
|
onTouchEnd(evt) {
|
|
6416
6929
|
if (!this.trackEvents) {
|
|
@@ -6426,7 +6939,7 @@ class GestureManager {
|
|
|
6426
6939
|
* Handle a touch-cancel event that originated in a node registered with the
|
|
6427
6940
|
* gesture system.
|
|
6428
6941
|
*
|
|
6429
|
-
* @param {TouchEvent} evt - the raw touch event from the browser
|
|
6942
|
+
* @param {React.TouchEvent<HTMLDivElement>} evt - the raw touch event from the browser
|
|
6430
6943
|
*/
|
|
6431
6944
|
onTouchCancel(evt) {
|
|
6432
6945
|
if (!this.trackEvents) {
|
|
@@ -6494,7 +7007,7 @@ const echoReducer = function () {
|
|
|
6494
7007
|
|
|
6495
7008
|
// Add in the echo animation if the user performs a math
|
|
6496
7009
|
// operation.
|
|
6497
|
-
if (keyConfig.type ===
|
|
7010
|
+
if (keyConfig.type === "VALUE" || keyConfig.type === "OPERATOR") {
|
|
6498
7011
|
return {
|
|
6499
7012
|
...state,
|
|
6500
7013
|
echoes: [...state.echoes, {
|
|
@@ -6536,7 +7049,7 @@ const inputReducer = function () {
|
|
|
6536
7049
|
};
|
|
6537
7050
|
case "PressKey":
|
|
6538
7051
|
const keyConfig = KeyConfigs[action.key];
|
|
6539
|
-
if (keyConfig.type !==
|
|
7052
|
+
if (keyConfig.type !== "KEYPAD_NAVIGATION") {
|
|
6540
7053
|
var _state$keyHandler;
|
|
6541
7054
|
// This is probably an anti-pattern but it works for the
|
|
6542
7055
|
// case where we don't actually control the state but we
|
|
@@ -6566,7 +7079,7 @@ const keypadForType = {
|
|
|
6566
7079
|
};
|
|
6567
7080
|
|
|
6568
7081
|
const initialKeypadState = {
|
|
6569
|
-
extraKeys: ["x", "y",
|
|
7082
|
+
extraKeys: ["x", "y", "THETA", "PI"],
|
|
6570
7083
|
keypadType: defaultKeypadType,
|
|
6571
7084
|
active: false
|
|
6572
7085
|
};
|
|
@@ -6600,7 +7113,7 @@ const keypadReducer = function () {
|
|
|
6600
7113
|
// right actions when they occur. Hence, we figure off a
|
|
6601
7114
|
// dismissal here rather than dispatching a dismiss action in
|
|
6602
7115
|
// the first place.
|
|
6603
|
-
if (keyConfig.id ===
|
|
7116
|
+
if (keyConfig.id === "DISMISS") {
|
|
6604
7117
|
return keypadReducer(state, {
|
|
6605
7118
|
type: "DismissKeypad"
|
|
6606
7119
|
});
|
|
@@ -6850,19 +7363,13 @@ const createStore = () => {
|
|
|
6850
7363
|
return new GestureManager({
|
|
6851
7364
|
swipeEnabled
|
|
6852
7365
|
}, {
|
|
6853
|
-
onSwipeChange: dx => {
|
|
6854
|
-
store.dispatch(onSwipeChange(dx));
|
|
6855
|
-
},
|
|
6856
|
-
onSwipeEnd: dx => {
|
|
6857
|
-
store.dispatch(onSwipeEnd(dx));
|
|
6858
|
-
},
|
|
6859
7366
|
onActiveNodesChanged: activeNodes => {
|
|
6860
7367
|
store.dispatch(setActiveNodes(activeNodes));
|
|
6861
7368
|
},
|
|
6862
7369
|
onClick: (key, layoutProps, inPopover) => {
|
|
6863
7370
|
store.dispatch(pressKey(key, layoutProps.initialBounds, inPopover));
|
|
6864
7371
|
}
|
|
6865
|
-
}, [], [
|
|
7372
|
+
}, [], ["BACKSPACE", "UP", "RIGHT", "DOWN", "LEFT"]);
|
|
6866
7373
|
};
|
|
6867
7374
|
const initialGestureState = {
|
|
6868
7375
|
popover: null,
|
|
@@ -6988,7 +7495,7 @@ class ProvidedKeypad extends React__namespace.Component {
|
|
|
6988
7495
|
}
|
|
6989
7496
|
}
|
|
6990
7497
|
|
|
6991
|
-
const styles = aphrodite.StyleSheet.create({
|
|
7498
|
+
const styles$1 = aphrodite.StyleSheet.create({
|
|
6992
7499
|
base: {
|
|
6993
7500
|
display: "flex",
|
|
6994
7501
|
justifyContent: "center",
|
|
@@ -7043,6 +7550,7 @@ class Button extends React__namespace.Component {
|
|
|
7043
7550
|
render() {
|
|
7044
7551
|
const {
|
|
7045
7552
|
onPress,
|
|
7553
|
+
ariaLabel,
|
|
7046
7554
|
children,
|
|
7047
7555
|
style,
|
|
7048
7556
|
tintColor
|
|
@@ -7051,7 +7559,8 @@ class Button extends React__namespace.Component {
|
|
|
7051
7559
|
style: style
|
|
7052
7560
|
}, /*#__PURE__*/React__namespace.createElement(Clickable__default["default"], {
|
|
7053
7561
|
onClick: onPress,
|
|
7054
|
-
style: styles.clickable
|
|
7562
|
+
style: styles$1.clickable,
|
|
7563
|
+
"aria-label": ariaLabel
|
|
7055
7564
|
}, _ref => {
|
|
7056
7565
|
let {
|
|
7057
7566
|
hovered,
|
|
@@ -7059,11 +7568,11 @@ class Button extends React__namespace.Component {
|
|
|
7059
7568
|
pressed
|
|
7060
7569
|
} = _ref;
|
|
7061
7570
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
7062
|
-
style: [styles.outerBoxBase, hovered && styles.outerBoxHover, pressed && styles.outerBoxPressed]
|
|
7571
|
+
style: [styles$1.outerBoxBase, hovered && styles$1.outerBoxHover, pressed && styles$1.outerBoxPressed]
|
|
7063
7572
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
7064
|
-
style: [styles.base, tintColor != null ? {
|
|
7573
|
+
style: [styles$1.base, tintColor != null ? {
|
|
7065
7574
|
background: tintColor
|
|
7066
|
-
} : undefined, hovered && styles.hovered, focused && styles.focused, pressed && styles.pressed]
|
|
7575
|
+
} : undefined, hovered && styles$1.hovered, focused && styles$1.focused, pressed && styles$1.pressed]
|
|
7067
7576
|
}, children));
|
|
7068
7577
|
}));
|
|
7069
7578
|
}
|
|
@@ -7081,9 +7590,6 @@ asset.
|
|
|
7081
7590
|
In the future it would be great if these were included from files so that
|
|
7082
7591
|
no copying and pasting is necessary.
|
|
7083
7592
|
*/
|
|
7084
|
-
|
|
7085
|
-
// TODO: This should be an enumeration of all of the possible legal values
|
|
7086
|
-
|
|
7087
7593
|
function ButtonAsset(_ref) {
|
|
7088
7594
|
let {
|
|
7089
7595
|
id
|
|
@@ -7229,84 +7735,94 @@ function ButtonAsset(_ref) {
|
|
|
7229
7735
|
}));
|
|
7230
7736
|
case "MINUS":
|
|
7231
7737
|
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
7232
|
-
|
|
7233
|
-
|
|
7234
|
-
|
|
7235
|
-
fill: "
|
|
7236
|
-
|
|
7738
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
7739
|
+
width: "20",
|
|
7740
|
+
height: "20",
|
|
7741
|
+
fill: "currentColor",
|
|
7742
|
+
viewBox: "0 0 256 256"
|
|
7237
7743
|
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
7238
|
-
d: "
|
|
7239
|
-
stroke: "#21242C",
|
|
7240
|
-
strokeWidth: "2",
|
|
7241
|
-
strokeLinecap: "round",
|
|
7242
|
-
strokeLinejoin: "round"
|
|
7744
|
+
d: "M224,128a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128Z"
|
|
7243
7745
|
}));
|
|
7244
7746
|
case "PLUS":
|
|
7747
|
+
return (
|
|
7748
|
+
/*#__PURE__*/
|
|
7749
|
+
// Phosphor Icons - Plus Bold
|
|
7750
|
+
React__namespace.createElement("svg", {
|
|
7751
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
7752
|
+
width: "20",
|
|
7753
|
+
height: "20",
|
|
7754
|
+
fill: "currentColor",
|
|
7755
|
+
viewBox: "0 0 256 256"
|
|
7756
|
+
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
7757
|
+
d: "M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z"
|
|
7758
|
+
}), " ")
|
|
7759
|
+
);
|
|
7760
|
+
case "TIMES":
|
|
7761
|
+
return (
|
|
7762
|
+
/*#__PURE__*/
|
|
7763
|
+
// Phosphor Icons - X Bold
|
|
7764
|
+
React__namespace.createElement("svg", {
|
|
7765
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
7766
|
+
width: "20",
|
|
7767
|
+
height: "20",
|
|
7768
|
+
fill: "#000000",
|
|
7769
|
+
viewBox: "0 0 256 256"
|
|
7770
|
+
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
7771
|
+
d: "M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"
|
|
7772
|
+
}))
|
|
7773
|
+
);
|
|
7774
|
+
case "BACKSPACE":
|
|
7245
7775
|
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
7246
|
-
|
|
7247
|
-
|
|
7248
|
-
|
|
7249
|
-
fill: "
|
|
7250
|
-
|
|
7776
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
7777
|
+
width: "20",
|
|
7778
|
+
height: "20",
|
|
7779
|
+
fill: "currentColor",
|
|
7780
|
+
viewBox: "0 0 256 256"
|
|
7251
7781
|
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
7252
|
-
d: "
|
|
7253
|
-
stroke: "#21242C",
|
|
7254
|
-
strokeWidth: "2",
|
|
7255
|
-
strokeLinecap: "round",
|
|
7256
|
-
strokeLinejoin: "round"
|
|
7257
|
-
}), /*#__PURE__*/React__namespace.createElement("path", {
|
|
7258
|
-
d: "M20 13V27",
|
|
7259
|
-
stroke: "#21242C",
|
|
7260
|
-
strokeWidth: "2",
|
|
7261
|
-
strokeLinecap: "round",
|
|
7262
|
-
strokeLinejoin: "round"
|
|
7782
|
+
d: "M216,40H68.53a16.08,16.08,0,0,0-13.72,7.77L9.14,123.88a8,8,0,0,0,0,8.24l45.67,76.11A16.08,16.08,0,0,0,68.53,216H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM61.67,204.12,68.53,200h0ZM216,200H68.53l-43.2-72,43.2-72H216ZM106.34,146.34,124.69,128l-18.35-18.34a8,8,0,0,1,11.32-11.32L136,116.69l18.34-18.35a8,8,0,0,1,11.32,11.32L147.31,128l18.35,18.34a8,8,0,0,1-11.32,11.32L136,139.31l-18.34,18.35a8,8,0,0,1-11.32-11.32Z"
|
|
7263
7783
|
}));
|
|
7264
|
-
case "
|
|
7784
|
+
case "DISMISS":
|
|
7265
7785
|
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
7266
|
-
|
|
7267
|
-
|
|
7268
|
-
|
|
7269
|
-
fill: "
|
|
7270
|
-
|
|
7786
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
7787
|
+
width: "20",
|
|
7788
|
+
height: "20",
|
|
7789
|
+
fill: "currentColor",
|
|
7790
|
+
viewBox: "0 0 256 256"
|
|
7271
7791
|
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
7272
|
-
|
|
7273
|
-
|
|
7274
|
-
|
|
7275
|
-
strokeLinecap: "round",
|
|
7276
|
-
strokeLinejoin: "round"
|
|
7277
|
-
}), /*#__PURE__*/React__namespace.createElement("path", {
|
|
7278
|
-
d: "M24.9498 15.0507L15.0503 24.9502",
|
|
7279
|
-
stroke: "#21242C",
|
|
7280
|
-
strokeWidth: "2",
|
|
7281
|
-
strokeLinecap: "round",
|
|
7282
|
-
strokeLinejoin: "round"
|
|
7792
|
+
// flip to point down
|
|
7793
|
+
transform: "scale(1,-1) translate(0, -260)",
|
|
7794
|
+
d: "M205.66,125.66a8,8,0,0,1-11.32,0L128,59.31,61.66,125.66a8,8,0,0,1-11.32-11.32l72-72a8,8,0,0,1,11.32,0l72,72A8,8,0,0,1,205.66,125.66Z"
|
|
7283
7795
|
}));
|
|
7284
|
-
case "
|
|
7796
|
+
case "FRAC":
|
|
7285
7797
|
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
7286
|
-
width: "
|
|
7287
|
-
height: "
|
|
7288
|
-
viewBox: "0 0
|
|
7798
|
+
width: "48",
|
|
7799
|
+
height: "48",
|
|
7800
|
+
viewBox: "0 0 48 48"
|
|
7801
|
+
}, /*#__PURE__*/React__namespace.createElement("g", {
|
|
7289
7802
|
fill: "none",
|
|
7290
|
-
|
|
7803
|
+
fillRule: "evenodd"
|
|
7291
7804
|
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
7292
|
-
fillRule: "evenodd",
|
|
7293
|
-
clipRule: "evenodd",
|
|
7294
|
-
d: "M10 20L16 14H28.1716V26L16 26L10 20ZM8.58579 18.5858L14.5858 12.5858C14.9609 12.2107 15.4696 12 16 12H28.1716C29.2761 12 30.1716 12.8954 30.1716 14V26C30.1716 27.1046 29.2761 28 28.1716 28H16C15.4696 28 14.9609 27.7893 14.5858 27.4142L8.58579 21.4142C7.80474 20.6332 7.80474 19.3668 8.58579 18.5858ZM22.4645 17.2929L21.1716 18.5858L19.8787 17.2929C19.4882 16.9024 18.855 16.9024 18.4645 17.2929C18.074 17.6834 18.074 18.3166 18.4645 18.7071L19.7574 20L18.4645 21.2929C18.074 21.6834 18.074 22.3166 18.4645 22.7071C18.855 23.0976 19.4882 23.0976 19.8787 22.7071L21.1716 21.4142L22.4645 22.7071C22.855 23.0976 23.4882 23.0976 23.8787 22.7071C24.2693 22.3166 24.2693 21.6834 23.8787 21.2929L22.5858 20L23.8787 18.7071C24.2693 18.3166 24.2693 17.6834 23.8787 17.2929C23.4882 16.9024 22.855 16.9024 22.4645 17.2929Z",
|
|
7295
|
-
fill: "#21242C"
|
|
7296
|
-
}));
|
|
7297
|
-
case "DISMISS":
|
|
7298
|
-
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
7299
|
-
width: "40",
|
|
7300
|
-
height: "40",
|
|
7301
|
-
viewBox: "0 0 40 40",
|
|
7302
7805
|
fill: "none",
|
|
7303
|
-
|
|
7806
|
+
d: "M0 0h48v48H0z"
|
|
7807
|
+
}), /*#__PURE__*/React__namespace.createElement("g", {
|
|
7808
|
+
transform: "translate(12 12)"
|
|
7304
7809
|
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
7305
|
-
|
|
7306
|
-
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
|
|
7810
|
+
fill: "none",
|
|
7811
|
+
d: "M0 0h24v24H0z"
|
|
7812
|
+
}), /*#__PURE__*/React__namespace.createElement("path", {
|
|
7813
|
+
d: "M8 16.997c0-.55.453-.997.997-.997h6.006c.55 0 .997.453.997.997v6.006c0 .55-.453.997-.997.997H8.997c-.55 0-.997-.453-.997-.997v-6.006zM10 18h4v4h-4v-4z",
|
|
7814
|
+
fill: "currentColor"
|
|
7815
|
+
}), /*#__PURE__*/React__namespace.createElement("rect", {
|
|
7816
|
+
fill: "currentColor",
|
|
7817
|
+
x: "2",
|
|
7818
|
+
y: "11",
|
|
7819
|
+
width: "20",
|
|
7820
|
+
height: "2",
|
|
7821
|
+
rx: "1"
|
|
7822
|
+
}), /*#__PURE__*/React__namespace.createElement("path", {
|
|
7823
|
+
d: "M8 .997C8 .447 8.453 0 8.997 0h6.006c.55 0 .997.453.997.997v6.006c0 .55-.453.997-.997.997H8.997C8.447 8 8 7.547 8 7.003V.997zM10 2h4v4h-4V2z",
|
|
7824
|
+
fill: "currentColor"
|
|
7825
|
+
}))));
|
|
7310
7826
|
case "FRAC_INCLUSIVE":
|
|
7311
7827
|
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
7312
7828
|
width: "40",
|
|
@@ -7333,26 +7849,23 @@ function ButtonAsset(_ref) {
|
|
|
7333
7849
|
d: "M12.9571 13.2929C13.3476 13.6834 13.3476 14.3166 12.9571 14.7071C11.6871 15.9771 11 17.9485 11 20C11 22.0515 11.6871 24.0229 12.9571 25.2929C13.3476 25.6834 13.3476 26.3166 12.9571 26.7071C12.5666 27.0976 11.9334 27.0976 11.5429 26.7071C9.81292 24.9771 9 22.4485 9 20C9 17.5515 9.81292 15.0229 11.5429 13.2929C11.9334 12.9024 12.5666 12.9024 12.9571 13.2929ZM14 20C14 19.4477 14.4477 19 15 19H25C25.5523 19 26 19.4477 26 20C26 20.5523 25.5523 21 25 21H15C14.4477 21 14 20.5523 14 20ZM28.4571 13.2929C28.0666 12.9024 27.4334 12.9024 27.0429 13.2929C26.6524 13.6834 26.6524 14.3166 27.0429 14.7071C28.3129 15.9771 29 17.9485 29 20C29 22.0515 28.3129 24.0229 27.0429 25.2929C26.6524 25.6834 26.6524 26.3166 27.0429 26.7071C27.4334 27.0976 28.0666 27.0976 28.4571 26.7071C30.1871 24.9771 31 22.4485 31 20C31 17.5515 30.1871 15.0229 28.4571 13.2929Z",
|
|
7334
7850
|
fill: "#21242C"
|
|
7335
7851
|
}));
|
|
7852
|
+
// TODO(ned): Per the notes in `KeyConfigs`, shouldn't this be a comma
|
|
7853
|
+
// that we replace with the period icon for i18n? Duplicating for now.
|
|
7336
7854
|
case "DECIMAL":
|
|
7855
|
+
case "PERIOD":
|
|
7337
7856
|
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
7338
|
-
|
|
7339
|
-
|
|
7340
|
-
|
|
7341
|
-
fill: "
|
|
7342
|
-
|
|
7343
|
-
}, /*#__PURE__*/React__namespace.createElement("g", {
|
|
7344
|
-
clipPath: "url(#clip0)"
|
|
7345
|
-
}, /*#__PURE__*/React__namespace.createElement("circle", {
|
|
7346
|
-
cx: "20",
|
|
7347
|
-
cy: "20",
|
|
7348
|
-
r: "1.5",
|
|
7349
|
-
fill: "#21242C"
|
|
7350
|
-
})), /*#__PURE__*/React__namespace.createElement("defs", null, /*#__PURE__*/React__namespace.createElement("clipPath", {
|
|
7351
|
-
id: "clip0"
|
|
7857
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
7858
|
+
width: "20",
|
|
7859
|
+
height: "20",
|
|
7860
|
+
fill: "currentColor",
|
|
7861
|
+
viewBox: "0 0 256 256"
|
|
7352
7862
|
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
7353
|
-
d: "
|
|
7354
|
-
|
|
7355
|
-
|
|
7863
|
+
d: "M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Z"
|
|
7864
|
+
// moves decimal down to baseline of number icons,
|
|
7865
|
+
// otherwise indistinguishable from cdot
|
|
7866
|
+
,
|
|
7867
|
+
transform: "translate(0 80)"
|
|
7868
|
+
}));
|
|
7356
7869
|
case "RADICAL":
|
|
7357
7870
|
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
7358
7871
|
width: "40",
|
|
@@ -7367,6 +7880,38 @@ function ButtonAsset(_ref) {
|
|
|
7367
7880
|
fill: "#21242C"
|
|
7368
7881
|
}));
|
|
7369
7882
|
case "SQRT":
|
|
7883
|
+
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
7884
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
7885
|
+
width: "20",
|
|
7886
|
+
height: "20",
|
|
7887
|
+
fill: "currentColor",
|
|
7888
|
+
viewBox: "0 0 256 256"
|
|
7889
|
+
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
7890
|
+
d: "M240,72V96a8,8,0,0,1-16,0V80H125.55L79.49,202.81a8,8,0,0,1-15,0l-48-128a8,8,0,1,1,15-5.62L72,177.22l40.51-108A8,8,0,0,1,120,64H232A8,8,0,0,1,240,72Z"
|
|
7891
|
+
}));
|
|
7892
|
+
case "CUBE_ROOT":
|
|
7893
|
+
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
7894
|
+
width: "48",
|
|
7895
|
+
height: "48",
|
|
7896
|
+
viewBox: "0 0 48 48"
|
|
7897
|
+
}, /*#__PURE__*/React__namespace.createElement("g", {
|
|
7898
|
+
fill: "none",
|
|
7899
|
+
fillRule: "evenodd",
|
|
7900
|
+
transform: "translate(0, -4)"
|
|
7901
|
+
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
7902
|
+
fill: "none",
|
|
7903
|
+
d: "M0 0h48v48H0z"
|
|
7904
|
+
}), /*#__PURE__*/React__namespace.createElement("path", {
|
|
7905
|
+
d: "M17.91 23.12c1.66 0 2.76-.81 2.76-1.98 0-.96-.86-1.51-1.57-1.58.79-.13 1.46-.72 1.46-1.5 0-1.1-.95-1.83-2.65-1.83-1.23 0-2.11.45-2.67 1.08l.83 1.08c.47-.42 1.05-.64 1.66-.64.64 0 1.12.19 1.12.61 0 .35-.39.52-1.08.52-.25 0-.77 0-.9-.01v1.53c.1-.01.61-.01.9-.01.91 0 1.19.18 1.19.56 0 .37-.38.65-1.12.65-.58 0-1.34-.23-1.82-.7l-.87 1.17c.52.6 1.48 1.05 2.76 1.05z",
|
|
7906
|
+
fill: "currentColor"
|
|
7907
|
+
}), /*#__PURE__*/React__namespace.createElement("path", {
|
|
7908
|
+
stroke: "currentColor",
|
|
7909
|
+
strokeWidth: "2",
|
|
7910
|
+
strokeLinecap: "round",
|
|
7911
|
+
strokeLinejoin: "round",
|
|
7912
|
+
d: "M14 29l4 6 9-14h7"
|
|
7913
|
+
})));
|
|
7914
|
+
case "EXP":
|
|
7370
7915
|
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
7371
7916
|
width: "40",
|
|
7372
7917
|
height: "40",
|
|
@@ -7374,11 +7919,10 @@ function ButtonAsset(_ref) {
|
|
|
7374
7919
|
fill: "none",
|
|
7375
7920
|
xmlns: "http://www.w3.org/2000/svg"
|
|
7376
7921
|
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
7377
|
-
|
|
7378
|
-
|
|
7379
|
-
|
|
7380
|
-
|
|
7381
|
-
strokeLinejoin: "round"
|
|
7922
|
+
fillRule: "evenodd",
|
|
7923
|
+
clipRule: "evenodd",
|
|
7924
|
+
fill: "#21242C",
|
|
7925
|
+
d: "M28 8C28 7.44772 28.4477 7 29 7H35C35.5523 7 36 7.44772 36 8V14C36 14.5523 35.5523 15 35 15H29C28.4477 15 28 14.5523 28 14V8ZM30 9H34V13H30V9ZM14 13C14 12.4477 14.4477 12 15 12H25C25.5523 12 26 12.4477 26 13V27C26 27.5523 25.5523 28 25 28H15C14.4477 28 14 27.5523 14 27V13ZM16 14H24V26H16V14Z"
|
|
7382
7926
|
}));
|
|
7383
7927
|
case "EXP_2":
|
|
7384
7928
|
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
@@ -7393,25 +7937,20 @@ function ButtonAsset(_ref) {
|
|
|
7393
7937
|
d: "M33.5791 13.7461C33.4874 13.6545 33.3591 13.6086 33.1941 13.6086H31.4011C31.2397 13.6086 31.0674 13.6251 30.8841 13.6581C30.7007 13.6875 30.5156 13.7296 30.3286 13.7846L32.0226 12.0521C32.2352 11.8358 32.4369 11.6213 32.6276 11.4086C32.8182 11.196 32.9851 10.9778 33.1281 10.7541C33.2747 10.5268 33.3902 10.2885 33.4746 10.0391C33.5589 9.78981 33.6011 9.51847 33.6011 9.22514C33.6011 8.88414 33.5406 8.57247 33.4196 8.29014C33.2986 8.00781 33.1281 7.76764 32.9081 7.56964C32.6881 7.36797 32.4222 7.21214 32.1106 7.10214C31.8026 6.98847 31.4597 6.93164 31.0821 6.93164C30.7227 6.93164 30.3872 6.98114 30.0756 7.08014C29.7639 7.17547 29.4871 7.32031 29.2451 7.51464C29.0031 7.70897 28.8014 7.95281 28.6401 8.24614C28.4787 8.53947 28.3687 8.88047 28.3101 9.26914L29.1131 9.41214C29.3184 9.44514 29.4761 9.43231 29.5861 9.37364C29.6997 9.31131 29.7896 9.18847 29.8556 9.00514C29.8886 8.88781 29.9399 8.77964 30.0096 8.68064C30.0792 8.58164 30.1617 8.49547 30.2571 8.42214C30.3561 8.34881 30.4661 8.29197 30.5871 8.25164C30.7117 8.20764 30.8474 8.18564 30.9941 8.18564C31.3277 8.18564 31.5862 8.27914 31.7696 8.46614C31.9529 8.64947 32.0446 8.91897 32.0446 9.27464C32.0446 9.47631 32.0189 9.66881 31.9676 9.85214C31.9162 10.0355 31.8392 10.217 31.7366 10.3966C31.6339 10.5726 31.5056 10.7541 31.3516 10.9411C31.1976 11.1245 31.0197 11.317 30.8181 11.5186L28.4531 13.8891C28.3577 13.9808 28.2899 14.0835 28.2496 14.1971C28.2092 14.3071 28.1891 14.4098 28.1891 14.5051V15.0001H33.7221V14.1091C33.7221 13.9588 33.6744 13.8378 33.5791 13.7461ZM14 13.0001C14 12.4479 14.4477 12.0001 15 12.0001H25C25.5523 12.0001 26 12.4479 26 13.0001V27.0001C26 27.5524 25.5523 28.0001 25 28.0001H15C14.4477 28.0001 14 27.5524 14 27.0001V13.0001ZM16 14.0001H24V26.0001H16V14.0001Z",
|
|
7394
7938
|
fill: "#21242C"
|
|
7395
7939
|
}));
|
|
7396
|
-
case "
|
|
7940
|
+
case "EXP_3":
|
|
7397
7941
|
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
7398
|
-
width: "
|
|
7399
|
-
height: "
|
|
7942
|
+
width: "42",
|
|
7943
|
+
height: "42",
|
|
7400
7944
|
viewBox: "0 0 40 40",
|
|
7401
7945
|
fill: "none",
|
|
7402
7946
|
xmlns: "http://www.w3.org/2000/svg"
|
|
7403
7947
|
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
7948
|
+
transform: "translate(0, -8)",
|
|
7404
7949
|
fillRule: "evenodd",
|
|
7405
7950
|
clipRule: "evenodd",
|
|
7406
|
-
|
|
7407
|
-
|
|
7951
|
+
fill: "#21242C",
|
|
7952
|
+
d: "M14 21c0-.552.456-1 1.002-1h9.996A1 1 0 0 1 26 21v14c0 .552-.456 1-1.002 1h-9.996A1 1 0 0 1 14 35V21zm2 1h8v12h-8V22zM30.92 23.12c1.66 0 2.76-.81 2.76-1.98 0-.96-.86-1.51-1.57-1.58.79-.13 1.46-.72 1.46-1.5 0-1.1-.95-1.83-2.65-1.83-1.23 0-2.11.45-2.67 1.08l.83 1.08c.47-.42 1.05-.64 1.66-.64.64 0 1.12.19 1.12.61 0 .35-.39.52-1.08.52-.25 0-.77 0-.9-.01v1.53c.1-.01.61-.01.9-.01.91 0 1.19.18 1.19.56 0 .37-.38.65-1.12.65-.58 0-1.34-.23-1.82-.7l-.87 1.17c.52.6 1.48 1.05 2.76 1.05z"
|
|
7408
7953
|
}));
|
|
7409
|
-
case "PI":
|
|
7410
|
-
//TODO(NickR): use correct font, size, and color for this. It's not an SVG asset
|
|
7411
|
-
return /*#__PURE__*/React__namespace.createElement("span", null, "pi");
|
|
7412
|
-
case "X":
|
|
7413
|
-
//TODO(NickR): use correct font, size, and color for this. It's not an SVG asset
|
|
7414
|
-
return /*#__PURE__*/React__namespace.createElement("span", null, "x");
|
|
7415
7954
|
case "TAN":
|
|
7416
7955
|
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
7417
7956
|
width: "40",
|
|
@@ -7445,7 +7984,334 @@ function ButtonAsset(_ref) {
|
|
|
7445
7984
|
d: "M16.4215 19.392C16.3682 19.4773 16.3122 19.5387 16.2535 19.576C16.1948 19.608 16.1202 19.624 16.0295 19.624C15.9335 19.624 15.8295 19.5973 15.7175 19.544C15.6108 19.4907 15.4855 19.432 15.3415 19.368C15.1975 19.2987 15.0322 19.2373 14.8455 19.184C14.6642 19.1307 14.4482 19.104 14.1975 19.104C13.8082 19.104 13.5015 19.1867 13.2775 19.352C13.0588 19.5173 12.9495 19.7333 12.9495 20C12.9495 20.176 13.0055 20.3253 13.1175 20.448C13.2348 20.5653 13.3868 20.6693 13.5735 20.76C13.7655 20.8507 13.9815 20.9333 14.2215 21.008C14.4615 21.0773 14.7042 21.1547 14.9495 21.24C15.2002 21.3253 15.4455 21.424 15.6855 21.536C15.9255 21.6427 16.1388 21.7813 16.3255 21.952C16.5175 22.1173 16.6695 22.3173 16.7815 22.552C16.8988 22.7867 16.9575 23.0693 16.9575 23.4C16.9575 23.7947 16.8855 24.16 16.7415 24.496C16.6028 24.8267 16.3948 25.1147 16.1175 25.36C15.8402 25.6 15.4962 25.7893 15.0855 25.928C14.6802 26.0613 14.2108 26.128 13.6775 26.128C13.3948 26.128 13.1175 26.1013 12.8455 26.048C12.5788 26 12.3202 25.9307 12.0695 25.84C11.8242 25.7493 11.5948 25.6427 11.3815 25.52C11.1735 25.3973 10.9895 25.264 10.8295 25.12L11.2855 24.368C11.3442 24.2773 11.4135 24.208 11.4935 24.16C11.5735 24.112 11.6748 24.088 11.7975 24.088C11.9202 24.088 12.0348 24.1227 12.1415 24.192C12.2535 24.2613 12.3815 24.336 12.5255 24.416C12.6695 24.496 12.8375 24.5707 13.0295 24.64C13.2268 24.7093 13.4748 24.744 13.7735 24.744C14.0082 24.744 14.2082 24.7173 14.3735 24.664C14.5442 24.6053 14.6828 24.5307 14.7895 24.44C14.9015 24.3493 14.9815 24.2453 15.0295 24.128C15.0828 24.0053 15.1095 23.88 15.1095 23.752C15.1095 23.56 15.0508 23.4027 14.9335 23.28C14.8215 23.1573 14.6695 23.0507 14.4775 22.96C14.2908 22.8693 14.0748 22.7893 13.8295 22.72C13.5895 22.6453 13.3415 22.5653 13.0855 22.48C12.8348 22.3947 12.5868 22.296 12.3415 22.184C12.1015 22.0667 11.8855 21.92 11.6935 21.744C11.5068 21.568 11.3548 21.352 11.2375 21.096C11.1255 20.84 11.0695 20.5307 11.0695 20.168C11.0695 19.832 11.1362 19.512 11.2695 19.208C11.4028 18.904 11.5975 18.64 11.8535 18.416C12.1148 18.1867 12.4375 18.0053 12.8215 17.872C13.2108 17.7333 13.6588 17.664 14.1655 17.664C14.7308 17.664 15.2455 17.7573 15.7095 17.944C16.1735 18.1307 16.5602 18.376 16.8695 18.68L16.4215 19.392ZM20.4928 17.792V26H18.5088V17.792H20.4928ZM20.7648 15.4C20.7648 15.5707 20.7301 15.7307 20.6608 15.88C20.5914 16.0293 20.4981 16.16 20.3808 16.272C20.2688 16.384 20.1354 16.4747 19.9808 16.544C19.8261 16.608 19.6608 16.64 19.4848 16.64C19.3141 16.64 19.1514 16.608 18.9968 16.544C18.8474 16.4747 18.7168 16.384 18.6048 16.272C18.4928 16.16 18.4021 16.0293 18.3328 15.88C18.2688 15.7307 18.2368 15.5707 18.2368 15.4C18.2368 15.224 18.2688 15.0587 18.3328 14.904C18.4021 14.7493 18.4928 14.616 18.6048 14.504C18.7168 14.392 18.8474 14.304 18.9968 14.24C19.1514 14.1707 19.3141 14.136 19.4848 14.136C19.6608 14.136 19.8261 14.1707 19.9808 14.24C20.1354 14.304 20.2688 14.392 20.3808 14.504C20.4981 14.616 20.5914 14.7493 20.6608 14.904C20.7301 15.0587 20.7648 15.224 20.7648 15.4ZM24.3553 18.8C24.5206 18.6347 24.6939 18.4827 24.8753 18.344C25.0619 18.2 25.2566 18.08 25.4593 17.984C25.6673 17.8827 25.8886 17.8053 26.1233 17.752C26.3579 17.6933 26.6139 17.664 26.8913 17.664C27.3393 17.664 27.7366 17.7413 28.0833 17.896C28.4299 18.0453 28.7179 18.2587 28.9473 18.536C29.1819 18.808 29.3579 19.136 29.4753 19.52C29.5979 19.8987 29.6593 20.3173 29.6593 20.776V26H27.6833V20.776C27.6833 20.2747 27.5686 19.888 27.3393 19.616C27.1099 19.3387 26.7606 19.2 26.2913 19.2C25.9499 19.2 25.6299 19.2773 25.3313 19.432C25.0326 19.5867 24.7499 19.7973 24.4833 20.064V26H22.5073V17.792H23.7153C23.9713 17.792 24.1393 17.912 24.2193 18.152L24.3553 18.8Z",
|
|
7446
7985
|
fill: "#21242C"
|
|
7447
7986
|
}));
|
|
7448
|
-
|
|
7987
|
+
case "DIVIDE":
|
|
7988
|
+
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
7989
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
7990
|
+
width: "20",
|
|
7991
|
+
height: "20",
|
|
7992
|
+
fill: "currentColor",
|
|
7993
|
+
viewBox: "0 0 256 256"
|
|
7994
|
+
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
7995
|
+
d: "M224,128a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM128,80a16,16,0,1,0-16-16A16,16,0,0,0,128,80Zm0,96a16,16,0,1,0,16,16A16,16,0,0,0,128,176Z"
|
|
7996
|
+
}));
|
|
7997
|
+
case "EQUAL":
|
|
7998
|
+
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
7999
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8000
|
+
width: "20",
|
|
8001
|
+
height: "20",
|
|
8002
|
+
fill: "currentColor",
|
|
8003
|
+
viewBox: "0 0 256 256"
|
|
8004
|
+
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
8005
|
+
d: "M224,160a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,160ZM40,104H216a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16Z"
|
|
8006
|
+
}));
|
|
8007
|
+
case "GT":
|
|
8008
|
+
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
8009
|
+
width: "44",
|
|
8010
|
+
height: "44",
|
|
8011
|
+
viewBox: "0 0 48 48"
|
|
8012
|
+
}, /*#__PURE__*/React__namespace.createElement("g", {
|
|
8013
|
+
fill: "none",
|
|
8014
|
+
fillRule: "evenodd"
|
|
8015
|
+
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
8016
|
+
fill: "none",
|
|
8017
|
+
d: "M0 0h48v48H0z"
|
|
8018
|
+
}), /*#__PURE__*/React__namespace.createElement("path", {
|
|
8019
|
+
fill: "none",
|
|
8020
|
+
d: "M12 12h24v24H12z"
|
|
8021
|
+
}), /*#__PURE__*/React__namespace.createElement("path", {
|
|
8022
|
+
stroke: "currentColor",
|
|
8023
|
+
strokeWidth: "2",
|
|
8024
|
+
strokeLinecap: "round",
|
|
8025
|
+
strokeLinejoin: "round",
|
|
8026
|
+
d: "M16 30l16-6-16-6"
|
|
8027
|
+
})));
|
|
8028
|
+
case "LT":
|
|
8029
|
+
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
8030
|
+
width: "44",
|
|
8031
|
+
height: "44",
|
|
8032
|
+
viewBox: "0 0 48 48"
|
|
8033
|
+
}, /*#__PURE__*/React__namespace.createElement("g", {
|
|
8034
|
+
fill: "none",
|
|
8035
|
+
fillRule: "evenodd"
|
|
8036
|
+
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
8037
|
+
fill: "none",
|
|
8038
|
+
d: "M0 0h48v48H0z"
|
|
8039
|
+
}), /*#__PURE__*/React__namespace.createElement("path", {
|
|
8040
|
+
fill: "none",
|
|
8041
|
+
d: "M12 12h24v24H12z"
|
|
8042
|
+
}), /*#__PURE__*/React__namespace.createElement("path", {
|
|
8043
|
+
stroke: "currentColor",
|
|
8044
|
+
strokeWidth: "2",
|
|
8045
|
+
strokeLinecap: "round",
|
|
8046
|
+
strokeLinejoin: "round",
|
|
8047
|
+
d: "M32 30l-16-6 16-6"
|
|
8048
|
+
})));
|
|
8049
|
+
case "GEQ":
|
|
8050
|
+
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
8051
|
+
width: "44",
|
|
8052
|
+
height: "44",
|
|
8053
|
+
viewBox: "0 0 48 48"
|
|
8054
|
+
}, /*#__PURE__*/React__namespace.createElement("g", {
|
|
8055
|
+
fill: "none",
|
|
8056
|
+
fillRule: "evenodd"
|
|
8057
|
+
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
8058
|
+
fill: "none",
|
|
8059
|
+
d: "M0 0h48v48H0z"
|
|
8060
|
+
}), /*#__PURE__*/React__namespace.createElement("path", {
|
|
8061
|
+
fill: "none",
|
|
8062
|
+
d: "M12 12h24v24H12z"
|
|
8063
|
+
}), /*#__PURE__*/React__namespace.createElement("path", {
|
|
8064
|
+
d: "M16 33h16M16 30l16-6-16-6",
|
|
8065
|
+
stroke: "currentColor",
|
|
8066
|
+
strokeWidth: "2",
|
|
8067
|
+
strokeLinecap: "round",
|
|
8068
|
+
strokeLinejoin: "round"
|
|
8069
|
+
})));
|
|
8070
|
+
case "LEQ":
|
|
8071
|
+
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
8072
|
+
width: "44",
|
|
8073
|
+
height: "44",
|
|
8074
|
+
viewBox: "0 0 48 48"
|
|
8075
|
+
}, /*#__PURE__*/React__namespace.createElement("g", {
|
|
8076
|
+
fill: "none",
|
|
8077
|
+
fillRule: "evenodd"
|
|
8078
|
+
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
8079
|
+
fill: "none",
|
|
8080
|
+
d: "M0 0h48v48H0z"
|
|
8081
|
+
}), /*#__PURE__*/React__namespace.createElement("path", {
|
|
8082
|
+
fill: "none",
|
|
8083
|
+
d: "M12 12h24v24H12z"
|
|
8084
|
+
}), /*#__PURE__*/React__namespace.createElement("path", {
|
|
8085
|
+
d: "M16 33h16M32 30l-16-6 16-6",
|
|
8086
|
+
stroke: "currentColor",
|
|
8087
|
+
strokeWidth: "2",
|
|
8088
|
+
strokeLinecap: "round",
|
|
8089
|
+
strokeLinejoin: "round"
|
|
8090
|
+
})));
|
|
8091
|
+
case "NEQ":
|
|
8092
|
+
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
8093
|
+
width: "44",
|
|
8094
|
+
height: "44",
|
|
8095
|
+
viewBox: "0 0 48 48"
|
|
8096
|
+
}, /*#__PURE__*/React__namespace.createElement("g", {
|
|
8097
|
+
fill: "none",
|
|
8098
|
+
fillRule: "evenodd"
|
|
8099
|
+
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
8100
|
+
fill: "none",
|
|
8101
|
+
d: "M0 0h48v48H0z"
|
|
8102
|
+
}), /*#__PURE__*/React__namespace.createElement("path", {
|
|
8103
|
+
fill: "none",
|
|
8104
|
+
d: "M12 12h24v24H12z"
|
|
8105
|
+
}), /*#__PURE__*/React__namespace.createElement("path", {
|
|
8106
|
+
d: "M19 33l10-18M16 21h17M16 27h17",
|
|
8107
|
+
stroke: "currentColor",
|
|
8108
|
+
strokeWidth: "2",
|
|
8109
|
+
strokeLinecap: "round",
|
|
8110
|
+
strokeLinejoin: "round"
|
|
8111
|
+
})));
|
|
8112
|
+
case "LN":
|
|
8113
|
+
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
8114
|
+
width: "48",
|
|
8115
|
+
height: "48",
|
|
8116
|
+
viewBox: "0 0 48 48"
|
|
8117
|
+
}, /*#__PURE__*/React__namespace.createElement("g", {
|
|
8118
|
+
fill: "none",
|
|
8119
|
+
fillRule: "evenodd"
|
|
8120
|
+
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
8121
|
+
fill: "none",
|
|
8122
|
+
d: "M0 0h48v48H0z"
|
|
8123
|
+
}), /*#__PURE__*/React__namespace.createElement("path", {
|
|
8124
|
+
d: "M20.836 29v-9.338h-1.778V29h1.778zm8.106 0v-4.774c0-1.316-.714-2.156-2.198-2.156-1.106 0-1.932.532-2.366 1.05v-.882H22.6V29h1.778v-4.55c.294-.406.84-.798 1.54-.798.756 0 1.246.322 1.246 1.26V29h1.778z",
|
|
8125
|
+
fill: "currentColor"
|
|
8126
|
+
})));
|
|
8127
|
+
case "LOG":
|
|
8128
|
+
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
8129
|
+
width: "48",
|
|
8130
|
+
height: "48",
|
|
8131
|
+
viewBox: "0 0 48 48"
|
|
8132
|
+
}, /*#__PURE__*/React__namespace.createElement("g", {
|
|
8133
|
+
fill: "none",
|
|
8134
|
+
fillRule: "evenodd"
|
|
8135
|
+
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
8136
|
+
fill: "none",
|
|
8137
|
+
d: "M0 0h48v48H0z"
|
|
8138
|
+
}), /*#__PURE__*/React__namespace.createElement("path", {
|
|
8139
|
+
d: "M16.776 29v-9.338h-1.778V29h1.778zm4.9.168c2.24 0 3.584-1.624 3.584-3.556 0-1.918-1.344-3.542-3.584-3.542-2.226 0-3.57 1.624-3.57 3.542 0 1.932 1.344 3.556 3.57 3.556zm0-1.582c-1.106 0-1.722-.91-1.722-1.974 0-1.05.616-1.96 1.722-1.96 1.106 0 1.736.91 1.736 1.96 0 1.064-.63 1.974-1.736 1.974zm7.672 4.158c1.666 0 3.654-.63 3.654-3.206v-6.3H31.21v.868c-.546-.686-1.274-1.036-2.086-1.036-1.708 0-2.982 1.232-2.982 3.444 0 2.254 1.288 3.444 2.982 3.444.826 0 1.554-.392 2.086-1.064v.686c0 1.33-1.008 1.708-1.862 1.708-.854 0-1.568-.238-2.114-.84l-.798 1.288c.854.742 1.75 1.008 2.912 1.008zm.336-4.368c-1.008 0-1.708-.7-1.708-1.862 0-1.162.7-1.862 1.708-1.862.588 0 1.232.322 1.526.77v2.184c-.294.434-.938.77-1.526.77z",
|
|
8140
|
+
fill: "currentColor"
|
|
8141
|
+
})));
|
|
8142
|
+
case "LOG_N":
|
|
8143
|
+
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
8144
|
+
width: "48",
|
|
8145
|
+
height: "48",
|
|
8146
|
+
viewBox: "0 0 48 48"
|
|
8147
|
+
}, /*#__PURE__*/React__namespace.createElement("g", {
|
|
8148
|
+
fill: "none",
|
|
8149
|
+
fillRule: "evenodd"
|
|
8150
|
+
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
8151
|
+
fill: "none",
|
|
8152
|
+
d: "M0 0h48v48H0z"
|
|
8153
|
+
}), /*#__PURE__*/React__namespace.createElement("path", {
|
|
8154
|
+
d: "M30 28.997c0-.55.453-.997.997-.997h6.006c.55 0 .997.453.997.997v6.006c0 .55-.453.997-.997.997h-6.006c-.55 0-.997-.453-.997-.997v-6.006zM32 30h4v4h-4v-4zM12.776 29v-9.338h-1.778V29h1.778zm4.9.168c2.24 0 3.584-1.624 3.584-3.556 0-1.918-1.344-3.542-3.584-3.542-2.226 0-3.57 1.624-3.57 3.542 0 1.932 1.344 3.556 3.57 3.556zm0-1.582c-1.106 0-1.722-.91-1.722-1.974 0-1.05.616-1.96 1.722-1.96 1.106 0 1.736.91 1.736 1.96 0 1.064-.63 1.974-1.736 1.974zm7.672 4.158c1.666 0 3.654-.63 3.654-3.206v-6.3H27.21v.868c-.546-.686-1.274-1.036-2.086-1.036-1.708 0-2.982 1.232-2.982 3.444 0 2.254 1.288 3.444 2.982 3.444.826 0 1.554-.392 2.086-1.064v.686c0 1.33-1.008 1.708-1.862 1.708-.854 0-1.568-.238-2.114-.84l-.798 1.288c.854.742 1.75 1.008 2.912 1.008zm.336-4.368c-1.008 0-1.708-.7-1.708-1.862 0-1.162.7-1.862 1.708-1.862.588 0 1.232.322 1.526.77v2.184c-.294.434-.938.77-1.526.77z",
|
|
8155
|
+
fill: "currentColor"
|
|
8156
|
+
})));
|
|
8157
|
+
case "PERCENT":
|
|
8158
|
+
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
8159
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8160
|
+
width: "20",
|
|
8161
|
+
height: "20",
|
|
8162
|
+
fill: "currentColor",
|
|
8163
|
+
viewBox: "0 0 256 256"
|
|
8164
|
+
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
8165
|
+
d: "M205.66,61.64l-144,144a8,8,0,0,1-11.32-11.32l144-144a8,8,0,0,1,11.32,11.31ZM50.54,101.44a36,36,0,0,1,50.92-50.91h0a36,36,0,0,1-50.92,50.91ZM56,76A20,20,0,1,0,90.14,61.84h0A20,20,0,0,0,56,76ZM216,180a36,36,0,1,1-10.54-25.46h0A35.76,35.76,0,0,1,216,180Zm-16,0a20,20,0,1,0-5.86,14.14A19.87,19.87,0,0,0,200,180Z"
|
|
8166
|
+
}));
|
|
8167
|
+
case "CDOT":
|
|
8168
|
+
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
8169
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8170
|
+
width: "20",
|
|
8171
|
+
height: "20",
|
|
8172
|
+
fill: "currentColor",
|
|
8173
|
+
viewBox: "0 0 256 256"
|
|
8174
|
+
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
8175
|
+
d: "M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Z"
|
|
8176
|
+
}));
|
|
8177
|
+
case "PI":
|
|
8178
|
+
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
8179
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8180
|
+
width: "20",
|
|
8181
|
+
height: "20",
|
|
8182
|
+
fill: "currentColor",
|
|
8183
|
+
viewBox: "0 0 256 256"
|
|
8184
|
+
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
8185
|
+
d: "M232,172a36,36,0,0,1-72,0V72H96V200a8,8,0,0,1-16,0V72H72a40,40,0,0,0-40,40,8,8,0,0,1-16,0A56.06,56.06,0,0,1,72,56H224a8,8,0,0,1,0,16H176V172a20,20,0,0,0,40,0,8,8,0,0,1,16,0Z"
|
|
8186
|
+
}));
|
|
8187
|
+
case "a":
|
|
8188
|
+
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
8189
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8190
|
+
width: "20",
|
|
8191
|
+
height: "20",
|
|
8192
|
+
viewBox: "0 0 384 512"
|
|
8193
|
+
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
8194
|
+
d: "M221.5 51.7C216.6 39.8 204.9 32 192 32s-24.6 7.8-29.5 19.7l-120 288-40 96c-6.8 16.3 .9 35 17.2 41.8s35-.9 41.8-17.2L93.3 384H290.7l31.8 76.3c6.8 16.3 25.5 24 41.8 17.2s24-25.5 17.2-41.8l-40-96-120-288zM264 320H120l72-172.8L264 320z"
|
|
8195
|
+
}));
|
|
8196
|
+
case "b":
|
|
8197
|
+
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
8198
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8199
|
+
width: "20",
|
|
8200
|
+
height: "20",
|
|
8201
|
+
viewBox: "0 0 320 512"
|
|
8202
|
+
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
8203
|
+
d: "M64 32C28.7 32 0 60.7 0 96V256 416c0 35.3 28.7 64 64 64H192c70.7 0 128-57.3 128-128c0-46.5-24.8-87.3-62-109.7c18.7-22.3 30-51 30-82.3c0-70.7-57.3-128-128-128H64zm96 192H64V96h96c35.3 0 64 28.7 64 64s-28.7 64-64 64zM64 288h96 32c35.3 0 64 28.7 64 64s-28.7 64-64 64H64V288z"
|
|
8204
|
+
}));
|
|
8205
|
+
case "c":
|
|
8206
|
+
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
8207
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8208
|
+
width: "20",
|
|
8209
|
+
height: "20",
|
|
8210
|
+
viewBox: "0 0 384 512"
|
|
8211
|
+
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
8212
|
+
d: "M329.1 142.9c-62.5-62.5-155.8-62.5-218.3 0s-62.5 163.8 0 226.3s155.8 62.5 218.3 0c12.5-12.5 32.8-12.5 45.3 0s12.5 32.8 0 45.3c-87.5 87.5-221.3 87.5-308.8 0s-87.5-229.3 0-316.8s221.3-87.5 308.8 0c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0z"
|
|
8213
|
+
}));
|
|
8214
|
+
case "x":
|
|
8215
|
+
// MATHEMATICAL ITALIC SMALL CHI
|
|
8216
|
+
// https://en.wikipedia.org/wiki/Chi_(letter)#Mathematical_chi
|
|
8217
|
+
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
8218
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8219
|
+
width: "20",
|
|
8220
|
+
height: "20",
|
|
8221
|
+
fill: "currentColor",
|
|
8222
|
+
viewBox: "0 0 256 256"
|
|
8223
|
+
}, /*#__PURE__*/React__namespace.createElement("text", {
|
|
8224
|
+
fontSize: "200px",
|
|
8225
|
+
x: "50%",
|
|
8226
|
+
y: "50%",
|
|
8227
|
+
dominantBaseline: "middle",
|
|
8228
|
+
textAnchor: "middle"
|
|
8229
|
+
}, "\uD835\uDF12"));
|
|
8230
|
+
case "X":
|
|
8231
|
+
// MATHEMATICAL ITALIC CAPITAL CHI
|
|
8232
|
+
// https://en.wikipedia.org/wiki/Chi_(letter)#Mathematical_chi
|
|
8233
|
+
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
8234
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8235
|
+
width: "20",
|
|
8236
|
+
height: "20",
|
|
8237
|
+
fill: "currentColor",
|
|
8238
|
+
viewBox: "0 0 256 256"
|
|
8239
|
+
}, /*#__PURE__*/React__namespace.createElement("text", {
|
|
8240
|
+
fontSize: "200px",
|
|
8241
|
+
x: "50%",
|
|
8242
|
+
y: "50%",
|
|
8243
|
+
dominantBaseline: "middle",
|
|
8244
|
+
textAnchor: "middle"
|
|
8245
|
+
}, "\uD835\uDEF8"));
|
|
8246
|
+
|
|
8247
|
+
/**
|
|
8248
|
+
* ANYTHING BELOW IS NOT YET HANDLED
|
|
8249
|
+
*/
|
|
8250
|
+
case "MANY":
|
|
8251
|
+
case "FRAC_EXCLUSIVE":
|
|
8252
|
+
case "THETA":
|
|
8253
|
+
case "NOOP":
|
|
8254
|
+
case "UP":
|
|
8255
|
+
case "DOWN":
|
|
8256
|
+
case "LEFT":
|
|
8257
|
+
case "RIGHT":
|
|
8258
|
+
case "JUMP_OUT_PARENTHESES":
|
|
8259
|
+
case "JUMP_OUT_EXPONENT":
|
|
8260
|
+
case "JUMP_OUT_BASE":
|
|
8261
|
+
case "JUMP_INTO_NUMERATOR":
|
|
8262
|
+
case "JUMP_OUT_NUMERATOR":
|
|
8263
|
+
case "JUMP_OUT_DENOMINATOR":
|
|
8264
|
+
case "PHI":
|
|
8265
|
+
case "NTHROOT3":
|
|
8266
|
+
case "POW":
|
|
8267
|
+
case "LOG_B":
|
|
8268
|
+
case "d":
|
|
8269
|
+
case "e":
|
|
8270
|
+
case "f":
|
|
8271
|
+
case "g":
|
|
8272
|
+
case "h":
|
|
8273
|
+
case "i":
|
|
8274
|
+
case "j":
|
|
8275
|
+
case "k":
|
|
8276
|
+
case "l":
|
|
8277
|
+
case "m":
|
|
8278
|
+
case "n":
|
|
8279
|
+
case "o":
|
|
8280
|
+
case "p":
|
|
8281
|
+
case "q":
|
|
8282
|
+
case "r":
|
|
8283
|
+
case "s":
|
|
8284
|
+
case "t":
|
|
8285
|
+
case "u":
|
|
8286
|
+
case "v":
|
|
8287
|
+
case "w":
|
|
8288
|
+
case "y":
|
|
8289
|
+
case "z":
|
|
8290
|
+
case "A":
|
|
8291
|
+
case "B":
|
|
8292
|
+
case "C":
|
|
8293
|
+
case "D":
|
|
8294
|
+
case "E":
|
|
8295
|
+
case "F":
|
|
8296
|
+
case "G":
|
|
8297
|
+
case "H":
|
|
8298
|
+
case "I":
|
|
8299
|
+
case "J":
|
|
8300
|
+
case "K":
|
|
8301
|
+
case "L":
|
|
8302
|
+
case "M":
|
|
8303
|
+
case "N":
|
|
8304
|
+
case "O":
|
|
8305
|
+
case "P":
|
|
8306
|
+
case "Q":
|
|
8307
|
+
case "R":
|
|
8308
|
+
case "S":
|
|
8309
|
+
case "T":
|
|
8310
|
+
case "U":
|
|
8311
|
+
case "V":
|
|
8312
|
+
case "W":
|
|
8313
|
+
case "Y":
|
|
8314
|
+
case "Z":
|
|
7449
8315
|
// placeholder
|
|
7450
8316
|
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
7451
8317
|
width: "40",
|
|
@@ -7463,6 +8329,11 @@ function ButtonAsset(_ref) {
|
|
|
7463
8329
|
lengthAdjust: "spacingAndGlyphs",
|
|
7464
8330
|
fill: "red"
|
|
7465
8331
|
}, "placeholder"));
|
|
8332
|
+
default:
|
|
8333
|
+
// this line forces an exhaustive check of all keys;
|
|
8334
|
+
// if a key is not handled, the compiler will complain.
|
|
8335
|
+
const unhandledKey = id;
|
|
8336
|
+
throw new Error("Unhandled key: ".concat(unhandledKey));
|
|
7466
8337
|
}
|
|
7467
8338
|
}
|
|
7468
8339
|
|
|
@@ -7491,7 +8362,8 @@ const KeypadButton = _ref2 => {
|
|
|
7491
8362
|
return /*#__PURE__*/React__namespace.createElement(Button, {
|
|
7492
8363
|
onPress: () => onClickKey(keyConfig.id),
|
|
7493
8364
|
tintColor: tintColor,
|
|
7494
|
-
style: style
|
|
8365
|
+
style: style,
|
|
8366
|
+
ariaLabel: keyConfig.id
|
|
7495
8367
|
}, /*#__PURE__*/React__namespace.createElement(ButtonAsset, {
|
|
7496
8368
|
id: keyConfig.id
|
|
7497
8369
|
}));
|
|
@@ -7553,6 +8425,20 @@ const PlaceHolderButtons = _ref5 => {
|
|
|
7553
8425
|
}))));
|
|
7554
8426
|
};
|
|
7555
8427
|
|
|
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, {
|
|
8435
|
+
key: key,
|
|
8436
|
+
keyConfig: KeyConfigs[key],
|
|
8437
|
+
onClickKey: onClickKey
|
|
8438
|
+
})));
|
|
8439
|
+
}
|
|
8440
|
+
}
|
|
8441
|
+
|
|
7556
8442
|
class GeometryPage extends React__namespace.Component {
|
|
7557
8443
|
render() {
|
|
7558
8444
|
const {
|
|
@@ -7580,7 +8466,7 @@ class GeometryPage extends React__namespace.Component {
|
|
|
7580
8466
|
gridColumn: 6
|
|
7581
8467
|
}
|
|
7582
8468
|
}), /*#__PURE__*/React__namespace.createElement(SecondaryKeypadButton, {
|
|
7583
|
-
keyConfig: KeyConfigs.
|
|
8469
|
+
keyConfig: KeyConfigs.x,
|
|
7584
8470
|
onClickKey: onClickKey,
|
|
7585
8471
|
style: {
|
|
7586
8472
|
gridColumn: 5
|
|
@@ -7813,7 +8699,7 @@ class OperatorsPage extends React__namespace.Component {
|
|
|
7813
8699
|
onClickKey: onClickKey,
|
|
7814
8700
|
placeholder: !this.props.logarithms
|
|
7815
8701
|
}), /*#__PURE__*/React__namespace.createElement(SecondaryKeypadButton, {
|
|
7816
|
-
keyConfig: KeyConfigs.
|
|
8702
|
+
keyConfig: KeyConfigs.x,
|
|
7817
8703
|
onClickKey: onClickKey,
|
|
7818
8704
|
style: {
|
|
7819
8705
|
gridColumn: 5
|
|
@@ -7852,8 +8738,12 @@ class OperatorsPage extends React__namespace.Component {
|
|
|
7852
8738
|
}
|
|
7853
8739
|
}
|
|
7854
8740
|
|
|
7855
|
-
|
|
8741
|
+
function allPages(props) {
|
|
8742
|
+
var _props$extraKeys;
|
|
7856
8743
|
const pages = ["Numbers"];
|
|
8744
|
+
if ((_props$extraKeys = props.extraKeys) !== null && _props$extraKeys !== void 0 && _props$extraKeys.length) {
|
|
8745
|
+
pages.push("Extras");
|
|
8746
|
+
}
|
|
7857
8747
|
if (
|
|
7858
8748
|
// OperatorsButtonSets
|
|
7859
8749
|
props.preAlgebra || props.logarithms || props.basicRelations || props.advancedRelations) {
|
|
@@ -7862,9 +8752,8 @@ const allPages = function (props) {
|
|
|
7862
8752
|
if (props.trigonometry) {
|
|
7863
8753
|
pages.push("Geometry");
|
|
7864
8754
|
}
|
|
7865
|
-
// @ts-expect-error [FEI-5003] - TS2739 - Type 'TabbarItemType[]' is missing the following properties from type 'ReactElement<any, string | JSXElementConstructor<any>>': type, props, key
|
|
7866
8755
|
return pages;
|
|
7867
|
-
}
|
|
8756
|
+
}
|
|
7868
8757
|
class Keypad extends React__namespace.Component {
|
|
7869
8758
|
constructor() {
|
|
7870
8759
|
super(...arguments);
|
|
@@ -7877,26 +8766,33 @@ class Keypad extends React__namespace.Component {
|
|
|
7877
8766
|
selectedPage
|
|
7878
8767
|
} = this.state;
|
|
7879
8768
|
const availablePages = allPages(this.props);
|
|
7880
|
-
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, null, /*#__PURE__*/React__namespace.createElement(Tabbar
|
|
7881
|
-
// @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call.
|
|
7882
|
-
, {
|
|
8769
|
+
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, null, /*#__PURE__*/React__namespace.createElement(Tabbar, {
|
|
7883
8770
|
items: availablePages,
|
|
7884
|
-
|
|
8771
|
+
selectedItem: selectedPage,
|
|
8772
|
+
onSelectItem: tabbarItem => {
|
|
7885
8773
|
this.setState({
|
|
7886
8774
|
selectedPage: tabbarItem
|
|
7887
8775
|
});
|
|
7888
|
-
}
|
|
7889
|
-
|
|
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));
|
|
7890
8779
|
}
|
|
7891
8780
|
}
|
|
8781
|
+
_defineProperty(Keypad, "defaultProps", {
|
|
8782
|
+
extraKeys: []
|
|
8783
|
+
});
|
|
8784
|
+
const styles = aphrodite.StyleSheet.create({
|
|
8785
|
+
tabbar: {
|
|
8786
|
+
background: Color__default["default"].white
|
|
8787
|
+
}
|
|
8788
|
+
});
|
|
7892
8789
|
|
|
7893
8790
|
exports.CursorContext = CursorContext;
|
|
7894
8791
|
exports.KeyConfigs = KeyConfigs;
|
|
7895
|
-
exports.KeyType = KeyType;
|
|
7896
8792
|
exports.Keypad = Keypad;
|
|
7897
8793
|
exports.KeypadInput = MathInput;
|
|
7898
8794
|
exports.KeypadType = KeypadType;
|
|
7899
|
-
exports.Keys = Keys;
|
|
7900
8795
|
exports.LegacyKeypad = ProvidedKeypad;
|
|
8796
|
+
exports.keyTranslator = keyToMathquillMap;
|
|
7901
8797
|
exports.keypadElementPropType = keypadElementPropType;
|
|
7902
8798
|
//# sourceMappingURL=index.js.map
|