@pie-lib/math-toolbar 1.8.8 → 1.8.9

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 CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.8.9](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-toolbar@1.8.8...@pie-lib/math-toolbar@1.8.9) (2022-04-12)
7
+
8
+ **Note:** Version bump only for package @pie-lib/math-toolbar
9
+
10
+
11
+
12
+
13
+
6
14
  ## [1.8.8](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-toolbar@1.8.7...@pie-lib/math-toolbar@1.8.8) (2022-02-04)
7
15
 
8
16
  **Note:** Version bump only for package @pie-lib/math-toolbar
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.DoneButton = exports.RawDoneButton = void 0;
6
+ exports.RawDoneButton = exports.DoneButton = void 0;
7
7
 
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
 
@@ -20,7 +20,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
20
20
  var RawDoneButton = function RawDoneButton(_ref) {
21
21
  var classes = _ref.classes,
22
22
  onClick = _ref.onClick;
23
- return _react["default"].createElement(_IconButton["default"], {
23
+ return /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
24
24
  "aria-label": "Done",
25
25
  className: classes.iconRoot,
26
26
  onClick: onClick,
@@ -28,7 +28,7 @@ var RawDoneButton = function RawDoneButton(_ref) {
28
28
  label: classes.label,
29
29
  root: classes.iconRoot
30
30
  }
31
- }, _react["default"].createElement(_Check["default"], null));
31
+ }, /*#__PURE__*/_react["default"].createElement(_Check["default"], null));
32
32
  };
33
33
 
34
34
  exports.RawDoneButton = RawDoneButton;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/done-button.jsx"],"names":["RawDoneButton","classes","onClick","iconRoot","label","root","propTypes","PropTypes","object","isRequired","func","styles","verticalAlign","width","height","color","position","top","DoneButton"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;;;AAEO,IAAMA,aAAa,GAAG,SAAhBA,aAAgB;AAAA,MAAGC,OAAH,QAAGA,OAAH;AAAA,MAAYC,OAAZ,QAAYA,OAAZ;AAAA,SAC3B,gCAAC,sBAAD;AACE,kBAAW,MADb;AAEE,IAAA,SAAS,EAAED,OAAO,CAACE,QAFrB;AAGE,IAAA,OAAO,EAAED,OAHX;AAIE,IAAA,OAAO,EAAE;AACPE,MAAAA,KAAK,EAAEH,OAAO,CAACG,KADR;AAEPC,MAAAA,IAAI,EAAEJ,OAAO,CAACE;AAFP;AAJX,KASE,gCAAC,iBAAD,OATF,CAD2B;AAAA,CAAtB;;;AAcPH,aAAa,CAACM,SAAd,GAA0B;AACxBL,EAAAA,OAAO,EAAEM,sBAAUC,MAAV,CAAiBC,UADF;AAExBP,EAAAA,OAAO,EAAEK,sBAAUG;AAFK,CAA1B;AAKA,IAAMC,MAAM,GAAG;AACbR,EAAAA,QAAQ,EAAE;AACRS,IAAAA,aAAa,EAAE,KADP;AAERC,IAAAA,KAAK,EAAE,MAFC;AAGRC,IAAAA,MAAM,EAAE,MAHA;AAIRC,IAAAA,KAAK,EAAE;AAJC,GADG;AAObX,EAAAA,KAAK,EAAE;AACLY,IAAAA,QAAQ,EAAE,UADL;AAELC,IAAAA,GAAG,EAAE;AAFA;AAPM,CAAf;AAYO,IAAMC,UAAU,GAAG,wBAAWP,MAAX,EAAmBX,aAAnB,CAAnB","sourcesContent":["import React from 'react';\n\nimport IconButton from '@material-ui/core/IconButton';\nimport Check from '@material-ui/icons/Check';\nimport { withStyles } from '@material-ui/core/styles';\nimport PropTypes from 'prop-types';\n\nexport const RawDoneButton = ({ classes, onClick }) => (\n <IconButton\n aria-label=\"Done\"\n className={classes.iconRoot}\n onClick={onClick}\n classes={{\n label: classes.label,\n root: classes.iconRoot\n }}\n >\n <Check />\n </IconButton>\n);\n\nRawDoneButton.propTypes = {\n classes: PropTypes.object.isRequired,\n onClick: PropTypes.func\n};\n\nconst styles = {\n iconRoot: {\n verticalAlign: 'top',\n width: '28px',\n height: '28px',\n color: '#00bb00'\n },\n label: {\n position: 'absolute',\n top: '2px'\n }\n};\nexport const DoneButton = withStyles(styles)(RawDoneButton);\n"],"file":"done-button.js"}
1
+ {"version":3,"sources":["../src/done-button.jsx"],"names":["RawDoneButton","classes","onClick","iconRoot","label","root","propTypes","PropTypes","object","isRequired","func","styles","verticalAlign","width","height","color","position","top","DoneButton"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;;;AAEO,IAAMA,aAAa,GAAG,SAAhBA,aAAgB;AAAA,MAAGC,OAAH,QAAGA,OAAH;AAAA,MAAYC,OAAZ,QAAYA,OAAZ;AAAA,sBAC3B,gCAAC,sBAAD;AACE,kBAAW,MADb;AAEE,IAAA,SAAS,EAAED,OAAO,CAACE,QAFrB;AAGE,IAAA,OAAO,EAAED,OAHX;AAIE,IAAA,OAAO,EAAE;AACPE,MAAAA,KAAK,EAAEH,OAAO,CAACG,KADR;AAEPC,MAAAA,IAAI,EAAEJ,OAAO,CAACE;AAFP;AAJX,kBASE,gCAAC,iBAAD,OATF,CAD2B;AAAA,CAAtB;;;AAcPH,aAAa,CAACM,SAAd,GAA0B;AACxBL,EAAAA,OAAO,EAAEM,sBAAUC,MAAV,CAAiBC,UADF;AAExBP,EAAAA,OAAO,EAAEK,sBAAUG;AAFK,CAA1B;AAKA,IAAMC,MAAM,GAAG;AACbR,EAAAA,QAAQ,EAAE;AACRS,IAAAA,aAAa,EAAE,KADP;AAERC,IAAAA,KAAK,EAAE,MAFC;AAGRC,IAAAA,MAAM,EAAE,MAHA;AAIRC,IAAAA,KAAK,EAAE;AAJC,GADG;AAObX,EAAAA,KAAK,EAAE;AACLY,IAAAA,QAAQ,EAAE,UADL;AAELC,IAAAA,GAAG,EAAE;AAFA;AAPM,CAAf;AAYO,IAAMC,UAAU,GAAG,wBAAWP,MAAX,EAAmBX,aAAnB,CAAnB","sourcesContent":["import React from 'react';\n\nimport IconButton from '@material-ui/core/IconButton';\nimport Check from '@material-ui/icons/Check';\nimport { withStyles } from '@material-ui/core/styles';\nimport PropTypes from 'prop-types';\n\nexport const RawDoneButton = ({ classes, onClick }) => (\n <IconButton\n aria-label=\"Done\"\n className={classes.iconRoot}\n onClick={onClick}\n classes={{\n label: classes.label,\n root: classes.iconRoot\n }}\n >\n <Check />\n </IconButton>\n);\n\nRawDoneButton.propTypes = {\n classes: PropTypes.object.isRequired,\n onClick: PropTypes.func\n};\n\nconst styles = {\n iconRoot: {\n verticalAlign: 'top',\n width: '28px',\n height: '28px',\n color: '#00bb00'\n },\n label: {\n position: 'absolute',\n top: '2px'\n }\n};\nexport const DoneButton = withStyles(styles)(RawDoneButton);\n"],"file":"done-button.js"}
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
@@ -27,27 +29,29 @@ var _Select = _interopRequireDefault(require("@material-ui/core/Select"));
27
29
 
28
30
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
29
31
 
30
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
31
-
32
32
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
33
33
 
34
34
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
35
35
 
36
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
36
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
37
37
 
38
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
38
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
39
39
 
40
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
40
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
41
+
42
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
43
+
44
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
41
45
 
42
46
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
43
47
 
44
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
48
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
45
49
 
46
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
50
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
47
51
 
48
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
52
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
49
53
 
50
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
54
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
51
55
 
52
56
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
53
57
 
@@ -80,17 +84,17 @@ var toNodeData = function toNodeData(data) {
80
84
  }
81
85
  };
82
86
 
83
- var EditorAndPad =
84
- /*#__PURE__*/
85
- function (_React$Component) {
87
+ var EditorAndPad = /*#__PURE__*/function (_React$Component) {
86
88
  _inherits(EditorAndPad, _React$Component);
87
89
 
90
+ var _super = _createSuper(EditorAndPad);
91
+
88
92
  function EditorAndPad(props) {
89
93
  var _this;
90
94
 
91
95
  _classCallCheck(this, EditorAndPad);
92
96
 
93
- _this = _possibleConstructorReturn(this, _getPrototypeOf(EditorAndPad).call(this, props));
97
+ _this = _super.call(this, props);
94
98
 
95
99
  _defineProperty(_assertThisInitialized(_this), "onClick", function (data) {
96
100
  var noDecimal = _this.props.noDecimal;
@@ -162,10 +166,10 @@ function (_React$Component) {
162
166
  }
163
167
  }, {
164
168
  key: "shouldComponentUpdate",
165
-
169
+ value:
166
170
  /** Only render if the mathquill instance's latex is different
167
171
  * or the keypad state changed from one state to the other (shown / hidden) */
168
- value: function shouldComponentUpdate(nextProps, nextState) {
172
+ function shouldComponentUpdate(nextProps, nextState) {
169
173
  var inputIsDifferent = this.input.mathField.latex() !== nextProps.latex;
170
174
  log('[shouldComponentUpdate] ', 'inputIsDifferent: ', inputIsDifferent);
171
175
 
@@ -207,42 +211,42 @@ function (_React$Component) {
207
211
  classes = _this$props2.classes;
208
212
  var shouldShowKeypad = !controlledKeypad || controlledKeypad && showKeypad;
209
213
  log('[render]', latex);
210
- return _react["default"].createElement("div", {
214
+ return /*#__PURE__*/_react["default"].createElement("div", {
211
215
  className: (0, _classnames["default"])(classes.mathToolbar, classNames.mathToolbar)
212
- }, _react["default"].createElement("div", {
216
+ }, /*#__PURE__*/_react["default"].createElement("div", {
213
217
  className: classes.inputAndTypeContainer
214
- }, controlledKeypadMode && _react["default"].createElement(_renderUi.InputContainer, {
218
+ }, controlledKeypadMode && /*#__PURE__*/_react["default"].createElement(_renderUi.InputContainer, {
215
219
  label: "Equation Editor",
216
220
  className: classes.selectContainer
217
- }, _react["default"].createElement(_Select["default"], {
221
+ }, /*#__PURE__*/_react["default"].createElement(_Select["default"], {
218
222
  className: classes.select,
219
223
  onChange: this.onEditorTypeChange,
220
224
  value: this.state.equationEditor
221
- }, _react["default"].createElement(_MenuItem["default"], {
225
+ }, /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
222
226
  value: "non-negative-integers"
223
- }, "Numeric - Non-Negative Integers"), _react["default"].createElement(_MenuItem["default"], {
227
+ }, "Numeric - Non-Negative Integers"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
224
228
  value: "integers"
225
- }, "Numeric - Integers"), _react["default"].createElement(_MenuItem["default"], {
229
+ }, "Numeric - Integers"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
226
230
  value: "decimals"
227
- }, "Numeric - Decimals"), _react["default"].createElement(_MenuItem["default"], {
231
+ }, "Numeric - Decimals"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
228
232
  value: "fractions"
229
- }, "Numeric - Fractions"), _react["default"].createElement(_MenuItem["default"], {
233
+ }, "Numeric - Fractions"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
230
234
  value: 1
231
- }, "Grade 1 - 2"), _react["default"].createElement(_MenuItem["default"], {
235
+ }, "Grade 1 - 2"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
232
236
  value: 3
233
- }, "Grade 3 - 5"), _react["default"].createElement(_MenuItem["default"], {
237
+ }, "Grade 3 - 5"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
234
238
  value: 6
235
- }, "Grade 6 - 7"), _react["default"].createElement(_MenuItem["default"], {
239
+ }, "Grade 6 - 7"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
236
240
  value: 8
237
- }, "Grade 8 - HS"), _react["default"].createElement(_MenuItem["default"], {
241
+ }, "Grade 8 - HS"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
238
242
  value: 'geometry'
239
- }, "Geometry"), _react["default"].createElement(_MenuItem["default"], {
243
+ }, "Geometry"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
240
244
  value: 'advanced-algebra'
241
- }, "Advanced Algebra"), _react["default"].createElement(_MenuItem["default"], {
245
+ }, "Advanced Algebra"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
242
246
  value: 'statistics'
243
- }, "Statistics"), _react["default"].createElement(_MenuItem["default"], {
247
+ }, "Statistics"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
244
248
  value: 'item-authoring'
245
- }, "Item Authoring"))), _react["default"].createElement(_mathInput.mq.Input, {
249
+ }, "Item Authoring"))), /*#__PURE__*/_react["default"].createElement(_mathInput.mq.Input, {
246
250
  onFocus: onFocus,
247
251
  onBlur: onBlur,
248
252
  className: (0, _classnames["default"])(classes.mathEditor, classNames.editor, !controlledKeypadMode ? classes.longMathEditor : ''),
@@ -251,16 +255,16 @@ function (_React$Component) {
251
255
  },
252
256
  latex: latex,
253
257
  onChange: this.onEditorChange
254
- })), allowAnswerBlock && _react["default"].createElement(_Button["default"], {
258
+ })), allowAnswerBlock && /*#__PURE__*/_react["default"].createElement(_Button["default"], {
255
259
  className: classes.addAnswerBlockButton,
256
260
  type: "primary",
257
261
  style: {
258
262
  bottom: shouldShowKeypad ? '320px' : '20px'
259
263
  },
260
264
  onClick: this.onAnswerBlockClick
261
- }, "+ Response Area"), _react["default"].createElement("hr", {
265
+ }, "+ Response Area"), /*#__PURE__*/_react["default"].createElement("hr", {
262
266
  className: classes.hr
263
- }), shouldShowKeypad && _react["default"].createElement(_mathInput.HorizontalKeypad, {
267
+ }), shouldShowKeypad && /*#__PURE__*/_react["default"].createElement(_mathInput.HorizontalKeypad, {
264
268
  additionalKeys: additionalKeys,
265
269
  mode: controlledKeypadMode ? this.state.equationEditor : keypadMode,
266
270
  onClick: this.onClick,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/editor-and-pad.jsx"],"names":["log","decimalRegex","toNodeData","data","type","value","EditorAndPad","props","noDecimal","c","input","clear","command","keystroke","write","onAnswerBlockAdd","onClick","latex","onChange","indexOf","replace","evt","setState","equationEditor","target","state","autoFocus","focus","nextProps","nextState","inputIsDifferent","mathField","keypadMode","controlledKeypad","showKeypad","classNames","allowAnswerBlock","additionalKeys","controlledKeypadMode","onFocus","onBlur","classes","shouldShowKeypad","mathToolbar","inputAndTypeContainer","selectContainer","select","onEditorTypeChange","mathEditor","editor","longMathEditor","r","onEditorChange","addAnswerBlockButton","bottom","onAnswerBlockClick","hr","React","Component","PropTypes","object","oneOfType","string","number","bool","array","isRequired","func","styles","theme","display","alignItems","fontFamily","minWidth","lineHeight","top","left","right","flex","width","marginLeft","marginTop","marginBottom","marginRight","maxWidth","color","text","backgroundColor","background","padding","spacing","unit","position","border","margin","height","borderBottom","palette","primary","main","zIndex","textAlign","outline","boxShadow","borderRadius","paddingTop","borderTop"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAHA,IAAMA,GAAG,GAAG,uBAA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A,MAAM,EAAE,CADG;AAEXR,MAAAA,QAAQ,EAAE,UAFC;AAGXS,MAAAA,SAAS,EAAE,QAHA;AAIXtB,MAAAA,KAAK,EAAE,MAJI;AAKX,2BAAqB;AACnBc,QAAAA,MAAM,EAAE;AADW,OALV;AAQX,yBAAmB;AACjBS,QAAAA,OAAO,EAAE,MADQ;AAEjBC,QAAAA,SAAS,EAAE,MAFM;AAGjBV,QAAAA,MAAM,uBAAgBxB,KAAK,CAAC4B,OAAN,CAAcC,OAAd,CAAsBC,IAAtC,CAHW;AAIjBK,QAAAA,YAAY,EAAE;AAJG,OARR;AAcX,+BAAyB;AACvBX,QAAAA,MAAM,EAAE,iBADe;AAEvBY,QAAAA,UAAU,EAAE;AAFW,OAdd;AAkBX,qCAA+B;AAC7BnC,QAAAA,OAAO,EAAE;AADoB,OAlBpB;AAqBX,oCAA8B;AAC5BA,QAAAA,OAAO,EAAE;AADmB,OArBnB;AAwBX,6BAAuB;AACrBoC,QAAAA,SAAS,EAAE,sBADU;AAErBD,QAAAA,UAAU,EAAE;AAFS,OAxBZ;AA4BX,uCAAiC;AAC/BhC,QAAAA,QAAQ,EAAE;AADqB,OA5BtB;AA+BX,6BAAuB;AACrBC,QAAAA,UAAU,EAAE;AADS;AA/BZ;AA/DU,GAAL;AAAA,CAApB;;eAoGe,wBAAWN,MAAX,EAAmB9D,YAAnB,C","sourcesContent":["import { HorizontalKeypad, mq } from '@pie-lib/math-input';\nimport React from 'react';\nimport debug from 'debug';\nimport PropTypes from 'prop-types';\nimport cx from 'classnames';\nimport Button from '@material-ui/core/Button';\nimport { withStyles } from '@material-ui/core/styles';\nconst log = debug('@pie-lib:math-toolbar:editor-and-pad');\nimport { color, InputContainer } from '@pie-lib/render-ui';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport Select from '@material-ui/core/Select';\nimport { updateSpans } from '@pie-lib/math-input';\n\nconst decimalRegex = /\\.|,/g;\n\nconst toNodeData = data => {\n if (!data) {\n return;\n }\n\n const { type, value } = data;\n\n if (type === 'command' || type === 'cursor') {\n return data;\n } else if (type === 'answer') {\n return { type: 'answer', ...data };\n } else if (value === 'clear') {\n return { type: 'clear' };\n } else {\n return { type: 'write', value };\n }\n};\n\nexport class EditorAndPad extends React.Component {\n static propTypes = {\n classNames: PropTypes.object,\n keypadMode: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n autoFocus: PropTypes.bool,\n allowAnswerBlock: PropTypes.bool,\n showKeypad: PropTypes.bool,\n controlledKeypad: PropTypes.bool,\n controlledKeypadMode: PropTypes.bool,\n noDecimal: PropTypes.bool,\n additionalKeys: PropTypes.array,\n latex: PropTypes.string.isRequired,\n onAnswerBlockAdd: PropTypes.func,\n onFocus: PropTypes.func,\n onBlur: PropTypes.func,\n onChange: PropTypes.func.isRequired,\n classes: PropTypes.object\n };\n\n constructor(props) {\n super(props);\n\n this.state = { equationEditor: 'item-authoring' };\n }\n\n componentDidMount() {\n if (this.input && this.props.autoFocus) {\n this.input.focus();\n }\n }\n\n onClick = data => {\n const { noDecimal } = this.props;\n const c = toNodeData(data);\n log('mathChange: ', c);\n\n // if decimals are not allowed for this response, we discard the input\n if (noDecimal && (c.value === '.' || c.value === ',')) {\n return;\n }\n\n if (c.type === 'clear') {\n log('call clear...');\n this.input.clear();\n } else if (c.type === 'command') {\n this.input.command(c.value);\n } else if (c.type === 'cursor') {\n this.input.keystroke(c.value);\n } else if (c.type === 'answer') {\n this.input.write('%response%');\n } else {\n this.input.write(c.value);\n }\n };\n\n onAnswerBlockClick = () => {\n this.props.onAnswerBlockAdd();\n this.onClick({\n type: 'answer'\n });\n };\n\n onEditorChange = latex => {\n const { onChange, noDecimal } = this.props;\n\n updateSpans();\n\n // if no decimals are allowed and the last change is a decimal dot, discard the change\n if (noDecimal && (latex.indexOf('.') !== -1 || latex.indexOf(',') !== -1) && this.input) {\n this.input.clear();\n this.input.write(latex.replace(decimalRegex, ''));\n return;\n }\n\n onChange(latex);\n };\n\n /** Only render if the mathquill instance's latex is different\n * or the keypad state changed from one state to the other (shown / hidden) */\n shouldComponentUpdate(nextProps, nextState) {\n const inputIsDifferent = this.input.mathField.latex() !== nextProps.latex;\n log('[shouldComponentUpdate] ', 'inputIsDifferent: ', inputIsDifferent);\n\n if (!inputIsDifferent && this.props.keypadMode !== nextProps.keypadMode) {\n return true;\n }\n\n if (!inputIsDifferent && this.props.noDecimal !== nextProps.noDecimal) {\n return true;\n }\n\n if (!inputIsDifferent && this.state.equationEditor !== nextState.equationEditor) {\n return true;\n }\n\n if (!inputIsDifferent && this.props.controlledKeypad) {\n return this.props.showKeypad !== nextProps.showKeypad;\n }\n\n return inputIsDifferent;\n }\n\n onEditorTypeChange = evt => {\n this.setState({ equationEditor: evt.target.value });\n };\n\n render() {\n const {\n classNames,\n keypadMode,\n allowAnswerBlock,\n additionalKeys,\n controlledKeypad,\n controlledKeypadMode,\n showKeypad,\n noDecimal,\n latex,\n onFocus,\n onBlur,\n classes\n } = this.props;\n const shouldShowKeypad = !controlledKeypad || (controlledKeypad && showKeypad);\n\n log('[render]', latex);\n\n return (\n <div className={cx(classes.mathToolbar, classNames.mathToolbar)}>\n <div className={classes.inputAndTypeContainer}>\n {controlledKeypadMode && (\n <InputContainer label=\"Equation Editor\" className={classes.selectContainer}>\n <Select\n className={classes.select}\n onChange={this.onEditorTypeChange}\n value={this.state.equationEditor}\n >\n <MenuItem value=\"non-negative-integers\">Numeric - Non-Negative Integers</MenuItem>\n <MenuItem value=\"integers\">Numeric - Integers</MenuItem>\n <MenuItem value=\"decimals\">Numeric - Decimals</MenuItem>\n <MenuItem value=\"fractions\">Numeric - Fractions</MenuItem>\n <MenuItem value={1}>Grade 1 - 2</MenuItem>\n <MenuItem value={3}>Grade 3 - 5</MenuItem>\n <MenuItem value={6}>Grade 6 - 7</MenuItem>\n <MenuItem value={8}>Grade 8 - HS</MenuItem>\n <MenuItem value={'geometry'}>Geometry</MenuItem>\n <MenuItem value={'advanced-algebra'}>Advanced Algebra</MenuItem>\n <MenuItem value={'statistics'}>Statistics</MenuItem>\n <MenuItem value={'item-authoring'}>Item Authoring</MenuItem>\n </Select>\n </InputContainer>\n )}\n <mq.Input\n onFocus={onFocus}\n onBlur={onBlur}\n className={cx(\n classes.mathEditor,\n classNames.editor,\n !controlledKeypadMode ? classes.longMathEditor : ''\n )}\n innerRef={r => (this.input = r)}\n latex={latex}\n onChange={this.onEditorChange}\n />\n </div>\n {allowAnswerBlock && (\n <Button\n className={classes.addAnswerBlockButton}\n type=\"primary\"\n style={{ bottom: shouldShowKeypad ? '320px' : '20px' }}\n onClick={this.onAnswerBlockClick}\n >\n + Response Area\n </Button>\n )}\n <hr className={classes.hr} />\n {shouldShowKeypad && (\n <HorizontalKeypad\n additionalKeys={additionalKeys}\n mode={controlledKeypadMode ? this.state.equationEditor : keypadMode}\n onClick={this.onClick}\n noDecimal={noDecimal}\n />\n )}\n </div>\n );\n }\n}\n\nconst styles = theme => ({\n inputAndTypeContainer: {\n display: 'flex',\n alignItems: 'center',\n '& *': {\n fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important'\n },\n '& .mq-overarrow.mq-arrow-both': {\n minWidth: '1.23em',\n '& *': {\n lineHeight: '1 !important'\n },\n '&:before': {\n top: '-0.4em',\n left: '-1px'\n },\n '&:after': {\n top: '-2.36em',\n right: '-1px'\n },\n '&.mq-empty:after': {\n top: '-0.45em'\n }\n },\n '& .mq-overarrow.mq-arrow-right': {\n '&:before': {\n top: '-0.4em',\n right: '-1px'\n }\n }\n },\n selectContainer: {\n flex: 'initial',\n width: '25%',\n minWidth: '100px',\n marginLeft: '15px',\n marginTop: '5px',\n marginBottom: '5px',\n marginRight: '5px'\n },\n mathEditor: {\n maxWidth: '400px',\n color: color.text(),\n backgroundColor: color.background(),\n padding: theme.spacing.unit,\n marginTop: theme.spacing.unit,\n marginBottom: theme.spacing.unit\n },\n longMathEditor: {\n maxWidth: '500px'\n },\n addAnswerBlockButton: {\n position: 'absolute',\n right: '12px',\n border: '1px solid lightgrey'\n },\n hr: {\n padding: 0,\n margin: 0,\n height: '1px',\n border: 'none',\n borderBottom: `solid 1px ${theme.palette.primary.main}`\n },\n mathToolbar: {\n zIndex: 9,\n position: 'relative',\n textAlign: 'center',\n width: 'auto',\n '& > .mq-math-mode': {\n border: 'solid 1px lightgrey'\n },\n '& > .mq-focused': {\n outline: 'none',\n boxShadow: 'none',\n border: `dotted 1px ${theme.palette.primary.main}`,\n borderRadius: '0px'\n },\n '& .mq-overarrow-inner': {\n border: 'none !important',\n paddingTop: '0 !important'\n },\n '& .mq-overarrow-inner-right': {\n display: 'none !important'\n },\n '& .mq-overarrow-inner-left': {\n display: 'none !important'\n },\n '& .mq-longdiv-inner': {\n borderTop: '1px solid !important',\n paddingTop: '1.5px !important'\n },\n '& .mq-overarrow.mq-arrow-both': {\n minWidth: '1.23em'\n },\n '& .mq-parallelogram': {\n lineHeight: 0.85\n }\n }\n});\n\nexport default withStyles(styles)(EditorAndPad);\n"],"file":"editor-and-pad.js"}
1
+ {"version":3,"sources":["../src/editor-and-pad.jsx"],"names":["log","decimalRegex","toNodeData","data","type","value","EditorAndPad","props","noDecimal","c","input","clear","command","keystroke","write","onAnswerBlockAdd","onClick","latex","onChange","indexOf","replace","evt","setState","equationEditor","target","state","autoFocus","focus","nextProps","nextState","inputIsDifferent","mathField","keypadMode","controlledKeypad","showKeypad","classNames","allowAnswerBlock","additionalKeys","controlledKeypadMode","onFocus","onBlur","classes","shouldShowKeypad","mathToolbar","inputAndTypeContainer","selectContainer","select","onEditorTypeChange","mathEditor","editor","longMathEditor","r","onEditorChange","addAnswerBlockButton","bottom","onAnswerBlockClick","hr","React","Component","PropTypes","object","oneOfType","string","number","bool","array","isRequired","func","styles","theme","display","alignItems","fontFamily","minWidth","lineHeight","top","left","right","flex","width","marginLeft","marginTop","marginBottom","marginRight","maxWidth","color","text","backgroundColor","background","padding","spacing","unit","position","border","margin","height","borderBottom","palette","primary","main","zIndex","textAlign","outline","boxShadow","borderRadius","paddingTop","borderTop"],"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AAGFC,MAAAA,MAAM,EAAE,KAHN;AAIFF,MAAAA,MAAM,EAAE,MAJN;AAKFG,MAAAA,YAAY,sBAAe3B,KAAK,CAAC4B,OAAN,CAAcC,OAAd,CAAsBC,IAArC;AALV,KAxDmB;AA+DvBxD,IAAAA,WAAW,EAAE;AACXyD,MAAAA,MAAM,EAAE,CADG;AAEXR,MAAAA,QAAQ,EAAE,UAFC;AAGXS,MAAAA,SAAS,EAAE,QAHA;AAIXtB,MAAAA,KAAK,EAAE,MAJI;AAKX,2BAAqB;AACnBc,QAAAA,MAAM,EAAE;AADW,OALV;AAQX,yBAAmB;AACjBS,QAAAA,OAAO,EAAE,MADQ;AAEjBC,QAAAA,SAAS,EAAE,MAFM;AAGjBV,QAAAA,MAAM,uBAAgBxB,KAAK,CAAC4B,OAAN,CAAcC,OAAd,CAAsBC,IAAtC,CAHW;AAIjBK,QAAAA,YAAY,EAAE;AAJG,OARR;AAcX,+BAAyB;AACvBX,QAAAA,MAAM,EAAE,iBADe;AAEvBY,QAAAA,UAAU,EAAE;AAFW,OAdd;AAkBX,qCAA+B;AAC7BnC,QAAAA,OAAO,EAAE;AADoB,OAlBpB;AAqBX,oCAA8B;AAC5BA,QAAAA,OAAO,EAAE;AADmB,OArBnB;AAwBX,6BAAuB;AACrBoC,QAAAA,SAAS,EAAE,sBADU;AAErBD,QAAAA,UAAU,EAAE;AAFS,OAxBZ;AA4BX,uCAAiC;AAC/BhC,QAAAA,QAAQ,EAAE;AADqB,OA5BtB;AA+BX,6BAAuB;AACrBC,QAAAA,UAAU,EAAE;AADS;AA/BZ;AA/DU,GAAL;AAAA,CAApB;;eAoGe,wBAAWN,MAAX,EAAmB9D,YAAnB,C","sourcesContent":["import { HorizontalKeypad, mq } from '@pie-lib/math-input';\nimport React from 'react';\nimport debug from 'debug';\nimport PropTypes from 'prop-types';\nimport cx from 'classnames';\nimport Button from '@material-ui/core/Button';\nimport { withStyles } from '@material-ui/core/styles';\nconst log = debug('@pie-lib:math-toolbar:editor-and-pad');\nimport { color, InputContainer } from '@pie-lib/render-ui';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport Select from '@material-ui/core/Select';\nimport { updateSpans } from '@pie-lib/math-input';\n\nconst decimalRegex = /\\.|,/g;\n\nconst toNodeData = data => {\n if (!data) {\n return;\n }\n\n const { type, value } = data;\n\n if (type === 'command' || type === 'cursor') {\n return data;\n } else if (type === 'answer') {\n return { type: 'answer', ...data };\n } else if (value === 'clear') {\n return { type: 'clear' };\n } else {\n return { type: 'write', value };\n }\n};\n\nexport class EditorAndPad extends React.Component {\n static propTypes = {\n classNames: PropTypes.object,\n keypadMode: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n autoFocus: PropTypes.bool,\n allowAnswerBlock: PropTypes.bool,\n showKeypad: PropTypes.bool,\n controlledKeypad: PropTypes.bool,\n controlledKeypadMode: PropTypes.bool,\n noDecimal: PropTypes.bool,\n additionalKeys: PropTypes.array,\n latex: PropTypes.string.isRequired,\n onAnswerBlockAdd: PropTypes.func,\n onFocus: PropTypes.func,\n onBlur: PropTypes.func,\n onChange: PropTypes.func.isRequired,\n classes: PropTypes.object\n };\n\n constructor(props) {\n super(props);\n\n this.state = { equationEditor: 'item-authoring' };\n }\n\n componentDidMount() {\n if (this.input && this.props.autoFocus) {\n this.input.focus();\n }\n }\n\n onClick = data => {\n const { noDecimal } = this.props;\n const c = toNodeData(data);\n log('mathChange: ', c);\n\n // if decimals are not allowed for this response, we discard the input\n if (noDecimal && (c.value === '.' || c.value === ',')) {\n return;\n }\n\n if (c.type === 'clear') {\n log('call clear...');\n this.input.clear();\n } else if (c.type === 'command') {\n this.input.command(c.value);\n } else if (c.type === 'cursor') {\n this.input.keystroke(c.value);\n } else if (c.type === 'answer') {\n this.input.write('%response%');\n } else {\n this.input.write(c.value);\n }\n };\n\n onAnswerBlockClick = () => {\n this.props.onAnswerBlockAdd();\n this.onClick({\n type: 'answer'\n });\n };\n\n onEditorChange = latex => {\n const { onChange, noDecimal } = this.props;\n\n updateSpans();\n\n // if no decimals are allowed and the last change is a decimal dot, discard the change\n if (noDecimal && (latex.indexOf('.') !== -1 || latex.indexOf(',') !== -1) && this.input) {\n this.input.clear();\n this.input.write(latex.replace(decimalRegex, ''));\n return;\n }\n\n onChange(latex);\n };\n\n /** Only render if the mathquill instance's latex is different\n * or the keypad state changed from one state to the other (shown / hidden) */\n shouldComponentUpdate(nextProps, nextState) {\n const inputIsDifferent = this.input.mathField.latex() !== nextProps.latex;\n log('[shouldComponentUpdate] ', 'inputIsDifferent: ', inputIsDifferent);\n\n if (!inputIsDifferent && this.props.keypadMode !== nextProps.keypadMode) {\n return true;\n }\n\n if (!inputIsDifferent && this.props.noDecimal !== nextProps.noDecimal) {\n return true;\n }\n\n if (!inputIsDifferent && this.state.equationEditor !== nextState.equationEditor) {\n return true;\n }\n\n if (!inputIsDifferent && this.props.controlledKeypad) {\n return this.props.showKeypad !== nextProps.showKeypad;\n }\n\n return inputIsDifferent;\n }\n\n onEditorTypeChange = evt => {\n this.setState({ equationEditor: evt.target.value });\n };\n\n render() {\n const {\n classNames,\n keypadMode,\n allowAnswerBlock,\n additionalKeys,\n controlledKeypad,\n controlledKeypadMode,\n showKeypad,\n noDecimal,\n latex,\n onFocus,\n onBlur,\n classes\n } = this.props;\n const shouldShowKeypad = !controlledKeypad || (controlledKeypad && showKeypad);\n\n log('[render]', latex);\n\n return (\n <div className={cx(classes.mathToolbar, classNames.mathToolbar)}>\n <div className={classes.inputAndTypeContainer}>\n {controlledKeypadMode && (\n <InputContainer label=\"Equation Editor\" className={classes.selectContainer}>\n <Select\n className={classes.select}\n onChange={this.onEditorTypeChange}\n value={this.state.equationEditor}\n >\n <MenuItem value=\"non-negative-integers\">Numeric - Non-Negative Integers</MenuItem>\n <MenuItem value=\"integers\">Numeric - Integers</MenuItem>\n <MenuItem value=\"decimals\">Numeric - Decimals</MenuItem>\n <MenuItem value=\"fractions\">Numeric - Fractions</MenuItem>\n <MenuItem value={1}>Grade 1 - 2</MenuItem>\n <MenuItem value={3}>Grade 3 - 5</MenuItem>\n <MenuItem value={6}>Grade 6 - 7</MenuItem>\n <MenuItem value={8}>Grade 8 - HS</MenuItem>\n <MenuItem value={'geometry'}>Geometry</MenuItem>\n <MenuItem value={'advanced-algebra'}>Advanced Algebra</MenuItem>\n <MenuItem value={'statistics'}>Statistics</MenuItem>\n <MenuItem value={'item-authoring'}>Item Authoring</MenuItem>\n </Select>\n </InputContainer>\n )}\n <mq.Input\n onFocus={onFocus}\n onBlur={onBlur}\n className={cx(\n classes.mathEditor,\n classNames.editor,\n !controlledKeypadMode ? classes.longMathEditor : ''\n )}\n innerRef={r => (this.input = r)}\n latex={latex}\n onChange={this.onEditorChange}\n />\n </div>\n {allowAnswerBlock && (\n <Button\n className={classes.addAnswerBlockButton}\n type=\"primary\"\n style={{ bottom: shouldShowKeypad ? '320px' : '20px' }}\n onClick={this.onAnswerBlockClick}\n >\n + Response Area\n </Button>\n )}\n <hr className={classes.hr} />\n {shouldShowKeypad && (\n <HorizontalKeypad\n additionalKeys={additionalKeys}\n mode={controlledKeypadMode ? this.state.equationEditor : keypadMode}\n onClick={this.onClick}\n noDecimal={noDecimal}\n />\n )}\n </div>\n );\n }\n}\n\nconst styles = theme => ({\n inputAndTypeContainer: {\n display: 'flex',\n alignItems: 'center',\n '& *': {\n fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important'\n },\n '& .mq-overarrow.mq-arrow-both': {\n minWidth: '1.23em',\n '& *': {\n lineHeight: '1 !important'\n },\n '&:before': {\n top: '-0.4em',\n left: '-1px'\n },\n '&:after': {\n top: '-2.36em',\n right: '-1px'\n },\n '&.mq-empty:after': {\n top: '-0.45em'\n }\n },\n '& .mq-overarrow.mq-arrow-right': {\n '&:before': {\n top: '-0.4em',\n right: '-1px'\n }\n }\n },\n selectContainer: {\n flex: 'initial',\n width: '25%',\n minWidth: '100px',\n marginLeft: '15px',\n marginTop: '5px',\n marginBottom: '5px',\n marginRight: '5px'\n },\n mathEditor: {\n maxWidth: '400px',\n color: color.text(),\n backgroundColor: color.background(),\n padding: theme.spacing.unit,\n marginTop: theme.spacing.unit,\n marginBottom: theme.spacing.unit\n },\n longMathEditor: {\n maxWidth: '500px'\n },\n addAnswerBlockButton: {\n position: 'absolute',\n right: '12px',\n border: '1px solid lightgrey'\n },\n hr: {\n padding: 0,\n margin: 0,\n height: '1px',\n border: 'none',\n borderBottom: `solid 1px ${theme.palette.primary.main}`\n },\n mathToolbar: {\n zIndex: 9,\n position: 'relative',\n textAlign: 'center',\n width: 'auto',\n '& > .mq-math-mode': {\n border: 'solid 1px lightgrey'\n },\n '& > .mq-focused': {\n outline: 'none',\n boxShadow: 'none',\n border: `dotted 1px ${theme.palette.primary.main}`,\n borderRadius: '0px'\n },\n '& .mq-overarrow-inner': {\n border: 'none !important',\n paddingTop: '0 !important'\n },\n '& .mq-overarrow-inner-right': {\n display: 'none !important'\n },\n '& .mq-overarrow-inner-left': {\n display: 'none !important'\n },\n '& .mq-longdiv-inner': {\n borderTop: '1px solid !important',\n paddingTop: '1.5px !important'\n },\n '& .mq-overarrow.mq-arrow-both': {\n minWidth: '1.23em'\n },\n '& .mq-parallelogram': {\n lineHeight: 0.85\n }\n }\n});\n\nexport default withStyles(styles)(EditorAndPad);\n"],"file":"editor-and-pad.js"}
package/lib/index.js CHANGED
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
@@ -9,7 +11,7 @@ Object.defineProperty(exports, "MathPreview", {
9
11
  return _mathPreview["default"];
10
12
  }
11
13
  });
12
- exports.PureToolbar = exports.RawPureToolbar = exports.MathToolbar = void 0;
14
+ exports.RawPureToolbar = exports.PureToolbar = exports.MathToolbar = void 0;
13
15
 
14
16
  var _react = _interopRequireDefault(require("react"));
15
17
 
@@ -27,37 +29,39 @@ var _mathPreview = _interopRequireDefault(require("./math-preview"));
27
29
 
28
30
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
29
31
 
30
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
31
-
32
32
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
33
33
 
34
34
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
35
35
 
36
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
36
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
37
37
 
38
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
38
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
39
39
 
40
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
40
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
41
+
42
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
43
+
44
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
41
45
 
42
46
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
43
47
 
44
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
48
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
45
49
 
46
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
50
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
47
51
 
48
52
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
49
53
 
50
- var MathToolbar =
51
- /*#__PURE__*/
52
- function (_React$Component) {
54
+ var MathToolbar = /*#__PURE__*/function (_React$Component) {
53
55
  _inherits(MathToolbar, _React$Component);
54
56
 
57
+ var _super = _createSuper(MathToolbar);
58
+
55
59
  function MathToolbar(props) {
56
60
  var _this;
57
61
 
58
62
  _classCallCheck(this, MathToolbar);
59
63
 
60
- _this = _possibleConstructorReturn(this, _getPrototypeOf(MathToolbar).call(this, props));
64
+ _this = _super.call(this, props);
61
65
 
62
66
  _defineProperty(_assertThisInitialized(_this), "done", function () {
63
67
  _this.props.onDone(_this.state.latex);
@@ -102,7 +106,7 @@ function (_React$Component) {
102
106
  onFocus = _this$props.onFocus,
103
107
  onBlur = _this$props.onBlur,
104
108
  hideDoneButton = _this$props.hideDoneButton;
105
- return _react["default"].createElement(PureToolbar, {
109
+ return /*#__PURE__*/_react["default"].createElement(PureToolbar, {
106
110
  autoFocus: autoFocus,
107
111
  classNames: classNames,
108
112
  onAnswerBlockAdd: onAnswerBlockAdd,
@@ -163,15 +167,15 @@ _defineProperty(MathToolbar, "defaultProps", {
163
167
  hideDoneButton: false
164
168
  });
165
169
 
166
- var RawPureToolbar =
167
- /*#__PURE__*/
168
- function (_React$Component2) {
170
+ var RawPureToolbar = /*#__PURE__*/function (_React$Component2) {
169
171
  _inherits(RawPureToolbar, _React$Component2);
170
172
 
173
+ var _super2 = _createSuper(RawPureToolbar);
174
+
171
175
  function RawPureToolbar() {
172
176
  _classCallCheck(this, RawPureToolbar);
173
177
 
174
- return _possibleConstructorReturn(this, _getPrototypeOf(RawPureToolbar).apply(this, arguments));
178
+ return _super2.apply(this, arguments);
175
179
  }
176
180
 
177
181
  _createClass(RawPureToolbar, [{
@@ -195,9 +199,9 @@ function (_React$Component2) {
195
199
  onBlur = _this$props2.onBlur,
196
200
  hideDoneButton = _this$props2.hideDoneButton,
197
201
  classes = _this$props2.classes;
198
- return _react["default"].createElement("div", {
202
+ return /*#__PURE__*/_react["default"].createElement("div", {
199
203
  className: (0, _classnames["default"])(classes.pureToolbar, (classNames || {}).toolbar)
200
- }, _react["default"].createElement("div", null), _react["default"].createElement(_editorAndPad["default"], {
204
+ }, /*#__PURE__*/_react["default"].createElement("div", null), /*#__PURE__*/_react["default"].createElement(_editorAndPad["default"], {
201
205
  autoFocus: autoFocus,
202
206
  keypadMode: keypadMode,
203
207
  classNames: classNames || {},
@@ -212,7 +216,7 @@ function (_React$Component2) {
212
216
  onChange: onChange,
213
217
  onFocus: onFocus,
214
218
  onBlur: onBlur
215
- }), (!controlledKeypad || controlledKeypad && showKeypad) && !hideDoneButton && _react["default"].createElement(_doneButton.DoneButton, {
219
+ }), (!controlledKeypad || controlledKeypad && showKeypad) && !hideDoneButton && /*#__PURE__*/_react["default"].createElement(_doneButton.DoneButton, {
216
220
  onClick: onDone
217
221
  }));
218
222
  }
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.jsx"],"names":["MathToolbar","props","onDone","state","latex","setState","onChange","nextProps","classNames","autoFocus","allowAnswerBlock","onAnswerBlockAdd","controlledKeypad","controlledKeypadMode","keypadMode","noDecimal","additionalKeys","showKeypad","onFocus","onBlur","hideDoneButton","done","React","Component","PropTypes","bool","oneOfType","string","number","object","array","isRequired","func","RawPureToolbar","classes","pureToolbar","toolbar","styles","display","width","zIndex","alignItems","PureToolbar"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;IAIaA,W;;;;;AAoCX,uBAAYC,KAAZ,EAAmB;AAAA;;AAAA;;AACjB,qFAAMA,KAAN;;AADiB,2DAOZ,YAAM;AACX,YAAKA,KAAL,CAAWC,MAAX,CAAkB,MAAKC,KAAL,CAAWC,KAA7B;AACD,KATkB;;AAAA,+DAeR,UAAAA,KAAK,EAAI;AAClB,YAA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EAAEY,sBAAUC,IAdX;AAejBZ,EAAAA,oBAAoB,EAAEW,sBAAUC,IAff;AAgBjBR,EAAAA,UAAU,EAAEO,sBAAUC,IAhBL;AAiBjBL,EAAAA,cAAc,EAAEI,sBAAUC;AAjBT,C;;AAmErB,IAAMY,MAAM,GAAG,SAATA,MAAS;AAAA,SAAO;AACpBF,IAAAA,WAAW,EAAE;AACXG,MAAAA,OAAO,EAAE,MADE;AAEXC,MAAAA,KAAK,EAAE,MAFI;AAGXC,MAAAA,MAAM,EAAE,CAHG;AAIXC,MAAAA,UAAU,EAAE;AAJD;AADO,GAAP;AAAA,CAAf;;AASO,IAAMC,WAAW,GAAG,wBAAWL,MAAX,EAAmBJ,cAAnB,CAApB","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport cx from 'classnames';\nimport EditorAndPad from './editor-and-pad';\nimport { DoneButton } from './done-button';\nimport { withStyles } from '@material-ui/core/styles';\nimport MathPreview from './math-preview';\n\nexport { MathPreview };\n\nexport class MathToolbar extends React.Component {\n static propTypes = {\n autoFocus: PropTypes.bool,\n allowAnswerBlock: PropTypes.bool,\n controlledKeypad: PropTypes.bool,\n controlledKeypadMode: PropTypes.bool,\n keypadMode: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n classNames: PropTypes.object,\n showKeypad: PropTypes.bool,\n noDecimal: PropTypes.bool,\n additionalKeys: PropTypes.array,\n latex: PropTypes.string.isRequired,\n onAnswerBlockAdd: PropTypes.func,\n onChange: PropTypes.func,\n onDone: PropTypes.func.isRequired,\n onFocus: PropTypes.func,\n onBlur: PropTypes.func,\n hideDoneButton: PropTypes.bool\n };\n\n static defaultProps = {\n classNames: {},\n keypadMode: 'item-authoring',\n autoFocus: false,\n allowAnswerBlock: false,\n controlledKeypad: false,\n controlledKeypadMode: false,\n noDecimal: false,\n showKeypad: true,\n additionalKeys: [],\n onChange: () => {},\n onAnswerBlockAdd: () => {},\n onFocus: () => {},\n hideDoneButton: false\n };\n\n constructor(props) {\n super(props);\n this.state = {\n latex: props.latex\n };\n }\n\n done = () => {\n this.props.onDone(this.state.latex);\n };\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n this.setState({ latex: nextProps.latex });\n }\n\n onChange = latex => {\n this.setState({ latex });\n this.props.onChange(latex);\n };\n\n render() {\n const { latex } = this.state;\n const {\n classNames,\n autoFocus,\n allowAnswerBlock,\n onAnswerBlockAdd,\n controlledKeypad,\n controlledKeypadMode,\n keypadMode,\n noDecimal,\n additionalKeys,\n showKeypad,\n onFocus,\n onBlur,\n hideDoneButton\n } = this.props;\n\n return (\n <PureToolbar\n autoFocus={autoFocus}\n classNames={classNames}\n onAnswerBlockAdd={onAnswerBlockAdd}\n allowAnswerBlock={allowAnswerBlock}\n latex={latex}\n additionalKeys={additionalKeys}\n noDecimal={noDecimal}\n keypadMode={keypadMode}\n onChange={this.onChange}\n onDone={this.done}\n onFocus={onFocus}\n onBlur={onBlur}\n showKeypad={showKeypad}\n controlledKeypad={controlledKeypad}\n controlledKeypadMode={controlledKeypadMode}\n hideDoneButton={hideDoneButton}\n />\n );\n }\n}\n\nexport class RawPureToolbar extends React.Component {\n static propTypes = {\n classNames: PropTypes.object,\n latex: PropTypes.string.isRequired,\n keypadMode: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n onChange: PropTypes.func.isRequired,\n onDone: PropTypes.func.isRequired,\n onBlur: PropTypes.func,\n onAnswerBlockAdd: PropTypes.func,\n additionalKeys: PropTypes.array,\n onFocus: PropTypes.func,\n classes: PropTypes.object.isRequired,\n autoFocus: PropTypes.bool,\n noDecimal: PropTypes.bool,\n allowAnswerBlock: PropTypes.bool,\n controlledKeypad: PropTypes.bool,\n controlledKeypadMode: PropTypes.bool,\n showKeypad: PropTypes.bool,\n hideDoneButton: PropTypes.bool\n };\n\n render() {\n const {\n classNames,\n autoFocus,\n allowAnswerBlock,\n onAnswerBlockAdd,\n controlledKeypad,\n controlledKeypadMode,\n additionalKeys,\n showKeypad,\n keypadMode,\n noDecimal,\n latex,\n onChange,\n onDone,\n onFocus,\n onBlur,\n hideDoneButton,\n classes\n } = this.props;\n\n return (\n <div className={cx(classes.pureToolbar, (classNames || {}).toolbar)}>\n <div />\n <EditorAndPad\n autoFocus={autoFocus}\n keypadMode={keypadMode}\n classNames={classNames || {}}\n controlledKeypad={controlledKeypad}\n controlledKeypadMode={controlledKeypadMode}\n noDecimal={noDecimal}\n showKeypad={showKeypad}\n additionalKeys={additionalKeys}\n allowAnswerBlock={allowAnswerBlock}\n onAnswerBlockAdd={onAnswerBlockAdd}\n latex={latex}\n onChange={onChange}\n onFocus={onFocus}\n onBlur={onBlur}\n />\n {(!controlledKeypad || (controlledKeypad && showKeypad)) && !hideDoneButton && (\n <DoneButton onClick={onDone} />\n )}\n </div>\n );\n }\n}\nconst styles = () => ({\n pureToolbar: {\n display: 'flex',\n width: '100%',\n zIndex: 8,\n alignItems: 'center'\n }\n});\n\nexport const PureToolbar = withStyles(styles)(RawPureToolbar);\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../src/index.jsx"],"names":["MathToolbar","props","onDone","state","latex","setState","onChange","nextProps","classNames","autoFocus","allowAnswerBlock","onAnswerBlockAdd","controlledKeypad","controlledKeypadMode","keypadMode","noDecimal","additionalKeys","showKeypad","onFocus","onBlur","hideDoneButton","done","React","Component","PropTypes","bool","oneOfType","string","number","object","array","isRequired","func","RawPureToolbar","classes","pureToolbar","toolbar","styles","display","width","zIndex","alignItems","PureToolbar"],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;IAIaA,W;;;;;AAoCX,uBAAYC,KAAZ,EAAmB;AAAA;;AAAA;;AACjB,8BAAMA,KAAN;;AADiB,2DAOZ,YAAM;AACX,YAAKA,KAAL,CAAWC,MAAX,CAAkB,MAAKC,KAAL,CAAWC,KAA7B;AACD,KATkB;;AAAA,+DAeR,UAAAA,KAAK,EAAI;AAClB,YAAKC,QAA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jBb,EAAAA,gBAAgB,EAAEY,sBAAUC,IAdX;AAejBZ,EAAAA,oBAAoB,EAAEW,sBAAUC,IAff;AAgBjBR,EAAAA,UAAU,EAAEO,sBAAUC,IAhBL;AAiBjBL,EAAAA,cAAc,EAAEI,sBAAUC;AAjBT,C;;AAmErB,IAAMY,MAAM,GAAG,SAATA,MAAS;AAAA,SAAO;AACpBF,IAAAA,WAAW,EAAE;AACXG,MAAAA,OAAO,EAAE,MADE;AAEXC,MAAAA,KAAK,EAAE,MAFI;AAGXC,MAAAA,MAAM,EAAE,CAHG;AAIXC,MAAAA,UAAU,EAAE;AAJD;AADO,GAAP;AAAA,CAAf;;AASO,IAAMC,WAAW,GAAG,wBAAWL,MAAX,EAAmBJ,cAAnB,CAApB","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport cx from 'classnames';\nimport EditorAndPad from './editor-and-pad';\nimport { DoneButton } from './done-button';\nimport { withStyles } from '@material-ui/core/styles';\nimport MathPreview from './math-preview';\n\nexport { MathPreview };\n\nexport class MathToolbar extends React.Component {\n static propTypes = {\n autoFocus: PropTypes.bool,\n allowAnswerBlock: PropTypes.bool,\n controlledKeypad: PropTypes.bool,\n controlledKeypadMode: PropTypes.bool,\n keypadMode: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n classNames: PropTypes.object,\n showKeypad: PropTypes.bool,\n noDecimal: PropTypes.bool,\n additionalKeys: PropTypes.array,\n latex: PropTypes.string.isRequired,\n onAnswerBlockAdd: PropTypes.func,\n onChange: PropTypes.func,\n onDone: PropTypes.func.isRequired,\n onFocus: PropTypes.func,\n onBlur: PropTypes.func,\n hideDoneButton: PropTypes.bool\n };\n\n static defaultProps = {\n classNames: {},\n keypadMode: 'item-authoring',\n autoFocus: false,\n allowAnswerBlock: false,\n controlledKeypad: false,\n controlledKeypadMode: false,\n noDecimal: false,\n showKeypad: true,\n additionalKeys: [],\n onChange: () => {},\n onAnswerBlockAdd: () => {},\n onFocus: () => {},\n hideDoneButton: false\n };\n\n constructor(props) {\n super(props);\n this.state = {\n latex: props.latex\n };\n }\n\n done = () => {\n this.props.onDone(this.state.latex);\n };\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n this.setState({ latex: nextProps.latex });\n }\n\n onChange = latex => {\n this.setState({ latex });\n this.props.onChange(latex);\n };\n\n render() {\n const { latex } = this.state;\n const {\n classNames,\n autoFocus,\n allowAnswerBlock,\n onAnswerBlockAdd,\n controlledKeypad,\n controlledKeypadMode,\n keypadMode,\n noDecimal,\n additionalKeys,\n showKeypad,\n onFocus,\n onBlur,\n hideDoneButton\n } = this.props;\n\n return (\n <PureToolbar\n autoFocus={autoFocus}\n classNames={classNames}\n onAnswerBlockAdd={onAnswerBlockAdd}\n allowAnswerBlock={allowAnswerBlock}\n latex={latex}\n additionalKeys={additionalKeys}\n noDecimal={noDecimal}\n keypadMode={keypadMode}\n onChange={this.onChange}\n onDone={this.done}\n onFocus={onFocus}\n onBlur={onBlur}\n showKeypad={showKeypad}\n controlledKeypad={controlledKeypad}\n controlledKeypadMode={controlledKeypadMode}\n hideDoneButton={hideDoneButton}\n />\n );\n }\n}\n\nexport class RawPureToolbar extends React.Component {\n static propTypes = {\n classNames: PropTypes.object,\n latex: PropTypes.string.isRequired,\n keypadMode: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n onChange: PropTypes.func.isRequired,\n onDone: PropTypes.func.isRequired,\n onBlur: PropTypes.func,\n onAnswerBlockAdd: PropTypes.func,\n additionalKeys: PropTypes.array,\n onFocus: PropTypes.func,\n classes: PropTypes.object.isRequired,\n autoFocus: PropTypes.bool,\n noDecimal: PropTypes.bool,\n allowAnswerBlock: PropTypes.bool,\n controlledKeypad: PropTypes.bool,\n controlledKeypadMode: PropTypes.bool,\n showKeypad: PropTypes.bool,\n hideDoneButton: PropTypes.bool\n };\n\n render() {\n const {\n classNames,\n autoFocus,\n allowAnswerBlock,\n onAnswerBlockAdd,\n controlledKeypad,\n controlledKeypadMode,\n additionalKeys,\n showKeypad,\n keypadMode,\n noDecimal,\n latex,\n onChange,\n onDone,\n onFocus,\n onBlur,\n hideDoneButton,\n classes\n } = this.props;\n\n return (\n <div className={cx(classes.pureToolbar, (classNames || {}).toolbar)}>\n <div />\n <EditorAndPad\n autoFocus={autoFocus}\n keypadMode={keypadMode}\n classNames={classNames || {}}\n controlledKeypad={controlledKeypad}\n controlledKeypadMode={controlledKeypadMode}\n noDecimal={noDecimal}\n showKeypad={showKeypad}\n additionalKeys={additionalKeys}\n allowAnswerBlock={allowAnswerBlock}\n onAnswerBlockAdd={onAnswerBlockAdd}\n latex={latex}\n onChange={onChange}\n onFocus={onFocus}\n onBlur={onBlur}\n />\n {(!controlledKeypad || (controlledKeypad && showKeypad)) && !hideDoneButton && (\n <DoneButton onClick={onDone} />\n )}\n </div>\n );\n }\n}\nconst styles = () => ({\n pureToolbar: {\n display: 'flex',\n width: '100%',\n zIndex: 8,\n alignItems: 'center'\n }\n});\n\nexport const PureToolbar = withStyles(styles)(RawPureToolbar);\n"],"file":"index.js"}
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
@@ -19,37 +21,39 @@ var _mathInput = require("@pie-lib/math-input");
19
21
 
20
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
21
23
 
22
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
23
-
24
24
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
25
25
 
26
26
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
27
27
 
28
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
28
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
29
29
 
30
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
30
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
31
31
 
32
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
32
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
33
33
 
34
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
34
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
35
35
 
36
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
36
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
37
37
 
38
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
38
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
39
+
40
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
41
+
42
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
39
43
 
40
44
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
41
45
 
42
46
  var log = (0, _debug["default"])('@pie-lib:math-toolbar:math-preview');
43
47
 
44
- var RawMathPreview =
45
- /*#__PURE__*/
46
- function (_React$Component) {
48
+ var RawMathPreview = /*#__PURE__*/function (_React$Component) {
47
49
  _inherits(RawMathPreview, _React$Component);
48
50
 
51
+ var _super = _createSuper(RawMathPreview);
52
+
49
53
  function RawMathPreview() {
50
54
  _classCallCheck(this, RawMathPreview);
51
55
 
52
- return _possibleConstructorReturn(this, _getPrototypeOf(RawMathPreview).apply(this, arguments));
56
+ return _super.apply(this, arguments);
53
57
  }
54
58
 
55
59
  _createClass(RawMathPreview, [{
@@ -62,11 +66,11 @@ function (_React$Component) {
62
66
  isSelected = _this$props.isSelected,
63
67
  onFocus = _this$props.onFocus,
64
68
  onBlur = _this$props.onBlur;
65
- return _react["default"].createElement("div", {
69
+ return /*#__PURE__*/_react["default"].createElement("div", {
66
70
  className: (0, _classnames["default"])(classes.root, isSelected && classes.selected)
67
- }, ' ', _react["default"].createElement("span", {
71
+ }, ' ', /*#__PURE__*/_react["default"].createElement("span", {
68
72
  className: classes.insideOverlay
69
- }), _react["default"].createElement(_mathInput.mq.Static, {
73
+ }), /*#__PURE__*/_react["default"].createElement(_mathInput.mq.Static, {
70
74
  latex: latex,
71
75
  onFocus: onFocus,
72
76
  onBlur: onBlur
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/math-preview.jsx"],"names":["log","RawMathPreview","props","node","data","latex","get","classes","isSelected","onFocus","onBlur","root","selected","insideOverlay","React","Component","PropTypes","string","object","bool","func","mp","theme","display","alignItems","position","border","outline","boxShadow","borderRadius","fontFamily","paddingTop","minWidth","lineHeight","top","left","right","borderTop","palette","primary","main","bottom"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,oCAAN,CAAZ;;IAEaC,c;;;;;;;;;;;;;6BAUF;AACPD,MAAAA,GAAG,CAAC,iBAAD,EAAoB,KAAKE,KAAL,CAAWC,IAAX,CAAgBC,IAApC,CAAH;AACA,UAAMC,KAAK,GAAG,KAAKH,KAAL,CAAWC,IAAX,CAAgBC,IAAhB,CAAqBE,GAArB,CAAyB,OAAzB,CAAd;AAFO,wBAG0C,KAAKJ,KAH/C;AAAA,UAGCK,OAHD,eAGCA,OAHD;AAAA,UAGUC,UAHV,eAGUA,UAHV;AAAA,UAG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AoBJ,uCAAiC;AAC/BM,QAAAA,QAAQ,EAAE,QADqB;AAE/B,eAAO;AACLC,UAAAA,UAAU,EAAE;AADP,SAFwB;AAK/B,oBAAY;AACVC,UAAAA,GAAG,EAAE,QADK;AAEVC,UAAAA,IAAI,EAAE;AAFI,SALmB;AAS/B,mBAAW;AACTD,UAAAA,GAAG,EAAE,SADI;AAETE,UAAAA,KAAK,EAAE;AAFE,SAToB;AAa/B,4BAAoB;AAClBF,UAAAA,GAAG,EAAE;AADa;AAbW,OApB7B;AAqCJ,wCAAkC;AAChC,oBAAY;AACVA,UAAAA,GAAG,EAAE,QADK;AAEVE,UAAAA,KAAK,EAAE;AAFG;AADoB,OArC9B;AA2CJ,qCAA+B;AAC7Bb,QAAAA,OAAO,EAAE;AADoB,OA3C3B;AA8CJ,oCAA8B;AAC5BA,QAAAA,OAAO,EAAE;AADmB,OA9C1B;AAiDJ,6BAAuB;AACrBc,QAAAA,SAAS,EAAE,sBADU;AAErBN,QAAAA,UAAU,EAAE;AAFS,OAjDnB;AAqDJ,6BAAuB;AACrBE,QAAAA,UAAU,EAAE;AADS;AArDnB,KADa;AA0DnBrB,IAAAA,QAAQ,EAAE;AACRc,MAAAA,MAAM,sBAAeJ,KAAK,CAACgB,OAAN,CAAcC,OAAd,CAAsBC,IAArC,CADE;AAER,2BAAqB;AACnBd,QAAAA,MAAM,EAAE;AADW;AAFb,KA1DS;AAgEnBb,IAAAA,aAAa,EAAE;AACbY,MAAAA,QAAQ,EAAE,UADG;AAEbgB,MAAAA,MAAM,EAAE,CAFK;AAGbN,MAAAA,IAAI,EAAE,CAHO;AAIbC,MAAAA,KAAK,EAAE,CAJM;AAKbF,MAAAA,GAAG,EAAE;AALQ;AAhEI,GAAL;AAAA,CAAhB;;eAyEe,wBAAWb,EAAX,EAAepB,cAAf,C","sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport debug from 'debug';\nimport { withStyles } from '@material-ui/core/styles';\nimport PropTypes from 'prop-types';\nimport { mq } from '@pie-lib/math-input';\n\nconst log = debug('@pie-lib:math-toolbar:math-preview');\n\nexport class RawMathPreview extends React.Component {\n static propTypes = {\n latex: PropTypes.string,\n node: PropTypes.object,\n classes: PropTypes.object,\n isSelected: PropTypes.bool,\n onFocus: PropTypes.func,\n onBlur: PropTypes.func\n };\n\n render() {\n log('[render] data: ', this.props.node.data);\n const latex = this.props.node.data.get('latex');\n const { classes, isSelected, onFocus, onBlur } = this.props;\n return (\n <div className={classNames(classes.root, isSelected && classes.selected)}>\n {' '}\n <span className={classes.insideOverlay} />\n <mq.Static latex={latex} onFocus={onFocus} onBlur={onBlur} />\n </div>\n );\n }\n}\n\nconst mp = theme => ({\n root: {\n display: 'inline-flex',\n alignItems: 'center',\n position: 'relative',\n '& > .mq-math-mode': {\n border: 'solid 1px lightgrey'\n },\n '& > .mq-focused': {\n outline: 'none',\n boxShadow: 'none',\n border: 'solid 1px black',\n borderRadius: '0px'\n },\n '& *': {\n fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important'\n },\n '& .mq-overarrow-inner': {\n paddingTop: '0 !important',\n border: 'none !important'\n },\n '& .mq-overarrow.mq-arrow-both': {\n minWidth: '1.23em',\n '& *': {\n lineHeight: '1 !important'\n },\n '&:before': {\n top: '-0.4em',\n left: '-1px'\n },\n '&:after': {\n top: '-2.36em',\n right: '-1px'\n },\n '&.mq-empty:after': {\n top: '-0.45em'\n }\n },\n '& .mq-overarrow.mq-arrow-right': {\n '&:before': {\n top: '-0.4em',\n right: '-1px'\n }\n },\n '& .mq-overarrow-inner-right': {\n display: 'none !important'\n },\n '& .mq-overarrow-inner-left': {\n display: 'none !important'\n },\n '& .mq-longdiv-inner': {\n borderTop: '1px solid !important',\n paddingTop: '1.5px !important'\n },\n '& .mq-parallelogram': {\n lineHeight: 0.85\n }\n },\n selected: {\n border: `solid 1px ${theme.palette.primary.main}`,\n '& > .mq-math-mode': {\n border: 'solid 0px lightgrey'\n }\n },\n insideOverlay: {\n position: 'absolute',\n bottom: 0,\n left: 0,\n right: 0,\n top: 0\n }\n});\n\nexport default withStyles(mp)(RawMathPreview);\n"],"file":"math-preview.js"}
1
+ {"version":3,"sources":["../src/math-preview.jsx"],"names":["log","RawMathPreview","props","node","data","latex","get","classes","isSelected","onFocus","onBlur","root","selected","insideOverlay","React","Component","PropTypes","string","object","bool","func","mp","theme","display","alignItems","position","border","outline","boxShadow","borderRadius","fontFamily","paddingTop","minWidth","lineHeight","top","left","right","borderTop","palette","primary","main","bottom"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,oCAAN,CAAZ;;IAEaC,c;;;;;;;;;;;;;WAUX,kBAAS;AACPD,MAAAA,GAAG,CAAC,iBAAD,EAAoB,KAAKE,KAAL,CAAWC,IAAX,CAAgBC,IAApC,CAAH;AACA,UAAMC,KAAK,GAAG,KAAKH,KAAL,CAAWC,IAAX,CAAgBC,IAAhB,CAAqBE,GAArB,CAAyB,OAAzB,CAAd;AACA,wBAAiD,KAAKJ,KAAtD;AAAA,UAAQK,OAAR,eAAQA,OAAR;AAAA,UAAiBC,UAAjB,eAAiBA,UAAjB;AAAA,UAA6BC,OAA7B,eAA6BA,OAA7B;AAAA,UAAsCC,MAAtC,eAAsCA,MAAtC;AACA,0BACE;AAAK,QAAA,SAAS,EAAE,4BAAWH,OAAO,CAACI,IAAnB,EAAyBH,UAAU,IAAID,OAAO,CAACK,QAA/C;AAAhB,SACG,GADH,eAEE;AAAM,QAAA,SAAS,EAAEL,OAAO,CAACM;AAAzB,QAFF,eAGE,gCAAC,aAAD,CAAI,MAAJ;AAAW,QAAA,KAAK,EAAER,KAAlB;AAAyB,QAAA,OAAO,EAAEI,OAAlC;AAA2C,QAAA,MAAM,EAAEC;AAAnD,QAHF,CADF;AAOD;;;;EArBiCI,kBAAMC,S;;;;gBAA7Bd,c,eACQ;AACjBI,EAAAA,KAAK,EAAEW,s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A,OAAO,EAAE;AADoB,OA3C3B;AA8CJ,oCAA8B;AAC5BA,QAAAA,OAAO,EAAE;AADmB,OA9C1B;AAiDJ,6BAAuB;AACrBc,QAAAA,SAAS,EAAE,sBADU;AAErBN,QAAAA,UAAU,EAAE;AAFS,OAjDnB;AAqDJ,6BAAuB;AACrBE,QAAAA,UAAU,EAAE;AADS;AArDnB,KADa;AA0DnBrB,IAAAA,QAAQ,EAAE;AACRc,MAAAA,MAAM,sBAAeJ,KAAK,CAACgB,OAAN,CAAcC,OAAd,CAAsBC,IAArC,CADE;AAER,2BAAqB;AACnBd,QAAAA,MAAM,EAAE;AADW;AAFb,KA1DS;AAgEnBb,IAAAA,aAAa,EAAE;AACbY,MAAAA,QAAQ,EAAE,UADG;AAEbgB,MAAAA,MAAM,EAAE,CAFK;AAGbN,MAAAA,IAAI,EAAE,CAHO;AAIbC,MAAAA,KAAK,EAAE,CAJM;AAKbF,MAAAA,GAAG,EAAE;AALQ;AAhEI,GAAL;AAAA,CAAhB;;eAyEe,wBAAWb,EAAX,EAAepB,cAAf,C","sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport debug from 'debug';\nimport { withStyles } from '@material-ui/core/styles';\nimport PropTypes from 'prop-types';\nimport { mq } from '@pie-lib/math-input';\n\nconst log = debug('@pie-lib:math-toolbar:math-preview');\n\nexport class RawMathPreview extends React.Component {\n static propTypes = {\n latex: PropTypes.string,\n node: PropTypes.object,\n classes: PropTypes.object,\n isSelected: PropTypes.bool,\n onFocus: PropTypes.func,\n onBlur: PropTypes.func\n };\n\n render() {\n log('[render] data: ', this.props.node.data);\n const latex = this.props.node.data.get('latex');\n const { classes, isSelected, onFocus, onBlur } = this.props;\n return (\n <div className={classNames(classes.root, isSelected && classes.selected)}>\n {' '}\n <span className={classes.insideOverlay} />\n <mq.Static latex={latex} onFocus={onFocus} onBlur={onBlur} />\n </div>\n );\n }\n}\n\nconst mp = theme => ({\n root: {\n display: 'inline-flex',\n alignItems: 'center',\n position: 'relative',\n '& > .mq-math-mode': {\n border: 'solid 1px lightgrey'\n },\n '& > .mq-focused': {\n outline: 'none',\n boxShadow: 'none',\n border: 'solid 1px black',\n borderRadius: '0px'\n },\n '& *': {\n fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important'\n },\n '& .mq-overarrow-inner': {\n paddingTop: '0 !important',\n border: 'none !important'\n },\n '& .mq-overarrow.mq-arrow-both': {\n minWidth: '1.23em',\n '& *': {\n lineHeight: '1 !important'\n },\n '&:before': {\n top: '-0.4em',\n left: '-1px'\n },\n '&:after': {\n top: '-2.36em',\n right: '-1px'\n },\n '&.mq-empty:after': {\n top: '-0.45em'\n }\n },\n '& .mq-overarrow.mq-arrow-right': {\n '&:before': {\n top: '-0.4em',\n right: '-1px'\n }\n },\n '& .mq-overarrow-inner-right': {\n display: 'none !important'\n },\n '& .mq-overarrow-inner-left': {\n display: 'none !important'\n },\n '& .mq-longdiv-inner': {\n borderTop: '1px solid !important',\n paddingTop: '1.5px !important'\n },\n '& .mq-parallelogram': {\n lineHeight: 0.85\n }\n },\n selected: {\n border: `solid 1px ${theme.palette.primary.main}`,\n '& > .mq-math-mode': {\n border: 'solid 0px lightgrey'\n }\n },\n insideOverlay: {\n position: 'absolute',\n bottom: 0,\n left: 0,\n right: 0,\n top: 0\n }\n});\n\nexport default withStyles(mp)(RawMathPreview);\n"],"file":"math-preview.js"}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.8.8",
6
+ "version": "1.8.9",
7
7
  "description": "Math toolbar for editing math equations",
8
8
  "keywords": [
9
9
  "math",
@@ -19,7 +19,7 @@
19
19
  "dependencies": {
20
20
  "@material-ui/core": "^3.8.3",
21
21
  "@material-ui/icons": "^3.0.2",
22
- "@pie-lib/math-input": "^6.6.8",
22
+ "@pie-lib/math-input": "^6.6.9",
23
23
  "classnames": "^2.2.6",
24
24
  "debug": "^4.1.1",
25
25
  "keycode": "^2.2.0"
@@ -32,5 +32,5 @@
32
32
  "@pie-lib/test-utils": "^0.2.19"
33
33
  },
34
34
  "scripts": {},
35
- "gitHead": "8c254f4c516c9f4e67109accdb2ad415e1f6cea4"
35
+ "gitHead": "c37429328de4f87b6a7095de6e671c2cc53dd7f5"
36
36
  }