@khanacademy/perseus 20.0.1 → 20.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/index.js +20 -8
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +20 -5
- package/dist/index.js.map +1 -1
- package/dist/util/debounce.d.ts +1 -0
- package/package.json +1 -1
package/dist/es/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as KAS from '@khanacademy/kas';
|
|
2
|
-
import { keyTranslator, CursorContext, createMathField,
|
|
2
|
+
import { keyTranslator, CursorContext, createMathField, getCursorContext, DesktopKeypad, convertDotToTimesByLocale, mathQuillInstance, KeypadInput, KeypadType, KeyArray, keypadElementPropType } from '@khanacademy/math-input';
|
|
3
3
|
import * as PerseusLinter from '@khanacademy/perseus-linter';
|
|
4
4
|
import { linterContextDefault, Rule, linterContextProps } from '@khanacademy/perseus-linter';
|
|
5
5
|
import { View, RenderStateRoot, useUniqueIdWithMock, Text as Text$1 } from '@khanacademy/wonder-blocks-core';
|
|
@@ -8,7 +8,7 @@ import Tooltip$1 from '@khanacademy/wonder-blocks-tooltip';
|
|
|
8
8
|
import classNames from 'classnames';
|
|
9
9
|
import * as React from 'react';
|
|
10
10
|
import React__default, { useState, useEffect, useRef } from 'react';
|
|
11
|
-
import _, { debounce } from 'underscore';
|
|
11
|
+
import _, { debounce as debounce$1 } from 'underscore';
|
|
12
12
|
import Clickable from '@khanacademy/wonder-blocks-clickable';
|
|
13
13
|
import Color, { fade } from '@khanacademy/wonder-blocks-color';
|
|
14
14
|
import { Popover, PopoverContentCore, PopoverContent } from '@khanacademy/wonder-blocks-popover';
|
|
@@ -28,7 +28,7 @@ import Button from '@khanacademy/wonder-blocks-button';
|
|
|
28
28
|
import { Strut } from '@khanacademy/wonder-blocks-layout';
|
|
29
29
|
import Banner from '@khanacademy/wonder-blocks-banner';
|
|
30
30
|
import { OptionItem, SingleSelect, MultiSelect } from '@khanacademy/wonder-blocks-dropdown';
|
|
31
|
-
import debounce$
|
|
31
|
+
import debounce$2 from 'lodash.debounce';
|
|
32
32
|
import { vec, Line as Line$3, MovablePoint as MovablePoint$5, Coordinates, Mafs } from 'mafs';
|
|
33
33
|
import createReactClass from 'create-react-class';
|
|
34
34
|
import Switch from '@khanacademy/wonder-blocks-switch';
|
|
@@ -66,6 +66,18 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
66
66
|
return target;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
const debounce = (func, delay) => {
|
|
70
|
+
let timer = null;
|
|
71
|
+
return (...args) => {
|
|
72
|
+
if (timer) {
|
|
73
|
+
clearTimeout(timer);
|
|
74
|
+
}
|
|
75
|
+
timer = window.setTimeout(() => {
|
|
76
|
+
func(...args);
|
|
77
|
+
}, delay);
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
|
|
69
81
|
const customKeyTranslator = _extends({}, keyTranslator, {
|
|
70
82
|
// If there's something in the input that can become part of a
|
|
71
83
|
// fraction, typing "/" puts it in the numerator. If not, typing
|
|
@@ -119,7 +131,7 @@ class MathInput extends React.Component {
|
|
|
119
131
|
// Initialize MathQuill.MathField instance
|
|
120
132
|
this.__mathField = createMathField(this.__mathFieldWrapperRef, baseConfig => _extends({}, baseConfig, {
|
|
121
133
|
handlers: {
|
|
122
|
-
edit: mathField => {
|
|
134
|
+
edit: debounce(mathField => {
|
|
123
135
|
// This handler is guaranteed to be called on change, but
|
|
124
136
|
// unlike React it sometimes generates false positives.
|
|
125
137
|
// One of these is on initialization (with an empty string
|
|
@@ -155,7 +167,7 @@ class MathInput extends React.Component {
|
|
|
155
167
|
this.setState({
|
|
156
168
|
cursorContext: getCursorContext(mathField)
|
|
157
169
|
});
|
|
158
|
-
},
|
|
170
|
+
}, 100),
|
|
159
171
|
enter: () => {
|
|
160
172
|
// NOTE(kevinb): This isn't how answers to exercises are
|
|
161
173
|
// submitted. The actual mechanism for this can be found
|
|
@@ -18540,7 +18552,7 @@ class TranslationLinter {
|
|
|
18540
18552
|
* Linting is relatively expensive -- so we debounce linting each instance
|
|
18541
18553
|
* for some amount of time.
|
|
18542
18554
|
*/
|
|
18543
|
-
this.runLinter = debounce((perseusStr, onLintErrorsGenerated) => {
|
|
18555
|
+
this.runLinter = debounce$1((perseusStr, onLintErrorsGenerated) => {
|
|
18544
18556
|
// TODO(FEI-5003): Do we still need to check for 'KA'?
|
|
18545
18557
|
if (typeof KA === "undefined") {
|
|
18546
18558
|
return;
|
|
@@ -29815,7 +29827,7 @@ class InteractiveGraph extends React.Component {
|
|
|
29815
29827
|
// eslint-disable-next-line no-restricted-syntax
|
|
29816
29828
|
setTimeout(point$1.remove.bind(point$1), 0);
|
|
29817
29829
|
};
|
|
29818
|
-
const setInitialMove = debounce$
|
|
29830
|
+
const setInitialMove = debounce$2((point, bool) => {
|
|
29819
29831
|
point.state.isInitialMove = bool;
|
|
29820
29832
|
}, 1000);
|
|
29821
29833
|
const onMoveEndHandler = coord => {
|
|
@@ -41167,7 +41179,7 @@ const init = function init(options) {
|
|
|
41167
41179
|
|
|
41168
41180
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
41169
41181
|
const libName = "@khanacademy/perseus";
|
|
41170
|
-
const libVersion = "20.0.
|
|
41182
|
+
const libVersion = "20.0.2";
|
|
41171
41183
|
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
41172
41184
|
|
|
41173
41185
|
const apiVersion = {
|