@khanacademy/perseus 17.4.0 → 17.6.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.js CHANGED
@@ -21509,7 +21509,7 @@ const propTransform$4 = widgetOptions => {
21509
21509
  };
21510
21510
  var InputNumber$1 = {
21511
21511
  name: "input-number",
21512
- displayName: "Number text box (old)",
21512
+ displayName: "Input number (deprecated - use numeric input instead)",
21513
21513
  defaultAlignment: "inline-block",
21514
21514
  hidden: true,
21515
21515
  widget: InputNumber,
@@ -21913,7 +21913,7 @@ const propsTransform = function (widgetOptions) {
21913
21913
  };
21914
21914
  var NumericInput$1 = {
21915
21915
  name: "numeric-input",
21916
- displayName: "Number text box",
21916
+ displayName: "Numeric input",
21917
21917
  defaultAlignment: "inline-block",
21918
21918
  accessible: true,
21919
21919
  widget: NumericInput,
@@ -23921,7 +23921,7 @@ const propUpgrades$1 = {
23921
23921
  };
23922
23922
  var Radio = {
23923
23923
  name: "radio",
23924
- displayName: "Multiple choice",
23924
+ displayName: "Radio / Multiple choice",
23925
23925
  accessible: true,
23926
23926
  widget: Radio$1,
23927
23927
  transform: transform,
@@ -26814,7 +26814,7 @@ ___default["default"].extend(Iframe, {
26814
26814
  });
26815
26815
  var Iframe$1 = {
26816
26816
  name: "iframe",
26817
- displayName: "Iframe",
26817
+ displayName: "Iframe (deprecated)",
26818
26818
  widget: Iframe,
26819
26819
  // Let's not expose it to all content creators yet
26820
26820
  hidden: true
@@ -32426,7 +32426,7 @@ const transformProps = function (editorProps) {
32426
32426
  };
32427
32427
  var LightsPuzzle$1 = {
32428
32428
  name: "lights-puzzle",
32429
- displayName: "Lights Puzzle",
32429
+ displayName: "Lights puzzle (deprecated)",
32430
32430
  hidden: true,
32431
32431
  widget: LightsPuzzle,
32432
32432
  transform: transformProps
@@ -33366,7 +33366,7 @@ const styles$d = aphrodite.StyleSheet.create({
33366
33366
  });
33367
33367
  var Matcher$1 = {
33368
33368
  name: "matcher",
33369
- displayName: "Two column matcher",
33369
+ displayName: "Matcher (two column)",
33370
33370
  widget: Matcher,
33371
33371
  isLintable: true
33372
33372
  };
@@ -39432,7 +39432,7 @@ class ReactionDiagramWidget extends React__namespace.Component {
39432
39432
  }
39433
39433
  var ReactionDiagram = {
39434
39434
  name: "reaction-diagram",
39435
- displayName: "Chemical reaction",
39435
+ displayName: "Chemical reaction diagram (deprecated)",
39436
39436
  hidden: true,
39437
39437
  widget: ReactionDiagramWidget
39438
39438
  };
@@ -39529,7 +39529,7 @@ const traverseChildWidgets = function (props, traverseRenderer) {
39529
39529
  };
39530
39530
  var Sequence$1 = {
39531
39531
  name: "sequence",
39532
- displayName: "Graded Sequence",
39532
+ displayName: "Graded sequence (deprecated)",
39533
39533
  widget: Sequence,
39534
39534
  traverseChildWidgets: traverseChildWidgets,
39535
39535
  tracking: "all",
@@ -40243,7 +40243,7 @@ const propTransform$1 = editorProps => {
40243
40243
  };
40244
40244
  var Simulator$1 = {
40245
40245
  name: "simulator",
40246
- displayName: "Simulator",
40246
+ displayName: "Simulator (deprecated)",
40247
40247
  widget: Simulator,
40248
40248
  transform: propTransform$1,
40249
40249
  hidden: true
@@ -40657,7 +40657,7 @@ const propTransform = editorProps => {
40657
40657
  };
40658
40658
  var Table$1 = {
40659
40659
  name: "table",
40660
- displayName: "Table of values",
40660
+ displayName: "Table (deprecated - use markdown table instead)",
40661
40661
  accessible: true,
40662
40662
  widget: Table,
40663
40663
  transform: propTransform,
@@ -43069,7 +43069,8 @@ class Transformer extends React__namespace.Component {
43069
43069
  }
43070
43070
  var Transformer$1 = {
43071
43071
  name: "transformer",
43072
- displayName: "Transformer",
43072
+ displayName: "Transformer (deprecated)",
43073
+ hidden: true,
43073
43074
  widget: Transformer
43074
43075
  };
43075
43076
 
@@ -44117,7 +44118,7 @@ const primUnits = function (expr) {
44117
44118
  };
44118
44119
  var Unit = {
44119
44120
  name: "unit-input",
44120
- displayName: "Unit",
44121
+ displayName: "Unit input",
44121
44122
  defaultAlignment: "inline-block",
44122
44123
  widget: OldUnitInput,
44123
44124
  transform: x => lens(x).del(["value"]).freeze(),
@@ -44337,7 +44338,7 @@ const init = function (options) {
44337
44338
 
44338
44339
  // This file is processed by a Rollup plugin (replace) to inject the production
44339
44340
  const libName = "@khanacademy/perseus";
44340
- const libVersion = "17.4.0";
44341
+ const libVersion = "17.6.0";
44341
44342
  perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
44342
44343
 
44343
44344
  const apiVersion = {
@@ -44404,6 +44405,17 @@ class ArticleRenderer extends React__namespace.Component {
44404
44405
  });
44405
44406
  focusedInput = this.sectionRenderers[sectionIndex].getDOMNodeForPath(focusPath);
44406
44407
  }
44408
+ const {
44409
+ onFocusChange
44410
+ } = this.props.apiOptions;
44411
+ if (onFocusChange) {
44412
+ // Wait for the keypad to mount before getting the height
44413
+ setTimeout(() => {
44414
+ const keypadDomNode = keypadElement?.getDOMNode();
44415
+ const keypadHeight = keypadDomNode && didFocusInput ? keypadDomNode.getBoundingClientRect().height : 0;
44416
+ onFocusChange(this._currentFocus, prevFocusPath, keypadHeight, didFocusInput ? focusedInput : null);
44417
+ }, 0);
44418
+ }
44407
44419
  if (keypadElement && isMobile) {
44408
44420
  if (didFocusInput) {
44409
44421
  keypadElement.activate();
@@ -44411,11 +44423,6 @@ class ArticleRenderer extends React__namespace.Component {
44411
44423
  keypadElement.dismiss();
44412
44424
  }
44413
44425
  }
44414
- if (this.props.apiOptions.onFocusChange != null) {
44415
- const keypadDomNode = keypadElement?.getDOMNode();
44416
- const keypadHeight = keypadDomNode && didFocusInput ? keypadDomNode.getBoundingClientRect().height : 0;
44417
- this.props.apiOptions.onFocusChange(this._currentFocus, prevFocusPath, keypadHeight, didFocusInput ? focusedInput : null);
44418
- }
44419
44426
  };
44420
44427
  _onRendererBlur = blurPath => {
44421
44428
  const blurringFocusPath = this._currentFocus;
@@ -44953,6 +44960,19 @@ class ServerItemRenderer extends React__namespace.Component {
44953
44960
  const didFocusInput = this._currentFocus && inputPaths.some(inputPath => {
44954
44961
  return Util.inputPathsEqual(inputPath, this._currentFocus);
44955
44962
  });
44963
+ if (onFocusChange != null) {
44964
+ // Wait for the keypad to mount before getting the height
44965
+ setTimeout(() => {
44966
+ // First, calculate the current keypad height
44967
+ const keypadDomNode = keypadElement?.getDOMNode();
44968
+ const keypadHeight = keypadDomNode && didFocusInput ? keypadDomNode.getBoundingClientRect().height : 0;
44969
+
44970
+ // Then call the callback
44971
+ onFocusChange(this._currentFocus, prevFocus, keypadHeight,
44972
+ // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'false | Element | Text | null | undefined' is not assignable to parameter of type 'HTMLElement | undefined'.
44973
+ didFocusInput && this.questionRenderer.getDOMNodeForPath(newFocus));
44974
+ }, 0);
44975
+ }
44956
44976
  if (keypadElement && isMobile) {
44957
44977
  if (didFocusInput) {
44958
44978
  keypadElement.activate();
@@ -44960,16 +44980,6 @@ class ServerItemRenderer extends React__namespace.Component {
44960
44980
  keypadElement.dismiss();
44961
44981
  }
44962
44982
  }
44963
- if (onFocusChange != null) {
44964
- // First, calculate the current keypad height
44965
- const keypadDomNode = keypadElement?.getDOMNode();
44966
- const keypadHeight = keypadDomNode && didFocusInput ? keypadDomNode.getBoundingClientRect().height : 0;
44967
-
44968
- // Then call the callback
44969
- onFocusChange(this._currentFocus, prevFocus, keypadHeight,
44970
- // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'false | Element | Text | null | undefined' is not assignable to parameter of type 'HTMLElement | undefined'.
44971
- didFocusInput && this.questionRenderer.getDOMNodeForPath(newFocus));
44972
- }
44973
44983
  }
44974
44984
  _onRendererBlur(blurPath) {
44975
44985
  const blurringFocusPath = this._currentFocus;