@pie-element/math-inline 5.9.1 → 5.9.4
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 +24 -0
- package/configure/CHANGELOG.md +24 -0
- package/configure/package.json +3 -3
- package/controller/CHANGELOG.md +8 -0
- package/controller/lib/index.js +24 -13
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +1 -1
- package/lib/main.js +5 -2
- package/lib/main.js.map +1 -1
- package/lib/print.js +2 -0
- package/lib/print.js.map +1 -1
- package/lib/simple-question-block.js +9 -8
- package/lib/simple-question-block.js.map +1 -1
- package/module/configure.js +4 -4
- package/module/controller.js +24 -13
- package/module/element.js +58 -2265
- package/module/index.html +1 -1
- package/module/manifest.json +4 -4
- package/module/print.html +1 -1
- package/module/print.js +60 -2265
- package/package.json +2 -2
|
@@ -107,7 +107,7 @@ var SimpleQuestionBlockRaw = /*#__PURE__*/function (_React$Component) {
|
|
|
107
107
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
108
108
|
className: classes.expression
|
|
109
109
|
}, showCorrect || disabled ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
110
|
-
className: (0, _classnames["default"])(classes["static"], (_cx = {}, (0, _defineProperty2["default"])(_cx, classes.
|
|
110
|
+
className: (0, _classnames["default"])(classes["static"], (_cx = {}, (0, _defineProperty2["default"])(_cx, classes.incorrect, !emptyResponse && !correct && !showCorrect), (0, _defineProperty2["default"])(_cx, classes.correct, !emptyResponse && (correct || showCorrect)), _cx))
|
|
111
111
|
}, /*#__PURE__*/_react["default"].createElement(_mathInput.mq.Static, {
|
|
112
112
|
latex: showCorrect ? responses && responses.length && responses[0].answer : session.response || ''
|
|
113
113
|
})) : /*#__PURE__*/_react["default"].createElement(_mathToolbar.MathToolbar, {
|
|
@@ -144,8 +144,7 @@ var SimpleQuestionBlock = (0, _styles.withStyles)(function (theme) {
|
|
|
144
144
|
display: 'flex',
|
|
145
145
|
justifyContent: 'center',
|
|
146
146
|
width: 'auto',
|
|
147
|
-
|
|
148
|
-
maxWidth: '900px',
|
|
147
|
+
maxWidth: 'fit-content',
|
|
149
148
|
height: 'auto',
|
|
150
149
|
textAlign: 'left',
|
|
151
150
|
padding: theme.spacing.unit,
|
|
@@ -162,7 +161,7 @@ var SimpleQuestionBlock = (0, _styles.withStyles)(function (theme) {
|
|
|
162
161
|
color: _renderUi.color.text(),
|
|
163
162
|
background: _renderUi.color.background(),
|
|
164
163
|
border: "1px solid ".concat(_renderUi.color.primaryLight()),
|
|
165
|
-
width: '
|
|
164
|
+
width: 'fit-content',
|
|
166
165
|
fontSize: '1rem',
|
|
167
166
|
padding: theme.spacing.unit / 2,
|
|
168
167
|
'& > .mq-math-mode': {
|
|
@@ -174,12 +173,14 @@ var SimpleQuestionBlock = (0, _styles.withStyles)(function (theme) {
|
|
|
174
173
|
}
|
|
175
174
|
},
|
|
176
175
|
correct: {
|
|
177
|
-
|
|
178
|
-
|
|
176
|
+
border: "2px solid ".concat(_renderUi.color.correct(), " !important"),
|
|
177
|
+
padding: theme.spacing.unit,
|
|
178
|
+
letterSpacing: '0.5px'
|
|
179
179
|
},
|
|
180
180
|
incorrect: {
|
|
181
|
-
|
|
182
|
-
|
|
181
|
+
border: "2px solid ".concat(_renderUi.color.incorrect(), " !important"),
|
|
182
|
+
padding: theme.spacing.unit,
|
|
183
|
+
letterSpacing: '0.5px'
|
|
183
184
|
}
|
|
184
185
|
};
|
|
185
186
|
})(SimpleQuestionBlockRaw);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/simple-question-block.jsx"],"names":["SimpleQuestionBlockRaw","showKeypad","setState","e","relatedTarget","currentTarget","offsetParent","props","classes","model","showCorrect","session","emptyResponse","onSimpleResponseChange","config","disabled","correctness","view","correct","showAsCorrect","showAsIncorrect","responses","equationEditor","expression","incorrect","length","answer","response","editor","responseEditor","onFocus","onBlur","state","React","Component","PropTypes","object","func","isRequired","bool","SimpleQuestionBlock","theme","display","justifyContent","width","
|
|
1
|
+
{"version":3,"sources":["../src/simple-question-block.jsx"],"names":["SimpleQuestionBlockRaw","showKeypad","setState","e","relatedTarget","currentTarget","offsetParent","props","classes","model","showCorrect","session","emptyResponse","onSimpleResponseChange","config","disabled","correctness","view","correct","showAsCorrect","showAsIncorrect","responses","equationEditor","expression","incorrect","length","answer","response","editor","responseEditor","onFocus","onBlur","state","React","Component","PropTypes","object","func","isRequired","bool","SimpleQuestionBlock","theme","display","justifyContent","width","maxWidth","height","textAlign","padding","spacing","unit","border","color","primaryLight","marginTop","marginBottom","text","background","fontSize","letterSpacing"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;IAEaA,sB;;;;;;;;;;;;;;;8FAUH;AACNC,MAAAA,UAAU,EAAE;AADN,K;gGAIE;AAAA,aAAM,MAAKC,QAAL,CAAc;AAAED,QAAAA,UAAU,EAAE;AAAd,OAAd,CAAN;AAAA,K;+FAED,UAACE,CAAD,EAAO;AACd,iBAAyCA,CAAC,IAAI,EAA9C;AAAA,UAAQC,aAAR,QAAQA,aAAR;AAAA,UAAuBC,aAAvB,QAAuBA,aAAvB;;AAEA,UAAI,CAACD,aAAD,IAAkB,CAACC,aAAnB,IAAqCD,aAAa,CAACE,YAAd,KAA+BD,aAAa,CAACC,YAAtF,EAAqG;AACnG,cAAKJ,QAAL,CAAc;AAAED,UAAAA,UAAU,EAAE;AAAd,SAAd;AACD;AACF,K;;;;;;WAED,kBAAS;AAAA;;AACP,wBAOI,KAAKM,KAPT;AAAA,UACEC,OADF,eACEA,OADF;AAAA,UAEEC,KAFF,eAEEA,KAFF;AAAA,UAGEC,WAHF,eAGEA,WAHF;AAAA,UAIEC,OAJF,eAIEA,OAJF;AAAA,UAKEC,aALF,eAKEA,aALF;AAAA,UAMEC,sBANF,eAMEA,sBANF;;AAQA,kBAAgDJ,KAAK,IAAI,EAAzD;AAAA,UAAQK,MAAR,SA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,CAAcC;AAHb,KAbmC;AAkB/C,cAAQ;AACNE,MAAAA,KAAK,EAAEA,gBAAMI,IAAN,EADD;AAENC,MAAAA,UAAU,EAAEL,gBAAMK,UAAN,EAFN;AAGNN,MAAAA,MAAM,sBAAeC,gBAAMC,YAAN,EAAf,CAHA;AAINT,MAAAA,KAAK,EAAE,aAJD;AAKNc,MAAAA,QAAQ,EAAE,MALJ;AAMNV,MAAAA,OAAO,EAAEP,KAAK,CAACQ,OAAN,CAAcC,IAAd,GAAqB,CANxB;AAON,2BAAqB;AACnB,6BAAqB;AACnB,4BAAkB;AAChBR,YAAAA,OAAO,EAAE;AADO;AADC;AADF;AAPf,KAlBuC;AAiC/CxB,IAAAA,OAAO,EAAE;AACPiC,MAAAA,MAAM,sBAAeC,gBAAMlC,OAAN,EAAf,gBADC;AAEP8B,MAAAA,OAAO,EAAEP,KAAK,CAACQ,OAAN,CAAcC,IAFhB;AAGPS,MAAAA,aAAa,EAAE;AAHR,KAjCsC;AAsC/CnC,IAAAA,SAAS,EAAE;AACT2B,MAAAA,MAAM,sBAAeC,gBAAM5B,SAAN,EAAf,gBADG;AAETwB,MAAAA,OAAO,EAAEP,KAAK,CAACQ,OAAN,CAAcC,IAFd;AAGTS,MAAAA,aAAa,EAAE;AAHN;AAtCoC,GAAL;AAAA,CAAhB,EA2CxB3D,sBA3CwB,CAA5B;eA6CewC,mB","sourcesContent":["import React from 'react';\nimport { MathToolbar } from '@pie-lib/math-toolbar';\nimport { mq } from '@pie-lib/math-input';\nimport cx from 'classnames';\nimport { withStyles } from '@material-ui/core/styles';\nimport PropTypes from 'prop-types';\nimport { color } from '@pie-lib/render-ui';\n\nexport class SimpleQuestionBlockRaw extends React.Component {\n static propTypes = {\n classes: PropTypes.object,\n onSimpleResponseChange: PropTypes.func,\n model: PropTypes.object.isRequired,\n emptyResponse: PropTypes.bool,\n session: PropTypes.object.isRequired,\n showCorrect: PropTypes.bool\n };\n\n state = {\n showKeypad: true\n };\n\n onFocus = () => this.setState({ showKeypad: true });\n\n onBlur = (e) => {\n const { relatedTarget, currentTarget } = e || {};\n\n if (!relatedTarget || !currentTarget || (relatedTarget.offsetParent !== currentTarget.offsetParent)) {\n this.setState({ showKeypad: false });\n }\n };\n\n render() {\n const {\n classes,\n model,\n showCorrect,\n session,\n emptyResponse,\n onSimpleResponseChange\n } = this.props;\n const { config, disabled, correctness, view } = model || {};\n\n if (!config) {\n return;\n }\n\n const correct = correctness && correctness.correct;\n const showAsCorrect = !emptyResponse && (showCorrect || correct);\n const showAsIncorrect = !emptyResponse && !correct && !showCorrect && !view;\n const { responses, equationEditor } = config;\n\n return (\n <div className={classes.expression}>\n {showCorrect || disabled ? (\n <div\n className={cx(classes.static, {\n [classes.incorrect]: !emptyResponse && !correct && !showCorrect,\n [classes.correct]: !emptyResponse && (correct || showCorrect)\n })}\n >\n <mq.Static\n latex={\n showCorrect ? (responses && responses.length && responses[0].answer) : (session.response || '')\n }\n />\n </div>\n ) : (\n <MathToolbar\n classNames={{ editor: classes.responseEditor }}\n latex={session.response || ''}\n keypadMode={equationEditor}\n onChange={onSimpleResponseChange}\n onDone={() => {}}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n controlledKeypad={true}\n showKeypad={this.state.showKeypad}\n hideDoneButton={true}\n />\n )}\n </div>\n );\n }\n}\nconst SimpleQuestionBlock = withStyles(theme => ({\n responseEditor: {\n display: 'flex',\n justifyContent: 'center',\n width: 'auto',\n maxWidth: 'fit-content',\n height: 'auto',\n textAlign: 'left',\n padding: theme.spacing.unit,\n '&.mq-math-mode': {\n border: `1px solid ${color.primaryLight()}`\n }\n },\n expression: {\n marginTop: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit * 2,\n padding: theme.spacing.unit\n },\n static: {\n color: color.text(),\n background: color.background(),\n border: `1px solid ${color.primaryLight()}`,\n width: 'fit-content',\n fontSize: '1rem',\n padding: theme.spacing.unit / 2,\n '& > .mq-math-mode': {\n '& > .mq-hasCursor': {\n '& > .mq-cursor': {\n display: 'none'\n }\n }\n }\n },\n correct: {\n border: `2px solid ${color.correct()} !important`,\n padding: theme.spacing.unit,\n letterSpacing: '0.5px',\n },\n incorrect: {\n border: `2px solid ${color.incorrect()} !important`,\n padding: theme.spacing.unit,\n letterSpacing: '0.5px',\n }\n}))(SimpleQuestionBlockRaw);\n\nexport default SimpleQuestionBlock;\n"],"file":"simple-question-block.js"}
|
package/module/configure.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {_dll_react, _dll_prop_types, _dll_material_ui__core, _dll_material_ui__core_styles, _dll_classnames, _dll_lodash, _dll_debug, _dll_react_dom} from "../../../@pie-lib/shared-module@^1.2
|
|
2
|
-
import {_dll_pie_lib__config_ui} from "../../../@pie-lib/config-module@^1.0.
|
|
3
|
-
import {_dll_pie_lib__editable_html} from "../../../@pie-lib/editable-html-module@^1.
|
|
4
|
-
import {_dll_pie_lib__math_toolbar, _dll_pie_framework__mathquill} from "../../../@pie-lib/math-edit-module@^1.1.
|
|
1
|
+
import {_dll_react, _dll_prop_types, _dll_material_ui__core, _dll_material_ui__core_styles, _dll_classnames, _dll_lodash, _dll_debug, _dll_react_dom} from "../../../@pie-lib/shared-module@^1.4.2/module/index.js";
|
|
2
|
+
import {_dll_pie_lib__config_ui} from "../../../@pie-lib/config-module@^1.0.25/module/index.js";
|
|
3
|
+
import {_dll_pie_lib__editable_html} from "../../../@pie-lib/editable-html-module@^1.2.1/module/index.js";
|
|
4
|
+
import {_dll_pie_lib__math_toolbar, _dll_pie_framework__mathquill} from "../../../@pie-lib/math-edit-module@^1.1.23/module/index.js";
|
|
5
5
|
const React$3 = _dll_react;
|
|
6
6
|
const PropTypes$2 = _dll_prop_types;
|
|
7
7
|
const {Card: Card} = _dll_material_ui__core;
|
package/module/controller.js
CHANGED
|
@@ -1278,19 +1278,30 @@ const escape = (string) => string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $&
|
|
|
1278
1278
|
|
|
1279
1279
|
const simpleSessionResponse = (question) =>
|
|
1280
1280
|
new Promise((resolve) => {
|
|
1281
|
-
const { responses } = question;
|
|
1282
|
-
const { answer } = responses ? responses[0] : {};
|
|
1281
|
+
const { responses, id } = question;
|
|
1282
|
+
const { answer } = responses && responses.length ? responses[0] : {};
|
|
1283
|
+
|
|
1283
1284
|
resolve({
|
|
1284
|
-
id
|
|
1285
|
-
response: answer,
|
|
1286
|
-
completeAnswer: answer
|
|
1285
|
+
id,
|
|
1286
|
+
response: answer || '',
|
|
1287
|
+
completeAnswer: answer || ''
|
|
1287
1288
|
});
|
|
1288
1289
|
});
|
|
1289
1290
|
|
|
1290
1291
|
const advancedSessionResponse = (question) =>
|
|
1291
1292
|
new Promise((resolve, reject) => {
|
|
1292
|
-
const { responses } = question;
|
|
1293
|
-
const { answer } = responses ? responses[0] : {};
|
|
1293
|
+
const { responses, id } = question;
|
|
1294
|
+
const { answer } = responses && responses.length ? responses[0] : {};
|
|
1295
|
+
|
|
1296
|
+
if (!answer) {
|
|
1297
|
+
resolve({
|
|
1298
|
+
id,
|
|
1299
|
+
answers: {},
|
|
1300
|
+
completeAnswer: ''
|
|
1301
|
+
});
|
|
1302
|
+
|
|
1303
|
+
return;
|
|
1304
|
+
}
|
|
1294
1305
|
|
|
1295
1306
|
try {
|
|
1296
1307
|
const e = question.expression;
|
|
@@ -1306,9 +1317,9 @@ const advancedSessionResponse = (question) =>
|
|
|
1306
1317
|
|
|
1307
1318
|
if (!m) {
|
|
1308
1319
|
resolve({
|
|
1320
|
+
id,
|
|
1309
1321
|
answers: {},
|
|
1310
|
-
completeAnswer: answer
|
|
1311
|
-
id: question.id,
|
|
1322
|
+
completeAnswer: answer
|
|
1312
1323
|
});
|
|
1313
1324
|
|
|
1314
1325
|
console.log(`can not find match: ${o} in ${answer}`);
|
|
@@ -1325,15 +1336,15 @@ const advancedSessionResponse = (question) =>
|
|
|
1325
1336
|
}
|
|
1326
1337
|
|
|
1327
1338
|
resolve({
|
|
1339
|
+
id,
|
|
1328
1340
|
answers,
|
|
1329
|
-
completeAnswer: answer
|
|
1330
|
-
id: question.id,
|
|
1341
|
+
completeAnswer: answer
|
|
1331
1342
|
});
|
|
1332
1343
|
} catch (e) {
|
|
1333
1344
|
resolve({
|
|
1345
|
+
id,
|
|
1334
1346
|
answers: {},
|
|
1335
|
-
completeAnswer: answer
|
|
1336
|
-
id: question.id,
|
|
1347
|
+
completeAnswer: answer
|
|
1337
1348
|
});
|
|
1338
1349
|
|
|
1339
1350
|
console.error(e.toString());
|