@khanacademy/perseus 49.0.3 → 49.1.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 +83 -7
- package/dist/es/index.js.map +1 -1
- package/dist/es/strings.js +35 -1
- package/dist/es/strings.js.map +1 -1
- package/dist/index.js +96 -7
- package/dist/index.js.map +1 -1
- package/dist/strings.d.ts +21 -0
- package/dist/strings.js +44 -1
- package/dist/strings.js.map +1 -1
- package/package.json +10 -10
package/dist/es/index.js
CHANGED
|
@@ -303,7 +303,28 @@ const mockStrings = {
|
|
|
303
303
|
xIntercept,
|
|
304
304
|
yIntercept
|
|
305
305
|
}) => `The line crosses the X-axis at ${xIntercept} comma 0 and the Y-axis at 0 comma ${yIntercept}.`,
|
|
306
|
-
srLinearGraphOriginIntercept: "The line crosses the x and y axes at the graph's origin."
|
|
306
|
+
srLinearGraphOriginIntercept: "The line crosses the x and y axes at the graph's origin.",
|
|
307
|
+
srAngleSideAtCoordinates: ({
|
|
308
|
+
point,
|
|
309
|
+
side,
|
|
310
|
+
x,
|
|
311
|
+
y
|
|
312
|
+
}) => `Point ${point}, ${side} at ${x} comma ${y}`,
|
|
313
|
+
srAngleVertexAtCoordinatesWithAngleMeasure: ({
|
|
314
|
+
x,
|
|
315
|
+
y,
|
|
316
|
+
angleMeasure
|
|
317
|
+
}) => `Point 2, vertex at ${x} comma ${y}. Angle ${angleMeasure} degrees`,
|
|
318
|
+
srAngleGraphAriaLabel: "An angle on a coordinate plane.",
|
|
319
|
+
srAngleGraphAriaDescription: ({
|
|
320
|
+
angleMeasure,
|
|
321
|
+
vertexX,
|
|
322
|
+
vertexY,
|
|
323
|
+
isX,
|
|
324
|
+
isY,
|
|
325
|
+
tsX,
|
|
326
|
+
tsY
|
|
327
|
+
}) => `The angle measure is ${angleMeasure} degrees with a vertex at ${vertexX} comma ${vertexY}, a point on the initial side at ${isX} comma ${isY} and a point on the terminal side at ${tsX} comma ${tsY}.`
|
|
307
328
|
// The above strings are used for interactive graph SR descriptions.
|
|
308
329
|
};
|
|
309
330
|
|
|
@@ -34065,23 +34086,78 @@ function AngleGraph(props) {
|
|
|
34065
34086
|
showAngles: showAngles || false // Whether to show the angle or not
|
|
34066
34087
|
};
|
|
34067
34088
|
|
|
34089
|
+
const {
|
|
34090
|
+
strings,
|
|
34091
|
+
locale
|
|
34092
|
+
} = usePerseusI18n();
|
|
34093
|
+
const angleMeasure = srFormatNumber(getClockwiseAngle([endPoints[0], centerPoint, endPoints[1]], allowReflexAngles), locale);
|
|
34094
|
+
const wholeAngleAriaLabel = strings.srAngleGraphAriaLabel;
|
|
34095
|
+
const wholeAngleDescription = strings.srAngleGraphAriaDescription({
|
|
34096
|
+
angleMeasure,
|
|
34097
|
+
vertexX: srFormatNumber(coords[1][X], locale),
|
|
34098
|
+
vertexY: srFormatNumber(coords[1][Y], locale),
|
|
34099
|
+
isX: srFormatNumber(coords[2][X], locale),
|
|
34100
|
+
isY: srFormatNumber(coords[2][Y], locale),
|
|
34101
|
+
tsX: srFormatNumber(coords[0][X], locale),
|
|
34102
|
+
tsY: srFormatNumber(coords[0][Y], locale)
|
|
34103
|
+
});
|
|
34104
|
+
const formatCoordinates = (x, y) => ({
|
|
34105
|
+
x: srFormatNumber(x, locale),
|
|
34106
|
+
y: srFormatNumber(y, locale)
|
|
34107
|
+
});
|
|
34108
|
+
const formatSideAriaLabel = (side, newPoint) => {
|
|
34109
|
+
const formattedCoordinates = formatCoordinates(newPoint[X], newPoint[Y]);
|
|
34110
|
+
const label = side === "terminal" ? strings.srAngleSideAtCoordinates(_extends({
|
|
34111
|
+
point: 1,
|
|
34112
|
+
side: "terminal side"
|
|
34113
|
+
}, formattedCoordinates)) : strings.srAngleSideAtCoordinates(_extends({
|
|
34114
|
+
point: 3,
|
|
34115
|
+
side: "initial side"
|
|
34116
|
+
}, formattedCoordinates));
|
|
34117
|
+
return label;
|
|
34118
|
+
};
|
|
34119
|
+
const formatVertexAriaLabel = newPoint => {
|
|
34120
|
+
const formattedVertexCoordinates = formatCoordinates(newPoint[X], newPoint[Y]);
|
|
34121
|
+
const label = showAngles ? strings.srAngleVertexAtCoordinatesWithAngleMeasure(_extends({}, formattedVertexCoordinates, {
|
|
34122
|
+
angleMeasure: angleMeasure
|
|
34123
|
+
})) : strings.srAngleSideAtCoordinates(_extends({
|
|
34124
|
+
point: 2,
|
|
34125
|
+
side: "vertex"
|
|
34126
|
+
}, formattedVertexCoordinates));
|
|
34127
|
+
return label;
|
|
34128
|
+
};
|
|
34129
|
+
const initialSideAriaLabel = formatSideAriaLabel("initial", coords[2]);
|
|
34130
|
+
const terminalSideAriaLabel = formatSideAriaLabel("terminal", coords[0]);
|
|
34131
|
+
const vertexAriaLabel = formatVertexAriaLabel(coords[1]);
|
|
34132
|
+
|
|
34068
34133
|
// Render the lines, angle, and then movable points
|
|
34069
|
-
return /*#__PURE__*/React.createElement(
|
|
34134
|
+
return /*#__PURE__*/React.createElement("g", {
|
|
34135
|
+
"aria-label": wholeAngleAriaLabel,
|
|
34136
|
+
"aria-describedby": "angle-description"
|
|
34137
|
+
}, svgLines, /*#__PURE__*/React.createElement(Angle, angleParams), /*#__PURE__*/React.createElement(MovablePoint$1, {
|
|
34070
34138
|
point: coords[1],
|
|
34071
34139
|
sequenceNumber: 1,
|
|
34072
34140
|
constrain: p => p,
|
|
34073
|
-
onMove: destination => dispatch(actions.angle.movePoint(1, destination))
|
|
34141
|
+
onMove: destination => dispatch(actions.angle.movePoint(1, destination)),
|
|
34142
|
+
ariaLabel: vertexAriaLabel
|
|
34074
34143
|
}), /*#__PURE__*/React.createElement(MovablePoint$1, {
|
|
34075
34144
|
point: coords[0],
|
|
34076
34145
|
sequenceNumber: 2,
|
|
34077
34146
|
constrain: getAngleSideConstraint(coords[0], coords[1], snapDegrees || 1),
|
|
34078
|
-
onMove: destination => dispatch(actions.angle.movePoint(0, destination))
|
|
34147
|
+
onMove: destination => dispatch(actions.angle.movePoint(0, destination)),
|
|
34148
|
+
ariaLabel: terminalSideAriaLabel
|
|
34079
34149
|
}), /*#__PURE__*/React.createElement(MovablePoint$1, {
|
|
34080
34150
|
point: coords[2],
|
|
34081
34151
|
sequenceNumber: 3,
|
|
34082
34152
|
constrain: getAngleSideConstraint(coords[2], coords[1], snapDegrees || 1),
|
|
34083
|
-
onMove: destination => dispatch(actions.angle.movePoint(2, destination))
|
|
34084
|
-
|
|
34153
|
+
onMove: destination => dispatch(actions.angle.movePoint(2, destination)),
|
|
34154
|
+
ariaLabel: initialSideAriaLabel
|
|
34155
|
+
}), /*#__PURE__*/React.createElement("g", {
|
|
34156
|
+
id: "angle-description",
|
|
34157
|
+
style: {
|
|
34158
|
+
display: "hidden"
|
|
34159
|
+
}
|
|
34160
|
+
}, wholeAngleDescription));
|
|
34085
34161
|
}
|
|
34086
34162
|
const positiveX = [1, 0];
|
|
34087
34163
|
const negativeX = [-1, 0];
|
|
@@ -45431,7 +45507,7 @@ const init = function init() {
|
|
|
45431
45507
|
|
|
45432
45508
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
45433
45509
|
const libName = "@khanacademy/perseus";
|
|
45434
|
-
const libVersion = "49.
|
|
45510
|
+
const libVersion = "49.1.1";
|
|
45435
45511
|
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
45436
45512
|
|
|
45437
45513
|
const apiVersion = {
|