@khanacademy/perseus 13.2.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/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
@@ -26857,43 +26857,50 @@ class ImageWidget extends React__namespace.Component {
26857
26857
  } = this.props;
26858
26858
  const backgroundImage = this.props.backgroundImage;
26859
26859
  if (backgroundImage.url) {
26860
- image = /*#__PURE__*/React__namespace.createElement(SvgImage, {
26861
- src: backgroundImage.url,
26862
- alt:
26863
- /* alt text is formatted in a sr-only
26864
- div next to the image in addition to
26865
- the alt attribute.
26866
- If there is no alt text at all,
26867
- we don't put an alt attribute on
26868
- the image, so that screen readers
26869
- know there's something they can't
26870
- read there :(.
26871
- NOTE: React <=0.13 (maybe later)
26872
- has a bug where it won't ever
26873
- remove an attribute, so if this
26874
- alt node is ever defined it's
26875
- not removed. This is sort of
26876
- dangerous, but we usually re-key
26877
- new renderers so that they're
26878
- rendered from scratch anyways,
26879
- so this shouldn't be a problem
26880
- in practice right now, although
26881
- it will exhibit weird behaviour
26882
- while editing. */
26883
- this.props.alt,
26884
- overrideAriaHidden: true,
26885
- width: backgroundImage.width,
26886
- height: backgroundImage.height,
26887
- preloader: apiOptions.imagePreloader,
26888
- extraGraphie: {
26889
- box: this.props.box,
26890
- range: this.props.range,
26891
- labels: this.props.labels
26892
- },
26893
- trackInteraction: this.props.trackInteraction,
26894
- zoomToFullSizeOnMobile: apiOptions.isMobile,
26895
- constrainHeight: apiOptions.isMobile,
26896
- allowFullBleed: apiOptions.isMobile
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
+ });
26897
26904
  });
26898
26905
  }
26899
26906
  if (this.props.alt) {
@@ -27896,15 +27903,20 @@ class Graph extends React__namespace.Component {
27896
27903
  const imageData = this.props.backgroundImage;
27897
27904
  if (imageData.url) {
27898
27905
  const scale = this.props.box[0] / interactiveSizes$1.defaultBoxSize;
27899
- image =
27900
- /*#__PURE__*/
27901
- // @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">'.
27902
- React__namespace.createElement(SvgImage, {
27903
- src: imageData.url,
27904
- width: imageData.width,
27905
- height: imageData.height,
27906
- scale: scale,
27907
- responsive: false
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
+ });
27908
27920
  });
27909
27921
  } else {
27910
27922
  image = null;
@@ -44209,7 +44221,7 @@ const init = function (options) {
44209
44221
 
44210
44222
  // This file is processed by a Rollup plugin (replace) to inject the production
44211
44223
  const libName = "@khanacademy/perseus";
44212
- const libVersion = "13.2.0";
44224
+ const libVersion = "14.0.0";
44213
44225
  perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
44214
44226
 
44215
44227
  const apiVersion = {
@@ -44764,7 +44776,6 @@ const ProvideKeypad = {
44764
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...'.
44765
44777
  ,
44766
44778
  style: _this.props.keypadStyle,
44767
- useV2Keypad: apiOptions.useV2Keypad,
44768
44779
  onAnalyticsEvent: async () => {
44769
44780
  // Intentionally left empty. This component is
44770
44781
  // deprecated and so we don't want/need to instrument