@khanacademy/perseus 28.2.0 → 29.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/components/lint.d.ts +1 -8
- package/dist/es/index.js +30 -90
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +29 -90
- package/dist/index.js.map +1 -1
- package/dist/interactive2/arrowhead.d.ts +1 -1
- package/dist/interactive2/get-clip-point.d.ts +1 -1
- package/dist/interactive2/movable-point.d.ts +1 -2
- package/dist/perseus-api.d.ts +3 -3
- package/dist/perseus-types.d.ts +15 -1
- package/dist/server-item-renderer.d.ts +5 -5
- package/dist/util/fix-passage-refs.d.ts +3 -2
- package/dist/widgets/expression.d.ts +24 -24
- package/dist/widgets/interactive-graphs/interactive-graph-question-builder.d.ts +1 -1
- package/dist/widgets/interactive-graphs/reducer/initialize-graph-state.d.ts +1 -1
- package/dist/widgets/interactive-graphs/reducer/interactive-graph-state.d.ts +1 -1
- package/dist/widgets/interactive-graphs/stateful-mafs-graph.d.ts +1 -1
- package/dist/widgets/interactive-graphs/types.d.ts +1 -1
- package/dist/widgets/label-image.d.ts +6 -6
- package/dist/widgets/measurer.d.ts +4 -4
- package/package.json +1 -1
- package/dist/perseus-env.d.ts +0 -3
package/dist/index.d.ts
CHANGED
|
@@ -88,7 +88,7 @@ export type { ServerItemRenderer as ServerItemRendererComponent } from "./server
|
|
|
88
88
|
export type { Alignment, APIOptions, APIOptionsWithDefaults, ChangeHandler, DeviceType, DomInsertCheckFn, EditorMode, FocusPath, ImageDict, ImageUploader, JiptLabelStore, JiptRenderer, PerseusDependencies, PerseusScore, Version, VideoData, VideoKind, WidgetDict, WidgetExports, } from "./types";
|
|
89
89
|
export type { ParsedValue } from "./util";
|
|
90
90
|
export type { Hint, LegacyButtonSets, LockedFigure, LockedFigureColor, LockedFigureFillType, LockedFigureType, LockedPointType, LockedLineType, LockedVectorType, LockedEllipseType, LockedPolygonType, LockedFunctionType, PerseusGraphType, PerseusAnswerArea, PerseusExpressionWidgetOptions, Range, Size, CollinearTuple, MathFormat, InputNumberWidget, // TODO(jeremy): remove?
|
|
91
|
-
PerseusImageBackground, PerseusInputNumberWidgetOptions, PerseusInteractiveGraphWidgetOptions, PerseusItem, PerseusPlotterWidgetOptions, PerseusPythonProgramWidgetOptions, PerseusRadioWidgetOptions, PerseusExampleWidgetOptions, PerseusExampleGraphieWidgetOptions, PerseusSimpleMarkdownTesterWidgetOptions, PerseusRenderer, PerseusWidget, PerseusWidgetsMap, } from "./perseus-types";
|
|
91
|
+
PerseusImageBackground, PerseusInputNumberWidgetOptions, PerseusInteractiveGraphWidgetOptions, PerseusItem, PerseusPlotterWidgetOptions, PerseusPythonProgramWidgetOptions, PerseusRadioWidgetOptions, PerseusExampleWidgetOptions, PerseusExampleGraphieWidgetOptions, PerseusSimpleMarkdownTesterWidgetOptions, PerseusRenderer, PerseusWidget, PerseusWidgetsMap, MultiItem, } from "./perseus-types";
|
|
92
92
|
export type { Coord } from "./interactive2/types";
|
|
93
93
|
export type { MarkerType } from "./widgets/label-image/types";
|
|
94
94
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1395,7 +1395,7 @@ const KhanMath = {
|
|
|
1395
1395
|
* with an approx symbol if num had to be rounded, and trailing 0s
|
|
1396
1396
|
*/
|
|
1397
1397
|
toFixedApprox: function (num, precision) {
|
|
1398
|
-
// TODO(aria): Make this locale-dependent
|
|
1398
|
+
// TODO(aria): Make this locale-dependent
|
|
1399
1399
|
const fixedStr = num.toFixed(precision);
|
|
1400
1400
|
if (kmath.number.equal(+fixedStr, num)) {
|
|
1401
1401
|
return fixedStr;
|
|
@@ -18331,39 +18331,10 @@ var Severity = /*#__PURE__*/function (Severity) {
|
|
|
18331
18331
|
**/
|
|
18332
18332
|
class Lint extends React__namespace.Component {
|
|
18333
18333
|
_positionTimeout;
|
|
18334
|
-
state = {
|
|
18335
|
-
tooltipAbove: true
|
|
18336
|
-
};
|
|
18337
|
-
componentDidMount() {
|
|
18338
|
-
// TODO(somewhatabstract): Use WB timing
|
|
18339
|
-
// eslint-disable-next-line no-restricted-syntax
|
|
18340
|
-
this._positionTimeout = window.setTimeout(this.getPosition);
|
|
18341
|
-
}
|
|
18342
|
-
componentWillUnmount() {
|
|
18343
|
-
// TODO(somewhatabstract): Use WB timing
|
|
18344
|
-
// eslint-disable-next-line no-restricted-syntax
|
|
18345
|
-
window.clearTimeout(this._positionTimeout);
|
|
18346
|
-
}
|
|
18347
|
-
|
|
18348
|
-
// We can't call setState in componentDidMount without risking a render
|
|
18349
|
-
// thrash, and we can't call getBoundingClientRect in render, so we
|
|
18350
|
-
// borrow a timeout approach from learnstorm-dashboard.jsx and set our
|
|
18351
|
-
// state once the component has mounted and we can get what we need.
|
|
18352
|
-
getPosition = () => {
|
|
18353
|
-
// @ts-expect-error - TS2531 - Object is possibly 'null'. | TS2339 - Property 'getBoundingClientRect' does not exist on type 'Element | Text'.
|
|
18354
|
-
const rect = ReactDOM__default["default"].findDOMNode(this).getBoundingClientRect();
|
|
18355
|
-
// TODO(scottgrant): This is a magic number! We don't know the size
|
|
18356
|
-
// of the tooltip at this point, so we're arbitrarily choosing a
|
|
18357
|
-
// point at which to flip the tooltip's position.
|
|
18358
|
-
this.setState({
|
|
18359
|
-
tooltipAbove: rect.top > 100
|
|
18360
|
-
});
|
|
18361
|
-
};
|
|
18362
18334
|
|
|
18363
18335
|
// Render the <a> element that holds the indicator icon and the tooltip
|
|
18364
18336
|
// We pass different styles for the inline and block cases
|
|
18365
18337
|
renderLink = style => {
|
|
18366
|
-
const tooltipAbove = this.state.tooltipAbove;
|
|
18367
18338
|
let severityStyle;
|
|
18368
18339
|
let warningText;
|
|
18369
18340
|
let warningTextStyle;
|
|
@@ -18380,22 +18351,21 @@ class Lint extends React__namespace.Component {
|
|
|
18380
18351
|
warningText = "Recommendation";
|
|
18381
18352
|
warningTextStyle = styles$B.warning;
|
|
18382
18353
|
}
|
|
18383
|
-
return /*#__PURE__*/React__namespace.createElement("
|
|
18354
|
+
return /*#__PURE__*/React__namespace.createElement(Tooltip__default["default"], {
|
|
18355
|
+
backgroundColor: "offBlack",
|
|
18356
|
+
content: /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, this.props.message.split("\n\n").map((m, i) => /*#__PURE__*/React__namespace.createElement("p", {
|
|
18357
|
+
key: i,
|
|
18358
|
+
className: aphrodite.css(styles$B.tooltipParagraph)
|
|
18359
|
+
}, /*#__PURE__*/React__namespace.createElement("span", {
|
|
18360
|
+
className: aphrodite.css(warningTextStyle)
|
|
18361
|
+
}, warningText, ":", " "), m)))
|
|
18362
|
+
}, /*#__PURE__*/React__namespace.createElement("a", {
|
|
18384
18363
|
href: `https://khanacademy.org/r/linter-rules#${this.props.ruleName}`,
|
|
18385
18364
|
target: "lint-help-window",
|
|
18386
18365
|
className: aphrodite.css(style)
|
|
18387
18366
|
}, /*#__PURE__*/React__namespace.createElement("span", {
|
|
18388
18367
|
className: aphrodite.css(styles$B.indicator, severityStyle)
|
|
18389
|
-
}, this.props.severity === 1 && /*#__PURE__*/React__namespace.createElement(InlineIcon, exclamationIcon))
|
|
18390
|
-
className: aphrodite.css(styles$B.tooltip, tooltipAbove && styles$B.tooltipAbove)
|
|
18391
|
-
}, this.props.message.split("\n\n").map((m, i) => /*#__PURE__*/React__namespace.createElement("p", {
|
|
18392
|
-
key: i,
|
|
18393
|
-
className: aphrodite.css(styles$B.tooltipParagraph)
|
|
18394
|
-
}, /*#__PURE__*/React__namespace.createElement("span", {
|
|
18395
|
-
className: aphrodite.css(warningTextStyle)
|
|
18396
|
-
}, warningText, ":", " "), m)), /*#__PURE__*/React__namespace.createElement("div", {
|
|
18397
|
-
className: aphrodite.css(styles$B.tail, tooltipAbove && styles$B.tailAbove)
|
|
18398
|
-
})));
|
|
18368
|
+
}, this.props.severity === 1 && /*#__PURE__*/React__namespace.createElement(InlineIcon, exclamationIcon))));
|
|
18399
18369
|
};
|
|
18400
18370
|
|
|
18401
18371
|
// The main render method surrounds linty content with a block or
|
|
@@ -18598,54 +18568,11 @@ const styles$B = aphrodite.StyleSheet.create({
|
|
|
18598
18568
|
indicatorGuideline: {
|
|
18599
18569
|
backgroundColor: "#ffbe26"
|
|
18600
18570
|
},
|
|
18601
|
-
// These are the styles for the tooltip
|
|
18602
|
-
tooltip: {
|
|
18603
|
-
// Absolute positioning relative to the lint indicator circle.
|
|
18604
|
-
position: "absolute",
|
|
18605
|
-
right: -12,
|
|
18606
|
-
// The tooltip is hidden by default; only displayed on hover
|
|
18607
|
-
display: "none",
|
|
18608
|
-
// When it is displayed, it goes on top!
|
|
18609
|
-
zIndex: 1000,
|
|
18610
|
-
// These styles control what the tooltip looks like
|
|
18611
|
-
color: white$1,
|
|
18612
|
-
backgroundColor: gray17,
|
|
18613
|
-
opacity: 0.9,
|
|
18614
|
-
fontFamily: baseFontFamily$1,
|
|
18615
|
-
fontSize: "12px",
|
|
18616
|
-
lineHeight: "15px",
|
|
18617
|
-
width: "320px",
|
|
18618
|
-
borderRadius: "4px"
|
|
18619
|
-
},
|
|
18620
|
-
// If we're going to render the tooltip above the warning circle, we use
|
|
18621
|
-
// the previous rules in tooltip, but change the position slightly.
|
|
18622
|
-
tooltipAbove: {
|
|
18623
|
-
bottom: 32
|
|
18624
|
-
},
|
|
18625
|
-
// We give the tooltip a little triangular "tail" that points down at
|
|
18626
|
-
// the lint indicator circle. This is inside the tooltip and positioned
|
|
18627
|
-
// relative to it. It also shares the opacity of the tooltip. We're using
|
|
18628
|
-
// the standard CSS trick for drawing triangles with a thick border.
|
|
18629
|
-
tail: {
|
|
18630
|
-
position: "absolute",
|
|
18631
|
-
top: -12,
|
|
18632
|
-
right: 16,
|
|
18633
|
-
width: 0,
|
|
18634
|
-
height: 0,
|
|
18635
|
-
// This is the CSS triangle trick
|
|
18636
|
-
borderLeft: "8px solid transparent",
|
|
18637
|
-
borderRight: "8px solid transparent",
|
|
18638
|
-
borderBottom: "12px solid " + gray17
|
|
18639
|
-
},
|
|
18640
|
-
tailAbove: {
|
|
18641
|
-
bottom: -12,
|
|
18642
|
-
borderBottom: "none",
|
|
18643
|
-
borderTop: "12px solid " + gray17,
|
|
18644
|
-
top: "auto"
|
|
18645
|
-
},
|
|
18646
18571
|
// Each warning in the tooltip is its own <p>. They are 12 pixels from
|
|
18647
18572
|
// the edges of the tooltip and 12 pixels from each other.
|
|
18648
18573
|
tooltipParagraph: {
|
|
18574
|
+
fontFamily: wonderBlocksTokens.font.family.sans,
|
|
18575
|
+
color: wonderBlocksTokens.color.white,
|
|
18649
18576
|
margin: 12
|
|
18650
18577
|
},
|
|
18651
18578
|
// The text "Warning" inside the tooltip is highlighted like this
|
|
@@ -22792,7 +22719,7 @@ var sharedStyles = aphrodite.StyleSheet.create({
|
|
|
22792
22719
|
zIndex: zIndexAboveScratchpad
|
|
22793
22720
|
},
|
|
22794
22721
|
blankBackground: {
|
|
22795
|
-
// TODO(emily): Use
|
|
22722
|
+
// TODO(emily): Use WB colors?
|
|
22796
22723
|
backgroundColor: "#FDFDFD"
|
|
22797
22724
|
},
|
|
22798
22725
|
perseusSrOnly: {
|
|
@@ -29997,6 +29924,18 @@ const LegacyGrid = _ref => {
|
|
|
29997
29924
|
|
|
29998
29925
|
// Range is replaced within this file with Interval, but it is used elsewhere
|
|
29999
29926
|
// and exported from the package, so we need to keep it around.
|
|
29927
|
+
/**
|
|
29928
|
+
* A "PerseusItem" is a classic Perseus item. It is rendered by the
|
|
29929
|
+
* `ServerItemRenderer` and the layout is pre-set.
|
|
29930
|
+
*
|
|
29931
|
+
* To render more complex Perseus items, see the `Item` type in the multi item
|
|
29932
|
+
* area.
|
|
29933
|
+
*/
|
|
29934
|
+
/**
|
|
29935
|
+
* A "MultiItem" is an advanced Perseus item. It is rendered by the
|
|
29936
|
+
* `MultiRenderer` and you can control the layout of individual parts of the
|
|
29937
|
+
* item.
|
|
29938
|
+
*/
|
|
30000
29939
|
const ItemExtras = [
|
|
30001
29940
|
// The user might benefit from using a Scientific Calculator. Provided on Khan Academy when true
|
|
30002
29941
|
"calculator",
|
|
@@ -32219,7 +32158,8 @@ const MafsGraph = props => {
|
|
|
32219
32158
|
boxSizing: "content-box",
|
|
32220
32159
|
marginLeft: "20px",
|
|
32221
32160
|
marginBottom: "20px",
|
|
32222
|
-
pointerEvents: props.static ? "none" : "auto"
|
|
32161
|
+
pointerEvents: props.static ? "none" : "auto",
|
|
32162
|
+
userSelect: "none"
|
|
32223
32163
|
}
|
|
32224
32164
|
}, /*#__PURE__*/React__namespace.createElement(LegacyGrid, {
|
|
32225
32165
|
box: props.box,
|
|
@@ -44612,7 +44552,7 @@ const init = function (options) {
|
|
|
44612
44552
|
|
|
44613
44553
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
44614
44554
|
const libName = "@khanacademy/perseus";
|
|
44615
|
-
const libVersion = "
|
|
44555
|
+
const libVersion = "29.0.0";
|
|
44616
44556
|
perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
44617
44557
|
|
|
44618
44558
|
const apiVersion = {
|
|
@@ -48033,7 +47973,6 @@ const genericPerseusItemData = {
|
|
|
48033
47973
|
minor: 1
|
|
48034
47974
|
},
|
|
48035
47975
|
hints: [],
|
|
48036
|
-
_multi: null,
|
|
48037
47976
|
answer: null
|
|
48038
47977
|
};
|
|
48039
47978
|
|