@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/dist/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/index.js CHANGED
@@ -44216,7 +44216,7 @@ const init = function (options) {
44216
44216
 
44217
44217
  // This file is processed by a Rollup plugin (replace) to inject the production
44218
44218
  const libName = "@khanacademy/perseus";
44219
- const libVersion = "15.0.0";
44219
+ const libVersion = "17.0.0";
44220
44220
  perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
44221
44221
 
44222
44222
  const apiVersion = {
@@ -44749,6 +44749,7 @@ class ServerItemRenderer extends React__namespace.Component {
44749
44749
  static defaultProps = {
44750
44750
  apiOptions: {},
44751
44751
  // a deep default is done in `this.update()`
44752
+ linterContext: PerseusLinter__namespace.linterContextDefault,
44752
44753
  onRendered: isRendered => {}
44753
44754
  };
44754
44755
  constructor(props) {
@@ -45027,13 +45028,15 @@ class ServerItemRenderer extends React__namespace.Component {
45027
45028
  },
45028
45029
  content: this.props.item.question.content,
45029
45030
  widgets: this.props.item.question.widgets,
45030
- images: this.props.item.question.images
45031
+ images: this.props.item.question.images,
45032
+ linterContext: PerseusLinter__namespace.pushContextStack(this.props.linterContext, "question")
45031
45033
  }, this.props.dependencies)));
45032
45034
  const hintsRenderer = /*#__PURE__*/React__namespace.createElement(HintsRenderer, {
45033
45035
  hints: this.props.item.hints,
45034
45036
  hintsVisible: this.props.hintsVisible,
45035
45037
  apiOptions: apiOptions,
45036
- ref: elem => this.hintsRenderer = elem
45038
+ ref: elem => this.hintsRenderer = elem,
45039
+ linterContext: PerseusLinter__namespace.pushContextStack(this.props.linterContext, "hints")
45037
45040
  });
45038
45041
  return /*#__PURE__*/React__namespace.createElement(DependenciesContext.Provider, {
45039
45042
  value: this.props.dependencies
@@ -45498,238 +45501,6 @@ class RangeInput extends React__namespace.Component {
45498
45501
  };
45499
45502
  }
45500
45503
 
45501
- /* eslint-disable @khanacademy/ts-no-error-suppressions */
45502
- const prettyBig = {
45503
- fontSize: "150%"
45504
- };
45505
- const slightlyBig = {
45506
- fontSize: "120%"
45507
- };
45508
- const symbStyle = {
45509
- fontSize: "130%"
45510
- };
45511
- // These are functions because we want to generate a new component for each use
45512
- // on the page rather than reusing an instance (which will cause an error).
45513
- // Also, it's useful for things which might look different depending on the
45514
- // props.
45515
- const basic = [() => [/*#__PURE__*/React__namespace.createElement("span", {
45516
- key: "plus",
45517
- style: slightlyBig
45518
- }, "+"), "PLUS", i18n__namespace._("Plus")], () => [/*#__PURE__*/React__namespace.createElement("span", {
45519
- key: "minus",
45520
- style: prettyBig
45521
- }, "-"), "MINUS", i18n__namespace._("Minus")],
45522
- // TODO(joel) - display as \cdot when appropriate
45523
- props => {
45524
- const {
45525
- TeX
45526
- } = getDependencies();
45527
- if (props.convertDotToTimes) {
45528
- return [/*#__PURE__*/React__namespace.createElement(TeX, {
45529
- key: "times",
45530
- style: prettyBig
45531
- }, i18n__namespace.doNotTranslate("\\times")), "TIMES", i18n__namespace._("Multiply")];
45532
- }
45533
- return [/*#__PURE__*/React__namespace.createElement(TeX, {
45534
- key: "times",
45535
- style: prettyBig
45536
- }, i18n__namespace.doNotTranslate("\\cdot")), "CDOT", i18n__namespace._("Multiply")];
45537
- }, () => {
45538
- const {
45539
- TeX
45540
- } = getDependencies();
45541
- return [/*#__PURE__*/React__namespace.createElement(TeX, {
45542
- key: "frac",
45543
- style: prettyBig
45544
- }, i18n__namespace.doNotTranslate("\\frac{x}{y}")), "FRAC", i18n__namespace._("Fraction, excluding the current expression")];
45545
- }];
45546
- const buttonSets = {
45547
- basic,
45548
- "basic+div": basic.concat([() => {
45549
- const {
45550
- TeX
45551
- } = getDependencies();
45552
- return [/*#__PURE__*/React__namespace.createElement(TeX, {
45553
- key: "div"
45554
- }, i18n__namespace.doNotTranslate("\\div")), "DIVIDE", i18n__namespace._("Divide")];
45555
- }]),
45556
- trig: [() => {
45557
- const {
45558
- TeX
45559
- } = getDependencies();
45560
- return [/*#__PURE__*/React__namespace.createElement(TeX, {
45561
- key: "sin"
45562
- }, i18n__namespace.doNotTranslate("\\sin")), "SIN", i18n__namespace._("Sine")];
45563
- }, () => {
45564
- const {
45565
- TeX
45566
- } = getDependencies();
45567
- return [/*#__PURE__*/React__namespace.createElement(TeX, {
45568
- key: "cos"
45569
- }, i18n__namespace.doNotTranslate("\\cos")), "COS", i18n__namespace._("Cosine")];
45570
- }, () => {
45571
- const {
45572
- TeX
45573
- } = getDependencies();
45574
- return [/*#__PURE__*/React__namespace.createElement(TeX, {
45575
- key: "tan"
45576
- }, i18n__namespace.doNotTranslate("\\tan")), "TAN", i18n__namespace._("Tangent")];
45577
- }, () => {
45578
- const {
45579
- TeX
45580
- } = getDependencies();
45581
- return [/*#__PURE__*/React__namespace.createElement(TeX, {
45582
- key: "theta",
45583
- style: symbStyle
45584
- }, i18n__namespace.doNotTranslate("\\theta")), "THETA", i18n__namespace._("Theta")];
45585
- }, () => {
45586
- const {
45587
- TeX
45588
- } = getDependencies();
45589
- return [/*#__PURE__*/React__namespace.createElement("span", {
45590
- key: "phi"
45591
- }, /*#__PURE__*/React__namespace.createElement("span", {
45592
- className: "perseus-sr-only"
45593
- }, i18n__namespace.doNotTranslate("phi")), /*#__PURE__*/React__namespace.createElement(TeX, {
45594
- key: "pi",
45595
- style: symbStyle
45596
- }, i18n__namespace.doNotTranslate("\\phi"))), "PHI", i18n__namespace._("Phi")];
45597
- }],
45598
- prealgebra: [() => {
45599
- const {
45600
- TeX
45601
- } = getDependencies();
45602
- return [/*#__PURE__*/React__namespace.createElement(TeX, {
45603
- key: "sqrt"
45604
- }, i18n__namespace.doNotTranslate("\\sqrt{x}")), "SQRT", i18n__namespace._("Square root")];
45605
- },
45606
- // TODO(joel) - how does desmos do this?
45607
- () => {
45608
- const {
45609
- TeX
45610
- } = getDependencies();
45611
- return [/*#__PURE__*/React__namespace.createElement(TeX, {
45612
- key: "nthroot"
45613
- }, i18n__namespace.doNotTranslate("\\sqrt[3]{x}")), "NTHROOT3", i18n__namespace._("Cube root")];
45614
- }, () => {
45615
- const {
45616
- TeX
45617
- } = getDependencies();
45618
- return [/*#__PURE__*/React__namespace.createElement(TeX, {
45619
- key: "pow",
45620
- style: slightlyBig
45621
- }, i18n__namespace.doNotTranslate("a^b")), "POW", i18n__namespace._("Exponent")];
45622
- }, () => {
45623
- const {
45624
- TeX
45625
- } = getDependencies();
45626
- return [/*#__PURE__*/React__namespace.createElement(TeX, {
45627
- key: "pi",
45628
- style: slightlyBig
45629
- }, i18n__namespace.doNotTranslate("\\pi")), "PI", i18n__namespace._("Pi")];
45630
- }],
45631
- logarithms: [() => {
45632
- const {
45633
- TeX
45634
- } = getDependencies();
45635
- return [/*#__PURE__*/React__namespace.createElement(TeX, {
45636
- key: "log"
45637
- }, i18n__namespace.doNotTranslate("\\log")), "LOG", i18n__namespace._("Logarithm with base 10")];
45638
- }, () => {
45639
- const {
45640
- TeX
45641
- } = getDependencies();
45642
- return [/*#__PURE__*/React__namespace.createElement(TeX, {
45643
- key: "ln"
45644
- }, i18n__namespace.doNotTranslate("\\ln")), "LN", i18n__namespace._("Natural logarithm")];
45645
- }, () => {
45646
- const {
45647
- TeX
45648
- } = getDependencies();
45649
- return [/*#__PURE__*/React__namespace.createElement(TeX, {
45650
- key: "log_b"
45651
- }, i18n__namespace.doNotTranslate("\\log_b")), "LOG_B", i18n__namespace._("Logarithm with custom base")];
45652
- }],
45653
- "basic relations": [() => {
45654
- const {
45655
- TeX
45656
- } = getDependencies();
45657
- return [/*#__PURE__*/React__namespace.createElement(TeX, {
45658
- key: "eq"
45659
- }, "="), "EQUAL", i18n__namespace._("Equals sign")];
45660
- }, () => {
45661
- const {
45662
- TeX
45663
- } = getDependencies();
45664
- return [/*#__PURE__*/React__namespace.createElement(TeX, {
45665
- key: "lt"
45666
- }, i18n__namespace.doNotTranslate("\\lt")), "LT", i18n__namespace._("Less than sign")];
45667
- }, () => {
45668
- const {
45669
- TeX
45670
- } = getDependencies();
45671
- return [/*#__PURE__*/React__namespace.createElement(TeX, {
45672
- key: "gt"
45673
- }, i18n__namespace.doNotTranslate("\\gt")), "GT", i18n__namespace._("Greater than sign")];
45674
- }],
45675
- "advanced relations": [() => {
45676
- const {
45677
- TeX
45678
- } = getDependencies();
45679
- return [/*#__PURE__*/React__namespace.createElement(TeX, {
45680
- key: "neq"
45681
- }, i18n__namespace.doNotTranslate("\\neq")), "NEQ", i18n__namespace._("Not-equals sign")];
45682
- }, () => {
45683
- const {
45684
- TeX
45685
- } = getDependencies();
45686
- return [/*#__PURE__*/React__namespace.createElement(TeX, {
45687
- key: "leq"
45688
- }, i18n__namespace.doNotTranslate("\\leq")), "LEQ", i18n__namespace._("Less than or equal to sign")];
45689
- }, () => {
45690
- const {
45691
- TeX
45692
- } = getDependencies();
45693
- return [/*#__PURE__*/React__namespace.createElement(TeX, {
45694
- key: "geq"
45695
- }, i18n__namespace.doNotTranslate("\\geq")), "GEQ", i18n__namespace._("Greater than or equal to sign")];
45696
- }]
45697
- };
45698
- const buttonSetsPropType = PropTypes__default["default"].arrayOf(PropTypes__default["default"].oneOf(___default["default"](buttonSets).keys()));
45699
- class TexButtons extends React__namespace.Component {
45700
- static buttonSets = buttonSets;
45701
- static buttonSetsType = buttonSetsPropType;
45702
- render() {
45703
- // Always show buttonSets in the same order. Note: Technically it's ok
45704
- // for _.keys() to return the keys in an arbitrary order, but in
45705
- // practice, they will be ordered as listed above.
45706
- const sortedButtonSets = ___default["default"].sortBy(this.props.sets, setName => ___default["default"].keys(buttonSets).indexOf(setName));
45707
- const buttons = ___default["default"](sortedButtonSets).map(setName => buttonSets[setName]);
45708
- const buttonRows = ___default["default"](buttons).map(row => row.map(symbGen => {
45709
- // create a (component, thing we should send to mathquill) pair
45710
- const symbol = symbGen(this.props);
45711
- return /*#__PURE__*/React__namespace.createElement("button", {
45712
- onClick: () => this.props.onInsert(symbol[1]),
45713
- className: "tex-button"
45714
- // @ts-expect-error - TS2533 - Object is possibly 'null' or 'undefined'. | TS2339 - Property 'key' does not exist on type 'boolean | ReactChild | ReactFragment | ReactPortal'.
45715
- ,
45716
- key: symbol[0].key,
45717
- type: "button",
45718
- "aria-label": symbol[2]
45719
- }, symbol[0]);
45720
- }));
45721
- const buttonPopup = ___default["default"](buttonRows).map((row, i) => {
45722
- return /*#__PURE__*/React__namespace.createElement("div", {
45723
- className: "clearfix tex-button-row",
45724
- key: this.props.sets[i]
45725
- }, row);
45726
- });
45727
- return /*#__PURE__*/React__namespace.createElement("div", {
45728
- className: `${this.props.className || ""} preview-measure`
45729
- }, buttonPopup);
45730
- }
45731
- }
45732
-
45733
45504
  var components = /*#__PURE__*/Object.freeze({
45734
45505
  __proto__: null,
45735
45506
  ButtonGroup: ButtonGroup,
@@ -45746,7 +45517,6 @@ var components = /*#__PURE__*/Object.freeze({
45746
45517
  RangeInput: RangeInput,
45747
45518
  SvgImage: SvgImage,
45748
45519
  TextInput: TextInput,
45749
- TexButtons: TexButtons,
45750
45520
  TextListEditor: TextListEditor
45751
45521
  });
45752
45522