@pie-lib/math-toolbar 1.14.0 → 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js DELETED
@@ -1,287 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- Object.defineProperty(exports, "MathPreview", {
9
- enumerable: true,
10
- get: function get() {
11
- return _mathPreview["default"];
12
- }
13
- });
14
- exports.RawPureToolbar = exports.PureToolbar = exports.MathToolbar = void 0;
15
-
16
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
17
-
18
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
19
-
20
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
21
-
22
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
23
-
24
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
25
-
26
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
27
-
28
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
29
-
30
- var _react = _interopRequireDefault(require("react"));
31
-
32
- var _propTypes = _interopRequireDefault(require("prop-types"));
33
-
34
- var _classnames = _interopRequireDefault(require("classnames"));
35
-
36
- var _editorAndPad = _interopRequireDefault(require("./editor-and-pad"));
37
-
38
- var _doneButton = require("./done-button");
39
-
40
- var _styles = require("@material-ui/core/styles");
41
-
42
- var _mathPreview = _interopRequireDefault(require("./math-preview"));
43
-
44
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
45
-
46
- 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; } }
47
-
48
- var MathToolbar = /*#__PURE__*/function (_React$Component) {
49
- (0, _inherits2["default"])(MathToolbar, _React$Component);
50
-
51
- var _super = _createSuper(MathToolbar);
52
-
53
- function MathToolbar(props) {
54
- var _this;
55
-
56
- (0, _classCallCheck2["default"])(this, MathToolbar);
57
- _this = _super.call(this, props);
58
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "done", function () {
59
- _this.props.onDone(_this.state.latex);
60
- });
61
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChange", function (latex) {
62
- _this.setState({
63
- latex: latex
64
- });
65
-
66
- _this.props.onChange(latex);
67
- });
68
- _this.state = {
69
- latex: props.latex
70
- };
71
- return _this;
72
- }
73
-
74
- (0, _createClass2["default"])(MathToolbar, [{
75
- key: "UNSAFE_componentWillReceiveProps",
76
- value: function UNSAFE_componentWillReceiveProps(nextProps) {
77
- this.setState({
78
- latex: nextProps.latex
79
- });
80
- }
81
- }, {
82
- key: "render",
83
- value: function render() {
84
- var latex = this.state.latex;
85
- var _this$props = this.props,
86
- classNames = _this$props.classNames,
87
- autoFocus = _this$props.autoFocus,
88
- allowAnswerBlock = _this$props.allowAnswerBlock,
89
- onAnswerBlockAdd = _this$props.onAnswerBlockAdd,
90
- controlledKeypad = _this$props.controlledKeypad,
91
- controlledKeypadMode = _this$props.controlledKeypadMode,
92
- keypadMode = _this$props.keypadMode,
93
- noDecimal = _this$props.noDecimal,
94
- additionalKeys = _this$props.additionalKeys,
95
- showKeypad = _this$props.showKeypad,
96
- onFocus = _this$props.onFocus,
97
- onBlur = _this$props.onBlur,
98
- hideDoneButton = _this$props.hideDoneButton,
99
- error = _this$props.error,
100
- keyPadCharacterRef = _this$props.keyPadCharacterRef,
101
- setKeypadInteraction = _this$props.setKeypadInteraction,
102
- maxResponseAreas = _this$props.maxResponseAreas;
103
- return /*#__PURE__*/_react["default"].createElement(PureToolbar, {
104
- autoFocus: autoFocus,
105
- classNames: classNames,
106
- onAnswerBlockAdd: onAnswerBlockAdd,
107
- allowAnswerBlock: allowAnswerBlock,
108
- latex: latex,
109
- additionalKeys: additionalKeys,
110
- noDecimal: noDecimal,
111
- keypadMode: keypadMode,
112
- keyPadCharacterRef: keyPadCharacterRef,
113
- setKeypadInteraction: setKeypadInteraction,
114
- onChange: this.onChange,
115
- onDone: this.done,
116
- onFocus: onFocus,
117
- onBlur: onBlur,
118
- showKeypad: showKeypad,
119
- controlledKeypad: controlledKeypad,
120
- controlledKeypadMode: controlledKeypadMode,
121
- hideDoneButton: hideDoneButton,
122
- error: error,
123
- maxResponseAreas: maxResponseAreas
124
- });
125
- }
126
- }]);
127
- return MathToolbar;
128
- }(_react["default"].Component);
129
-
130
- exports.MathToolbar = MathToolbar;
131
- (0, _defineProperty2["default"])(MathToolbar, "propTypes", {
132
- autoFocus: _propTypes["default"].bool,
133
- allowAnswerBlock: _propTypes["default"].bool,
134
- controlledKeypad: _propTypes["default"].bool,
135
- controlledKeypadMode: _propTypes["default"].bool,
136
- keypadMode: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
137
- classNames: _propTypes["default"].object,
138
- error: _propTypes["default"].string,
139
- maxResponseAreas: _propTypes["default"].number,
140
- showKeypad: _propTypes["default"].bool,
141
- noDecimal: _propTypes["default"].bool,
142
- additionalKeys: _propTypes["default"].array,
143
- latex: _propTypes["default"].string.isRequired,
144
- onAnswerBlockAdd: _propTypes["default"].func,
145
- onChange: _propTypes["default"].func,
146
- onDone: _propTypes["default"].func.isRequired,
147
- onFocus: _propTypes["default"].func,
148
- onBlur: _propTypes["default"].func,
149
- hideDoneButton: _propTypes["default"].bool,
150
- keyPadCharacterRef: _propTypes["default"].func,
151
- setKeypadInteraction: _propTypes["default"].func
152
- });
153
- (0, _defineProperty2["default"])(MathToolbar, "defaultProps", {
154
- classNames: {},
155
- keypadMode: 'item-authoring',
156
- autoFocus: false,
157
- allowAnswerBlock: false,
158
- controlledKeypad: false,
159
- controlledKeypadMode: false,
160
- noDecimal: false,
161
- showKeypad: true,
162
- additionalKeys: [],
163
- onChange: function onChange() {},
164
- onAnswerBlockAdd: function onAnswerBlockAdd() {},
165
- onFocus: function onFocus() {},
166
- hideDoneButton: false
167
- });
168
-
169
- var RawPureToolbar = /*#__PURE__*/function (_React$Component2) {
170
- (0, _inherits2["default"])(RawPureToolbar, _React$Component2);
171
-
172
- var _super2 = _createSuper(RawPureToolbar);
173
-
174
- function RawPureToolbar() {
175
- (0, _classCallCheck2["default"])(this, RawPureToolbar);
176
- return _super2.apply(this, arguments);
177
- }
178
-
179
- (0, _createClass2["default"])(RawPureToolbar, [{
180
- key: "render",
181
- value: function render() {
182
- var _this$props2 = this.props,
183
- classNames = _this$props2.classNames,
184
- autoFocus = _this$props2.autoFocus,
185
- allowAnswerBlock = _this$props2.allowAnswerBlock,
186
- onAnswerBlockAdd = _this$props2.onAnswerBlockAdd,
187
- controlledKeypad = _this$props2.controlledKeypad,
188
- controlledKeypadMode = _this$props2.controlledKeypadMode,
189
- additionalKeys = _this$props2.additionalKeys,
190
- showKeypad = _this$props2.showKeypad,
191
- keypadMode = _this$props2.keypadMode,
192
- noDecimal = _this$props2.noDecimal,
193
- hideInput = _this$props2.hideInput,
194
- noLatexHandling = _this$props2.noLatexHandling,
195
- layoutForKeyPad = _this$props2.layoutForKeyPad,
196
- keyPadCharacterRef = _this$props2.keyPadCharacterRef,
197
- setKeypadInteraction = _this$props2.setKeypadInteraction,
198
- latex = _this$props2.latex,
199
- onChange = _this$props2.onChange,
200
- onDone = _this$props2.onDone,
201
- onFocus = _this$props2.onFocus,
202
- onBlur = _this$props2.onBlur,
203
- hideDoneButton = _this$props2.hideDoneButton,
204
- hideDoneButtonBackground = _this$props2.hideDoneButtonBackground,
205
- classes = _this$props2.classes,
206
- error = _this$props2.error,
207
- maxResponseAreas = _this$props2.maxResponseAreas;
208
- return /*#__PURE__*/_react["default"].createElement("div", {
209
- className: (0, _classnames["default"])(classes.pureToolbar, (classNames || {}).toolbar),
210
- ref: keyPadCharacterRef
211
- }, /*#__PURE__*/_react["default"].createElement("div", null), /*#__PURE__*/_react["default"].createElement(_editorAndPad["default"], {
212
- autoFocus: autoFocus,
213
- keypadMode: keypadMode,
214
- classNames: classNames || {},
215
- controlledKeypad: controlledKeypad,
216
- controlledKeypadMode: controlledKeypadMode,
217
- noDecimal: noDecimal,
218
- hideInput: hideInput,
219
- noLatexHandling: noLatexHandling,
220
- layoutForKeyPad: layoutForKeyPad,
221
- showKeypad: showKeypad,
222
- additionalKeys: additionalKeys,
223
- allowAnswerBlock: allowAnswerBlock,
224
- onAnswerBlockAdd: onAnswerBlockAdd,
225
- latex: latex,
226
- onChange: onChange,
227
- onFocus: onFocus,
228
- onBlur: onBlur,
229
- error: error,
230
- maxResponseAreas: maxResponseAreas,
231
- setKeypadInteraction: setKeypadInteraction
232
- }), (!controlledKeypad || controlledKeypad && showKeypad) && !hideDoneButton && /*#__PURE__*/_react["default"].createElement(_doneButton.DoneButton, {
233
- hideBackground: hideDoneButtonBackground,
234
- onClick: onDone
235
- }));
236
- }
237
- }]);
238
- return RawPureToolbar;
239
- }(_react["default"].Component);
240
-
241
- exports.RawPureToolbar = RawPureToolbar;
242
- (0, _defineProperty2["default"])(RawPureToolbar, "propTypes", {
243
- classNames: _propTypes["default"].object,
244
- latex: _propTypes["default"].string.isRequired,
245
- keypadMode: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
246
- hideInput: _propTypes["default"].bool,
247
- noLatexHandling: _propTypes["default"].bool,
248
- layoutForKeyPad: _propTypes["default"].object,
249
- onChange: _propTypes["default"].func.isRequired,
250
- onDone: _propTypes["default"].func.isRequired,
251
- onBlur: _propTypes["default"].func,
252
- onAnswerBlockAdd: _propTypes["default"].func,
253
- additionalKeys: _propTypes["default"].array,
254
- onFocus: _propTypes["default"].func,
255
- classes: _propTypes["default"].object.isRequired,
256
- autoFocus: _propTypes["default"].bool,
257
- noDecimal: _propTypes["default"].bool,
258
- allowAnswerBlock: _propTypes["default"].bool,
259
- controlledKeypad: _propTypes["default"].bool,
260
- controlledKeypadMode: _propTypes["default"].bool,
261
- showKeypad: _propTypes["default"].bool,
262
- hideDoneButton: _propTypes["default"].bool,
263
- hideDoneButtonBackground: _propTypes["default"].bool,
264
- error: _propTypes["default"].any,
265
- maxResponseAreas: _propTypes["default"].number,
266
- keyPadCharacterRef: _propTypes["default"].object,
267
- setKeypadInteraction: _propTypes["default"].func
268
- });
269
- (0, _defineProperty2["default"])(RawPureToolbar, "defaultProps", {
270
- classNames: {},
271
- hideDoneButtonBackground: false
272
- });
273
-
274
- var styles = function styles() {
275
- return {
276
- pureToolbar: {
277
- display: 'flex',
278
- width: '100%',
279
- zIndex: 8,
280
- alignItems: 'center'
281
- }
282
- };
283
- };
284
-
285
- var PureToolbar = (0, _styles.withStyles)(styles)(RawPureToolbar);
286
- exports.PureToolbar = PureToolbar;
287
- //# sourceMappingURL=index.js.map
package/lib/index.js.map DELETED
@@ -1 +0,0 @@
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","error","keyPadCharacterRef","setKeypadInteraction","maxResponseAreas","done","React","Component","PropTypes","bool","oneOfType","string","number","object","array","isRequired","func","RawPureToolbar","hideInput","noLatexHandling","layoutForKeyPad","hideDoneButtonBackground","classes","pureToolbar","toolbar","any","styles","display","width","zIndex","alignItems","PureTool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,EAAEiB,sBAAUQ,IAVX;AAWjBpB,EAAAA,cAAc,EAAEY,sBAAUM,KAXT;AAYjBhB,EAAAA,OAAO,EAAEU,sBAAUQ,IAZF;AAajBM,EAAAA,OAAO,EAAEd,sBAAUK,MAAV,CAAiBE,UAbT;AAcjB1B,EAAAA,SAAS,EAAEmB,sBAAUC,IAdJ;AAejBd,EAAAA,SAAS,EAAEa,sBAAUC,IAfJ;AAgBjBnB,EAAAA,gBAAgB,EAAEkB,sBAAUC,IAhBX;AAiBjBjB,EAAAA,gBAAgB,EAAEgB,sBAAUC,IAjBX;AAkBjBhB,EAAAA,oBAAoB,EAAEe,sBAAUC,IAlBf;AAmBjBZ,EAAAA,UAAU,EAAEW,sBAAUC,IAnBL;AAoBjBT,EAAAA,cAAc,EAAEQ,sBAAUC,IApBT;AAqBjBY,EAAAA,wBAAwB,EAAEb,sBAAUC,IArBnB;AAsBjBR,EAAAA,KAAK,EAAEO,sBAAUiB,GAtBA;AAuBjBrB,EAAAA,gBAAgB,EAAEI,sBAAUI,MAvBX;AAwBjBV,EAAAA,kBAAkB,EAAEM,sBAAUK,MAxBb;AAyBjBV,EAAAA,oBAAoB,EAAEK,sBAAUQ;AAzBf,C;iCADRC,c,kBA6BW;AACpB7B,EAAAA,UAAU,EAAE,EADQ;AAEpBiC,EAAAA,wBAAwB,EAAE;AAFN,C;;AAkExB,IAAMK,MAAM,GAAG,SAATA,MAAS;AAAA,SAAO;AACpBH,IAAAA,WAAW,EAAE;AACXI,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,EAAmBT,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 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 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 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 classes,\n error,\n maxResponseAreas,\n } = this.props;\n\n return (\n <div className={cx(classes.pureToolbar, (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 </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,240 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports["default"] = exports.RawMathPreview = void 0;
9
-
10
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
-
12
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
-
14
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
15
-
16
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
17
-
18
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
19
-
20
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
21
-
22
- var _react = _interopRequireDefault(require("react"));
23
-
24
- var _classnames = _interopRequireDefault(require("classnames"));
25
-
26
- var _debug = _interopRequireDefault(require("debug"));
27
-
28
- var _styles = require("@material-ui/core/styles");
29
-
30
- var _propTypes = _interopRequireDefault(require("prop-types"));
31
-
32
- var _mathInput = require("@pie-lib/math-input");
33
-
34
- var _utils = require("./utils");
35
-
36
- 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; }
37
-
38
- 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) { (0, _defineProperty2["default"])(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; }
39
-
40
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
41
-
42
- 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; } }
43
-
44
- var _mq$CommonMqStyles = _mathInput.mq.CommonMqStyles,
45
- commonMqFontStyles = _mq$CommonMqStyles.commonMqFontStyles,
46
- longdivStyles = _mq$CommonMqStyles.longdivStyles,
47
- supsubStyles = _mq$CommonMqStyles.supsubStyles;
48
- var log = (0, _debug["default"])('@pie-lib:math-toolbar:math-preview');
49
-
50
- var RawMathPreview = /*#__PURE__*/function (_React$Component) {
51
- (0, _inherits2["default"])(RawMathPreview, _React$Component);
52
-
53
- var _super = _createSuper(RawMathPreview);
54
-
55
- function RawMathPreview() {
56
- (0, _classCallCheck2["default"])(this, RawMathPreview);
57
- return _super.apply(this, arguments);
58
- }
59
-
60
- (0, _createClass2["default"])(RawMathPreview, [{
61
- key: "componentDidMount",
62
- value: function componentDidMount() {
63
- (0, _utils.markFractionBaseSuperscripts)();
64
- }
65
- }, {
66
- key: "componentDidUpdate",
67
- value: function componentDidUpdate(prevProps) {
68
- // Re-run only if LaTeX changed
69
- if (this.props.node.data.get('latex') !== prevProps.node.data.get('latex')) {
70
- (0, _utils.markFractionBaseSuperscripts)();
71
- }
72
- }
73
- }, {
74
- key: "render",
75
- value: function render() {
76
- log('[render] data: ', this.props.node.data);
77
- var latex = this.props.node.data.get('latex');
78
- var _this$props = this.props,
79
- classes = _this$props.classes,
80
- isSelected = _this$props.isSelected,
81
- onFocus = _this$props.onFocus,
82
- onBlur = _this$props.onBlur;
83
- return /*#__PURE__*/_react["default"].createElement("div", {
84
- className: (0, _classnames["default"])(classes.root, isSelected && classes.selected)
85
- }, ' ', /*#__PURE__*/_react["default"].createElement("span", {
86
- className: classes.insideOverlay
87
- }), /*#__PURE__*/_react["default"].createElement(_mathInput.mq.Static, {
88
- latex: latex,
89
- onFocus: onFocus,
90
- onBlur: onBlur
91
- }));
92
- }
93
- }]);
94
- return RawMathPreview;
95
- }(_react["default"].Component);
96
-
97
- exports.RawMathPreview = RawMathPreview;
98
- (0, _defineProperty2["default"])(RawMathPreview, "propTypes", {
99
- latex: _propTypes["default"].string,
100
- node: _propTypes["default"].object,
101
- classes: _propTypes["default"].object,
102
- isSelected: _propTypes["default"].bool,
103
- onFocus: _propTypes["default"].func,
104
- onBlur: _propTypes["default"].func
105
- });
106
-
107
- var mp = function mp(theme) {
108
- return {
109
- root: _objectSpread(_objectSpread(_objectSpread({
110
- display: 'inline-flex',
111
- alignItems: 'center',
112
- position: 'relative',
113
- '& *': commonMqFontStyles
114
- }, supsubStyles), longdivStyles), {}, {
115
- '& > .mq-math-mode': {
116
- border: 'solid 1px lightgrey'
117
- },
118
- '& > .mq-focused': {
119
- outline: 'none',
120
- boxShadow: 'none',
121
- border: 'solid 1px black',
122
- borderRadius: '0px'
123
- },
124
- '& > .mq-math-mode .mq-root-block': {
125
- paddingTop: '7px !important'
126
- },
127
- '& > .mq-math-mode .mq-overarc ': {
128
- paddingTop: '0.45em !important'
129
- },
130
- '& > .mq-math-mode .mq-sqrt-prefix': {
131
- verticalAlign: 'baseline !important',
132
- top: '1px !important',
133
- left: '-0.1em !important'
134
- },
135
- '& > .mq-math-mode .mq-denominator': {
136
- marginTop: '-5px !important',
137
- padding: '0.5em 0.1em 0.1em !important'
138
- },
139
- '& > .mq-math-mode .mq-numerator, .mq-math-mode .mq-over': {
140
- padding: '0 0.1em !important',
141
- paddingBottom: '0 !important',
142
- marginBottom: '-2px'
143
- },
144
- '& > .mq-math-mode .mq-longdiv .mq-longdiv-inner .mq-empty': {
145
- paddingTop: '6px !important',
146
- paddingLeft: '4px !important'
147
- },
148
- '& > .mq-math-mode .mq-longdiv .mq-longdiv-inner': {
149
- marginLeft: '0 !important'
150
- },
151
- '& > .mq-math-mode .mq-overarrow': {
152
- fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important'
153
- },
154
- '& > .mq-math-mode .mq-paren': {
155
- verticalAlign: 'top !important',
156
- padding: '1px 0.1em !important'
157
- },
158
- '& > .mq-math-mode .mq-sqrt-stem': {
159
- borderTop: '0.07em solid',
160
- marginLeft: '-1.5px',
161
- marginTop: '-2px !important',
162
- paddingTop: '5px !important'
163
- },
164
- '& .mq-overarrow-inner': {
165
- paddingTop: '0 !important',
166
- border: 'none !important'
167
- },
168
- '& .mq-editable-field .mq-cursor': {
169
- marginTop: '-15px !important'
170
- },
171
- '& .mq-overarrow.mq-arrow-both': {
172
- top: '7.5px',
173
- marginTop: '0px',
174
- minWidth: '1.23em',
175
- '& *': {
176
- lineHeight: '1 !important'
177
- },
178
- '&:before': {
179
- top: '-0.4em',
180
- left: '-1px'
181
- },
182
- // NOTE: This workaround adds `!important` to enforce the correct positioning and styling
183
- // of `.mq-overarrow.mq-arrow-both` elements in MathQuill. This ensures consistent display
184
- // regardless of the order in which MathQuill is initialized on our websites.
185
- //
186
- // In the future, investigate why MathQuill scripts and styles are being initialized
187
- // more than once and address the root cause to prevent potential conflicts and ensure
188
- // optimal performance.
189
- '&:after': {
190
- top: '0px !important',
191
- position: 'absolute !important',
192
- right: '-2px'
193
- },
194
- '&.mq-empty:after': {
195
- top: '-0.45em'
196
- }
197
- },
198
- '& .mq-overarrow.mq-arrow-right': {
199
- '&:before': {
200
- top: '-0.4em',
201
- right: '-1px'
202
- }
203
- },
204
- '& .mq-overarrow-inner-right': {
205
- display: 'none !important'
206
- },
207
- '& .mq-overarrow-inner-left': {
208
- display: 'none !important'
209
- },
210
- '& .mq-longdiv-inner': {
211
- borderTop: '1px solid !important',
212
- paddingTop: '1.5px !important'
213
- },
214
- '& .mq-parallelogram': {
215
- lineHeight: 0.85
216
- },
217
- '& span[data-prime="true"]': {
218
- fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important'
219
- }
220
- }),
221
- selected: {
222
- border: "solid 1px ".concat(theme.palette.primary.main),
223
- '& > .mq-math-mode': {
224
- border: 'solid 0px lightgrey'
225
- }
226
- },
227
- insideOverlay: {
228
- position: 'absolute',
229
- bottom: 0,
230
- left: 0,
231
- right: 0,
232
- top: 0
233
- }
234
- };
235
- };
236
-
237
- var _default = (0, _styles.withStyles)(mp)(RawMathPreview);
238
-
239
- exports["default"] = _default;
240
- //# sourceMappingURL=math-preview.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/math-preview.jsx"],"names":["mq","CommonMqStyles","commonMqFontStyles","longdivStyles","supsubStyles","log","RawMathPreview","prevProps","props","node","data","get","latex","classes","isSelected","onFocus","onBlur","root","selected","insideOverlay","React","Component","PropTypes","string","object","bool","func","mp","theme","display","alignItems","position","border","outline","boxShadow","borderRadius","paddingTop","verticalAlign","top","left","marginTop","padding","paddingBottom","marginBottom","paddingLeft","marginLeft","fontFamily","borderTop","minWidth","lineHeight","right","palette","primary","main","bottom"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,yBAA4DA,cAAGC,cAA/D;AAAA,IAAQC,kBAAR,sBAAQA,kBAAR;AAAA,IAA4BC,aAA5B,sBAA4BA,aAA5B;AAAA,IAA2CC,YAA3C,sBAA2CA,YAA3C;AAEA,IAAMC,GAAG,GAAG,uBAAM,oCAAN,CAAZ;;IAEaC,c;;;;;;;;;;;;WAUX,6BAAoB;AAClB;AACD;;;WAED,4BAAmBC,SAAnB,EAA8B;AAC5B;AACA,UAAI,KAAKC,KAAL,CAAWC,IAAX,CAAgBC,IAAhB,CAAqBC,GAArB,CAAyB,OAAzB,MAAsCJ,SAAS,CAACE,IAAV,CAAeC,IAAf,CAAoBC,GAApB,CAAwB,OAAxB,CAA1C,EAA4E;AAC1E;AACD;AACF;;;WAED,kBAAS;AACPN,MAAAA,GAAG,CAAC,iBAAD,EAAoB,KAAKG,KAAL,CAAWC,IAAX,CAAgBC,IAApC,CAAH;AACA,UAAME,KAAK,GAAG,KAAKJ,KAAL,CAAWC,IAAX,CAAgBC,IAAhB,CAAqBC,GAArB,CAAyB,OAAzB,CAAd;AACA,wBAAiD,KAAKH,KAAtD;AAAA,UAAQK,OAAR,eAAQA,OAAR;AAAA,UAAiBC,UAAjB,eAAiBA,UAAjB;AAAA,UAA6BC,OAA7B,eAA6BA,OAA7B;AAAA,UAAsCC,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W;AACTD,UAAAA,GAAG,EAAE,gBADI;AAETP,UAAAA,QAAQ,EAAE,qBAFD;AAGTmB,UAAAA,KAAK,EAAE;AAHE,SAlBoB;AAuB/B,4BAAoB;AAClBZ,UAAAA,GAAG,EAAE;AADa;AAvBW,OAjE/B;AA4FF,wCAAkC;AAChC,oBAAY;AACVA,UAAAA,GAAG,EAAE,QADK;AAEVY,UAAAA,KAAK,EAAE;AAFG;AADoB,OA5FhC;AAkGF,qCAA+B;AAC7BrB,QAAAA,OAAO,EAAE;AADoB,OAlG7B;AAqGF,oCAA8B;AAC5BA,QAAAA,OAAO,EAAE;AADmB,OArG5B;AAwGF,6BAAuB;AACrBkB,QAAAA,SAAS,EAAE,sBADU;AAErBX,QAAAA,UAAU,EAAE;AAFS,OAxGrB;AA4GF,6BAAuB;AACrBa,QAAAA,UAAU,EAAE;AADS,OA5GrB;AA+GF,mCAA6B;AAC3BH,QAAAA,UAAU,EAAE;AADe;AA/G3B,MADiB;AAoHrB5B,IAAAA,QAAQ,EAAE;AACRc,MAAAA,MAAM,sBAAeJ,KAAK,CAACuB,OAAN,CAAcC,OAAd,CAAsBC,IAArC,CADE;AAER,2BAAqB;AACnBrB,QAAAA,MAAM,EAAE;AADW;AAFb,KApHW;AA0HrBb,IAAAA,aAAa,EAAE;AACbY,MAAAA,QAAQ,EAAE,UADG;AAEbuB,MAAAA,MAAM,EAAE,CAFK;AAGbf,MAAAA,IAAI,EAAE,CAHO;AAIbW,MAAAA,KAAK,EAAE,CAJM;AAKbZ,MAAAA,GAAG,EAAE;AALQ;AA1HM,GAAZ;AAAA,CAAX;;eAmIe,wBAAWX,EAAX,EAAerB,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';\nimport { markFractionBaseSuperscripts } from './utils';\n\nconst { commonMqFontStyles, longdivStyles, supsubStyles } = mq.CommonMqStyles;\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 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 { 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 '& *': commonMqFontStyles,\n ...supsubStyles,\n ...longdivStyles,\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 '& > .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\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\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 // NOTE: This workaround adds `!important` to enforce the correct positioning and styling\n // of `.mq-overarrow.mq-arrow-both` elements in MathQuill. This ensures consistent display\n // regardless of the order in which MathQuill is initialized on our websites.\n //\n // In the future, investigate why MathQuill scripts and styles are being initialized\n // more than once and address the root cause to prevent potential conflicts and ensure\n // optimal performance.\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 },\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"}