@khanacademy/perseus 17.3.2 → 17.4.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 +16 -0
- package/dist/es/index.css +12 -10
- package/dist/es/index.js +16 -9
- package/dist/es/index.js.map +1 -1
- package/dist/index.css +12 -10
- package/dist/index.d.ts +1 -1
- package/dist/index.js +16 -9
- package/dist/index.js.map +1 -1
- package/dist/perseus-api.d.ts +2 -2
- package/dist/server-item-renderer.d.ts +6 -6
- package/dist/types.d.ts +4 -8
- package/dist/widgets/expression.d.ts +12 -12
- package/dist/widgets/label-image.d.ts +2 -2
- package/package.json +1 -1
- package/src/__tests__/server-item-renderer.test.tsx +23 -7
- package/src/article-renderer.tsx +15 -9
- package/src/index.ts +5 -4
- package/src/server-item-renderer.tsx +23 -14
- package/src/styles/articles.less +20 -15
- package/src/types.ts +8 -8
- package/src/widgets/__stories__/expression.stories.tsx +2 -0
- package/tsconfig-build.tsbuildinfo +1 -1
package/dist/index.css
CHANGED
|
@@ -1490,6 +1490,18 @@ body.mobile ul.inequalities-one-line-radios > li {
|
|
|
1490
1490
|
clear: both;
|
|
1491
1491
|
}
|
|
1492
1492
|
/* Fall back colors? Eg educator, talks & interviews */
|
|
1493
|
+
.framework-perseus code {
|
|
1494
|
+
font-family: Courier, monospace;
|
|
1495
|
+
}
|
|
1496
|
+
.framework-perseus pre {
|
|
1497
|
+
background-color: #f0f1f2;
|
|
1498
|
+
border-radius: 4px;
|
|
1499
|
+
color: #21242c;
|
|
1500
|
+
font-size: 18px;
|
|
1501
|
+
padding: 16px;
|
|
1502
|
+
white-space: pre;
|
|
1503
|
+
overflow: auto;
|
|
1504
|
+
}
|
|
1493
1505
|
.framework-perseus.perseus-article:not(.perseus-mobile) .perseus-widget-container:not(.perseus-widget__definition) {
|
|
1494
1506
|
font-size: 14px;
|
|
1495
1507
|
line-height: 19.6px;
|
|
@@ -1634,17 +1646,7 @@ body.mobile ul.inequalities-one-line-radios > li {
|
|
|
1634
1646
|
line-height: 1.5;
|
|
1635
1647
|
margin: 0;
|
|
1636
1648
|
}
|
|
1637
|
-
.framework-perseus.perseus-article:not(.perseus-mobile) code {
|
|
1638
|
-
font-family: Courier, monospace;
|
|
1639
|
-
}
|
|
1640
1649
|
.framework-perseus.perseus-article:not(.perseus-mobile) pre {
|
|
1641
|
-
background-color: #f0f1f2;
|
|
1642
|
-
border-radius: 4px;
|
|
1643
|
-
color: #21242c;
|
|
1644
|
-
font-size: 18px;
|
|
1645
|
-
padding: 16px;
|
|
1646
|
-
white-space: pre;
|
|
1647
|
-
overflow: auto;
|
|
1648
1650
|
margin: 0 -16px 32px -16px;
|
|
1649
1651
|
}
|
|
1650
1652
|
.framework-perseus:not(.perseus-article):not(.perseus-mobile) .perseus-radio-option-content .perseus-renderer > .paragraph {
|
package/dist/index.d.ts
CHANGED
|
@@ -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,
|
|
84
|
+
export type { InputNumberWidget, MathFormat, PerseusAnswerArea, PerseusExpressionWidgetOptions, PerseusImageBackground, PerseusInteractiveGraphWidgetOptions, PerseusItem, PerseusPlotterWidgetOptions, PerseusRadioWidgetOptions, PerseusRenderer, } 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
|
@@ -44337,7 +44337,7 @@ const init = function (options) {
|
|
|
44337
44337
|
|
|
44338
44338
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
44339
44339
|
const libName = "@khanacademy/perseus";
|
|
44340
|
-
const libVersion = "17.
|
|
44340
|
+
const libVersion = "17.4.0";
|
|
44341
44341
|
perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
44342
44342
|
|
|
44343
44343
|
const apiVersion = {
|
|
@@ -44404,9 +44404,6 @@ class ArticleRenderer extends React__namespace.Component {
|
|
|
44404
44404
|
});
|
|
44405
44405
|
focusedInput = this.sectionRenderers[sectionIndex].getDOMNodeForPath(focusPath);
|
|
44406
44406
|
}
|
|
44407
|
-
if (this.props.apiOptions.onFocusChange != null) {
|
|
44408
|
-
this.props.apiOptions.onFocusChange(this._currentFocus, prevFocusPath, didFocusInput ? keypadElement?.getDOMNode() : null, didFocusInput ? focusedInput : null);
|
|
44409
|
-
}
|
|
44410
44407
|
if (keypadElement && isMobile) {
|
|
44411
44408
|
if (didFocusInput) {
|
|
44412
44409
|
keypadElement.activate();
|
|
@@ -44414,6 +44411,11 @@ class ArticleRenderer extends React__namespace.Component {
|
|
|
44414
44411
|
keypadElement.dismiss();
|
|
44415
44412
|
}
|
|
44416
44413
|
}
|
|
44414
|
+
if (this.props.apiOptions.onFocusChange != null) {
|
|
44415
|
+
const keypadDomNode = keypadElement?.getDOMNode();
|
|
44416
|
+
const keypadHeight = keypadDomNode && didFocusInput ? keypadDomNode.getBoundingClientRect().height : 0;
|
|
44417
|
+
this.props.apiOptions.onFocusChange(this._currentFocus, prevFocusPath, keypadHeight, didFocusInput ? focusedInput : null);
|
|
44418
|
+
}
|
|
44417
44419
|
};
|
|
44418
44420
|
_onRendererBlur = blurPath => {
|
|
44419
44421
|
const blurringFocusPath = this._currentFocus;
|
|
@@ -44951,11 +44953,6 @@ class ServerItemRenderer extends React__namespace.Component {
|
|
|
44951
44953
|
const didFocusInput = this._currentFocus && inputPaths.some(inputPath => {
|
|
44952
44954
|
return Util.inputPathsEqual(inputPath, this._currentFocus);
|
|
44953
44955
|
});
|
|
44954
|
-
if (onFocusChange != null) {
|
|
44955
|
-
onFocusChange(this._currentFocus, prevFocus, didFocusInput ? keypadElement?.getDOMNode() : null,
|
|
44956
|
-
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'false | Element | Text | null | undefined' is not assignable to parameter of type 'HTMLElement | undefined'.
|
|
44957
|
-
didFocusInput && this.questionRenderer.getDOMNodeForPath(newFocus));
|
|
44958
|
-
}
|
|
44959
44956
|
if (keypadElement && isMobile) {
|
|
44960
44957
|
if (didFocusInput) {
|
|
44961
44958
|
keypadElement.activate();
|
|
@@ -44963,6 +44960,16 @@ class ServerItemRenderer extends React__namespace.Component {
|
|
|
44963
44960
|
keypadElement.dismiss();
|
|
44964
44961
|
}
|
|
44965
44962
|
}
|
|
44963
|
+
if (onFocusChange != null) {
|
|
44964
|
+
// First, calculate the current keypad height
|
|
44965
|
+
const keypadDomNode = keypadElement?.getDOMNode();
|
|
44966
|
+
const keypadHeight = keypadDomNode && didFocusInput ? keypadDomNode.getBoundingClientRect().height : 0;
|
|
44967
|
+
|
|
44968
|
+
// Then call the callback
|
|
44969
|
+
onFocusChange(this._currentFocus, prevFocus, keypadHeight,
|
|
44970
|
+
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'false | Element | Text | null | undefined' is not assignable to parameter of type 'HTMLElement | undefined'.
|
|
44971
|
+
didFocusInput && this.questionRenderer.getDOMNodeForPath(newFocus));
|
|
44972
|
+
}
|
|
44966
44973
|
}
|
|
44967
44974
|
_onRendererBlur(blurPath) {
|
|
44968
44975
|
const blurringFocusPath = this._currentFocus;
|