@khanacademy/perseus 6.2.0 → 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 +17 -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/__tests__/item-renderer.test.tsx +1 -1
- 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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @khanacademy/perseus
|
|
2
2
|
|
|
3
|
+
## 6.2.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5fba7c60: Remove pi as a default answerForm for numeric-input
|
|
8
|
+
- Updated dependencies [31ed8380]
|
|
9
|
+
- Updated dependencies [937d2308]
|
|
10
|
+
- @khanacademy/math-input@4.1.1
|
|
11
|
+
|
|
12
|
+
## 6.2.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [a7f56710]
|
|
17
|
+
- Updated dependencies [a7f56710]
|
|
18
|
+
- @khanacademy/math-input@4.1.0
|
|
19
|
+
|
|
3
20
|
## 6.2.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
package/dist/all-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;
|
package/dist/all-widgets.js.flow
CHANGED
|
@@ -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/basic-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/es/index.js
CHANGED
|
@@ -2458,7 +2458,6 @@ const KhanAnswerTypes = {
|
|
|
2458
2458
|
}
|
|
2459
2459
|
};
|
|
2460
2460
|
|
|
2461
|
-
/* eslint-disable react/prop-types */
|
|
2462
2461
|
const ERROR_MESSAGE = i18n._("Sorry, I don't understand that!");
|
|
2463
2462
|
const insertBraces = value => {
|
|
2464
2463
|
// HACK(alex): Make sure that all LaTeX super/subscripts are wrapped
|
|
@@ -3392,7 +3391,7 @@ const DeprecationMixin$1 = {
|
|
|
3392
3391
|
/**
|
|
3393
3392
|
* Approximate equality on numbers and primitives.
|
|
3394
3393
|
*/
|
|
3395
|
-
function eq$
|
|
3394
|
+
function eq$2(x, y) {
|
|
3396
3395
|
if (typeof x === "number" && typeof y === "number") {
|
|
3397
3396
|
return Math.abs(x - y) < 1e-9;
|
|
3398
3397
|
}
|
|
@@ -3403,13 +3402,13 @@ function eq$1(x, y) {
|
|
|
3403
3402
|
* Deep approximate equality on primitives, numbers, arrays, and objects.
|
|
3404
3403
|
* Recursive.
|
|
3405
3404
|
*/
|
|
3406
|
-
function deepEq$
|
|
3405
|
+
function deepEq$6(x, y) {
|
|
3407
3406
|
if (Array.isArray(x) && Array.isArray(y)) {
|
|
3408
3407
|
if (x.length !== y.length) {
|
|
3409
3408
|
return false;
|
|
3410
3409
|
}
|
|
3411
3410
|
for (let i = 0; i < x.length; i++) {
|
|
3412
|
-
if (!deepEq$
|
|
3411
|
+
if (!deepEq$6(x[i], y[i])) {
|
|
3413
3412
|
return false;
|
|
3414
3413
|
}
|
|
3415
3414
|
}
|
|
@@ -3419,7 +3418,7 @@ function deepEq$5(x, y) {
|
|
|
3419
3418
|
return false;
|
|
3420
3419
|
}
|
|
3421
3420
|
if (typeof x === "function" && typeof y === "function") {
|
|
3422
|
-
return eq$
|
|
3421
|
+
return eq$2(x, y);
|
|
3423
3422
|
}
|
|
3424
3423
|
if (typeof x === "function" || typeof y === "function") {
|
|
3425
3424
|
return false;
|
|
@@ -3427,16 +3426,16 @@ function deepEq$5(x, y) {
|
|
|
3427
3426
|
if (typeof x === "object" && typeof y === "object" && !!x && !!y) {
|
|
3428
3427
|
return x === y || _.all(x, function (v, k) {
|
|
3429
3428
|
// @ts-expect-error [FEI-5003] - TS2536 - Type 'CollectionKey<T>' cannot be used to index type 'T'.
|
|
3430
|
-
return deepEq$
|
|
3429
|
+
return deepEq$6(y[k], v);
|
|
3431
3430
|
}) && _.all(y, function (v, k) {
|
|
3432
3431
|
// @ts-expect-error [FEI-5003] - TS2536 - Type 'CollectionKey<T>' cannot be used to index type 'T'.
|
|
3433
|
-
return deepEq$
|
|
3432
|
+
return deepEq$6(x[k], v);
|
|
3434
3433
|
});
|
|
3435
3434
|
}
|
|
3436
3435
|
if (typeof x === "object" && !!x || typeof y === "object" && !!y) {
|
|
3437
3436
|
return false;
|
|
3438
3437
|
}
|
|
3439
|
-
return eq$
|
|
3438
|
+
return eq$2(x, y);
|
|
3440
3439
|
}
|
|
3441
3440
|
|
|
3442
3441
|
/**
|
|
@@ -3754,8 +3753,8 @@ const Util = {
|
|
|
3754
3753
|
tickStepFromNumTicks,
|
|
3755
3754
|
constrainedTickStepsFromTickSteps,
|
|
3756
3755
|
DeprecationMixin: DeprecationMixin$1,
|
|
3757
|
-
eq: eq$
|
|
3758
|
-
deepEq: deepEq$
|
|
3756
|
+
eq: eq$2,
|
|
3757
|
+
deepEq: deepEq$6,
|
|
3759
3758
|
parseQueryString,
|
|
3760
3759
|
updateQueryString: updateQueryString$2,
|
|
3761
3760
|
strongEncodeURIComponent,
|
|
@@ -14017,7 +14016,7 @@ _.extend(MovableAngle.prototype, {
|
|
|
14017
14016
|
|
|
14018
14017
|
/* eslint-disable @babel/no-invalid-this */
|
|
14019
14018
|
const nestedMap$1 = Util.nestedMap;
|
|
14020
|
-
const deepEq$
|
|
14019
|
+
const deepEq$5 = Util.deepEq;
|
|
14021
14020
|
|
|
14022
14021
|
/**
|
|
14023
14022
|
* A base class for all Graphie Movables
|
|
@@ -14114,7 +14113,7 @@ const createSimpleClass = function createSimpleClass(addFunction) {
|
|
|
14114
14113
|
this._prevProps = this.props;
|
|
14115
14114
|
},
|
|
14116
14115
|
modify: function (graphie) {
|
|
14117
|
-
if (!deepEq$
|
|
14116
|
+
if (!deepEq$5(this.props, this._prevProps)) {
|
|
14118
14117
|
this.remove();
|
|
14119
14118
|
this.add(graphie);
|
|
14120
14119
|
this._prevProps = this.props;
|
|
@@ -16387,7 +16386,7 @@ var Movables = {
|
|
|
16387
16386
|
const GraphieMovable = GraphieClasses.GraphieMovable;
|
|
16388
16387
|
const createGraphie = GraphUtils.createGraphie;
|
|
16389
16388
|
const {
|
|
16390
|
-
deepEq: deepEq$
|
|
16389
|
+
deepEq: deepEq$4,
|
|
16391
16390
|
nestedMap
|
|
16392
16391
|
} = Util;
|
|
16393
16392
|
const {
|
|
@@ -16622,7 +16621,7 @@ class Graphie extends React.Component {
|
|
|
16622
16621
|
if (this.props.setup !== prevProps.setup) {
|
|
16623
16622
|
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);
|
|
16624
16623
|
}
|
|
16625
|
-
if (!deepEq$
|
|
16624
|
+
if (!deepEq$4(this.props.options, prevProps.options) || !deepEq$4(this.props.box, prevProps.box) || !deepEq$4(this.props.range, prevProps.range)) {
|
|
16626
16625
|
this._setupGraphie();
|
|
16627
16626
|
}
|
|
16628
16627
|
this._updateMovables();
|
|
@@ -21045,7 +21044,7 @@ SimpleKeypadInput.propTypes = {
|
|
|
21045
21044
|
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
21046
21045
|
};
|
|
21047
21046
|
|
|
21048
|
-
/* eslint-disable react/
|
|
21047
|
+
/* eslint-disable react/sort-comp */
|
|
21049
21048
|
const ParseTex$1 = TexWrangler.parseTex;
|
|
21050
21049
|
const answerTypes = {
|
|
21051
21050
|
number: {
|
|
@@ -21348,7 +21347,6 @@ var InputNumber$1 = {
|
|
|
21348
21347
|
isLintable: true
|
|
21349
21348
|
};
|
|
21350
21349
|
|
|
21351
|
-
/* eslint-disable react/prop-types */
|
|
21352
21350
|
const ParseTex = TexWrangler.parseTex;
|
|
21353
21351
|
const answerFormButtons = [{
|
|
21354
21352
|
title: "Integers",
|
|
@@ -21511,7 +21509,11 @@ class NumericInput extends React.Component {
|
|
|
21511
21509
|
return answerStrings[0];
|
|
21512
21510
|
}
|
|
21513
21511
|
static validate(useInput, rubric) {
|
|
21514
|
-
const allAnswerForms = answerFormButtons.map(e => e["value"])
|
|
21512
|
+
const allAnswerForms = answerFormButtons.map(e => e["value"])
|
|
21513
|
+
// Don't default to validating the answer as a pi answer
|
|
21514
|
+
// if answerForm isn't set on the answer
|
|
21515
|
+
// https://khanacademy.atlassian.net/browse/LC-691
|
|
21516
|
+
.filter(e => e !== "pi");
|
|
21515
21517
|
const createValidator = answer => {
|
|
21516
21518
|
const stringAnswer = `${answer.value}`;
|
|
21517
21519
|
return KhanAnswerTypes.number.createValidatorFunctional(stringAnswer, {
|
|
@@ -26565,7 +26567,7 @@ var Iframe$1 = {
|
|
|
26565
26567
|
hidden: true
|
|
26566
26568
|
};
|
|
26567
26569
|
|
|
26568
|
-
/* eslint-disable react/
|
|
26570
|
+
/* eslint-disable react/sort-comp */
|
|
26569
26571
|
const defaultBoxSize$2 = 400;
|
|
26570
26572
|
const defaultRange = [0, 10];
|
|
26571
26573
|
const defaultBackgroundImage$3 = {
|
|
@@ -27686,36 +27688,29 @@ Graph.defaultProps = {
|
|
|
27686
27688
|
isMobile: false
|
|
27687
27689
|
};
|
|
27688
27690
|
|
|
27691
|
+
/**
|
|
27692
|
+
* A collection of geomtry-related utility functions
|
|
27693
|
+
*/
|
|
27689
27694
|
const {
|
|
27690
|
-
|
|
27695
|
+
eq: eq$1,
|
|
27696
|
+
deepEq: deepEq$3
|
|
27691
27697
|
} = Util;
|
|
27692
|
-
const TRASH_ICON_URI = "https://ka-perseus-graphie.s3.amazonaws.com/b1452c0d79fd0f7ff4c3af9488474a0a0decb361.png";
|
|
27693
|
-
const defaultBackgroundImage$1 = {
|
|
27694
|
-
url: null
|
|
27695
|
-
};
|
|
27696
|
-
const eq = Util.eq;
|
|
27697
|
-
const deepEq$2 = Util.deepEq;
|
|
27698
|
-
const UNLIMITED = "unlimited";
|
|
27699
27698
|
|
|
27700
|
-
//
|
|
27701
|
-
|
|
27699
|
+
// This should really be a readonly tuple of [number, number]
|
|
27700
|
+
|
|
27701
|
+
// a, b, c
|
|
27702
27702
|
|
|
27703
|
-
function ccw(a, b, c) {
|
|
27704
|
-
return (b[0] - a[0]) * (c[1] - a[1]) - (c[0] - a[0]) * (b[1] - a[1]);
|
|
27705
|
-
}
|
|
27706
|
-
function collinear(a, b, c) {
|
|
27707
|
-
return eq(ccw(a, b, c), 0);
|
|
27708
|
-
}
|
|
27709
27703
|
function sign(val) {
|
|
27710
|
-
if (eq(val, 0)) {
|
|
27704
|
+
if (eq$1(val, 0)) {
|
|
27711
27705
|
return 0;
|
|
27712
27706
|
}
|
|
27713
27707
|
return val > 0 ? 1 : -1;
|
|
27714
27708
|
}
|
|
27715
|
-
|
|
27716
|
-
|
|
27717
|
-
|
|
27718
|
-
|
|
27709
|
+
function ccw(a, b, c) {
|
|
27710
|
+
return (b[0] - a[0]) * (c[1] - a[1]) - (c[0] - a[0]) * (b[1] - a[1]);
|
|
27711
|
+
}
|
|
27712
|
+
function collinear(a, b, c) {
|
|
27713
|
+
return eq$1(ccw(a, b, c), 0);
|
|
27719
27714
|
}
|
|
27720
27715
|
|
|
27721
27716
|
// Given rect bounding points A and B, whether point C is inside the rect
|
|
@@ -27728,14 +27723,12 @@ function pointInRect(a, b, c) {
|
|
|
27728
27723
|
function intersects(ab, cd) {
|
|
27729
27724
|
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]]];
|
|
27730
27725
|
const orientations = _.map(triplets, function (triplet) {
|
|
27731
|
-
// @ts-expect-error [FEI-5003] - TS2556 - A spread argument must either have a tuple type or be passed to a rest parameter.
|
|
27732
27726
|
return sign(ccw(...triplet));
|
|
27733
27727
|
});
|
|
27734
27728
|
if (orientations[0] !== orientations[1] && orientations[2] !== orientations[3]) {
|
|
27735
27729
|
return true;
|
|
27736
27730
|
}
|
|
27737
27731
|
for (let i = 0; i < 4; i++) {
|
|
27738
|
-
// @ts-expect-error [FEI-5003] - TS2556 - A spread argument must either have a tuple type or be passed to a rest parameter.
|
|
27739
27732
|
if (orientations[i] === 0 && pointInRect(...triplets[i])) {
|
|
27740
27733
|
return true;
|
|
27741
27734
|
}
|
|
@@ -27813,13 +27806,13 @@ function similar(coords1, coords2, tolerance) {
|
|
|
27813
27806
|
angles = rotate(angles, i);
|
|
27814
27807
|
// @ts-expect-error [FEI-5003] - TS4104 - The type 'readonly number[]' is 'readonly' and cannot be assigned to the mutable type 'number[]'.
|
|
27815
27808
|
sides = rotate(sides, i);
|
|
27816
|
-
if (deepEq$
|
|
27809
|
+
if (deepEq$3(angles1, angles)) {
|
|
27817
27810
|
const sidePairs = _.zip(sides1, sides);
|
|
27818
27811
|
const factors = _.map(sidePairs, function (pair) {
|
|
27819
27812
|
return pair[0] / pair[1];
|
|
27820
27813
|
});
|
|
27821
27814
|
const same = _.all(factors, function (factor) {
|
|
27822
|
-
return eq(factors[0], factor);
|
|
27815
|
+
return eq$1(factors[0], factor);
|
|
27823
27816
|
});
|
|
27824
27817
|
const congruentEnough = _.all(sidePairs, function (pair) {
|
|
27825
27818
|
return number.equal(pair[0], pair[1], tolerance);
|
|
@@ -27832,11 +27825,6 @@ function similar(coords1, coords2, tolerance) {
|
|
|
27832
27825
|
return false;
|
|
27833
27826
|
}
|
|
27834
27827
|
|
|
27835
|
-
// Less than or approximately equal
|
|
27836
|
-
function leq(a, b) {
|
|
27837
|
-
return a < b || eq(a, b);
|
|
27838
|
-
}
|
|
27839
|
-
|
|
27840
27828
|
// Given triangle with sides ABC return angle opposite side C in degrees
|
|
27841
27829
|
function lawOfCosines(a, b, c) {
|
|
27842
27830
|
return Math.acos((a * a + b * b - c * c) / (2 * a * b)) * 180 / Math.PI;
|
|
@@ -27875,13 +27863,8 @@ function rotate(array, n) {
|
|
|
27875
27863
|
n = typeof n === "undefined" ? 1 : n % array.length;
|
|
27876
27864
|
return array.slice(n).concat(array.slice(0, n));
|
|
27877
27865
|
}
|
|
27878
|
-
function capitalize(str) {
|
|
27879
|
-
return str.replace(/(?:^|-)(.)/g, function (match, letter) {
|
|
27880
|
-
return letter.toUpperCase();
|
|
27881
|
-
});
|
|
27882
|
-
}
|
|
27883
27866
|
function getLineEquation(first, second) {
|
|
27884
|
-
if (eq(first[0], second[0])) {
|
|
27867
|
+
if (eq$1(first[0], second[0])) {
|
|
27885
27868
|
return "x = " + first[0].toFixed(3);
|
|
27886
27869
|
}
|
|
27887
27870
|
const m = (second[1] - first[1]) / (second[0] - first[0]);
|
|
@@ -27910,6 +27893,35 @@ firstPoints, secondPoints) {
|
|
|
27910
27893
|
const y = ((x1 * y2 - y1 * x2) * (y3 - y4) - (y1 - y2) * (x3 * y4 - y3 * x4)) / determinant;
|
|
27911
27894
|
return "Intersection: (" + x.toFixed(3) + ", " + y.toFixed(3) + ")";
|
|
27912
27895
|
}
|
|
27896
|
+
|
|
27897
|
+
const {
|
|
27898
|
+
DeprecationMixin
|
|
27899
|
+
} = Util;
|
|
27900
|
+
const TRASH_ICON_URI = "https://ka-perseus-graphie.s3.amazonaws.com/b1452c0d79fd0f7ff4c3af9488474a0a0decb361.png";
|
|
27901
|
+
const defaultBackgroundImage$1 = {
|
|
27902
|
+
url: null
|
|
27903
|
+
};
|
|
27904
|
+
const eq = Util.eq;
|
|
27905
|
+
const deepEq$2 = Util.deepEq;
|
|
27906
|
+
const UNLIMITED = "unlimited";
|
|
27907
|
+
|
|
27908
|
+
// Sample background image:
|
|
27909
|
+
// https://ka-perseus-graphie.s3.amazonaws.com/29c1b0fcd17fe63df0f148fe357044d5d5c7d0bb.png
|
|
27910
|
+
|
|
27911
|
+
// default to defaultValue if actual is null or undefined
|
|
27912
|
+
function defaultVal(actual, defaultValue) {
|
|
27913
|
+
return actual == null ? defaultValue : actual;
|
|
27914
|
+
}
|
|
27915
|
+
|
|
27916
|
+
// Less than or approximately equal
|
|
27917
|
+
function leq(a, b) {
|
|
27918
|
+
return a < b || eq(a, b);
|
|
27919
|
+
}
|
|
27920
|
+
function capitalize(str) {
|
|
27921
|
+
return str.replace(/(?:^|-)(.)/g, function (match, letter) {
|
|
27922
|
+
return letter.toUpperCase();
|
|
27923
|
+
});
|
|
27924
|
+
}
|
|
27913
27925
|
function numSteps(range, step) {
|
|
27914
27926
|
return Math.floor((range[1] - range[0]) / step);
|
|
27915
27927
|
}
|
|
@@ -29061,17 +29073,6 @@ class InteractiveGraph extends React.Component {
|
|
|
29061
29073
|
_.invoke(this.points, "remove");
|
|
29062
29074
|
(_this$angle2 = this.angle) == null ? void 0 : _this$angle2.remove();
|
|
29063
29075
|
};
|
|
29064
|
-
this.toggleShowAngles = () => {
|
|
29065
|
-
if (this.props.graph.type !== "polygon") {
|
|
29066
|
-
throw makeInvalidTypeError("toggleShowAngles", "polygon");
|
|
29067
|
-
}
|
|
29068
|
-
const graph = _.extend({}, this.props.graph, {
|
|
29069
|
-
showAngles: !this.props.graph.showAngles
|
|
29070
|
-
});
|
|
29071
|
-
this.onChange({
|
|
29072
|
-
graph: graph
|
|
29073
|
-
});
|
|
29074
|
-
};
|
|
29075
29076
|
this.toggleShowSides = () => {
|
|
29076
29077
|
if (this.props.graph.type !== "polygon") {
|
|
29077
29078
|
throw makeInvalidTypeError("toggleShowSides", "polygon");
|
|
@@ -45588,7 +45589,7 @@ const styles$1 = StyleSheet.create({
|
|
|
45588
45589
|
}
|
|
45589
45590
|
});
|
|
45590
45591
|
|
|
45591
|
-
/* eslint-disable
|
|
45592
|
+
/* eslint-disable @babel/no-invalid-this */
|
|
45592
45593
|
|
|
45593
45594
|
/* A checkbox that syncs its value to props using the
|
|
45594
45595
|
* renderer's onChange method, and gets the prop name
|