@khanacademy/perseus-editor 11.6.0 → 12.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.d.ts CHANGED
@@ -8,7 +8,6 @@ export { default as StructuredItemDiff } from "./diffs/structured-item-diff";
8
8
  export { default as EditorPage } from "./editor-page";
9
9
  export { default as Editor } from "./editor";
10
10
  export { default as i18n } from "./i18n";
11
- export { default as ContentPreview } from "./content-preview";
12
11
  export { default as IframeContentRenderer } from "./iframe-content-renderer";
13
12
  export { default as MultiRendererEditor } from "./multirenderer-editor";
14
13
  export { default as StatefulEditorPage } from "./stateful-editor-page";
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var perseusCore = require('@khanacademy/perseus-core');
6
6
  var perseus = require('@khanacademy/perseus');
7
- var React$1 = require('react');
7
+ var React = require('react');
8
8
  var _ = require('underscore');
9
9
  var createReactClass = require('create-react-class');
10
10
  var Clickable = require('@khanacademy/wonder-blocks-clickable');
@@ -18,14 +18,13 @@ var wonderBlocksIcon = require('@khanacademy/wonder-blocks-icon');
18
18
  var caretRight = require('@phosphor-icons/core/bold/caret-right-bold.svg');
19
19
  var classNames = require('classnames');
20
20
  var wonderBlocksForm = require('@khanacademy/wonder-blocks-form');
21
- var keypadContext = require('@khanacademy/keypad-context');
22
- var mathInput = require('@khanacademy/math-input');
23
21
  var ReactDOM = require('react-dom');
24
22
  var kmath = require('@khanacademy/kmath');
25
23
  var KAS = require('@khanacademy/kas');
26
24
  var Button = require('@khanacademy/wonder-blocks-button');
27
25
  var wonderBlocksTypography = require('@khanacademy/wonder-blocks-typography');
28
26
  var wonderStuffCore = require('@khanacademy/wonder-stuff-core');
27
+ var mathInput = require('@khanacademy/math-input');
29
28
  var wonderBlocksDropdown = require('@khanacademy/wonder-blocks-dropdown');
30
29
  var wonderBlocksAccordion = require('@khanacademy/wonder-blocks-accordion');
31
30
  var IconButton = require('@khanacademy/wonder-blocks-icon-button');
@@ -63,7 +62,7 @@ function _interopNamespace(e) {
63
62
  return Object.freeze(n);
64
63
  }
65
64
 
66
- var React__namespace = /*#__PURE__*/_interopNamespace(React$1);
65
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
67
66
  var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
68
67
  var createReactClass__default = /*#__PURE__*/_interopDefaultLegacy(createReactClass);
69
68
  var Clickable__default = /*#__PURE__*/_interopDefaultLegacy(Clickable);
@@ -92,7 +91,7 @@ var arrowCounterClockwise__default = /*#__PURE__*/_interopDefaultLegacy(arrowCou
92
91
 
93
92
  // This file is processed by a Rollup plugin (replace) to inject the production
94
93
  const libName = "@khanacademy/perseus-editor";
95
- const libVersion = "11.6.0";
94
+ const libVersion = "12.0.0";
96
95
  perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
97
96
 
98
97
  function _extends() {
@@ -287,13 +286,13 @@ class SectionControlButton extends React__namespace.Component {
287
286
  role: "button",
288
287
  hideDefaultFocusRing: true,
289
288
  "aria-label": title,
290
- style: styles$T.button
289
+ style: styles$S.button
291
290
  }, _ref => {
292
291
  return /*#__PURE__*/React__namespace.createElement(InlineIcon$a, icon);
293
292
  });
294
293
  }
295
294
  }
296
- const styles$T = aphrodite.StyleSheet.create({
295
+ const styles$S = aphrodite.StyleSheet.create({
297
296
  button: {
298
297
  backgroundColor: wonderBlocksTokens.color.gold,
299
298
  margin: 2,
@@ -20674,11 +20673,11 @@ class Spring extends React__namespace.Component {
20674
20673
  } = this.props;
20675
20674
  return React__namespace.createElement(wonderBlocksCore.View, {
20676
20675
  "aria-hidden": "true",
20677
- style: [styles$S.grow, style]
20676
+ style: [styles$R.grow, style]
20678
20677
  });
20679
20678
  }
20680
20679
  }
20681
- const styles$S = aphrodite.StyleSheet.create({
20680
+ const styles$R = aphrodite.StyleSheet.create({
20682
20681
  grow: {
20683
20682
  flexGrow: 1
20684
20683
  }
@@ -20915,13 +20914,13 @@ class WidgetSelect extends React__namespace.Component {
20915
20914
  * that collapse a region.
20916
20915
  */
20917
20916
  function ToggleableCaret(props) {
20918
- const iconStyle = props.isExpanded ? styles$R.expanded : styles$R.collapsed;
20917
+ const iconStyle = props.isExpanded ? styles$Q.expanded : styles$Q.collapsed;
20919
20918
  return /*#__PURE__*/React__namespace.createElement(wonderBlocksIcon.PhosphorIcon, {
20920
20919
  icon: caretRight__default["default"],
20921
20920
  style: iconStyle
20922
20921
  });
20923
20922
  }
20924
- const styles$R = aphrodite.StyleSheet.create({
20923
+ const styles$Q = aphrodite.StyleSheet.create({
20925
20924
  collapsed: {
20926
20925
  transition: ".15s"
20927
20926
  },
@@ -20951,16 +20950,16 @@ class TexErrorView extends React__namespace.Component {
20951
20950
  showErrors
20952
20951
  } = this.state;
20953
20952
  return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
20954
- style: styles$Q.errorContainer
20953
+ style: styles$P.errorContainer
20955
20954
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
20956
- style: styles$Q.title,
20955
+ style: styles$P.title,
20957
20956
  onClick: this.handleToggleTexErrors
20958
20957
  }, /*#__PURE__*/React__namespace.createElement(ToggleableCaret, {
20959
20958
  isExpanded: showErrors
20960
20959
  }), "\xA0 TeX Errors (", errorList.length, ")"), showErrors && /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
20961
- style: styles$Q.errorExplanation
20960
+ style: styles$P.errorExplanation
20962
20961
  }, "If your math doesn't display correctly, these errors might help you troubleshoot. Message #content-kitchen for help."), showErrors && errorList.map((e, index) => /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
20963
- style: styles$Q.error,
20962
+ style: styles$P.error,
20964
20963
  key: index
20965
20964
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
20966
20965
  style: {
@@ -20969,7 +20968,7 @@ class TexErrorView extends React__namespace.Component {
20969
20968
  }, e.math), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, null, e.message))));
20970
20969
  }
20971
20970
  }
20972
- const styles$Q = aphrodite.StyleSheet.create({
20971
+ const styles$P = aphrodite.StyleSheet.create({
20973
20972
  title: {
20974
20973
  backgroundColor: "#eee",
20975
20974
  fontSize: "1.25em",
@@ -24046,7 +24045,7 @@ class ItemExtrasEditor extends React__namespace.Component {
24046
24045
  }
24047
24046
  }
24048
24047
  const ItemExtraCheckbox = props => /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
24049
- style: [styles$P.checkbox, props.indent ? styles$P.indented : undefined]
24048
+ style: [styles$O.checkbox, props.indent ? styles$O.indented : undefined]
24050
24049
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
24051
24050
  label: /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
24052
24051
  style: {
@@ -24056,7 +24055,7 @@ const ItemExtraCheckbox = props => /*#__PURE__*/React__namespace.createElement(w
24056
24055
  checked: props.checked,
24057
24056
  onChange: newCheckedState => props.onChange(newCheckedState)
24058
24057
  }));
24059
- const styles$P = aphrodite.StyleSheet.create({
24058
+ const styles$O = aphrodite.StyleSheet.create({
24060
24059
  indented: {
24061
24060
  marginInlineStart: wonderBlocksTokens.spacing.large_24
24062
24061
  }
@@ -24483,64 +24482,6 @@ var i18n = {
24483
24482
  findImagesInItemData: findImagesInItemData
24484
24483
  };
24485
24484
 
24486
- /**
24487
- * The `ContentPreview` component provides a simple preview system for Perseus
24488
- * Content. Due to how Persus styles are built, the preview styling matches the
24489
- * current device based on the viewport width (using `@media` queries for
24490
- * `min-width` and `max-width`).
24491
- *
24492
- * The preview will render the mobile variant (styling and layout) when the
24493
- * `previewDevice` is phone or tablet. Note that the styling cannot be matched
24494
- * 100% due to the above `@media` query limitation.
24495
- */
24496
- function ContentPreview(_ref) {
24497
- let {
24498
- question,
24499
- apiOptions,
24500
- seamless,
24501
- linterContext,
24502
- legacyPerseusLint,
24503
- previewDevice,
24504
- strings
24505
- } = _ref;
24506
- const isMobile = previewDevice !== "desktop";
24507
- const className = isMobile ? "perseus-mobile" : "";
24508
- return /*#__PURE__*/React.createElement(wonderBlocksCore.View, {
24509
- className: `framework-perseus ${className}`,
24510
- style: [styles$O.container, !seamless ? styles$O.gutter : undefined]
24511
- }, /*#__PURE__*/React.createElement(keypadContext.StatefulKeypadContextProvider, null, /*#__PURE__*/React.createElement(keypadContext.KeypadContext.Consumer, null, _ref2 => {
24512
- let {
24513
- setKeypadActive,
24514
- keypadElement,
24515
- setKeypadElement
24516
- } = _ref2;
24517
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(perseus.Renderer, _extends({
24518
- strings: strings,
24519
- apiOptions: {
24520
- ...apiOptions,
24521
- isMobile
24522
- },
24523
- keypadElement: keypadElement,
24524
- linterContext: linterContext,
24525
- legacyPerseusLint: legacyPerseusLint
24526
- }, question)), /*#__PURE__*/React.createElement(mathInput.MobileKeypad, {
24527
- onAnalyticsEvent: () => Promise.resolve(),
24528
- onDismiss: () => setKeypadActive(false),
24529
- onElementMounted: setKeypadElement
24530
- }));
24531
- })));
24532
- }
24533
- const styles$O = aphrodite.StyleSheet.create({
24534
- container: {
24535
- padding: wonderBlocksTokens.spacing.xxxSmall_4,
24536
- containerType: "inline-size",
24537
- containerName: "perseus-root"
24538
- },
24539
- gutter: {
24540
- marginRight: perseus.constants.lintGutterWidth
24541
- }
24542
- });
24543
-
24544
24485
  var isObject = function (obj) {
24545
24486
  return obj === Object(obj);
24546
24487
  };
@@ -28613,13 +28554,13 @@ class InputNumberEditor extends React__namespace.Component {
28613
28554
  * it's just the input itself for use writing TeX.
28614
28555
  */
28615
28556
  function MathquillInput(props) {
28616
- const mathFieldWrapperRef = React$1.useRef(null);
28617
- const mathFieldInstance = React$1.useRef();
28557
+ const mathFieldWrapperRef = React.useRef(null);
28558
+ const mathFieldInstance = React.useRef();
28618
28559
  const {
28619
28560
  locale,
28620
28561
  strings
28621
28562
  } = mathInput.useMathInputI18n();
28622
- React$1.useEffect(() => {
28563
+ React.useEffect(() => {
28623
28564
  // If we have the mount for the input, but not the input
28624
28565
  // make a new Mathquill input
28625
28566
  if (mathFieldWrapperRef.current && !mathFieldInstance.current) {
@@ -30638,8 +30579,8 @@ const LockedFunctionSettings = props => {
30638
30579
  // Tracking the string value of domain constraints to handle interim state of
30639
30580
  // entering a negative value, as well as representing Infinity as an empty string.
30640
30581
  // This variable is used when specifying the values of the input fields.
30641
- const [domainEntries, setDomainEntries] = React$1.useState([domain && domain[0] !== -Infinity ? domain[0].toString() : "", domain && domain[1] !== Infinity ? domain[1].toString() : ""]);
30642
- React$1.useEffect(() => {
30582
+ const [domainEntries, setDomainEntries] = React.useState([domain && domain[0] !== -Infinity ? domain[0].toString() : "", domain && domain[1] !== Infinity ? domain[1].toString() : ""]);
30583
+ React.useEffect(() => {
30643
30584
  // "useEffect" used to maintain parity between domain constraints and their string representation.
30644
30585
  setDomainEntries([domain && domain[0] !== -Infinity ? domain[0].toString() : "", domain && domain[1] !== Infinity ? domain[1].toString() : ""]);
30645
30586
  }, [domain]);
@@ -37220,7 +37161,6 @@ exports.AllEditors = AllEditors;
37220
37161
  exports.AllWidgets = AllWidgets;
37221
37162
  exports.ArticleDiff = ArticleDiff;
37222
37163
  exports.ArticleEditor = ArticleEditor;
37223
- exports.ContentPreview = ContentPreview;
37224
37164
  exports.DeviceFramer = DeviceFramer;
37225
37165
  exports.Editor = Editor;
37226
37166
  exports.EditorPage = EditorPage;