@khanacademy/perseus-editor 6.9.0 → 6.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/index.js +47 -82
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +47 -82
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/es/index.js
CHANGED
|
@@ -29,7 +29,7 @@ import trashIcon from '@phosphor-icons/core/bold/trash-bold.svg';
|
|
|
29
29
|
|
|
30
30
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
31
31
|
const libName = "@khanacademy/perseus-editor";
|
|
32
|
-
const libVersion = "6.
|
|
32
|
+
const libVersion = "6.10.0";
|
|
33
33
|
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
34
34
|
|
|
35
35
|
function _extends() {
|
|
@@ -30290,29 +30290,26 @@ const AngleInput = props => {
|
|
|
30290
30290
|
return /*#__PURE__*/React.createElement(View, {
|
|
30291
30291
|
style: [styles$q.row, styles$q.spaceUnder]
|
|
30292
30292
|
}, /*#__PURE__*/React.createElement(LabelMedium, {
|
|
30293
|
-
tag: "label"
|
|
30294
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
30293
|
+
tag: "label",
|
|
30295
30294
|
style: styles$q.row
|
|
30296
30295
|
}, "angle", /*#__PURE__*/React.createElement(Strut, {
|
|
30297
30296
|
size: spacing.xxSmall_6
|
|
30298
30297
|
}), /*#__PURE__*/React.createElement(TextField, {
|
|
30299
|
-
id: "",
|
|
30300
30298
|
value: angleInput,
|
|
30301
30299
|
onChange: handleAngleChange,
|
|
30302
30300
|
style: styles$q.textField
|
|
30303
|
-
}))
|
|
30301
|
+
})), /*#__PURE__*/React.createElement(Strut, {
|
|
30304
30302
|
size: spacing.xxSmall_6
|
|
30305
|
-
}), /*#__PURE__*/React.createElement(View, {
|
|
30306
|
-
style: styles$q.row
|
|
30307
|
-
}, /*#__PURE__*/React.createElement(LabelSmall, null, "radians"), /*#__PURE__*/React.createElement(View, {
|
|
30303
|
+
}), /*#__PURE__*/React.createElement(LabelSmall, null, "radians"), /*#__PURE__*/React.createElement(View, {
|
|
30308
30304
|
style: styles$q.switch
|
|
30309
30305
|
}, /*#__PURE__*/React.createElement(Switch, {
|
|
30310
30306
|
onChange: handleAngleTypeChange,
|
|
30311
30307
|
checked: isInDegrees
|
|
30312
|
-
})), /*#__PURE__*/React.createElement(LabelSmall, null, "degrees")
|
|
30308
|
+
})), /*#__PURE__*/React.createElement(LabelSmall, null, "degrees"), /*#__PURE__*/React.createElement(InfoTip$d, null, /*#__PURE__*/React.createElement("p", null, "The angle of rotation for the ellipse (if the x radius and y radius are different)."), /*#__PURE__*/React.createElement("p", null, "Expressions will be evaluted (e.g. \"pi/2\" or \"5pi/4\").")));
|
|
30313
30309
|
};
|
|
30314
30310
|
const styles$q = StyleSheet.create({
|
|
30315
30311
|
row: {
|
|
30312
|
+
display: "flex",
|
|
30316
30313
|
flexDirection: "row",
|
|
30317
30314
|
alignItems: "center"
|
|
30318
30315
|
},
|
|
@@ -30359,16 +30356,14 @@ const ColorSelect = props => {
|
|
|
30359
30356
|
style,
|
|
30360
30357
|
onChange
|
|
30361
30358
|
} = props;
|
|
30362
|
-
const ids = useUniqueIdWithMock();
|
|
30363
|
-
const id = ids.get("color-select");
|
|
30364
30359
|
return /*#__PURE__*/React.createElement(View, {
|
|
30365
30360
|
style: [styles$o.row, style]
|
|
30366
30361
|
}, /*#__PURE__*/React.createElement(LabelMedium, {
|
|
30367
|
-
|
|
30368
|
-
style: styles$o.
|
|
30369
|
-
|
|
30370
|
-
|
|
30371
|
-
|
|
30362
|
+
tag: "label",
|
|
30363
|
+
style: styles$o.row
|
|
30364
|
+
}, "color", /*#__PURE__*/React.createElement(Strut, {
|
|
30365
|
+
size: spacing.xxSmall_6
|
|
30366
|
+
}), /*#__PURE__*/React.createElement(SingleSelect, {
|
|
30372
30367
|
selectedValue: selectedValue,
|
|
30373
30368
|
onChange: onChange
|
|
30374
30369
|
// Placeholder is required, but never gets used.
|
|
@@ -30382,15 +30377,13 @@ const ColorSelect = props => {
|
|
|
30382
30377
|
color: colorName,
|
|
30383
30378
|
decorative: true
|
|
30384
30379
|
})
|
|
30385
|
-
}, colorName))));
|
|
30380
|
+
}, colorName)))));
|
|
30386
30381
|
};
|
|
30387
30382
|
const styles$o = StyleSheet.create({
|
|
30388
30383
|
row: {
|
|
30384
|
+
display: "flex",
|
|
30389
30385
|
flexDirection: "row",
|
|
30390
30386
|
alignItems: "center"
|
|
30391
|
-
},
|
|
30392
|
-
label: {
|
|
30393
|
-
marginInlineEnd: spacing.xxxSmall_4
|
|
30394
30387
|
}
|
|
30395
30388
|
});
|
|
30396
30389
|
|
|
@@ -30407,12 +30400,6 @@ const CoordinatePairInput = props => {
|
|
|
30407
30400
|
const [coordState, setCoordState] = React.useState([
|
|
30408
30401
|
// Using strings to make it easier to work with the text fields.
|
|
30409
30402
|
coord[0].toString(), coord[1].toString()]);
|
|
30410
|
-
|
|
30411
|
-
// Generate unique IDs so that the programmatic labels can be associated
|
|
30412
|
-
// with their respective text fields.
|
|
30413
|
-
const ids = useUniqueIdWithMock();
|
|
30414
|
-
const xCoordId = ids.get("x-coord");
|
|
30415
|
-
const yCoordId = ids.get("y-coord");
|
|
30416
30403
|
function handleCoordChange(newValue, coordIndex) {
|
|
30417
30404
|
// Update the local state (update the input field value).
|
|
30418
30405
|
const newCoordState = [...coordState];
|
|
@@ -30433,40 +30420,38 @@ const CoordinatePairInput = props => {
|
|
|
30433
30420
|
return /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(View, {
|
|
30434
30421
|
style: [styles$n.row, styles$n.spaceUnder]
|
|
30435
30422
|
}, /*#__PURE__*/React.createElement(LabelMedium, {
|
|
30436
|
-
|
|
30437
|
-
style: styles$n.
|
|
30438
|
-
|
|
30439
|
-
|
|
30440
|
-
|
|
30423
|
+
tag: "label",
|
|
30424
|
+
style: styles$n.row
|
|
30425
|
+
}, labels ? labels[0] : "x coord", /*#__PURE__*/React.createElement(Strut, {
|
|
30426
|
+
size: spacing.xxSmall_6
|
|
30427
|
+
}), /*#__PURE__*/React.createElement(TextField, {
|
|
30441
30428
|
type: "number",
|
|
30442
30429
|
value: coordState[0],
|
|
30443
30430
|
onChange: newValue => handleCoordChange(newValue, 0),
|
|
30444
30431
|
style: [styles$n.textField, error ? styles$n.errorField : undefined]
|
|
30445
|
-
}), /*#__PURE__*/React.createElement(Strut, {
|
|
30432
|
+
})), /*#__PURE__*/React.createElement(Strut, {
|
|
30446
30433
|
size: spacing.medium_16
|
|
30447
30434
|
}), /*#__PURE__*/React.createElement(LabelMedium, {
|
|
30448
|
-
|
|
30449
|
-
style: styles$n.
|
|
30450
|
-
|
|
30451
|
-
|
|
30452
|
-
|
|
30435
|
+
tag: "label",
|
|
30436
|
+
style: styles$n.row
|
|
30437
|
+
}, labels ? labels[1] : "y coord", /*#__PURE__*/React.createElement(Strut, {
|
|
30438
|
+
size: spacing.xxSmall_6
|
|
30439
|
+
}), /*#__PURE__*/React.createElement(TextField, {
|
|
30453
30440
|
type: "number",
|
|
30454
30441
|
value: coordState[1],
|
|
30455
30442
|
onChange: newValue => handleCoordChange(newValue, 1),
|
|
30456
30443
|
style: [styles$n.textField, error ? styles$n.errorField : undefined]
|
|
30457
|
-
})));
|
|
30444
|
+
}))));
|
|
30458
30445
|
};
|
|
30459
30446
|
const styles$n = StyleSheet.create({
|
|
30460
30447
|
row: {
|
|
30448
|
+
display: "flex",
|
|
30461
30449
|
flexDirection: "row",
|
|
30462
30450
|
alignItems: "center"
|
|
30463
30451
|
},
|
|
30464
30452
|
spaceUnder: {
|
|
30465
30453
|
marginBottom: spacing.xSmall_8
|
|
30466
30454
|
},
|
|
30467
|
-
label: {
|
|
30468
|
-
marginInlineEnd: spacing.xxSmall_6
|
|
30469
|
-
},
|
|
30470
30455
|
textField: {
|
|
30471
30456
|
width: spacing.xxxLarge_64
|
|
30472
30457
|
},
|
|
@@ -30608,9 +30593,6 @@ const LockedEllipseSettings = props => {
|
|
|
30608
30593
|
onChangeProps,
|
|
30609
30594
|
onRemove
|
|
30610
30595
|
} = props;
|
|
30611
|
-
const ids = useUniqueIdWithMock();
|
|
30612
|
-
const strokeSelectId = ids.get("stroke-style-select");
|
|
30613
|
-
const fillSelectId = ids.get("fill-style-select");
|
|
30614
30596
|
function handleColorChange(newValue) {
|
|
30615
30597
|
onChangeProps({
|
|
30616
30598
|
color: newValue
|
|
@@ -30662,10 +30644,10 @@ const LockedEllipseSettings = props => {
|
|
|
30662
30644
|
size: spacing.medium_16
|
|
30663
30645
|
}), /*#__PURE__*/React.createElement(LabelMedium, {
|
|
30664
30646
|
tag: "label",
|
|
30665
|
-
|
|
30666
|
-
|
|
30667
|
-
|
|
30668
|
-
|
|
30647
|
+
style: styles$j.row
|
|
30648
|
+
}, "fill", /*#__PURE__*/React.createElement(Strut, {
|
|
30649
|
+
size: spacing.xxSmall_6
|
|
30650
|
+
}), /*#__PURE__*/React.createElement(SingleSelect, {
|
|
30669
30651
|
selectedValue: fillStyle,
|
|
30670
30652
|
onChange: value => onChangeProps({
|
|
30671
30653
|
fillStyle: value
|
|
@@ -30677,14 +30659,12 @@ const LockedEllipseSettings = props => {
|
|
|
30677
30659
|
key: option,
|
|
30678
30660
|
value: option,
|
|
30679
30661
|
label: option
|
|
30680
|
-
}, option)))), /*#__PURE__*/React.createElement(
|
|
30681
|
-
style: styles$j.row
|
|
30682
|
-
}, /*#__PURE__*/React.createElement(LabelMedium, {
|
|
30662
|
+
}, option))))), /*#__PURE__*/React.createElement(LabelMedium, {
|
|
30683
30663
|
tag: "label",
|
|
30684
|
-
|
|
30685
|
-
|
|
30686
|
-
|
|
30687
|
-
|
|
30664
|
+
style: styles$j.row
|
|
30665
|
+
}, "stroke", /*#__PURE__*/React.createElement(Strut, {
|
|
30666
|
+
size: spacing.xxSmall_6
|
|
30667
|
+
}), /*#__PURE__*/React.createElement(SingleSelect, {
|
|
30688
30668
|
selectedValue: strokeStyle,
|
|
30689
30669
|
onChange: value => onChangeProps({
|
|
30690
30670
|
strokeStyle: value
|
|
@@ -30705,12 +30685,10 @@ const LockedEllipseSettings = props => {
|
|
|
30705
30685
|
};
|
|
30706
30686
|
const styles$j = StyleSheet.create({
|
|
30707
30687
|
row: {
|
|
30688
|
+
display: "flex",
|
|
30708
30689
|
flexDirection: "row",
|
|
30709
30690
|
alignItems: "center"
|
|
30710
30691
|
},
|
|
30711
|
-
label: {
|
|
30712
|
-
marginInlineEnd: spacing.xxSmall_6
|
|
30713
|
-
},
|
|
30714
30692
|
spaceUnder: {
|
|
30715
30693
|
marginBottom: spacing.xSmall_8
|
|
30716
30694
|
}
|
|
@@ -30870,12 +30848,6 @@ const LockedLineSettings = props => {
|
|
|
30870
30848
|
onRemove
|
|
30871
30849
|
} = props;
|
|
30872
30850
|
const [point1, point2] = points;
|
|
30873
|
-
|
|
30874
|
-
// Generate unique IDs so that the programmatic labels can be associated
|
|
30875
|
-
// with their respective text fields.
|
|
30876
|
-
const ids = useUniqueIdWithMock();
|
|
30877
|
-
const kindSelectId = ids.get("line-kind-select");
|
|
30878
|
-
const styleSelectId = ids.get("line-style-select");
|
|
30879
30851
|
const capitalizeKind = kind.charAt(0).toUpperCase() + kind.slice(1);
|
|
30880
30852
|
const lineLabel = `${capitalizeKind} (${point1.coord[0]},
|
|
30881
30853
|
${point1.coord[1]}), (${point2.coord[0]}, ${point2.coord[1]})`;
|
|
@@ -30911,14 +30883,12 @@ const LockedLineSettings = props => {
|
|
|
30911
30883
|
color: lineColor,
|
|
30912
30884
|
lineStyle: lineStyle
|
|
30913
30885
|
}))
|
|
30914
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
30915
|
-
style: [styles$f.row, styles$f.spaceUnder]
|
|
30916
30886
|
}, /*#__PURE__*/React.createElement(LabelMedium, {
|
|
30917
|
-
|
|
30918
|
-
style: styles$f.
|
|
30919
|
-
|
|
30920
|
-
|
|
30921
|
-
|
|
30887
|
+
tag: "label",
|
|
30888
|
+
style: [styles$f.row, styles$f.spaceUnder]
|
|
30889
|
+
}, "kind", /*#__PURE__*/React.createElement(Strut, {
|
|
30890
|
+
size: spacing.xxxSmall_4
|
|
30891
|
+
}), /*#__PURE__*/React.createElement(SingleSelect, {
|
|
30922
30892
|
selectedValue: kind,
|
|
30923
30893
|
onChange: value => onChangeProps({
|
|
30924
30894
|
kind: value
|
|
@@ -30936,20 +30906,18 @@ const LockedLineSettings = props => {
|
|
|
30936
30906
|
value: "segment",
|
|
30937
30907
|
label: "segment"
|
|
30938
30908
|
}))), /*#__PURE__*/React.createElement(View, {
|
|
30939
|
-
style:
|
|
30909
|
+
style: styles$f.row
|
|
30940
30910
|
}, /*#__PURE__*/React.createElement(ColorSelect, {
|
|
30941
30911
|
selectedValue: lineColor,
|
|
30942
30912
|
onChange: handleColorChange
|
|
30943
30913
|
}), /*#__PURE__*/React.createElement(Strut, {
|
|
30944
30914
|
size: spacing.small_12
|
|
30945
|
-
}), /*#__PURE__*/React.createElement(
|
|
30915
|
+
}), /*#__PURE__*/React.createElement(LabelMedium, {
|
|
30916
|
+
tag: "label",
|
|
30946
30917
|
style: styles$f.row
|
|
30947
|
-
}, /*#__PURE__*/React.createElement(
|
|
30948
|
-
|
|
30949
|
-
|
|
30950
|
-
tag: "label"
|
|
30951
|
-
}, "style"), /*#__PURE__*/React.createElement(SingleSelect, {
|
|
30952
|
-
id: styleSelectId,
|
|
30918
|
+
}, "style", /*#__PURE__*/React.createElement(Strut, {
|
|
30919
|
+
size: spacing.xxxSmall_4
|
|
30920
|
+
}), /*#__PURE__*/React.createElement(SingleSelect, {
|
|
30953
30921
|
selectedValue: lineStyle,
|
|
30954
30922
|
onChange: value => onChangeProps({
|
|
30955
30923
|
lineStyle: value
|
|
@@ -30999,9 +30967,6 @@ const styles$f = StyleSheet.create({
|
|
|
30999
30967
|
spaceUnder: {
|
|
31000
30968
|
marginBottom: spacing.xSmall_8
|
|
31001
30969
|
},
|
|
31002
|
-
label: {
|
|
31003
|
-
marginInlineEnd: spacing.xxxSmall_4
|
|
31004
|
-
},
|
|
31005
30970
|
selectMarginOffset: {
|
|
31006
30971
|
// Align with the point settings accordions.
|
|
31007
30972
|
marginInlineEnd: -spacing.xxxSmall_4
|