@khanacademy/perseus 57.0.0 → 57.0.1
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 +81 -72
- package/dist/es/index.js.map +1 -1
- package/dist/es/strings.js +4 -4
- package/dist/es/strings.js.map +1 -1
- package/dist/index.js +82 -73
- package/dist/index.js.map +1 -1
- package/dist/strings.js +4 -4
- package/dist/strings.js.map +1 -1
- package/dist/widgets/interactive-graphs/graphs/components/sr-description-within-svg.d.ts +19 -0
- package/package.json +2 -2
package/dist/es/index.js
CHANGED
|
@@ -234,8 +234,8 @@ const mockStrings = {
|
|
|
234
234
|
simulationLocaleWarning: "Sorry, this simulation isn't available in your language.",
|
|
235
235
|
selectAnAnswer: "Select an answer",
|
|
236
236
|
// The following strings are used for interactive graph SR descriptions.
|
|
237
|
-
srGraphInstructions: "Use the Tab key to move through the interactive elements in the graph. When an interactive element has focus, use
|
|
238
|
-
srUnlimitedGraphInstructions: "Press Shift + Enter to interact with the graph. Use the Tab key to move through the interactive elements in the graph and access the graph Action Bar. When an interactive element has focus, use
|
|
237
|
+
srGraphInstructions: "Use the Tab key to move through the interactive elements in the graph. When an interactive element has focus, use Control + Shift + Arrows to move it.",
|
|
238
|
+
srUnlimitedGraphInstructions: "Press Shift + Enter to interact with the graph. Use the Tab key to move through the interactive elements in the graph and access the graph Action Bar. When an interactive element has focus, use Control + Shift + Arrows to move it or use the Delete key to remove it from the graph. Use the buttons in the Action Bar to add or adjust elements within the graph.",
|
|
239
239
|
xAxis: "X-axis",
|
|
240
240
|
yAxis: "Y-axis",
|
|
241
241
|
graphKeyboardPrompt: "Press Shift + Enter to interact with the graph",
|
|
@@ -30197,6 +30197,7 @@ function useDraggable(args) {
|
|
|
30197
30197
|
const {
|
|
30198
30198
|
direction: yDownDirection,
|
|
30199
30199
|
altKey,
|
|
30200
|
+
ctrlKey,
|
|
30200
30201
|
metaKey,
|
|
30201
30202
|
shiftKey
|
|
30202
30203
|
} = state;
|
|
@@ -30206,7 +30207,7 @@ function useDraggable(args) {
|
|
|
30206
30207
|
if (altKey || metaKey) {
|
|
30207
30208
|
divisions = 200;
|
|
30208
30209
|
}
|
|
30209
|
-
if (shiftKey) {
|
|
30210
|
+
if (shiftKey && !ctrlKey) {
|
|
30210
30211
|
divisions = 10;
|
|
30211
30212
|
}
|
|
30212
30213
|
const min = span / (divisions * 2);
|
|
@@ -30735,6 +30736,35 @@ const MovablePoint$1 = /*#__PURE__*/React.forwardRef((props, pointRef) => {
|
|
|
30735
30736
|
return /*#__PURE__*/React.createElement(React.Fragment, null, focusableHandle, visiblePoint);
|
|
30736
30737
|
});
|
|
30737
30738
|
|
|
30739
|
+
/**
|
|
30740
|
+
* If an element has an `aria-describedby` attribute, it needs to point to
|
|
30741
|
+
* a separate description element that contains the description for that
|
|
30742
|
+
* element.
|
|
30743
|
+
*
|
|
30744
|
+
* If the element is within an SVG, the description element must be a
|
|
30745
|
+
* `<span>` within a `<foreignObject>` in order for some browser/SR
|
|
30746
|
+
* combos to be able to access it.
|
|
30747
|
+
*
|
|
30748
|
+
* Use this SRDescInSVG component to create the <foreignObject>
|
|
30749
|
+
* and styling for this description element.
|
|
30750
|
+
*/
|
|
30751
|
+
function SRDescInSVG(props) {
|
|
30752
|
+
const {
|
|
30753
|
+
id,
|
|
30754
|
+
children
|
|
30755
|
+
} = props;
|
|
30756
|
+
return /*#__PURE__*/React.createElement("foreignObject", null, /*#__PURE__*/React.createElement("span", {
|
|
30757
|
+
id: id
|
|
30758
|
+
// Hidden visually
|
|
30759
|
+
,
|
|
30760
|
+
style: a11y.srOnly
|
|
30761
|
+
// Hidden from screen readers so they don't read this
|
|
30762
|
+
// again outside of the element that it describes.
|
|
30763
|
+
,
|
|
30764
|
+
"aria-hidden": true
|
|
30765
|
+
}, children));
|
|
30766
|
+
}
|
|
30767
|
+
|
|
30738
30768
|
const {
|
|
30739
30769
|
calculateAngleInDegrees: calculateAngleInDegrees$1,
|
|
30740
30770
|
getClockwiseAngle: getClockwiseAngle$2,
|
|
@@ -30841,9 +30871,8 @@ function AngleGraph(props) {
|
|
|
30841
30871
|
constrain: getAngleSideConstraint(coords[2], coords[1], snapDegrees || 1),
|
|
30842
30872
|
onMove: destination => dispatch(actions.angle.movePoint(2, destination)),
|
|
30843
30873
|
ariaLabel: srAngleStartingSide
|
|
30844
|
-
}), /*#__PURE__*/React.createElement(
|
|
30845
|
-
id: descriptionId
|
|
30846
|
-
style: a11y.srOnly
|
|
30874
|
+
}), /*#__PURE__*/React.createElement(SRDescInSVG, {
|
|
30875
|
+
id: descriptionId
|
|
30847
30876
|
}, srAngleGraphAriaDescription));
|
|
30848
30877
|
}
|
|
30849
30878
|
function getAngleGraphDescription(state, i18n) {
|
|
@@ -31119,12 +31148,10 @@ function CircleGraph(props) {
|
|
|
31119
31148
|
dispatch(actions.circle.moveRadiusPoint(newRadiusPoint));
|
|
31120
31149
|
},
|
|
31121
31150
|
constrain: getCircleKeyboardConstraint(center, radiusPoint, snapStep)
|
|
31122
|
-
}), /*#__PURE__*/React.createElement(
|
|
31123
|
-
id: radiusId
|
|
31124
|
-
|
|
31125
|
-
|
|
31126
|
-
id: outerPointsId,
|
|
31127
|
-
style: a11y.srOnly
|
|
31151
|
+
}), /*#__PURE__*/React.createElement(SRDescInSVG, {
|
|
31152
|
+
id: radiusId
|
|
31153
|
+
}, srCircleRadius), /*#__PURE__*/React.createElement(SRDescInSVG, {
|
|
31154
|
+
id: outerPointsId
|
|
31128
31155
|
}, srCircleOuterPoints));
|
|
31129
31156
|
}
|
|
31130
31157
|
function MovableCircle(props) {
|
|
@@ -31371,15 +31398,12 @@ const LinearGraph = (props, key) => {
|
|
|
31371
31398
|
end: true
|
|
31372
31399
|
},
|
|
31373
31400
|
onMovePoint: (endpointIndex, destination) => dispatch(actions.linear.movePoint(endpointIndex, destination))
|
|
31374
|
-
}), /*#__PURE__*/React.createElement(
|
|
31375
|
-
id: pointsDescriptionId
|
|
31376
|
-
|
|
31377
|
-
|
|
31378
|
-
|
|
31379
|
-
|
|
31380
|
-
}, interceptString), /*#__PURE__*/React.createElement("g", {
|
|
31381
|
-
id: slopeDescriptionId,
|
|
31382
|
-
style: a11y.srOnly
|
|
31401
|
+
}), /*#__PURE__*/React.createElement(SRDescInSVG, {
|
|
31402
|
+
id: pointsDescriptionId
|
|
31403
|
+
}, srLinearGraphPoints), /*#__PURE__*/React.createElement(SRDescInSVG, {
|
|
31404
|
+
id: interceptDescriptionId
|
|
31405
|
+
}, interceptString), /*#__PURE__*/React.createElement(SRDescInSVG, {
|
|
31406
|
+
id: slopeDescriptionId
|
|
31383
31407
|
}, slopeString));
|
|
31384
31408
|
};
|
|
31385
31409
|
function getLinearGraphDescription(state, i18n) {
|
|
@@ -31517,21 +31541,16 @@ const LinearSystemGraph = props => {
|
|
|
31517
31541
|
pointsDescription,
|
|
31518
31542
|
interceptDescription,
|
|
31519
31543
|
slopeDescription
|
|
31520
|
-
}) => /*#__PURE__*/React.createElement(
|
|
31521
|
-
key:
|
|
31522
|
-
|
|
31523
|
-
|
|
31524
|
-
}, pointsDescription), /*#__PURE__*/React.createElement(
|
|
31525
|
-
|
|
31526
|
-
|
|
31527
|
-
|
|
31528
|
-
},
|
|
31529
|
-
|
|
31530
|
-
id: slopeDescriptionId,
|
|
31531
|
-
style: a11y.srOnly
|
|
31532
|
-
}, slopeDescription))), /*#__PURE__*/React.createElement("g", {
|
|
31533
|
-
id: intersectionId,
|
|
31534
|
-
style: a11y.srOnly
|
|
31544
|
+
}, i) => /*#__PURE__*/React.createElement("span", {
|
|
31545
|
+
key: `line-descriptions-${i}`
|
|
31546
|
+
}, /*#__PURE__*/React.createElement(SRDescInSVG, {
|
|
31547
|
+
id: pointsDescriptionId
|
|
31548
|
+
}, pointsDescription), /*#__PURE__*/React.createElement(SRDescInSVG, {
|
|
31549
|
+
id: interceptDescriptionId
|
|
31550
|
+
}, interceptDescription), /*#__PURE__*/React.createElement(SRDescInSVG, {
|
|
31551
|
+
id: slopeDescriptionId
|
|
31552
|
+
}, slopeDescription))), /*#__PURE__*/React.createElement(SRDescInSVG, {
|
|
31553
|
+
id: intersectionId
|
|
31535
31554
|
}, intersectionDescription));
|
|
31536
31555
|
};
|
|
31537
31556
|
|
|
@@ -33086,23 +33105,21 @@ const LimitedPolygonGraph = statefulProps => {
|
|
|
33086
33105
|
// point is "polite".
|
|
33087
33106
|
setAriaLives(["off", ...newPointAriaLives]);
|
|
33088
33107
|
}
|
|
33089
|
-
}), angleDegree && /*#__PURE__*/React.createElement(
|
|
33108
|
+
}), angleDegree && /*#__PURE__*/React.createElement(SRDescInSVG, {
|
|
33090
33109
|
id: angleId
|
|
33091
33110
|
}, Number.isInteger(angleDegree) ? strings.srPolygonPointAngle({
|
|
33092
33111
|
angle: angleDegree
|
|
33093
33112
|
}) : strings.srPolygonPointAngleApprox({
|
|
33094
33113
|
angle: srFormatNumber(angleDegree, locale, 1)
|
|
33095
|
-
})), /*#__PURE__*/React.createElement(
|
|
33114
|
+
})), /*#__PURE__*/React.createElement(SRDescInSVG, {
|
|
33096
33115
|
id: side1Id
|
|
33097
|
-
}, getPolygonSideString(side1Length, point1Index, strings, locale)), /*#__PURE__*/React.createElement(
|
|
33116
|
+
}, getPolygonSideString(side1Length, point1Index, strings, locale)), /*#__PURE__*/React.createElement(SRDescInSVG, {
|
|
33098
33117
|
id: side2Id
|
|
33099
33118
|
}, getPolygonSideString(side2Length, point2Index, strings, locale)));
|
|
33100
|
-
}), /*#__PURE__*/React.createElement(
|
|
33101
|
-
id: polygonPointsNumId
|
|
33102
|
-
|
|
33103
|
-
|
|
33104
|
-
id: polygonPointsId,
|
|
33105
|
-
style: a11y.srOnly
|
|
33119
|
+
}), /*#__PURE__*/React.createElement(SRDescInSVG, {
|
|
33120
|
+
id: polygonPointsNumId
|
|
33121
|
+
}, srPolygonGraphPointsNum), srPolygonGraphPoints && /*#__PURE__*/React.createElement(SRDescInSVG, {
|
|
33122
|
+
id: polygonPointsId
|
|
33106
33123
|
}, srPolygonGraphPoints));
|
|
33107
33124
|
};
|
|
33108
33125
|
const UnlimitedPolygonGraph = statefulProps => {
|
|
@@ -33237,7 +33254,7 @@ const UnlimitedPolygonGraph = statefulProps => {
|
|
|
33237
33254
|
}
|
|
33238
33255
|
dispatch(actions.polygon.clickPoint(i));
|
|
33239
33256
|
}
|
|
33240
|
-
}), angleDegree && /*#__PURE__*/React.createElement(
|
|
33257
|
+
}), angleDegree && /*#__PURE__*/React.createElement(SRDescInSVG, {
|
|
33241
33258
|
id: angleId
|
|
33242
33259
|
}, Number.isInteger(angleDegree) ? strings.srPolygonPointAngle({
|
|
33243
33260
|
angle: angleDegree
|
|
@@ -33246,16 +33263,14 @@ const UnlimitedPolygonGraph = statefulProps => {
|
|
|
33246
33263
|
})), sidesArray.map(({
|
|
33247
33264
|
pointIndex,
|
|
33248
33265
|
sideLength
|
|
33249
|
-
}, j) => /*#__PURE__*/React.createElement(
|
|
33266
|
+
}, j) => /*#__PURE__*/React.createElement(SRDescInSVG, {
|
|
33250
33267
|
key: `${id}-point-${i}-side-${j}`,
|
|
33251
33268
|
id: `${id}-point-${i}-side-${j}`
|
|
33252
33269
|
}, getPolygonSideString(sideLength, pointIndex, strings, locale))));
|
|
33253
|
-
}), coords.length > 0 && /*#__PURE__*/React.createElement(
|
|
33254
|
-
id: polygonPointsNumId
|
|
33255
|
-
|
|
33256
|
-
|
|
33257
|
-
id: polygonPointsId,
|
|
33258
|
-
style: a11y.srOnly
|
|
33270
|
+
}), coords.length > 0 && /*#__PURE__*/React.createElement(SRDescInSVG, {
|
|
33271
|
+
id: polygonPointsNumId
|
|
33272
|
+
}, srPolygonGraphPointsNum), srPolygonGraphPoints && /*#__PURE__*/React.createElement(SRDescInSVG, {
|
|
33273
|
+
id: polygonPointsId
|
|
33259
33274
|
}, srPolygonGraphPoints));
|
|
33260
33275
|
};
|
|
33261
33276
|
function getLines(points) {
|
|
@@ -33512,15 +33527,12 @@ function QuadraticGraph(props) {
|
|
|
33512
33527
|
constrain: getQuadraticKeyboardConstraint(coords, snapStep, i),
|
|
33513
33528
|
onMove: destination => dispatch(actions.quadratic.movePoint(i, destination))
|
|
33514
33529
|
});
|
|
33515
|
-
}), srQuadraticDirection && /*#__PURE__*/React.createElement(
|
|
33516
|
-
id: quadraticDirectionId
|
|
33517
|
-
|
|
33518
|
-
|
|
33519
|
-
|
|
33520
|
-
|
|
33521
|
-
}, srQuadraticVertex), /*#__PURE__*/React.createElement("g", {
|
|
33522
|
-
id: quadraticInterceptsId,
|
|
33523
|
-
style: a11y.srOnly
|
|
33530
|
+
}), srQuadraticDirection && /*#__PURE__*/React.createElement(SRDescInSVG, {
|
|
33531
|
+
id: quadraticDirectionId
|
|
33532
|
+
}, srQuadraticDirection), srQuadraticVertex && /*#__PURE__*/React.createElement(SRDescInSVG, {
|
|
33533
|
+
id: quadraticVertexId
|
|
33534
|
+
}, srQuadraticVertex), /*#__PURE__*/React.createElement(SRDescInSVG, {
|
|
33535
|
+
id: quadraticInterceptsId
|
|
33524
33536
|
}, srQuadraticXIntercepts ? `${srQuadraticXIntercepts} ${srQuadraticYIntercept}` : `${srQuadraticYIntercept}`));
|
|
33525
33537
|
}
|
|
33526
33538
|
|
|
@@ -33708,9 +33720,8 @@ const RayGraph = props => {
|
|
|
33708
33720
|
start: false,
|
|
33709
33721
|
end: true
|
|
33710
33722
|
}
|
|
33711
|
-
}), /*#__PURE__*/React.createElement(
|
|
33712
|
-
id: pointsDescriptionId
|
|
33713
|
-
style: a11y.srOnly
|
|
33723
|
+
}), /*#__PURE__*/React.createElement(SRDescInSVG, {
|
|
33724
|
+
id: pointsDescriptionId
|
|
33714
33725
|
}, srRayPoints));
|
|
33715
33726
|
};
|
|
33716
33727
|
function getRayGraphDescription(state, i18n) {
|
|
@@ -33848,13 +33859,11 @@ const SegmentGraph = ({
|
|
|
33848
33859
|
point2Y: srFormatNumber(segment[1][Y], locale)
|
|
33849
33860
|
})
|
|
33850
33861
|
}
|
|
33851
|
-
}), /*#__PURE__*/React.createElement(
|
|
33852
|
-
id: lengthDescriptionId
|
|
33853
|
-
style: a11y.srOnly
|
|
33862
|
+
}), /*#__PURE__*/React.createElement(SRDescInSVG, {
|
|
33863
|
+
id: lengthDescriptionId
|
|
33854
33864
|
}, strings.srSegmentLength({
|
|
33855
33865
|
length: srFormatNumber(getLengthOfSegment(segment), locale)
|
|
33856
|
-
})))), /*#__PURE__*/React.createElement(
|
|
33857
|
-
style: a11y.srOnly,
|
|
33866
|
+
})))), /*#__PURE__*/React.createElement(SRDescInSVG, {
|
|
33858
33867
|
id: wholeGraphDescriptionId
|
|
33859
33868
|
}, getWholeSegmentGraphAriaDescription()));
|
|
33860
33869
|
};
|
|
@@ -33953,7 +33962,7 @@ function SinusoidGraph(props) {
|
|
|
33953
33962
|
sequenceNumber: i + 1,
|
|
33954
33963
|
constrain: getSinusoidKeyboardConstraint(coords, snapStep, i),
|
|
33955
33964
|
onMove: destination => dispatch(actions.sinusoid.movePoint(i, destination))
|
|
33956
|
-
})), /*#__PURE__*/React.createElement(
|
|
33965
|
+
})), /*#__PURE__*/React.createElement(SRDescInSVG, {
|
|
33957
33966
|
id: descriptionId
|
|
33958
33967
|
}, srSinusoidDescription));
|
|
33959
33968
|
}
|
|
@@ -41420,7 +41429,7 @@ const addLibraryVersionToPerseusDebug = (libraryName, libraryVersion) => {
|
|
|
41420
41429
|
|
|
41421
41430
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
41422
41431
|
const libName = "@khanacademy/perseus";
|
|
41423
|
-
const libVersion = "57.0.
|
|
41432
|
+
const libVersion = "57.0.1";
|
|
41424
41433
|
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
41425
41434
|
|
|
41426
41435
|
const apiVersion = {
|