@khanacademy/perseus 32.0.0 → 32.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/dist/es/index.js CHANGED
@@ -3161,45 +3161,6 @@ function constrainedTickStepsFromTickSteps(tickSteps, ranges) {
3161
3161
  return [constrainTickStep(tickSteps[0], ranges[0]), constrainTickStep(tickSteps[1], ranges[1])];
3162
3162
  }
3163
3163
 
3164
- /**
3165
- * Transparently update deprecated props so that the code to deal
3166
- * with them only lives in one place: (Widget).deprecatedProps
3167
- *
3168
- * For example, if a boolean `foo` was deprecated in favor of a
3169
- * number 'bar':
3170
- * deprecatedProps: {
3171
- * foo: function(props) {
3172
- * return {bar: props.foo ? 1 : 0};
3173
- * }
3174
- * }
3175
- */
3176
- const DeprecationMixin$1 = {
3177
- // This lifecycle stage is only called before first render
3178
- // TODO(jangmi, CP-3288): Remove usage of `UNSAFE_componentWillMount`
3179
- UNSAFE_componentWillMount: function () {
3180
- const newProps = {};
3181
- _.each(this.deprecatedProps, function (func, prop) {
3182
- // @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
3183
- if (_.has(this.props, prop)) {
3184
- // @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
3185
- _.extend(newProps, func(this.props));
3186
- }
3187
- }, this);
3188
- if (!_.isEmpty(newProps)) {
3189
- // Set new props directly so that widget renders correctly
3190
- // when it first mounts, even though these will be overwritten
3191
- // almost immediately afterwards...
3192
- _.extend(this.props, newProps);
3193
-
3194
- // ...when we propagate the new props upwards and they come
3195
- // back down again.
3196
- // TODO(jeff, CP-3128): Use Wonder Blocks Timing API
3197
- // eslint-disable-next-line no-restricted-syntax
3198
- setTimeout(this.props.onChange, 0, newProps);
3199
- }
3200
- }
3201
- };
3202
-
3203
3164
  /**
3204
3165
  * Approximate equality on numbers and primitives.
3205
3166
  */
@@ -3547,7 +3508,6 @@ const Util = {
3547
3508
  gridStepFromTickStep,
3548
3509
  tickStepFromNumTicks,
3549
3510
  constrainedTickStepsFromTickSteps,
3550
- DeprecationMixin: DeprecationMixin$1,
3551
3511
  eq: eq$3,
3552
3512
  deepEq: deepEq$5,
3553
3513
  parseQueryString,
@@ -33316,9 +33276,6 @@ const StatefulMafsGraph = /*#__PURE__*/React.forwardRef((props, ref) => {
33316
33276
  }));
33317
33277
  });
33318
33278
 
33319
- const {
33320
- DeprecationMixin
33321
- } = Util;
33322
33279
  const TRASH_ICON_URI = "https://ka-perseus-graphie.s3.amazonaws.com/b1452c0d79fd0f7ff4c3af9488474a0a0decb361.png";
33323
33280
  const defaultBackgroundImage = {
33324
33281
  url: null
@@ -33347,13 +33304,6 @@ function capitalize(str) {
33347
33304
  function numSteps(range, step) {
33348
33305
  return Math.floor((range[1] - range[0]) / step);
33349
33306
  }
33350
- const deprecatedProps = {
33351
- showGraph: function (props) {
33352
- return {
33353
- markings: props.showGraph ? "graph" : "none"
33354
- };
33355
- }
33356
- };
33357
33307
  const _getShouldShowInstructions = props => {
33358
33308
  return _isClickToAddPoints(props) && (
33359
33309
  // @ts-expect-error - TS2339 - Property 'coords' does not exist on type 'PerseusGraphType'. | TS2339 - Property 'coords' does not exist on type 'PerseusGraphType'.
@@ -33406,7 +33356,6 @@ class LegacyInteractiveGraph extends React.Component {
33406
33356
  // @ts-expect-error - TS2339 - Property 'coords' does not exist on type 'PerseusGraphType'. | TS2339 - Property 'coords' does not exist on type 'PerseusGraphType'.
33407
33357
  props.graph.coords == null || props.graph.coords.length === 0);
33408
33358
  };
33409
- this.deprecatedProps = deprecatedProps;
33410
33359
  this.setGraphie = newGraphie => {
33411
33360
  this.graphie = newGraphie;
33412
33361
  this.setupGraphie();
@@ -34479,10 +34428,6 @@ class LegacyInteractiveGraph extends React.Component {
34479
34428
  };
34480
34429
  this.focus = $.noop;
34481
34430
  }
34482
- // TODO(jangmi, CP-3288): Remove usage of `UNSAFE_componentWillMount`
34483
- UNSAFE_componentWillMount() {
34484
- DeprecationMixin.UNSAFE_componentWillMount.call(this);
34485
- }
34486
34431
  componentDidMount() {
34487
34432
  if (this.refs.graph) {
34488
34433
  // eslint-disable-next-line react/no-string-refs
@@ -43161,7 +43106,7 @@ class PhetSimulation extends React.Component {
43161
43106
  // http://www.html5rocks.com/en/tutorials/security/sandboxed-iframes/
43162
43107
  const sandboxProperties = "allow-same-origin allow-scripts";
43163
43108
  return /*#__PURE__*/React.createElement(View, {
43164
- style: styles$6.container
43109
+ style: styles$6.widgetContainer
43165
43110
  }, this.state.banner !== null &&
43166
43111
  /*#__PURE__*/
43167
43112
  // TODO(anna): Make this banner focusable
@@ -43173,18 +43118,16 @@ class PhetSimulation extends React.Component {
43173
43118
  layout: "floating",
43174
43119
  kind: this.state.banner.kind,
43175
43120
  text: this.state.banner.message
43176
- })), /*#__PURE__*/React.createElement("iframe", {
43121
+ })), /*#__PURE__*/React.createElement(View, {
43122
+ style: styles$6.iframeContainer
43123
+ }, /*#__PURE__*/React.createElement("iframe", {
43177
43124
  ref: this.iframeRef,
43178
43125
  title: this.props.description,
43179
43126
  sandbox: sandboxProperties,
43180
- style: {
43181
- height: 225,
43182
- width: "100%",
43183
- borderWidth: 0
43184
- },
43127
+ className: css(styles$6.iframeResponsive),
43185
43128
  src: (_this$state$url = this.state.url) == null ? void 0 : _this$state$url.toString(),
43186
43129
  allow: "fullscreen"
43187
- }), /*#__PURE__*/React.createElement(IconButton, {
43130
+ })), /*#__PURE__*/React.createElement(IconButton, {
43188
43131
  icon: cornersOutIcon,
43189
43132
  onClick: () => {
43190
43133
  var _this$iframeRef$curre;
@@ -43216,14 +43159,29 @@ const makeSafeUrl = (urlString, locale) => {
43216
43159
  return url;
43217
43160
  };
43218
43161
  const styles$6 = StyleSheet.create({
43219
- container: {
43162
+ widgetContainer: {
43220
43163
  borderRadius: borderRadiusLarge,
43221
43164
  borderWidth: 1,
43222
43165
  borderColor: basicBorderColor,
43223
43166
  padding: spacing.medium_16,
43224
- paddingBottom: 0,
43225
- // Include space for medium_16 padding on each side
43226
- width: 400 + spacing.xLarge_32
43167
+ paddingBottom: 0
43168
+ },
43169
+ iframeContainer: {
43170
+ position: "relative",
43171
+ overflow: "hidden",
43172
+ width: "100%",
43173
+ // 16:9 aspect ratio
43174
+ paddingTop: "56.25%"
43175
+ },
43176
+ iframeResponsive: {
43177
+ borderWidth: 0,
43178
+ position: "absolute",
43179
+ top: 0,
43180
+ left: 0,
43181
+ bottom: 0,
43182
+ right: 0,
43183
+ width: "100%",
43184
+ height: "100%"
43227
43185
  }
43228
43186
  });
43229
43187
  var PhetSimulation$1 = {
@@ -44737,7 +44695,7 @@ const init = function init(options) {
44737
44695
 
44738
44696
  // This file is processed by a Rollup plugin (replace) to inject the production
44739
44697
  const libName = "@khanacademy/perseus";
44740
- const libVersion = "32.0.0";
44698
+ const libVersion = "32.0.1";
44741
44699
  addLibraryVersionToPerseusDebug(libName, libVersion);
44742
44700
 
44743
44701
  const apiVersion = {