@khanacademy/perseus 0.2.8 → 0.3.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 +14 -0
- package/dist/es/index.css +1 -436
- package/dist/es/index.js +165 -212
- package/dist/es/index.js.map +1 -1
- package/dist/index.css +1 -436
- package/dist/index.js +193 -241
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/perseus-markdown_test.jsx +5 -5
- package/src/__tests__/renderer_test.jsx +9 -9
- package/src/article-renderer.jsx +4 -4
- package/src/components/input-with-examples.jsx +4 -4
- package/src/components/lint.jsx +2 -1
- package/src/components/sortable.jsx +6 -6
- package/src/hint-renderer.jsx +3 -3
- package/src/hints-renderer.jsx +3 -3
- package/src/item-renderer.jsx +4 -4
- package/src/jquery.mobile.vmouse.js +2 -1
- package/src/perseus-markdown.jsx +2 -1
- package/src/renderer.jsx +31 -32
- package/src/styles/perseus-renderer.less +1 -1
- package/src/{not-gorgon.js → translation-linter.js} +9 -12
- package/src/widgets/__tests__/__snapshots__/definition_test.js.snap +30 -12
- package/src/widgets/__tests__/definition_test.js +18 -33
- package/src/widgets/__tests__/grapher.cypress.jsx +2 -2
- package/src/widgets/__tests__/interactive-graph.cypress.jsx +2 -2
- package/src/widgets/definition.jsx +36 -71
package/dist/es/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as KAS from '@khanacademy/kas';
|
|
2
2
|
import { KeypadInput, KeypadTypes, keypadElementPropType, Keypad } from '@khanacademy/math-input';
|
|
3
|
-
import * as
|
|
3
|
+
import * as PerseusLinter from '@khanacademy/perseus-linter';
|
|
4
4
|
import { Rule, linterContextDefault, linterContextProps } from '@khanacademy/perseus-linter';
|
|
5
5
|
import * as i18n from '@khanacademy/wonder-blocks-i18n';
|
|
6
6
|
import classNames from 'classnames';
|
|
@@ -20,12 +20,11 @@ import Color from '@khanacademy/wonder-blocks-color';
|
|
|
20
20
|
import { LabelLarge } from '@khanacademy/wonder-blocks-typography';
|
|
21
21
|
import 'intersection-observer';
|
|
22
22
|
import { UniqueIDProvider, View, Text } from '@khanacademy/wonder-blocks-core';
|
|
23
|
+
import Button from '@khanacademy/wonder-blocks-button';
|
|
24
|
+
import { Popover, PopoverContentCore } from '@khanacademy/wonder-blocks-popover';
|
|
23
25
|
import Spacing from '@khanacademy/wonder-blocks-spacing';
|
|
24
|
-
import Tooltip$1 from '@khanacademy/wonder-blocks-tooltip';
|
|
25
26
|
import { OptionItem, SingleSelect } from '@khanacademy/wonder-blocks-dropdown';
|
|
26
|
-
import Button from '@khanacademy/wonder-blocks-button';
|
|
27
27
|
import debounce$1 from 'lodash.debounce';
|
|
28
|
-
import { Popover, PopoverContentCore } from '@khanacademy/wonder-blocks-popover';
|
|
29
28
|
import { CircularSpinner } from '@khanacademy/wonder-blocks-progress-spinner';
|
|
30
29
|
import { Strut } from '@khanacademy/wonder-blocks-layout';
|
|
31
30
|
import Link from '@khanacademy/wonder-blocks-link';
|
|
@@ -9987,26 +9986,6 @@ GraphUtils.createGraphie = function (el) {
|
|
|
9987
9986
|
|
|
9988
9987
|
/* eslint-disable */
|
|
9989
9988
|
|
|
9990
|
-
/*
|
|
9991
|
-
* jQuery Mobile Framework : "mouse" plugin
|
|
9992
|
-
* Copyright (c) jQuery Project
|
|
9993
|
-
* Dual licensed under the MIT or GPL Version 2 licenses.
|
|
9994
|
-
* http://jquery.org/license
|
|
9995
|
-
*/
|
|
9996
|
-
// This plugin is an experiment for abstracting away the touch and mouse
|
|
9997
|
-
// events so that developers don't have to worry about which method of input
|
|
9998
|
-
// the device their document is loaded on supports.
|
|
9999
|
-
//
|
|
10000
|
-
// The idea here is to allow the developer to register listeners for the
|
|
10001
|
-
// basic mouse events, such as mousedown, mousemove, mouseup, and click,
|
|
10002
|
-
// and the plugin will take care of registering the correct listeners
|
|
10003
|
-
// behind the scenes to invoke the listener at the fastest possible time
|
|
10004
|
-
// for that device, while still retaining the order of event firing in
|
|
10005
|
-
// the traditional mouse environment, should multiple handlers be registered
|
|
10006
|
-
// on the same element for different events.
|
|
10007
|
-
//
|
|
10008
|
-
// The current version exposes the following virtual events to jQuery bind methods:
|
|
10009
|
-
// "vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel"
|
|
10010
9989
|
(function ($, window, document, undefined$1) {
|
|
10011
9990
|
if (typeof $ === "undefined") {
|
|
10012
9991
|
return;
|
|
@@ -10468,7 +10447,7 @@ GraphUtils.createGraphie = function (el) {
|
|
|
10468
10447
|
}
|
|
10469
10448
|
}, true);
|
|
10470
10449
|
}
|
|
10471
|
-
})(
|
|
10450
|
+
})($, window, document);
|
|
10472
10451
|
|
|
10473
10452
|
/**
|
|
10474
10453
|
* A work-in-progress of _ methods for objects.
|
|
@@ -17935,109 +17914,6 @@ var JiptParagraphs = {
|
|
|
17935
17914
|
joinFromArray: joinFromArray
|
|
17936
17915
|
};
|
|
17937
17916
|
|
|
17938
|
-
/**
|
|
17939
|
-
* NotGorgon asynchronously calls Khan Academy's poentry linter.
|
|
17940
|
-
*
|
|
17941
|
-
* The poentry linter checks for issues that prevent content from being
|
|
17942
|
-
* translated. This linter is KA-specific and so NotGorgon does not do anything
|
|
17943
|
-
* in non-KA environments.
|
|
17944
|
-
*
|
|
17945
|
-
* NotGorgon is named as such because it is not Gorgon, Perseus' built-in
|
|
17946
|
-
* linter.
|
|
17947
|
-
*/
|
|
17948
|
-
// A LintCB is called once the linter has been run.
|
|
17949
|
-
|
|
17950
|
-
// msec to wait before we actually call the linter after receiving the
|
|
17951
|
-
// last call. The timer is reset if the lint is called during the wait.
|
|
17952
|
-
var DEBOUNCE_TIMEOUT = 1000;
|
|
17953
|
-
class NotGorgon {
|
|
17954
|
-
constructor() {
|
|
17955
|
-
_defineProperty(this, "previousContent", null);
|
|
17956
|
-
|
|
17957
|
-
_defineProperty(this, "runLinter", debounce((perseusStr, onLintErrorsGenerated) => {
|
|
17958
|
-
// $FlowFixMe[cannot-resolve-name] -- TODO(joshuan): use an api flag instead?
|
|
17959
|
-
if (typeof KA === "undefined") {
|
|
17960
|
-
return;
|
|
17961
|
-
}
|
|
17962
|
-
|
|
17963
|
-
if (perseusStr === this.previousContent) {
|
|
17964
|
-
return;
|
|
17965
|
-
}
|
|
17966
|
-
|
|
17967
|
-
this.previousContent = perseusStr;
|
|
17968
|
-
|
|
17969
|
-
if (perseusStr === "") {
|
|
17970
|
-
onLintErrorsGenerated([]);
|
|
17971
|
-
return;
|
|
17972
|
-
}
|
|
17973
|
-
|
|
17974
|
-
fetch("/api/internal/translations/lint_poentry?preview=1&lang=en", {
|
|
17975
|
-
headers: {
|
|
17976
|
-
"Content-Type": "application/json"
|
|
17977
|
-
},
|
|
17978
|
-
body: JSON.stringify({
|
|
17979
|
-
// The poentry linter verifies that the translation from
|
|
17980
|
-
// the original text to the translated text is sane. We
|
|
17981
|
-
// want to ensure that the translation from English to
|
|
17982
|
-
// English is sane, so msgid === mstr.
|
|
17983
|
-
msgid: perseusStr,
|
|
17984
|
-
// msgid is the original text
|
|
17985
|
-
msgstr: perseusStr,
|
|
17986
|
-
// msgstr is the translated text
|
|
17987
|
-
format: "perseus_text",
|
|
17988
|
-
filename: ""
|
|
17989
|
-
}),
|
|
17990
|
-
method: "POST"
|
|
17991
|
-
}).then(response => {
|
|
17992
|
-
if (response.status >= 400) {
|
|
17993
|
-
return {
|
|
17994
|
-
status: "error",
|
|
17995
|
-
message: "Could not run i18n linter."
|
|
17996
|
-
};
|
|
17997
|
-
}
|
|
17998
|
-
|
|
17999
|
-
return response.json();
|
|
18000
|
-
}, rejection => {
|
|
18001
|
-
return {
|
|
18002
|
-
status: "error",
|
|
18003
|
-
message: "Could not run i18n linter."
|
|
18004
|
-
};
|
|
18005
|
-
}).then(json => {
|
|
18006
|
-
if (json.status === "error") {
|
|
18007
|
-
onLintErrorsGenerated(["Some part of this text makes it untranslatable. " + "The specific message from the i18n linter was: " + json.message.replace(/\n/g, " ")]);
|
|
18008
|
-
} else {
|
|
18009
|
-
onLintErrorsGenerated([]);
|
|
18010
|
-
}
|
|
18011
|
-
});
|
|
18012
|
-
}, DEBOUNCE_TIMEOUT));
|
|
18013
|
-
}
|
|
18014
|
-
|
|
18015
|
-
/**
|
|
18016
|
-
* Applies an array of errors generated by linters without position
|
|
18017
|
-
* information (NotGorgon and the legacy getSaveWarnings()) to the top
|
|
18018
|
-
* of a Perseus tree.
|
|
18019
|
-
*/
|
|
18020
|
-
applyLintErrors(parsedMarkdown, notGorgonLintErrors) {
|
|
18021
|
-
// These lint errors do not have position data associated with
|
|
18022
|
-
// them, so we just plop them at the top.
|
|
18023
|
-
if (notGorgonLintErrors.length) {
|
|
18024
|
-
var errorText = notGorgonLintErrors.join("\n\n");
|
|
18025
|
-
parsedMarkdown.unshift({
|
|
18026
|
-
content: {
|
|
18027
|
-
type: "text",
|
|
18028
|
-
content: ""
|
|
18029
|
-
},
|
|
18030
|
-
insideTable: false,
|
|
18031
|
-
message: errorText,
|
|
18032
|
-
ruleName: "legacy-error",
|
|
18033
|
-
severity: Rule.Severity.ERROR,
|
|
18034
|
-
type: "lint"
|
|
18035
|
-
});
|
|
18036
|
-
}
|
|
18037
|
-
}
|
|
18038
|
-
|
|
18039
|
-
}
|
|
18040
|
-
|
|
18041
17917
|
var exclamationIcon = {
|
|
18042
17918
|
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",
|
|
18043
17919
|
height: 12,
|
|
@@ -18485,7 +18361,8 @@ var rules$1 = _objectSpread2(_objectSpread2({}, pureMarkdownRules), {}, {
|
|
|
18485
18361
|
|
|
18486
18362
|
// The `table` in this node is actually a `lint` node,
|
|
18487
18363
|
// not the expected `table` node. This is due to the linter
|
|
18488
|
-
// implementation "reparenting" the `table` node, see
|
|
18364
|
+
// implementation "reparenting" the `table` node, see
|
|
18365
|
+
// perseus-linter/src/index.js
|
|
18489
18366
|
if (((_node$table$content = node.table.content) === null || _node$table$content === void 0 ? void 0 : _node$table$content.type) === "table") {
|
|
18490
18367
|
// And the `content` of this lint node is the `table` node
|
|
18491
18368
|
// which we actually want to render. Thus, we perform
|
|
@@ -18790,6 +18667,106 @@ class QuestionParagraph extends React.Component {
|
|
|
18790
18667
|
|
|
18791
18668
|
}
|
|
18792
18669
|
|
|
18670
|
+
/**
|
|
18671
|
+
* TranslationLinter asynchronously calls Khan Academy's poentry linter.
|
|
18672
|
+
*
|
|
18673
|
+
* The poentry linter checks for issues that prevent content from being
|
|
18674
|
+
* translated. This linter is KA-specific and so TranslationLinter does not do
|
|
18675
|
+
* anything in non-KA environments.
|
|
18676
|
+
*/
|
|
18677
|
+
// A LintCB is called once the linter has been run.
|
|
18678
|
+
|
|
18679
|
+
// msec to wait before we actually call the linter after receiving the
|
|
18680
|
+
// last call. The timer is reset if the lint is called during the wait.
|
|
18681
|
+
var DEBOUNCE_TIMEOUT = 1000;
|
|
18682
|
+
class TranslationLinter {
|
|
18683
|
+
constructor() {
|
|
18684
|
+
_defineProperty(this, "previousContent", null);
|
|
18685
|
+
|
|
18686
|
+
_defineProperty(this, "runLinter", debounce((perseusStr, onLintErrorsGenerated) => {
|
|
18687
|
+
// $FlowFixMe[cannot-resolve-name] -- TODO(joshuan): use an api flag instead?
|
|
18688
|
+
if (typeof KA === "undefined") {
|
|
18689
|
+
return;
|
|
18690
|
+
}
|
|
18691
|
+
|
|
18692
|
+
if (perseusStr === this.previousContent) {
|
|
18693
|
+
return;
|
|
18694
|
+
}
|
|
18695
|
+
|
|
18696
|
+
this.previousContent = perseusStr;
|
|
18697
|
+
|
|
18698
|
+
if (perseusStr === "") {
|
|
18699
|
+
onLintErrorsGenerated([]);
|
|
18700
|
+
return;
|
|
18701
|
+
}
|
|
18702
|
+
|
|
18703
|
+
fetch("/api/internal/translations/lint_poentry?preview=1&lang=en", {
|
|
18704
|
+
headers: {
|
|
18705
|
+
"Content-Type": "application/json"
|
|
18706
|
+
},
|
|
18707
|
+
body: JSON.stringify({
|
|
18708
|
+
// The poentry linter verifies that the translation from
|
|
18709
|
+
// the original text to the translated text is sane. We
|
|
18710
|
+
// want to ensure that the translation from English to
|
|
18711
|
+
// English is sane, so msgid === mstr.
|
|
18712
|
+
msgid: perseusStr,
|
|
18713
|
+
// msgid is the original text
|
|
18714
|
+
msgstr: perseusStr,
|
|
18715
|
+
// msgstr is the translated text
|
|
18716
|
+
format: "perseus_text",
|
|
18717
|
+
filename: ""
|
|
18718
|
+
}),
|
|
18719
|
+
method: "POST"
|
|
18720
|
+
}).then(response => {
|
|
18721
|
+
if (response.status >= 400) {
|
|
18722
|
+
return {
|
|
18723
|
+
status: "error",
|
|
18724
|
+
message: "Could not run i18n linter."
|
|
18725
|
+
};
|
|
18726
|
+
}
|
|
18727
|
+
|
|
18728
|
+
return response.json();
|
|
18729
|
+
}, rejection => {
|
|
18730
|
+
return {
|
|
18731
|
+
status: "error",
|
|
18732
|
+
message: "Could not run i18n linter."
|
|
18733
|
+
};
|
|
18734
|
+
}).then(json => {
|
|
18735
|
+
if (json.status === "error") {
|
|
18736
|
+
onLintErrorsGenerated(["Some part of this text makes it untranslatable. " + "The specific message from the i18n linter was: " + json.message.replace(/\n/g, " ")]);
|
|
18737
|
+
} else {
|
|
18738
|
+
onLintErrorsGenerated([]);
|
|
18739
|
+
}
|
|
18740
|
+
});
|
|
18741
|
+
}, DEBOUNCE_TIMEOUT));
|
|
18742
|
+
}
|
|
18743
|
+
|
|
18744
|
+
/**
|
|
18745
|
+
* Applies an array of errors generated by linters without position
|
|
18746
|
+
* information (TranslationLinter and the legacy getSaveWarnings()) to the
|
|
18747
|
+
* top of a Perseus tree.
|
|
18748
|
+
*/
|
|
18749
|
+
applyLintErrors(parsedMarkdown, translationLintErrors) {
|
|
18750
|
+
// These lint errors do not have position data associated with
|
|
18751
|
+
// them, so we just plop them at the top.
|
|
18752
|
+
if (translationLintErrors.length) {
|
|
18753
|
+
var errorText = translationLintErrors.join("\n\n");
|
|
18754
|
+
parsedMarkdown.unshift({
|
|
18755
|
+
content: {
|
|
18756
|
+
type: "text",
|
|
18757
|
+
content: ""
|
|
18758
|
+
},
|
|
18759
|
+
insideTable: false,
|
|
18760
|
+
message: errorText,
|
|
18761
|
+
ruleName: "legacy-error",
|
|
18762
|
+
severity: Rule.Severity.ERROR,
|
|
18763
|
+
type: "lint"
|
|
18764
|
+
});
|
|
18765
|
+
}
|
|
18766
|
+
}
|
|
18767
|
+
|
|
18768
|
+
}
|
|
18769
|
+
|
|
18793
18770
|
/**
|
|
18794
18771
|
* Preprocess TeX code to convert things that KaTeX doesn't know how to handle
|
|
18795
18772
|
* to things is does.
|
|
@@ -19401,7 +19378,7 @@ class Renderer extends React.Component {
|
|
|
19401
19378
|
|
|
19402
19379
|
_defineProperty(this, "_isTwoColumn", void 0);
|
|
19403
19380
|
|
|
19404
|
-
_defineProperty(this, "
|
|
19381
|
+
_defineProperty(this, "_translationLinter", void 0);
|
|
19405
19382
|
|
|
19406
19383
|
_defineProperty(this, "lastRenderedMarkdown", void 0);
|
|
19407
19384
|
|
|
@@ -19497,7 +19474,7 @@ class Renderer extends React.Component {
|
|
|
19497
19474
|
type: type,
|
|
19498
19475
|
initialProps: this.getWidgetProps(id),
|
|
19499
19476
|
shouldHighlight: shouldHighlight,
|
|
19500
|
-
linterContext:
|
|
19477
|
+
linterContext: PerseusLinter.pushContextStack(this.props.linterContext, "widget")
|
|
19501
19478
|
}));
|
|
19502
19479
|
}
|
|
19503
19480
|
|
|
@@ -20513,23 +20490,23 @@ class Renderer extends React.Component {
|
|
|
20513
20490
|
return examples[0];
|
|
20514
20491
|
});
|
|
20515
20492
|
|
|
20516
|
-
_defineProperty(this, "
|
|
20493
|
+
_defineProperty(this, "handletranslationLintErrors", lintErrors => {
|
|
20517
20494
|
if (!this._isMounted) {
|
|
20518
20495
|
return;
|
|
20519
20496
|
}
|
|
20520
20497
|
|
|
20521
20498
|
this.setState({
|
|
20522
|
-
|
|
20499
|
+
translationLintErrors: lintErrors
|
|
20523
20500
|
});
|
|
20524
20501
|
});
|
|
20525
20502
|
|
|
20526
|
-
this.
|
|
20503
|
+
this._translationLinter = new TranslationLinter();
|
|
20527
20504
|
this.state = _objectSpread2({
|
|
20528
20505
|
jiptContent: null,
|
|
20529
|
-
//
|
|
20530
|
-
// This is a list of error strings
|
|
20531
|
-
// run.
|
|
20532
|
-
|
|
20506
|
+
// TranslationLinter is async and currently does not contain a
|
|
20507
|
+
// location. This is a list of error strings TranslationLinter
|
|
20508
|
+
// detected on its last run.
|
|
20509
|
+
translationLintErrors: [],
|
|
20533
20510
|
// The ID of the last widget the user interacted with. We'll
|
|
20534
20511
|
// use this to set the `isLastUsedWidget` flag on the
|
|
20535
20512
|
// corresponding widget.
|
|
@@ -20553,7 +20530,7 @@ class Renderer extends React.Component {
|
|
|
20553
20530
|
if (this.props.linterContext.highlightLint) {
|
|
20554
20531
|
// Get i18n lint errors asynchronously. If there are lint errors,
|
|
20555
20532
|
// this component will be rerendered.
|
|
20556
|
-
this.
|
|
20533
|
+
this._translationLinter.runLinter(this.props.content, this.handletranslationLintErrors);
|
|
20557
20534
|
}
|
|
20558
20535
|
}
|
|
20559
20536
|
|
|
@@ -20605,7 +20582,7 @@ class Renderer extends React.Component {
|
|
|
20605
20582
|
// "shouldComponentUpdate" -- can we just remove this
|
|
20606
20583
|
// componentWillUpdate and the reuseMarkdown attr?
|
|
20607
20584
|
|
|
20608
|
-
this.reuseMarkdown = !oldJipt && !newJipt && oldContent === newContent && _.isEqual(this.state.
|
|
20585
|
+
this.reuseMarkdown = !oldJipt && !newJipt && oldContent === newContent && _.isEqual(this.state.translationLintErrors, nextState.translationLintErrors) && ( // If we are running the linter then we need to know when
|
|
20609
20586
|
// widgets have changed because we need for force the linter to
|
|
20610
20587
|
// run when that happens. Note: don't do identity comparison here:
|
|
20611
20588
|
// it can cause frequent re-renders that break MathJax somehow
|
|
@@ -20643,7 +20620,7 @@ class Renderer extends React.Component {
|
|
|
20643
20620
|
if (this.props.linterContext.highlightLint) {
|
|
20644
20621
|
// Get i18n lint errors asynchronously. If lint errors have changed
|
|
20645
20622
|
// since the last run, this component will be rerendered.
|
|
20646
|
-
this.
|
|
20623
|
+
this._translationLinter.runLinter(this.props.content, this.handletranslationLintErrors);
|
|
20647
20624
|
}
|
|
20648
20625
|
}
|
|
20649
20626
|
|
|
@@ -20749,10 +20726,10 @@ class Renderer extends React.Component {
|
|
|
20749
20726
|
widgets: this.props.widgets
|
|
20750
20727
|
}, this.props.linterContext);
|
|
20751
20728
|
|
|
20752
|
-
|
|
20729
|
+
PerseusLinter.runLinter(parsedMarkdown, context, true); // Apply the lint errors from the last TranslationLinter run.
|
|
20753
20730
|
// TODO(joshuan): Support overlapping dots.
|
|
20754
20731
|
|
|
20755
|
-
this.
|
|
20732
|
+
this._translationLinter.applyLintErrors(parsedMarkdown, [...this.state.translationLintErrors, ...(this.props.legacyPerseusLint || [])]);
|
|
20756
20733
|
} // Render the linted markdown parse tree with React components
|
|
20757
20734
|
|
|
20758
20735
|
|
|
@@ -20788,7 +20765,7 @@ _defineProperty(Renderer, "defaultProps", {
|
|
|
20788
20765
|
reviewMode: false,
|
|
20789
20766
|
serializedState: null,
|
|
20790
20767
|
onSerializedStateUpdated: () => {},
|
|
20791
|
-
linterContext:
|
|
20768
|
+
linterContext: PerseusLinter.linterContextDefault
|
|
20792
20769
|
});
|
|
20793
20770
|
|
|
20794
20771
|
var styles$C = {
|
|
@@ -22219,7 +22196,7 @@ class InputWithExamples extends React.Component {
|
|
|
22219
22196
|
id: this._getUniqueId()
|
|
22220
22197
|
}, /*#__PURE__*/React.createElement(Renderer, {
|
|
22221
22198
|
content: examplesContent,
|
|
22222
|
-
linterContext:
|
|
22199
|
+
linterContext: PerseusLinter.pushContextStack(this.props.linterContext, "input-with-examples")
|
|
22223
22200
|
})));
|
|
22224
22201
|
}
|
|
22225
22202
|
|
|
@@ -22241,7 +22218,7 @@ _defineProperty(InputWithExamples, "propTypes", {
|
|
|
22241
22218
|
disabled: PropTypes.bool,
|
|
22242
22219
|
// A unique string identifying this InputWithExamples
|
|
22243
22220
|
id: PropTypes.string.isRequired,
|
|
22244
|
-
linterContext:
|
|
22221
|
+
linterContext: PerseusLinter.linterContextProps
|
|
22245
22222
|
});
|
|
22246
22223
|
|
|
22247
22224
|
_defineProperty(InputWithExamples, "defaultProps", {
|
|
@@ -22250,7 +22227,7 @@ _defineProperty(InputWithExamples, "defaultProps", {
|
|
|
22250
22227
|
onFocus: function onFocus() {},
|
|
22251
22228
|
onBlur: function onBlur() {},
|
|
22252
22229
|
disabled: false,
|
|
22253
|
-
linterContext:
|
|
22230
|
+
linterContext: PerseusLinter.linterContextDefault
|
|
22254
22231
|
});
|
|
22255
22232
|
|
|
22256
22233
|
/**
|
|
@@ -29915,30 +29892,6 @@ var CSProgram$1 = {
|
|
|
29915
29892
|
hidden: true
|
|
29916
29893
|
};
|
|
29917
29894
|
|
|
29918
|
-
class DefinitionContent extends React.Component {
|
|
29919
|
-
componentDidMount() {
|
|
29920
|
-
this.props.trackInteraction();
|
|
29921
|
-
}
|
|
29922
|
-
|
|
29923
|
-
render() {
|
|
29924
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
29925
|
-
style: styles$o.tooltipBody
|
|
29926
|
-
}, /*#__PURE__*/React.createElement(Renderer, {
|
|
29927
|
-
apiOptions: this.props.apiOptions,
|
|
29928
|
-
content: this.props.content,
|
|
29929
|
-
widgets: this.props.widgets
|
|
29930
|
-
}));
|
|
29931
|
-
}
|
|
29932
|
-
|
|
29933
|
-
}
|
|
29934
|
-
|
|
29935
|
-
_defineProperty(DefinitionContent, "propTypes", {
|
|
29936
|
-
apiOptions: ApiOptions.propTypes,
|
|
29937
|
-
content: PropTypes.string,
|
|
29938
|
-
trackInteraction: PropTypes.func.isRequired,
|
|
29939
|
-
widgets: PropTypes.objectOf(PropTypes.any)
|
|
29940
|
-
});
|
|
29941
|
-
|
|
29942
29895
|
class Definition extends React.Component {
|
|
29943
29896
|
constructor() {
|
|
29944
29897
|
super(...arguments);
|
|
@@ -29962,25 +29915,32 @@ class Definition extends React.Component {
|
|
|
29962
29915
|
}
|
|
29963
29916
|
|
|
29964
29917
|
render() {
|
|
29965
|
-
|
|
29966
|
-
|
|
29967
|
-
|
|
29968
|
-
|
|
29969
|
-
|
|
29970
|
-
|
|
29971
|
-
|
|
29972
|
-
|
|
29973
|
-
|
|
29974
|
-
|
|
29975
|
-
|
|
29976
|
-
|
|
29977
|
-
|
|
29978
|
-
|
|
29918
|
+
return /*#__PURE__*/React.createElement(Popover, {
|
|
29919
|
+
content: /*#__PURE__*/React.createElement(PopoverContentCore, {
|
|
29920
|
+
color: "white",
|
|
29921
|
+
style: styles$o.tooltipBody,
|
|
29922
|
+
closeButtonVisible: true
|
|
29923
|
+
}, /*#__PURE__*/React.createElement(Renderer, {
|
|
29924
|
+
apiOptions: this.props.apiOptions,
|
|
29925
|
+
content: this.props.definition,
|
|
29926
|
+
widgets: this.props.widgets
|
|
29927
|
+
})),
|
|
29928
|
+
placement: "top"
|
|
29929
|
+
}, _ref => {
|
|
29930
|
+
var {
|
|
29931
|
+
open
|
|
29932
|
+
} = _ref;
|
|
29933
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
29979
29934
|
className: "perseus-widget-definition"
|
|
29980
|
-
}, /*#__PURE__*/React.createElement(
|
|
29981
|
-
|
|
29982
|
-
|
|
29983
|
-
|
|
29935
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
29936
|
+
size: "small",
|
|
29937
|
+
kind: "tertiary",
|
|
29938
|
+
onClick: () => {
|
|
29939
|
+
this.props.trackInteraction();
|
|
29940
|
+
open();
|
|
29941
|
+
}
|
|
29942
|
+
}, this.props.togglePrompt));
|
|
29943
|
+
});
|
|
29984
29944
|
}
|
|
29985
29945
|
|
|
29986
29946
|
}
|
|
@@ -29998,13 +29958,6 @@ var styles$o = {
|
|
|
29998
29958
|
fontWeight: 500,
|
|
29999
29959
|
lineHeight: "30px",
|
|
30000
29960
|
margin: Spacing.xSmall_8
|
|
30001
|
-
},
|
|
30002
|
-
definitionLink: {
|
|
30003
|
-
borderBottom: "dashed 1px ".concat(Color.blue),
|
|
30004
|
-
color: Color.blue,
|
|
30005
|
-
cursor: "pointer",
|
|
30006
|
-
display: "inline-block",
|
|
30007
|
-
textDecoration: "none"
|
|
30008
29961
|
}
|
|
30009
29962
|
};
|
|
30010
29963
|
var Definition$1 = {
|
|
@@ -30013,7 +29966,7 @@ var Definition$1 = {
|
|
|
30013
29966
|
accessible: true,
|
|
30014
29967
|
defaultAlignment: "inline",
|
|
30015
29968
|
widget: Definition,
|
|
30016
|
-
transform:
|
|
29969
|
+
transform: x => x
|
|
30017
29970
|
};
|
|
30018
29971
|
|
|
30019
29972
|
class Dropdown extends React.Component {
|
|
@@ -37731,7 +37684,7 @@ class Draggable extends React.Component {
|
|
|
37731
37684
|
onTouchCancel: this.onMouseUp
|
|
37732
37685
|
}, /*#__PURE__*/React.createElement(Renderer, {
|
|
37733
37686
|
content: this.props.content,
|
|
37734
|
-
linterContext:
|
|
37687
|
+
linterContext: PerseusLinter.pushContextStack(this.props.linterContext, "draggable"),
|
|
37735
37688
|
onRender: this.props.onRender
|
|
37736
37689
|
}));
|
|
37737
37690
|
}
|
|
@@ -37769,13 +37722,13 @@ _defineProperty(Draggable, "propTypes", {
|
|
|
37769
37722
|
onMouseUp: PropTypes.func.isRequired,
|
|
37770
37723
|
onRender: PropTypes.func.isRequired,
|
|
37771
37724
|
type: PropTypes.oneOf([STATIC, DRAGGING, ANIMATING, DISABLED]),
|
|
37772
|
-
linterContext:
|
|
37725
|
+
linterContext: PerseusLinter.linterContextProps
|
|
37773
37726
|
});
|
|
37774
37727
|
|
|
37775
37728
|
_defineProperty(Draggable, "defaultProps", {
|
|
37776
37729
|
includePadding: true,
|
|
37777
37730
|
type: STATIC,
|
|
37778
|
-
linterContext:
|
|
37731
|
+
linterContext: PerseusLinter.linterContextDefault
|
|
37779
37732
|
});
|
|
37780
37733
|
|
|
37781
37734
|
class Sortable extends React.Component {
|
|
@@ -37957,7 +37910,7 @@ class Sortable extends React.Component {
|
|
|
37957
37910
|
includePadding: this.props.padding,
|
|
37958
37911
|
margin: isLast && isStatic ? 0 : margin,
|
|
37959
37912
|
endPosition: item.endPosition,
|
|
37960
|
-
linterContext:
|
|
37913
|
+
linterContext: PerseusLinter.pushContextStack(this.props.linterContext, "sortable"),
|
|
37961
37914
|
onRender: this.remeasureItems // eslint-disable-next-line react/jsx-no-bind
|
|
37962
37915
|
,
|
|
37963
37916
|
onMouseDown: this.onMouseDown.bind(this, item.key) // eslint-disable-next-line react/jsx-no-bind
|
|
@@ -38159,7 +38112,7 @@ _defineProperty(Sortable, "defaultProps", {
|
|
|
38159
38112
|
onMeasure: function onMeasure() {},
|
|
38160
38113
|
margin: 5,
|
|
38161
38114
|
onChange: function onChange() {},
|
|
38162
|
-
linterContext:
|
|
38115
|
+
linterContext: PerseusLinter.linterContextDefault,
|
|
38163
38116
|
waitForKatexLoad: true
|
|
38164
38117
|
});
|
|
38165
38118
|
|
|
@@ -50849,7 +50802,7 @@ class ArticleRenderer extends React.Component {
|
|
|
50849
50802
|
this._handleFocusChange(newFocusPath && [refForSection].concat(newFocusPath), oldFocusPath && [refForSection].concat(oldFocusPath));
|
|
50850
50803
|
}
|
|
50851
50804
|
}),
|
|
50852
|
-
linterContext:
|
|
50805
|
+
linterContext: PerseusLinter.pushContextStack(this.props.linterContext, "article"),
|
|
50853
50806
|
legacyPerseusLint: this.props.legacyPerseusLint
|
|
50854
50807
|
})));
|
|
50855
50808
|
});
|
|
@@ -50869,14 +50822,14 @@ _defineProperty(ArticleRenderer, "propTypes", _objectSpread2(_objectSpread2({},
|
|
|
50869
50822
|
json: PropTypes.oneOfType([rendererProps, PropTypes.arrayOf(rendererProps)]).isRequired,
|
|
50870
50823
|
// Whether to use the new Bibliotron styles for articles
|
|
50871
50824
|
useNewStyles: PropTypes.bool,
|
|
50872
|
-
linterContext:
|
|
50825
|
+
linterContext: PerseusLinter.linterContextProps,
|
|
50873
50826
|
legacyPerseusLint: PropTypes.arrayOf(PropTypes.string)
|
|
50874
50827
|
}));
|
|
50875
50828
|
|
|
50876
50829
|
_defineProperty(ArticleRenderer, "defaultProps", {
|
|
50877
50830
|
apiOptions: {},
|
|
50878
50831
|
useNewStyles: false,
|
|
50879
|
-
linterContext:
|
|
50832
|
+
linterContext: PerseusLinter.linterContextDefault
|
|
50880
50833
|
});
|
|
50881
50834
|
|
|
50882
50835
|
/* Renders just a hint preview */
|
|
@@ -50942,14 +50895,14 @@ class HintRenderer extends React.Component {
|
|
|
50942
50895
|
images: hint.images,
|
|
50943
50896
|
apiOptions: rendererApiOptions,
|
|
50944
50897
|
findExternalWidgets: this.props.findExternalWidgets,
|
|
50945
|
-
linterContext:
|
|
50898
|
+
linterContext: PerseusLinter.pushContextStack(this.props.linterContext, "hint")
|
|
50946
50899
|
}));
|
|
50947
50900
|
}
|
|
50948
50901
|
|
|
50949
50902
|
}
|
|
50950
50903
|
|
|
50951
50904
|
_defineProperty(HintRenderer, "defaultProps", {
|
|
50952
|
-
linterContext:
|
|
50905
|
+
linterContext: PerseusLinter.linterContextDefault
|
|
50953
50906
|
});
|
|
50954
50907
|
|
|
50955
50908
|
var styles$5 = StyleSheet.create({
|
|
@@ -51112,7 +51065,7 @@ class HintsRenderer extends React.Component {
|
|
|
51112
51065
|
key: "hintRenderer" + i,
|
|
51113
51066
|
apiOptions: apiOptions,
|
|
51114
51067
|
findExternalWidgets: this.props.findExternalWidgets,
|
|
51115
|
-
linterContext:
|
|
51068
|
+
linterContext: PerseusLinter.pushContextStack(this.props.linterContext, "hints[" + i + "]")
|
|
51116
51069
|
});
|
|
51117
51070
|
|
|
51118
51071
|
if (isFinalHelpPage) {
|
|
@@ -51156,7 +51109,7 @@ class HintsRenderer extends React.Component {
|
|
|
51156
51109
|
}
|
|
51157
51110
|
|
|
51158
51111
|
_defineProperty(HintsRenderer, "defaultProps", {
|
|
51159
|
-
linterContext:
|
|
51112
|
+
linterContext: PerseusLinter.linterContextDefault
|
|
51160
51113
|
});
|
|
51161
51114
|
|
|
51162
51115
|
var hintIndentation = baseUnitPx + hintBorderWidth;
|
|
@@ -51397,7 +51350,7 @@ class ItemRenderer extends React.Component {
|
|
|
51397
51350
|
questionCompleted: this.state.questionCompleted,
|
|
51398
51351
|
reviewMode: this.props.reviewMode,
|
|
51399
51352
|
savedState: this.props.savedState,
|
|
51400
|
-
linterContext:
|
|
51353
|
+
linterContext: PerseusLinter.pushContextStack(this.props.linterContext, "question")
|
|
51401
51354
|
}, this.props.item.question, {
|
|
51402
51355
|
legacyPerseusLint: this.props.legacyPerseusLint
|
|
51403
51356
|
})), workArea); // TODO(LP-11406): Replace with React Portal
|
|
@@ -51408,7 +51361,7 @@ class ItemRenderer extends React.Component {
|
|
|
51408
51361
|
hints: this.props.item.hints,
|
|
51409
51362
|
hintsVisible: this.state.hintsVisible,
|
|
51410
51363
|
apiOptions: apiOptions,
|
|
51411
|
-
linterContext:
|
|
51364
|
+
linterContext: PerseusLinter.pushContextStack(this.props.linterContext, "hints")
|
|
51412
51365
|
}), hintsArea);
|
|
51413
51366
|
var answerArea = this.props.item.answerArea || {};
|
|
51414
51367
|
|
|
@@ -51665,7 +51618,7 @@ _defineProperty(ItemRenderer, "defaultProps", {
|
|
|
51665
51618
|
initialHintsVisible: 0,
|
|
51666
51619
|
workAreaSelector: "#workarea",
|
|
51667
51620
|
reviewMode: false,
|
|
51668
|
-
linterContext:
|
|
51621
|
+
linterContext: PerseusLinter.linterContextDefault
|
|
51669
51622
|
});
|
|
51670
51623
|
|
|
51671
51624
|
/**
|