@khanacademy/math-input 3.0.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -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/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/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 +1781 -1196
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2069 -1242
- 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 +1 -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 +411 -100
- package/src/components/keypad/geometry-page/index.tsx +1 -1
- package/src/components/keypad/keypad-mathquill.stories.tsx +69 -0
- package/src/components/keypad/keypad-page-items.tsx +2 -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/tabbar/icons.tsx +0 -2
- 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
|
@@ -12,10 +12,9 @@ no copying and pasting is necessary.
|
|
|
12
12
|
*/
|
|
13
13
|
import * as React from "react";
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
type KeyId = string;
|
|
15
|
+
import Key from "../../data/keys";
|
|
17
16
|
|
|
18
|
-
type Props = {id:
|
|
17
|
+
type Props = {id: Key};
|
|
19
18
|
|
|
20
19
|
export default function ButtonAsset({id}: Props): React.ReactElement {
|
|
21
20
|
switch (id) {
|
|
@@ -208,106 +207,97 @@ export default function ButtonAsset({id}: Props): React.ReactElement {
|
|
|
208
207
|
case "MINUS":
|
|
209
208
|
return (
|
|
210
209
|
<svg
|
|
211
|
-
width="40"
|
|
212
|
-
height="40"
|
|
213
|
-
viewBox="0 0 40 40"
|
|
214
|
-
fill="none"
|
|
215
210
|
xmlns="http://www.w3.org/2000/svg"
|
|
211
|
+
width="20"
|
|
212
|
+
height="20"
|
|
213
|
+
fill="currentColor"
|
|
214
|
+
viewBox="0 0 256 256"
|
|
216
215
|
>
|
|
217
|
-
<path
|
|
218
|
-
d="M27 20H13"
|
|
219
|
-
stroke="#21242C"
|
|
220
|
-
strokeWidth="2"
|
|
221
|
-
strokeLinecap="round"
|
|
222
|
-
strokeLinejoin="round"
|
|
223
|
-
/>
|
|
216
|
+
<path d="M224,128a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128Z" />
|
|
224
217
|
</svg>
|
|
225
218
|
);
|
|
226
219
|
case "PLUS":
|
|
227
220
|
return (
|
|
221
|
+
// Phosphor Icons - Plus Bold
|
|
228
222
|
<svg
|
|
229
|
-
width="40"
|
|
230
|
-
height="40"
|
|
231
|
-
viewBox="0 0 40 40"
|
|
232
|
-
fill="none"
|
|
233
223
|
xmlns="http://www.w3.org/2000/svg"
|
|
224
|
+
width="20"
|
|
225
|
+
height="20"
|
|
226
|
+
fill="currentColor"
|
|
227
|
+
viewBox="0 0 256 256"
|
|
234
228
|
>
|
|
235
|
-
<path
|
|
236
|
-
d="M27 20H13"
|
|
237
|
-
stroke="#21242C"
|
|
238
|
-
strokeWidth="2"
|
|
239
|
-
strokeLinecap="round"
|
|
240
|
-
strokeLinejoin="round"
|
|
241
|
-
/>
|
|
242
|
-
<path
|
|
243
|
-
d="M20 13V27"
|
|
244
|
-
stroke="#21242C"
|
|
245
|
-
strokeWidth="2"
|
|
246
|
-
strokeLinecap="round"
|
|
247
|
-
strokeLinejoin="round"
|
|
248
|
-
/>
|
|
229
|
+
<path 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" />{" "}
|
|
249
230
|
</svg>
|
|
250
231
|
);
|
|
251
232
|
case "TIMES":
|
|
252
233
|
return (
|
|
234
|
+
// Phosphor Icons - X Bold
|
|
253
235
|
<svg
|
|
254
|
-
width="40"
|
|
255
|
-
height="40"
|
|
256
|
-
viewBox="0 0 40 40"
|
|
257
|
-
fill="none"
|
|
258
236
|
xmlns="http://www.w3.org/2000/svg"
|
|
237
|
+
width="20"
|
|
238
|
+
height="20"
|
|
239
|
+
fill="#000000"
|
|
240
|
+
viewBox="0 0 256 256"
|
|
259
241
|
>
|
|
260
|
-
<path
|
|
261
|
-
d="M24.9498 24.9493L15.0503 15.0498"
|
|
262
|
-
stroke="#21242C"
|
|
263
|
-
strokeWidth="2"
|
|
264
|
-
strokeLinecap="round"
|
|
265
|
-
strokeLinejoin="round"
|
|
266
|
-
/>
|
|
267
|
-
<path
|
|
268
|
-
d="M24.9498 15.0507L15.0503 24.9502"
|
|
269
|
-
stroke="#21242C"
|
|
270
|
-
strokeWidth="2"
|
|
271
|
-
strokeLinecap="round"
|
|
272
|
-
strokeLinejoin="round"
|
|
273
|
-
/>
|
|
242
|
+
<path 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" />
|
|
274
243
|
</svg>
|
|
275
244
|
);
|
|
276
245
|
|
|
277
246
|
case "BACKSPACE":
|
|
278
247
|
return (
|
|
279
248
|
<svg
|
|
280
|
-
width="40"
|
|
281
|
-
height="40"
|
|
282
|
-
viewBox="0 0 40 40"
|
|
283
|
-
fill="none"
|
|
284
249
|
xmlns="http://www.w3.org/2000/svg"
|
|
250
|
+
width="20"
|
|
251
|
+
height="20"
|
|
252
|
+
fill="currentColor"
|
|
253
|
+
viewBox="0 0 256 256"
|
|
285
254
|
>
|
|
286
|
-
<path
|
|
287
|
-
fillRule="evenodd"
|
|
288
|
-
clipRule="evenodd"
|
|
289
|
-
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"
|
|
290
|
-
fill="#21242C"
|
|
291
|
-
/>
|
|
255
|
+
<path 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" />
|
|
292
256
|
</svg>
|
|
293
257
|
);
|
|
294
258
|
case "DISMISS":
|
|
295
259
|
return (
|
|
296
260
|
<svg
|
|
297
|
-
width="40"
|
|
298
|
-
height="40"
|
|
299
|
-
viewBox="0 0 40 40"
|
|
300
|
-
fill="none"
|
|
301
261
|
xmlns="http://www.w3.org/2000/svg"
|
|
262
|
+
width="20"
|
|
263
|
+
height="20"
|
|
264
|
+
fill="currentColor"
|
|
265
|
+
viewBox="0 0 256 256"
|
|
302
266
|
>
|
|
303
267
|
<path
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
d="
|
|
307
|
-
fill="#21242C"
|
|
268
|
+
// flip to point down
|
|
269
|
+
transform="scale(1,-1) translate(0, -260)"
|
|
270
|
+
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"
|
|
308
271
|
/>
|
|
309
272
|
</svg>
|
|
310
273
|
);
|
|
274
|
+
case "FRAC":
|
|
275
|
+
return (
|
|
276
|
+
<svg width="48" height="48" viewBox="0 0 48 48">
|
|
277
|
+
<g fill="none" fillRule="evenodd">
|
|
278
|
+
<path fill="none" d="M0 0h48v48H0z" />
|
|
279
|
+
<g transform="translate(12 12)">
|
|
280
|
+
<path fill="none" d="M0 0h24v24H0z" />
|
|
281
|
+
<path
|
|
282
|
+
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"
|
|
283
|
+
fill="currentColor"
|
|
284
|
+
/>
|
|
285
|
+
<rect
|
|
286
|
+
fill="currentColor"
|
|
287
|
+
x="2"
|
|
288
|
+
y="11"
|
|
289
|
+
width="20"
|
|
290
|
+
height="2"
|
|
291
|
+
rx="1"
|
|
292
|
+
/>
|
|
293
|
+
<path
|
|
294
|
+
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"
|
|
295
|
+
fill="currentColor"
|
|
296
|
+
/>
|
|
297
|
+
</g>
|
|
298
|
+
</g>
|
|
299
|
+
</svg>
|
|
300
|
+
);
|
|
311
301
|
case "FRAC_INCLUSIVE":
|
|
312
302
|
return (
|
|
313
303
|
<svg
|
|
@@ -342,26 +332,24 @@ export default function ButtonAsset({id}: Props): React.ReactElement {
|
|
|
342
332
|
/>
|
|
343
333
|
</svg>
|
|
344
334
|
);
|
|
335
|
+
// TODO(ned): Per the notes in `KeyConfigs`, shouldn't this be a comma
|
|
336
|
+
// that we replace with the period icon for i18n? Duplicating for now.
|
|
345
337
|
case "DECIMAL":
|
|
338
|
+
case "PERIOD":
|
|
346
339
|
return (
|
|
347
340
|
<svg
|
|
348
|
-
width="40"
|
|
349
|
-
height="40"
|
|
350
|
-
viewBox="0 0 40 40"
|
|
351
|
-
fill="none"
|
|
352
341
|
xmlns="http://www.w3.org/2000/svg"
|
|
342
|
+
width="20"
|
|
343
|
+
height="20"
|
|
344
|
+
fill="currentColor"
|
|
345
|
+
viewBox="0 0 256 256"
|
|
353
346
|
>
|
|
354
|
-
<
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
d="M18.5 18.5H21.5V21.5H18.5V18.5Z"
|
|
361
|
-
fill="white"
|
|
362
|
-
/>
|
|
363
|
-
</clipPath>
|
|
364
|
-
</defs>
|
|
347
|
+
<path
|
|
348
|
+
d="M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Z"
|
|
349
|
+
// moves decimal down to baseline of number icons,
|
|
350
|
+
// otherwise indistinguishable from cdot
|
|
351
|
+
transform="translate(0 80)"
|
|
352
|
+
/>
|
|
365
353
|
</svg>
|
|
366
354
|
);
|
|
367
355
|
case "RADICAL":
|
|
@@ -382,6 +370,41 @@ export default function ButtonAsset({id}: Props): React.ReactElement {
|
|
|
382
370
|
</svg>
|
|
383
371
|
);
|
|
384
372
|
case "SQRT":
|
|
373
|
+
return (
|
|
374
|
+
<svg
|
|
375
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
376
|
+
width="20"
|
|
377
|
+
height="20"
|
|
378
|
+
fill="currentColor"
|
|
379
|
+
viewBox="0 0 256 256"
|
|
380
|
+
>
|
|
381
|
+
<path 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" />
|
|
382
|
+
</svg>
|
|
383
|
+
);
|
|
384
|
+
case "CUBE_ROOT":
|
|
385
|
+
return (
|
|
386
|
+
<svg width="48" height="48" viewBox="0 0 48 48">
|
|
387
|
+
<g
|
|
388
|
+
fill="none"
|
|
389
|
+
fillRule="evenodd"
|
|
390
|
+
transform="translate(0, -4)"
|
|
391
|
+
>
|
|
392
|
+
<path fill="none" d="M0 0h48v48H0z" />
|
|
393
|
+
<path
|
|
394
|
+
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"
|
|
395
|
+
fill="currentColor"
|
|
396
|
+
/>
|
|
397
|
+
<path
|
|
398
|
+
stroke="currentColor"
|
|
399
|
+
strokeWidth="2"
|
|
400
|
+
strokeLinecap="round"
|
|
401
|
+
strokeLinejoin="round"
|
|
402
|
+
d="M14 29l4 6 9-14h7"
|
|
403
|
+
/>
|
|
404
|
+
</g>
|
|
405
|
+
</svg>
|
|
406
|
+
);
|
|
407
|
+
case "EXP":
|
|
385
408
|
return (
|
|
386
409
|
<svg
|
|
387
410
|
width="40"
|
|
@@ -391,11 +414,10 @@ export default function ButtonAsset({id}: Props): React.ReactElement {
|
|
|
391
414
|
xmlns="http://www.w3.org/2000/svg"
|
|
392
415
|
>
|
|
393
416
|
<path
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
strokeLinejoin="round"
|
|
417
|
+
fillRule="evenodd"
|
|
418
|
+
clipRule="evenodd"
|
|
419
|
+
fill="#21242C"
|
|
420
|
+
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"
|
|
399
421
|
/>
|
|
400
422
|
</svg>
|
|
401
423
|
);
|
|
@@ -416,30 +438,24 @@ export default function ButtonAsset({id}: Props): React.ReactElement {
|
|
|
416
438
|
/>
|
|
417
439
|
</svg>
|
|
418
440
|
);
|
|
419
|
-
case "
|
|
441
|
+
case "EXP_3":
|
|
420
442
|
return (
|
|
421
443
|
<svg
|
|
422
|
-
width="
|
|
423
|
-
height="
|
|
444
|
+
width="42"
|
|
445
|
+
height="42"
|
|
424
446
|
viewBox="0 0 40 40"
|
|
425
447
|
fill="none"
|
|
426
448
|
xmlns="http://www.w3.org/2000/svg"
|
|
427
449
|
>
|
|
428
450
|
<path
|
|
451
|
+
transform="translate(0, -8)"
|
|
429
452
|
fillRule="evenodd"
|
|
430
453
|
clipRule="evenodd"
|
|
431
|
-
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"
|
|
432
454
|
fill="#21242C"
|
|
455
|
+
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"
|
|
433
456
|
/>
|
|
434
457
|
</svg>
|
|
435
458
|
);
|
|
436
|
-
case "PI":
|
|
437
|
-
//TODO(NickR): use correct font, size, and color for this. It's not an SVG asset
|
|
438
|
-
return <span>pi</span>;
|
|
439
|
-
case "X":
|
|
440
|
-
//TODO(NickR): use correct font, size, and color for this. It's not an SVG asset
|
|
441
|
-
return <span>x</span>;
|
|
442
|
-
|
|
443
459
|
case "TAN":
|
|
444
460
|
return (
|
|
445
461
|
<svg
|
|
@@ -485,8 +501,298 @@ export default function ButtonAsset({id}: Props): React.ReactElement {
|
|
|
485
501
|
/>
|
|
486
502
|
</svg>
|
|
487
503
|
);
|
|
504
|
+
case "DIVIDE":
|
|
505
|
+
return (
|
|
506
|
+
<svg
|
|
507
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
508
|
+
width="20"
|
|
509
|
+
height="20"
|
|
510
|
+
fill="currentColor"
|
|
511
|
+
viewBox="0 0 256 256"
|
|
512
|
+
>
|
|
513
|
+
<path 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" />
|
|
514
|
+
</svg>
|
|
515
|
+
);
|
|
516
|
+
case "EQUAL":
|
|
517
|
+
return (
|
|
518
|
+
<svg
|
|
519
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
520
|
+
width="20"
|
|
521
|
+
height="20"
|
|
522
|
+
fill="currentColor"
|
|
523
|
+
viewBox="0 0 256 256"
|
|
524
|
+
>
|
|
525
|
+
<path 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" />
|
|
526
|
+
</svg>
|
|
527
|
+
);
|
|
528
|
+
case "GT":
|
|
529
|
+
return (
|
|
530
|
+
<svg width="44" height="44" viewBox="0 0 48 48">
|
|
531
|
+
<g fill="none" fillRule="evenodd">
|
|
532
|
+
<path fill="none" d="M0 0h48v48H0z" />
|
|
533
|
+
<path fill="none" d="M12 12h24v24H12z" />
|
|
534
|
+
<path
|
|
535
|
+
stroke="currentColor"
|
|
536
|
+
strokeWidth="2"
|
|
537
|
+
strokeLinecap="round"
|
|
538
|
+
strokeLinejoin="round"
|
|
539
|
+
d="M16 30l16-6-16-6"
|
|
540
|
+
/>
|
|
541
|
+
</g>
|
|
542
|
+
</svg>
|
|
543
|
+
);
|
|
544
|
+
case "LT":
|
|
545
|
+
return (
|
|
546
|
+
<svg width="44" height="44" viewBox="0 0 48 48">
|
|
547
|
+
<g fill="none" fillRule="evenodd">
|
|
548
|
+
<path fill="none" d="M0 0h48v48H0z" />
|
|
549
|
+
<path fill="none" d="M12 12h24v24H12z" />
|
|
550
|
+
<path
|
|
551
|
+
stroke="currentColor"
|
|
552
|
+
strokeWidth="2"
|
|
553
|
+
strokeLinecap="round"
|
|
554
|
+
strokeLinejoin="round"
|
|
555
|
+
d="M32 30l-16-6 16-6"
|
|
556
|
+
/>
|
|
557
|
+
</g>
|
|
558
|
+
</svg>
|
|
559
|
+
);
|
|
560
|
+
case "GEQ":
|
|
561
|
+
return (
|
|
562
|
+
<svg width="44" height="44" viewBox="0 0 48 48">
|
|
563
|
+
<g fill="none" fillRule="evenodd">
|
|
564
|
+
<path fill="none" d="M0 0h48v48H0z" />
|
|
565
|
+
<path fill="none" d="M12 12h24v24H12z" />
|
|
566
|
+
<path
|
|
567
|
+
d="M16 33h16M16 30l16-6-16-6"
|
|
568
|
+
stroke="currentColor"
|
|
569
|
+
strokeWidth="2"
|
|
570
|
+
strokeLinecap="round"
|
|
571
|
+
strokeLinejoin="round"
|
|
572
|
+
/>
|
|
573
|
+
</g>
|
|
574
|
+
</svg>
|
|
575
|
+
);
|
|
576
|
+
case "LEQ":
|
|
577
|
+
return (
|
|
578
|
+
<svg width="44" height="44" viewBox="0 0 48 48">
|
|
579
|
+
<g fill="none" fillRule="evenodd">
|
|
580
|
+
<path fill="none" d="M0 0h48v48H0z" />
|
|
581
|
+
<path fill="none" d="M12 12h24v24H12z" />
|
|
582
|
+
<path
|
|
583
|
+
d="M16 33h16M32 30l-16-6 16-6"
|
|
584
|
+
stroke="currentColor"
|
|
585
|
+
strokeWidth="2"
|
|
586
|
+
strokeLinecap="round"
|
|
587
|
+
strokeLinejoin="round"
|
|
588
|
+
/>
|
|
589
|
+
</g>
|
|
590
|
+
</svg>
|
|
591
|
+
);
|
|
592
|
+
case "NEQ":
|
|
593
|
+
return (
|
|
594
|
+
<svg width="44" height="44" viewBox="0 0 48 48">
|
|
595
|
+
<g fill="none" fillRule="evenodd">
|
|
596
|
+
<path fill="none" d="M0 0h48v48H0z" />
|
|
597
|
+
<path fill="none" d="M12 12h24v24H12z" />
|
|
598
|
+
<path
|
|
599
|
+
d="M19 33l10-18M16 21h17M16 27h17"
|
|
600
|
+
stroke="currentColor"
|
|
601
|
+
strokeWidth="2"
|
|
602
|
+
strokeLinecap="round"
|
|
603
|
+
strokeLinejoin="round"
|
|
604
|
+
/>
|
|
605
|
+
</g>
|
|
606
|
+
</svg>
|
|
607
|
+
);
|
|
608
|
+
case "LN":
|
|
609
|
+
return (
|
|
610
|
+
<svg width="48" height="48" viewBox="0 0 48 48">
|
|
611
|
+
<g fill="none" fillRule="evenodd">
|
|
612
|
+
<path fill="none" d="M0 0h48v48H0z" />
|
|
613
|
+
<path
|
|
614
|
+
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"
|
|
615
|
+
fill="currentColor"
|
|
616
|
+
/>
|
|
617
|
+
</g>
|
|
618
|
+
</svg>
|
|
619
|
+
);
|
|
620
|
+
case "LOG":
|
|
621
|
+
return (
|
|
622
|
+
<svg width="48" height="48" viewBox="0 0 48 48">
|
|
623
|
+
<g fill="none" fillRule="evenodd">
|
|
624
|
+
<path fill="none" d="M0 0h48v48H0z" />
|
|
625
|
+
<path
|
|
626
|
+
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"
|
|
627
|
+
fill="currentColor"
|
|
628
|
+
/>
|
|
629
|
+
</g>
|
|
630
|
+
</svg>
|
|
631
|
+
);
|
|
632
|
+
case "LOG_N":
|
|
633
|
+
return (
|
|
634
|
+
<svg width="48" height="48" viewBox="0 0 48 48">
|
|
635
|
+
<g fill="none" fillRule="evenodd">
|
|
636
|
+
<path fill="none" d="M0 0h48v48H0z" />
|
|
637
|
+
<path
|
|
638
|
+
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"
|
|
639
|
+
fill="currentColor"
|
|
640
|
+
/>
|
|
641
|
+
</g>
|
|
642
|
+
</svg>
|
|
643
|
+
);
|
|
644
|
+
case "PERCENT":
|
|
645
|
+
return (
|
|
646
|
+
<svg
|
|
647
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
648
|
+
width="20"
|
|
649
|
+
height="20"
|
|
650
|
+
fill="currentColor"
|
|
651
|
+
viewBox="0 0 256 256"
|
|
652
|
+
>
|
|
653
|
+
<path 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" />
|
|
654
|
+
</svg>
|
|
655
|
+
);
|
|
656
|
+
case "CDOT":
|
|
657
|
+
return (
|
|
658
|
+
<svg
|
|
659
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
660
|
+
width="20"
|
|
661
|
+
height="20"
|
|
662
|
+
fill="currentColor"
|
|
663
|
+
viewBox="0 0 256 256"
|
|
664
|
+
>
|
|
665
|
+
<path d="M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Z" />
|
|
666
|
+
</svg>
|
|
667
|
+
);
|
|
668
|
+
case "PI":
|
|
669
|
+
return (
|
|
670
|
+
<svg
|
|
671
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
672
|
+
width="20"
|
|
673
|
+
height="20"
|
|
674
|
+
fill="currentColor"
|
|
675
|
+
viewBox="0 0 256 256"
|
|
676
|
+
>
|
|
677
|
+
<path 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" />
|
|
678
|
+
</svg>
|
|
679
|
+
);
|
|
680
|
+
case "x":
|
|
681
|
+
// MATHEMATICAL ITALIC SMALL CHI
|
|
682
|
+
// https://en.wikipedia.org/wiki/Chi_(letter)#Mathematical_chi
|
|
683
|
+
return (
|
|
684
|
+
<svg
|
|
685
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
686
|
+
width="20"
|
|
687
|
+
height="20"
|
|
688
|
+
fill="currentColor"
|
|
689
|
+
viewBox="0 0 256 256"
|
|
690
|
+
>
|
|
691
|
+
<text
|
|
692
|
+
fontSize="200px"
|
|
693
|
+
x="50%"
|
|
694
|
+
y="50%"
|
|
695
|
+
dominantBaseline="middle"
|
|
696
|
+
textAnchor="middle"
|
|
697
|
+
>
|
|
698
|
+
𝜒
|
|
699
|
+
</text>
|
|
700
|
+
</svg>
|
|
701
|
+
);
|
|
702
|
+
case "X":
|
|
703
|
+
// MATHEMATICAL ITALIC CAPITAL CHI
|
|
704
|
+
// https://en.wikipedia.org/wiki/Chi_(letter)#Mathematical_chi
|
|
705
|
+
return (
|
|
706
|
+
<svg
|
|
707
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
708
|
+
width="20"
|
|
709
|
+
height="20"
|
|
710
|
+
fill="currentColor"
|
|
711
|
+
viewBox="0 0 256 256"
|
|
712
|
+
>
|
|
713
|
+
<text
|
|
714
|
+
fontSize="200px"
|
|
715
|
+
x="50%"
|
|
716
|
+
y="50%"
|
|
717
|
+
dominantBaseline="middle"
|
|
718
|
+
textAnchor="middle"
|
|
719
|
+
>
|
|
720
|
+
𝛸
|
|
721
|
+
</text>
|
|
722
|
+
</svg>
|
|
723
|
+
);
|
|
488
724
|
|
|
489
|
-
|
|
725
|
+
/**
|
|
726
|
+
* ANYTHING BELOW IS NOT YET HANDLED
|
|
727
|
+
*/
|
|
728
|
+
case "MANY":
|
|
729
|
+
case "FRAC_EXCLUSIVE":
|
|
730
|
+
case "THETA":
|
|
731
|
+
case "NOOP":
|
|
732
|
+
case "UP":
|
|
733
|
+
case "DOWN":
|
|
734
|
+
case "LEFT":
|
|
735
|
+
case "RIGHT":
|
|
736
|
+
case "JUMP_OUT_PARENTHESES":
|
|
737
|
+
case "JUMP_OUT_EXPONENT":
|
|
738
|
+
case "JUMP_OUT_BASE":
|
|
739
|
+
case "JUMP_INTO_NUMERATOR":
|
|
740
|
+
case "JUMP_OUT_NUMERATOR":
|
|
741
|
+
case "JUMP_OUT_DENOMINATOR":
|
|
742
|
+
case "PHI":
|
|
743
|
+
case "NTHROOT3":
|
|
744
|
+
case "POW":
|
|
745
|
+
case "LOG_B":
|
|
746
|
+
case "a":
|
|
747
|
+
case "b":
|
|
748
|
+
case "c":
|
|
749
|
+
case "d":
|
|
750
|
+
case "e":
|
|
751
|
+
case "f":
|
|
752
|
+
case "g":
|
|
753
|
+
case "h":
|
|
754
|
+
case "i":
|
|
755
|
+
case "j":
|
|
756
|
+
case "k":
|
|
757
|
+
case "l":
|
|
758
|
+
case "m":
|
|
759
|
+
case "n":
|
|
760
|
+
case "o":
|
|
761
|
+
case "p":
|
|
762
|
+
case "q":
|
|
763
|
+
case "r":
|
|
764
|
+
case "s":
|
|
765
|
+
case "t":
|
|
766
|
+
case "u":
|
|
767
|
+
case "v":
|
|
768
|
+
case "w":
|
|
769
|
+
case "y":
|
|
770
|
+
case "z":
|
|
771
|
+
case "A":
|
|
772
|
+
case "B":
|
|
773
|
+
case "C":
|
|
774
|
+
case "D":
|
|
775
|
+
case "E":
|
|
776
|
+
case "F":
|
|
777
|
+
case "G":
|
|
778
|
+
case "H":
|
|
779
|
+
case "I":
|
|
780
|
+
case "J":
|
|
781
|
+
case "K":
|
|
782
|
+
case "L":
|
|
783
|
+
case "M":
|
|
784
|
+
case "N":
|
|
785
|
+
case "O":
|
|
786
|
+
case "P":
|
|
787
|
+
case "Q":
|
|
788
|
+
case "R":
|
|
789
|
+
case "S":
|
|
790
|
+
case "T":
|
|
791
|
+
case "U":
|
|
792
|
+
case "V":
|
|
793
|
+
case "W":
|
|
794
|
+
case "Y":
|
|
795
|
+
case "Z":
|
|
490
796
|
// placeholder
|
|
491
797
|
return (
|
|
492
798
|
<svg
|
|
@@ -513,5 +819,10 @@ export default function ButtonAsset({id}: Props): React.ReactElement {
|
|
|
513
819
|
</text>
|
|
514
820
|
</svg>
|
|
515
821
|
);
|
|
822
|
+
default:
|
|
823
|
+
// this line forces an exhaustive check of all keys;
|
|
824
|
+
// if a key is not handled, the compiler will complain.
|
|
825
|
+
const unhandledKey: never = id;
|
|
826
|
+
throw new Error(`Unhandled key: ${unhandledKey}`);
|
|
516
827
|
}
|
|
517
828
|
}
|