@khanacademy/perseus 17.3.3 → 17.5.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/index.css CHANGED
@@ -2508,7 +2508,7 @@ img.zoom-img {
2508
2508
  padding-bottom: 2px;
2509
2509
  }
2510
2510
  .framework-perseus:not(.perseus-mobile) table tr:nth-child(odd) td {
2511
- background-color: #ededed;
2511
+ background-color: #f7f8fa;
2512
2512
  }
2513
2513
  .framework-perseus:not(.perseus-mobile) .perseus-titled-table {
2514
2514
  display: inline-block;
package/dist/index.d.ts CHANGED
@@ -81,7 +81,7 @@ export type { ILogger, LogErrorOptions, ErrorKind } from "./logging/log";
81
81
  export type { ServerItemRenderer as ServerItemRendererComponent } from "./server-item-renderer";
82
82
  export type { Alignment, APIOptions, APIOptionsWithDefaults, ChangeHandler, DeviceType, DomInsertCheckFn, EditorMode, FocusPath, Hint, ImageDict, ImageUploader, JiptLabelStore, JiptRenderer, PerseusDependencies, PerseusScore, Version, VideoData, VideoKind, WidgetDict, WidgetExports, WidgetInfo, } from "./types";
83
83
  export type { ParsedValue } from "./util";
84
- export type { MathFormat, InputNumberWidget, PerseusImageBackground, PerseusInteractiveGraphWidgetOptions, PerseusRadioWidgetOptions, PerseusExpressionWidgetOptions, PerseusPlotterWidgetOptions, PerseusRenderer, PerseusAnswerArea, } from "./perseus-types";
84
+ export type { InputNumberWidget, MathFormat, PerseusAnswerArea, PerseusExpressionWidgetOptions, PerseusImageBackground, PerseusInteractiveGraphWidgetOptions, PerseusItem, PerseusPlotterWidgetOptions, PerseusRadioWidgetOptions, PerseusRenderer, } from "./perseus-types";
85
85
  export type { Coord } from "./interactive2/types";
86
86
  export type { MarkerType } from "./widgets/label-image/types";
87
87
  /**
package/dist/index.js CHANGED
@@ -44337,7 +44337,7 @@ const init = function (options) {
44337
44337
 
44338
44338
  // This file is processed by a Rollup plugin (replace) to inject the production
44339
44339
  const libName = "@khanacademy/perseus";
44340
- const libVersion = "17.3.3";
44340
+ const libVersion = "17.5.0";
44341
44341
  perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
44342
44342
 
44343
44343
  const apiVersion = {
@@ -44404,8 +44404,16 @@ class ArticleRenderer extends React__namespace.Component {
44404
44404
  });
44405
44405
  focusedInput = this.sectionRenderers[sectionIndex].getDOMNodeForPath(focusPath);
44406
44406
  }
44407
- if (this.props.apiOptions.onFocusChange != null) {
44408
- this.props.apiOptions.onFocusChange(this._currentFocus, prevFocusPath, didFocusInput ? keypadElement?.getDOMNode() : null, didFocusInput ? focusedInput : null);
44407
+ const {
44408
+ onFocusChange
44409
+ } = this.props.apiOptions;
44410
+ if (onFocusChange) {
44411
+ // Wait for the keypad to mount before getting the height
44412
+ setTimeout(() => {
44413
+ const keypadDomNode = keypadElement?.getDOMNode();
44414
+ const keypadHeight = keypadDomNode && didFocusInput ? keypadDomNode.getBoundingClientRect().height : 0;
44415
+ onFocusChange(this._currentFocus, prevFocusPath, keypadHeight, didFocusInput ? focusedInput : null);
44416
+ }, 0);
44409
44417
  }
44410
44418
  if (keypadElement && isMobile) {
44411
44419
  if (didFocusInput) {
@@ -44952,9 +44960,17 @@ class ServerItemRenderer extends React__namespace.Component {
44952
44960
  return Util.inputPathsEqual(inputPath, this._currentFocus);
44953
44961
  });
44954
44962
  if (onFocusChange != null) {
44955
- onFocusChange(this._currentFocus, prevFocus, didFocusInput ? keypadElement?.getDOMNode() : null,
44956
- // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'false | Element | Text | null | undefined' is not assignable to parameter of type 'HTMLElement | undefined'.
44957
- didFocusInput && this.questionRenderer.getDOMNodeForPath(newFocus));
44963
+ // Wait for the keypad to mount before getting the height
44964
+ setTimeout(() => {
44965
+ // First, calculate the current keypad height
44966
+ const keypadDomNode = keypadElement?.getDOMNode();
44967
+ const keypadHeight = keypadDomNode && didFocusInput ? keypadDomNode.getBoundingClientRect().height : 0;
44968
+
44969
+ // Then call the callback
44970
+ onFocusChange(this._currentFocus, prevFocus, keypadHeight,
44971
+ // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'false | Element | Text | null | undefined' is not assignable to parameter of type 'HTMLElement | undefined'.
44972
+ didFocusInput && this.questionRenderer.getDOMNodeForPath(newFocus));
44973
+ }, 0);
44958
44974
  }
44959
44975
  if (keypadElement && isMobile) {
44960
44976
  if (didFocusInput) {