@khanacademy/perseus-core 3.4.0 → 3.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.
@@ -647,7 +647,7 @@ export type PerseusGraphTypeRay = {
647
647
  type AngleGraphCorrect = {
648
648
  type: "angle";
649
649
  allowReflexAngles: boolean;
650
- match: "congruent";
650
+ match?: "congruent";
651
651
  coords: [Coord, Coord, Coord];
652
652
  };
653
653
  type CircleGraphCorrect = {
package/dist/es/index.js CHANGED
@@ -4492,7 +4492,7 @@ function _objectWithoutPropertiesLoose(r, e) {
4492
4492
  if (null == r) return {};
4493
4493
  var t = {};
4494
4494
  for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
4495
- if (e.includes(n)) continue;
4495
+ if (-1 !== e.indexOf(n)) continue;
4496
4496
  t[n] = r[n];
4497
4497
  }
4498
4498
  return t;
@@ -4506,7 +4506,7 @@ const parseHint = object({
4506
4506
  images: parseImages
4507
4507
  });
4508
4508
 
4509
- const _excluded$5 = ["type", "options"];
4509
+ const _excluded$a = ["type", "options"];
4510
4510
  const parsePerseusItem$1 = object({
4511
4511
  question: parsePerseusRenderer,
4512
4512
  hints: defaulted(array(parseHint), () => []),
@@ -4533,7 +4533,7 @@ const parsePerseusItem$1 = object({
4533
4533
  // The "type" and "options" fields don't seem to be used anywhere. This
4534
4534
  // migration function removes them.
4535
4535
  function migrateAnswerArea(rawValue, ctx) {
4536
- const rest = _objectWithoutPropertiesLoose(rawValue, _excluded$5);
4536
+ const rest = _objectWithoutPropertiesLoose(rawValue, _excluded$a);
4537
4537
  return ctx.success(rest);
4538
4538
  }
4539
4539
 
@@ -4611,7 +4611,7 @@ function throwErrorIfCheatingDetected() {
4611
4611
 
4612
4612
  // This file is processed by a Rollup plugin (replace) to inject the production
4613
4613
  const libName = "@khanacademy/perseus-core";
4614
- const libVersion = "3.4.0";
4614
+ const libVersion = "3.5.0";
4615
4615
  addLibraryVersionToPerseusDebug(libName, libVersion);
4616
4616
 
4617
4617
  /**
@@ -4996,7 +4996,7 @@ const matrixWidgetLogic = {
4996
4996
  defaultWidgetOptions: defaultWidgetOptions$e
4997
4997
  };
4998
4998
 
4999
- const _excluded$4 = ["imageUrl", "imageTop", "imageLeft"];
4999
+ const _excluded$9 = ["imageUrl", "imageTop", "imageLeft"];
5000
5000
  const currentVersion$2 = {
5001
5001
  major: 1,
5002
5002
  minor: 0
@@ -5008,7 +5008,7 @@ const widgetOptionsUpgrades$1 = {
5008
5008
  imageTop,
5009
5009
  imageLeft
5010
5010
  } = v0options,
5011
- rest = _objectWithoutPropertiesLoose(v0options, _excluded$4);
5011
+ rest = _objectWithoutPropertiesLoose(v0options, _excluded$9);
5012
5012
  return _extends({}, rest, {
5013
5013
  image: {
5014
5014
  url: imageUrl,
@@ -5166,7 +5166,7 @@ const pythonProgramWidgetLogic = {
5166
5166
  defaultWidgetOptions: defaultWidgetOptions$4
5167
5167
  };
5168
5168
 
5169
- const _excluded$3 = ["noneOfTheAbove"];
5169
+ const _excluded$8 = ["noneOfTheAbove"];
5170
5170
  const currentVersion = {
5171
5171
  major: 1,
5172
5172
  minor: 0
@@ -5176,7 +5176,7 @@ const widgetOptionsUpgrades = {
5176
5176
  const {
5177
5177
  noneOfTheAbove
5178
5178
  } = v0props,
5179
- rest = _objectWithoutPropertiesLoose(v0props, _excluded$3);
5179
+ rest = _objectWithoutPropertiesLoose(v0props, _excluded$8);
5180
5180
  if (noneOfTheAbove) {
5181
5181
  throw new Error("radio widget v0 no longer supports auto noneOfTheAbove");
5182
5182
  }
@@ -5524,7 +5524,19 @@ function getExpressionPublicWidgetOptions(options) {
5524
5524
  };
5525
5525
  }
5526
5526
 
5527
- const _excluded$2 = ["answers"];
5527
+ const _excluded$7 = ["correct"];
5528
+ function getGrapherPublicWidgetOptions(options) {
5529
+ const publicOptions = _objectWithoutPropertiesLoose(options, _excluded$7);
5530
+ return publicOptions;
5531
+ }
5532
+
5533
+ const _excluded$6 = ["correct"];
5534
+ function getInteractiveGraphPublicWidgetOptions(options) {
5535
+ const publicOptions = _objectWithoutPropertiesLoose(options, _excluded$6);
5536
+ return publicOptions;
5537
+ }
5538
+
5539
+ const _excluded$5 = ["answers"];
5528
5540
  /**
5529
5541
  * For details on the individual options, see the
5530
5542
  * PerseusLabelImageWidgetOptions type
@@ -5536,7 +5548,7 @@ function getLabelImagePublicWidgetOptions(options) {
5536
5548
  });
5537
5549
  }
5538
5550
  function getLabelImageMarkerPublicData(marker) {
5539
- const publicData = _objectWithoutPropertiesLoose(marker, _excluded$2);
5551
+ const publicData = _objectWithoutPropertiesLoose(marker, _excluded$5);
5540
5552
  return publicData;
5541
5553
  }
5542
5554
 
@@ -5581,7 +5593,7 @@ function getDropdownPublicWidgetOptions(options) {
5581
5593
  };
5582
5594
  }
5583
5595
 
5584
- const _excluded$1 = ["answers"];
5596
+ const _excluded$4 = ["answers"];
5585
5597
  /**
5586
5598
  * For details on the individual options, see the
5587
5599
  * PerseusNumericInputWidgetOptions type
@@ -5592,15 +5604,82 @@ const _excluded$1 = ["answers"];
5592
5604
  * the public options that should be exposed to the client.
5593
5605
  */
5594
5606
  function getNumericInputPublicWidgetOptions(options) {
5595
- const publicWidgetOptions = _objectWithoutPropertiesLoose(options, _excluded$1);
5607
+ const publicWidgetOptions = _objectWithoutPropertiesLoose(options, _excluded$4);
5596
5608
  return publicWidgetOptions;
5597
5609
  }
5598
5610
 
5599
- const _excluded = ["correctX", "correctRel"];
5611
+ const _excluded$3 = ["correctX", "correctRel"];
5600
5612
  function getNumberLinePublicWidgetOptions(options) {
5613
+ const publicOptions = _objectWithoutPropertiesLoose(options, _excluded$3);
5614
+ return publicOptions;
5615
+ }
5616
+
5617
+ /**
5618
+ * For details on the individual options, see the
5619
+ * PerseusRadioWidgetOptions type
5620
+ */
5621
+
5622
+ /**
5623
+ * Only the options from each Radio choice that should be exposed to the client.
5624
+ */
5625
+
5626
+ /**
5627
+ * Given a PerseusRadioChoice object, return a new object with only the public
5628
+ * data that should be included in the Radio public widget options.
5629
+ */
5630
+ function getRadioChoicePublicData(choice) {
5631
+ const {
5632
+ content,
5633
+ isNoneOfTheAbove,
5634
+ widgets
5635
+ } = choice;
5636
+ return {
5637
+ content,
5638
+ isNoneOfTheAbove,
5639
+ widgets
5640
+ };
5641
+ }
5642
+
5643
+ /**
5644
+ * Given a PerseusRadioWidgetOptions object, return a new object with only
5645
+ * the public options that should be exposed to the client.
5646
+ */
5647
+ function getRadioPublicWidgetOptions(options) {
5648
+ return _extends({}, options, {
5649
+ choices: options.choices.map(getRadioChoicePublicData)
5650
+ });
5651
+ }
5652
+
5653
+ const _excluded$2 = ["answers"];
5654
+ function getTablePublicWidgetOptions(options) {
5655
+ const publicOptions = _objectWithoutPropertiesLoose(options, _excluded$2);
5656
+ return publicOptions;
5657
+ }
5658
+
5659
+ function getIFramePublicWidgetOptions(options) {
5660
+ return options;
5661
+ }
5662
+
5663
+ const _excluded$1 = ["answers"];
5664
+ function getMatrixPublicWidgetOptions(options) {
5665
+ const publicOptions = _objectWithoutPropertiesLoose(options, _excluded$1);
5666
+ return publicOptions;
5667
+ }
5668
+
5669
+ const _excluded = ["correct"];
5670
+ /**
5671
+ * For details on the individual options, see the
5672
+ * PerseusPlotterWidgetOptions type
5673
+ */
5674
+
5675
+ /**
5676
+ * Given a PerseusPlotterWidgetOptions object, return a new object with only
5677
+ * the public options that should be exposed to the client.
5678
+ */
5679
+ function getPlotterPublicWidgetOptions(options) {
5601
5680
  const publicOptions = _objectWithoutPropertiesLoose(options, _excluded);
5602
5681
  return publicOptions;
5603
5682
  }
5604
5683
 
5605
- export { coreWidgetRegistry as CoreWidgetRegistry, Errors, grapherUtil as GrapherUtil, ItemExtras, PerseusError, PerseusExpressionAnswerFormConsidered, addLibraryVersionToPerseusDebug, addWidget, approximateDeepEqual, approximateEqual, categorizerWidgetLogic as categorizerLogic, csProgramWidgetLogic as csProgramLogic, deepClone, definitionWidgetLogic as definitionLogic, dropdownWidgetLogic as dropdownLogic, explanationWidgetLogic as explanationLogic, expressionWidgetLogic as expressionLogic, getCSProgramPublicWidgetOptions, getCategorizerPublicWidgetOptions, getDecimalSeparator, getDropdownPublicWidgetOptions, getExpressionPublicWidgetOptions, getLabelImagePublicWidgetOptions, getMatrixSize, getNumberLinePublicWidgetOptions, getNumericInputPublicWidgetOptions, getOrdererPublicWidgetOptions, getSorterPublicWidgetOptions, getUpgradedWidgetOptions, getWidgetIdsFromContent, getWidgetIdsFromContentByType, gradedGroupWidgetLogic as gradedGroupLogic, gradedGroupSetWidgetLogic as gradedGroupSetLogic, grapherWidgetLogic as grapherLogic, groupWidgetLogic as groupLogic, iframeWidgetLogic as iframeLogic, imageWidgetLogic as imageLogic, inputNumberWidgetLogic as inputNumberLogic, interactionWidgetLogic as interactionLogic, interactiveGraphWidgetLogic as interactiveGraphLogic, isFailure, isSuccess, labelImageWidgetLogic as labelImageLogic, libVersion, lockedFigureColorNames, lockedFigureColors, lockedFigureFillStyles, mapObject, matcherWidgetLogic as matcherLogic, matrixWidgetLogic as matrixLogic, measurerWidgetLogic as measurerLogic, numberLineWidgetLogic as numberLineLogic, numericInputWidgetLogic as numericInputLogic, ordererWidgetLogic as ordererLogic, parseAndMigratePerseusArticle, parseAndMigratePerseusItem, parsePerseusItem, passageWidgetLogic as passageLogic, passageRefWidgetLogic as passageRefLogic, passageRefTargetWidgetLogic as passageRefTargetLogic, phetSimulationWidgetLogic as phetSimulationLogic, plotterWidgetLogic as plotterLogic, plotterPlotTypes, pluck, pythonProgramWidgetLogic as pythonProgramLogic, radioWidgetLogic as radioLogic, sorterWidgetLogic as sorterLogic, tableWidgetLogic as tableLogic, upgradeWidgetInfoToLatestVersion, videoWidgetLogic as videoLogic };
5684
+ export { coreWidgetRegistry as CoreWidgetRegistry, Errors, grapherUtil as GrapherUtil, ItemExtras, PerseusError, PerseusExpressionAnswerFormConsidered, addLibraryVersionToPerseusDebug, addWidget, approximateDeepEqual, approximateEqual, categorizerWidgetLogic as categorizerLogic, csProgramWidgetLogic as csProgramLogic, deepClone, definitionWidgetLogic as definitionLogic, dropdownWidgetLogic as dropdownLogic, explanationWidgetLogic as explanationLogic, expressionWidgetLogic as expressionLogic, getCSProgramPublicWidgetOptions, getCategorizerPublicWidgetOptions, getDecimalSeparator, getDropdownPublicWidgetOptions, getExpressionPublicWidgetOptions, getGrapherPublicWidgetOptions, getIFramePublicWidgetOptions, getInteractiveGraphPublicWidgetOptions, getLabelImagePublicWidgetOptions, getMatrixPublicWidgetOptions, getMatrixSize, getNumberLinePublicWidgetOptions, getNumericInputPublicWidgetOptions, getOrdererPublicWidgetOptions, getPlotterPublicWidgetOptions, getRadioPublicWidgetOptions, getSorterPublicWidgetOptions, getTablePublicWidgetOptions, getUpgradedWidgetOptions, getWidgetIdsFromContent, getWidgetIdsFromContentByType, gradedGroupWidgetLogic as gradedGroupLogic, gradedGroupSetWidgetLogic as gradedGroupSetLogic, grapherWidgetLogic as grapherLogic, groupWidgetLogic as groupLogic, iframeWidgetLogic as iframeLogic, imageWidgetLogic as imageLogic, inputNumberWidgetLogic as inputNumberLogic, interactionWidgetLogic as interactionLogic, interactiveGraphWidgetLogic as interactiveGraphLogic, isFailure, isSuccess, labelImageWidgetLogic as labelImageLogic, libVersion, lockedFigureColorNames, lockedFigureColors, lockedFigureFillStyles, mapObject, matcherWidgetLogic as matcherLogic, matrixWidgetLogic as matrixLogic, measurerWidgetLogic as measurerLogic, numberLineWidgetLogic as numberLineLogic, numericInputWidgetLogic as numericInputLogic, ordererWidgetLogic as ordererLogic, parseAndMigratePerseusArticle, parseAndMigratePerseusItem, parsePerseusItem, passageWidgetLogic as passageLogic, passageRefWidgetLogic as passageRefLogic, passageRefTargetWidgetLogic as passageRefTargetLogic, phetSimulationWidgetLogic as phetSimulationLogic, plotterWidgetLogic as plotterLogic, plotterPlotTypes, pluck, pythonProgramWidgetLogic as pythonProgramLogic, radioWidgetLogic as radioLogic, sorterWidgetLogic as sorterLogic, tableWidgetLogic as tableLogic, upgradeWidgetInfoToLatestVersion, videoWidgetLogic as videoLogic };
5606
5685
  //# sourceMappingURL=index.js.map