@khanacademy/perseus 17.2.0 → 17.3.1
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 +19 -0
- package/dist/es/index.css +1 -13
- package/dist/es/index.js +37 -9
- package/dist/es/index.js.map +1 -1
- package/dist/index.css +1 -13
- package/dist/index.d.ts +2 -2
- package/dist/index.js +36 -8
- package/dist/index.js.map +1 -1
- package/dist/perseus-types.d.ts +2 -8
- package/dist/question-paragraph.d.ts +1 -0
- package/dist/renderer.d.ts +1 -0
- package/package.json +2 -2
- package/src/__testdata__/graphie.testdata.ts +8 -8
- package/src/__testdata__/server-item-renderer.testdata.ts +10 -12
- package/src/__tests__/mock-asset-loading-widget.tsx +5 -8
- package/src/index.ts +2 -0
- package/src/perseus-types.ts +18 -11
- package/src/question-paragraph.tsx +6 -1
- package/src/renderer.tsx +14 -7
- package/src/styles/widgets/label-image.less +1 -18
- package/src/widgets/__stories__/label-image.stories.tsx +30 -0
- package/src/widgets/__testdata__/expression.testdata.ts +13 -15
- package/src/widgets/__testdata__/label-image.testdata.ts +128 -0
- package/src/widgets/__tests__/expression-mobile.test.tsx +29 -0
- package/src/widgets/label-image/__stories__/answer-pill.stories.tsx +3 -3
- package/src/widgets/label-image/answer-pill.tsx +1 -1
- package/src/widgets/label-image.tsx +1 -1
- package/src/widgets/passage-ref-target.tsx +5 -2
- package/tsconfig-build.tsbuildinfo +1 -1
package/dist/index.css
CHANGED
|
@@ -2795,23 +2795,11 @@ body.mobile .categorizer-container td.category input[type="radio"] + span:active
|
|
|
2795
2795
|
.framework-perseus .perseus-label-image-widget-instructions div.paragraph {
|
|
2796
2796
|
margin: 0;
|
|
2797
2797
|
}
|
|
2798
|
-
.framework-perseus button[id*="perseus-label-image-widget-answer-pill"] div.paragraph,
|
|
2799
|
-
.framework-perseus div[id*="perseus-label-image-widget-answer-pill"] div.paragraph {
|
|
2800
|
-
all: revert;
|
|
2801
|
-
}
|
|
2802
|
-
.framework-perseus button[id*="perseus-label-image-widget-answer-pill"] div.perseus-block-math-inner,
|
|
2803
|
-
.framework-perseus div[id*="perseus-label-image-widget-answer-pill"] div.perseus-block-math-inner {
|
|
2804
|
-
margin: -5px 0 !important;
|
|
2805
|
-
}
|
|
2806
2798
|
@media (max-width: 767px) {
|
|
2807
|
-
[id*="perseus-label-image-widget-answer-pill"] div.paragraph {
|
|
2808
|
-
all: revert;
|
|
2809
|
-
}
|
|
2810
2799
|
[id*="perseus-label-image-widget-answer-pill"] > div.perseus-renderer-responsive {
|
|
2811
2800
|
all: revert;
|
|
2812
2801
|
}
|
|
2813
|
-
.framework-perseus.perseus-mobile [id*="perseus-label-image-widget-answer-pill"]
|
|
2814
|
-
.framework-perseus.perseus-mobile [id*="perseus-label-image-widget-answer-pill"] .perseus-renderer > .paragraph .paragraph {
|
|
2802
|
+
.framework-perseus.perseus-mobile [id*="perseus-label-image-widget-answer-pill"] mjx-container {
|
|
2815
2803
|
all: revert;
|
|
2816
2804
|
}
|
|
2817
2805
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -52,7 +52,7 @@ export { default as KhanMath } from "./util/math";
|
|
|
52
52
|
export { default as LoadingContext } from "./loading-context";
|
|
53
53
|
export { default as mediaQueries } from "./styles/media-queries";
|
|
54
54
|
export { default as PerseusMarkdown } from "./perseus-markdown";
|
|
55
|
-
export { PerseusExpressionAnswerFormConsidered, plotterPlotTypes, } from "./perseus-types";
|
|
55
|
+
export { PerseusExpressionAnswerFormConsidered, plotterPlotTypes, ItemExtras, } from "./perseus-types";
|
|
56
56
|
export { traverse } from "./traversal";
|
|
57
57
|
export { isItemRenderableByVersion } from "./renderability";
|
|
58
58
|
export { violatingWidgets } from "./a11y";
|
|
@@ -81,7 +81,7 @@ export type { ILogger, LogErrorOptions, ErrorKind } from "./logging/log";
|
|
|
81
81
|
export type { ServerItemRenderer as ServerItemRendererComponent } from "./server-item-renderer";
|
|
82
82
|
export type { Alignment, APIOptions, APIOptionsWithDefaults, ChangeHandler, DeviceType, DomInsertCheckFn, EditorMode, FocusPath, Hint, ImageDict, ImageUploader, JiptLabelStore, JiptRenderer, PerseusDependencies, PerseusScore, Version, VideoData, VideoKind, WidgetDict, WidgetExports, WidgetInfo, } from "./types";
|
|
83
83
|
export type { ParsedValue } from "./util";
|
|
84
|
-
export type { MathFormat, InputNumberWidget, PerseusImageBackground, PerseusInteractiveGraphWidgetOptions, PerseusRadioWidgetOptions, PerseusExpressionWidgetOptions, PerseusPlotterWidgetOptions, PerseusRenderer, } from "./perseus-types";
|
|
84
|
+
export type { MathFormat, InputNumberWidget, PerseusImageBackground, PerseusInteractiveGraphWidgetOptions, PerseusRadioWidgetOptions, PerseusExpressionWidgetOptions, PerseusPlotterWidgetOptions, PerseusRenderer, PerseusAnswerArea, } from "./perseus-types";
|
|
85
85
|
export type { Coord } from "./interactive2/types";
|
|
86
86
|
export type { MarkerType } from "./widgets/label-image/types";
|
|
87
87
|
/**
|
package/dist/index.js
CHANGED
|
@@ -18263,7 +18263,7 @@ class QuestionParagraph extends React__namespace.Component {
|
|
|
18263
18263
|
// For perseus-article just-in-place-translation (jipt), we need
|
|
18264
18264
|
// to attach some metadata to top-level QuestionParagraphs:
|
|
18265
18265
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
18266
|
-
className: className,
|
|
18266
|
+
className: this.props.inline ? this.props.className ?? undefined : className,
|
|
18267
18267
|
"data-perseus-component-index": this.props.translationIndex,
|
|
18268
18268
|
"data-perseus-paragraph-index": this.props.paragraphIndex
|
|
18269
18269
|
}, this.props.children);
|
|
@@ -19621,7 +19621,8 @@ class Renderer extends React__namespace.Component {
|
|
|
19621
19621
|
key: state.key,
|
|
19622
19622
|
className: className,
|
|
19623
19623
|
translationIndex: this.translationIndex,
|
|
19624
|
-
paragraphIndex: state.paragraphIndex
|
|
19624
|
+
paragraphIndex: state.paragraphIndex,
|
|
19625
|
+
inline: this.props.inline
|
|
19625
19626
|
}, /*#__PURE__*/React__namespace.createElement(ErrorBoundary, null, output));
|
|
19626
19627
|
};
|
|
19627
19628
|
|
|
@@ -20333,12 +20334,14 @@ class Renderer extends React__namespace.Component {
|
|
|
20333
20334
|
this._isTwoColumn = false;
|
|
20334
20335
|
|
|
20335
20336
|
// Parse the string of markdown to a parse tree
|
|
20336
|
-
const parsedMarkdown = PerseusMarkdown.
|
|
20337
|
+
const parsedMarkdown = this.props.inline ? PerseusMarkdown.parseInline(content, {
|
|
20337
20338
|
// Recognize crowdin IDs while translating articles
|
|
20338
20339
|
// (This should never be hit by exercises, though if you
|
|
20339
20340
|
// decide you want to add a check that this is an article,
|
|
20340
20341
|
// go for it.)
|
|
20341
20342
|
isJipt: this.translationIndex != null
|
|
20343
|
+
}) : PerseusMarkdown.parse(content, {
|
|
20344
|
+
isJipt: this.translationIndex != null
|
|
20342
20345
|
});
|
|
20343
20346
|
|
|
20344
20347
|
// Optionally apply the linter to the parse tree
|
|
@@ -31203,7 +31206,8 @@ const AnswerPill = props => {
|
|
|
31203
31206
|
":focus": bringToFront
|
|
31204
31207
|
}, correct && styles$i.correct, incorrect && styles$i.incorrect]
|
|
31205
31208
|
}, /*#__PURE__*/React__namespace.createElement(Renderer, {
|
|
31206
|
-
content: answerString
|
|
31209
|
+
content: answerString,
|
|
31210
|
+
inline: true
|
|
31207
31211
|
}));
|
|
31208
31212
|
});
|
|
31209
31213
|
};
|
|
@@ -31973,7 +31977,7 @@ class LabelImage extends React__namespace.Component {
|
|
|
31973
31977
|
};
|
|
31974
31978
|
|
|
31975
31979
|
const adjustPillDistance = {
|
|
31976
|
-
[`margin${markerPosition.charAt(0).toUpperCase() + markerPosition.slice(1)}`]:
|
|
31980
|
+
[`margin${markerPosition.charAt(0).toUpperCase() + markerPosition.slice(1)}`]: 15 // move pill further from marker
|
|
31977
31981
|
};
|
|
31978
31982
|
|
|
31979
31983
|
const showAnswerChoice = !answerChoicesActive && !this.state.hideAnswers;
|
|
@@ -38453,9 +38457,12 @@ class PassageRefTarget extends React__namespace.Component {
|
|
|
38453
38457
|
render() {
|
|
38454
38458
|
return /*#__PURE__*/React__namespace.createElement(Renderer, {
|
|
38455
38459
|
content: this.props.content
|
|
38456
|
-
//
|
|
38460
|
+
// This was already here before inline was recently added (#873)
|
|
38461
|
+
// It was for a different use case a long time ago:
|
|
38462
|
+
// https://phabricator.khanacademy.org/D12113
|
|
38463
|
+
// Commenting out to prevent unanticipated side effects
|
|
38464
|
+
// inline={true}
|
|
38457
38465
|
,
|
|
38458
|
-
inline: true,
|
|
38459
38466
|
apiOptions: this.props.apiOptions,
|
|
38460
38467
|
linterContext: this.props.linterContext
|
|
38461
38468
|
});
|
|
@@ -44321,7 +44328,7 @@ const init = function (options) {
|
|
|
44321
44328
|
|
|
44322
44329
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
44323
44330
|
const libName = "@khanacademy/perseus";
|
|
44324
|
-
const libVersion = "17.
|
|
44331
|
+
const libVersion = "17.3.1";
|
|
44325
44332
|
perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
44326
44333
|
|
|
44327
44334
|
const apiVersion = {
|
|
@@ -45652,6 +45659,26 @@ var constants = /*#__PURE__*/Object.freeze({
|
|
|
45652
45659
|
|
|
45653
45660
|
// TODO(FEI-5054): Figure out how to get global .d.ts files working with monorepos
|
|
45654
45661
|
|
|
45662
|
+
const ItemExtras = [
|
|
45663
|
+
// The user might benefit from using a Scientific Calculator. Provided on Khan Academy when true
|
|
45664
|
+
"calculator",
|
|
45665
|
+
// The user might benefit from using a statistics Chi Squared Table like https://people.richland.edu/james/lecture/m170/tbl-chi.html
|
|
45666
|
+
"chi2Table",
|
|
45667
|
+
// The user might benefit from a monthly payments calculator. Provided on Khan Academy when true
|
|
45668
|
+
"financialCalculatorMonthlyPayment",
|
|
45669
|
+
// The user might benefit from a total amount calculator. Provided on Khan Academy when true
|
|
45670
|
+
"financialCalculatorTotalAmount",
|
|
45671
|
+
// The user might benefit from a time to pay off calculator. Provided on Khan Academy when true
|
|
45672
|
+
"financialCalculatorTimeToPayOff",
|
|
45673
|
+
// The user might benefit from using a Periodic Table of Elements. Provided on Khan Academy when true
|
|
45674
|
+
"periodicTable",
|
|
45675
|
+
// The user might benefit from using a Periodic Table of Elements with key. Provided on Khan Academy when true
|
|
45676
|
+
"periodicTableWithKey",
|
|
45677
|
+
// The user might benefit from using a statistics T Table like https://www.statisticshowto.com/tables/t-distribution-table/
|
|
45678
|
+
"tTable",
|
|
45679
|
+
// The user might benefit from using a statistics Z Table like https://www.ztable.net/
|
|
45680
|
+
"zTable"];
|
|
45681
|
+
|
|
45655
45682
|
// prettier-ignore
|
|
45656
45683
|
|
|
45657
45684
|
// prettier-ignore
|
|
@@ -46884,6 +46911,7 @@ exports.HintRenderer = HintRenderer;
|
|
|
46884
46911
|
exports.HintsRenderer = HintsRenderer;
|
|
46885
46912
|
exports.InputNumber = InputNumber$1;
|
|
46886
46913
|
exports.InteractiveGraphWidget = InteractiveGraph$1;
|
|
46914
|
+
exports.ItemExtras = ItemExtras;
|
|
46887
46915
|
exports.JiptParagraphs = JiptParagraphs;
|
|
46888
46916
|
exports.KhanColors = KhanColors;
|
|
46889
46917
|
exports.KhanMath = KhanMath;
|