@khanacademy/perseus 15.0.0 → 17.0.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/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @khanacademy/perseus
2
2
 
3
+ ## 17.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#852](https://github.com/Khan/perseus/pull/852) [`204788f8`](https://github.com/Khan/perseus/commit/204788f8f583bda5ff94d74fd70ec542fedd3d6e) Thanks [@handeyeco](https://github.com/handeyeco)! - Remove ItemRenderer again
8
+
9
+ * [#838](https://github.com/Khan/perseus/pull/838) [`233fc9fc`](https://github.com/Khan/perseus/commit/233fc9fcd4c65d2ff0c8f1ebd1cb1b17b76cbe0c) Thanks [@handeyeco](https://github.com/handeyeco)! - Remove TexButtons and update ExpressionEditor
10
+
11
+ ### Patch Changes
12
+
13
+ - [#854](https://github.com/Khan/perseus/pull/854) [`2e2f2cc1`](https://github.com/Khan/perseus/commit/2e2f2cc1afe99613eb688ab1e4e1fccad0c8df57) Thanks [@handeyeco](https://github.com/handeyeco)! - Remove unused CSS images for next/prev steps
14
+
15
+ - Updated dependencies [[`41d3cd93`](https://github.com/Khan/perseus/commit/41d3cd93f78d4649c8a57b6fa4964c0c9f2c45b0), [`27f691aa`](https://github.com/Khan/perseus/commit/27f691aa11f061b54db487b5b35222431776260f), [`3803452b`](https://github.com/Khan/perseus/commit/3803452b0593649faf4043bf6e1d7681a14078e4), [`ef32b88f`](https://github.com/Khan/perseus/commit/ef32b88f5027154784fb496506d7c96ee3765eac), [`820febc5`](https://github.com/Khan/perseus/commit/820febc5814a5a10d7c1743be8aa9d220f2d9bd8), [`67a09051`](https://github.com/Khan/perseus/commit/67a09051c61df98b697349ad75760193e4228bfe)]:
16
+ - @khanacademy/math-input@16.1.1
17
+
18
+ ## 16.0.0
19
+
20
+ ### Major Changes
21
+
22
+ - [#847](https://github.com/Khan/perseus/pull/847) [`45350a24`](https://github.com/Khan/perseus/commit/45350a2458cd3f816bc87af40997e426feb4b13b) Thanks [@handeyeco](https://github.com/handeyeco)! - Add back ItemRenderer temporarily
23
+
3
24
  ## 15.0.0
4
25
 
5
26
  ### Major Changes
@@ -12,5 +12,4 @@ export { default as PropCheckBox } from "./components/prop-check-box";
12
12
  export { default as RangeInput } from "./components/range-input";
13
13
  export { default as SvgImage } from "./components/svg-image";
14
14
  export { default as TextInput } from "./components/text-input";
15
- export { default as TexButtons } from "./components/tex-buttons";
16
15
  export { default as TextListEditor } from "./components/text-list-editor";
package/dist/es/index.css CHANGED
@@ -675,30 +675,6 @@ div.timeline-total {
675
675
  width: 100px;
676
676
  }
677
677
 
678
- #previous-step {
679
- margin: 5px;
680
- cursor: pointer;
681
- float: left;
682
- width: 100px;
683
- }
684
-
685
- #next-step {
686
- margin: 5px;
687
- cursor: pointer;
688
- float: right;
689
- width: 80px;
690
- }
691
-
692
- #previous-step span {
693
- background: url(/images/previous-step.png) no-repeat 0 50% transparent;
694
- padding: 4px 0 4px 25px;
695
- }
696
-
697
- #next-step span {
698
- background: url(/images/next-step.png) no-repeat 100% 50% transparent;
699
- padding: 4px 25px 4px 0;
700
- }
701
-
702
678
  #next-problem {
703
679
  margin: 5px;
704
680
  cursor: pointer;
@@ -3584,48 +3560,6 @@ body.mobile .framework-perseus table.perseus-widget-table-of-values.non-markdown
3584
3560
  font-size: 18px;
3585
3561
  }
3586
3562
  }
3587
- /**
3588
- * Styles for managing the popover animations.
3589
- *
3590
- * Ideally, we'd be generating these styles with Aphrodite (along with
3591
- * CSSTransitionGroup's support for custom classnames), but the generated
3592
- * styles have issues on mobile Safari.
3593
- * See: https://github.com/Khan/aphrodite/issues/68.
3594
- *
3595
- * If the animation durations change, the corresponding values in
3596
- * echo-manager.js must change as well.
3597
- */
3598
- .echo-slide-and-fade-enter {
3599
- opacity: 1 !important;
3600
- transform: translate3d(0, 0, 0) !important;
3601
- }
3602
- .echo-slide-and-fade-enter.echo-slide-and-fade-enter-active {
3603
- opacity: 0 !important;
3604
- transform: translate3d(0, -33%, 0) !important;
3605
- /**
3606
- * TODO(charlie): These times are intentionally different, which means
3607
- * that the animation really "ends" after 400ms
3608
- * cubic-bezier(1, 0, 0.9, 1) (since the opacity goes to 0), even though
3609
- * the transform doesn't complete. There's probably a way to achieve the
3610
- * same effect by manipulating the transform's Bezier curve and total
3611
- * displacement.
3612
- */
3613
- transition: transform 800ms cubic-bezier(0, 1, 0.25, 1), opacity 400ms cubic-bezier(1, 0, 0.9, 1) !important;
3614
- }
3615
- .echo-fade-only-enter {
3616
- opacity: 1 !important;
3617
- }
3618
- .echo-fade-only-enter.echo-fade-only-enter-active {
3619
- opacity: 0 !important;
3620
- transition: opacity 300ms cubic-bezier(0.25, 0, 0.75, 1) !important;
3621
- }
3622
- .echo-long-fade-only-enter {
3623
- opacity: 1 !important;
3624
- }
3625
- .echo-long-fade-only-enter.echo-long-fade-only-enter-active {
3626
- opacity: 0 !important;
3627
- transition: opacity 400ms cubic-bezier(0.75, 0, 0.75, 1) !important;
3628
- }
3629
3563
  .keypad-input {
3630
3564
  outline: none !important;
3631
3565
  }
@@ -3706,24 +3640,6 @@ body.mobile .framework-perseus table.perseus-widget-table-of-values.non-markdown
3706
3640
  color: white !important;
3707
3641
  display: inline-block !important;
3708
3642
  }
3709
- /**
3710
- * Styles for managing the popover animations.
3711
- *
3712
- * Ideally, we'd be generating these styles with Aphrodite (along with
3713
- * CSSTransitionGroup's support for custom classnames), but the generated
3714
- * styles have issues on mobile Safari.
3715
- * See: https://github.com/Khan/aphrodite/issues/68.
3716
- *
3717
- * If the animation durations change, the corresponding values in
3718
- * popover-manager.js must change as well.
3719
- */
3720
- .popover-enter {
3721
- opacity: 0 !important;
3722
- }
3723
- .popover-enter.popover-enter-active {
3724
- opacity: 1 !important;
3725
- transition: opacity 200ms ease-out !important;
3726
- }
3727
3643
  /*
3728
3644
  * MathQuill v0.10.1 http://mathquill.com
3729
3645
  * by Han, Jeanine, and Mary maintainers@mathquill.com
@@ -4160,9 +4076,3 @@ body.mobile .framework-perseus table.perseus-widget-table-of-values.non-markdown
4160
4076
  margin-top: -0.1em;
4161
4077
  }
4162
4078
 
4163
- .tabbar_item {
4164
- background-color: red;
4165
- }
4166
- .tabbar_item:focus {
4167
- background-color: green;
4168
- }
package/dist/es/index.js CHANGED
@@ -44079,7 +44079,7 @@ const init = function init(options) {
44079
44079
 
44080
44080
  // This file is processed by a Rollup plugin (replace) to inject the production
44081
44081
  const libName = "@khanacademy/perseus";
44082
- const libVersion = "15.0.0";
44082
+ const libVersion = "17.0.0";
44083
44083
  addLibraryVersionToPerseusDebug(libName, libVersion);
44084
44084
 
44085
44085
  const apiVersion = {
@@ -44883,13 +44883,15 @@ class ServerItemRenderer extends React.Component {
44883
44883
  },
44884
44884
  content: this.props.item.question.content,
44885
44885
  widgets: this.props.item.question.widgets,
44886
- images: this.props.item.question.images
44886
+ images: this.props.item.question.images,
44887
+ linterContext: PerseusLinter.pushContextStack(this.props.linterContext, "question")
44887
44888
  }, this.props.dependencies)));
44888
44889
  const hintsRenderer = /*#__PURE__*/React.createElement(HintsRenderer, {
44889
44890
  hints: this.props.item.hints,
44890
44891
  hintsVisible: this.props.hintsVisible,
44891
44892
  apiOptions: apiOptions,
44892
- ref: elem => this.hintsRenderer = elem
44893
+ ref: elem => this.hintsRenderer = elem,
44894
+ linterContext: PerseusLinter.pushContextStack(this.props.linterContext, "hints")
44893
44895
  });
44894
44896
  return /*#__PURE__*/React.createElement(DependenciesContext.Provider, {
44895
44897
  value: this.props.dependencies
@@ -44906,6 +44908,7 @@ class ServerItemRenderer extends React.Component {
44906
44908
  ServerItemRenderer.defaultProps = {
44907
44909
  apiOptions: {},
44908
44910
  // a deep default is done in `this.update()`
44911
+ linterContext: PerseusLinter.linterContextDefault,
44909
44912
  onRendered: isRendered => {}
44910
44913
  };
44911
44914
  const styles$3 = StyleSheet.create({
@@ -45362,238 +45365,6 @@ RangeInput.defaultProps = {
45362
45365
  placeholder: [null, null]
45363
45366
  };
45364
45367
 
45365
- /* eslint-disable @khanacademy/ts-no-error-suppressions */
45366
- const prettyBig = {
45367
- fontSize: "150%"
45368
- };
45369
- const slightlyBig = {
45370
- fontSize: "120%"
45371
- };
45372
- const symbStyle = {
45373
- fontSize: "130%"
45374
- };
45375
- // These are functions because we want to generate a new component for each use
45376
- // on the page rather than reusing an instance (which will cause an error).
45377
- // Also, it's useful for things which might look different depending on the
45378
- // props.
45379
- const basic = [() => [/*#__PURE__*/React.createElement("span", {
45380
- key: "plus",
45381
- style: slightlyBig
45382
- }, "+"), "PLUS", i18n._("Plus")], () => [/*#__PURE__*/React.createElement("span", {
45383
- key: "minus",
45384
- style: prettyBig
45385
- }, "-"), "MINUS", i18n._("Minus")],
45386
- // TODO(joel) - display as \cdot when appropriate
45387
- props => {
45388
- const {
45389
- TeX
45390
- } = getDependencies();
45391
- if (props.convertDotToTimes) {
45392
- return [/*#__PURE__*/React.createElement(TeX, {
45393
- key: "times",
45394
- style: prettyBig
45395
- }, i18n.doNotTranslate("\\times")), "TIMES", i18n._("Multiply")];
45396
- }
45397
- return [/*#__PURE__*/React.createElement(TeX, {
45398
- key: "times",
45399
- style: prettyBig
45400
- }, i18n.doNotTranslate("\\cdot")), "CDOT", i18n._("Multiply")];
45401
- }, () => {
45402
- const {
45403
- TeX
45404
- } = getDependencies();
45405
- return [/*#__PURE__*/React.createElement(TeX, {
45406
- key: "frac",
45407
- style: prettyBig
45408
- }, i18n.doNotTranslate("\\frac{x}{y}")), "FRAC", i18n._("Fraction, excluding the current expression")];
45409
- }];
45410
- const buttonSets = {
45411
- basic,
45412
- "basic+div": basic.concat([() => {
45413
- const {
45414
- TeX
45415
- } = getDependencies();
45416
- return [/*#__PURE__*/React.createElement(TeX, {
45417
- key: "div"
45418
- }, i18n.doNotTranslate("\\div")), "DIVIDE", i18n._("Divide")];
45419
- }]),
45420
- trig: [() => {
45421
- const {
45422
- TeX
45423
- } = getDependencies();
45424
- return [/*#__PURE__*/React.createElement(TeX, {
45425
- key: "sin"
45426
- }, i18n.doNotTranslate("\\sin")), "SIN", i18n._("Sine")];
45427
- }, () => {
45428
- const {
45429
- TeX
45430
- } = getDependencies();
45431
- return [/*#__PURE__*/React.createElement(TeX, {
45432
- key: "cos"
45433
- }, i18n.doNotTranslate("\\cos")), "COS", i18n._("Cosine")];
45434
- }, () => {
45435
- const {
45436
- TeX
45437
- } = getDependencies();
45438
- return [/*#__PURE__*/React.createElement(TeX, {
45439
- key: "tan"
45440
- }, i18n.doNotTranslate("\\tan")), "TAN", i18n._("Tangent")];
45441
- }, () => {
45442
- const {
45443
- TeX
45444
- } = getDependencies();
45445
- return [/*#__PURE__*/React.createElement(TeX, {
45446
- key: "theta",
45447
- style: symbStyle
45448
- }, i18n.doNotTranslate("\\theta")), "THETA", i18n._("Theta")];
45449
- }, () => {
45450
- const {
45451
- TeX
45452
- } = getDependencies();
45453
- return [/*#__PURE__*/React.createElement("span", {
45454
- key: "phi"
45455
- }, /*#__PURE__*/React.createElement("span", {
45456
- className: "perseus-sr-only"
45457
- }, i18n.doNotTranslate("phi")), /*#__PURE__*/React.createElement(TeX, {
45458
- key: "pi",
45459
- style: symbStyle
45460
- }, i18n.doNotTranslate("\\phi"))), "PHI", i18n._("Phi")];
45461
- }],
45462
- prealgebra: [() => {
45463
- const {
45464
- TeX
45465
- } = getDependencies();
45466
- return [/*#__PURE__*/React.createElement(TeX, {
45467
- key: "sqrt"
45468
- }, i18n.doNotTranslate("\\sqrt{x}")), "SQRT", i18n._("Square root")];
45469
- },
45470
- // TODO(joel) - how does desmos do this?
45471
- () => {
45472
- const {
45473
- TeX
45474
- } = getDependencies();
45475
- return [/*#__PURE__*/React.createElement(TeX, {
45476
- key: "nthroot"
45477
- }, i18n.doNotTranslate("\\sqrt[3]{x}")), "NTHROOT3", i18n._("Cube root")];
45478
- }, () => {
45479
- const {
45480
- TeX
45481
- } = getDependencies();
45482
- return [/*#__PURE__*/React.createElement(TeX, {
45483
- key: "pow",
45484
- style: slightlyBig
45485
- }, i18n.doNotTranslate("a^b")), "POW", i18n._("Exponent")];
45486
- }, () => {
45487
- const {
45488
- TeX
45489
- } = getDependencies();
45490
- return [/*#__PURE__*/React.createElement(TeX, {
45491
- key: "pi",
45492
- style: slightlyBig
45493
- }, i18n.doNotTranslate("\\pi")), "PI", i18n._("Pi")];
45494
- }],
45495
- logarithms: [() => {
45496
- const {
45497
- TeX
45498
- } = getDependencies();
45499
- return [/*#__PURE__*/React.createElement(TeX, {
45500
- key: "log"
45501
- }, i18n.doNotTranslate("\\log")), "LOG", i18n._("Logarithm with base 10")];
45502
- }, () => {
45503
- const {
45504
- TeX
45505
- } = getDependencies();
45506
- return [/*#__PURE__*/React.createElement(TeX, {
45507
- key: "ln"
45508
- }, i18n.doNotTranslate("\\ln")), "LN", i18n._("Natural logarithm")];
45509
- }, () => {
45510
- const {
45511
- TeX
45512
- } = getDependencies();
45513
- return [/*#__PURE__*/React.createElement(TeX, {
45514
- key: "log_b"
45515
- }, i18n.doNotTranslate("\\log_b")), "LOG_B", i18n._("Logarithm with custom base")];
45516
- }],
45517
- "basic relations": [() => {
45518
- const {
45519
- TeX
45520
- } = getDependencies();
45521
- return [/*#__PURE__*/React.createElement(TeX, {
45522
- key: "eq"
45523
- }, "="), "EQUAL", i18n._("Equals sign")];
45524
- }, () => {
45525
- const {
45526
- TeX
45527
- } = getDependencies();
45528
- return [/*#__PURE__*/React.createElement(TeX, {
45529
- key: "lt"
45530
- }, i18n.doNotTranslate("\\lt")), "LT", i18n._("Less than sign")];
45531
- }, () => {
45532
- const {
45533
- TeX
45534
- } = getDependencies();
45535
- return [/*#__PURE__*/React.createElement(TeX, {
45536
- key: "gt"
45537
- }, i18n.doNotTranslate("\\gt")), "GT", i18n._("Greater than sign")];
45538
- }],
45539
- "advanced relations": [() => {
45540
- const {
45541
- TeX
45542
- } = getDependencies();
45543
- return [/*#__PURE__*/React.createElement(TeX, {
45544
- key: "neq"
45545
- }, i18n.doNotTranslate("\\neq")), "NEQ", i18n._("Not-equals sign")];
45546
- }, () => {
45547
- const {
45548
- TeX
45549
- } = getDependencies();
45550
- return [/*#__PURE__*/React.createElement(TeX, {
45551
- key: "leq"
45552
- }, i18n.doNotTranslate("\\leq")), "LEQ", i18n._("Less than or equal to sign")];
45553
- }, () => {
45554
- const {
45555
- TeX
45556
- } = getDependencies();
45557
- return [/*#__PURE__*/React.createElement(TeX, {
45558
- key: "geq"
45559
- }, i18n.doNotTranslate("\\geq")), "GEQ", i18n._("Greater than or equal to sign")];
45560
- }]
45561
- };
45562
- const buttonSetsPropType = PropTypes.arrayOf(PropTypes.oneOf(_(buttonSets).keys()));
45563
- class TexButtons extends React.Component {
45564
- render() {
45565
- // Always show buttonSets in the same order. Note: Technically it's ok
45566
- // for _.keys() to return the keys in an arbitrary order, but in
45567
- // practice, they will be ordered as listed above.
45568
- const sortedButtonSets = _.sortBy(this.props.sets, setName => _.keys(buttonSets).indexOf(setName));
45569
- const buttons = _(sortedButtonSets).map(setName => buttonSets[setName]);
45570
- const buttonRows = _(buttons).map(row => row.map(symbGen => {
45571
- // create a (component, thing we should send to mathquill) pair
45572
- const symbol = symbGen(this.props);
45573
- return /*#__PURE__*/React.createElement("button", {
45574
- onClick: () => this.props.onInsert(symbol[1]),
45575
- className: "tex-button"
45576
- // @ts-expect-error - TS2533 - Object is possibly 'null' or 'undefined'. | TS2339 - Property 'key' does not exist on type 'boolean | ReactChild | ReactFragment | ReactPortal'.
45577
- ,
45578
- key: symbol[0].key,
45579
- type: "button",
45580
- "aria-label": symbol[2]
45581
- }, symbol[0]);
45582
- }));
45583
- const buttonPopup = _(buttonRows).map((row, i) => {
45584
- return /*#__PURE__*/React.createElement("div", {
45585
- className: "clearfix tex-button-row",
45586
- key: this.props.sets[i]
45587
- }, row);
45588
- });
45589
- return /*#__PURE__*/React.createElement("div", {
45590
- className: `${this.props.className || ""} preview-measure`
45591
- }, buttonPopup);
45592
- }
45593
- }
45594
- TexButtons.buttonSets = buttonSets;
45595
- TexButtons.buttonSetsType = buttonSetsPropType;
45596
-
45597
45368
  var components = /*#__PURE__*/Object.freeze({
45598
45369
  __proto__: null,
45599
45370
  ButtonGroup: ButtonGroup,
@@ -45610,7 +45381,6 @@ var components = /*#__PURE__*/Object.freeze({
45610
45381
  RangeInput: RangeInput,
45611
45382
  SvgImage: SvgImage,
45612
45383
  TextInput: TextInput,
45613
- TexButtons: TexButtons,
45614
45384
  TextListEditor: TextListEditor
45615
45385
  });
45616
45386