@khanacademy/perseus 0.2.8 → 0.3.2

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.js CHANGED
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var KAS = require('@khanacademy/kas');
6
6
  var mathInput = require('@khanacademy/math-input');
7
- var Gorgon = require('@khanacademy/perseus-linter');
7
+ var PerseusLinter = require('@khanacademy/perseus-linter');
8
8
  var i18n = require('@khanacademy/wonder-blocks-i18n');
9
9
  var classNames = require('classnames');
10
10
  var React = require('react');
@@ -22,12 +22,11 @@ var Color = require('@khanacademy/wonder-blocks-color');
22
22
  var wonderBlocksTypography = require('@khanacademy/wonder-blocks-typography');
23
23
  require('intersection-observer');
24
24
  var wonderBlocksCore = require('@khanacademy/wonder-blocks-core');
25
+ var Button = require('@khanacademy/wonder-blocks-button');
26
+ var wonderBlocksPopover = require('@khanacademy/wonder-blocks-popover');
25
27
  var Spacing = require('@khanacademy/wonder-blocks-spacing');
26
- var Tooltip$1 = require('@khanacademy/wonder-blocks-tooltip');
27
28
  var wonderBlocksDropdown = require('@khanacademy/wonder-blocks-dropdown');
28
- var Button = require('@khanacademy/wonder-blocks-button');
29
29
  var debounce = require('lodash.debounce');
30
- var wonderBlocksPopover = require('@khanacademy/wonder-blocks-popover');
31
30
  var wonderBlocksProgressSpinner = require('@khanacademy/wonder-blocks-progress-spinner');
32
31
  var wonderBlocksLayout = require('@khanacademy/wonder-blocks-layout');
33
32
  var Link = require('@khanacademy/wonder-blocks-link');
@@ -53,7 +52,7 @@ function _interopNamespace(e) {
53
52
  }
54
53
 
55
54
  var KAS__namespace = /*#__PURE__*/_interopNamespace(KAS);
56
- var Gorgon__namespace = /*#__PURE__*/_interopNamespace(Gorgon);
55
+ var PerseusLinter__namespace = /*#__PURE__*/_interopNamespace(PerseusLinter);
57
56
  var i18n__namespace = /*#__PURE__*/_interopNamespace(i18n);
58
57
  var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
59
58
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
@@ -66,9 +65,8 @@ var createReactClass__default = /*#__PURE__*/_interopDefaultLegacy(createReactCl
66
65
  var SimpleMarkdown__default = /*#__PURE__*/_interopDefaultLegacy(SimpleMarkdown);
67
66
  var MathQuill__default = /*#__PURE__*/_interopDefaultLegacy(MathQuill);
68
67
  var Color__default = /*#__PURE__*/_interopDefaultLegacy(Color);
69
- var Spacing__default = /*#__PURE__*/_interopDefaultLegacy(Spacing);
70
- var Tooltip__default = /*#__PURE__*/_interopDefaultLegacy(Tooltip$1);
71
68
  var Button__default = /*#__PURE__*/_interopDefaultLegacy(Button);
69
+ var Spacing__default = /*#__PURE__*/_interopDefaultLegacy(Spacing);
72
70
  var debounce__default = /*#__PURE__*/_interopDefaultLegacy(debounce);
73
71
  var Link__default = /*#__PURE__*/_interopDefaultLegacy(Link);
74
72
 
@@ -9892,26 +9890,6 @@ GraphUtils.createGraphie = function (el) {
9892
9890
 
9893
9891
  /* eslint-disable */
9894
9892
 
9895
- /*
9896
- * jQuery Mobile Framework : "mouse" plugin
9897
- * Copyright (c) jQuery Project
9898
- * Dual licensed under the MIT or GPL Version 2 licenses.
9899
- * http://jquery.org/license
9900
- */
9901
- // This plugin is an experiment for abstracting away the touch and mouse
9902
- // events so that developers don't have to worry about which method of input
9903
- // the device their document is loaded on supports.
9904
- //
9905
- // The idea here is to allow the developer to register listeners for the
9906
- // basic mouse events, such as mousedown, mousemove, mouseup, and click,
9907
- // and the plugin will take care of registering the correct listeners
9908
- // behind the scenes to invoke the listener at the fastest possible time
9909
- // for that device, while still retaining the order of event firing in
9910
- // the traditional mouse environment, should multiple handlers be registered
9911
- // on the same element for different events.
9912
- //
9913
- // The current version exposes the following virtual events to jQuery bind methods:
9914
- // "vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel"
9915
9893
  (function ($, window, document, undefined$1) {
9916
9894
  if (typeof $ === "undefined") {
9917
9895
  return;
@@ -10373,7 +10351,7 @@ GraphUtils.createGraphie = function (el) {
10373
10351
  }
10374
10352
  }, true);
10375
10353
  }
10376
- })(window.jQuery, window, document);
10354
+ })($__default["default"], window, document);
10377
10355
 
10378
10356
  /**
10379
10357
  * A work-in-progress of _ methods for objects.
@@ -17827,109 +17805,6 @@ var JiptParagraphs = {
17827
17805
  joinFromArray: joinFromArray
17828
17806
  };
17829
17807
 
17830
- /**
17831
- * NotGorgon asynchronously calls Khan Academy's poentry linter.
17832
- *
17833
- * The poentry linter checks for issues that prevent content from being
17834
- * translated. This linter is KA-specific and so NotGorgon does not do anything
17835
- * in non-KA environments.
17836
- *
17837
- * NotGorgon is named as such because it is not Gorgon, Perseus' built-in
17838
- * linter.
17839
- */
17840
- // A LintCB is called once the linter has been run.
17841
-
17842
- // msec to wait before we actually call the linter after receiving the
17843
- // last call. The timer is reset if the lint is called during the wait.
17844
- const DEBOUNCE_TIMEOUT = 1000;
17845
- class NotGorgon {
17846
- constructor() {
17847
- _defineProperty(this, "previousContent", null);
17848
-
17849
- _defineProperty(this, "runLinter", _.debounce((perseusStr, onLintErrorsGenerated) => {
17850
- // $FlowFixMe[cannot-resolve-name] -- TODO(joshuan): use an api flag instead?
17851
- if (typeof KA === "undefined") {
17852
- return;
17853
- }
17854
-
17855
- if (perseusStr === this.previousContent) {
17856
- return;
17857
- }
17858
-
17859
- this.previousContent = perseusStr;
17860
-
17861
- if (perseusStr === "") {
17862
- onLintErrorsGenerated([]);
17863
- return;
17864
- }
17865
-
17866
- fetch("/api/internal/translations/lint_poentry?preview=1&lang=en", {
17867
- headers: {
17868
- "Content-Type": "application/json"
17869
- },
17870
- body: JSON.stringify({
17871
- // The poentry linter verifies that the translation from
17872
- // the original text to the translated text is sane. We
17873
- // want to ensure that the translation from English to
17874
- // English is sane, so msgid === mstr.
17875
- msgid: perseusStr,
17876
- // msgid is the original text
17877
- msgstr: perseusStr,
17878
- // msgstr is the translated text
17879
- format: "perseus_text",
17880
- filename: ""
17881
- }),
17882
- method: "POST"
17883
- }).then(response => {
17884
- if (response.status >= 400) {
17885
- return {
17886
- status: "error",
17887
- message: "Could not run i18n linter."
17888
- };
17889
- }
17890
-
17891
- return response.json();
17892
- }, rejection => {
17893
- return {
17894
- status: "error",
17895
- message: "Could not run i18n linter."
17896
- };
17897
- }).then(json => {
17898
- if (json.status === "error") {
17899
- onLintErrorsGenerated(["Some part of this text makes it untranslatable. " + "The specific message from the i18n linter was: " + json.message.replace(/\n/g, " ")]);
17900
- } else {
17901
- onLintErrorsGenerated([]);
17902
- }
17903
- });
17904
- }, DEBOUNCE_TIMEOUT));
17905
- }
17906
-
17907
- /**
17908
- * Applies an array of errors generated by linters without position
17909
- * information (NotGorgon and the legacy getSaveWarnings()) to the top
17910
- * of a Perseus tree.
17911
- */
17912
- applyLintErrors(parsedMarkdown, notGorgonLintErrors) {
17913
- // These lint errors do not have position data associated with
17914
- // them, so we just plop them at the top.
17915
- if (notGorgonLintErrors.length) {
17916
- const errorText = notGorgonLintErrors.join("\n\n");
17917
- parsedMarkdown.unshift({
17918
- content: {
17919
- type: "text",
17920
- content: ""
17921
- },
17922
- insideTable: false,
17923
- message: errorText,
17924
- ruleName: "legacy-error",
17925
- severity: Gorgon.Rule.Severity.ERROR,
17926
- type: "lint"
17927
- });
17928
- }
17929
- }
17930
-
17931
- }
17932
-
17933
17808
  const exclamationIcon = {
17934
17809
  path: "M6 11a1 1 0 1 1 0-2 1 1 0 0 1 0 2zm0-9a1 1 0 0 1 1 1v4a1 1 0 1 1-2 0V3a1 1 0 0 1 1-1z",
17935
17810
  height: 12,
@@ -18378,7 +18253,8 @@ const rules$1 = { ...pureMarkdown.pureMarkdownRules,
18378
18253
 
18379
18254
  // The `table` in this node is actually a `lint` node,
18380
18255
  // not the expected `table` node. This is due to the linter
18381
- // implementation "reparenting" the `table` node, see gorgon.js
18256
+ // implementation "reparenting" the `table` node, see
18257
+ // perseus-linter/src/index.js
18382
18258
  if (((_node$table$content = node.table.content) === null || _node$table$content === void 0 ? void 0 : _node$table$content.type) === "table") {
18383
18259
  // And the `content` of this lint node is the `table` node
18384
18260
  // which we actually want to render. Thus, we perform
@@ -18682,6 +18558,106 @@ class QuestionParagraph extends React__namespace.Component {
18682
18558
 
18683
18559
  }
18684
18560
 
18561
+ /**
18562
+ * TranslationLinter asynchronously calls Khan Academy's poentry linter.
18563
+ *
18564
+ * The poentry linter checks for issues that prevent content from being
18565
+ * translated. This linter is KA-specific and so TranslationLinter does not do
18566
+ * anything in non-KA environments.
18567
+ */
18568
+ // A LintCB is called once the linter has been run.
18569
+
18570
+ // msec to wait before we actually call the linter after receiving the
18571
+ // last call. The timer is reset if the lint is called during the wait.
18572
+ const DEBOUNCE_TIMEOUT = 1000;
18573
+ class TranslationLinter {
18574
+ constructor() {
18575
+ _defineProperty(this, "previousContent", null);
18576
+
18577
+ _defineProperty(this, "runLinter", _.debounce((perseusStr, onLintErrorsGenerated) => {
18578
+ // $FlowFixMe[cannot-resolve-name] -- TODO(joshuan): use an api flag instead?
18579
+ if (typeof KA === "undefined") {
18580
+ return;
18581
+ }
18582
+
18583
+ if (perseusStr === this.previousContent) {
18584
+ return;
18585
+ }
18586
+
18587
+ this.previousContent = perseusStr;
18588
+
18589
+ if (perseusStr === "") {
18590
+ onLintErrorsGenerated([]);
18591
+ return;
18592
+ }
18593
+
18594
+ fetch("/api/internal/translations/lint_poentry?preview=1&lang=en", {
18595
+ headers: {
18596
+ "Content-Type": "application/json"
18597
+ },
18598
+ body: JSON.stringify({
18599
+ // The poentry linter verifies that the translation from
18600
+ // the original text to the translated text is sane. We
18601
+ // want to ensure that the translation from English to
18602
+ // English is sane, so msgid === mstr.
18603
+ msgid: perseusStr,
18604
+ // msgid is the original text
18605
+ msgstr: perseusStr,
18606
+ // msgstr is the translated text
18607
+ format: "perseus_text",
18608
+ filename: ""
18609
+ }),
18610
+ method: "POST"
18611
+ }).then(response => {
18612
+ if (response.status >= 400) {
18613
+ return {
18614
+ status: "error",
18615
+ message: "Could not run i18n linter."
18616
+ };
18617
+ }
18618
+
18619
+ return response.json();
18620
+ }, rejection => {
18621
+ return {
18622
+ status: "error",
18623
+ message: "Could not run i18n linter."
18624
+ };
18625
+ }).then(json => {
18626
+ if (json.status === "error") {
18627
+ onLintErrorsGenerated(["Some part of this text makes it untranslatable. " + "The specific message from the i18n linter was: " + json.message.replace(/\n/g, " ")]);
18628
+ } else {
18629
+ onLintErrorsGenerated([]);
18630
+ }
18631
+ });
18632
+ }, DEBOUNCE_TIMEOUT));
18633
+ }
18634
+
18635
+ /**
18636
+ * Applies an array of errors generated by linters without position
18637
+ * information (TranslationLinter and the legacy getSaveWarnings()) to the
18638
+ * top of a Perseus tree.
18639
+ */
18640
+ applyLintErrors(parsedMarkdown, translationLintErrors) {
18641
+ // These lint errors do not have position data associated with
18642
+ // them, so we just plop them at the top.
18643
+ if (translationLintErrors.length) {
18644
+ const errorText = translationLintErrors.join("\n\n");
18645
+ parsedMarkdown.unshift({
18646
+ content: {
18647
+ type: "text",
18648
+ content: ""
18649
+ },
18650
+ insideTable: false,
18651
+ message: errorText,
18652
+ ruleName: "legacy-error",
18653
+ severity: PerseusLinter.Rule.Severity.ERROR,
18654
+ type: "lint"
18655
+ });
18656
+ }
18657
+ }
18658
+
18659
+ }
18660
+
18685
18661
  /**
18686
18662
  * Preprocess TeX code to convert things that KaTeX doesn't know how to handle
18687
18663
  * to things is does.
@@ -19245,7 +19221,7 @@ class WidgetContainer extends React__namespace.Component {
19245
19221
  }
19246
19222
 
19247
19223
  _defineProperty(WidgetContainer, "defaultProps", {
19248
- linterContext: Gorgon.linterContextDefault
19224
+ linterContext: PerseusLinter.linterContextDefault
19249
19225
  });
19250
19226
 
19251
19227
  const {
@@ -19295,7 +19271,7 @@ class Renderer extends React__namespace.Component {
19295
19271
 
19296
19272
  _defineProperty(this, "_isTwoColumn", void 0);
19297
19273
 
19298
- _defineProperty(this, "_notGorgon", void 0);
19274
+ _defineProperty(this, "_translationLinter", void 0);
19299
19275
 
19300
19276
  _defineProperty(this, "lastRenderedMarkdown", void 0);
19301
19277
 
@@ -19393,7 +19369,7 @@ class Renderer extends React__namespace.Component {
19393
19369
  type: type,
19394
19370
  initialProps: this.getWidgetProps(id),
19395
19371
  shouldHighlight: shouldHighlight,
19396
- linterContext: Gorgon__namespace.pushContextStack(this.props.linterContext, "widget")
19372
+ linterContext: PerseusLinter__namespace.pushContextStack(this.props.linterContext, "widget")
19397
19373
  }));
19398
19374
  }
19399
19375
 
@@ -20411,23 +20387,23 @@ class Renderer extends React__namespace.Component {
20411
20387
  return examples[0];
20412
20388
  });
20413
20389
 
20414
- _defineProperty(this, "handleNotGorgonLintErrors", lintErrors => {
20390
+ _defineProperty(this, "handletranslationLintErrors", lintErrors => {
20415
20391
  if (!this._isMounted) {
20416
20392
  return;
20417
20393
  }
20418
20394
 
20419
20395
  this.setState({
20420
- notGorgonLintErrors: lintErrors
20396
+ translationLintErrors: lintErrors
20421
20397
  });
20422
20398
  });
20423
20399
 
20424
- this._notGorgon = new NotGorgon();
20400
+ this._translationLinter = new TranslationLinter();
20425
20401
  this.state = {
20426
20402
  jiptContent: null,
20427
- // NotGorgon is async and currently does not contain a location.
20428
- // This is a list of error strings NotGorgon detected on its last
20429
- // run.
20430
- notGorgonLintErrors: [],
20403
+ // TranslationLinter is async and currently does not contain a
20404
+ // location. This is a list of error strings TranslationLinter
20405
+ // detected on its last run.
20406
+ translationLintErrors: [],
20431
20407
  // The ID of the last widget the user interacted with. We'll
20432
20408
  // use this to set the `isLastUsedWidget` flag on the
20433
20409
  // corresponding widget.
@@ -20452,7 +20428,7 @@ class Renderer extends React__namespace.Component {
20452
20428
  if (this.props.linterContext.highlightLint) {
20453
20429
  // Get i18n lint errors asynchronously. If there are lint errors,
20454
20430
  // this component will be rerendered.
20455
- this._notGorgon.runLinter(this.props.content, this.handleNotGorgonLintErrors);
20431
+ this._translationLinter.runLinter(this.props.content, this.handletranslationLintErrors);
20456
20432
  }
20457
20433
  }
20458
20434
 
@@ -20504,7 +20480,7 @@ class Renderer extends React__namespace.Component {
20504
20480
  // "shouldComponentUpdate" -- can we just remove this
20505
20481
  // componentWillUpdate and the reuseMarkdown attr?
20506
20482
 
20507
- this.reuseMarkdown = !oldJipt && !newJipt && oldContent === newContent && ___default["default"].isEqual(this.state.notGorgonLintErrors, nextState.notGorgonLintErrors) && ( // If we are running the linter then we need to know when
20483
+ this.reuseMarkdown = !oldJipt && !newJipt && oldContent === newContent && ___default["default"].isEqual(this.state.translationLintErrors, nextState.translationLintErrors) && ( // If we are running the linter then we need to know when
20508
20484
  // widgets have changed because we need for force the linter to
20509
20485
  // run when that happens. Note: don't do identity comparison here:
20510
20486
  // it can cause frequent re-renders that break MathJax somehow
@@ -20542,7 +20518,7 @@ class Renderer extends React__namespace.Component {
20542
20518
  if (this.props.linterContext.highlightLint) {
20543
20519
  // Get i18n lint errors asynchronously. If lint errors have changed
20544
20520
  // since the last run, this component will be rerendered.
20545
- this._notGorgon.runLinter(this.props.content, this.handleNotGorgonLintErrors);
20521
+ this._translationLinter.runLinter(this.props.content, this.handletranslationLintErrors);
20546
20522
  }
20547
20523
  }
20548
20524
 
@@ -20648,10 +20624,10 @@ class Renderer extends React__namespace.Component {
20648
20624
  widgets: this.props.widgets,
20649
20625
  ...this.props.linterContext
20650
20626
  };
20651
- Gorgon__namespace.runLinter(parsedMarkdown, context, true); // Apply the lint errors from the last NotGorgon run.
20627
+ PerseusLinter__namespace.runLinter(parsedMarkdown, context, true); // Apply the lint errors from the last TranslationLinter run.
20652
20628
  // TODO(joshuan): Support overlapping dots.
20653
20629
 
20654
- this._notGorgon.applyLintErrors(parsedMarkdown, [...this.state.notGorgonLintErrors, ...(this.props.legacyPerseusLint || [])]);
20630
+ this._translationLinter.applyLintErrors(parsedMarkdown, [...this.state.translationLintErrors, ...(this.props.legacyPerseusLint || [])]);
20655
20631
  } // Render the linted markdown parse tree with React components
20656
20632
 
20657
20633
 
@@ -20687,7 +20663,7 @@ _defineProperty(Renderer, "defaultProps", {
20687
20663
  reviewMode: false,
20688
20664
  serializedState: null,
20689
20665
  onSerializedStateUpdated: () => {},
20690
- linterContext: Gorgon__namespace.linterContextDefault
20666
+ linterContext: PerseusLinter__namespace.linterContextDefault
20691
20667
  });
20692
20668
 
20693
20669
  const styles$C = {
@@ -22114,7 +22090,7 @@ class InputWithExamples extends React__namespace.Component {
22114
22090
  id: this._getUniqueId()
22115
22091
  }, /*#__PURE__*/React__namespace.createElement(Renderer, {
22116
22092
  content: examplesContent,
22117
- linterContext: Gorgon__namespace.pushContextStack(this.props.linterContext, "input-with-examples")
22093
+ linterContext: PerseusLinter__namespace.pushContextStack(this.props.linterContext, "input-with-examples")
22118
22094
  })));
22119
22095
  }
22120
22096
 
@@ -22136,7 +22112,7 @@ _defineProperty(InputWithExamples, "propTypes", {
22136
22112
  disabled: PropTypes__default["default"].bool,
22137
22113
  // A unique string identifying this InputWithExamples
22138
22114
  id: PropTypes__default["default"].string.isRequired,
22139
- linterContext: Gorgon__namespace.linterContextProps
22115
+ linterContext: PerseusLinter__namespace.linterContextProps
22140
22116
  });
22141
22117
 
22142
22118
  _defineProperty(InputWithExamples, "defaultProps", {
@@ -22145,7 +22121,7 @@ _defineProperty(InputWithExamples, "defaultProps", {
22145
22121
  onFocus: function () {},
22146
22122
  onBlur: function () {},
22147
22123
  disabled: false,
22148
- linterContext: Gorgon__namespace.linterContextDefault
22124
+ linterContext: PerseusLinter__namespace.linterContextDefault
22149
22125
  });
22150
22126
 
22151
22127
  /**
@@ -22713,7 +22689,7 @@ _defineProperty(Expression, "defaultProps", {
22713
22689
  onFocus: () => {},
22714
22690
  onBlur: () => {},
22715
22691
  apiOptions: ApiOptions.defaults,
22716
- linterContext: Gorgon.linterContextDefault
22692
+ linterContext: PerseusLinter.linterContextDefault
22717
22693
  });
22718
22694
 
22719
22695
  const keypadConfigurationForProps = widgetOptions => {
@@ -23217,7 +23193,7 @@ _defineProperty(InputNumber, "defaultProps", {
23217
23193
  // NOTE(kevinb): renderer.jsx should be provide this so we probably don't
23218
23194
  // need to include it in defaultProps.
23219
23195
  apiOptions: ApiOptions.defaults,
23220
- linterContext: Gorgon.linterContextDefault
23196
+ linterContext: PerseusLinter.linterContextDefault
23221
23197
  });
23222
23198
 
23223
23199
  const propTransform$4 = widgetOptions => {
@@ -23666,7 +23642,7 @@ _defineProperty(NumericInput, "defaultProps", {
23666
23642
  coefficient: false,
23667
23643
  answerForms: [],
23668
23644
  labelText: "",
23669
- linterContext: Gorgon.linterContextDefault,
23645
+ linterContext: PerseusLinter.linterContextDefault,
23670
23646
  multipleNumberInput: false
23671
23647
  });
23672
23648
 
@@ -29213,7 +29189,7 @@ _defineProperty(Radio$1, "defaultProps", {
29213
29189
  multipleSelect: false,
29214
29190
  countChoices: false,
29215
29191
  deselectEnabled: false,
29216
- linterContext: Gorgon.linterContextDefault
29192
+ linterContext: PerseusLinter.linterContextDefault
29217
29193
  });
29218
29194
 
29219
29195
  const {
@@ -29491,7 +29467,7 @@ _defineProperty(Categorizer, "defaultProps", {
29491
29467
  items: [],
29492
29468
  categories: [],
29493
29469
  values: [],
29494
- linterContext: Gorgon.linterContextDefault
29470
+ linterContext: PerseusLinter.linterContextDefault
29495
29471
  });
29496
29472
 
29497
29473
  const pageMargin = 16; // Stylesheets aren't directly testable
@@ -29813,30 +29789,6 @@ var CSProgram$1 = {
29813
29789
  hidden: true
29814
29790
  };
29815
29791
 
29816
- class DefinitionContent extends React__namespace.Component {
29817
- componentDidMount() {
29818
- this.props.trackInteraction();
29819
- }
29820
-
29821
- render() {
29822
- return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
29823
- style: styles$o.tooltipBody
29824
- }, /*#__PURE__*/React__namespace.createElement(Renderer, {
29825
- apiOptions: this.props.apiOptions,
29826
- content: this.props.content,
29827
- widgets: this.props.widgets
29828
- }));
29829
- }
29830
-
29831
- }
29832
-
29833
- _defineProperty(DefinitionContent, "propTypes", {
29834
- apiOptions: ApiOptions.propTypes,
29835
- content: PropTypes__default["default"].string,
29836
- trackInteraction: PropTypes__default["default"].func.isRequired,
29837
- widgets: PropTypes__default["default"].objectOf(PropTypes__default["default"].any)
29838
- });
29839
-
29840
29792
  class Definition extends React__namespace.Component {
29841
29793
  constructor() {
29842
29794
  super(...arguments);
@@ -29860,25 +29812,32 @@ class Definition extends React__namespace.Component {
29860
29812
  }
29861
29813
 
29862
29814
  render() {
29863
- const content = /*#__PURE__*/React__namespace.createElement(DefinitionContent, {
29864
- apiOptions: this.props.apiOptions,
29865
- content: this.props.definition,
29866
- key: this.props.definition,
29867
- trackInteraction: this.props.trackInteraction,
29868
- widgets: this.props.widgets
29869
- });
29870
- return (
29871
- /*#__PURE__*/
29872
- // $FlowFixMe[incompatible-type]: content prop
29873
- React__namespace.createElement(Tooltip__default["default"], {
29874
- content: content,
29875
- placement: "top"
29876
- }, /*#__PURE__*/React__namespace.createElement("span", {
29815
+ return /*#__PURE__*/React__namespace.createElement(wonderBlocksPopover.Popover, {
29816
+ content: /*#__PURE__*/React__namespace.createElement(wonderBlocksPopover.PopoverContentCore, {
29817
+ color: "white",
29818
+ style: styles$o.tooltipBody,
29819
+ closeButtonVisible: true
29820
+ }, /*#__PURE__*/React__namespace.createElement(Renderer, {
29821
+ apiOptions: this.props.apiOptions,
29822
+ content: this.props.definition,
29823
+ widgets: this.props.widgets
29824
+ })),
29825
+ placement: "top"
29826
+ }, _ref => {
29827
+ let {
29828
+ open
29829
+ } = _ref;
29830
+ return /*#__PURE__*/React__namespace.createElement("span", {
29877
29831
  className: "perseus-widget-definition"
29878
- }, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
29879
- style: styles$o.definitionLink
29880
- }, this.props.togglePrompt)))
29881
- );
29832
+ }, /*#__PURE__*/React__namespace.createElement(Button__default["default"], {
29833
+ size: "small",
29834
+ kind: "tertiary",
29835
+ onClick: () => {
29836
+ this.props.trackInteraction();
29837
+ open();
29838
+ }
29839
+ }, this.props.togglePrompt));
29840
+ });
29882
29841
  }
29883
29842
 
29884
29843
  }
@@ -29896,13 +29855,6 @@ const styles$o = {
29896
29855
  fontWeight: 500,
29897
29856
  lineHeight: "30px",
29898
29857
  margin: Spacing__default["default"].xSmall_8
29899
- },
29900
- definitionLink: {
29901
- borderBottom: "dashed 1px ".concat(Color__default["default"].blue),
29902
- color: Color__default["default"].blue,
29903
- cursor: "pointer",
29904
- display: "inline-block",
29905
- textDecoration: "none"
29906
29858
  }
29907
29859
  };
29908
29860
  var Definition$1 = {
@@ -29911,7 +29863,7 @@ var Definition$1 = {
29911
29863
  accessible: true,
29912
29864
  defaultAlignment: "inline",
29913
29865
  widget: Definition,
29914
- transform: ___default["default"].identity
29866
+ transform: x => x
29915
29867
  };
29916
29868
 
29917
29869
  class Dropdown extends React__namespace.Component {
@@ -30152,7 +30104,7 @@ _defineProperty(Explanation, "defaultProps", {
30152
30104
  hidePrompt: "Hide explanation",
30153
30105
  explanation: "explanation goes here\n\nmore explanation",
30154
30106
  widgets: {},
30155
- linterContext: Gorgon.linterContextDefault
30107
+ linterContext: PerseusLinter.linterContextDefault
30156
30108
  });
30157
30109
 
30158
30110
  const leftBorderSpacing = 23;
@@ -30603,7 +30555,7 @@ _defineProperty(GradedGroup$1, "defaultProps", {
30603
30555
  images: {},
30604
30556
  hint: null,
30605
30557
  hasHint: false,
30606
- linterContext: Gorgon.linterContextDefault
30558
+ linterContext: PerseusLinter.linterContextDefault
30607
30559
  });
30608
30560
 
30609
30561
  const traverseChildWidgets$3 = function (props, traverseRenderer) {
@@ -30831,7 +30783,7 @@ class GradedGroupSet extends React__namespace.Component {
30831
30783
 
30832
30784
  _defineProperty(GradedGroupSet, "defaultProps", {
30833
30785
  gradedGroups: [],
30834
- linterContext: Gorgon.linterContextDefault
30786
+ linterContext: PerseusLinter.linterContextDefault
30835
30787
  });
30836
30788
 
30837
30789
  const traverseChildWidgets$2 = function (props, traverseRenderer) {
@@ -32208,7 +32160,7 @@ _defineProperty(Group, "defaultProps", {
32208
32160
  content: "",
32209
32161
  widgets: {},
32210
32162
  images: {},
32211
- linterContext: Gorgon.linterContextDefault
32163
+ linterContext: PerseusLinter.linterContextDefault
32212
32164
  });
32213
32165
 
32214
32166
  const traverseChildWidgets$1 = function (props, traverseRenderer) {
@@ -32619,7 +32571,7 @@ _defineProperty(ImageWidget, "defaultProps", {
32619
32571
  labels: [],
32620
32572
  alt: "",
32621
32573
  caption: "",
32622
- linterContext: Gorgon.linterContextDefault
32574
+ linterContext: PerseusLinter.linterContextDefault
32623
32575
  });
32624
32576
 
32625
32577
  const styles$i = aphrodite.StyleSheet.create({
@@ -37593,7 +37545,7 @@ class Draggable extends React__namespace.Component {
37593
37545
  onTouchCancel: this.onMouseUp
37594
37546
  }, /*#__PURE__*/React__namespace.createElement(Renderer, {
37595
37547
  content: this.props.content,
37596
- linterContext: Gorgon__namespace.pushContextStack(this.props.linterContext, "draggable"),
37548
+ linterContext: PerseusLinter__namespace.pushContextStack(this.props.linterContext, "draggable"),
37597
37549
  onRender: this.props.onRender
37598
37550
  }));
37599
37551
  }
@@ -37631,13 +37583,13 @@ _defineProperty(Draggable, "propTypes", {
37631
37583
  onMouseUp: PropTypes__default["default"].func.isRequired,
37632
37584
  onRender: PropTypes__default["default"].func.isRequired,
37633
37585
  type: PropTypes__default["default"].oneOf([STATIC, DRAGGING, ANIMATING, DISABLED]),
37634
- linterContext: Gorgon__namespace.linterContextProps
37586
+ linterContext: PerseusLinter__namespace.linterContextProps
37635
37587
  });
37636
37588
 
37637
37589
  _defineProperty(Draggable, "defaultProps", {
37638
37590
  includePadding: true,
37639
37591
  type: STATIC,
37640
- linterContext: Gorgon__namespace.linterContextDefault
37592
+ linterContext: PerseusLinter__namespace.linterContextDefault
37641
37593
  });
37642
37594
 
37643
37595
  class Sortable extends React__namespace.Component {
@@ -37819,7 +37771,7 @@ class Sortable extends React__namespace.Component {
37819
37771
  includePadding: this.props.padding,
37820
37772
  margin: isLast && isStatic ? 0 : margin,
37821
37773
  endPosition: item.endPosition,
37822
- linterContext: Gorgon__namespace.pushContextStack(this.props.linterContext, "sortable"),
37774
+ linterContext: PerseusLinter__namespace.pushContextStack(this.props.linterContext, "sortable"),
37823
37775
  onRender: this.remeasureItems // eslint-disable-next-line react/jsx-no-bind
37824
37776
  ,
37825
37777
  onMouseDown: this.onMouseDown.bind(this, item.key) // eslint-disable-next-line react/jsx-no-bind
@@ -38021,7 +37973,7 @@ _defineProperty(Sortable, "defaultProps", {
38021
37973
  onMeasure: function () {},
38022
37974
  margin: 5,
38023
37975
  onChange: function () {},
38024
- linterContext: Gorgon__namespace.linterContextDefault,
37976
+ linterContext: PerseusLinter__namespace.linterContextDefault,
38025
37977
  waitForKatexLoad: true
38026
37978
  });
38027
37979
 
@@ -38244,7 +38196,7 @@ _defineProperty(Matcher, "propTypes", {
38244
38196
  problemNum: PropTypes__default["default"].number,
38245
38197
  right: PropTypes__default["default"].array,
38246
38198
  trackInteraction: PropTypes__default["default"].func.isRequired,
38247
- linterContext: Gorgon.linterContextProps
38199
+ linterContext: PerseusLinter.linterContextProps
38248
38200
  });
38249
38201
 
38250
38202
  _defineProperty(Matcher, "defaultProps", {
@@ -38255,7 +38207,7 @@ _defineProperty(Matcher, "defaultProps", {
38255
38207
  padding: true,
38256
38208
  problemNum: 0,
38257
38209
  onChange: function () {},
38258
- linterContext: Gorgon.linterContextDefault
38210
+ linterContext: PerseusLinter.linterContextDefault
38259
38211
  });
38260
38212
 
38261
38213
  ___default["default"].extend(Matcher, {
@@ -38934,7 +38886,7 @@ _defineProperty(Matrix, "defaultProps", {
38934
38886
  suffix: "",
38935
38887
  cursorPosition: [0, 0],
38936
38888
  apiOptions: ApiOptions.defaults,
38937
- linterContext: Gorgon.linterContextDefault
38889
+ linterContext: PerseusLinter.linterContextDefault
38938
38890
  });
38939
38891
 
38940
38892
  ___default["default"].extend(Matrix, {
@@ -41041,13 +40993,13 @@ _defineProperty(Card, "propTypes", {
41041
40993
  startOffset: PropTypePosition,
41042
40994
  animateTo: PropTypePosition,
41043
40995
  onAnimationEnd: PropTypes__default["default"].func,
41044
- linterContext: Gorgon.linterContextProps
40996
+ linterContext: PerseusLinter.linterContextProps
41045
40997
  });
41046
40998
 
41047
40999
  _defineProperty(Card, "defaultProps", {
41048
41000
  stack: false,
41049
41001
  animating: false,
41050
- linterContext: Gorgon.linterContextDefault
41002
+ linterContext: PerseusLinter.linterContextDefault
41051
41003
  });
41052
41004
 
41053
41005
  const NORMAL = "normal",
@@ -41405,7 +41357,7 @@ _defineProperty(Orderer, "defaultProps", {
41405
41357
  correctOptions: [],
41406
41358
  height: NORMAL,
41407
41359
  layout: HORIZONTAL$1,
41408
- linterContext: Gorgon.linterContextDefault
41360
+ linterContext: PerseusLinter.linterContextDefault
41409
41361
  });
41410
41362
 
41411
41363
  ___default["default"].extend(Orderer, {
@@ -41485,12 +41437,12 @@ class PassageRefTarget extends React__namespace.Component {
41485
41437
 
41486
41438
  _defineProperty(PassageRefTarget, "propTypes", { ...propTypes,
41487
41439
  content: PropTypes__default["default"].string,
41488
- linterContext: Gorgon.linterContextProps
41440
+ linterContext: PerseusLinter.linterContextProps
41489
41441
  });
41490
41442
 
41491
41443
  _defineProperty(PassageRefTarget, "defaultProps", {
41492
41444
  content: "",
41493
- linterContext: Gorgon.linterContextDefault
41445
+ linterContext: PerseusLinter.linterContextDefault
41494
41446
  });
41495
41447
 
41496
41448
  var PassageRefTarget$1 = {
@@ -43874,7 +43826,7 @@ _defineProperty(Passage, "defaultProps", {
43874
43826
  footnotes: "",
43875
43827
  showLineNumbers: true,
43876
43828
  highlights: {},
43877
- linterContext: Gorgon.linterContextDefault
43829
+ linterContext: PerseusLinter.linterContextDefault
43878
43830
  });
43879
43831
 
43880
43832
  var Passage$1 = {
@@ -45054,7 +45006,7 @@ _defineProperty(Sequence, "propTypes", { ...propTypes,
45054
45006
  widgets: PropTypes__default["default"].objectOf(PropTypes__default["default"].any)
45055
45007
  })),
45056
45008
  trackInteraction: PropTypes__default["default"].func.isRequired,
45057
- linterContext: Gorgon.linterContextProps
45009
+ linterContext: PerseusLinter.linterContextProps
45058
45010
  });
45059
45011
 
45060
45012
  _defineProperty(Sequence, "defaultProps", {
@@ -45063,7 +45015,7 @@ _defineProperty(Sequence, "defaultProps", {
45063
45015
  widgets: {},
45064
45016
  images: {}
45065
45017
  }],
45066
- linterContext: Gorgon.linterContextDefault
45018
+ linterContext: PerseusLinter.linterContextDefault
45067
45019
  });
45068
45020
 
45069
45021
  const traverseChildWidgets = function (props, traverseRenderer) {
@@ -46003,7 +45955,7 @@ _defineProperty(Sorter, "propTypes", {
46003
45955
  padding: PropTypes__default["default"].bool,
46004
45956
  problemNum: PropTypes__default["default"].number,
46005
45957
  trackInteraction: PropTypes__default["default"].func.isRequired,
46006
- linterContext: Gorgon.linterContextProps
45958
+ linterContext: PerseusLinter.linterContextProps
46007
45959
  });
46008
45960
 
46009
45961
  _defineProperty(Sorter, "defaultProps", {
@@ -46012,7 +45964,7 @@ _defineProperty(Sorter, "defaultProps", {
46012
45964
  padding: true,
46013
45965
  problemNum: 0,
46014
45966
  onChange: function () {},
46015
- linterContext: Gorgon.linterContextDefault
45967
+ linterContext: PerseusLinter.linterContextDefault
46016
45968
  });
46017
45969
 
46018
45970
  var Sorter$1 = {
@@ -46259,7 +46211,7 @@ _defineProperty(Table, "propTypes", {
46259
46211
  headers: PropTypes__default["default"].arrayOf(PropTypes__default["default"].string),
46260
46212
  keypadElement: mathInput.keypadElementPropType,
46261
46213
  trackInteraction: PropTypes__default["default"].func.isRequired,
46262
- linterContext: Gorgon.linterContextProps
46214
+ linterContext: PerseusLinter.linterContextProps
46263
46215
  });
46264
46216
 
46265
46217
  _defineProperty(Table, "defaultProps", function () {
@@ -46277,7 +46229,7 @@ _defineProperty(Table, "defaultProps", function () {
46277
46229
  rows: defaultRows,
46278
46230
  columns: defaultColumns,
46279
46231
  answers: blankAnswers,
46280
- linterContext: Gorgon.linterContextDefault
46232
+ linterContext: PerseusLinter.linterContextDefault
46281
46233
  };
46282
46234
  }());
46283
46235
 
@@ -50703,7 +50655,7 @@ class ArticleRenderer extends React__namespace.Component {
50703
50655
  this._handleFocusChange(newFocusPath && [refForSection].concat(newFocusPath), oldFocusPath && [refForSection].concat(oldFocusPath));
50704
50656
  }
50705
50657
  },
50706
- linterContext: Gorgon__namespace.pushContextStack(this.props.linterContext, "article"),
50658
+ linterContext: PerseusLinter__namespace.pushContextStack(this.props.linterContext, "article"),
50707
50659
  legacyPerseusLint: this.props.legacyPerseusLint
50708
50660
  })));
50709
50661
  });
@@ -50723,14 +50675,14 @@ _defineProperty(ArticleRenderer, "propTypes", { ...ProvideKeypad.propTypes,
50723
50675
  json: PropTypes__default["default"].oneOfType([rendererProps, PropTypes__default["default"].arrayOf(rendererProps)]).isRequired,
50724
50676
  // Whether to use the new Bibliotron styles for articles
50725
50677
  useNewStyles: PropTypes__default["default"].bool,
50726
- linterContext: Gorgon__namespace.linterContextProps,
50678
+ linterContext: PerseusLinter__namespace.linterContextProps,
50727
50679
  legacyPerseusLint: PropTypes__default["default"].arrayOf(PropTypes__default["default"].string)
50728
50680
  });
50729
50681
 
50730
50682
  _defineProperty(ArticleRenderer, "defaultProps", {
50731
50683
  apiOptions: {},
50732
50684
  useNewStyles: false,
50733
- linterContext: Gorgon__namespace.linterContextDefault
50685
+ linterContext: PerseusLinter__namespace.linterContextDefault
50734
50686
  });
50735
50687
 
50736
50688
  /* Renders just a hint preview */
@@ -50795,14 +50747,14 @@ class HintRenderer extends React__namespace.Component {
50795
50747
  images: hint.images,
50796
50748
  apiOptions: rendererApiOptions,
50797
50749
  findExternalWidgets: this.props.findExternalWidgets,
50798
- linterContext: Gorgon__namespace.pushContextStack(this.props.linterContext, "hint")
50750
+ linterContext: PerseusLinter__namespace.pushContextStack(this.props.linterContext, "hint")
50799
50751
  }));
50800
50752
  }
50801
50753
 
50802
50754
  }
50803
50755
 
50804
50756
  _defineProperty(HintRenderer, "defaultProps", {
50805
- linterContext: Gorgon__namespace.linterContextDefault
50757
+ linterContext: PerseusLinter__namespace.linterContextDefault
50806
50758
  });
50807
50759
 
50808
50760
  const styles$5 = aphrodite.StyleSheet.create({
@@ -50966,7 +50918,7 @@ class HintsRenderer extends React__namespace.Component {
50966
50918
  key: "hintRenderer" + i,
50967
50919
  apiOptions: apiOptions,
50968
50920
  findExternalWidgets: this.props.findExternalWidgets,
50969
- linterContext: Gorgon__namespace.pushContextStack(this.props.linterContext, "hints[" + i + "]")
50921
+ linterContext: PerseusLinter__namespace.pushContextStack(this.props.linterContext, "hints[" + i + "]")
50970
50922
  });
50971
50923
 
50972
50924
  if (isFinalHelpPage) {
@@ -51010,7 +50962,7 @@ class HintsRenderer extends React__namespace.Component {
51010
50962
  }
51011
50963
 
51012
50964
  _defineProperty(HintsRenderer, "defaultProps", {
51013
- linterContext: Gorgon__namespace.linterContextDefault
50965
+ linterContext: PerseusLinter__namespace.linterContextDefault
51014
50966
  });
51015
50967
 
51016
50968
  const hintIndentation = baseUnitPx + hintBorderWidth;
@@ -51253,7 +51205,7 @@ class ItemRenderer extends React__namespace.Component {
51253
51205
  questionCompleted: this.state.questionCompleted,
51254
51206
  reviewMode: this.props.reviewMode,
51255
51207
  savedState: this.props.savedState,
51256
- linterContext: Gorgon__namespace.pushContextStack(this.props.linterContext, "question")
51208
+ linterContext: PerseusLinter__namespace.pushContextStack(this.props.linterContext, "question")
51257
51209
  }, this.props.item.question, {
51258
51210
  legacyPerseusLint: this.props.legacyPerseusLint
51259
51211
  })), workArea); // TODO(LP-11406): Replace with React Portal
@@ -51264,7 +51216,7 @@ class ItemRenderer extends React__namespace.Component {
51264
51216
  hints: this.props.item.hints,
51265
51217
  hintsVisible: this.state.hintsVisible,
51266
51218
  apiOptions: apiOptions,
51267
- linterContext: Gorgon__namespace.pushContextStack(this.props.linterContext, "hints")
51219
+ linterContext: PerseusLinter__namespace.pushContextStack(this.props.linterContext, "hints")
51268
51220
  }), hintsArea);
51269
51221
  const answerArea = this.props.item.answerArea || {};
51270
51222
 
@@ -51521,7 +51473,7 @@ _defineProperty(ItemRenderer, "defaultProps", {
51521
51473
  initialHintsVisible: 0,
51522
51474
  workAreaSelector: "#workarea",
51523
51475
  reviewMode: false,
51524
- linterContext: Gorgon__namespace.linterContextDefault
51476
+ linterContext: PerseusLinter__namespace.linterContextDefault
51525
51477
  });
51526
51478
 
51527
51479
  /**