@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/index.js
CHANGED
|
@@ -354,8 +354,8 @@ const mockStrings = {
|
|
|
354
354
|
simulationLocaleWarning: "Sorry, this simulation isn't available in your language.",
|
|
355
355
|
selectAnAnswer: "Select an answer",
|
|
356
356
|
// The following strings are used for interactive graph SR descriptions.
|
|
357
|
-
srGraphInstructions: "Use the Tab key to move through the interactive elements in the graph. When an interactive element has focus, use
|
|
358
|
-
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
|
|
357
|
+
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.",
|
|
358
|
+
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.",
|
|
359
359
|
xAxis: "X-axis",
|
|
360
360
|
yAxis: "Y-axis",
|
|
361
361
|
graphKeyboardPrompt: "Press Shift + Enter to interact with the graph",
|
|
@@ -30666,6 +30666,7 @@ function useDraggable(args) {
|
|
|
30666
30666
|
const {
|
|
30667
30667
|
direction: yDownDirection,
|
|
30668
30668
|
altKey,
|
|
30669
|
+
ctrlKey,
|
|
30669
30670
|
metaKey,
|
|
30670
30671
|
shiftKey
|
|
30671
30672
|
} = state;
|
|
@@ -30675,7 +30676,7 @@ function useDraggable(args) {
|
|
|
30675
30676
|
if (altKey || metaKey) {
|
|
30676
30677
|
divisions = 200;
|
|
30677
30678
|
}
|
|
30678
|
-
if (shiftKey) {
|
|
30679
|
+
if (shiftKey && !ctrlKey) {
|
|
30679
30680
|
divisions = 10;
|
|
30680
30681
|
}
|
|
30681
30682
|
const min = span / (divisions * 2);
|
|
@@ -31209,6 +31210,35 @@ const MovablePoint$1 = /*#__PURE__*/React__namespace.forwardRef((props, pointRef
|
|
|
31209
31210
|
return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, focusableHandle, visiblePoint);
|
|
31210
31211
|
});
|
|
31211
31212
|
|
|
31213
|
+
/**
|
|
31214
|
+
* If an element has an `aria-describedby` attribute, it needs to point to
|
|
31215
|
+
* a separate description element that contains the description for that
|
|
31216
|
+
* element.
|
|
31217
|
+
*
|
|
31218
|
+
* If the element is within an SVG, the description element must be a
|
|
31219
|
+
* `<span>` within a `<foreignObject>` in order for some browser/SR
|
|
31220
|
+
* combos to be able to access it.
|
|
31221
|
+
*
|
|
31222
|
+
* Use this SRDescInSVG component to create the <foreignObject>
|
|
31223
|
+
* and styling for this description element.
|
|
31224
|
+
*/
|
|
31225
|
+
function SRDescInSVG(props) {
|
|
31226
|
+
const {
|
|
31227
|
+
id,
|
|
31228
|
+
children
|
|
31229
|
+
} = props;
|
|
31230
|
+
return /*#__PURE__*/React__namespace.createElement("foreignObject", null, /*#__PURE__*/React__namespace.createElement("span", {
|
|
31231
|
+
id: id
|
|
31232
|
+
// Hidden visually
|
|
31233
|
+
,
|
|
31234
|
+
style: a11y.srOnly
|
|
31235
|
+
// Hidden from screen readers so they don't read this
|
|
31236
|
+
// again outside of the element that it describes.
|
|
31237
|
+
,
|
|
31238
|
+
"aria-hidden": true
|
|
31239
|
+
}, children));
|
|
31240
|
+
}
|
|
31241
|
+
|
|
31212
31242
|
const {
|
|
31213
31243
|
calculateAngleInDegrees: calculateAngleInDegrees$1,
|
|
31214
31244
|
getClockwiseAngle: getClockwiseAngle$2,
|
|
@@ -31316,9 +31346,8 @@ function AngleGraph(props) {
|
|
|
31316
31346
|
constrain: getAngleSideConstraint(coords[2], coords[1], snapDegrees || 1),
|
|
31317
31347
|
onMove: destination => dispatch(actions.angle.movePoint(2, destination)),
|
|
31318
31348
|
ariaLabel: srAngleStartingSide
|
|
31319
|
-
}), /*#__PURE__*/React__namespace.createElement(
|
|
31320
|
-
id: descriptionId
|
|
31321
|
-
style: a11y.srOnly
|
|
31349
|
+
}), /*#__PURE__*/React__namespace.createElement(SRDescInSVG, {
|
|
31350
|
+
id: descriptionId
|
|
31322
31351
|
}, srAngleGraphAriaDescription));
|
|
31323
31352
|
}
|
|
31324
31353
|
function getAngleGraphDescription(state, i18n) {
|
|
@@ -31607,12 +31636,10 @@ function CircleGraph(props) {
|
|
|
31607
31636
|
dispatch(actions.circle.moveRadiusPoint(newRadiusPoint));
|
|
31608
31637
|
},
|
|
31609
31638
|
constrain: getCircleKeyboardConstraint(center, radiusPoint, snapStep)
|
|
31610
|
-
}), /*#__PURE__*/React__namespace.createElement(
|
|
31611
|
-
id: radiusId
|
|
31612
|
-
|
|
31613
|
-
|
|
31614
|
-
id: outerPointsId,
|
|
31615
|
-
style: a11y.srOnly
|
|
31639
|
+
}), /*#__PURE__*/React__namespace.createElement(SRDescInSVG, {
|
|
31640
|
+
id: radiusId
|
|
31641
|
+
}, srCircleRadius), /*#__PURE__*/React__namespace.createElement(SRDescInSVG, {
|
|
31642
|
+
id: outerPointsId
|
|
31616
31643
|
}, srCircleOuterPoints));
|
|
31617
31644
|
}
|
|
31618
31645
|
function MovableCircle(props) {
|
|
@@ -31859,15 +31886,12 @@ const LinearGraph = (props, key) => {
|
|
|
31859
31886
|
end: true
|
|
31860
31887
|
},
|
|
31861
31888
|
onMovePoint: (endpointIndex, destination) => dispatch(actions.linear.movePoint(endpointIndex, destination))
|
|
31862
|
-
}), /*#__PURE__*/React__namespace.createElement(
|
|
31863
|
-
id: pointsDescriptionId
|
|
31864
|
-
|
|
31865
|
-
|
|
31866
|
-
|
|
31867
|
-
|
|
31868
|
-
}, interceptString), /*#__PURE__*/React__namespace.createElement("g", {
|
|
31869
|
-
id: slopeDescriptionId,
|
|
31870
|
-
style: a11y.srOnly
|
|
31889
|
+
}), /*#__PURE__*/React__namespace.createElement(SRDescInSVG, {
|
|
31890
|
+
id: pointsDescriptionId
|
|
31891
|
+
}, srLinearGraphPoints), /*#__PURE__*/React__namespace.createElement(SRDescInSVG, {
|
|
31892
|
+
id: interceptDescriptionId
|
|
31893
|
+
}, interceptString), /*#__PURE__*/React__namespace.createElement(SRDescInSVG, {
|
|
31894
|
+
id: slopeDescriptionId
|
|
31871
31895
|
}, slopeString));
|
|
31872
31896
|
};
|
|
31873
31897
|
function getLinearGraphDescription(state, i18n) {
|
|
@@ -32001,7 +32025,7 @@ const LinearSystemGraph = props => {
|
|
|
32001
32025
|
end: true
|
|
32002
32026
|
},
|
|
32003
32027
|
onMovePoint: (endpointIndex, destination) => dispatch(actions.linearSystem.movePointInFigure(i, endpointIndex, destination))
|
|
32004
|
-
})), linesAriaInfo.map(_ref2 => {
|
|
32028
|
+
})), linesAriaInfo.map((_ref2, i) => {
|
|
32005
32029
|
let {
|
|
32006
32030
|
pointsDescriptionId,
|
|
32007
32031
|
interceptDescriptionId,
|
|
@@ -32010,22 +32034,17 @@ const LinearSystemGraph = props => {
|
|
|
32010
32034
|
interceptDescription,
|
|
32011
32035
|
slopeDescription
|
|
32012
32036
|
} = _ref2;
|
|
32013
|
-
return /*#__PURE__*/React__namespace.createElement(
|
|
32014
|
-
key:
|
|
32015
|
-
|
|
32016
|
-
|
|
32017
|
-
}, pointsDescription), /*#__PURE__*/React__namespace.createElement(
|
|
32018
|
-
|
|
32019
|
-
|
|
32020
|
-
|
|
32021
|
-
}, interceptDescription), /*#__PURE__*/React__namespace.createElement("g", {
|
|
32022
|
-
key: slopeDescriptionId,
|
|
32023
|
-
id: slopeDescriptionId,
|
|
32024
|
-
style: a11y.srOnly
|
|
32037
|
+
return /*#__PURE__*/React__namespace.createElement("span", {
|
|
32038
|
+
key: `line-descriptions-${i}`
|
|
32039
|
+
}, /*#__PURE__*/React__namespace.createElement(SRDescInSVG, {
|
|
32040
|
+
id: pointsDescriptionId
|
|
32041
|
+
}, pointsDescription), /*#__PURE__*/React__namespace.createElement(SRDescInSVG, {
|
|
32042
|
+
id: interceptDescriptionId
|
|
32043
|
+
}, interceptDescription), /*#__PURE__*/React__namespace.createElement(SRDescInSVG, {
|
|
32044
|
+
id: slopeDescriptionId
|
|
32025
32045
|
}, slopeDescription));
|
|
32026
|
-
}), /*#__PURE__*/React__namespace.createElement(
|
|
32027
|
-
id: intersectionId
|
|
32028
|
-
style: a11y.srOnly
|
|
32046
|
+
}), /*#__PURE__*/React__namespace.createElement(SRDescInSVG, {
|
|
32047
|
+
id: intersectionId
|
|
32029
32048
|
}, intersectionDescription));
|
|
32030
32049
|
};
|
|
32031
32050
|
|
|
@@ -33627,23 +33646,21 @@ const LimitedPolygonGraph = statefulProps => {
|
|
|
33627
33646
|
// point is "polite".
|
|
33628
33647
|
setAriaLives(["off", ...newPointAriaLives]);
|
|
33629
33648
|
}
|
|
33630
|
-
}), angleDegree && /*#__PURE__*/React__namespace.createElement(
|
|
33649
|
+
}), angleDegree && /*#__PURE__*/React__namespace.createElement(SRDescInSVG, {
|
|
33631
33650
|
id: angleId
|
|
33632
33651
|
}, Number.isInteger(angleDegree) ? strings.srPolygonPointAngle({
|
|
33633
33652
|
angle: angleDegree
|
|
33634
33653
|
}) : strings.srPolygonPointAngleApprox({
|
|
33635
33654
|
angle: srFormatNumber(angleDegree, locale, 1)
|
|
33636
|
-
})), /*#__PURE__*/React__namespace.createElement(
|
|
33655
|
+
})), /*#__PURE__*/React__namespace.createElement(SRDescInSVG, {
|
|
33637
33656
|
id: side1Id
|
|
33638
|
-
}, getPolygonSideString(side1Length, point1Index, strings, locale)), /*#__PURE__*/React__namespace.createElement(
|
|
33657
|
+
}, getPolygonSideString(side1Length, point1Index, strings, locale)), /*#__PURE__*/React__namespace.createElement(SRDescInSVG, {
|
|
33639
33658
|
id: side2Id
|
|
33640
33659
|
}, getPolygonSideString(side2Length, point2Index, strings, locale)));
|
|
33641
|
-
}), /*#__PURE__*/React__namespace.createElement(
|
|
33642
|
-
id: polygonPointsNumId
|
|
33643
|
-
|
|
33644
|
-
|
|
33645
|
-
id: polygonPointsId,
|
|
33646
|
-
style: a11y.srOnly
|
|
33660
|
+
}), /*#__PURE__*/React__namespace.createElement(SRDescInSVG, {
|
|
33661
|
+
id: polygonPointsNumId
|
|
33662
|
+
}, srPolygonGraphPointsNum), srPolygonGraphPoints && /*#__PURE__*/React__namespace.createElement(SRDescInSVG, {
|
|
33663
|
+
id: polygonPointsId
|
|
33647
33664
|
}, srPolygonGraphPoints));
|
|
33648
33665
|
};
|
|
33649
33666
|
const UnlimitedPolygonGraph = statefulProps => {
|
|
@@ -33779,7 +33796,7 @@ const UnlimitedPolygonGraph = statefulProps => {
|
|
|
33779
33796
|
}
|
|
33780
33797
|
dispatch(actions.polygon.clickPoint(i));
|
|
33781
33798
|
}
|
|
33782
|
-
}), angleDegree && /*#__PURE__*/React__namespace.createElement(
|
|
33799
|
+
}), angleDegree && /*#__PURE__*/React__namespace.createElement(SRDescInSVG, {
|
|
33783
33800
|
id: angleId
|
|
33784
33801
|
}, Number.isInteger(angleDegree) ? strings.srPolygonPointAngle({
|
|
33785
33802
|
angle: angleDegree
|
|
@@ -33790,17 +33807,15 @@ const UnlimitedPolygonGraph = statefulProps => {
|
|
|
33790
33807
|
pointIndex,
|
|
33791
33808
|
sideLength
|
|
33792
33809
|
} = _ref2;
|
|
33793
|
-
return /*#__PURE__*/React__namespace.createElement(
|
|
33810
|
+
return /*#__PURE__*/React__namespace.createElement(SRDescInSVG, {
|
|
33794
33811
|
key: `${id}-point-${i}-side-${j}`,
|
|
33795
33812
|
id: `${id}-point-${i}-side-${j}`
|
|
33796
33813
|
}, getPolygonSideString(sideLength, pointIndex, strings, locale));
|
|
33797
33814
|
}));
|
|
33798
|
-
}), coords.length > 0 && /*#__PURE__*/React__namespace.createElement(
|
|
33799
|
-
id: polygonPointsNumId
|
|
33800
|
-
|
|
33801
|
-
|
|
33802
|
-
id: polygonPointsId,
|
|
33803
|
-
style: a11y.srOnly
|
|
33815
|
+
}), coords.length > 0 && /*#__PURE__*/React__namespace.createElement(SRDescInSVG, {
|
|
33816
|
+
id: polygonPointsNumId
|
|
33817
|
+
}, srPolygonGraphPointsNum), srPolygonGraphPoints && /*#__PURE__*/React__namespace.createElement(SRDescInSVG, {
|
|
33818
|
+
id: polygonPointsId
|
|
33804
33819
|
}, srPolygonGraphPoints));
|
|
33805
33820
|
};
|
|
33806
33821
|
function getLines(points) {
|
|
@@ -34054,15 +34069,12 @@ function QuadraticGraph(props) {
|
|
|
34054
34069
|
constrain: getQuadraticKeyboardConstraint(coords, snapStep, i),
|
|
34055
34070
|
onMove: destination => dispatch(actions.quadratic.movePoint(i, destination))
|
|
34056
34071
|
});
|
|
34057
|
-
}), srQuadraticDirection && /*#__PURE__*/React__namespace.createElement(
|
|
34058
|
-
id: quadraticDirectionId
|
|
34059
|
-
|
|
34060
|
-
|
|
34061
|
-
|
|
34062
|
-
|
|
34063
|
-
}, srQuadraticVertex), /*#__PURE__*/React__namespace.createElement("g", {
|
|
34064
|
-
id: quadraticInterceptsId,
|
|
34065
|
-
style: a11y.srOnly
|
|
34072
|
+
}), srQuadraticDirection && /*#__PURE__*/React__namespace.createElement(SRDescInSVG, {
|
|
34073
|
+
id: quadraticDirectionId
|
|
34074
|
+
}, srQuadraticDirection), srQuadraticVertex && /*#__PURE__*/React__namespace.createElement(SRDescInSVG, {
|
|
34075
|
+
id: quadraticVertexId
|
|
34076
|
+
}, srQuadraticVertex), /*#__PURE__*/React__namespace.createElement(SRDescInSVG, {
|
|
34077
|
+
id: quadraticInterceptsId
|
|
34066
34078
|
}, srQuadraticXIntercepts ? `${srQuadraticXIntercepts} ${srQuadraticYIntercept}` : `${srQuadraticYIntercept}`));
|
|
34067
34079
|
}
|
|
34068
34080
|
|
|
@@ -34250,9 +34262,8 @@ const RayGraph = props => {
|
|
|
34250
34262
|
start: false,
|
|
34251
34263
|
end: true
|
|
34252
34264
|
}
|
|
34253
|
-
}), /*#__PURE__*/React__namespace.createElement(
|
|
34254
|
-
id: pointsDescriptionId
|
|
34255
|
-
style: a11y.srOnly
|
|
34265
|
+
}), /*#__PURE__*/React__namespace.createElement(SRDescInSVG, {
|
|
34266
|
+
id: pointsDescriptionId
|
|
34256
34267
|
}, srRayPoints));
|
|
34257
34268
|
};
|
|
34258
34269
|
function getRayGraphDescription(state, i18n) {
|
|
@@ -34392,13 +34403,11 @@ const SegmentGraph = _ref => {
|
|
|
34392
34403
|
point2Y: srFormatNumber(segment[1][Y], locale)
|
|
34393
34404
|
})
|
|
34394
34405
|
}
|
|
34395
|
-
}), /*#__PURE__*/React__namespace.createElement(
|
|
34396
|
-
id: lengthDescriptionId
|
|
34397
|
-
style: a11y.srOnly
|
|
34406
|
+
}), /*#__PURE__*/React__namespace.createElement(SRDescInSVG, {
|
|
34407
|
+
id: lengthDescriptionId
|
|
34398
34408
|
}, strings.srSegmentLength({
|
|
34399
34409
|
length: srFormatNumber(getLengthOfSegment(segment), locale)
|
|
34400
|
-
})))), /*#__PURE__*/React__namespace.createElement(
|
|
34401
|
-
style: a11y.srOnly,
|
|
34410
|
+
})))), /*#__PURE__*/React__namespace.createElement(SRDescInSVG, {
|
|
34402
34411
|
id: wholeGraphDescriptionId
|
|
34403
34412
|
}, getWholeSegmentGraphAriaDescription()));
|
|
34404
34413
|
};
|
|
@@ -34500,7 +34509,7 @@ function SinusoidGraph(props) {
|
|
|
34500
34509
|
sequenceNumber: i + 1,
|
|
34501
34510
|
constrain: getSinusoidKeyboardConstraint(coords, snapStep, i),
|
|
34502
34511
|
onMove: destination => dispatch(actions.sinusoid.movePoint(i, destination))
|
|
34503
|
-
})), /*#__PURE__*/React__namespace.createElement(
|
|
34512
|
+
})), /*#__PURE__*/React__namespace.createElement(SRDescInSVG, {
|
|
34504
34513
|
id: descriptionId
|
|
34505
34514
|
}, srSinusoidDescription));
|
|
34506
34515
|
}
|
|
@@ -41983,7 +41992,7 @@ const addLibraryVersionToPerseusDebug = (libraryName, libraryVersion) => {
|
|
|
41983
41992
|
|
|
41984
41993
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
41985
41994
|
const libName = "@khanacademy/perseus";
|
|
41986
|
-
const libVersion = "57.0.
|
|
41995
|
+
const libVersion = "57.0.1";
|
|
41987
41996
|
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
41988
41997
|
|
|
41989
41998
|
const apiVersion = {
|