@khanacademy/perseus 25.1.1 → 26.1.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/fixed-to-responsive.d.ts +1 -1
- package/dist/components/hud.d.ts +2 -2
- package/dist/components/i18n-context.d.ts +1 -1
- package/dist/components/info-tip/info-tip.d.ts +1 -1
- package/dist/components/math-input.d.ts +1 -1
- package/dist/components/tooltip.d.ts +2 -2
- package/dist/es/index.css +2 -2
- package/dist/es/index.js +55 -14
- package/dist/es/index.js.map +1 -1
- package/dist/index.css +2 -2
- package/dist/index.js +55 -14
- package/dist/index.js.map +1 -1
- package/dist/renderer.d.ts +8 -1
- package/dist/types.d.ts +1 -0
- package/dist/util/react-render.d.ts +9 -1
- package/dist/widget-container.d.ts +1 -1
- package/dist/widgets/deprecated-standin/index.d.ts +1 -1
- package/dist/widgets/expression.d.ts +6 -4
- package/dist/widgets/interactive-graph.d.ts +1 -1
- package/dist/widgets/interactive-graphs/backgrounds/axis-arrows.d.ts +2 -2
- package/dist/widgets/interactive-graphs/backgrounds/axis-labels.d.ts +2 -2
- package/dist/widgets/interactive-graphs/backgrounds/axis-tick-labels.d.ts +2 -2
- package/dist/widgets/interactive-graphs/backgrounds/axis-ticks.d.ts +2 -2
- package/dist/widgets/interactive-graphs/backgrounds/grid.d.ts +2 -2
- package/dist/widgets/interactive-graphs/backgrounds/legacy-grid.d.ts +2 -2
- package/dist/widgets/interactive-graphs/graph-locked-layer.d.ts +2 -2
- package/dist/widgets/interactive-graphs/graphs/angle.d.ts +2 -2
- package/dist/widgets/interactive-graphs/graphs/circle.d.ts +2 -2
- package/dist/widgets/interactive-graphs/graphs/components/angle-indicators.d.ts +3 -3
- package/dist/widgets/interactive-graphs/graphs/components/arrowhead.d.ts +2 -2
- package/dist/widgets/interactive-graphs/graphs/components/css-transform-wrapper.d.ts +1 -1
- package/dist/widgets/interactive-graphs/graphs/components/movable-line.d.ts +3 -3
- package/dist/widgets/interactive-graphs/graphs/components/movable-point.d.ts +2 -2
- package/dist/widgets/interactive-graphs/graphs/components/svg-line.d.ts +2 -1
- package/dist/widgets/interactive-graphs/graphs/components/text-label.d.ts +3 -2
- package/dist/widgets/interactive-graphs/graphs/components/vector.d.ts +1 -1
- package/dist/widgets/interactive-graphs/graphs/linear-system.d.ts +2 -2
- package/dist/widgets/interactive-graphs/graphs/linear.d.ts +2 -2
- package/dist/widgets/interactive-graphs/graphs/point.d.ts +2 -2
- package/dist/widgets/interactive-graphs/graphs/polygon.d.ts +2 -2
- package/dist/widgets/interactive-graphs/graphs/quadratic.d.ts +2 -2
- package/dist/widgets/interactive-graphs/graphs/ray.d.ts +2 -2
- package/dist/widgets/interactive-graphs/graphs/segment.d.ts +2 -2
- package/dist/widgets/interactive-graphs/graphs/sinusoid.d.ts +2 -2
- package/dist/widgets/interactive-graphs/locked-figures/locked-ellipse.d.ts +2 -2
- package/dist/widgets/interactive-graphs/locked-figures/locked-function.d.ts +2 -2
- package/dist/widgets/interactive-graphs/locked-figures/locked-line.d.ts +2 -2
- package/dist/widgets/interactive-graphs/locked-figures/locked-point.d.ts +2 -2
- package/dist/widgets/interactive-graphs/locked-figures/locked-polygon.d.ts +2 -2
- package/dist/widgets/interactive-graphs/locked-figures/locked-vector.d.ts +2 -2
- package/dist/widgets/interactive-graphs/mafs-graph.d.ts +2 -1
- package/dist/widgets/interactive-graphs/protractor.d.ts +2 -2
- package/dist/widgets/interactive-graphs/stateful-mafs-graph.d.ts +1 -0
- package/dist/widgets/label-image/answer-choices.d.ts +2 -2
- package/dist/widgets/label-image/answer-pill.d.ts +2 -2
- package/dist/widgets/label-image/hide-answers-toggle.d.ts +1 -1
- package/dist/widgets/label-image/marker.d.ts +1 -1
- package/package.json +10 -10
|
@@ -23,6 +23,6 @@ declare class FixedToResponsive extends React.Component<Props, State> {
|
|
|
23
23
|
componentDidMount(): void;
|
|
24
24
|
componentWillUnmount(): void;
|
|
25
25
|
_cacheViewportSize: () => void;
|
|
26
|
-
render(): JSX.Element;
|
|
26
|
+
render(): React.JSX.Element;
|
|
27
27
|
}
|
|
28
28
|
export default FixedToResponsive;
|
package/dist/components/hud.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
2
|
type Props = {
|
|
3
3
|
message: string;
|
|
4
4
|
enabled: boolean;
|
|
5
5
|
onClick: () => void;
|
|
6
6
|
fixedPosition?: boolean;
|
|
7
7
|
};
|
|
8
|
-
declare const HUD: ({ message, enabled, onClick, fixedPosition }: Props) => JSX.Element;
|
|
8
|
+
declare const HUD: ({ message, enabled, onClick, fixedPosition }: Props) => React.JSX.Element;
|
|
9
9
|
export default HUD;
|
|
@@ -11,6 +11,6 @@ type I18nContextType = {
|
|
|
11
11
|
};
|
|
12
12
|
export declare const PerseusI18nContext: React.Context<I18nContextType>;
|
|
13
13
|
type Props = React.PropsWithChildren<I18nContextType>;
|
|
14
|
-
export declare function PerseusI18nContextProvider({ children, strings, locale }: Props): JSX.Element;
|
|
14
|
+
export declare function PerseusI18nContextProvider({ children, strings, locale }: Props): React.JSX.Element;
|
|
15
15
|
export declare const usePerseusI18n: () => I18nContextType;
|
|
16
16
|
export {};
|
|
@@ -2,5 +2,5 @@ import * as React from "react";
|
|
|
2
2
|
type Props = {
|
|
3
3
|
children: string | React.ReactElement | React.ReactElement[];
|
|
4
4
|
};
|
|
5
|
-
export declare const InfoTip: (props: Props) => JSX.Element;
|
|
5
|
+
export declare const InfoTip: (props: Props) => React.JSX.Element;
|
|
6
6
|
export default InfoTip;
|
|
@@ -66,8 +66,8 @@ declare class Tooltip extends React.Component<Props, State> {
|
|
|
66
66
|
componentDidMount(): void;
|
|
67
67
|
UNSAFE_componentWillReceiveProps(): void;
|
|
68
68
|
componentDidUpdate(): void;
|
|
69
|
-
_renderToolTipDiv(isTooltipAbove?: boolean): JSX.Element;
|
|
69
|
+
_renderToolTipDiv(isTooltipAbove?: boolean): React.JSX.Element;
|
|
70
70
|
_updateHeight(): void;
|
|
71
|
-
render(): JSX.Element;
|
|
71
|
+
render(): React.JSX.Element;
|
|
72
72
|
}
|
|
73
73
|
export default Tooltip;
|
package/dist/es/index.css
CHANGED
|
@@ -4148,11 +4148,11 @@ html body .mq-editable-field .mq-selection .mq-nthroot-container * {
|
|
|
4148
4148
|
/* `pointer-events: all` is needed to make the hit target the size of the
|
|
4149
4149
|
* entire <g> element and not just its visible subelements */
|
|
4150
4150
|
pointer-events: all;
|
|
4151
|
-
transition: transform 0.
|
|
4151
|
+
transition: transform 0.15s ease-out;
|
|
4152
4152
|
}
|
|
4153
4153
|
|
|
4154
4154
|
.MafsView .protractor-rotation-handle:hover {
|
|
4155
|
-
transform: scale(1.
|
|
4155
|
+
transform: scale(1.2);
|
|
4156
4156
|
}
|
|
4157
4157
|
|
|
4158
4158
|
.MafsView .protractor-rotation-handle-arrow-arc {
|
package/dist/es/index.js
CHANGED
|
@@ -501,6 +501,7 @@ class InnerMathInput extends React.Component {
|
|
|
501
501
|
}), /*#__PURE__*/React.createElement(Popover, {
|
|
502
502
|
opened: this.state.keypadOpen,
|
|
503
503
|
onClose: () => this.closeKeypad(),
|
|
504
|
+
portal: false,
|
|
504
505
|
dismissEnabled: true,
|
|
505
506
|
content: () => {
|
|
506
507
|
var _this$props$keypadBut, _this$props;
|
|
@@ -730,7 +731,7 @@ const denylist = [
|
|
|
730
731
|
// (technically the renderer still adds them)
|
|
731
732
|
"key", "ref",
|
|
732
733
|
// added by src/renderer.jsx
|
|
733
|
-
"containerSizeClass", "widgetId", "onChange", "problemNum", "apiOptions", "questionCompleted", "findWidgets",
|
|
734
|
+
"containerSizeClass", "widgetId", "onChange", "problemNum", "apiOptions", "questionCompleted", "findWidgets", "hintMode",
|
|
734
735
|
// added by src/editor.jsx, for widgets removing themselves
|
|
735
736
|
// this is soooo not the right place for this, but alas.
|
|
736
737
|
"onRemove",
|
|
@@ -8836,12 +8837,41 @@ class GraphBounds {
|
|
|
8836
8837
|
}
|
|
8837
8838
|
}
|
|
8838
8839
|
|
|
8839
|
-
|
|
8840
|
-
|
|
8841
|
-
|
|
8842
|
-
|
|
8843
|
-
|
|
8844
|
-
|
|
8840
|
+
var createRoot;
|
|
8841
|
+
|
|
8842
|
+
var m = ReactDOM__default;
|
|
8843
|
+
if (process.env.NODE_ENV === 'production') {
|
|
8844
|
+
createRoot = m.createRoot;
|
|
8845
|
+
} else {
|
|
8846
|
+
var i = m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
8847
|
+
createRoot = function(c, o) {
|
|
8848
|
+
i.usingClientEntryPoint = true;
|
|
8849
|
+
try {
|
|
8850
|
+
return m.createRoot(c, o);
|
|
8851
|
+
} finally {
|
|
8852
|
+
i.usingClientEntryPoint = false;
|
|
8853
|
+
}
|
|
8854
|
+
};
|
|
8855
|
+
}
|
|
8856
|
+
|
|
8857
|
+
// We keep a cache of elements that have already had createRoot() called on
|
|
8858
|
+
// them. If we don't do this, React 18 warns every subsequent call:
|
|
8859
|
+
// > You are calling ReactDOMClient.createRoot() on a container that has
|
|
8860
|
+
// > already been passed to createRoot() before.
|
|
8861
|
+
//
|
|
8862
|
+
// Note that this cache uses a WeakMap<> so that the cache isn't causing a
|
|
8863
|
+
// memory leak (by retaining elements after they're released everywhere else).
|
|
8864
|
+
const reactRootCache = new WeakMap();
|
|
8865
|
+
|
|
8866
|
+
/**
|
|
8867
|
+
* Renders the given ReactNode inside the given container.
|
|
8868
|
+
* @param element The JSX to render
|
|
8869
|
+
* @param container The HTML elemetn to render into
|
|
8870
|
+
*
|
|
8871
|
+
* @deprecated this function is legacy and exists to support ancient code
|
|
8872
|
+
* paths. Do not use in new code.
|
|
8873
|
+
*/
|
|
8874
|
+
function render(element, container) {
|
|
8845
8875
|
/**
|
|
8846
8876
|
* `RenderStateRoot` is responsible for tracking whether it's
|
|
8847
8877
|
* the initial render or subsequent renders. It's used by
|
|
@@ -8851,9 +8881,15 @@ function render(element, container, callback) {
|
|
|
8851
8881
|
* components using that hook or those components will function
|
|
8852
8882
|
* correctly.
|
|
8853
8883
|
*/
|
|
8854
|
-
React.createElement(RenderStateRoot, {
|
|
8884
|
+
const children = /*#__PURE__*/React.createElement(RenderStateRoot, {
|
|
8855
8885
|
throwIfNested: false
|
|
8856
|
-
}, element)
|
|
8886
|
+
}, element);
|
|
8887
|
+
let root = reactRootCache.get(container);
|
|
8888
|
+
if (root == null) {
|
|
8889
|
+
root = createRoot(container);
|
|
8890
|
+
reactRootCache.set(container, root);
|
|
8891
|
+
}
|
|
8892
|
+
root.render(children);
|
|
8857
8893
|
}
|
|
8858
8894
|
|
|
8859
8895
|
function findChildOrAdd(elem, className) {
|
|
@@ -8905,6 +8941,7 @@ var Tex$1 = {
|
|
|
8905
8941
|
} = await getDependencies();
|
|
8906
8942
|
// We use createElement instead of JSX here because we can't name this file tex.tsx;
|
|
8907
8943
|
// that name is already taken.
|
|
8944
|
+
// eslint-disable-next-line import/no-deprecated
|
|
8908
8945
|
render( /*#__PURE__*/React.createElement(TeX, {
|
|
8909
8946
|
children: text,
|
|
8910
8947
|
onRender: callback
|
|
@@ -15305,6 +15342,7 @@ class MovablePoint$4 {
|
|
|
15305
15342
|
}
|
|
15306
15343
|
const showTrashTooltip = () => {
|
|
15307
15344
|
this._showTooltip(container => {
|
|
15345
|
+
// eslint-disable-next-line import/no-deprecated
|
|
15308
15346
|
render( /*#__PURE__*/React.createElement("span", {
|
|
15309
15347
|
style: {
|
|
15310
15348
|
fontSize: "2em"
|
|
@@ -17572,7 +17610,6 @@ class Tex extends React.Component {
|
|
|
17572
17610
|
super(props);
|
|
17573
17611
|
this._hasRendered = void 0;
|
|
17574
17612
|
this.handleRender = () => {
|
|
17575
|
-
this.props.onRender();
|
|
17576
17613
|
this.setState({
|
|
17577
17614
|
rendered: true
|
|
17578
17615
|
});
|
|
@@ -19695,6 +19732,7 @@ class Renderer extends React.Component {
|
|
|
19695
19732
|
onBlur: _.partial(this._onWidgetBlur, id),
|
|
19696
19733
|
findWidgets: this.findWidgets,
|
|
19697
19734
|
reviewModeRubric: reviewModeRubric,
|
|
19735
|
+
hintMode: this.props.hintMode,
|
|
19698
19736
|
onChange: (newProps, cb, silent = false) => {
|
|
19699
19737
|
this._setWidgetProps(id, newProps, cb, silent);
|
|
19700
19738
|
},
|
|
@@ -20894,6 +20932,7 @@ Renderer.defaultProps = {
|
|
|
20894
20932
|
findExternalWidgets: () => [],
|
|
20895
20933
|
alwaysUpdate: false,
|
|
20896
20934
|
reviewMode: false,
|
|
20935
|
+
hintMode: false,
|
|
20897
20936
|
serializedState: null,
|
|
20898
20937
|
onSerializedStateUpdated: () => {},
|
|
20899
20938
|
linterContext: PerseusLinter.linterContextDefault
|
|
@@ -31793,7 +31832,7 @@ const renderGraph = props => {
|
|
|
31793
31832
|
dispatch: dispatch
|
|
31794
31833
|
});
|
|
31795
31834
|
default:
|
|
31796
|
-
|
|
31835
|
+
throw new UnreachableCaseError(type);
|
|
31797
31836
|
}
|
|
31798
31837
|
};
|
|
31799
31838
|
|
|
@@ -34123,7 +34162,8 @@ class InteractiveGraph extends React.Component {
|
|
|
34123
34162
|
gridStep: gridStep,
|
|
34124
34163
|
snapStep: snapStep,
|
|
34125
34164
|
box: box,
|
|
34126
|
-
showTooltips: !!this.props.showTooltips
|
|
34165
|
+
showTooltips: !!this.props.showTooltips,
|
|
34166
|
+
hintMode: this.props.hintMode
|
|
34127
34167
|
}));
|
|
34128
34168
|
}
|
|
34129
34169
|
return /*#__PURE__*/React.createElement(LegacyInteractiveGraph, _extends({
|
|
@@ -41802,6 +41842,7 @@ const rules = {
|
|
|
41802
41842
|
}, getInitialParseState()));
|
|
41803
41843
|
return {
|
|
41804
41844
|
ref: ref,
|
|
41845
|
+
// @ts-expect-error - TS2322- Type 'SingleASTNode[]' is not assignable to type 'ReactNode'.
|
|
41805
41846
|
refContent: refContent
|
|
41806
41847
|
};
|
|
41807
41848
|
},
|
|
@@ -44933,7 +44974,7 @@ const init = function init(options) {
|
|
|
44933
44974
|
|
|
44934
44975
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
44935
44976
|
const libName = "@khanacademy/perseus";
|
|
44936
|
-
const libVersion = "
|
|
44977
|
+
const libVersion = "26.1.0";
|
|
44937
44978
|
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
44938
44979
|
|
|
44939
44980
|
const apiVersion = {
|
|
@@ -45175,6 +45216,7 @@ class HintRenderer extends React.Component {
|
|
|
45175
45216
|
// eslint-disable-next-line react/no-string-refs
|
|
45176
45217
|
, {
|
|
45177
45218
|
ref: "renderer",
|
|
45219
|
+
hintMode: true,
|
|
45178
45220
|
widgets: hint.widgets,
|
|
45179
45221
|
content: hint.content || "",
|
|
45180
45222
|
images: hint.images,
|
|
@@ -45369,7 +45411,6 @@ class HintsRenderer extends React.Component {
|
|
|
45369
45411
|
}, apiOptions.isMobile && hintsVisible > 0 && /*#__PURE__*/React.createElement("div", {
|
|
45370
45412
|
className: css(styles$2.mobileHintStylesHintTitle, sharedStyles.responsiveLabel)
|
|
45371
45413
|
}, this.context.strings.hints), hints, showGetAnotherHint && /*#__PURE__*/React.createElement("button", {
|
|
45372
|
-
// @ts-expect-error - TS2322 - Type '{ children: Element[]; rel: string; className: string; onClick: (evt: MouseEvent<HTMLButtonElement, MouseEvent>) => void; }' is not assignable to type 'DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>'.
|
|
45373
45414
|
rel: "button",
|
|
45374
45415
|
className: css(styles$2.linkButton, styles$2.getAnotherHintButton, apiOptions.isMobile && styles$2.mobileHintStylesGetAnotherHintButton),
|
|
45375
45416
|
onClick: evt => {
|