@khanacademy/math-input 20.1.2 → 21.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/es/index.js CHANGED
@@ -1,9 +1,10 @@
1
1
  import { addLibraryVersionToPerseusDebug } from '@khanacademy/perseus-core';
2
+ import { KeypadContext } from '@khanacademy/keypad-context';
2
3
  import { color } from '@khanacademy/wonder-blocks-tokens';
3
4
  import { entries } from '@khanacademy/wonder-stuff-core';
4
5
  import { StyleSheet, css } from 'aphrodite';
5
6
  import * as React from 'react';
6
- import { useContext, useState, useMemo, useRef, useEffect } from 'react';
7
+ import { useContext, useRef, useEffect, useState } from 'react';
7
8
  import ReactDOM from 'react-dom';
8
9
  import { SpeechRuleEngine } from '@khanacademy/mathjax-renderer';
9
10
  import MathQuill from 'mathquill';
@@ -15,7 +16,7 @@ import PropTypes from 'prop-types';
15
16
 
16
17
  // This file is processed by a Rollup plugin (replace) to inject the production
17
18
  const libName = "@khanacademy/math-input";
18
- const libVersion = "20.1.2";
19
+ const libVersion = "21.0.0";
19
20
  addLibraryVersionToPerseusDebug(libName, libVersion);
20
21
 
21
22
  function _extends() {
@@ -212,49 +213,6 @@ function MathInputI18nContextProvider({
212
213
  }
213
214
  const useMathInputI18n = () => useContext(MathInputI18nContext);
214
215
 
215
- /**
216
- * KeypadContext provides a way to the Keypad and Perseus Renderers to
217
- * communicate.
218
- *
219
- * The StatefulKeypadContextProvider wraps the application
220
- * while KeypadContext.Consumer wraps things that need this state:
221
- * - mobile keypad usages
222
- * - Perseus Renderers (Server/Item/Article)
223
- */
224
- // @ts-expect-error - TS2322 - Type 'Context<{ setKeypadElement: (keypadElement: HTMLElement | null | undefined) => void; keypadElement: null; setRenderer: (renderer: RendererInterface | null | undefined) => void; renderer: null; setScrollableElement: (scrollableElement: HTMLElement | ... 1 more ... | undefined) => void; scrollableElement: null; }>' is not assignable to type 'Context<KeypadContext>'.
225
- const KeypadContext = /*#__PURE__*/React.createContext({
226
- setKeypadActive: keypadActive => {},
227
- keypadActive: false,
228
- setKeypadElement: keypadElement => {},
229
- keypadElement: null,
230
- setRenderer: renderer => {},
231
- renderer: null,
232
- setScrollableElement: scrollableElement => {},
233
- scrollableElement: null
234
- });
235
- function StatefulKeypadContextProvider(props) {
236
- // whether or not to display the keypad
237
- const [keypadActive, setKeypadActive] = useState(false);
238
- // used to communicate between the keypad and the Renderer
239
- const [keypadElement, setKeypadElement] = useState();
240
- // this is a KeypadContextRendererInterface from Perseus
241
- const [renderer, setRenderer] = useState();
242
- const [scrollableElement, setScrollableElement] = useState();
243
- const memoizedValue = useMemo(() => ({
244
- keypadActive,
245
- setKeypadActive,
246
- keypadElement,
247
- setKeypadElement,
248
- renderer,
249
- setRenderer,
250
- scrollableElement,
251
- setScrollableElement
252
- }), [keypadActive, setKeypadActive, keypadElement, setKeypadElement, renderer, setRenderer, scrollableElement, setScrollableElement]);
253
- return /*#__PURE__*/React.createElement(KeypadContext.Provider, {
254
- value: memoizedValue
255
- }, props.children);
256
- }
257
-
258
216
  /**
259
217
  * Common parameters used to style components.
260
218
  */
@@ -5797,5 +5755,5 @@ let KeypadType = /*#__PURE__*/function (KeypadType) {
5797
5755
  return KeypadType;
5798
5756
  }({});
5799
5757
 
5800
- export { CursorContext, Keypad as DesktopKeypad, KeyArray, KeyConfigs, KeypadContext, MathInput as KeypadInput, KeypadType, MathInputI18nContext, MathInputI18nContextProvider, MobileKeypad, StatefulKeypadContextProvider, convertDotToTimesByLocale, createMathField, getCursorContext, getKeyTranslator, keypadElementPropType, libVersion, mathQuillInstance, useMathInputI18n };
5758
+ export { CursorContext, Keypad as DesktopKeypad, KeyArray, KeyConfigs, MathInput as KeypadInput, KeypadType, MathInputI18nContext, MathInputI18nContextProvider, MobileKeypad, convertDotToTimesByLocale, createMathField, getCursorContext, getKeyTranslator, keypadElementPropType, libVersion, mathQuillInstance, useMathInputI18n };
5801
5759
  //# sourceMappingURL=index.js.map