@khanacademy/perseus 7.0.0 → 7.0.1

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 CHANGED
@@ -1,5 +1,16 @@
1
1
  # @khanacademy/perseus
2
2
 
3
+ ## 7.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 5611204a: Adds back the export of the unwrapped keypad for Khanmigo
8
+ - Updated dependencies [b4c06409]
9
+ - Updated dependencies [5611204a]
10
+ - Updated dependencies [b4430dce]
11
+ - @khanacademy/perseus-core@0.1.0
12
+ - @khanacademy/math-input@8.1.0
13
+
3
14
  ## 7.0.0
4
15
 
5
16
  ### Major Changes
package/dist/es/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as KAS from '@khanacademy/kas';
2
- import { keyTranslator, createMathField, mathQuillInstance, KeypadInput, KeypadType, keypadElementPropType, Keypad } from '@khanacademy/math-input';
2
+ import { keyTranslator, createMathField, mathQuillInstance, KeypadInput, KeypadType, keypadElementPropType, MobileKeypad } 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 * as i18n from '@khanacademy/wonder-blocks-i18n';
@@ -3618,6 +3618,21 @@ const supportsPassiveEvents = () => {
3618
3618
  function captureScratchpadTouchStart$4(e) {
3619
3619
  e.stopPropagation();
3620
3620
  }
3621
+ async function getImageSizeModern(url) {
3622
+ const image = new Image();
3623
+ return new Promise((resolve, reject) => {
3624
+ // Handle the success case
3625
+ image.onload = () => {
3626
+ resolve([image.naturalWidth, image.naturalHeight]);
3627
+ };
3628
+
3629
+ // Handle the error case
3630
+ image.onerror = reject;
3631
+
3632
+ // Kick off the loading
3633
+ image.src = url;
3634
+ });
3635
+ }
3621
3636
  function getImageSize(url, callback) {
3622
3637
  const img = new Image();
3623
3638
  img.onload = function () {
@@ -3752,6 +3767,7 @@ const Util = {
3752
3767
  supportsPassiveEvents,
3753
3768
  captureScratchpadTouchStart: captureScratchpadTouchStart$4,
3754
3769
  getImageSize,
3770
+ getImageSizeModern,
3755
3771
  getRealImageUrl,
3756
3772
  isLabeledSVG,
3757
3773
  getBaseUrl,
@@ -43960,7 +43976,7 @@ const ProvideKeypad = {
43960
43976
  _this._keypadContainer = document.createElement("div");
43961
43977
  // @ts-expect-error [FEI-5003] - TS2339 - Property '_keypadContainer' does not exist on type '{ readonly propTypes: { readonly apiOptions: React.PropType<{ customKeypad?: boolean | undefined; nativeKeypadProxy?: ((...a: readonly any[]) => unknown) | undefined; }>; readonly keypadStyle: Requireable<any>; }; readonly getInitialState: () => { ...; }; readonly componentDidMount: () => void; readonly componentWil...'.
43962
43978
  (_document$body = document.body) == null ? void 0 : _document$body.appendChild(_this._keypadContainer);
43963
- render( /*#__PURE__*/React.createElement(Keypad, {
43979
+ render( /*#__PURE__*/React.createElement(MobileKeypad, {
43964
43980
  onElementMounted: element => {
43965
43981
  // NOTE(kevinb): The reason why this setState works is
43966
43982
  // b/c we're calling it manually from item-renderer.jsx