@khanacademy/perseus-editor 17.1.0 → 17.1.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/dist/es/index.js +37 -71
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +23 -38
- package/dist/index.js.map +1 -1
- package/dist/widgets/interactive-graph-editor/interactive-graph-editor.d.ts +61 -61
- package/dist/widgets/interactive-graph-editor/locked-figures/locked-figure-select.d.ts +0 -1
- package/dist/widgets/interactive-graph-editor/locked-figures/locked-figure-settings.d.ts +1 -4
- package/dist/widgets/interactive-graph-editor/locked-figures/locked-figures-section.d.ts +1 -3
- package/dist/widgets/interactive-graph-editor/locked-figures/locked-point-settings.d.ts +1 -5
- package/package.json +31 -31
package/dist/es/index.js
CHANGED
|
@@ -45,25 +45,17 @@ import arrowCounterClockwise from '@phosphor-icons/core/bold/arrow-counter-clock
|
|
|
45
45
|
|
|
46
46
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
47
47
|
const libName = "@khanacademy/perseus-editor";
|
|
48
|
-
const libVersion = "17.1.
|
|
48
|
+
const libVersion = "17.1.2";
|
|
49
49
|
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
50
50
|
|
|
51
51
|
function _extends() {
|
|
52
|
-
_extends = Object.assign
|
|
53
|
-
for (var
|
|
54
|
-
var
|
|
55
|
-
|
|
56
|
-
for (var key in source) {
|
|
57
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
58
|
-
target[key] = source[key];
|
|
59
|
-
}
|
|
60
|
-
}
|
|
52
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
53
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
54
|
+
var t = arguments[e];
|
|
55
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
61
56
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
return _extends.apply(this, arguments);
|
|
57
|
+
return n;
|
|
58
|
+
}, _extends.apply(null, arguments);
|
|
67
59
|
}
|
|
68
60
|
|
|
69
61
|
const devices = {
|
|
@@ -20527,19 +20519,14 @@ katex.__defineMacro("\\pu", function (context) {
|
|
|
20527
20519
|
// a mathematical minus, U+2212. So we need that extra 0.56.
|
|
20528
20520
|
katex.__defineMacro("\\tripledash", "{\\vphantom{-}\\raisebox{2.56mu}{$\\mkern2mu" + "\\tiny\\text{-}\\mkern1mu\\text{-}\\mkern1mu\\text{-}\\mkern2mu$}}");
|
|
20529
20521
|
|
|
20530
|
-
function _objectWithoutPropertiesLoose(
|
|
20531
|
-
if (
|
|
20532
|
-
var
|
|
20533
|
-
var
|
|
20534
|
-
|
|
20535
|
-
|
|
20536
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
20537
|
-
key = sourceKeys[i];
|
|
20538
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
20539
|
-
target[key] = source[key];
|
|
20522
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
20523
|
+
if (null == r) return {};
|
|
20524
|
+
var t = {};
|
|
20525
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
20526
|
+
if (e.includes(n)) continue;
|
|
20527
|
+
t[n] = r[n];
|
|
20540
20528
|
}
|
|
20541
|
-
|
|
20542
|
-
return target;
|
|
20529
|
+
return t;
|
|
20543
20530
|
}
|
|
20544
20531
|
|
|
20545
20532
|
const _excluded$4 = ["component", "shouldDragHighlight"];
|
|
@@ -29038,7 +29025,7 @@ const LockedFigureSelect = props => {
|
|
|
29038
29025
|
id,
|
|
29039
29026
|
onChange
|
|
29040
29027
|
} = props;
|
|
29041
|
-
const figureTypes = ["point", "line", "vector", "ellipse", "polygon", "function",
|
|
29028
|
+
const figureTypes = ["point", "line", "vector", "ellipse", "polygon", "function", "label"];
|
|
29042
29029
|
return /*#__PURE__*/React.createElement(View, {
|
|
29043
29030
|
style: styles$C.container
|
|
29044
29031
|
}, /*#__PURE__*/React.createElement(ActionMenu, {
|
|
@@ -94289,9 +94276,7 @@ const {
|
|
|
94289
94276
|
InfoTip: InfoTip$c
|
|
94290
94277
|
} = components;
|
|
94291
94278
|
const LockedEllipseSettings = props => {
|
|
94292
|
-
var _flags$mafs, _flags$mafs2;
|
|
94293
94279
|
const {
|
|
94294
|
-
flags,
|
|
94295
94280
|
center,
|
|
94296
94281
|
radius,
|
|
94297
94282
|
angle,
|
|
@@ -94439,7 +94424,7 @@ const LockedEllipseSettings = props => {
|
|
|
94439
94424
|
onChange: value => onChangeProps({
|
|
94440
94425
|
strokeStyle: value
|
|
94441
94426
|
})
|
|
94442
|
-
}),
|
|
94427
|
+
}), /*#__PURE__*/React.createElement(Strut, {
|
|
94443
94428
|
size: spacing.small_12
|
|
94444
94429
|
}), /*#__PURE__*/React.createElement(View, {
|
|
94445
94430
|
style: styles$r.horizontalRule
|
|
@@ -94449,7 +94434,7 @@ const LockedEllipseSettings = props => {
|
|
|
94449
94434
|
onChangeProps: newProps => {
|
|
94450
94435
|
onChangeProps(newProps);
|
|
94451
94436
|
}
|
|
94452
|
-
})
|
|
94437
|
+
}), /*#__PURE__*/React.createElement(Strut, {
|
|
94453
94438
|
size: spacing.xxxSmall_4
|
|
94454
94439
|
}), /*#__PURE__*/React.createElement(View, {
|
|
94455
94440
|
style: styles$r.horizontalRule
|
|
@@ -94483,7 +94468,7 @@ const LockedEllipseSettings = props => {
|
|
|
94483
94468
|
});
|
|
94484
94469
|
},
|
|
94485
94470
|
style: styles$r.addButton
|
|
94486
|
-
}, "Add visible label")
|
|
94471
|
+
}, "Add visible label"), /*#__PURE__*/React.createElement(LockedFigureSettingsActions, {
|
|
94487
94472
|
figureType: props.type,
|
|
94488
94473
|
onMove: onMove,
|
|
94489
94474
|
onRemove: onRemove
|
|
@@ -94547,9 +94532,7 @@ const examples = {
|
|
|
94547
94532
|
};
|
|
94548
94533
|
|
|
94549
94534
|
const LockedFunctionSettings = props => {
|
|
94550
|
-
var _flags$mafs, _flags$mafs2;
|
|
94551
94535
|
const {
|
|
94552
|
-
flags,
|
|
94553
94536
|
color: lineColor,
|
|
94554
94537
|
strokeStyle,
|
|
94555
94538
|
equation,
|
|
@@ -94764,7 +94747,7 @@ const LockedFunctionSettings = props => {
|
|
|
94764
94747
|
example: example,
|
|
94765
94748
|
index: index,
|
|
94766
94749
|
pasteEquationFn: handlePropChange
|
|
94767
|
-
})))),
|
|
94750
|
+
})))), /*#__PURE__*/React.createElement(Strut, {
|
|
94768
94751
|
size: spacing.small_12
|
|
94769
94752
|
}), /*#__PURE__*/React.createElement(View, {
|
|
94770
94753
|
style: styles$p.horizontalRule
|
|
@@ -94774,7 +94757,7 @@ const LockedFunctionSettings = props => {
|
|
|
94774
94757
|
onChangeProps: newProps => {
|
|
94775
94758
|
onChangeProps(newProps);
|
|
94776
94759
|
}
|
|
94777
|
-
})
|
|
94760
|
+
}), /*#__PURE__*/React.createElement(Strut, {
|
|
94778
94761
|
size: spacing.xxxSmall_4
|
|
94779
94762
|
}), /*#__PURE__*/React.createElement(View, {
|
|
94780
94763
|
style: styles$p.horizontalRule
|
|
@@ -94808,7 +94791,7 @@ const LockedFunctionSettings = props => {
|
|
|
94808
94791
|
});
|
|
94809
94792
|
},
|
|
94810
94793
|
style: styles$p.addButton
|
|
94811
|
-
}, "Add visible label")
|
|
94794
|
+
}, "Add visible label"), /*#__PURE__*/React.createElement(LockedFigureSettingsActions, {
|
|
94812
94795
|
figureType: props.type,
|
|
94813
94796
|
onMove: onMove,
|
|
94814
94797
|
onRemove: onRemove
|
|
@@ -94980,9 +94963,7 @@ const styles$o = StyleSheet.create({
|
|
|
94980
94963
|
});
|
|
94981
94964
|
|
|
94982
94965
|
const LockedPointSettings = props => {
|
|
94983
|
-
var _flags$mafs, _flags$mafs2, _flags$mafs3;
|
|
94984
94966
|
const {
|
|
94985
|
-
flags,
|
|
94986
94967
|
headerLabel,
|
|
94987
94968
|
coord,
|
|
94988
94969
|
color: pointColor,
|
|
@@ -95103,7 +95084,7 @@ const LockedPointSettings = props => {
|
|
|
95103
95084
|
filled: !newValue
|
|
95104
95085
|
});
|
|
95105
95086
|
}
|
|
95106
|
-
})), !isDefiningPoint &&
|
|
95087
|
+
})), !isDefiningPoint && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Strut, {
|
|
95107
95088
|
size: spacing.small_12
|
|
95108
95089
|
}), /*#__PURE__*/React.createElement(View, {
|
|
95109
95090
|
style: styles$n.horizontalRule
|
|
@@ -95113,7 +95094,7 @@ const LockedPointSettings = props => {
|
|
|
95113
95094
|
onChangeProps: newProps => {
|
|
95114
95095
|
onChangeProps(newProps);
|
|
95115
95096
|
}
|
|
95116
|
-
})),
|
|
95097
|
+
})), /*#__PURE__*/React.createElement(Strut, {
|
|
95117
95098
|
size: spacing.xxxSmall_4
|
|
95118
95099
|
}), /*#__PURE__*/React.createElement(View, {
|
|
95119
95100
|
style: styles$n.horizontalRule
|
|
@@ -95150,7 +95131,7 @@ const LockedPointSettings = props => {
|
|
|
95150
95131
|
});
|
|
95151
95132
|
},
|
|
95152
95133
|
style: styles$n.addButton
|
|
95153
|
-
}, "Add visible label")
|
|
95134
|
+
}, "Add visible label"), onRemove && /*#__PURE__*/React.createElement(LockedFigureSettingsActions, {
|
|
95154
95135
|
figureType: props.type,
|
|
95155
95136
|
onMove: onMove,
|
|
95156
95137
|
onRemove: onRemove
|
|
@@ -95191,9 +95172,7 @@ const styles$n = StyleSheet.create({
|
|
|
95191
95172
|
|
|
95192
95173
|
const lengthZeroStr = "The line cannot have length 0.";
|
|
95193
95174
|
const LockedLineSettings = props => {
|
|
95194
|
-
var _flags$mafs, _flags$mafs2;
|
|
95195
95175
|
const {
|
|
95196
|
-
flags,
|
|
95197
95176
|
kind,
|
|
95198
95177
|
points,
|
|
95199
95178
|
color: lineColor,
|
|
@@ -95335,7 +95314,6 @@ const LockedLineSettings = props => {
|
|
|
95335
95314
|
})), isInvalid && /*#__PURE__*/React.createElement(LabelMedium, {
|
|
95336
95315
|
style: styles$m.errorText
|
|
95337
95316
|
}, lengthZeroStr), /*#__PURE__*/React.createElement(LockedPointSettings, _extends({
|
|
95338
|
-
flags: flags,
|
|
95339
95317
|
headerLabel: "Point 1",
|
|
95340
95318
|
expanded: true,
|
|
95341
95319
|
showPoint: showPoint1,
|
|
@@ -95346,7 +95324,6 @@ const LockedLineSettings = props => {
|
|
|
95346
95324
|
}),
|
|
95347
95325
|
onChangeProps: newProps => handleChangePoint(newProps, 0)
|
|
95348
95326
|
})), /*#__PURE__*/React.createElement(LockedPointSettings, _extends({
|
|
95349
|
-
flags: flags,
|
|
95350
95327
|
headerLabel: "Point 2",
|
|
95351
95328
|
expanded: true,
|
|
95352
95329
|
showPoint: showPoint2,
|
|
@@ -95356,7 +95333,7 @@ const LockedLineSettings = props => {
|
|
|
95356
95333
|
showPoint2: newValue
|
|
95357
95334
|
}),
|
|
95358
95335
|
onChangeProps: newProps => handleChangePoint(newProps, 1)
|
|
95359
|
-
})),
|
|
95336
|
+
})), /*#__PURE__*/React.createElement(Strut, {
|
|
95360
95337
|
size: spacing.small_12
|
|
95361
95338
|
}), /*#__PURE__*/React.createElement(View, {
|
|
95362
95339
|
style: styles$m.horizontalRule
|
|
@@ -95366,7 +95343,7 @@ const LockedLineSettings = props => {
|
|
|
95366
95343
|
onChangeProps: newProps => {
|
|
95367
95344
|
onChangeProps(newProps);
|
|
95368
95345
|
}
|
|
95369
|
-
})
|
|
95346
|
+
}), /*#__PURE__*/React.createElement(Strut, {
|
|
95370
95347
|
size: spacing.xxxSmall_4
|
|
95371
95348
|
}), /*#__PURE__*/React.createElement(View, {
|
|
95372
95349
|
style: styles$m.horizontalRule
|
|
@@ -95401,7 +95378,7 @@ const LockedLineSettings = props => {
|
|
|
95401
95378
|
});
|
|
95402
95379
|
},
|
|
95403
95380
|
style: styles$m.addButton
|
|
95404
|
-
}, "Add visible label")
|
|
95381
|
+
}, "Add visible label"), /*#__PURE__*/React.createElement(LockedFigureSettingsActions, {
|
|
95405
95382
|
figureType: props.type,
|
|
95406
95383
|
onMove: onMove,
|
|
95407
95384
|
onRemove: onRemove
|
|
@@ -95467,9 +95444,7 @@ const styles$l = StyleSheet.create({
|
|
|
95467
95444
|
});
|
|
95468
95445
|
|
|
95469
95446
|
const LockedPolygonSettings = props => {
|
|
95470
|
-
var _flags$mafs, _flags$mafs2;
|
|
95471
95447
|
const {
|
|
95472
|
-
flags,
|
|
95473
95448
|
points,
|
|
95474
95449
|
color,
|
|
95475
95450
|
showVertices,
|
|
@@ -95694,7 +95669,7 @@ const LockedPolygonSettings = props => {
|
|
|
95694
95669
|
size: "small",
|
|
95695
95670
|
icon: arrowFatRight,
|
|
95696
95671
|
onClick: () => handlePolygonMove("right")
|
|
95697
|
-
}))))),
|
|
95672
|
+
}))))), /*#__PURE__*/React.createElement(Strut, {
|
|
95698
95673
|
size: spacing.small_12
|
|
95699
95674
|
}), /*#__PURE__*/React.createElement(View, {
|
|
95700
95675
|
style: styles$k.horizontalRule
|
|
@@ -95704,7 +95679,7 @@ const LockedPolygonSettings = props => {
|
|
|
95704
95679
|
onChangeProps: newProps => {
|
|
95705
95680
|
onChangeProps(newProps);
|
|
95706
95681
|
}
|
|
95707
|
-
})
|
|
95682
|
+
}), /*#__PURE__*/React.createElement(Strut, {
|
|
95708
95683
|
size: spacing.xxxSmall_4
|
|
95709
95684
|
}), /*#__PURE__*/React.createElement(View, {
|
|
95710
95685
|
style: styles$k.horizontalRule
|
|
@@ -95738,7 +95713,7 @@ const LockedPolygonSettings = props => {
|
|
|
95738
95713
|
});
|
|
95739
95714
|
},
|
|
95740
95715
|
style: styles$k.addButton
|
|
95741
|
-
}, "Add visible label")
|
|
95716
|
+
}, "Add visible label"), /*#__PURE__*/React.createElement(LockedFigureSettingsActions, {
|
|
95742
95717
|
figureType: props.type,
|
|
95743
95718
|
onMove: onMove,
|
|
95744
95719
|
onRemove: onRemove
|
|
@@ -95793,9 +95768,7 @@ const styles$k = StyleSheet.create({
|
|
|
95793
95768
|
|
|
95794
95769
|
const lengthErrorMessage = "The vector cannot have length 0.";
|
|
95795
95770
|
const LockedVectorSettings = props => {
|
|
95796
|
-
var _flags$mafs, _flags$mafs2;
|
|
95797
95771
|
const {
|
|
95798
|
-
flags,
|
|
95799
95772
|
points,
|
|
95800
95773
|
color: lineColor,
|
|
95801
95774
|
labels,
|
|
@@ -95915,7 +95888,7 @@ const LockedVectorSettings = props => {
|
|
|
95915
95888
|
onChange: newProps => {
|
|
95916
95889
|
handleChangePoint(newProps, 1);
|
|
95917
95890
|
}
|
|
95918
|
-
})),
|
|
95891
|
+
})), /*#__PURE__*/React.createElement(Strut, {
|
|
95919
95892
|
size: spacing.small_12
|
|
95920
95893
|
}), /*#__PURE__*/React.createElement(View, {
|
|
95921
95894
|
style: styles$j.horizontalRule
|
|
@@ -95925,7 +95898,7 @@ const LockedVectorSettings = props => {
|
|
|
95925
95898
|
onChangeProps: newProps => {
|
|
95926
95899
|
onChangeProps(newProps);
|
|
95927
95900
|
}
|
|
95928
|
-
})
|
|
95901
|
+
}), /*#__PURE__*/React.createElement(Strut, {
|
|
95929
95902
|
size: spacing.xxxSmall_4
|
|
95930
95903
|
}), /*#__PURE__*/React.createElement(View, {
|
|
95931
95904
|
style: styles$j.horizontalRule
|
|
@@ -95960,7 +95933,7 @@ const LockedVectorSettings = props => {
|
|
|
95960
95933
|
});
|
|
95961
95934
|
},
|
|
95962
95935
|
style: styles$j.addButton
|
|
95963
|
-
}, "Add visible label")
|
|
95936
|
+
}, "Add visible label"), /*#__PURE__*/React.createElement(LockedFigureSettingsActions, {
|
|
95964
95937
|
figureType: props.type,
|
|
95965
95938
|
onMove: onMove,
|
|
95966
95939
|
onRemove: onRemove
|
|
@@ -96021,12 +95994,10 @@ const LockedFigureSettings = props => {
|
|
|
96021
95994
|
case "function":
|
|
96022
95995
|
return /*#__PURE__*/React.createElement(LockedFunctionSettings, props);
|
|
96023
95996
|
case "label":
|
|
96024
|
-
|
|
96025
|
-
|
|
96026
|
-
|
|
96027
|
-
break;
|
|
95997
|
+
return /*#__PURE__*/React.createElement(LockedLabelSettings, props);
|
|
95998
|
+
default:
|
|
95999
|
+
throw new UnreachableCaseError(props);
|
|
96028
96000
|
}
|
|
96029
|
-
return null;
|
|
96030
96001
|
};
|
|
96031
96002
|
|
|
96032
96003
|
const LockedFiguresSection = props => {
|
|
@@ -96130,8 +96101,6 @@ const LockedFiguresSection = props => {
|
|
|
96130
96101
|
}), isExpanded && /*#__PURE__*/React.createElement(View, null, figures == null ? void 0 : figures.map((figure, index) => {
|
|
96131
96102
|
return /*#__PURE__*/React.createElement(LockedFigureSettings, _extends({
|
|
96132
96103
|
key: `${uniqueId}-locked-${figure}-${index}`,
|
|
96133
|
-
flags: props.flags,
|
|
96134
|
-
showLabelsFlag: props.showLabelsFlag,
|
|
96135
96104
|
expanded: expandedStates[index],
|
|
96136
96105
|
onToggle: newValue => {
|
|
96137
96106
|
const newExpanded = [...expandedStates];
|
|
@@ -96146,7 +96115,6 @@ const LockedFiguresSection = props => {
|
|
|
96146
96115
|
}), /*#__PURE__*/React.createElement(View, {
|
|
96147
96116
|
style: styles$i.buttonContainer
|
|
96148
96117
|
}, /*#__PURE__*/React.createElement(LockedFigureSelect, {
|
|
96149
|
-
showLabelsFlag: props.showLabelsFlag,
|
|
96150
96118
|
id: `${uniqueId}-select`,
|
|
96151
96119
|
onChange: addLockedFigure
|
|
96152
96120
|
}), /*#__PURE__*/React.createElement(Strut, {
|
|
@@ -96821,7 +96789,7 @@ class InteractiveGraphEditor extends React.Component {
|
|
|
96821
96789
|
return json;
|
|
96822
96790
|
}
|
|
96823
96791
|
render() {
|
|
96824
|
-
var _this$props$graph$typ, _this$props$graph3, _this$props$apiOption, _this$props$apiOption2, _this$props$fullGraph, _this$props$fullGraph2, _this$props$correct, _this$props$correct2, _this$props$correct3, _this$props$correct4, _this$props$correct5, _this$props$correct6, _this$props$correct7, _this$props$correct8, _this$props$correct9, _this$props$correct10, _this$props$correct11, _this$props$correct12, _this$props$correct13, _this$props$correct14, _this$props$graph12, _this$props$apiOption3
|
|
96792
|
+
var _this$props$graph$typ, _this$props$graph3, _this$props$apiOption, _this$props$apiOption2, _this$props$fullGraph, _this$props$fullGraph2, _this$props$correct, _this$props$correct2, _this$props$correct3, _this$props$correct4, _this$props$correct5, _this$props$correct6, _this$props$correct7, _this$props$correct8, _this$props$correct9, _this$props$correct10, _this$props$correct11, _this$props$correct12, _this$props$correct13, _this$props$correct14, _this$props$graph12, _this$props$apiOption3;
|
|
96825
96793
|
let graph;
|
|
96826
96794
|
let equationString;
|
|
96827
96795
|
const gridStep = this.props.gridStep || Util.getGridStep(this.props.range, this.props.step, interactiveSizes.defaultBoxSize);
|
|
@@ -97165,8 +97133,6 @@ class InteractiveGraphEditor extends React.Component {
|
|
|
97165
97133
|
// Only show the "Add locked figure" dropdown if the graph
|
|
97166
97134
|
// is using Mafs.
|
|
97167
97135
|
this.props.graph && ((_this$props$apiOption3 = this.props.apiOptions) == null || (_this$props$apiOption3 = _this$props$apiOption3.flags) == null || (_this$props$apiOption3 = _this$props$apiOption3.mafs) == null ? void 0 : _this$props$apiOption3[this.props.graph.type]) && /*#__PURE__*/React.createElement(LockedFiguresSection, {
|
|
97168
|
-
flags: this.props.apiOptions.flags,
|
|
97169
|
-
showLabelsFlag: (_this$props$apiOption4 = this.props.apiOptions) == null || (_this$props$apiOption4 = _this$props$apiOption4.flags) == null || (_this$props$apiOption4 = _this$props$apiOption4.mafs) == null ? void 0 : _this$props$apiOption4["interactive-graph-locked-features-labels"],
|
|
97170
97136
|
figures: this.props.lockedFigures,
|
|
97171
97137
|
onChange: this.props.onChange
|
|
97172
97138
|
}));
|