@pie-lib/math-toolbar 2.0.0-next.0 → 2.1.0-next.2

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,37 @@
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
+ # [2.1.0-next.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-toolbar@2.1.0-next.1...@pie-lib/math-toolbar@2.1.0-next.2) (2026-01-26)
7
+
8
+ **Note:** Version bump only for package @pie-lib/math-toolbar
9
+
10
+
11
+
12
+
13
+
14
+ # [2.1.0-next.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-toolbar@1.31.2...@pie-lib/math-toolbar@2.1.0-next.1) (2026-01-26)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * fix some popper components, fix some math toolbar color ([ed1df55](https://github.com/pie-framework/pie-lib/commit/ed1df558e272686a712767e347df49434790f334))
20
+ * math keyboard ref and remove console log ([fd9dc91](https://github.com/pie-framework/pie-lib/commit/fd9dc91092497e55a75aba3e7ef1c4c1c5723f35))
21
+ * remove carets from [@pie-lib](https://github.com/pie-lib) dependencies and configure lerna to use exact versions ([c9cd800](https://github.com/pie-framework/pie-lib/commit/c9cd800844abca09e7acf1fd35b2ddf51a6d86df))
22
+ * remove carret, point to specific libs version ([09939a5](https://github.com/pie-framework/pie-lib/commit/09939a5aca19d7dda03d62c93d4d524f98dd69da))
23
+ * remove exports and publish ([#2068](https://github.com/pie-framework/pie-lib/issues/2068)) ([60a96cd](https://github.com/pie-framework/pie-lib/commit/60a96cde0ec65f6b1cac0ae329aa33a0abc50d05))
24
+ * use fixed lib deps ([de7c64d](https://github.com/pie-framework/pie-lib/commit/de7c64d14f13259fe44d47405e4421baef21e24e))
25
+
26
+
27
+ ### Features
28
+
29
+ * bump react and react-dom ([01dc19e](https://github.com/pie-framework/pie-lib/commit/01dc19e88bbc8d372c561d1511df1a82937d45af))
30
+ * packages/math-toolbar & packages/icons mui update PD-5268 ([8a18bc1](https://github.com/pie-framework/pie-lib/commit/8a18bc1a79cd3ca3baa7ff7a94b050ec20371649))
31
+ * sync latest changes from dev ([c936e9c](https://github.com/pie-framework/pie-lib/commit/c936e9c7f9e095e7d9b9805ac2bf72bd271e05f1))
32
+
33
+
34
+
35
+
36
+
6
37
  # [2.0.0-next.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/math-toolbar@1.31.3-next.0...@pie-lib/math-toolbar@2.0.0-next.0) (2026-01-19)
7
38
 
8
39
  **Note:** Version bump only for package @pie-lib/math-toolbar
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "2.0.0-next.0",
6
+ "version": "2.1.0-next.2",
7
7
  "description": "Math toolbar for editing math equations",
8
8
  "keywords": [
9
9
  "math",
@@ -21,8 +21,8 @@
21
21
  "@emotion/style": "^0.8.0",
22
22
  "@mui/icons-material": "^7.3.4",
23
23
  "@mui/material": "^7.3.4",
24
- "@pie-lib/math-input": "6.31.2-next.16",
25
- "@pie-lib/render-ui": "4.35.3-next.15",
24
+ "@pie-lib/math-input": "7.1.0-next.1",
25
+ "@pie-lib/render-ui": "5.1.0-next.2",
26
26
  "debug": "^4.1.1",
27
27
  "lodash": "^4.17.11",
28
28
  "prop-types": "^15.7.2"
@@ -32,16 +32,8 @@
32
32
  "react-dom": "^18.2.0"
33
33
  },
34
34
  "devDependencies": {
35
- "@pie-lib/test-utils": "0.22.2-next.16"
35
+ "@pie-lib/test-utils": "1.1.0-next.1"
36
36
  },
37
37
  "scripts": {},
38
- "gitHead": "f104bab3116a65a39c55efc48387d8701c0c1d84",
39
- "exports": {
40
- ".": {
41
- "require": "./lib/index.js",
42
- "import": "./src/index.jsx",
43
- "default": "./lib/index.js"
44
- },
45
- "./esm": "./esm/index.js"
46
- }
38
+ "gitHead": "04c639af6e49d1881bf3244ebb3940171c26bd3e"
47
39
  }
@@ -1,51 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.RawDoneButton = exports.DoneButton = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _react = _interopRequireDefault(require("react"));
10
- var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
11
- var _Check = _interopRequireDefault(require("@mui/icons-material/Check"));
12
- var _styles = require("@mui/material/styles");
13
- var _propTypes = _interopRequireDefault(require("prop-types"));
14
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
15
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
16
- var StyledIconButton = (0, _styles.styled)(_IconButton["default"])(function (_ref) {
17
- var theme = _ref.theme,
18
- hideBackground = _ref.hideBackground;
19
- return _objectSpread(_objectSpread({
20
- verticalAlign: 'top',
21
- width: '28px',
22
- height: '28px',
23
- color: '#00bb00'
24
- }, hideBackground && {
25
- backgroundColor: theme.palette.common.white,
26
- '&:hover': {
27
- backgroundColor: theme.palette.grey[200]
28
- }
29
- }), {}, {
30
- '& .MuiIconButton-label': {
31
- position: 'absolute',
32
- top: '2px'
33
- }
34
- });
35
- });
36
- var RawDoneButton = exports.RawDoneButton = function RawDoneButton(_ref2) {
37
- var onClick = _ref2.onClick,
38
- hideBackground = _ref2.hideBackground;
39
- return /*#__PURE__*/_react["default"].createElement(StyledIconButton, {
40
- "aria-label": "Done",
41
- onClick: onClick,
42
- hideBackground: hideBackground,
43
- size: "large"
44
- }, /*#__PURE__*/_react["default"].createElement(_Check["default"], null));
45
- };
46
- RawDoneButton.propTypes = {
47
- onClick: _propTypes["default"].func,
48
- hideBackground: _propTypes["default"].bool
49
- };
50
- var DoneButton = exports.DoneButton = RawDoneButton;
51
- //# sourceMappingURL=done-button.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"done-button.js","names":["_react","_interopRequireDefault","require","_IconButton","_Check","_styles","_propTypes","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","StyledIconButton","styled","IconButton","_ref","theme","hideBackground","verticalAlign","width","height","color","backgroundColor","palette","common","white","grey","position","top","RawDoneButton","exports","_ref2","onClick","createElement","size","propTypes","PropTypes","func","bool","DoneButton"],"sources":["../src/done-button.jsx"],"sourcesContent":["import React from 'react';\n\nimport IconButton from '@mui/material/IconButton';\nimport Check from '@mui/icons-material/Check';\nimport { styled } from '@mui/material/styles';\nimport PropTypes from 'prop-types';\n\nconst StyledIconButton = styled(IconButton)(({ theme, hideBackground }) => ({\n verticalAlign: 'top',\n width: '28px',\n height: '28px',\n color: '#00bb00',\n ...(hideBackground && {\n backgroundColor: theme.palette.common.white,\n '&:hover': {\n backgroundColor: theme.palette.grey[200],\n },\n }),\n '& .MuiIconButton-label': {\n position: 'absolute',\n top: '2px',\n },\n}));\n\nexport const RawDoneButton = ({ onClick, hideBackground }) => (\n <StyledIconButton\n aria-label=\"Done\"\n onClick={onClick}\n hideBackground={hideBackground}\n size=\"large\"\n >\n <Check />\n </StyledIconButton>\n);\n\nRawDoneButton.propTypes = {\n onClick: PropTypes.func,\n hideBackground: PropTypes.bool,\n};\n\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interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports["default"] = exports.EditorAndPad = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
11
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
12
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
13
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
- var _react = _interopRequireDefault(require("react"));
15
- var _debug = _interopRequireDefault(require("debug"));
16
- var _propTypes = _interopRequireDefault(require("prop-types"));
17
- var _Button = _interopRequireDefault(require("@mui/material/Button"));
18
- var _styles = require("@mui/material/styles");
19
- var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
20
- var _Select = _interopRequireDefault(require("@mui/material/Select"));
21
- var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
22
- var _FormControl = _interopRequireDefault(require("@mui/material/FormControl"));
23
- var _InputLabel = _interopRequireDefault(require("@mui/material/InputLabel"));
24
- var _mathInput = require("@pie-lib/math-input");
25
- var _renderUi = require("@pie-lib/render-ui");
26
- var _utils = require("./utils");
27
- function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
28
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
29
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
30
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
31
- var _mq$CommonMqStyles = _mathInput.mq.CommonMqStyles,
32
- commonMqFontStyles = _mq$CommonMqStyles.commonMqFontStyles,
33
- commonMqKeyboardStyles = _mq$CommonMqStyles.commonMqKeyboardStyles,
34
- longdivStyles = _mq$CommonMqStyles.longdivStyles,
35
- supsubStyles = _mq$CommonMqStyles.supsubStyles;
36
- var log = (0, _debug["default"])('@pie-lib:math-toolbar:editor-and-pad');
37
- var decimalRegex = /\.|,/g;
38
- var MathToolbarContainer = (0, _styles.styled)('div')(function (_ref) {
39
- var theme = _ref.theme;
40
- return {
41
- zIndex: 9,
42
- position: 'relative',
43
- textAlign: 'center',
44
- width: 'auto',
45
- '& > .mq-math-mode': {
46
- border: 'solid 1px lightgrey'
47
- },
48
- '& > .mq-focused': {
49
- outline: 'none',
50
- boxShadow: 'none',
51
- border: "dotted 1px ".concat(theme.palette.primary.main),
52
- borderRadius: '0px'
53
- },
54
- '& .mq-overarrow-inner': {
55
- border: 'none !important',
56
- paddingTop: '0 !important'
57
- },
58
- '& .mq-overarrow-inner-right': {
59
- display: 'none !important'
60
- },
61
- '& .mq-overarrow-inner-left': {
62
- display: 'none !important'
63
- },
64
- '& .mq-longdiv-inner': {
65
- borderTop: '1px solid !important',
66
- paddingTop: '1.5px !important'
67
- },
68
- '& .mq-overarrow.mq-arrow-both': {
69
- top: '7.8px',
70
- marginTop: '0px',
71
- minWidth: '1.23em'
72
- },
73
- '& .mq-parallelogram': {
74
- lineHeight: 0.85
75
- }
76
- };
77
- });
78
- var InputAndTypeContainer = (0, _styles.styled)('div')(function (_ref2) {
79
- var theme = _ref2.theme,
80
- hide = _ref2.hide;
81
- return {
82
- display: hide ? 'none' : 'flex',
83
- alignItems: 'center',
84
- '& .mq-editable-field .mq-cursor': {
85
- top: '-4px'
86
- },
87
- '& .mq-math-mode .mq-selection, .mq-editable-field .mq-selection': {
88
- paddingTop: '18px'
89
- },
90
- '& .mq-math-mode .mq-overarrow': {
91
- fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important'
92
- },
93
- '& .mq-math-mode .mq-overline .mq-overline-inner': {
94
- paddingTop: '0.4em !important'
95
- },
96
- '& .mq-overarrow.mq-arrow-both': {
97
- minWidth: '1.23em',
98
- '& *': {
99
- lineHeight: '1 !important'
100
- },
101
- '&:before': {
102
- top: '-0.45em',
103
- left: '-1px'
104
- },
105
- '&:after': {
106
- position: 'absolute !important',
107
- top: '0px !important',
108
- right: '-2px'
109
- },
110
- '&.mq-empty:after': {
111
- top: '-0.45em'
112
- }
113
- },
114
- '& .mq-overarrow.mq-arrow-right': {
115
- '&:before': {
116
- top: '-0.4em',
117
- right: '-1px'
118
- }
119
- },
120
- '& *': _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, commonMqFontStyles), supsubStyles), longdivStyles), {}, {
121
- '& .mq-math-mode .mq-sqrt-prefix': {
122
- verticalAlign: 'baseline !important',
123
- top: '1px !important',
124
- left: '-0.1em !important'
125
- },
126
- '& .mq-math-mode .mq-overarc ': {
127
- paddingTop: '0.45em !important'
128
- },
129
- '& .mq-math-mode .mq-empty': {
130
- padding: '9px 1px !important'
131
- },
132
- '& .mq-math-mode .mq-root-block': {
133
- paddingTop: '10px'
134
- },
135
- '& .mq-scaled .mq-sqrt-prefix': {
136
- top: '0 !important'
137
- },
138
- '& .mq-math-mode .mq-longdiv .mq-longdiv-inner': {
139
- marginLeft: '4px !important',
140
- paddingTop: '6px !important',
141
- paddingLeft: '6px !important'
142
- },
143
- '& .mq-math-mode .mq-paren': {
144
- verticalAlign: 'top !important',
145
- padding: '1px 0.1em !important'
146
- },
147
- '& .mq-math-mode .mq-sqrt-stem': {
148
- borderTop: '0.07em solid',
149
- marginLeft: '-1.5px',
150
- marginTop: '-2px !important',
151
- paddingTop: '5px !important'
152
- },
153
- '& .mq-math-mode .mq-denominator': {
154
- marginTop: '-5px !important',
155
- padding: '0.5em 0.1em 0.1em !important'
156
- },
157
- '& .mq-math-mode .mq-numerator, .mq-math-mode .mq-over': {
158
- padding: '0 0.1em !important',
159
- paddingBottom: '0 !important',
160
- marginBottom: '-2px'
161
- }
162
- }),
163
- '& span[data-prime="true"]': {
164
- fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important'
165
- }
166
- };
167
- });
168
- var StyledFormControl = (0, _styles.styled)(_FormControl["default"])({
169
- flex: 'initial',
170
- width: '25%',
171
- minWidth: '100px',
172
- marginLeft: '15px',
173
- marginTop: '5px',
174
- marginBottom: '5px',
175
- marginRight: '5px',
176
- '& label': {
177
- fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important'
178
- },
179
- '& div': {
180
- fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important'
181
- }
182
- });
183
- var StyledInputLabel = (0, _styles.styled)(_InputLabel["default"])(function () {
184
- return {
185
- backgroundColor: 'transparent'
186
- };
187
- });
188
- var InputContainerDiv = (0, _styles.styled)('div')(function (_ref3) {
189
- var theme = _ref3.theme,
190
- error = _ref3.error;
191
- return _objectSpread(_objectSpread({
192
- minWidth: '500px',
193
- maxWidth: '900px',
194
- minHeight: '30px',
195
- width: '100%',
196
- display: 'flex',
197
- marginTop: theme.spacing(1),
198
- marginBottom: theme.spacing(1)
199
- }, error && {
200
- border: '2px solid red'
201
- }), {}, {
202
- '& .mq-sqrt-prefix .mq-scaled': {
203
- verticalAlign: 'middle !important'
204
- }
205
- });
206
- });
207
- var MathEditor = (0, _styles.styled)(_mathInput.mq.Input)(function (_ref4) {
208
- var controlledKeypadMode = _ref4.controlledKeypadMode;
209
- return {
210
- maxWidth: controlledKeypadMode ? '400px' : '500px',
211
- color: _renderUi.color.text(),
212
- backgroundColor: _renderUi.color.background(),
213
- padding: '2px'
214
- };
215
- });
216
- var AddAnswerBlockButton = (0, _styles.styled)(_Button["default"])({
217
- position: 'absolute',
218
- right: '12px',
219
- border: '1px solid lightgrey',
220
- color: _renderUi.color.text()
221
- });
222
- var StyledHr = (0, _styles.styled)('hr')(function (_ref5) {
223
- var theme = _ref5.theme;
224
- return {
225
- padding: 0,
226
- margin: 0,
227
- height: '1px',
228
- border: 'none',
229
- borderBottom: "solid 1px ".concat(theme.palette.primary.main)
230
- };
231
- });
232
- var KeyboardContainer = (0, _styles.styled)(_mathInput.HorizontalKeypad)(function (_ref6) {
233
- var mode = _ref6.mode;
234
- return _objectSpread(_objectSpread({}, commonMqKeyboardStyles), mode === 'language' && {
235
- '& *': {
236
- fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important'
237
- }
238
- });
239
- });
240
- var toNodeData = function toNodeData(data) {
241
- if (!data) {
242
- return;
243
- }
244
- var type = data.type,
245
- value = data.value;
246
- if (type === 'command' || type === 'cursor') {
247
- return data;
248
- } else if (type === 'answer') {
249
- return _objectSpread({
250
- type: 'answer'
251
- }, data);
252
- } else if (value === 'clear') {
253
- return {
254
- type: 'clear'
255
- };
256
- } else {
257
- return {
258
- type: 'write',
259
- value: value
260
- };
261
- }
262
- };
263
- var EditorAndPad = exports.EditorAndPad = /*#__PURE__*/function (_React$Component) {
264
- function EditorAndPad(props) {
265
- var _this;
266
- (0, _classCallCheck2["default"])(this, EditorAndPad);
267
- _this = _callSuper(this, EditorAndPad, [props]);
268
- (0, _defineProperty2["default"])(_this, "onClick", function (data) {
269
- var _this$props = _this.props,
270
- noDecimal = _this$props.noDecimal,
271
- noLatexHandling = _this$props.noLatexHandling,
272
- onChange = _this$props.onChange;
273
- var c = toNodeData(data);
274
- log('mathChange: ', c);
275
- if (noLatexHandling) {
276
- onChange(c.value);
277
- return;
278
- }
279
-
280
- // if decimals are not allowed for this response, we discard the input
281
- if (noDecimal && (c.value === '.' || c.value === ',')) {
282
- return;
283
- }
284
- if (!c) {
285
- return;
286
- }
287
- if (c.type === 'clear') {
288
- log('call clear...');
289
- _this.input.clear();
290
- } else if (c.type === 'command') {
291
- _this.input.command(c.value);
292
- } else if (c.type === 'cursor') {
293
- _this.input.keystroke(c.value);
294
- } else if (c.type === 'answer') {
295
- _this.input.write('%response%');
296
- } else {
297
- _this.input.write(c.value);
298
- }
299
- });
300
- (0, _defineProperty2["default"])(_this, "updateDisable", function (isEdit) {
301
- var maxResponseAreas = _this.props.maxResponseAreas;
302
- if (maxResponseAreas) {
303
- var shouldDisable = _this.checkResponseAreasNumber(maxResponseAreas, isEdit);
304
- _this.setState({
305
- addDisabled: shouldDisable
306
- });
307
- }
308
- });
309
- (0, _defineProperty2["default"])(_this, "onAnswerBlockClick", function () {
310
- _this.props.onAnswerBlockAdd();
311
- _this.onClick({
312
- type: 'answer'
313
- });
314
- _this.updateDisable(true);
315
- });
316
- (0, _defineProperty2["default"])(_this, "onEditorChange", function (latex) {
317
- var _this$props2 = _this.props,
318
- onChange = _this$props2.onChange,
319
- noDecimal = _this$props2.noDecimal;
320
- (0, _mathInput.updateSpans)();
321
- (0, _utils.markFractionBaseSuperscripts)();
322
- _this.updateDisable(true);
323
-
324
- // if no decimals are allowed and the last change is a decimal dot, discard the change
325
- if (noDecimal && (latex.indexOf('.') !== -1 || latex.indexOf(',') !== -1) && _this.input) {
326
- _this.input.clear();
327
- _this.input.write(latex.replace(decimalRegex, ''));
328
- return;
329
- }
330
-
331
- // eslint-disable-next-line no-useless-escape
332
- var regexMatch = latex.match(/[0-9]\\ \\frac\{[^\{]*\}\{ \}/);
333
- if (_this.input && regexMatch && regexMatch !== null && regexMatch !== void 0 && regexMatch.length) {
334
- try {
335
- _this.input.mathField.__controller.cursor.insLeftOf(_this.input.mathField.__controller.cursor.parent[-1].parent);
336
- _this.input.mathField.el().dispatchEvent(new KeyboardEvent('keydown', {
337
- keyCode: 8
338
- }));
339
- } catch (e) {
340
- // eslint-disable-next-line no-console
341
- console.error(e.toString());
342
- }
343
- return;
344
- }
345
- onChange(latex);
346
- });
347
- (0, _defineProperty2["default"])(_this, "onEditorTypeChange", function (evt) {
348
- _this.setState({
349
- equationEditor: evt.target.value
350
- });
351
- });
352
- (0, _defineProperty2["default"])(_this, "checkResponseAreasNumber", function (maxResponseAreas, isEdit) {
353
- var _ref7 = _this.input && _this.input.props || {},
354
- latex = _ref7.latex;
355
- if (latex) {
356
- var count = (latex.match(/answerBlock/g) || []).length;
357
- return isEdit ? count === maxResponseAreas - 1 : count === maxResponseAreas;
358
- }
359
- return false;
360
- });
361
- _this.state = {
362
- equationEditor: 'item-authoring',
363
- addDisabled: false
364
- };
365
- return _this;
366
- }
367
- (0, _inherits2["default"])(EditorAndPad, _React$Component);
368
- return (0, _createClass2["default"])(EditorAndPad, [{
369
- key: "componentDidMount",
370
- value: function componentDidMount() {
371
- if (this.input && this.props.autoFocus) {
372
- this.input.focus();
373
- }
374
- }
375
- }, {
376
- key: "shouldComponentUpdate",
377
- value:
378
- /** Only render if the mathquill instance's latex is different
379
- * or the keypad state changed from one state to the other (shown / hidden) */
380
- function shouldComponentUpdate(nextProps, nextState) {
381
- var inputIsDifferent = this.input.mathField.latex() !== nextProps.latex;
382
- log('[shouldComponentUpdate] ', 'inputIsDifferent: ', inputIsDifferent);
383
- if (!(0, _isEqual["default"])(this.props.error, nextProps.error)) {
384
- return true;
385
- }
386
- if (!inputIsDifferent && this.props.keypadMode !== nextProps.keypadMode) {
387
- return true;
388
- }
389
- if (!inputIsDifferent && this.props.noDecimal !== nextProps.noDecimal) {
390
- return true;
391
- }
392
- if (!inputIsDifferent && this.state.equationEditor !== nextState.equationEditor) {
393
- return true;
394
- }
395
- if (!inputIsDifferent && this.props.controlledKeypad) {
396
- return this.props.showKeypad !== nextProps.showKeypad;
397
- }
398
- return inputIsDifferent;
399
- }
400
- }, {
401
- key: "render",
402
- value: function render() {
403
- var _this2 = this;
404
- var _this$props3 = this.props,
405
- classNames = _this$props3.classNames,
406
- keypadMode = _this$props3.keypadMode,
407
- allowAnswerBlock = _this$props3.allowAnswerBlock,
408
- additionalKeys = _this$props3.additionalKeys,
409
- controlledKeypad = _this$props3.controlledKeypad,
410
- controlledKeypadMode = _this$props3.controlledKeypadMode,
411
- showKeypad = _this$props3.showKeypad,
412
- setKeypadInteraction = _this$props3.setKeypadInteraction,
413
- noDecimal = _this$props3.noDecimal,
414
- hideInput = _this$props3.hideInput,
415
- layoutForKeyPad = _this$props3.layoutForKeyPad,
416
- latex = _this$props3.latex,
417
- _onFocus = _this$props3.onFocus,
418
- _onBlur = _this$props3.onBlur,
419
- error = _this$props3.error;
420
- var shouldShowKeypad = !controlledKeypad || controlledKeypad && showKeypad;
421
- var addDisabled = this.state.addDisabled;
422
- log('[render]', latex);
423
- return /*#__PURE__*/_react["default"].createElement(MathToolbarContainer, {
424
- className: classNames.mathToolbar
425
- }, /*#__PURE__*/_react["default"].createElement(InputAndTypeContainer, {
426
- hide: hideInput
427
- }, controlledKeypadMode && /*#__PURE__*/_react["default"].createElement(StyledFormControl, {
428
- variant: 'standard'
429
- }, /*#__PURE__*/_react["default"].createElement(StyledInputLabel, {
430
- id: "equation-editor-label"
431
- }, 'Equation Editor'), /*#__PURE__*/_react["default"].createElement(_Select["default"], {
432
- labelId: "equation-editor-label",
433
- id: "equation-editor-select",
434
- name: "equationEditor",
435
- label: 'Equation Editor',
436
- onChange: this.onEditorTypeChange,
437
- value: this.state.equationEditor,
438
- MenuProps: {
439
- transitionDuration: {
440
- enter: 225,
441
- exit: 195
442
- }
443
- }
444
- }, /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
445
- value: "non-negative-integers"
446
- }, "Numeric - Non-Negative Integers"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
447
- value: "integers"
448
- }, "Numeric - Integers"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
449
- value: "decimals"
450
- }, "Numeric - Decimals"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
451
- value: "fractions"
452
- }, "Numeric - Fractions"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
453
- value: 1
454
- }, "Grade 1 - 2"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
455
- value: 3
456
- }, "Grade 3 - 5"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
457
- value: 6
458
- }, "Grade 6 - 7"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
459
- value: 8
460
- }, "Grade 8 - HS"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
461
- value: 'geometry'
462
- }, "Geometry"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
463
- value: 'advanced-algebra'
464
- }, "Advanced Algebra"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
465
- value: 'statistics'
466
- }, "Statistics"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
467
- value: 'item-authoring'
468
- }, "Item Authoring"))), /*#__PURE__*/_react["default"].createElement(InputContainerDiv, {
469
- error: error
470
- }, /*#__PURE__*/_react["default"].createElement(MathEditor, {
471
- onFocus: function onFocus() {
472
- _onFocus && _onFocus();
473
- _this2.updateDisable(false);
474
- },
475
- onBlur: function onBlur(event) {
476
- _this2.updateDisable(false);
477
- _onBlur && _onBlur(event);
478
- },
479
- className: classNames && classNames.editor || '',
480
- controlledKeypadMode: controlledKeypadMode,
481
- ref: function ref(r) {
482
- return _this2.input = r;
483
- },
484
- latex: latex,
485
- onChange: this.onEditorChange
486
- }))), allowAnswerBlock && /*#__PURE__*/_react["default"].createElement(AddAnswerBlockButton, {
487
- type: "primary",
488
- style: {
489
- bottom: shouldShowKeypad ? '320px' : '20px'
490
- },
491
- onClick: this.onAnswerBlockClick,
492
- disabled: addDisabled
493
- }, "+ Response Area"), /*#__PURE__*/_react["default"].createElement(StyledHr, null), shouldShowKeypad && /*#__PURE__*/_react["default"].createElement(KeyboardContainer, {
494
- mode: controlledKeypadMode ? this.state.equationEditor : keypadMode,
495
- controlledKeypadMode: controlledKeypadMode,
496
- layoutForKeyPad: layoutForKeyPad,
497
- additionalKeys: additionalKeys,
498
- onClick: this.onClick,
499
- noDecimal: noDecimal,
500
- setKeypadInteraction: setKeypadInteraction
501
- }));
502
- }
503
- }]);
504
- }(_react["default"].Component);
505
- (0, _defineProperty2["default"])(EditorAndPad, "propTypes", {
506
- classNames: _propTypes["default"].object,
507
- keypadMode: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
508
- autoFocus: _propTypes["default"].bool,
509
- allowAnswerBlock: _propTypes["default"].bool,
510
- showKeypad: _propTypes["default"].bool,
511
- controlledKeypad: _propTypes["default"].bool,
512
- controlledKeypadMode: _propTypes["default"].bool,
513
- error: _propTypes["default"].string,
514
- noDecimal: _propTypes["default"].bool,
515
- hideInput: _propTypes["default"].bool,
516
- noLatexHandling: _propTypes["default"].bool,
517
- layoutForKeyPad: _propTypes["default"].object,
518
- maxResponseAreas: _propTypes["default"].number,
519
- additionalKeys: _propTypes["default"].array,
520
- latex: _propTypes["default"].string.isRequired,
521
- onAnswerBlockAdd: _propTypes["default"].func,
522
- onFocus: _propTypes["default"].func,
523
- onBlur: _propTypes["default"].func,
524
- onChange: _propTypes["default"].func.isRequired,
525
- setKeypadInteraction: _propTypes["default"].func
526
- });
527
- var _default = exports["default"] = EditorAndPad;
528
- //# sourceMappingURL=editor-and-pad.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"editor-and-pad.js","names":["_react","_interopRequireDefault","require","_debug","_propTypes","_Button","_styles","_MenuItem","_Select","_isEqual","_FormControl","_InputLabel","_mathInput","_renderUi","_utils","_callSuper","t","o","e","_getPrototypeOf2","_possibleConstructorReturn2","_isNativeReflectConstruct","Reflect","construct","constructor","apply","Boolean","prototype","valueOf","call","ownKeys","r","Object","keys","getOwnPropertySymbols","filter","getOwnPropertyDescriptor","enumerable","push","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","_mq$CommonMqStyles","mq","CommonMqStyles","commonMqFontStyles","commonMqKeyboardStyles","longdivStyles","supsubStyles","log","debug","decimalRegex","MathToolbarContainer","styled","_ref","theme","zIndex","position","textAlign","width","border","outline","boxShadow","concat","palette","primary","main","borderRadius","paddingTop","display","borderTop","top","marginTop","minWidth","lineHeight","InputAndTypeContainer","_ref2","hide","alignItems","fontFamily","left","right","verticalAlign","padding","marginLeft","paddingLeft","paddingBottom","marginBottom","StyledFormControl","FormControl","flex","marginRight","StyledInputLabel","InputLabel","backgroundColor","InputContainerDiv","_ref3","error","maxWidth","minHeight","spacing","MathEditor","Input","_ref4","controlledKeypadMode","color","text","background","AddAnswerBlockButton","Button","StyledHr","_ref5","margin","height","borderBottom","KeyboardContainer","HorizontalKeypad","_ref6","mode","toNodeData","data","type","value","EditorAndPad","exports","_React$Component","props","_this","_classCallCheck2","_this$props","noDecimal","noLatexHandling","onChange","c","input","clear","command","keystroke","write","isEdit","maxResponseAreas","shouldDisable","checkResponseAreasNumber","setState","addDisabled","onAnswerBlockAdd","onClick","updateDisable","latex","_this$props2","updateSpans","markFractionBaseSuperscripts","indexOf","replace","regexMatch","match","mathField","__controller","cursor","insLeftOf","parent","el","dispatchEvent","KeyboardEvent","keyCode","console","toString","evt","equationEditor","target","_ref7","count","state","_inherits2","_createClass2","key","componentDidMount","autoFocus","focus","shouldComponentUpdate","nextProps","nextState","inputIsDifferent","isEqual","keypadMode","controlledKeypad","showKeypad","render","_this2","_this$props3","classNames","allowAnswerBlock","additionalKeys","setKeypadInteraction","hideInput","layoutForKeyPad","onFocus","onBlur","shouldShowKeypad","createElement","className","mathToolbar","variant","id","labelId","name","label","onEditorTypeChange","MenuProps","transitionDuration","enter","exit","event","editor","ref","onEditorChange","style","bottom","onAnswerBlockClick","disabled","React","Component","PropTypes","object","oneOfType","string","number","bool","array","isRequired","func","_default"],"sources":["../src/editor-and-pad.jsx"],"sourcesContent":["import React from 'react';\nimport debug from 'debug';\nimport PropTypes from 'prop-types';\nimport Button from '@mui/material/Button';\nimport { styled } from '@mui/material/styles';\nimport MenuItem from '@mui/material/MenuItem';\nimport Select from '@mui/material/Select';\nimport isEqual from 'lodash/isEqual';\nimport FormControl from '@mui/material/FormControl';\nimport InputLabel from '@mui/material/InputLabel';\n\nimport { HorizontalKeypad, mq, updateSpans } from '@pie-lib/math-input';\nimport { color } from '@pie-lib/render-ui';\nimport { markFractionBaseSuperscripts } from './utils';\n\nconst { commonMqFontStyles, commonMqKeyboardStyles, longdivStyles, supsubStyles } = mq.CommonMqStyles;\nconst log = debug('@pie-lib:math-toolbar:editor-and-pad');\n\nconst decimalRegex = /\\.|,/g;\n\nconst MathToolbarContainer = styled('div')(({ theme }) => ({\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 top: '7.8px',\n marginTop: '0px',\n minWidth: '1.23em',\n },\n '& .mq-parallelogram': {\n lineHeight: 0.85,\n },\n}));\n\nconst InputAndTypeContainer = styled('div')(({ theme, hide }) => ({\n display: hide ? 'none' : 'flex',\n alignItems: 'center',\n '& .mq-editable-field .mq-cursor': {\n top: '-4px',\n },\n '& .mq-math-mode .mq-selection, .mq-editable-field .mq-selection': {\n paddingTop: '18px',\n },\n '& .mq-math-mode .mq-overarrow': {\n fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important',\n },\n '& .mq-math-mode .mq-overline .mq-overline-inner': {\n paddingTop: '0.4em !important',\n },\n '& .mq-overarrow.mq-arrow-both': {\n minWidth: '1.23em',\n '& *': {\n lineHeight: '1 !important',\n },\n '&:before': {\n top: '-0.45em',\n left: '-1px',\n },\n '&:after': {\n position: 'absolute !important',\n top: '0px !important',\n right: '-2px',\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 ...commonMqFontStyles,\n ...supsubStyles,\n ...longdivStyles,\n '& .mq-math-mode .mq-sqrt-prefix': {\n verticalAlign: 'baseline !important',\n top: '1px !important',\n left: '-0.1em !important',\n },\n '& .mq-math-mode .mq-overarc ': {\n paddingTop: '0.45em !important',\n },\n '& .mq-math-mode .mq-empty': {\n padding: '9px 1px !important',\n },\n '& .mq-math-mode .mq-root-block': {\n paddingTop: '10px',\n },\n '& .mq-scaled .mq-sqrt-prefix': {\n top: '0 !important',\n },\n '& .mq-math-mode .mq-longdiv .mq-longdiv-inner': {\n marginLeft: '4px !important',\n paddingTop: '6px !important',\n paddingLeft: '6px !important',\n },\n '& .mq-math-mode .mq-paren': {\n verticalAlign: 'top !important',\n padding: '1px 0.1em !important',\n },\n '& .mq-math-mode .mq-sqrt-stem': {\n borderTop: '0.07em solid',\n marginLeft: '-1.5px',\n marginTop: '-2px !important',\n paddingTop: '5px !important',\n },\n '& .mq-math-mode .mq-denominator': {\n marginTop: '-5px !important',\n padding: '0.5em 0.1em 0.1em !important',\n },\n '& .mq-math-mode .mq-numerator, .mq-math-mode .mq-over': {\n padding: '0 0.1em !important',\n paddingBottom: '0 !important',\n marginBottom: '-2px',\n },\n },\n '& span[data-prime=\"true\"]': {\n fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important',\n },\n}));\n\nconst StyledFormControl = styled(FormControl)({\n flex: 'initial',\n width: '25%',\n minWidth: '100px',\n marginLeft: '15px',\n marginTop: '5px',\n marginBottom: '5px',\n marginRight: '5px',\n '& label': {\n fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important',\n },\n '& div': {\n fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important',\n },\n});\n\nconst StyledInputLabel = styled(InputLabel)(() => ({\n backgroundColor: 'transparent',\n}));\n\nconst InputContainerDiv = styled('div')(({ theme, error }) => ({\n minWidth: '500px',\n maxWidth: '900px',\n minHeight: '30px',\n width: '100%',\n display: 'flex',\n marginTop: theme.spacing(1),\n marginBottom: theme.spacing(1),\n ...(error && {\n border: '2px solid red',\n }),\n '& .mq-sqrt-prefix .mq-scaled': {\n verticalAlign: 'middle !important',\n },\n}));\n\nconst MathEditor = styled(mq.Input)(({ controlledKeypadMode }) => ({\n maxWidth: controlledKeypadMode ? '400px' : '500px',\n color: color.text(),\n backgroundColor: color.background(),\n padding: '2px',\n}));\n\nconst AddAnswerBlockButton = styled(Button)({\n position: 'absolute',\n right: '12px',\n border: '1px solid lightgrey',\n color: color.text(),\n});\n\nconst StyledHr = styled('hr')(({ theme }) => ({\n padding: 0,\n margin: 0,\n height: '1px',\n border: 'none',\n borderBottom: `solid 1px ${theme.palette.primary.main}`,\n}));\n\nconst KeyboardContainer = styled(HorizontalKeypad)(({ mode }) => ({\n ...commonMqKeyboardStyles,\n ...(mode === 'language' && {\n '& *': {\n fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important',\n },\n }),\n}));\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 error: PropTypes.string,\n noDecimal: PropTypes.bool,\n hideInput: PropTypes.bool,\n noLatexHandling: PropTypes.bool,\n layoutForKeyPad: PropTypes.object,\n maxResponseAreas: PropTypes.number,\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 setKeypadInteraction: PropTypes.func,\n };\n\n constructor(props) {\n super(props);\n\n this.state = { equationEditor: 'item-authoring', addDisabled: false };\n }\n\n componentDidMount() {\n if (this.input && this.props.autoFocus) {\n this.input.focus();\n }\n }\n\n onClick = (data) => {\n const { noDecimal, noLatexHandling, onChange } = this.props;\n const c = toNodeData(data);\n log('mathChange: ', c);\n\n if (noLatexHandling) {\n onChange(c.value);\n return;\n }\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) {\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 updateDisable = (isEdit) => {\n const { maxResponseAreas } = this.props;\n\n if (maxResponseAreas) {\n const shouldDisable = this.checkResponseAreasNumber(maxResponseAreas, isEdit);\n\n this.setState({ addDisabled: shouldDisable });\n }\n };\n\n onAnswerBlockClick = () => {\n this.props.onAnswerBlockAdd();\n this.onClick({\n type: 'answer',\n });\n\n this.updateDisable(true);\n };\n\n onEditorChange = (latex) => {\n const { onChange, noDecimal } = this.props;\n\n updateSpans();\n markFractionBaseSuperscripts();\n\n this.updateDisable(true);\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 // eslint-disable-next-line no-useless-escape\n const regexMatch = latex.match(/[0-9]\\\\ \\\\frac\\{[^\\{]*\\}\\{ \\}/);\n\n if (this.input && regexMatch && regexMatch?.length) {\n try {\n this.input.mathField.__controller.cursor.insLeftOf(this.input.mathField.__controller.cursor.parent[-1].parent);\n this.input.mathField.el().dispatchEvent(new KeyboardEvent('keydown', { keyCode: 8 }));\n } catch (e) {\n // eslint-disable-next-line no-console\n console.error(e.toString());\n }\n\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 (!isEqual(this.props.error, nextProps.error)) {\n return true;\n }\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 checkResponseAreasNumber = (maxResponseAreas, isEdit) => {\n const { latex } = (this.input && this.input.props) || {};\n\n if (latex) {\n const count = (latex.match(/answerBlock/g) || []).length;\n\n return isEdit ? count === maxResponseAreas - 1 : count === maxResponseAreas;\n }\n\n return false;\n };\n\n render() {\n const {\n classNames,\n keypadMode,\n allowAnswerBlock,\n additionalKeys,\n controlledKeypad,\n controlledKeypadMode,\n showKeypad,\n setKeypadInteraction,\n noDecimal,\n hideInput,\n layoutForKeyPad,\n latex,\n onFocus,\n onBlur,\n error,\n } = this.props;\n const shouldShowKeypad = !controlledKeypad || (controlledKeypad && showKeypad);\n const { addDisabled } = this.state;\n\n log('[render]', latex);\n\n return (\n <MathToolbarContainer className={classNames.mathToolbar}>\n <InputAndTypeContainer hide={hideInput}>\n {controlledKeypadMode && (\n <StyledFormControl variant={'standard'}>\n <StyledInputLabel id=\"equation-editor-label\">{'Equation Editor'}</StyledInputLabel>\n <Select\n labelId=\"equation-editor-label\"\n id=\"equation-editor-select\"\n name=\"equationEditor\"\n label={'Equation Editor'}\n onChange={this.onEditorTypeChange}\n value={this.state.equationEditor}\n MenuProps={{ transitionDuration: { enter: 225, exit: 195 } }}\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 </StyledFormControl>\n )}\n <InputContainerDiv error={error}>\n <MathEditor\n onFocus={() => {\n onFocus && onFocus();\n this.updateDisable(false);\n }}\n onBlur={(event) => {\n this.updateDisable(false);\n onBlur && onBlur(event);\n }}\n className={(classNames && classNames.editor) || ''}\n controlledKeypadMode={controlledKeypadMode}\n ref={(r) => (this.input = r)}\n latex={latex}\n onChange={this.onEditorChange}\n />\n </InputContainerDiv>\n </InputAndTypeContainer>\n {allowAnswerBlock && (\n <AddAnswerBlockButton\n type=\"primary\"\n style={{ bottom: shouldShowKeypad ? '320px' : '20px' }}\n onClick={this.onAnswerBlockClick}\n disabled={addDisabled}\n >\n + Response Area\n </AddAnswerBlockButton>\n )}\n <StyledHr />\n {shouldShowKeypad && (\n <KeyboardContainer\n mode={controlledKeypadMode ? this.state.equationEditor : keypadMode}\n controlledKeypadMode={controlledKeypadMode}\n layoutForKeyPad={layoutForKeyPad}\n additionalKeys={additionalKeys}\n onClick={this.onClick}\n noDecimal={noDecimal}\n setKeypadInteraction={setKeypadInteraction}\n />\n )}\n </MathToolbarContainer>\n );\n }\n}\n\nexport default EditorAndPad;\n"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,OAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,OAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,QAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,YAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,WAAA,GAAAV,sBAAA,CAAAC,OAAA;AAEA,IAAAU,UAAA,GAAAV,OAAA;AACA,IAAAW,SAAA,GAAAX,OAAA;AACA,IAAAY,MAAA,GAAAZ,OAAA;AAAuD,SAAAa,WAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,WAAAD,CAAA,OAAAE,gBAAA,aAAAF,CAAA,OAAAG,2BAAA,aAAAJ,CAAA,EAAAK,yBAAA,KAAAC,OAAA,CAAAC,SAAA,CAAAN,CAAA,EAAAC,CAAA,YAAAC,gBAAA,aAAAH,CAAA,EAAAQ,WAAA,IAAAP,CAAA,CAAAQ,KAAA,CAAAT,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,MAAM;EACvB/F,SAAS,EAAE4F,qBAAS,CAACK,IAAI;EACzBjC,SAAS,EAAE4B,qBAAS,CAACK,IAAI;EACzBhG,eAAe,EAAE2F,qBAAS,CAACK,IAAI;EAC/BhC,eAAe,EAAE2B,qBAAS,CAACC,MAAM;EACjCnF,gBAAgB,EAAEkF,qBAAS,CAACI,MAAM;EAClClC,cAAc,EAAE8B,qBAAS,CAACM,KAAK;EAC/BhF,KAAK,EAAE0E,qBAAS,CAACG,MAAM,CAACI,UAAU;EAClCpF,gBAAgB,EAAE6E,qBAAS,CAACQ,IAAI;EAChClC,OAAO,EAAE0B,qBAAS,CAACQ,IAAI;EACvBjC,MAAM,EAAEyB,qBAAS,CAACQ,IAAI;EACtBlG,QAAQ,EAAE0F,qBAAS,CAACQ,IAAI,CAACD,UAAU;EACnCpC,oBAAoB,EAAE6B,qBAAS,CAACQ;AAClC,CAAC;AAAA,IAAAC,QAAA,GAAA3G,OAAA,cAkPYD,YAAY","ignoreList":[]}
package/lib/index.js DELETED
@@ -1,241 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- Object.defineProperty(exports, "MathPreview", {
8
- enumerable: true,
9
- get: function get() {
10
- return _mathPreview["default"];
11
- }
12
- });
13
- exports.RawPureToolbar = exports.PureToolbar = exports.MathToolbar = void 0;
14
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
15
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
16
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
17
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
18
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
19
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
20
- var _react = _interopRequireDefault(require("react"));
21
- var _propTypes = _interopRequireDefault(require("prop-types"));
22
- var _editorAndPad = _interopRequireDefault(require("./editor-and-pad"));
23
- var _doneButton = require("./done-button");
24
- var _styles = require("@mui/material/styles");
25
- var _mathPreview = _interopRequireDefault(require("./math-preview"));
26
- function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
27
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
28
- var PureToolbarContainer = (0, _styles.styled)('div')({
29
- display: 'flex',
30
- width: '100%',
31
- zIndex: 8,
32
- alignItems: 'center'
33
- });
34
- var MathToolbar = exports.MathToolbar = /*#__PURE__*/function (_React$Component) {
35
- function MathToolbar(props) {
36
- var _this;
37
- (0, _classCallCheck2["default"])(this, MathToolbar);
38
- _this = _callSuper(this, MathToolbar, [props]);
39
- (0, _defineProperty2["default"])(_this, "done", function () {
40
- _this.props.onDone(_this.state.latex);
41
- });
42
- (0, _defineProperty2["default"])(_this, "onChange", function (latex) {
43
- _this.setState({
44
- latex: latex
45
- });
46
- _this.props.onChange(latex);
47
- });
48
- _this.state = {
49
- latex: props.latex
50
- };
51
- return _this;
52
- }
53
- (0, _inherits2["default"])(MathToolbar, _React$Component);
54
- return (0, _createClass2["default"])(MathToolbar, [{
55
- key: "UNSAFE_componentWillReceiveProps",
56
- value: function UNSAFE_componentWillReceiveProps(nextProps) {
57
- this.setState({
58
- latex: nextProps.latex
59
- });
60
- }
61
- }, {
62
- key: "render",
63
- value: function render() {
64
- var latex = this.state.latex;
65
- var _this$props = this.props,
66
- classNames = _this$props.classNames,
67
- autoFocus = _this$props.autoFocus,
68
- allowAnswerBlock = _this$props.allowAnswerBlock,
69
- onAnswerBlockAdd = _this$props.onAnswerBlockAdd,
70
- controlledKeypad = _this$props.controlledKeypad,
71
- controlledKeypadMode = _this$props.controlledKeypadMode,
72
- keypadMode = _this$props.keypadMode,
73
- noDecimal = _this$props.noDecimal,
74
- additionalKeys = _this$props.additionalKeys,
75
- showKeypad = _this$props.showKeypad,
76
- onFocus = _this$props.onFocus,
77
- onBlur = _this$props.onBlur,
78
- hideDoneButton = _this$props.hideDoneButton,
79
- error = _this$props.error,
80
- keyPadCharacterRef = _this$props.keyPadCharacterRef,
81
- setKeypadInteraction = _this$props.setKeypadInteraction,
82
- maxResponseAreas = _this$props.maxResponseAreas;
83
- return /*#__PURE__*/_react["default"].createElement(PureToolbar, {
84
- autoFocus: autoFocus,
85
- classNames: classNames,
86
- onAnswerBlockAdd: onAnswerBlockAdd,
87
- allowAnswerBlock: allowAnswerBlock,
88
- latex: latex,
89
- additionalKeys: additionalKeys,
90
- noDecimal: noDecimal,
91
- keypadMode: keypadMode,
92
- keyPadCharacterRef: keyPadCharacterRef,
93
- setKeypadInteraction: setKeypadInteraction,
94
- onChange: this.onChange,
95
- onDone: this.done,
96
- onFocus: onFocus,
97
- onBlur: onBlur,
98
- showKeypad: showKeypad,
99
- controlledKeypad: controlledKeypad,
100
- controlledKeypadMode: controlledKeypadMode,
101
- hideDoneButton: hideDoneButton,
102
- error: error,
103
- maxResponseAreas: maxResponseAreas
104
- });
105
- }
106
- }]);
107
- }(_react["default"].Component);
108
- (0, _defineProperty2["default"])(MathToolbar, "propTypes", {
109
- autoFocus: _propTypes["default"].bool,
110
- allowAnswerBlock: _propTypes["default"].bool,
111
- controlledKeypad: _propTypes["default"].bool,
112
- controlledKeypadMode: _propTypes["default"].bool,
113
- keypadMode: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
114
- classNames: _propTypes["default"].object,
115
- error: _propTypes["default"].string,
116
- maxResponseAreas: _propTypes["default"].number,
117
- showKeypad: _propTypes["default"].bool,
118
- noDecimal: _propTypes["default"].bool,
119
- additionalKeys: _propTypes["default"].array,
120
- latex: _propTypes["default"].string.isRequired,
121
- onAnswerBlockAdd: _propTypes["default"].func,
122
- onChange: _propTypes["default"].func,
123
- onDone: _propTypes["default"].func.isRequired,
124
- onFocus: _propTypes["default"].func,
125
- onBlur: _propTypes["default"].func,
126
- hideDoneButton: _propTypes["default"].bool,
127
- keyPadCharacterRef: _propTypes["default"].func,
128
- setKeypadInteraction: _propTypes["default"].func
129
- });
130
- (0, _defineProperty2["default"])(MathToolbar, "defaultProps", {
131
- classNames: {},
132
- keypadMode: 'item-authoring',
133
- autoFocus: false,
134
- allowAnswerBlock: false,
135
- controlledKeypad: false,
136
- controlledKeypadMode: false,
137
- noDecimal: false,
138
- showKeypad: true,
139
- additionalKeys: [],
140
- onChange: function onChange() {},
141
- onAnswerBlockAdd: function onAnswerBlockAdd() {},
142
- onFocus: function onFocus() {},
143
- hideDoneButton: false
144
- });
145
- var RawPureToolbar = exports.RawPureToolbar = /*#__PURE__*/function (_React$Component2) {
146
- function RawPureToolbar() {
147
- (0, _classCallCheck2["default"])(this, RawPureToolbar);
148
- return _callSuper(this, RawPureToolbar, arguments);
149
- }
150
- (0, _inherits2["default"])(RawPureToolbar, _React$Component2);
151
- return (0, _createClass2["default"])(RawPureToolbar, [{
152
- key: "render",
153
- value: function render() {
154
- var _this$props2 = this.props,
155
- classNames = _this$props2.classNames,
156
- autoFocus = _this$props2.autoFocus,
157
- allowAnswerBlock = _this$props2.allowAnswerBlock,
158
- onAnswerBlockAdd = _this$props2.onAnswerBlockAdd,
159
- controlledKeypad = _this$props2.controlledKeypad,
160
- controlledKeypadMode = _this$props2.controlledKeypadMode,
161
- additionalKeys = _this$props2.additionalKeys,
162
- showKeypad = _this$props2.showKeypad,
163
- keypadMode = _this$props2.keypadMode,
164
- noDecimal = _this$props2.noDecimal,
165
- hideInput = _this$props2.hideInput,
166
- noLatexHandling = _this$props2.noLatexHandling,
167
- layoutForKeyPad = _this$props2.layoutForKeyPad,
168
- keyPadCharacterRef = _this$props2.keyPadCharacterRef,
169
- setKeypadInteraction = _this$props2.setKeypadInteraction,
170
- latex = _this$props2.latex,
171
- onChange = _this$props2.onChange,
172
- onDone = _this$props2.onDone,
173
- onFocus = _this$props2.onFocus,
174
- onBlur = _this$props2.onBlur,
175
- hideDoneButton = _this$props2.hideDoneButton,
176
- hideDoneButtonBackground = _this$props2.hideDoneButtonBackground,
177
- error = _this$props2.error,
178
- maxResponseAreas = _this$props2.maxResponseAreas;
179
- return /*#__PURE__*/_react["default"].createElement(PureToolbarContainer, {
180
- className: classNames && classNames.toolbar || '',
181
- ref: keyPadCharacterRef
182
- }, /*#__PURE__*/_react["default"].createElement("div", null), /*#__PURE__*/_react["default"].createElement(_editorAndPad["default"], {
183
- autoFocus: autoFocus,
184
- keypadMode: keypadMode,
185
- classNames: classNames || {},
186
- controlledKeypad: controlledKeypad,
187
- controlledKeypadMode: controlledKeypadMode,
188
- noDecimal: noDecimal,
189
- hideInput: hideInput,
190
- noLatexHandling: noLatexHandling,
191
- layoutForKeyPad: layoutForKeyPad,
192
- showKeypad: showKeypad,
193
- additionalKeys: additionalKeys,
194
- allowAnswerBlock: allowAnswerBlock,
195
- onAnswerBlockAdd: onAnswerBlockAdd,
196
- latex: latex,
197
- onChange: onChange,
198
- onFocus: onFocus,
199
- onBlur: onBlur,
200
- error: error,
201
- maxResponseAreas: maxResponseAreas,
202
- setKeypadInteraction: setKeypadInteraction
203
- }), (!controlledKeypad || controlledKeypad && showKeypad) && !hideDoneButton && /*#__PURE__*/_react["default"].createElement(_doneButton.DoneButton, {
204
- hideBackground: hideDoneButtonBackground,
205
- onClick: onDone
206
- }));
207
- }
208
- }]);
209
- }(_react["default"].Component);
210
- (0, _defineProperty2["default"])(RawPureToolbar, "propTypes", {
211
- classNames: _propTypes["default"].object,
212
- latex: _propTypes["default"].string.isRequired,
213
- keypadMode: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
214
- hideInput: _propTypes["default"].bool,
215
- noLatexHandling: _propTypes["default"].bool,
216
- layoutForKeyPad: _propTypes["default"].object,
217
- onChange: _propTypes["default"].func.isRequired,
218
- onDone: _propTypes["default"].func.isRequired,
219
- onBlur: _propTypes["default"].func,
220
- onAnswerBlockAdd: _propTypes["default"].func,
221
- additionalKeys: _propTypes["default"].array,
222
- onFocus: _propTypes["default"].func,
223
- autoFocus: _propTypes["default"].bool,
224
- noDecimal: _propTypes["default"].bool,
225
- allowAnswerBlock: _propTypes["default"].bool,
226
- controlledKeypad: _propTypes["default"].bool,
227
- controlledKeypadMode: _propTypes["default"].bool,
228
- showKeypad: _propTypes["default"].bool,
229
- hideDoneButton: _propTypes["default"].bool,
230
- hideDoneButtonBackground: _propTypes["default"].bool,
231
- error: _propTypes["default"].any,
232
- maxResponseAreas: _propTypes["default"].number,
233
- keyPadCharacterRef: _propTypes["default"].object,
234
- setKeypadInteraction: _propTypes["default"].func
235
- });
236
- (0, _defineProperty2["default"])(RawPureToolbar, "defaultProps", {
237
- classNames: {},
238
- hideDoneButtonBackground: false
239
- });
240
- var PureToolbar = exports.PureToolbar = RawPureToolbar;
241
- //# sourceMappingURL=index.js.map
package/lib/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["_react","_interopRequireDefault","require","_propTypes","_editorAndPad","_doneButton","_styles","_mathPreview","_callSuper","t","o","e","_getPrototypeOf2","_possibleConstructorReturn2","_isNativeReflectConstruct","Reflect","construct","constructor","apply","Boolean","prototype","valueOf","call","PureToolbarContainer","styled","display","width","zIndex","alignItems","MathToolbar","exports","_React$Component","props","_this","_classCallCheck2","_defineProperty2","onDone","state","latex","setState","onChange","_inherits2","_createClass2","key","value","UNSAFE_componentWillReceiveProps","nextProps","render","_this$props","classNames","autoFocus","allowAnswerBlock","onAnswerBlockAdd","controlledKeypad","controlledKeypadMode","keypadMode","noDecimal","additionalKeys","showKeypad","onFocus","onBlur","hideDoneButton","error","keyPadCharacterRef","setKeypadInteraction","maxResponseAreas","createElement","PureToolbar","done","React","Component","PropTypes","bool","oneOfType","string","number","object","array","isRequired","func","RawPureToolbar","_React$Component2","arguments","_this$props2","hideInput","noLatexHandling","layoutForKeyPad","hideDoneButtonBackground","className","toolbar","ref","DoneButton","hideBackground","onClick","any"],"sources":["../src/index.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport EditorAndPad from './editor-and-pad';\nimport { DoneButton } from './done-button';\nimport { styled } from '@mui/material/styles';\nimport MathPreview from './math-preview';\n\nexport { MathPreview };\n\nconst PureToolbarContainer = styled('div')({\n display: 'flex',\n width: '100%',\n zIndex: 8,\n alignItems: 'center',\n});\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 error: PropTypes.string,\n maxResponseAreas: PropTypes.number,\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 keyPadCharacterRef: PropTypes.func,\n setKeypadInteraction: PropTypes.func,\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 error,\n keyPadCharacterRef,\n setKeypadInteraction,\n maxResponseAreas,\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 keyPadCharacterRef={keyPadCharacterRef}\n setKeypadInteraction={setKeypadInteraction}\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 error={error}\n maxResponseAreas={maxResponseAreas}\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 hideInput: PropTypes.bool,\n noLatexHandling: PropTypes.bool,\n layoutForKeyPad: PropTypes.object,\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 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 hideDoneButtonBackground: PropTypes.bool,\n error: PropTypes.any,\n maxResponseAreas: PropTypes.number,\n keyPadCharacterRef: PropTypes.object,\n setKeypadInteraction: PropTypes.func,\n };\n\n static defaultProps = {\n classNames: {},\n hideDoneButtonBackground: false,\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 hideInput,\n noLatexHandling,\n layoutForKeyPad,\n keyPadCharacterRef,\n setKeypadInteraction,\n latex,\n onChange,\n onDone,\n onFocus,\n onBlur,\n hideDoneButton,\n hideDoneButtonBackground,\n error,\n maxResponseAreas,\n } = this.props;\n\n return (\n <PureToolbarContainer className={(classNames && classNames.toolbar) || ''} ref={keyPadCharacterRef}>\n <div />\n <EditorAndPad\n autoFocus={autoFocus}\n keypadMode={keypadMode}\n classNames={classNames || {}}\n controlledKeypad={controlledKeypad}\n controlledKeypadMode={controlledKeypadMode}\n noDecimal={noDecimal}\n hideInput={hideInput}\n noLatexHandling={noLatexHandling}\n layoutForKeyPad={layoutForKeyPad}\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 error={error}\n maxResponseAreas={maxResponseAreas}\n setKeypadInteraction={setKeypadInteraction}\n />\n {(!controlledKeypad || (controlledKeypad && showKeypad)) && !hideDoneButton && (\n <DoneButton hideBackground={hideDoneButtonBackground} onClick={onDone} />\n )}\n </PureToolbarContainer>\n );\n }\n}\n\nexport const PureToolbar = RawPureToolbar;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,aAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,O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ACI,MAAM,CAAC,CAAC;EACrES,SAAS,EAAEb,qBAAS,CAACC,IAAI;EACzBa,eAAe,EAAEd,qBAAS,CAACC,IAAI;EAC/Bc,eAAe,EAAEf,qBAAS,CAACK,MAAM;EACjCpC,QAAQ,EAAE+B,qBAAS,CAACQ,IAAI,CAACD,UAAU;EACnC1C,MAAM,EAAEmC,qBAAS,CAACQ,IAAI,CAACD,UAAU;EACjClB,MAAM,EAAEW,qBAAS,CAACQ,IAAI;EACtB3B,gBAAgB,EAAEmB,qBAAS,CAACQ,IAAI;EAChCtB,cAAc,EAAEc,qBAAS,CAACM,KAAK;EAC/BlB,OAAO,EAAEY,qBAAS,CAACQ,IAAI;EACvB7B,SAAS,EAAEqB,qBAAS,CAACC,IAAI;EACzBhB,SAAS,EAAEe,qBAAS,CAACC,IAAI;EACzBrB,gBAAgB,EAAEoB,qBAAS,CAACC,IAAI;EAChCnB,gBAAgB,EAAEkB,qBAAS,CAACC,IAAI;EAChClB,oBAAoB,EAAEiB,qBAAS,CAACC,IAAI;EACpCd,UAAU,EAAEa,qBAAS,CAACC,IAAI;EAC1BX,cAAc,EAAEU,qBAAS,CAACC,IAAI;EAC9Be,wBAAwB,EAAEhB,qBAAS,CAACC,IAAI;EACxCV,KAAK,EAAES,qBAAS,CAACuB,GAAG;EACpB7B,gBAAgB,EAAEM,qBAAS,CAACI,MAAM;EAClCZ,kBAAkB,EAAEQ,qBAAS,CAACK,MAAM;EACpCZ,oBAAoB,EAAEO,qBAAS,CAACQ;AAClC,CAAC;AAAA,IAAA5C,gBAAA,aA1BU6C,cAAc,kBA4BH;EACpB/B,UAAU,EAAE,CAAC,CAAC;EACdsC,wBAAwB,EAAE;AAC5B,CAAC;AA+DI,IAAMpB,WAAW,GAAArC,OAAA,CAAAqC,WAAA,GAAGa,cAAc","ignoreList":[]}
@@ -1,193 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports["default"] = exports.RawMathPreview = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
11
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
12
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
13
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
- var _react = _interopRequireDefault(require("react"));
15
- var _debug = _interopRequireDefault(require("debug"));
16
- var _styles = require("@mui/material/styles");
17
- var _propTypes = _interopRequireDefault(require("prop-types"));
18
- var _mathInput = require("@pie-lib/math-input");
19
- var _utils = require("./utils");
20
- function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
21
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
22
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
23
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
24
- var _mq$CommonMqStyles = _mathInput.mq.CommonMqStyles,
25
- commonMqFontStyles = _mq$CommonMqStyles.commonMqFontStyles,
26
- longdivStyles = _mq$CommonMqStyles.longdivStyles,
27
- supsubStyles = _mq$CommonMqStyles.supsubStyles;
28
- var log = (0, _debug["default"])('@pie-lib:math-toolbar:math-preview');
29
- var MathPreviewContainer = (0, _styles.styled)('div')(function (_ref) {
30
- var theme = _ref.theme,
31
- isSelected = _ref.isSelected;
32
- return _objectSpread(_objectSpread(_objectSpread({
33
- display: 'inline-flex',
34
- alignItems: 'center',
35
- position: 'relative',
36
- '& *': commonMqFontStyles
37
- }, supsubStyles), longdivStyles), {}, {
38
- '& > .mq-math-mode': {
39
- border: isSelected ? 'solid 0px lightgrey' : 'solid 1px lightgrey'
40
- },
41
- '& > .mq-focused': {
42
- outline: 'none',
43
- boxShadow: 'none',
44
- border: 'solid 1px black',
45
- borderRadius: '0px'
46
- },
47
- '& > .mq-math-mode .mq-root-block': {
48
- paddingTop: '7px !important'
49
- },
50
- '& > .mq-math-mode .mq-overarc ': {
51
- paddingTop: '0.45em !important'
52
- },
53
- '& > .mq-math-mode .mq-sqrt-prefix': {
54
- verticalAlign: 'baseline !important',
55
- top: '1px !important',
56
- left: '-0.1em !important'
57
- },
58
- '& > .mq-math-mode .mq-denominator': {
59
- marginTop: '-5px !important',
60
- padding: '0.5em 0.1em 0.1em !important'
61
- },
62
- '& > .mq-math-mode .mq-numerator, .mq-math-mode .mq-over': {
63
- padding: '0 0.1em !important',
64
- paddingBottom: '0 !important',
65
- marginBottom: '-2px'
66
- },
67
- '& > .mq-math-mode .mq-longdiv .mq-longdiv-inner .mq-empty': {
68
- paddingTop: '6px !important',
69
- paddingLeft: '4px !important'
70
- },
71
- '& > .mq-math-mode .mq-longdiv .mq-longdiv-inner': {
72
- marginLeft: '0 !important'
73
- },
74
- '& > .mq-math-mode .mq-overarrow': {
75
- fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important'
76
- },
77
- '& > .mq-math-mode .mq-paren': {
78
- verticalAlign: 'top !important',
79
- padding: '1px 0.1em !important'
80
- },
81
- '& > .mq-math-mode .mq-sqrt-stem': {
82
- borderTop: '0.07em solid',
83
- marginLeft: '-1.5px',
84
- marginTop: '-2px !important',
85
- paddingTop: '5px !important'
86
- },
87
- '& .mq-overarrow-inner': {
88
- paddingTop: '0 !important',
89
- border: 'none !important'
90
- },
91
- '& .mq-editable-field .mq-cursor': {
92
- marginTop: '-15px !important'
93
- },
94
- '& .mq-overarrow.mq-arrow-both': {
95
- top: '7.5px',
96
- marginTop: '0px',
97
- minWidth: '1.23em',
98
- '& *': {
99
- lineHeight: '1 !important'
100
- },
101
- '&:before': {
102
- top: '-0.4em',
103
- left: '-1px'
104
- },
105
- '&:after': {
106
- top: '0px !important',
107
- position: 'absolute !important',
108
- right: '-2px'
109
- },
110
- '&.mq-empty:after': {
111
- top: '-0.45em'
112
- }
113
- },
114
- '& .mq-overarrow.mq-arrow-right': {
115
- '&:before': {
116
- top: '-0.4em',
117
- right: '-1px'
118
- }
119
- },
120
- '& .mq-overarrow-inner-right': {
121
- display: 'none !important'
122
- },
123
- '& .mq-overarrow-inner-left': {
124
- display: 'none !important'
125
- },
126
- '& .mq-longdiv-inner': {
127
- borderTop: '1px solid !important',
128
- paddingTop: '1.5px !important'
129
- },
130
- '& .mq-parallelogram': {
131
- lineHeight: 0.85
132
- },
133
- '& span[data-prime="true"]': {
134
- fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important'
135
- }
136
- }, isSelected && {
137
- border: "solid 1px ".concat(theme.palette.primary.main)
138
- });
139
- });
140
- var InsideOverlay = (0, _styles.styled)('span')({
141
- position: 'absolute',
142
- bottom: 0,
143
- left: 0,
144
- right: 0,
145
- top: 0
146
- });
147
- var RawMathPreview = exports.RawMathPreview = /*#__PURE__*/function (_React$Component) {
148
- function RawMathPreview() {
149
- (0, _classCallCheck2["default"])(this, RawMathPreview);
150
- return _callSuper(this, RawMathPreview, arguments);
151
- }
152
- (0, _inherits2["default"])(RawMathPreview, _React$Component);
153
- return (0, _createClass2["default"])(RawMathPreview, [{
154
- key: "componentDidMount",
155
- value: function componentDidMount() {
156
- (0, _utils.markFractionBaseSuperscripts)();
157
- }
158
- }, {
159
- key: "componentDidUpdate",
160
- value: function componentDidUpdate(prevProps) {
161
- // Re-run only if LaTeX changed
162
- if (this.props.node.data.get('latex') !== prevProps.node.data.get('latex')) {
163
- (0, _utils.markFractionBaseSuperscripts)();
164
- }
165
- }
166
- }, {
167
- key: "render",
168
- value: function render() {
169
- log('[render] data: ', this.props.node.data);
170
- var latex = this.props.node.data.get('latex');
171
- var _this$props = this.props,
172
- isSelected = _this$props.isSelected,
173
- onFocus = _this$props.onFocus,
174
- onBlur = _this$props.onBlur;
175
- return /*#__PURE__*/_react["default"].createElement(MathPreviewContainer, {
176
- isSelected: isSelected
177
- }, ' ', /*#__PURE__*/_react["default"].createElement(InsideOverlay, null), /*#__PURE__*/_react["default"].createElement(_mathInput.mq.Static, {
178
- latex: latex,
179
- onFocus: onFocus,
180
- onBlur: onBlur
181
- }));
182
- }
183
- }]);
184
- }(_react["default"].Component);
185
- (0, _defineProperty2["default"])(RawMathPreview, "propTypes", {
186
- latex: _propTypes["default"].string,
187
- node: _propTypes["default"].object,
188
- isSelected: _propTypes["default"].bool,
189
- onFocus: _propTypes["default"].func,
190
- onBlur: _propTypes["default"].func
191
- });
192
- var _default = exports["default"] = RawMathPreview;
193
- //# sourceMappingURL=math-preview.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"math-preview.js","names":["_react","_interopRequireDefault","require","_debug","_styles","_propTypes","_mathInput","_utils","_callSuper","t","o","e","_getPrototypeOf2","_possibleConstructorReturn2","_isNativeReflectConstruct","Reflect","construct","constructor","apply","Boolean","prototype","valueOf","call","ownKeys","r","Object","keys","getOwnPropertySymbols","filter","getOwnPropertyDescriptor","enumerable","push","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","_mq$CommonMqStyles","mq","CommonMqStyles","commonMqFontStyles","longdivStyles","supsubStyles","log","debug","MathPreviewContainer","styled","_ref","theme","isSelected","display","alignItems","position","border","outline","boxShadow","borderRadius","paddingTop","verticalAlign","top","left","marginTop","padding","paddingBottom","marginBottom","paddingLeft","marginLeft","fontFamily","borderTop","minWidth","lineHeight","right","concat","palette","primary","main","InsideOverlay","bottom","RawMathPreview","exports","_React$Component","_classCallCheck2","_inherits2","_createClass2","key","value","componentDidMount","markFractionBaseSuperscripts","componentDidUpdate","prevProps","props","node","data","get","render","latex","_this$props","onFocus","onBlur","createElement","Static","React","Component","PropTypes","string","object","bool","func","_default"],"sources":["../src/math-preview.jsx"],"sourcesContent":["import React from 'react';\nimport debug from 'debug';\nimport { styled } from '@mui/material/styles';\nimport PropTypes from 'prop-types';\nimport { mq } from '@pie-lib/math-input';\nimport { markFractionBaseSuperscripts } from './utils';\n\nconst { commonMqFontStyles, longdivStyles, supsubStyles } = mq.CommonMqStyles;\n\nconst log = debug('@pie-lib:math-toolbar:math-preview');\n\nconst MathPreviewContainer = styled('div')(({ theme, isSelected }) => ({\n display: 'inline-flex',\n alignItems: 'center',\n position: 'relative',\n '& *': commonMqFontStyles,\n ...supsubStyles,\n ...longdivStyles,\n '& > .mq-math-mode': {\n border: isSelected ? 'solid 0px lightgrey' : 'solid 1px lightgrey',\n },\n '& > .mq-focused': {\n outline: 'none',\n boxShadow: 'none',\n border: 'solid 1px black',\n borderRadius: '0px',\n },\n '& > .mq-math-mode .mq-root-block': {\n paddingTop: '7px !important',\n },\n '& > .mq-math-mode .mq-overarc ': {\n paddingTop: '0.45em !important',\n },\n '& > .mq-math-mode .mq-sqrt-prefix': {\n verticalAlign: 'baseline !important',\n top: '1px !important',\n left: '-0.1em !important',\n },\n '& > .mq-math-mode .mq-denominator': {\n marginTop: '-5px !important',\n padding: '0.5em 0.1em 0.1em !important',\n },\n '& > .mq-math-mode .mq-numerator, .mq-math-mode .mq-over': {\n padding: '0 0.1em !important',\n paddingBottom: '0 !important',\n marginBottom: '-2px',\n },\n '& > .mq-math-mode .mq-longdiv .mq-longdiv-inner .mq-empty': {\n paddingTop: '6px !important',\n paddingLeft: '4px !important',\n },\n '& > .mq-math-mode .mq-longdiv .mq-longdiv-inner': {\n marginLeft: '0 !important',\n },\n '& > .mq-math-mode .mq-overarrow': {\n fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important',\n },\n '& > .mq-math-mode .mq-paren': {\n verticalAlign: 'top !important',\n padding: '1px 0.1em !important',\n },\n '& > .mq-math-mode .mq-sqrt-stem': {\n borderTop: '0.07em solid',\n marginLeft: '-1.5px',\n marginTop: '-2px !important',\n paddingTop: '5px !important',\n },\n '& .mq-overarrow-inner': {\n paddingTop: '0 !important',\n border: 'none !important',\n },\n '& .mq-editable-field .mq-cursor': {\n marginTop: '-15px !important',\n },\n '& .mq-overarrow.mq-arrow-both': {\n top: '7.5px',\n marginTop: '0px',\n minWidth: '1.23em',\n '& *': {\n lineHeight: '1 !important',\n },\n '&:before': {\n top: '-0.4em',\n left: '-1px',\n },\n '&:after': {\n top: '0px !important',\n position: 'absolute !important',\n right: '-2px',\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 '& span[data-prime=\"true\"]': {\n fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important',\n },\n ...(isSelected && {\n border: `solid 1px ${theme.palette.primary.main}`,\n }),\n}));\n\nconst InsideOverlay = styled('span')({\n position: 'absolute',\n bottom: 0,\n left: 0,\n right: 0,\n top: 0,\n});\n\nexport class RawMathPreview extends React.Component {\n static propTypes = {\n latex: PropTypes.string,\n node: PropTypes.object,\n isSelected: PropTypes.bool,\n onFocus: PropTypes.func,\n onBlur: PropTypes.func,\n };\n\n componentDidMount() {\n markFractionBaseSuperscripts();\n }\n\n componentDidUpdate(prevProps) {\n // Re-run only if LaTeX changed\n if (this.props.node.data.get('latex') !== prevProps.node.data.get('latex')) {\n markFractionBaseSuperscripts();\n }\n }\n\n render() {\n log('[render] data: ', this.props.node.data);\n const latex = this.props.node.data.get('latex');\n const { isSelected, onFocus, onBlur } = this.props;\n return (\n <MathPreviewContainer isSelected={isSelected}>\n {' '}\n <InsideOverlay />\n <mq.Static latex={latex} onFocus={onFocus} onBlur={onBlur} />\n </MathPreviewContainer>\n );\n }\n}\n\nexport default RawMathPreview;\n"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAAuD,SAAAM,WAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,WAAAD,CAAA,OAAAE,gBAAA,aAAAF,CAAA,OAAAG,2BAAA,aAAAJ,CAAA,EAAAK,yBAAA,KAAAC,OAAA,CAAAC,SAAA,CAAAN,CAAA,EAAAC,CAAA,YAAAC,gBAAA,aAAAH,CAAA,EAAAQ,WAAA,IAAAP,CAAA,CAAAQ,KAAA,CAAAT,CAAA,EAAAE,CAAA;AAAA,SAAAG,0BAAA,cAAAL,CAAA,IAAAU,OAAA,CAAAC,SAAA,CAAAC,OAAA,CAAAC,IAAA,CAAAP,OAAA,CAAAC,SAAA,CAAAG,OAAA,iCAAAV,CAAA,aAAAK,yBAAA,YAAAA,0BAAA,aAAAL,CAAA;AAAA,SAAAc,QAAA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YAAAsG,aAAA,CAACvB,aAAa,MAAE,CAAC,eACjB/E,MAAA,YAAAsG,aAAA,CAAChG,UAAA,CAAAmC,EAAE,CAAC8D,MAAM;QAACL,KAAK,EAAEA,KAAM;QAACE,OAAO,EAAEA,OAAQ;QAACC,MAAM,EAAEA;MAAO,CAAE,CACxC,CAAC;IAE3B;EAAC;AAAA,EA/BiCG,iBAAK,CAACC,SAAS;AAAA,IAAArE,gBAAA,aAAtC6C,cAAc,eACN;EACjBiB,KAAK,EAAEQ,qBAAS,CAACC,MAAM;EACvBb,IAAI,EAAEY,qBAAS,CAACE,MAAM;EACtBxD,UAAU,EAAEsD,qBAAS,CAACG,IAAI;EAC1BT,OAAO,EAAEM,qBAAS,CAACI,IAAI;EACvBT,MAAM,EAAEK,qBAAS,CAACI;AACpB,CAAC;AAAA,IAAAC,QAAA,GAAA7B,OAAA,cA2BYD,cAAc","ignoreList":[]}
package/lib/utils.js DELETED
@@ -1,17 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.markFractionBaseSuperscripts = void 0;
7
- var markFractionBaseSuperscripts = exports.markFractionBaseSuperscripts = function markFractionBaseSuperscripts() {
8
- document.querySelectorAll('.mq-supsub.mq-sup-only').forEach(function (supsub) {
9
- var prev = supsub.previousElementSibling;
10
- if (prev && prev.classList.contains('mq-non-leaf') && prev.querySelector('.mq-fraction')) {
11
- supsub.classList.add('mq-after-fraction-group');
12
- } else {
13
- supsub.classList.remove('mq-after-fraction-group');
14
- }
15
- });
16
- };
17
- //# sourceMappingURL=utils.js.map
package/lib/utils.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","names":["markFractionBaseSuperscripts","exports","document","querySelectorAll","forEach","supsub","prev","previousElementSibling","classList","contains","querySelector","add","remove"],"sources":["../src/utils.js"],"sourcesContent":["export const markFractionBaseSuperscripts = () => {\n document.querySelectorAll('.mq-supsub.mq-sup-only').forEach((supsub) => {\n const prev = supsub.previousElementSibling;\n\n if (prev && prev.classList.contains('mq-non-leaf') && prev.querySelector('.mq-fraction')) {\n supsub.classList.add('mq-after-fraction-group');\n } else {\n supsub.classList.remove('mq-after-fraction-group');\n }\n });\n};\n"],"mappings":";;;;;;AAAO,IAAMA,4BAA4B,GAAAC,OAAA,CAAAD,4BAAA,GAAG,SAA/BA,4BAA4BA,CAAA,EAAS;EAChDE,QAAQ,CAACC,gBAAgB,CAAC,wBAAwB,CAAC,CAACC,OAAO,CAAC,UAACC,MAAM,EAAK;IACtE,IAAMC,IAAI,GAAGD,MAAM,CAACE,sBAAsB;IAE1C,IAAID,IAAI,IAAIA,IAAI,CAACE,SAAS,CAACC,QAAQ,CAAC,aAAa,CAAC,IAAIH,IAAI,CAACI,aAAa,CAAC,cAAc,CAAC,EAAE;MACxFL,MAAM,CAACG,SAAS,CAACG,GAAG,CAAC,yBAAyB,CAAC;IACjD,CAAC,MAAM;MACLN,MAAM,CAACG,SAAS,CAACI,MAAM,CAAC,yBAAyB,CAAC;IACpD;EACF,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}