@khanacademy/perseus 13.1.0 → 14.0.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 +43 -0
- package/dist/components/svg-image.d.ts +10 -9
- package/dist/es/index.css +0 -7
- package/dist/es/index.js +37 -31
- package/dist/es/index.js.map +1 -1
- package/dist/index.css +0 -7
- package/dist/index.js +61 -49
- package/dist/index.js.map +1 -1
- package/dist/renderer.d.ts +2 -2
- package/dist/widgets/matcher.d.ts +1 -1
- package/package.json +35 -35
- package/src/__stories__/hints-renderer.stories.tsx +41 -44
- package/src/__tests__/__snapshots__/renderer.test.tsx.snap +9 -33
- package/src/__tests__/article-renderer.test.tsx +2 -3
- package/src/__tests__/renderer-api.test.tsx +35 -52
- package/src/components/graph.tsx +14 -8
- package/src/components/svg-image.tsx +13 -11
- package/src/mixins/provide-keypad.tsx +0 -1
- package/src/perseus-types.ts +8 -3
- package/src/renderer.tsx +2 -2
- package/src/styles/khan-exercise.css +0 -2
- package/src/styles/perseus-renderer.less +0 -7
- package/src/widgets/__stories__/random-widgets.stories.tsx +59 -0
- package/src/widgets/__stories__/test-keypad-context-wrapper.tsx +0 -1
- package/src/widgets/__testdata__/categorizer.testdata.ts +40 -0
- package/src/widgets/__testdata__/dropdown.testdata.ts +38 -0
- package/src/widgets/__testdata__/explanation.testdata.ts +30 -0
- package/src/widgets/__testdata__/expression.testdata.ts +82 -0
- package/src/widgets/__testdata__/interactive-graph-random.testdata.ts +269 -0
- package/src/widgets/__testdata__/radio.testdata.ts +63 -0
- package/src/widgets/__testdata__/randomizers.ts +51 -0
- package/src/widgets/__tests__/__snapshots__/dropdown.test.ts.snap +6 -22
- package/src/widgets/__tests__/__snapshots__/graded-group-set-jipt.test.ts.snap +3 -3
- package/src/widgets/__tests__/__snapshots__/graded-group-set.test.ts.snap +1 -1
- package/src/widgets/__tests__/__snapshots__/graded-group.test.ts.snap +1 -1
- package/src/widgets/__tests__/__snapshots__/radio.test.ts.snap +4 -4
- package/src/widgets/__tests__/expression-mobile.test.tsx +0 -1
- package/src/widgets/__tests__/matcher.test.tsx +1 -1
- package/src/widgets/__tests__/randomizers.test.ts +53 -0
- package/src/widgets/image.tsx +27 -20
- package/src/widgets/matcher.tsx +1 -1
- package/src/widgets/radio/choice.tsx +1 -0
- package/tsconfig-build.tsbuildinfo +1 -1
package/dist/index.css
CHANGED
|
@@ -130,8 +130,6 @@ div.definition {
|
|
|
130
130
|
|
|
131
131
|
#problemarea {
|
|
132
132
|
font-size: 14px;
|
|
133
|
-
width: 70%;
|
|
134
|
-
min-height: 378px;
|
|
135
133
|
position: relative;
|
|
136
134
|
float: left;
|
|
137
135
|
padding-bottom: 38px;
|
|
@@ -2366,11 +2364,6 @@ img.zoom-img {
|
|
|
2366
2364
|
.framework-perseus.perseus-mobile .perseus-input-right-align .keypad-input {
|
|
2367
2365
|
text-align: right;
|
|
2368
2366
|
}
|
|
2369
|
-
.framework-perseus #problemarea input,
|
|
2370
|
-
.framework-perseus #problemarea button {
|
|
2371
|
-
position: relative;
|
|
2372
|
-
z-index: 3;
|
|
2373
|
-
}
|
|
2374
2367
|
.framework-perseus div.paragraph {
|
|
2375
2368
|
font-family: "Lato", sans-serif;
|
|
2376
2369
|
font-weight: 400;
|
package/dist/index.js
CHANGED
|
@@ -16561,7 +16561,7 @@ const doJSONP = function (url, options) {
|
|
|
16561
16561
|
// system (with file://). We replace urls that start with `web+graphie`
|
|
16562
16562
|
// in the perseus json with this `file+graphie` prefix to indicate that
|
|
16563
16563
|
// they should have the `file://` protocol instead of `https://`.
|
|
16564
|
-
const svgLocalLabelsRegex = /^file\+graphie
|
|
16564
|
+
const svgLocalLabelsRegex = /^file\+graphie:/;
|
|
16565
16565
|
const hashRegex = /\/([^/]+)$/;
|
|
16566
16566
|
function isImageProbablyPhotograph(imageUrl) {
|
|
16567
16567
|
// TODO(david): Do an inventory to refine this heuristic. For example, what
|
|
@@ -23001,6 +23001,7 @@ const styles$r = aphrodite.StyleSheet.create({
|
|
|
23001
23001
|
padding: intermediateCheckboxPadding,
|
|
23002
23002
|
paddingTop: 0,
|
|
23003
23003
|
marginLeft: 54,
|
|
23004
|
+
color: Color__default["default"].offBlack64,
|
|
23004
23005
|
[mediaQueries.smOrSmaller]: {
|
|
23005
23006
|
padding: intermediateCheckboxPaddingPhone,
|
|
23006
23007
|
paddingTop: 0
|
|
@@ -26856,43 +26857,50 @@ class ImageWidget extends React__namespace.Component {
|
|
|
26856
26857
|
} = this.props;
|
|
26857
26858
|
const backgroundImage = this.props.backgroundImage;
|
|
26858
26859
|
if (backgroundImage.url) {
|
|
26859
|
-
|
|
26860
|
-
|
|
26861
|
-
|
|
26862
|
-
|
|
26863
|
-
|
|
26864
|
-
|
|
26865
|
-
|
|
26866
|
-
|
|
26867
|
-
|
|
26868
|
-
|
|
26869
|
-
|
|
26870
|
-
|
|
26871
|
-
|
|
26872
|
-
|
|
26873
|
-
|
|
26874
|
-
|
|
26875
|
-
|
|
26876
|
-
|
|
26877
|
-
|
|
26878
|
-
|
|
26879
|
-
|
|
26880
|
-
|
|
26881
|
-
|
|
26882
|
-
|
|
26883
|
-
|
|
26884
|
-
|
|
26885
|
-
|
|
26886
|
-
|
|
26887
|
-
|
|
26888
|
-
|
|
26889
|
-
|
|
26890
|
-
|
|
26891
|
-
|
|
26892
|
-
|
|
26893
|
-
|
|
26894
|
-
|
|
26895
|
-
|
|
26860
|
+
const url = backgroundImage.url;
|
|
26861
|
+
image = /*#__PURE__*/React__namespace.createElement(context$1.Consumer, null, _ref => {
|
|
26862
|
+
let {
|
|
26863
|
+
setAssetStatus
|
|
26864
|
+
} = _ref;
|
|
26865
|
+
return /*#__PURE__*/React__namespace.createElement(SvgImage, {
|
|
26866
|
+
src: url,
|
|
26867
|
+
alt:
|
|
26868
|
+
/* alt text is formatted in a sr-only
|
|
26869
|
+
div next to the image in addition to
|
|
26870
|
+
the alt attribute.
|
|
26871
|
+
If there is no alt text at all,
|
|
26872
|
+
we don't put an alt attribute on
|
|
26873
|
+
the image, so that screen readers
|
|
26874
|
+
know there's something they can't
|
|
26875
|
+
read there :(.
|
|
26876
|
+
NOTE: React <=0.13 (maybe later)
|
|
26877
|
+
has a bug where it won't ever
|
|
26878
|
+
remove an attribute, so if this
|
|
26879
|
+
alt node is ever defined it's
|
|
26880
|
+
not removed. This is sort of
|
|
26881
|
+
dangerous, but we usually re-key
|
|
26882
|
+
new renderers so that they're
|
|
26883
|
+
rendered from scratch anyways,
|
|
26884
|
+
so this shouldn't be a problem
|
|
26885
|
+
in practice right now, although
|
|
26886
|
+
it will exhibit weird behaviour
|
|
26887
|
+
while editing. */
|
|
26888
|
+
this.props.alt,
|
|
26889
|
+
overrideAriaHidden: true,
|
|
26890
|
+
width: backgroundImage.width,
|
|
26891
|
+
height: backgroundImage.height,
|
|
26892
|
+
preloader: apiOptions.imagePreloader,
|
|
26893
|
+
extraGraphie: {
|
|
26894
|
+
box: this.props.box,
|
|
26895
|
+
range: this.props.range,
|
|
26896
|
+
labels: this.props.labels
|
|
26897
|
+
},
|
|
26898
|
+
trackInteraction: this.props.trackInteraction,
|
|
26899
|
+
zoomToFullSizeOnMobile: apiOptions.isMobile,
|
|
26900
|
+
constrainHeight: apiOptions.isMobile,
|
|
26901
|
+
allowFullBleed: apiOptions.isMobile,
|
|
26902
|
+
setAssetStatus: setAssetStatus
|
|
26903
|
+
});
|
|
26896
26904
|
});
|
|
26897
26905
|
}
|
|
26898
26906
|
if (this.props.alt) {
|
|
@@ -27895,15 +27903,20 @@ class Graph extends React__namespace.Component {
|
|
|
27895
27903
|
const imageData = this.props.backgroundImage;
|
|
27896
27904
|
if (imageData.url) {
|
|
27897
27905
|
const scale = this.props.box[0] / interactiveSizes$1.defaultBoxSize;
|
|
27898
|
-
image =
|
|
27899
|
-
|
|
27900
|
-
|
|
27901
|
-
|
|
27902
|
-
|
|
27903
|
-
width:
|
|
27904
|
-
|
|
27905
|
-
|
|
27906
|
-
|
|
27906
|
+
image = /*#__PURE__*/React__namespace.createElement(context$1.Consumer, null, _ref => {
|
|
27907
|
+
let {
|
|
27908
|
+
setAssetStatus
|
|
27909
|
+
} = _ref;
|
|
27910
|
+
return /*#__PURE__*/React__namespace.createElement(SvgImage
|
|
27911
|
+
// @ts-expect-error - TS2741 - Property 'alt' is missing in type '{ src: any; width: any; height: any; scale: number; responsive: false; }' but required in type 'Pick<Readonly<Props> & Readonly<{ children?: ReactNode; }>, "children" | "height" | "width" | "title" | "alt" | "trackInteraction" | "preloader" | "allowFullBleed" | "extraGraphie" | "overrideAriaHidden">'.
|
|
27912
|
+
, {
|
|
27913
|
+
src: imageData.url,
|
|
27914
|
+
width: imageData.width,
|
|
27915
|
+
height: imageData.height,
|
|
27916
|
+
scale: scale,
|
|
27917
|
+
responsive: false,
|
|
27918
|
+
setAssetStatus: setAssetStatus
|
|
27919
|
+
});
|
|
27907
27920
|
});
|
|
27908
27921
|
} else {
|
|
27909
27922
|
image = null;
|
|
@@ -44208,7 +44221,7 @@ const init = function (options) {
|
|
|
44208
44221
|
|
|
44209
44222
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
44210
44223
|
const libName = "@khanacademy/perseus";
|
|
44211
|
-
const libVersion = "
|
|
44224
|
+
const libVersion = "14.0.0";
|
|
44212
44225
|
perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
44213
44226
|
|
|
44214
44227
|
const apiVersion = {
|
|
@@ -44763,7 +44776,6 @@ const ProvideKeypad = {
|
|
|
44763
44776
|
// @ts-expect-error - TS2339 - Property 'props' does not exist on type '{ readonly propTypes: { readonly apiOptions: React.PropType<{ customKeypad?: boolean | undefined; nativeKeypadProxy?: ((...a: readonly any[]) => unknown) | undefined; }>; readonly keypadStyle: Requireable<any>; }; readonly getInitialState: () => { ...; }; readonly componentDidMount: () => void; readonly componentWil...'.
|
|
44764
44777
|
,
|
|
44765
44778
|
style: _this.props.keypadStyle,
|
|
44766
|
-
useV2Keypad: apiOptions.useV2Keypad,
|
|
44767
44779
|
onAnalyticsEvent: async () => {
|
|
44768
44780
|
// Intentionally left empty. This component is
|
|
44769
44781
|
// deprecated and so we don't want/need to instrument
|