@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 +26 -68
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +26 -69
- package/dist/index.js.map +1 -1
- package/dist/util.d.ts +0 -1
- package/dist/widgets/interactive-graph.d.ts +0 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3272,45 +3272,6 @@ function constrainedTickStepsFromTickSteps(tickSteps, ranges) {
|
|
|
3272
3272
|
return [constrainTickStep(tickSteps[0], ranges[0]), constrainTickStep(tickSteps[1], ranges[1])];
|
|
3273
3273
|
}
|
|
3274
3274
|
|
|
3275
|
-
/**
|
|
3276
|
-
* Transparently update deprecated props so that the code to deal
|
|
3277
|
-
* with them only lives in one place: (Widget).deprecatedProps
|
|
3278
|
-
*
|
|
3279
|
-
* For example, if a boolean `foo` was deprecated in favor of a
|
|
3280
|
-
* number 'bar':
|
|
3281
|
-
* deprecatedProps: {
|
|
3282
|
-
* foo: function(props) {
|
|
3283
|
-
* return {bar: props.foo ? 1 : 0};
|
|
3284
|
-
* }
|
|
3285
|
-
* }
|
|
3286
|
-
*/
|
|
3287
|
-
const DeprecationMixin$1 = {
|
|
3288
|
-
// This lifecycle stage is only called before first render
|
|
3289
|
-
// TODO(jangmi, CP-3288): Remove usage of `UNSAFE_componentWillMount`
|
|
3290
|
-
UNSAFE_componentWillMount: function () {
|
|
3291
|
-
const newProps = {};
|
|
3292
|
-
___default["default"].each(this.deprecatedProps, function (func, prop) {
|
|
3293
|
-
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
3294
|
-
if (___default["default"].has(this.props, prop)) {
|
|
3295
|
-
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
3296
|
-
___default["default"].extend(newProps, func(this.props));
|
|
3297
|
-
}
|
|
3298
|
-
}, this);
|
|
3299
|
-
if (!___default["default"].isEmpty(newProps)) {
|
|
3300
|
-
// Set new props directly so that widget renders correctly
|
|
3301
|
-
// when it first mounts, even though these will be overwritten
|
|
3302
|
-
// almost immediately afterwards...
|
|
3303
|
-
___default["default"].extend(this.props, newProps);
|
|
3304
|
-
|
|
3305
|
-
// ...when we propagate the new props upwards and they come
|
|
3306
|
-
// back down again.
|
|
3307
|
-
// TODO(jeff, CP-3128): Use Wonder Blocks Timing API
|
|
3308
|
-
// eslint-disable-next-line no-restricted-syntax
|
|
3309
|
-
setTimeout(this.props.onChange, 0, newProps);
|
|
3310
|
-
}
|
|
3311
|
-
}
|
|
3312
|
-
};
|
|
3313
|
-
|
|
3314
3275
|
/**
|
|
3315
3276
|
* Approximate equality on numbers and primitives.
|
|
3316
3277
|
*/
|
|
@@ -3656,7 +3617,6 @@ const Util = {
|
|
|
3656
3617
|
gridStepFromTickStep,
|
|
3657
3618
|
tickStepFromNumTicks,
|
|
3658
3619
|
constrainedTickStepsFromTickSteps,
|
|
3659
|
-
DeprecationMixin: DeprecationMixin$1,
|
|
3660
3620
|
eq: eq$3,
|
|
3661
3621
|
deepEq: deepEq$5,
|
|
3662
3622
|
parseQueryString,
|
|
@@ -33693,9 +33653,6 @@ const StatefulMafsGraph = /*#__PURE__*/React__namespace.forwardRef((props, ref)
|
|
|
33693
33653
|
}));
|
|
33694
33654
|
});
|
|
33695
33655
|
|
|
33696
|
-
const {
|
|
33697
|
-
DeprecationMixin
|
|
33698
|
-
} = Util;
|
|
33699
33656
|
const TRASH_ICON_URI = "https://ka-perseus-graphie.s3.amazonaws.com/b1452c0d79fd0f7ff4c3af9488474a0a0decb361.png";
|
|
33700
33657
|
const defaultBackgroundImage = {
|
|
33701
33658
|
url: null
|
|
@@ -33724,13 +33681,6 @@ function capitalize(str) {
|
|
|
33724
33681
|
function numSteps(range, step) {
|
|
33725
33682
|
return Math.floor((range[1] - range[0]) / step);
|
|
33726
33683
|
}
|
|
33727
|
-
const deprecatedProps = {
|
|
33728
|
-
showGraph: function (props) {
|
|
33729
|
-
return {
|
|
33730
|
-
markings: props.showGraph ? "graph" : "none"
|
|
33731
|
-
};
|
|
33732
|
-
}
|
|
33733
|
-
};
|
|
33734
33684
|
const _getShouldShowInstructions = props => {
|
|
33735
33685
|
return _isClickToAddPoints(props) && (
|
|
33736
33686
|
// @ts-expect-error - TS2339 - Property 'coords' does not exist on type 'PerseusGraphType'. | TS2339 - Property 'coords' does not exist on type 'PerseusGraphType'.
|
|
@@ -33788,11 +33738,6 @@ class LegacyInteractiveGraph extends React__namespace.Component {
|
|
|
33788
33738
|
state = {
|
|
33789
33739
|
shouldShowInstructions: _getShouldShowInstructions(this.props)
|
|
33790
33740
|
};
|
|
33791
|
-
|
|
33792
|
-
// TODO(jangmi, CP-3288): Remove usage of `UNSAFE_componentWillMount`
|
|
33793
|
-
UNSAFE_componentWillMount() {
|
|
33794
|
-
DeprecationMixin.UNSAFE_componentWillMount.call(this);
|
|
33795
|
-
}
|
|
33796
33741
|
componentDidMount() {
|
|
33797
33742
|
if (this.refs.graph) {
|
|
33798
33743
|
// eslint-disable-next-line react/no-string-refs
|
|
@@ -33831,7 +33776,6 @@ class LegacyInteractiveGraph extends React__namespace.Component {
|
|
|
33831
33776
|
// @ts-expect-error - TS2339 - Property 'coords' does not exist on type 'PerseusGraphType'. | TS2339 - Property 'coords' does not exist on type 'PerseusGraphType'.
|
|
33832
33777
|
props.graph.coords == null || props.graph.coords.length === 0);
|
|
33833
33778
|
};
|
|
33834
|
-
deprecatedProps = deprecatedProps;
|
|
33835
33779
|
setGraphie = newGraphie => {
|
|
33836
33780
|
this.graphie = newGraphie;
|
|
33837
33781
|
this.setupGraphie();
|
|
@@ -43526,7 +43470,7 @@ class PhetSimulation extends React__namespace.Component {
|
|
|
43526
43470
|
// http://www.html5rocks.com/en/tutorials/security/sandboxed-iframes/
|
|
43527
43471
|
const sandboxProperties = "allow-same-origin allow-scripts";
|
|
43528
43472
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
43529
|
-
style: styles$6.
|
|
43473
|
+
style: styles$6.widgetContainer
|
|
43530
43474
|
}, this.state.banner !== null &&
|
|
43531
43475
|
/*#__PURE__*/
|
|
43532
43476
|
// TODO(anna): Make this banner focusable
|
|
@@ -43538,18 +43482,16 @@ class PhetSimulation extends React__namespace.Component {
|
|
|
43538
43482
|
layout: "floating",
|
|
43539
43483
|
kind: this.state.banner.kind,
|
|
43540
43484
|
text: this.state.banner.message
|
|
43541
|
-
})), /*#__PURE__*/React__namespace.createElement(
|
|
43485
|
+
})), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
43486
|
+
style: styles$6.iframeContainer
|
|
43487
|
+
}, /*#__PURE__*/React__namespace.createElement("iframe", {
|
|
43542
43488
|
ref: this.iframeRef,
|
|
43543
43489
|
title: this.props.description,
|
|
43544
43490
|
sandbox: sandboxProperties,
|
|
43545
|
-
|
|
43546
|
-
height: 225,
|
|
43547
|
-
width: "100%",
|
|
43548
|
-
borderWidth: 0
|
|
43549
|
-
},
|
|
43491
|
+
className: aphrodite.css(styles$6.iframeResponsive),
|
|
43550
43492
|
src: this.state.url?.toString(),
|
|
43551
43493
|
allow: "fullscreen"
|
|
43552
|
-
}), /*#__PURE__*/React__namespace.createElement(IconButton__default["default"], {
|
|
43494
|
+
})), /*#__PURE__*/React__namespace.createElement(IconButton__default["default"], {
|
|
43553
43495
|
icon: cornersOutIcon__default["default"],
|
|
43554
43496
|
onClick: () => {
|
|
43555
43497
|
this.iframeRef.current?.requestFullscreen();
|
|
@@ -43579,14 +43521,29 @@ const makeSafeUrl = (urlString, locale) => {
|
|
|
43579
43521
|
return url;
|
|
43580
43522
|
};
|
|
43581
43523
|
const styles$6 = aphrodite.StyleSheet.create({
|
|
43582
|
-
|
|
43524
|
+
widgetContainer: {
|
|
43583
43525
|
borderRadius: borderRadiusLarge,
|
|
43584
43526
|
borderWidth: 1,
|
|
43585
43527
|
borderColor: basicBorderColor,
|
|
43586
43528
|
padding: wonderBlocksTokens.spacing.medium_16,
|
|
43587
|
-
paddingBottom: 0
|
|
43588
|
-
|
|
43589
|
-
|
|
43529
|
+
paddingBottom: 0
|
|
43530
|
+
},
|
|
43531
|
+
iframeContainer: {
|
|
43532
|
+
position: "relative",
|
|
43533
|
+
overflow: "hidden",
|
|
43534
|
+
width: "100%",
|
|
43535
|
+
// 16:9 aspect ratio
|
|
43536
|
+
paddingTop: "56.25%"
|
|
43537
|
+
},
|
|
43538
|
+
iframeResponsive: {
|
|
43539
|
+
borderWidth: 0,
|
|
43540
|
+
position: "absolute",
|
|
43541
|
+
top: 0,
|
|
43542
|
+
left: 0,
|
|
43543
|
+
bottom: 0,
|
|
43544
|
+
right: 0,
|
|
43545
|
+
width: "100%",
|
|
43546
|
+
height: "100%"
|
|
43590
43547
|
}
|
|
43591
43548
|
});
|
|
43592
43549
|
var PhetSimulation$1 = {
|
|
@@ -45097,7 +45054,7 @@ const init = function (options) {
|
|
|
45097
45054
|
|
|
45098
45055
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
45099
45056
|
const libName = "@khanacademy/perseus";
|
|
45100
|
-
const libVersion = "32.0.
|
|
45057
|
+
const libVersion = "32.0.1";
|
|
45101
45058
|
perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
45102
45059
|
|
|
45103
45060
|
const apiVersion = {
|