@khanacademy/perseus 19.1.1 → 19.1.3
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 +24 -0
- package/dist/all-widgets.d.ts +1 -1
- package/dist/basic-widgets.d.ts +1 -1
- package/dist/components/graph.d.ts +7 -6
- package/dist/components/graphie.d.ts +8 -1
- package/dist/es/index.js +49 -51
- package/dist/es/index.js.map +1 -1
- package/dist/extra-widgets.d.ts +1 -1
- package/dist/index.js +48 -49
- package/dist/index.js.map +1 -1
- package/dist/perseus-types.d.ts +3 -3
- package/dist/types.d.ts +1 -1
- package/dist/util/graphie.d.ts +13 -6
- package/dist/widgets/categorizer.d.ts +1 -1
- package/dist/widgets/cs-program.d.ts +1 -1
- package/dist/widgets/definition.d.ts +1 -1
- package/dist/widgets/deprecated-standin/index.d.ts +1 -1
- package/dist/widgets/dropdown.d.ts +1 -1
- package/dist/widgets/explanation.d.ts +1 -1
- package/dist/widgets/expression.d.ts +14 -14
- package/dist/widgets/graded-group-set.d.ts +1 -1
- package/dist/widgets/graded-group.d.ts +1 -1
- package/dist/widgets/grapher.d.ts +1 -1
- package/dist/widgets/group.d.ts +1 -1
- package/dist/widgets/iframe.d.ts +1 -1
- package/dist/widgets/image.d.ts +1 -1
- package/dist/widgets/input-number.d.ts +1 -1
- package/dist/widgets/interaction.d.ts +1 -1
- package/dist/widgets/interactive-graph.d.ts +1 -1
- package/dist/widgets/label-image.d.ts +14 -14
- package/dist/widgets/lights-puzzle.d.ts +1 -1
- package/dist/widgets/matcher.d.ts +1 -1
- package/dist/widgets/matrix.d.ts +1 -1
- package/dist/widgets/measurer.d.ts +5 -5
- package/dist/widgets/molecule.d.ts +1 -1
- package/dist/widgets/number-line.d.ts +1 -1
- package/dist/widgets/numeric-input.d.ts +1 -1
- package/dist/widgets/orderer.d.ts +1 -1
- package/dist/widgets/passage-ref-target.d.ts +1 -1
- package/dist/widgets/passage-ref.d.ts +1 -1
- package/dist/widgets/passage.d.ts +1 -1
- package/dist/widgets/plotter.d.ts +1 -1
- package/dist/widgets/radio.d.ts +1 -1
- package/dist/widgets/reaction-diagram.d.ts +1 -1
- package/dist/widgets/sequence.d.ts +1 -1
- package/dist/widgets/simulator.d.ts +1 -1
- package/dist/widgets/sorter.d.ts +1 -1
- package/dist/widgets/table.d.ts +1 -1
- package/dist/widgets/unit.d.ts +1 -1
- package/dist/widgets/video.d.ts +1 -1
- package/package.json +3 -3
- package/src/__tests__/init.test.ts +10 -0
- package/src/__tests__/widgets.test.ts +2 -3
- package/src/components/graph.tsx +25 -20
- package/src/components/graphie.tsx +19 -14
- package/src/init.ts +1 -4
- package/src/perseus-types.ts +3 -3
- package/src/types.ts +4 -2
- package/src/util/graphie.test.ts +1 -15
- package/src/util/graphie.ts +14 -24
- package/src/util/interactive.ts +2 -2
- package/src/widgets/__tests__/__snapshots__/input-number.test.ts.snap +1 -1
- package/src/widgets/__tests__/__snapshots__/numeric-input.test.ts.snap +1 -1
- package/src/widgets/label-image/marker.tsx +4 -0
- package/src/widgets/label-image.tsx +2 -7
- package/src/widgets/measurer.tsx +8 -2
- package/src/widgets/plotter.tsx +2 -0
- package/src/widgets.ts +9 -4
- package/tsconfig-build.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @khanacademy/perseus
|
|
2
2
|
|
|
3
|
+
## 19.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#957](https://github.com/Khan/perseus/pull/957) [`19114138`](https://github.com/Khan/perseus/commit/1911413844b59ef87d5b2329f6120e4568be9ae3) Thanks [@nedredmond](https://github.com/nedredmond)! - Updated tests
|
|
8
|
+
|
|
9
|
+
* [#952](https://github.com/Khan/perseus/pull/952) [`6bebefcb`](https://github.com/Khan/perseus/commit/6bebefcb4ce54c3ed0d57707c34d4399f763368f) Thanks [@nedredmond](https://github.com/nedredmond)! - Screenreader reads Label Image Widget answer pills
|
|
10
|
+
|
|
11
|
+
- [#961](https://github.com/Khan/perseus/pull/961) [`03e1461f`](https://github.com/Khan/perseus/commit/03e1461fe16d5dd31fd1f6d11669126dce96f088) Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Ensure the deprecated-standin widget replaces the transformer widget which is now removed
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [[`19114138`](https://github.com/Khan/perseus/commit/1911413844b59ef87d5b2329f6120e4568be9ae3)]:
|
|
14
|
+
- @khanacademy/math-input@17.0.2
|
|
15
|
+
|
|
16
|
+
## 19.1.2
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- [#954](https://github.com/Khan/perseus/pull/954) [`43820ff9`](https://github.com/Khan/perseus/commit/43820ff9ce391682b951279a4c6fb9e3db966eb9) Thanks [@benchristel](https://github.com/benchristel)! - Internal: Fix @ts-expect-errors related to Graphie
|
|
21
|
+
|
|
22
|
+
* [#956](https://github.com/Khan/perseus/pull/956) [`14e107f5`](https://github.com/Khan/perseus/commit/14e107f57c10fb3a442e55506810eb309caced24) Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Fix bug when replacing transformer widget with deprecated-standin
|
|
23
|
+
|
|
24
|
+
* Updated dependencies [[`43820ff9`](https://github.com/Khan/perseus/commit/43820ff9ce391682b951279a4c6fb9e3db966eb9)]:
|
|
25
|
+
- @khanacademy/kmath@0.1.10
|
|
26
|
+
|
|
3
27
|
## 19.1.1
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
package/dist/all-widgets.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ declare const _default: readonly Readonly<{
|
|
|
3
3
|
name: string;
|
|
4
4
|
displayName: string;
|
|
5
5
|
getWidget?: (() => import("react").ComponentType<any>) | undefined;
|
|
6
|
+
widget: import("react").ComponentType<any>;
|
|
6
7
|
accessible?: boolean | ((props: any) => boolean) | undefined;
|
|
7
8
|
hidden?: boolean | undefined;
|
|
8
9
|
version?: import("./types").Version | undefined;
|
|
@@ -17,6 +18,5 @@ declare const _default: readonly Readonly<{
|
|
|
17
18
|
propUpgrades?: {
|
|
18
19
|
[key: string]: (arg1: any) => any;
|
|
19
20
|
} | undefined;
|
|
20
|
-
widget: import("react").ComponentType<any>;
|
|
21
21
|
}>[];
|
|
22
22
|
export default _default;
|
package/dist/basic-widgets.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ declare const _default: readonly Readonly<{
|
|
|
3
3
|
name: string;
|
|
4
4
|
displayName: string;
|
|
5
5
|
getWidget?: (() => import("react").ComponentType<any>) | undefined;
|
|
6
|
+
widget: import("react").ComponentType<any>;
|
|
6
7
|
accessible?: boolean | ((props: any) => boolean) | undefined;
|
|
7
8
|
hidden?: boolean | undefined;
|
|
8
9
|
version?: import("./types").Version | undefined;
|
|
@@ -17,6 +18,5 @@ declare const _default: readonly Readonly<{
|
|
|
17
18
|
propUpgrades?: {
|
|
18
19
|
[key: string]: (arg1: any) => any;
|
|
19
20
|
} | undefined;
|
|
20
|
-
widget: import("react").ComponentType<any>;
|
|
21
21
|
}>[];
|
|
22
22
|
export default _default;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { Coord } from "../interactive2/types";
|
|
3
3
|
import type { PerseusImageBackground } from "../perseus-types";
|
|
4
|
+
import type { GridDimensions } from "../util";
|
|
4
5
|
type Props = {
|
|
5
|
-
box:
|
|
6
|
+
box: [number, number];
|
|
6
7
|
labels: ReadonlyArray<string>;
|
|
7
|
-
range:
|
|
8
|
-
step:
|
|
9
|
-
gridStep:
|
|
10
|
-
snapStep:
|
|
8
|
+
range: [Coord, Coord];
|
|
9
|
+
step: [number, number];
|
|
10
|
+
gridStep: [number, number];
|
|
11
|
+
snapStep: [number, number];
|
|
11
12
|
markings: string;
|
|
12
13
|
backgroundImage: PerseusImageBackground;
|
|
13
14
|
showProtractor: boolean;
|
|
@@ -51,7 +52,7 @@ declare class Graph extends React.Component<Props> {
|
|
|
51
52
|
graphie: () => any;
|
|
52
53
|
pointsFromNormalized: (arg1: any, arg2: any) => any;
|
|
53
54
|
_setupGraphie: (arg1: any) => void;
|
|
54
|
-
_getGridConfig: () =>
|
|
55
|
+
_getGridConfig: () => [GridDimensions, GridDimensions];
|
|
55
56
|
_updateProtractor: () => void;
|
|
56
57
|
_updateRuler: () => void;
|
|
57
58
|
toJSON: () => any;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { Graphie as GraphieDrawingContext } from "../util/graphie";
|
|
2
3
|
import type { Coord } from "../interactive2/types";
|
|
3
4
|
import type { Range, Size } from "../perseus-types";
|
|
4
5
|
type Props = {
|
|
@@ -29,8 +30,14 @@ type DefaultProps = {
|
|
|
29
30
|
responsive: Props["responsive"];
|
|
30
31
|
addMouseLayer: Props["addMouseLayer"];
|
|
31
32
|
};
|
|
33
|
+
interface Movable {
|
|
34
|
+
remove(): void;
|
|
35
|
+
}
|
|
32
36
|
declare class Graphie extends React.Component<Props> {
|
|
33
37
|
graphieDivRef: React.RefObject<HTMLDivElement>;
|
|
38
|
+
_graphie: GraphieDrawingContext;
|
|
39
|
+
_movables: Record<string, Movable>;
|
|
40
|
+
movables: Record<string, Movable>;
|
|
34
41
|
static defaultProps: DefaultProps;
|
|
35
42
|
componentDidMount(): void;
|
|
36
43
|
shouldComponentUpdate(nextProps: Props): boolean;
|
|
@@ -46,7 +53,7 @@ declare class Graphie extends React.Component<Props> {
|
|
|
46
53
|
getGraphie: () => any;
|
|
47
54
|
_range: () => [Coord, Coord];
|
|
48
55
|
_box: () => Size;
|
|
49
|
-
_scale: () =>
|
|
56
|
+
_scale: () => Coord;
|
|
50
57
|
_setupGraphie: () => void;
|
|
51
58
|
_removeMovables: () => void;
|
|
52
59
|
_renderMovables: (children: ReadonlyArray<any>, arg2: any) => React.ReactElement;
|
package/dist/es/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import * as KAS from '@khanacademy/kas';
|
|
|
2
2
|
import { keyTranslator, CursorContext, createMathField, convertDotToTimesByLocale, mathQuillInstance, getCursorContext, DesktopKeypad, KeypadInput, KeypadType, KeyArray, keypadElementPropType } from '@khanacademy/math-input';
|
|
3
3
|
import * as PerseusLinter from '@khanacademy/perseus-linter';
|
|
4
4
|
import { linterContextDefault, Rule, linterContextProps } from '@khanacademy/perseus-linter';
|
|
5
|
-
import { View, RenderStateRoot, useUniqueIdWithMock, Text } from '@khanacademy/wonder-blocks-core';
|
|
5
|
+
import { View, RenderStateRoot, useUniqueIdWithMock, Text as Text$1 } from '@khanacademy/wonder-blocks-core';
|
|
6
6
|
import * as i18n from '@khanacademy/wonder-blocks-i18n';
|
|
7
7
|
import Tooltip$1 from '@khanacademy/wonder-blocks-tooltip';
|
|
8
8
|
import classNames from 'classnames';
|
|
@@ -9644,15 +9644,6 @@ const GraphUtils = {
|
|
|
9644
9644
|
getDistance: function (point1, point2) {
|
|
9645
9645
|
return point.distanceToPoint(point1, point2);
|
|
9646
9646
|
},
|
|
9647
|
-
/**
|
|
9648
|
-
* Round the given coordinates to a given snap value
|
|
9649
|
-
* (e.g., nearest 0.2 increment)
|
|
9650
|
-
*/
|
|
9651
|
-
snapCoord: function (coord, snap) {
|
|
9652
|
-
return coord.map(function (val, i) {
|
|
9653
|
-
return KhanMath.roundToNearest(snap[i], val);
|
|
9654
|
-
});
|
|
9655
|
-
},
|
|
9656
9647
|
// Find the angle in degrees between two or three points
|
|
9657
9648
|
findAngle: function (point1, point2, vertex) {
|
|
9658
9649
|
if (vertex === undefined) {
|
|
@@ -16167,6 +16158,9 @@ class Graphie extends React.Component {
|
|
|
16167
16158
|
constructor(...args) {
|
|
16168
16159
|
super(...args);
|
|
16169
16160
|
this.graphieDivRef = /*#__PURE__*/React.createRef();
|
|
16161
|
+
this._graphie = new Graphie$1(document.createElement("div"));
|
|
16162
|
+
this._movables = {};
|
|
16163
|
+
this.movables = {};
|
|
16170
16164
|
/**
|
|
16171
16165
|
* Allow parents of the <Graphie> component to grab a reference to the
|
|
16172
16166
|
* underlying graphie object using
|
|
@@ -16176,7 +16170,6 @@ class Graphie extends React.Component {
|
|
|
16176
16170
|
* Use it for good and not evil.
|
|
16177
16171
|
*/
|
|
16178
16172
|
this.getGraphie = () => {
|
|
16179
|
-
// @ts-expect-error - TS2339 - Property '_graphie' does not exist on type 'Graphie'.
|
|
16180
16173
|
return this._graphie;
|
|
16181
16174
|
};
|
|
16182
16175
|
// bounds-checked range
|
|
@@ -16197,10 +16190,11 @@ class Graphie extends React.Component {
|
|
|
16197
16190
|
};
|
|
16198
16191
|
return [ensureMinSize(this.props.box[0]), ensureMinSize(this.props.box[1])];
|
|
16199
16192
|
};
|
|
16193
|
+
// @ts-expect-error - TS2322: Type '() => number[]' is not assignable to type '() => Coord'.
|
|
16200
16194
|
this._scale = () => {
|
|
16201
16195
|
const box = this._box();
|
|
16202
16196
|
const range = this._range();
|
|
16203
|
-
return
|
|
16197
|
+
return box.map((pixelDim, i) => {
|
|
16204
16198
|
const unitDim = range[i][1] - range[i][0];
|
|
16205
16199
|
return pixelDim / unitDim;
|
|
16206
16200
|
});
|
|
@@ -16208,9 +16202,10 @@ class Graphie extends React.Component {
|
|
|
16208
16202
|
this._setupGraphie = () => {
|
|
16209
16203
|
this._removeMovables();
|
|
16210
16204
|
const graphieDiv = ReactDOM__default.findDOMNode(this.graphieDivRef.current);
|
|
16211
|
-
|
|
16212
|
-
|
|
16213
|
-
|
|
16205
|
+
if (graphieDiv == null || graphieDiv instanceof Text) {
|
|
16206
|
+
throw new Error("No graphie container div found");
|
|
16207
|
+
}
|
|
16208
|
+
graphieDiv.innerHTML = "";
|
|
16214
16209
|
const graphie = this._graphie = createGraphie(graphieDiv);
|
|
16215
16210
|
|
|
16216
16211
|
// This has to be called before addMouseLayer. You can re-init
|
|
@@ -16222,6 +16217,7 @@ class Graphie extends React.Component {
|
|
|
16222
16217
|
});
|
|
16223
16218
|
// Only add the mouselayer if we actually want one.
|
|
16224
16219
|
if (this.props.addMouseLayer) {
|
|
16220
|
+
// @ts-expect-error - TS2339: Property 'addMouseLayer' does not exist on type 'Graphie'.
|
|
16225
16221
|
graphie.addMouseLayer({
|
|
16226
16222
|
onClick: this.props.onClick,
|
|
16227
16223
|
onMouseDown: this.props.onMouseDown,
|
|
@@ -16230,12 +16226,13 @@ class Graphie extends React.Component {
|
|
|
16230
16226
|
setDrawingAreaAvailable: this.props.setDrawingAreaAvailable
|
|
16231
16227
|
});
|
|
16232
16228
|
}
|
|
16229
|
+
|
|
16230
|
+
// @ts-expect-error - TS2339: Property 'snap' does not exist on type 'Graphie'.
|
|
16233
16231
|
graphie.snap = this.props.options.snapStep || [1, 1];
|
|
16234
16232
|
if (this.props.responsive) {
|
|
16235
16233
|
// Overwrite fixed styles set in init()
|
|
16236
16234
|
// TODO(alex): Either make this component always responsive by
|
|
16237
16235
|
// itself, or always wrap it in other components so that it is.
|
|
16238
|
-
// @ts-expect-error - TS2769 - No overload matches this call. | TS2554 - Expected 2 arguments, but got 1.
|
|
16239
16236
|
$(graphieDiv).css({
|
|
16240
16237
|
width: "100%",
|
|
16241
16238
|
height: "100%"
|
|
@@ -16249,9 +16246,7 @@ class Graphie extends React.Component {
|
|
|
16249
16246
|
};
|
|
16250
16247
|
this._removeMovables = () => {
|
|
16251
16248
|
// _.invoke works even when this._movables is undefined
|
|
16252
|
-
// @ts-expect-error - TS2339 - Property '_movables' does not exist on type 'Graphie'.
|
|
16253
16249
|
_.invoke(this._movables, "remove");
|
|
16254
|
-
// @ts-expect-error - TS2339 - Property '_movables' does not exist on type 'Graphie'.
|
|
16255
16250
|
this._movables = {};
|
|
16256
16251
|
};
|
|
16257
16252
|
// @ts-expect-error - TS2322 - Type '(children: readonly any[], options: any) => ReactElement<any, string | JSXElementConstructor<any>> | readonly ReactElement<any, string | JSXElementConstructor<any>>[]' is not assignable to type '(children: readonly any[], arg2: any) => ReactElement<any, string | JSXElementConstructor<any>>'.
|
|
@@ -16347,7 +16342,6 @@ class Graphie extends React.Component {
|
|
|
16347
16342
|
newMovables[key].toFront();
|
|
16348
16343
|
}
|
|
16349
16344
|
if (ref) {
|
|
16350
|
-
// @ts-expect-error - TS2339 - Property 'movables' does not exist on type 'Graphie'.
|
|
16351
16345
|
this.movables[ref] = newMovables[key];
|
|
16352
16346
|
}
|
|
16353
16347
|
return newMovables[key];
|
|
@@ -16355,15 +16349,10 @@ class Graphie extends React.Component {
|
|
|
16355
16349
|
};
|
|
16356
16350
|
// Sort of like react diffing, but for movables
|
|
16357
16351
|
this._updateMovables = () => {
|
|
16358
|
-
// @ts-expect-error - TS2339 - Property '_graphie' does not exist on type 'Graphie'.
|
|
16359
16352
|
const graphie = this._graphie;
|
|
16360
|
-
|
|
16361
|
-
// @ts-expect-error - TS2339 - Property '_movables' does not exist on type 'Graphie'.
|
|
16362
16353
|
const oldMovables = this._movables;
|
|
16363
16354
|
const newMovables = {};
|
|
16364
|
-
// @ts-expect-error - TS2339 - Property '_movables' does not exist on type 'Graphie'.
|
|
16365
16355
|
this._movables = newMovables;
|
|
16366
|
-
// @ts-expect-error - TS2339 - Property 'movables' does not exist on type 'Graphie'.
|
|
16367
16356
|
this.movables = {};
|
|
16368
16357
|
|
|
16369
16358
|
// @ts-expect-error - TS2345 - Argument of type 'ReactNode' is not assignable to parameter of type 'readonly any[]'.
|
|
@@ -18502,10 +18491,13 @@ const registerWidgets = widgets => {
|
|
|
18502
18491
|
*/
|
|
18503
18492
|
const replaceWidget = (name, replacementName) => {
|
|
18504
18493
|
const substituteWidget = widgets[replacementName];
|
|
18505
|
-
|
|
18494
|
+
|
|
18495
|
+
// If the replacement widget isn't found, we need to throw. Otherwise after
|
|
18496
|
+
// removing the deprecated widget, we'll have data asking for a widget type
|
|
18497
|
+
// that doesn't exist at all.
|
|
18498
|
+
if (!substituteWidget) {
|
|
18506
18499
|
const errorMsg = `Failed to replace ${name} with ${replacementName}`;
|
|
18507
|
-
|
|
18508
|
-
return;
|
|
18500
|
+
throw new PerseusError(errorMsg, Errors.Internal);
|
|
18509
18501
|
}
|
|
18510
18502
|
registerWidget(name, substituteWidget);
|
|
18511
18503
|
};
|
|
@@ -18593,7 +18585,10 @@ const getAllWidgetTypes = () => {
|
|
|
18593
18585
|
};
|
|
18594
18586
|
const upgradeWidgetInfoToLatestVersion = oldWidgetInfo => {
|
|
18595
18587
|
const type = oldWidgetInfo.type;
|
|
18596
|
-
//
|
|
18588
|
+
// NOTE(jeremy): This looks like it could be replaced by fixing types so
|
|
18589
|
+
// that `type` is non-optional. But we're seeing this in Sentry today so I
|
|
18590
|
+
// suspect we have legacy data (potentially unpublished) and we should
|
|
18591
|
+
// figure that out before depending solely on types.
|
|
18597
18592
|
if (!_.isString(type)) {
|
|
18598
18593
|
throw new PerseusError("widget type must be a string, but was: " + type, Errors.Internal);
|
|
18599
18594
|
}
|
|
@@ -27761,21 +27756,23 @@ class Graph extends React.Component {
|
|
|
27761
27756
|
// `\text{Dollars}` to the Graph widget.
|
|
27762
27757
|
const labels = this.props.labels.map(label => Util.unescapeMathMode(label));
|
|
27763
27758
|
const range = this.props.range;
|
|
27759
|
+
// @ts-expect-error - TS2345: Argument of type 'Element | Text | null' is not assignable to parameter of type 'HTMLElement'.
|
|
27764
27760
|
const graphie = this._graphie = GraphUtils.createGraphie(graphieDiv);
|
|
27765
27761
|
const gridConfig = this._getGridConfig();
|
|
27762
|
+
// @ts-expect-error - TS2339: Property 'snap' does not exist on type 'Graphie'.
|
|
27766
27763
|
graphie.snap = this.props.snapStep;
|
|
27767
27764
|
if (this.props.markings === "graph") {
|
|
27768
27765
|
graphie.graphInit({
|
|
27769
27766
|
range: range,
|
|
27770
|
-
scale:
|
|
27767
|
+
scale: vector$1.map(gridConfig, g => g.scale),
|
|
27771
27768
|
axisArrows: "<->",
|
|
27772
27769
|
labelFormat: function (s) {
|
|
27773
27770
|
return "\\small{" + s + "}";
|
|
27774
27771
|
},
|
|
27775
27772
|
gridStep: this.props.gridStep,
|
|
27776
|
-
tickStep:
|
|
27773
|
+
tickStep: vector$1.map(gridConfig, g => g.tickStep),
|
|
27777
27774
|
labelStep: 1,
|
|
27778
|
-
unityLabels:
|
|
27775
|
+
unityLabels: vector$1.map(gridConfig, g => g.unityLabel),
|
|
27779
27776
|
isMobile: this.props.isMobile
|
|
27780
27777
|
});
|
|
27781
27778
|
graphie.label([0, range[1][1]], labels[1], this.props.isMobile ? "below right" : "above");
|
|
@@ -27783,7 +27780,7 @@ class Graph extends React.Component {
|
|
|
27783
27780
|
} else if (this.props.markings === "grid") {
|
|
27784
27781
|
graphie.graphInit({
|
|
27785
27782
|
range: range,
|
|
27786
|
-
scale:
|
|
27783
|
+
scale: vector$1.map(gridConfig, g => g.scale),
|
|
27787
27784
|
gridStep: this.props.gridStep,
|
|
27788
27785
|
axes: false,
|
|
27789
27786
|
ticks: false,
|
|
@@ -27793,7 +27790,7 @@ class Graph extends React.Component {
|
|
|
27793
27790
|
} else if (this.props.markings === "none") {
|
|
27794
27791
|
graphie.init({
|
|
27795
27792
|
range: range,
|
|
27796
|
-
scale:
|
|
27793
|
+
scale: vector$1.map(gridConfig, g => g.scale),
|
|
27797
27794
|
isMobile: this.props.isMobile
|
|
27798
27795
|
});
|
|
27799
27796
|
}
|
|
@@ -27840,6 +27837,7 @@ class Graph extends React.Component {
|
|
|
27840
27837
|
} : null;
|
|
27841
27838
|
/* eslint-enable indent */
|
|
27842
27839
|
|
|
27840
|
+
// @ts-expect-error - Property 'addMouseLayer' does not exist on type 'Graphie'.
|
|
27843
27841
|
graphie.addMouseLayer({
|
|
27844
27842
|
onClick: this.props.onClick,
|
|
27845
27843
|
onMouseDown: onMouseDown,
|
|
@@ -27865,10 +27863,7 @@ class Graph extends React.Component {
|
|
|
27865
27863
|
}
|
|
27866
27864
|
};
|
|
27867
27865
|
this._getGridConfig = () => {
|
|
27868
|
-
|
|
27869
|
-
return _.map(self.props.step, function (step, i) {
|
|
27870
|
-
return Util.gridDimensionConfig(step, self.props.range[i], self.props.box[i], self.props.gridStep[i]);
|
|
27871
|
-
});
|
|
27866
|
+
return vector$1.map(this.props.step, (step, i) => Util.gridDimensionConfig(step, this.props.range[i], this.props.box[i], this.props.gridStep[i]));
|
|
27872
27867
|
};
|
|
27873
27868
|
this._updateProtractor = () => {
|
|
27874
27869
|
if (this.protractor) {
|
|
@@ -31020,7 +31015,8 @@ class Marker extends React.Component {
|
|
|
31020
31015
|
answerSide,
|
|
31021
31016
|
answerStyles,
|
|
31022
31017
|
hovered,
|
|
31023
|
-
focused
|
|
31018
|
+
focused,
|
|
31019
|
+
label
|
|
31024
31020
|
} = this.props;
|
|
31025
31021
|
|
|
31026
31022
|
// We cannot make dropdown openers untabbable, so we isolate tabbing
|
|
@@ -31029,6 +31025,9 @@ class Marker extends React.Component {
|
|
|
31029
31025
|
const active = hovered || focused;
|
|
31030
31026
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(View, {
|
|
31031
31027
|
style: [styles$g.marker, active && !markerDisabled && styles$g.markerActive]
|
|
31028
|
+
// already translated in: /widgets/graded-group.tsx
|
|
31029
|
+
,
|
|
31030
|
+
"aria-label": markerDisabled ? i18n._("Correct!") : label
|
|
31032
31031
|
}, this.renderIcon()), !!selected && showAnswer && /*#__PURE__*/React.createElement(AnswerPill, {
|
|
31033
31032
|
selectedAnswers: selected,
|
|
31034
31033
|
showCorrectness: showCorrectness,
|
|
@@ -31577,14 +31576,11 @@ class LabelImage extends React.Component {
|
|
|
31577
31576
|
,
|
|
31578
31577
|
disabled: disabled,
|
|
31579
31578
|
opener: ({
|
|
31580
|
-
opened
|
|
31581
|
-
text
|
|
31579
|
+
opened
|
|
31582
31580
|
}) => /*#__PURE__*/React.createElement(Clickable, {
|
|
31583
31581
|
role: "button",
|
|
31584
|
-
|
|
31585
|
-
|
|
31586
|
-
// already translated in: /widgets/graded-group.tsx
|
|
31587
|
-
showCorrectness === "correct" ? i18n._("Correct!") : marker.label
|
|
31582
|
+
"aria-expanded": opened,
|
|
31583
|
+
key: `marker-${marker.x}.${marker.y}`
|
|
31588
31584
|
}, ({
|
|
31589
31585
|
hovered,
|
|
31590
31586
|
focused,
|
|
@@ -33687,6 +33683,7 @@ const Measurer = createReactClass({
|
|
|
33687
33683
|
const graphieDiv = ReactDOM__default.findDOMNode(this.refs.graphieDiv);
|
|
33688
33684
|
// @ts-expect-error - TS2769 - No overload matches this call. | TS2339 - Property 'empty' does not exist on type 'JQueryStatic'.
|
|
33689
33685
|
$(graphieDiv).empty();
|
|
33686
|
+
// @ts-expect-error - Argument of type 'Element | Text | null' is not assignable to parameter of type 'HTMLElement'.
|
|
33690
33687
|
const graphie = this.graphie = GraphUtils.createGraphie(graphieDiv);
|
|
33691
33688
|
const scale = [40, 40];
|
|
33692
33689
|
const range = [[0, this.props.box[0] / scale[0]], [0, this.props.box[1] / scale[1]]];
|
|
@@ -33694,6 +33691,7 @@ const Measurer = createReactClass({
|
|
|
33694
33691
|
range: range,
|
|
33695
33692
|
scale: scale
|
|
33696
33693
|
});
|
|
33694
|
+
// @ts-expect-error - Property 'addMouseLayer' does not exist on type 'Graphie'.
|
|
33697
33695
|
graphie.addMouseLayer({
|
|
33698
33696
|
allowScratchpad: true,
|
|
33699
33697
|
setDrawingAreaAvailable: this.props.apiOptions.setDrawingAreaAvailable
|
|
@@ -33702,12 +33700,14 @@ const Measurer = createReactClass({
|
|
|
33702
33700
|
this.protractor.remove();
|
|
33703
33701
|
}
|
|
33704
33702
|
if (this.props.showProtractor) {
|
|
33703
|
+
// @ts-expect-error - Property 'protractor' does not exist on type 'Graphie'.
|
|
33705
33704
|
this.protractor = graphie.protractor([this.props.protractorX, this.props.protractorY]);
|
|
33706
33705
|
}
|
|
33707
33706
|
if (this.ruler) {
|
|
33708
33707
|
this.ruler.remove();
|
|
33709
33708
|
}
|
|
33710
33709
|
if (this.props.showRuler) {
|
|
33710
|
+
// @ts-expect-error - Property 'ruler' does not exist on type 'Graphie'.
|
|
33711
33711
|
this.ruler = graphie.ruler({
|
|
33712
33712
|
center: [(range[0][0] + range[0][1]) / 2, (range[1][0] + range[1][1]) / 2],
|
|
33713
33713
|
label: this.props.rulerLabel,
|
|
@@ -38092,6 +38092,7 @@ class Plotter extends React.Component {
|
|
|
38092
38092
|
const graphieDiv = ReactDOM__default.findDOMNode(self.refs.graphieDiv);
|
|
38093
38093
|
// @ts-expect-error - TS2769 - No overload matches this call. | TS2339 - Property 'empty' does not exist on type 'JQueryStatic'.
|
|
38094
38094
|
$(graphieDiv).empty();
|
|
38095
|
+
// @ts-expect-error - Argument of type 'Element | Text | null' is not assignable to parameter of type 'HTMLElement'.
|
|
38095
38096
|
const graphie = GraphUtils.createGraphie(graphieDiv);
|
|
38096
38097
|
|
|
38097
38098
|
// TODO(jakesandlund): It's not the react way to hang
|
|
@@ -38199,6 +38200,7 @@ class Plotter extends React.Component {
|
|
|
38199
38200
|
scale: c.scale,
|
|
38200
38201
|
isMobile: this.props.apiOptions.isMobile
|
|
38201
38202
|
});
|
|
38203
|
+
// @ts-expect-error - Property 'addMouseLayer' does not exist on type 'Graphie'.
|
|
38202
38204
|
graphie.addMouseLayer({
|
|
38203
38205
|
allowScratchpad: true,
|
|
38204
38206
|
setDrawingAreaAvailable: this.props.apiOptions.setDrawingAreaAvailable
|
|
@@ -41328,7 +41330,7 @@ const VideoTranscriptLink = props => {
|
|
|
41328
41330
|
const video = (_result$data = result.data) == null ? void 0 : _result$data.video;
|
|
41329
41331
|
return /*#__PURE__*/React.createElement(View, {
|
|
41330
41332
|
style: styles$6.transcriptLink
|
|
41331
|
-
}, /*#__PURE__*/React.createElement(Text, null, video == null ? void 0 : video.title), /*#__PURE__*/React.createElement(Strut, {
|
|
41333
|
+
}, /*#__PURE__*/React.createElement(Text$1, null, video == null ? void 0 : video.title), /*#__PURE__*/React.createElement(Strut, {
|
|
41332
41334
|
size: 10
|
|
41333
41335
|
}), /*#__PURE__*/React.createElement(Link, {
|
|
41334
41336
|
href: "/transcript/" + ((video == null ? void 0 : video.contentId) || "videoNotFound"),
|
|
@@ -41471,11 +41473,7 @@ var extraWidgets = [Categorizer$1, CSProgram$1, Dropdown$1, Explanation$1, Defin
|
|
|
41471
41473
|
const init = function init(options) {
|
|
41472
41474
|
registerWidgets(basicWidgets);
|
|
41473
41475
|
registerWidgets(extraWidgets);
|
|
41474
|
-
|
|
41475
|
-
// This section replaces widgets
|
|
41476
|
-
// When it's time to replace the transformer widget
|
|
41477
|
-
// uncomment this line
|
|
41478
|
-
// Widgets.replaceWidget("transformer", "deprecated-standin");
|
|
41476
|
+
replaceWidget("transformer", "deprecated-standin");
|
|
41479
41477
|
|
|
41480
41478
|
// Pass skipMathJax: true if MathJax is already loaded and configured.
|
|
41481
41479
|
const skipMathJax = options.skipMathJax;
|
|
@@ -41501,7 +41499,7 @@ const init = function init(options) {
|
|
|
41501
41499
|
|
|
41502
41500
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
41503
41501
|
const libName = "@khanacademy/perseus";
|
|
41504
|
-
const libVersion = "19.1.
|
|
41502
|
+
const libVersion = "19.1.3";
|
|
41505
41503
|
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
41506
41504
|
|
|
41507
41505
|
const apiVersion = {
|