@khanacademy/perseus 12.3.0 → 12.4.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/CHANGELOG.md +19 -0
- package/dist/es/index.css +3 -3
- package/dist/es/index.js +52 -15
- package/dist/es/index.js.map +1 -1
- package/dist/index.css +3 -3
- package/dist/index.js +56 -16
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
- package/src/__tests__/widget-container.test.tsx +126 -0
- package/src/error-boundary.tsx +1 -0
- package/src/styles/articles.less +3 -1
- package/src/styles/perseus-renderer.less +1 -1
- package/src/widget-container.tsx +2 -1
- package/src/widgets/__tests__/__snapshots__/graded-group-set.test.ts.snap +50 -19
- package/src/widgets/graded-group-set.tsx +70 -25
- package/tsconfig-build.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @khanacademy/perseus
|
|
2
2
|
|
|
3
|
+
## 12.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#784](https://github.com/Khan/perseus/pull/784) [`cfff6ad1`](https://github.com/Khan/perseus/commit/cfff6ad16a3923418a3c75816af7c99689b94da4) Thanks [@nedredmond](https://github.com/nedredmond)! - Graded Group Set indicator dots now have a 24x24 clickable area as well as hover/focus states. Stretching issue on mobile resolved as well.
|
|
8
|
+
|
|
9
|
+
* [#783](https://github.com/Khan/perseus/pull/783) [`79403e06`](https://github.com/Khan/perseus/commit/79403e06eedb597d7818d6c858bbba6f51ff3fe1) Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Adds 'widgetId' to the 'perseus:widget-rendering-error' analytics event.
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [[`79403e06`](https://github.com/Khan/perseus/commit/79403e06eedb597d7818d6c858bbba6f51ff3fe1), [`ed00ee59`](https://github.com/Khan/perseus/commit/ed00ee59dcdeb20a66709c6b7d3474da55d58e4d)]:
|
|
14
|
+
- @khanacademy/perseus-core@1.3.0
|
|
15
|
+
- @khanacademy/math-input@14.2.2
|
|
16
|
+
- @khanacademy/kas@0.3.5
|
|
17
|
+
- @khanacademy/kmath@0.1.6
|
|
18
|
+
- @khanacademy/perseus-linter@0.3.8
|
|
19
|
+
- @khanacademy/pure-markdown@0.2.10
|
|
20
|
+
- @khanacademy/simple-markdown@0.10.4
|
|
21
|
+
|
|
3
22
|
## 12.3.0
|
|
4
23
|
|
|
5
24
|
### Minor Changes
|
package/dist/es/index.css
CHANGED
|
@@ -1742,11 +1742,11 @@ body.mobile ul.inequalities-one-line-radios > li {
|
|
|
1742
1742
|
.framework-perseus.perseus-mobile .clearfix > .perseus-renderer {
|
|
1743
1743
|
margin-bottom: 32px;
|
|
1744
1744
|
}
|
|
1745
|
-
.framework-perseus.perseus-mobile .perseus-renderer > .paragraph ul:not(.perseus-widget-radio) {
|
|
1745
|
+
.framework-perseus.perseus-mobile .perseus-renderer > .paragraph ul:not(.perseus-widget-radio, .indicatorContainer) {
|
|
1746
1746
|
margin: 0 0 0 1em;
|
|
1747
1747
|
padding: 0;
|
|
1748
1748
|
}
|
|
1749
|
-
.framework-perseus.perseus-mobile .perseus-renderer > .paragraph ul:not(.perseus-widget-radio) > li {
|
|
1749
|
+
.framework-perseus.perseus-mobile .perseus-renderer > .paragraph ul:not(.perseus-widget-radio, .indicatorContainer) > li {
|
|
1750
1750
|
padding-left: 10px;
|
|
1751
1751
|
margin-bottom: 24px;
|
|
1752
1752
|
}
|
|
@@ -2394,7 +2394,7 @@ img.zoom-img {
|
|
|
2394
2394
|
.framework-perseus .perseus-renderer > .paragraph > ol {
|
|
2395
2395
|
margin: -11px 0px 22px 0px;
|
|
2396
2396
|
}
|
|
2397
|
-
.framework-perseus .paragraph ul:not(.perseus-widget-radio) {
|
|
2397
|
+
.framework-perseus .paragraph ul:not(.perseus-widget-radio, .indicatorContainer) {
|
|
2398
2398
|
padding-left: 35px;
|
|
2399
2399
|
list-style-type: disc;
|
|
2400
2400
|
}
|
package/dist/es/index.js
CHANGED
|
@@ -17349,9 +17349,11 @@ class ErrorBoundary extends React.Component {
|
|
|
17349
17349
|
};
|
|
17350
17350
|
}
|
|
17351
17351
|
componentDidCatch(error, info) {
|
|
17352
|
+
var _this$props$onError, _this$props;
|
|
17352
17353
|
this.setState({
|
|
17353
17354
|
error: error.toString()
|
|
17354
17355
|
});
|
|
17356
|
+
(_this$props$onError = (_this$props = this.props).onError) == null ? void 0 : _this$props$onError.call(_this$props, error, info);
|
|
17355
17357
|
Log.error("Perseus error boundary caught error", Errors.Internal, {
|
|
17356
17358
|
cause: error,
|
|
17357
17359
|
loggedMetadata: _extends({
|
|
@@ -18807,11 +18809,12 @@ class WidgetContainer extends React.Component {
|
|
|
18807
18809
|
widget_type: type,
|
|
18808
18810
|
widget_id: this.props.id
|
|
18809
18811
|
},
|
|
18810
|
-
onError:
|
|
18812
|
+
onError: () => {
|
|
18811
18813
|
analytics.onAnalyticsEvent({
|
|
18812
18814
|
type: "perseus:widget-rendering-error",
|
|
18813
18815
|
payload: {
|
|
18814
|
-
widgetType: type
|
|
18816
|
+
widgetType: type,
|
|
18817
|
+
widgetId: this.props.id
|
|
18815
18818
|
}
|
|
18816
18819
|
});
|
|
18817
18820
|
}
|
|
@@ -24905,22 +24908,33 @@ class Indicators extends React.Component {
|
|
|
24905
24908
|
}
|
|
24906
24909
|
render() {
|
|
24907
24910
|
return /*#__PURE__*/React.createElement("ul", {
|
|
24908
|
-
|
|
24911
|
+
// reduntantly add class name for use in .less files--
|
|
24912
|
+
// the styles object key gets hashed
|
|
24913
|
+
className: classNames(css(styles$j.indicatorContainer), "indicatorContainer")
|
|
24909
24914
|
}, this.props.gradedGroups.map(({
|
|
24910
24915
|
title
|
|
24911
24916
|
}, i) => /*#__PURE__*/React.createElement("li", {
|
|
24917
|
+
className: css(styles$j.indicator),
|
|
24918
|
+
key: title
|
|
24919
|
+
}, /*#__PURE__*/React.createElement(Clickable, {
|
|
24912
24920
|
role: "button",
|
|
24913
24921
|
"aria-label": i18n._("Skip to %(title)s", {
|
|
24914
24922
|
title
|
|
24915
24923
|
}),
|
|
24916
|
-
|
|
24917
|
-
className: css(styles$j.indicator, i === this.props.currentGroup && styles$j.selectedIndicator),
|
|
24918
|
-
tabIndex: 0,
|
|
24924
|
+
style: styles$j.indicatorButton,
|
|
24919
24925
|
onClick: () => this.props.onChangeCurrentGroup(i),
|
|
24920
24926
|
onKeyDown: e => this.handleKeyDown(e, i)
|
|
24921
|
-
},
|
|
24927
|
+
}, ({
|
|
24928
|
+
hovered,
|
|
24929
|
+
focused,
|
|
24930
|
+
pressed
|
|
24931
|
+
}) => /*#__PURE__*/React.createElement(View, {
|
|
24932
|
+
style: [styles$j.indicatorDot, (hovered || focused || pressed) && styles$j.indicatorDotFocused]
|
|
24933
|
+
}, i === this.props.currentGroup && /*#__PURE__*/React.createElement(View, {
|
|
24934
|
+
style: styles$j.indicatorDotActive
|
|
24935
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
24922
24936
|
className: css(a11y.srOnly)
|
|
24923
|
-
}, i18n._("Current")))));
|
|
24937
|
+
}, i18n._("Current"))))))));
|
|
24924
24938
|
}
|
|
24925
24939
|
}
|
|
24926
24940
|
// TODO(jared): find a better name for this :) and for GradedGroup; the names
|
|
@@ -25068,19 +25082,42 @@ const styles$j = StyleSheet.create({
|
|
|
25068
25082
|
display: "flex",
|
|
25069
25083
|
flexDirection: "row",
|
|
25070
25084
|
listStyle: "none",
|
|
25071
|
-
margin: "unset"
|
|
25085
|
+
margin: "unset",
|
|
25086
|
+
paddingInlineStart: "unset",
|
|
25087
|
+
flexWrap: "wrap"
|
|
25072
25088
|
},
|
|
25073
25089
|
indicator: {
|
|
25090
|
+
width: 24,
|
|
25091
|
+
height: 24
|
|
25092
|
+
},
|
|
25093
|
+
indicatorButton: {
|
|
25094
|
+
width: "100%",
|
|
25095
|
+
height: "100%",
|
|
25096
|
+
display: "flex",
|
|
25097
|
+
flexWrap: "wrap",
|
|
25098
|
+
placeContent: "center",
|
|
25099
|
+
cursor: "pointer",
|
|
25100
|
+
":focus": {
|
|
25101
|
+
outline: "none"
|
|
25102
|
+
}
|
|
25103
|
+
},
|
|
25104
|
+
indicatorDot: {
|
|
25105
|
+
boxSizing: "content-box",
|
|
25074
25106
|
width: 10,
|
|
25075
25107
|
height: 10,
|
|
25076
25108
|
borderRadius: "100%",
|
|
25077
|
-
|
|
25109
|
+
borderWidth: 2,
|
|
25078
25110
|
borderColor: Color.blue,
|
|
25079
|
-
|
|
25080
|
-
|
|
25111
|
+
borderStyle: "solid"
|
|
25112
|
+
},
|
|
25113
|
+
indicatorDotFocused: {
|
|
25114
|
+
borderWidth: 5,
|
|
25115
|
+
borderStyle: "double"
|
|
25081
25116
|
},
|
|
25082
|
-
|
|
25083
|
-
backgroundColor: Color.blue
|
|
25117
|
+
indicatorDotActive: {
|
|
25118
|
+
backgroundColor: Color.blue,
|
|
25119
|
+
width: "100%",
|
|
25120
|
+
height: "100%"
|
|
25084
25121
|
},
|
|
25085
25122
|
container: {
|
|
25086
25123
|
borderTop: `1px solid ${gray76}`,
|
|
@@ -43768,7 +43805,7 @@ const init = function init(options) {
|
|
|
43768
43805
|
|
|
43769
43806
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
43770
43807
|
const libName = "@khanacademy/perseus";
|
|
43771
|
-
const libVersion = "12.
|
|
43808
|
+
const libVersion = "12.4.0";
|
|
43772
43809
|
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
43773
43810
|
|
|
43774
43811
|
const apiVersion = {
|