@khanacademy/perseus 6.2.1 → 6.2.2
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 +9 -0
- package/dist/all-widgets.d.ts +2 -2
- package/dist/all-widgets.js.flow +2 -2
- package/dist/basic-widgets.d.ts +2 -2
- package/dist/basic-widgets.js.flow +2 -2
- package/dist/es/index.js +67 -66
- package/dist/es/index.js.map +1 -1
- package/dist/extra-widgets.d.ts +2 -2
- package/dist/extra-widgets.js.flow +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +65 -62
- package/dist/index.js.flow +2 -0
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/types.js.flow +2 -2
- package/dist/util/geometry.d.ts +25 -0
- package/dist/util/geometry.js.flow +37 -0
- package/dist/widgets/categorizer.d.ts +2 -2
- package/dist/widgets/categorizer.js.flow +2 -2
- package/dist/widgets/cs-program.d.ts +2 -2
- package/dist/widgets/cs-program.js.flow +2 -2
- package/dist/widgets/definition.d.ts +2 -2
- package/dist/widgets/definition.js.flow +2 -2
- package/dist/widgets/dropdown.d.ts +2 -2
- package/dist/widgets/dropdown.js.flow +2 -2
- package/dist/widgets/explanation.d.ts +2 -2
- package/dist/widgets/explanation.js.flow +2 -2
- package/dist/widgets/expression.d.ts +2 -2
- package/dist/widgets/expression.js.flow +2 -2
- package/dist/widgets/graded-group-set.d.ts +2 -2
- package/dist/widgets/graded-group-set.js.flow +2 -2
- package/dist/widgets/graded-group.d.ts +2 -2
- package/dist/widgets/graded-group.js.flow +2 -2
- package/dist/widgets/grapher.d.ts +2 -2
- package/dist/widgets/grapher.js.flow +2 -2
- package/dist/widgets/group.d.ts +2 -2
- package/dist/widgets/group.js.flow +2 -2
- package/dist/widgets/iframe.d.ts +2 -2
- package/dist/widgets/iframe.js.flow +2 -2
- package/dist/widgets/image.d.ts +2 -2
- package/dist/widgets/image.js.flow +2 -2
- package/dist/widgets/input-number.d.ts +2 -2
- package/dist/widgets/input-number.js.flow +2 -2
- package/dist/widgets/interaction.d.ts +2 -2
- package/dist/widgets/interaction.js.flow +2 -2
- package/dist/widgets/interactive-graph.d.ts +4 -12
- package/dist/widgets/interactive-graph.js.flow +4 -7
- package/dist/widgets/label-image.d.ts +2 -2
- package/dist/widgets/label-image.js.flow +2 -2
- package/dist/widgets/lights-puzzle.d.ts +2 -2
- package/dist/widgets/lights-puzzle.js.flow +2 -2
- package/dist/widgets/matcher.d.ts +2 -2
- package/dist/widgets/matcher.js.flow +2 -2
- package/dist/widgets/matrix.d.ts +2 -2
- package/dist/widgets/matrix.js.flow +2 -2
- package/dist/widgets/measurer.d.ts +2 -2
- package/dist/widgets/measurer.js.flow +2 -2
- package/dist/widgets/molecule.d.ts +2 -2
- package/dist/widgets/molecule.js.flow +2 -2
- package/dist/widgets/number-line.d.ts +2 -2
- package/dist/widgets/number-line.js.flow +2 -2
- package/dist/widgets/numeric-input.d.ts +2 -2
- package/dist/widgets/numeric-input.js.flow +2 -2
- package/dist/widgets/orderer.d.ts +2 -2
- package/dist/widgets/orderer.js.flow +2 -2
- package/dist/widgets/passage-ref-target.d.ts +2 -2
- package/dist/widgets/passage-ref-target.js.flow +2 -2
- package/dist/widgets/passage-ref.d.ts +2 -2
- package/dist/widgets/passage-ref.js.flow +2 -2
- package/dist/widgets/passage.d.ts +2 -2
- package/dist/widgets/passage.js.flow +2 -2
- package/dist/widgets/plotter.d.ts +2 -2
- package/dist/widgets/plotter.js.flow +2 -2
- package/dist/widgets/radio.d.ts +2 -2
- package/dist/widgets/radio.js.flow +2 -2
- package/dist/widgets/reaction-diagram.d.ts +2 -2
- package/dist/widgets/reaction-diagram.js.flow +2 -2
- package/dist/widgets/sequence.d.ts +2 -2
- package/dist/widgets/sequence.js.flow +2 -2
- package/dist/widgets/simulator.d.ts +2 -2
- package/dist/widgets/simulator.js.flow +2 -2
- package/dist/widgets/sorter.d.ts +2 -2
- package/dist/widgets/sorter.js.flow +2 -2
- package/dist/widgets/table.d.ts +2 -2
- package/dist/widgets/table.js.flow +2 -2
- package/dist/widgets/transformer.d.ts +2 -2
- package/dist/widgets/transformer.js.flow +2 -2
- package/dist/widgets/unit.d.ts +2 -2
- package/dist/widgets/unit.js.flow +2 -2
- package/dist/widgets/video.d.ts +2 -2
- package/dist/widgets/video.js.flow +2 -2
- package/package.json +2 -2
- package/src/components/prop-check-box.tsx +0 -1
- package/src/index.ts +2 -0
- package/src/types.ts +19 -2
- package/src/util/geometry.ts +293 -0
- package/src/widgets/__tests__/numeric-input.test.ts +38 -0
- package/src/widgets/expression.tsx +0 -1
- package/src/widgets/grapher.tsx +0 -1
- package/src/widgets/image.tsx +0 -1
- package/src/widgets/input-number.tsx +0 -1
- package/src/widgets/interactive-graph.tsx +20 -288
- package/src/widgets/matrix.tsx +0 -1
- package/src/widgets/numeric-input.tsx +6 -2
- package/src/widgets/transformer.tsx +0 -1
- package/tsconfig-build.json +0 -1
- package/tsconfig-build.tsbuildinfo +1 -1
- package/dist/__tests__/mock-asset-loading-widget.d.ts +0 -59
- package/dist/__tests__/mock-asset-loading-widget.js.flow +0 -70
- package/dist/__tests__/mock-widget.d.ts +0 -30
- package/dist/__tests__/mock-widget.js.flow +0 -39
- package/dist/__tests__/test-items/image-item.d.ts +0 -14
- package/dist/__tests__/test-items/image-item.js.flow +0 -20
- package/dist/__tests__/test-items/input-number-1-item.d.ts +0 -9
- package/dist/__tests__/test-items/input-number-1-item.js.flow +0 -15
- package/dist/__tests__/test-items/input-number-2-item.d.ts +0 -9
- package/dist/__tests__/test-items/input-number-2-item.js.flow +0 -15
- package/dist/__tests__/test-items/table-item.d.ts +0 -9
- package/dist/__tests__/test-items/table-item.js.flow +0 -15
- package/dist/interactive2/__tests__/movable-mock.d.ts +0 -5
- package/dist/interactive2/__tests__/movable-mock.js.flow +0 -11
- package/dist/widgets/__stories__/test-keypad-context-wrapper.d.ts +0 -6
- package/dist/widgets/__stories__/test-keypad-context-wrapper.js.flow +0 -12
- package/dist/widgets/__tests__/renderQuestion.d.ts +0 -13
- package/dist/widgets/__tests__/renderQuestion.js.flow +0 -28
package/dist/extra-widgets.d.ts
CHANGED
|
@@ -10,10 +10,10 @@ declare const _default: readonly Readonly<{
|
|
|
10
10
|
defaultAlignment?: import("./types").Alignment | undefined;
|
|
11
11
|
getDefaultAlignment?: (() => import("./types").Alignment) | undefined;
|
|
12
12
|
isLintable?: boolean | undefined;
|
|
13
|
-
transform?: import("./types").WidgetTransform | undefined;
|
|
14
13
|
tracking?: import("./types").Tracking | undefined;
|
|
15
|
-
staticTransform?: import("./types").WidgetTransform | undefined;
|
|
16
14
|
traverseChildWidgets?: any;
|
|
15
|
+
transform?: import("./types").WidgetTransform | undefined;
|
|
16
|
+
staticTransform?: import("./types").WidgetTransform | undefined;
|
|
17
17
|
propUpgrades?: {
|
|
18
18
|
[key: string]: (arg1: any) => any;
|
|
19
19
|
} | undefined;
|
|
@@ -20,10 +20,10 @@ declare var _default: $ReadOnlyArray<
|
|
|
20
20
|
| (() => $Flowgen$Import$_2e__2f_types.Alignment)
|
|
21
21
|
| void,
|
|
22
22
|
isLintable?: boolean | void,
|
|
23
|
-
transform?: $Flowgen$Import$_2e__2f_types.WidgetTransform | void,
|
|
24
23
|
tracking?: $Flowgen$Import$_2e__2f_types.Tracking | void,
|
|
25
|
-
staticTransform?: $Flowgen$Import$_2e__2f_types.WidgetTransform | void,
|
|
26
24
|
traverseChildWidgets?: any,
|
|
25
|
+
transform?: $Flowgen$Import$_2e__2f_types.WidgetTransform | void,
|
|
26
|
+
staticTransform?: $Flowgen$Import$_2e__2f_types.WidgetTransform | void,
|
|
27
27
|
propUpgrades?: {
|
|
28
28
|
[key: string]: (arg1: any) => any,
|
|
29
29
|
} | void,
|
package/dist/index.d.ts
CHANGED
|
@@ -88,7 +88,7 @@ export type { ILogger, LogErrorOptions, ErrorKind } from "./logging/log";
|
|
|
88
88
|
export type { ServerItemRenderer as ServerItemRendererComponent } from "./server-item-renderer";
|
|
89
89
|
export type { Alignment, APIOptions, APIOptionsWithDefaults, ChangeHandler, DeviceType, DomInsertCheckFn, EditorMode, FocusPath, Hint, ImageDict, ImageUploader, JiptLabelStore, JiptRenderer, KEScore, LinterContextProps, PerseusDependencies, PerseusScore, RendererInterface, Version, VideoData, VideoKind, WidgetDict, WidgetExports, WidgetInfo, } from "./types";
|
|
90
90
|
export type { ParsedValue } from "./util";
|
|
91
|
-
export type { MathFormat, InputNumberWidget, PerseusRadioWidgetOptions, PerseusRenderer, } from "./perseus-types";
|
|
91
|
+
export type { MathFormat, InputNumberWidget, PerseusImageBackground, PerseusInteractiveGraphWidgetOptions, PerseusRadioWidgetOptions, PerseusRenderer, } 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
|
@@ -3456,7 +3456,7 @@ const DeprecationMixin$1 = {
|
|
|
3456
3456
|
/**
|
|
3457
3457
|
* Approximate equality on numbers and primitives.
|
|
3458
3458
|
*/
|
|
3459
|
-
function eq$
|
|
3459
|
+
function eq$2(x, y) {
|
|
3460
3460
|
if (typeof x === "number" && typeof y === "number") {
|
|
3461
3461
|
return Math.abs(x - y) < 1e-9;
|
|
3462
3462
|
}
|
|
@@ -3467,13 +3467,13 @@ function eq$1(x, y) {
|
|
|
3467
3467
|
* Deep approximate equality on primitives, numbers, arrays, and objects.
|
|
3468
3468
|
* Recursive.
|
|
3469
3469
|
*/
|
|
3470
|
-
function deepEq$
|
|
3470
|
+
function deepEq$6(x, y) {
|
|
3471
3471
|
if (Array.isArray(x) && Array.isArray(y)) {
|
|
3472
3472
|
if (x.length !== y.length) {
|
|
3473
3473
|
return false;
|
|
3474
3474
|
}
|
|
3475
3475
|
for (let i = 0; i < x.length; i++) {
|
|
3476
|
-
if (!deepEq$
|
|
3476
|
+
if (!deepEq$6(x[i], y[i])) {
|
|
3477
3477
|
return false;
|
|
3478
3478
|
}
|
|
3479
3479
|
}
|
|
@@ -3483,7 +3483,7 @@ function deepEq$5(x, y) {
|
|
|
3483
3483
|
return false;
|
|
3484
3484
|
}
|
|
3485
3485
|
if (typeof x === "function" && typeof y === "function") {
|
|
3486
|
-
return eq$
|
|
3486
|
+
return eq$2(x, y);
|
|
3487
3487
|
}
|
|
3488
3488
|
if (typeof x === "function" || typeof y === "function") {
|
|
3489
3489
|
return false;
|
|
@@ -3491,16 +3491,16 @@ function deepEq$5(x, y) {
|
|
|
3491
3491
|
if (typeof x === "object" && typeof y === "object" && !!x && !!y) {
|
|
3492
3492
|
return x === y || ___default["default"].all(x, function (v, k) {
|
|
3493
3493
|
// @ts-expect-error [FEI-5003] - TS2536 - Type 'CollectionKey<T>' cannot be used to index type 'T'.
|
|
3494
|
-
return deepEq$
|
|
3494
|
+
return deepEq$6(y[k], v);
|
|
3495
3495
|
}) && ___default["default"].all(y, function (v, k) {
|
|
3496
3496
|
// @ts-expect-error [FEI-5003] - TS2536 - Type 'CollectionKey<T>' cannot be used to index type 'T'.
|
|
3497
|
-
return deepEq$
|
|
3497
|
+
return deepEq$6(x[k], v);
|
|
3498
3498
|
});
|
|
3499
3499
|
}
|
|
3500
3500
|
if (typeof x === "object" && !!x || typeof y === "object" && !!y) {
|
|
3501
3501
|
return false;
|
|
3502
3502
|
}
|
|
3503
|
-
return eq$
|
|
3503
|
+
return eq$2(x, y);
|
|
3504
3504
|
}
|
|
3505
3505
|
|
|
3506
3506
|
/**
|
|
@@ -3818,8 +3818,8 @@ const Util = {
|
|
|
3818
3818
|
tickStepFromNumTicks,
|
|
3819
3819
|
constrainedTickStepsFromTickSteps,
|
|
3820
3820
|
DeprecationMixin: DeprecationMixin$1,
|
|
3821
|
-
eq: eq$
|
|
3822
|
-
deepEq: deepEq$
|
|
3821
|
+
eq: eq$2,
|
|
3822
|
+
deepEq: deepEq$6,
|
|
3823
3823
|
parseQueryString,
|
|
3824
3824
|
updateQueryString: updateQueryString$2,
|
|
3825
3825
|
strongEncodeURIComponent,
|
|
@@ -14076,7 +14076,7 @@ ___default["default"].extend(MovableAngle.prototype, {
|
|
|
14076
14076
|
|
|
14077
14077
|
/* eslint-disable @babel/no-invalid-this */
|
|
14078
14078
|
const nestedMap$1 = Util.nestedMap;
|
|
14079
|
-
const deepEq$
|
|
14079
|
+
const deepEq$5 = Util.deepEq;
|
|
14080
14080
|
|
|
14081
14081
|
/**
|
|
14082
14082
|
* A base class for all Graphie Movables
|
|
@@ -14173,7 +14173,7 @@ const createSimpleClass = function (addFunction) {
|
|
|
14173
14173
|
this._prevProps = this.props;
|
|
14174
14174
|
},
|
|
14175
14175
|
modify: function (graphie) {
|
|
14176
|
-
if (!deepEq$
|
|
14176
|
+
if (!deepEq$5(this.props, this._prevProps)) {
|
|
14177
14177
|
this.remove();
|
|
14178
14178
|
this.add(graphie);
|
|
14179
14179
|
this._prevProps = this.props;
|
|
@@ -16448,7 +16448,7 @@ var Movables = {
|
|
|
16448
16448
|
const GraphieMovable = GraphieClasses.GraphieMovable;
|
|
16449
16449
|
const createGraphie = GraphUtils.createGraphie;
|
|
16450
16450
|
const {
|
|
16451
|
-
deepEq: deepEq$
|
|
16451
|
+
deepEq: deepEq$4,
|
|
16452
16452
|
nestedMap
|
|
16453
16453
|
} = Util;
|
|
16454
16454
|
const {
|
|
@@ -16683,7 +16683,7 @@ class Graphie extends React__namespace.Component {
|
|
|
16683
16683
|
if (this.props.setup !== prevProps.setup) {
|
|
16684
16684
|
Log.error("<Graphie> was given a new setup function. " + "This is a bad idea; please refactor your code to give " + "the same setup function reference to <Graphie> on " + "every render.", Errors.Internal);
|
|
16685
16685
|
}
|
|
16686
|
-
if (!deepEq$
|
|
16686
|
+
if (!deepEq$4(this.props.options, prevProps.options) || !deepEq$4(this.props.box, prevProps.box) || !deepEq$4(this.props.range, prevProps.range)) {
|
|
16687
16687
|
this._setupGraphie();
|
|
16688
16688
|
}
|
|
16689
16689
|
this._updateMovables();
|
|
@@ -21612,7 +21612,11 @@ class NumericInput extends React__namespace.Component {
|
|
|
21612
21612
|
return answerStrings[0];
|
|
21613
21613
|
}
|
|
21614
21614
|
static validate(useInput, rubric) {
|
|
21615
|
-
const allAnswerForms = answerFormButtons.map(e => e["value"])
|
|
21615
|
+
const allAnswerForms = answerFormButtons.map(e => e["value"])
|
|
21616
|
+
// Don't default to validating the answer as a pi answer
|
|
21617
|
+
// if answerForm isn't set on the answer
|
|
21618
|
+
// https://khanacademy.atlassian.net/browse/LC-691
|
|
21619
|
+
.filter(e => e !== "pi");
|
|
21616
21620
|
const createValidator = answer => {
|
|
21617
21621
|
const stringAnswer = "".concat(answer.value);
|
|
21618
21622
|
return KhanAnswerTypes.number.createValidatorFunctional(stringAnswer, {
|
|
@@ -27849,36 +27853,29 @@ _defineProperty(Graph, "defaultProps", {
|
|
|
27849
27853
|
isMobile: false
|
|
27850
27854
|
});
|
|
27851
27855
|
|
|
27856
|
+
/**
|
|
27857
|
+
* A collection of geomtry-related utility functions
|
|
27858
|
+
*/
|
|
27852
27859
|
const {
|
|
27853
|
-
|
|
27860
|
+
eq: eq$1,
|
|
27861
|
+
deepEq: deepEq$3
|
|
27854
27862
|
} = Util;
|
|
27855
|
-
const TRASH_ICON_URI = "https://ka-perseus-graphie.s3.amazonaws.com/b1452c0d79fd0f7ff4c3af9488474a0a0decb361.png";
|
|
27856
|
-
const defaultBackgroundImage$1 = {
|
|
27857
|
-
url: null
|
|
27858
|
-
};
|
|
27859
|
-
const eq = Util.eq;
|
|
27860
|
-
const deepEq$2 = Util.deepEq;
|
|
27861
|
-
const UNLIMITED = "unlimited";
|
|
27862
27863
|
|
|
27863
|
-
//
|
|
27864
|
-
|
|
27864
|
+
// This should really be a readonly tuple of [number, number]
|
|
27865
|
+
|
|
27866
|
+
// a, b, c
|
|
27865
27867
|
|
|
27866
|
-
function ccw(a, b, c) {
|
|
27867
|
-
return (b[0] - a[0]) * (c[1] - a[1]) - (c[0] - a[0]) * (b[1] - a[1]);
|
|
27868
|
-
}
|
|
27869
|
-
function collinear(a, b, c) {
|
|
27870
|
-
return eq(ccw(a, b, c), 0);
|
|
27871
|
-
}
|
|
27872
27868
|
function sign(val) {
|
|
27873
|
-
if (eq(val, 0)) {
|
|
27869
|
+
if (eq$1(val, 0)) {
|
|
27874
27870
|
return 0;
|
|
27875
27871
|
}
|
|
27876
27872
|
return val > 0 ? 1 : -1;
|
|
27877
27873
|
}
|
|
27878
|
-
|
|
27879
|
-
|
|
27880
|
-
|
|
27881
|
-
|
|
27874
|
+
function ccw(a, b, c) {
|
|
27875
|
+
return (b[0] - a[0]) * (c[1] - a[1]) - (c[0] - a[0]) * (b[1] - a[1]);
|
|
27876
|
+
}
|
|
27877
|
+
function collinear(a, b, c) {
|
|
27878
|
+
return eq$1(ccw(a, b, c), 0);
|
|
27882
27879
|
}
|
|
27883
27880
|
|
|
27884
27881
|
// Given rect bounding points A and B, whether point C is inside the rect
|
|
@@ -27891,14 +27888,12 @@ function pointInRect(a, b, c) {
|
|
|
27891
27888
|
function intersects(ab, cd) {
|
|
27892
27889
|
const triplets = [[ab[0], ab[1], cd[0]], [ab[0], ab[1], cd[1]], [cd[0], cd[1], ab[0]], [cd[0], cd[1], ab[1]]];
|
|
27893
27890
|
const orientations = ___default["default"].map(triplets, function (triplet) {
|
|
27894
|
-
// @ts-expect-error [FEI-5003] - TS2556 - A spread argument must either have a tuple type or be passed to a rest parameter.
|
|
27895
27891
|
return sign(ccw(...triplet));
|
|
27896
27892
|
});
|
|
27897
27893
|
if (orientations[0] !== orientations[1] && orientations[2] !== orientations[3]) {
|
|
27898
27894
|
return true;
|
|
27899
27895
|
}
|
|
27900
27896
|
for (let i = 0; i < 4; i++) {
|
|
27901
|
-
// @ts-expect-error [FEI-5003] - TS2556 - A spread argument must either have a tuple type or be passed to a rest parameter.
|
|
27902
27897
|
if (orientations[i] === 0 && pointInRect(...triplets[i])) {
|
|
27903
27898
|
return true;
|
|
27904
27899
|
}
|
|
@@ -27976,13 +27971,13 @@ function similar(coords1, coords2, tolerance) {
|
|
|
27976
27971
|
angles = rotate(angles, i);
|
|
27977
27972
|
// @ts-expect-error [FEI-5003] - TS4104 - The type 'readonly number[]' is 'readonly' and cannot be assigned to the mutable type 'number[]'.
|
|
27978
27973
|
sides = rotate(sides, i);
|
|
27979
|
-
if (deepEq$
|
|
27974
|
+
if (deepEq$3(angles1, angles)) {
|
|
27980
27975
|
const sidePairs = ___default["default"].zip(sides1, sides);
|
|
27981
27976
|
const factors = ___default["default"].map(sidePairs, function (pair) {
|
|
27982
27977
|
return pair[0] / pair[1];
|
|
27983
27978
|
});
|
|
27984
27979
|
const same = ___default["default"].all(factors, function (factor) {
|
|
27985
|
-
return eq(factors[0], factor);
|
|
27980
|
+
return eq$1(factors[0], factor);
|
|
27986
27981
|
});
|
|
27987
27982
|
const congruentEnough = ___default["default"].all(sidePairs, function (pair) {
|
|
27988
27983
|
return kmath.number.equal(pair[0], pair[1], tolerance);
|
|
@@ -27995,11 +27990,6 @@ function similar(coords1, coords2, tolerance) {
|
|
|
27995
27990
|
return false;
|
|
27996
27991
|
}
|
|
27997
27992
|
|
|
27998
|
-
// Less than or approximately equal
|
|
27999
|
-
function leq(a, b) {
|
|
28000
|
-
return a < b || eq(a, b);
|
|
28001
|
-
}
|
|
28002
|
-
|
|
28003
27993
|
// Given triangle with sides ABC return angle opposite side C in degrees
|
|
28004
27994
|
function lawOfCosines(a, b, c) {
|
|
28005
27995
|
return Math.acos((a * a + b * b - c * c) / (2 * a * b)) * 180 / Math.PI;
|
|
@@ -28039,13 +28029,8 @@ function rotate(array, n) {
|
|
|
28039
28029
|
n = typeof n === "undefined" ? 1 : n % array.length;
|
|
28040
28030
|
return array.slice(n).concat(array.slice(0, n));
|
|
28041
28031
|
}
|
|
28042
|
-
function capitalize(str) {
|
|
28043
|
-
return str.replace(/(?:^|-)(.)/g, function (match, letter) {
|
|
28044
|
-
return letter.toUpperCase();
|
|
28045
|
-
});
|
|
28046
|
-
}
|
|
28047
28032
|
function getLineEquation(first, second) {
|
|
28048
|
-
if (eq(first[0], second[0])) {
|
|
28033
|
+
if (eq$1(first[0], second[0])) {
|
|
28049
28034
|
return "x = " + first[0].toFixed(3);
|
|
28050
28035
|
}
|
|
28051
28036
|
const m = (second[1] - first[1]) / (second[0] - first[0]);
|
|
@@ -28074,6 +28059,35 @@ firstPoints, secondPoints) {
|
|
|
28074
28059
|
const y = ((x1 * y2 - y1 * x2) * (y3 - y4) - (y1 - y2) * (x3 * y4 - y3 * x4)) / determinant;
|
|
28075
28060
|
return "Intersection: (" + x.toFixed(3) + ", " + y.toFixed(3) + ")";
|
|
28076
28061
|
}
|
|
28062
|
+
|
|
28063
|
+
const {
|
|
28064
|
+
DeprecationMixin
|
|
28065
|
+
} = Util;
|
|
28066
|
+
const TRASH_ICON_URI = "https://ka-perseus-graphie.s3.amazonaws.com/b1452c0d79fd0f7ff4c3af9488474a0a0decb361.png";
|
|
28067
|
+
const defaultBackgroundImage$1 = {
|
|
28068
|
+
url: null
|
|
28069
|
+
};
|
|
28070
|
+
const eq = Util.eq;
|
|
28071
|
+
const deepEq$2 = Util.deepEq;
|
|
28072
|
+
const UNLIMITED = "unlimited";
|
|
28073
|
+
|
|
28074
|
+
// Sample background image:
|
|
28075
|
+
// https://ka-perseus-graphie.s3.amazonaws.com/29c1b0fcd17fe63df0f148fe357044d5d5c7d0bb.png
|
|
28076
|
+
|
|
28077
|
+
// default to defaultValue if actual is null or undefined
|
|
28078
|
+
function defaultVal(actual, defaultValue) {
|
|
28079
|
+
return actual == null ? defaultValue : actual;
|
|
28080
|
+
}
|
|
28081
|
+
|
|
28082
|
+
// Less than or approximately equal
|
|
28083
|
+
function leq(a, b) {
|
|
28084
|
+
return a < b || eq(a, b);
|
|
28085
|
+
}
|
|
28086
|
+
function capitalize(str) {
|
|
28087
|
+
return str.replace(/(?:^|-)(.)/g, function (match, letter) {
|
|
28088
|
+
return letter.toUpperCase();
|
|
28089
|
+
});
|
|
28090
|
+
}
|
|
28077
28091
|
function numSteps(range, step) {
|
|
28078
28092
|
return Math.floor((range[1] - range[0]) / step);
|
|
28079
28093
|
}
|
|
@@ -29236,17 +29250,6 @@ class InteractiveGraph extends React__namespace.Component {
|
|
|
29236
29250
|
___default["default"].invoke(this.points, "remove");
|
|
29237
29251
|
(_this$angle2 = this.angle) === null || _this$angle2 === void 0 ? void 0 : _this$angle2.remove();
|
|
29238
29252
|
});
|
|
29239
|
-
_defineProperty(this, "toggleShowAngles", () => {
|
|
29240
|
-
if (this.props.graph.type !== "polygon") {
|
|
29241
|
-
throw makeInvalidTypeError("toggleShowAngles", "polygon");
|
|
29242
|
-
}
|
|
29243
|
-
const graph = ___default["default"].extend({}, this.props.graph, {
|
|
29244
|
-
showAngles: !this.props.graph.showAngles
|
|
29245
|
-
});
|
|
29246
|
-
this.onChange({
|
|
29247
|
-
graph: graph
|
|
29248
|
-
});
|
|
29249
|
-
});
|
|
29250
29253
|
_defineProperty(this, "toggleShowSides", () => {
|
|
29251
29254
|
if (this.props.graph.type !== "polygon") {
|
|
29252
29255
|
throw makeInvalidTypeError("toggleShowSides", "polygon");
|
|
@@ -45840,7 +45843,7 @@ const styles$1 = aphrodite.StyleSheet.create({
|
|
|
45840
45843
|
}
|
|
45841
45844
|
});
|
|
45842
45845
|
|
|
45843
|
-
/* eslint-disable
|
|
45846
|
+
/* eslint-disable @babel/no-invalid-this */
|
|
45844
45847
|
|
|
45845
45848
|
/* A checkbox that syncs its value to props using the
|
|
45846
45849
|
* renderer's onChange method, and gets the prop name
|
package/dist/index.js.flow
CHANGED