@pie-element/math-inline 7.14.2-next.16 → 7.14.2-next.17

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/main.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/main.jsx"],"names":["translator","Translator","registered","NEWLINE_LATEX","REGEX","DEFAULT_KEYPAD_VARIANT","IS_SAFARI","test","navigator","userAgent","generateAdditionalKeys","keyData","map","key","name","latex","write","label","getKeyPadWidth","additionalKeys","equationEditor","Math","floor","length","prepareForStatic","model","state","config","disabled","expression","responses","printMode","alwaysShowCorrect","modelExpression","showCorrect","answer","answerBlocks","replace","session","answers","blankSpace","repeat","value","Main","props","classes","root","Object","keys","forEach","answerId","el","querySelector","indexEl","MQ","MathQuill","getInterface","textContent","view","parentElement","classList","remove","correct","incorrect","StaticMath","selectableElements","querySelectorAll","elem","setAttribute","textareaElements","response","setState","callOnSessionChange","id","activeAnswerBlock","data","type","input","c","toNodeData","clear","Array","isArray","vv","cmd","keystroke","focus","onSessionChange","show","handleAnswerBlockDomUpdate","subfieldValue","completeAnswer","mqStatic","mathField","changeField","fields","find","k","tf","e","relatedTarget","currentTarget","getParentWithRoleTooltip","element","depth","parent","offsetParent","getAttribute","getDeepChildDataKeypad","child","children","attributes","parentWithTooltipRole","childWithDataKeypad","window","registerEmbed","htmlString","blockContainer","blockResponse","blockMath","text","pattern","matches","match","nextProps","nextConfig","note","language","t","lng","env","mode","countResponseOccurrences","setTimeout","updateAria","newAnswers","nextState","sameModel","sameState","ref","div","document","firstChild","correctness","teacherInstructions","rationale","feedback","animationsDisabled","showNote","prompt","responseType","customKeys","role","displayNote","emptyResponse","showCorrectAnswerToggle","tooltipModeEnabled","staticLatex","viewMode","studentPrintMode","printView","printContainer","subFieldChanged","getFieldName","setInput","onSubFieldFocus","onBlur","midContent","main","srOnly","collapsible","hidden","visible","__html","promptContainer","inputAndKeypadContainer","ResponseTypes","simple","onSimpleResponseChange","advanced","showCorrectness","correctAnswerShown","printCorrect","setTooltipRef","tooltip","keypadTooltip","popper","keypadTooltipPopper","responseContainer","width","onClick","tooltipPopper","toggle","toggleShowCorrect","mainContainer","r","React","Component","PropTypes","object","isRequired","func","styles","theme","color","backgroundColor","background","display","primaryLight","padding","spacing","unit","border","secondary","fontSize","opacity","marginTop","paddingTop","marginBottom","position","title","paddingBottom","zIndex","minWidth","maxWidth","margin","top","borderColor","lineHeight","left","right","borderTop","letterSpacing","flex","palette","grey","alignItems","justifyContent","borderRight","pointerEvents","height","overflow"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;;;AACA,IAAOA,UAAP,GAAqBC,sBAArB,CAAOD,UAAP;AACA,IAAIE,UAAU,GAAG,KAAjB;AAEA,IAAMC,aAAa,GAAG,YAAtB;AACA,IAAMC,KAAK,GAAG,gBAAd;AACA,IAAMC,sBAAsB,GAAG,CAA/B,C,CAEA;AACA;AACA;AACA;AACA;AACA;;AACA,IAAMC,SAAS,GAAG,iCAAiCC,IAAjC,CAAsCC,SAAS,CAACC,SAAhD,CAAlB;;AAEA,SAASC,sBAAT,GAA8C;AAAA,MAAdC,OAAc,uEAAJ,EAAI;AAC1C,SAAOA,OAAO,CAACC,GAAR,CAAY,UAACC,GAAD;AAAA,WAAU;AACzBC,MAAAA,IAAI,EAAED,GADmB;AAEzBE,MAAAA,KAAK,EAAEF,GAFkB;AAGzBG,MAAAA,KAAK,EAAEH,GAHkB;AAIzBI,MAAAA,KAAK,EAAEJ;AAJkB,KAAV;AAAA,GAAZ,CAAP;AAMH;;AAED,SAASK,cAAT,GAA6D;AAAA,MAArCC,cAAqC,uEAApB,EAAoB;AAAA,MAAhBC,cAAgB;AACzD,SAAOC,IAAI,CAACC,KAAL,CAAWH,cAAc,CAACI,MAAf,GAAwB,CAAnC,IAAwC,EAAxC,I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,EAAE;AADK;AADD;AADJ;AARd,KAlKY;AAkLvB9C,IAAAA,cAAc,EAAE;AACZyD,MAAAA,YAAY,EAAEf,KAAK,CAACO,OAAN,CAAcC,IADhB;AAEZ4B,MAAAA,aAAa,EAAE;AAFH,KAlLO;AAsLvBtE,IAAAA,MAAM,EAAE;AACJkD,MAAAA,QAAQ,EAAE,UADN;AAEJU,MAAAA,IAAI,EAAE,UAFF;AAGJH,MAAAA,GAAG,EAAE,MAHD;AAIJrC,MAAAA,KAAK,EAAE,KAJH;AAKJmD,MAAAA,MAAM,EAAE,KALJ;AAMJC,MAAAA,QAAQ,EAAE;AANN;AAtLe,GAAZ;AAAA,CAAf;;eAgMe,wBAAWvC,MAAX,EAAmB/J,IAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport {CorrectAnswerToggle} from '@pie-lib/pie-toolbox/correct-answer-toggle';\nimport {mq, HorizontalKeypad, updateSpans} from '@pie-lib/pie-toolbox/math-input';\nimport {Feedback, Collapsible, Readable, hasText, PreviewPrompt} from '@pie-lib/pie-toolbox/render-ui';\nimport {renderMath} from '@pie-lib/pie-toolbox/math-rendering-accessible';\nimport {withStyles} from '@material-ui/core/styles';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport {ResponseTypes} from './utils';\nimport isEqual from 'lodash/isEqual';\nimport cx from 'classnames';\nimport SimpleQuestionBlock from './simple-question-block';\nimport MathQuill from '@pie-framework/mathquill';\nimport {color} from '@pie-lib/pie-toolbox/render-ui';\nimport isEmpty from 'lodash/isEmpty';\nimport Translator from '@pie-lib/pie-toolbox/translator';\nconst {translator} = Translator;\nlet registered = false;\n\nconst NEWLINE_LATEX = /\\\\newline/g;\nconst REGEX = /{{response}}/gm;\nconst DEFAULT_KEYPAD_VARIANT = 6;\n\n// !!! If you're using Chrome but have selected the \"iPad\" device in Chrome Developer Tools, the navigator.userAgent string may still report as\n// Safari because Chrome on iOS actually uses the Safari rendering engine under the hood due to Apple's restrictions on third-party browser engines.\n// When you select the \"iPad\" device in Chrome Developer Tools, you're essentially emulating the behavior of Safari on an iPad, including the user agent string.\n// Therefore, even though you're using Chrome, the user agent string will resemble that of Safari on an iPad.\n// Since the regular expression /^((?!chrome|android).)*safari/i checks for the presence of \"safari\" in the user agent string while excluding \"chrome\" and \"android\",\n// it will return true in this case because \"safari\" is present in the user agent string emulated by Chrome when in iPad mode.\nconst IS_SAFARI = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n\nfunction generateAdditionalKeys(keyData = []) {\n return keyData.map((key) => ({\n name: key,\n latex: key,\n write: key,\n label: key,\n }));\n}\n\nfunction getKeyPadWidth(additionalKeys = [], equationEditor) {\n return Math.floor(additionalKeys.length / 5) * 30 + (equationEditor === 'miscellaneous' ? 600 : 500);\n}\n\nfunction prepareForStatic(model, state) {\n const {config, disabled} = model || {};\n const {expression, responses, printMode, alwaysShowCorrect} = config || {};\n\n if (config && expression) {\n const modelExpression = expression;\n\n if (state.showCorrect) {\n return responses && responses.length && responses[0].answer;\n }\n\n let answerBlocks = 1; // assume one at least\n // build out local state model using responses declared in expression\n\n return (modelExpression || '')\n .replace(REGEX, function () {\n const answer = state.session.answers[`r${answerBlocks}`];\n\n if (printMode && !alwaysShowCorrect) {\n const blankSpace = '\\\\ \\\\ '.repeat(30) + '\\\\newline ';\n\n return `\\\\MathQuillMathField[r${answerBlocks++}]{${blankSpace.repeat(3)}}`;\n }\n\n if (disabled) {\n return `\\\\embed{answerBlock}[r${answerBlocks++}]`;\n }\n\n return `\\\\MathQuillMathField[r${answerBlocks++}]{${(answer && answer.value) || ''}}`;\n })\n .replace(NEWLINE_LATEX, '\\\\embed{newLine}[]');\n }\n}\n\nexport class Main extends React.Component {\n static propTypes = {\n classes: PropTypes.object,\n session: PropTypes.object.isRequired,\n onSessionChange: PropTypes.func,\n model: PropTypes.object.isRequired,\n };\n\n constructor(props) {\n super(props);\n\n const answers = {};\n\n if (props.model.config && props.model.config.expression) {\n let answerBlocks = 1; // assume one at least\n // build out local state model using responses declared in expression\n\n (props.model.config.expression || '').replace(REGEX, () => {\n answers[`r${answerBlocks}`] = {\n value:\n (props.session &&\n props.session.answers &&\n props.session.answers[`r${answerBlocks}`] &&\n props.session.answers[`r${answerBlocks}`].value) ||\n '',\n };\n\n answerBlocks += 1;\n });\n }\n\n this.state = {\n session: {...props.session, answers},\n activeAnswerBlock: '',\n showCorrect: this.props.model.config.alwaysShowCorrect || false,\n };\n }\n\n UNSAFE_componentWillMount() {\n const {classes} = this.props;\n\n if (typeof window !== 'undefined') {\n let MQ = MathQuill.getInterface(2);\n\n if (!registered) {\n MQ.registerEmbed('answerBlock', (data) => {\n return {\n htmlString: `<div class=\"${classes.blockContainer}\">\n <div class=\"${classes.blockResponse}\" id=\"${data}Index\">R</div>\n <div class=\"${classes.blockMath}\">\n <span id=\"${data}\"></span>\n </div>\n </div>`,\n text: () => 'text',\n latex: () => `\\\\embed{answerBlock}[${data}]`,\n };\n });\n\n registered = true;\n }\n }\n }\n\n handleAnswerBlockDomUpdate = () => {\n const {model, classes} = this.props;\n const {session, showCorrect} = this.state;\n const answers = session.answers;\n\n if (this.root && model.disabled && !showCorrect) {\n Object.keys(answers).forEach((answerId) => {\n const el = this.root.querySelector(`#${answerId}`);\n const indexEl = this.root.querySelector(`#${answerId}Index`);\n // const correct = model.correctness && model.correctness.correct;\n\n if (el) {\n let MQ = MathQuill.getInterface(2);\n const answer = answers[answerId];\n\n el.textContent = (answer && answer.value) || '';\n\n if (!model.view) {\n // for now, we're not going to be showing individual response correctness\n // TODO re-attach the classes once we are\n // el.parentElement.parentElement.classList.add(\n // correct ? classes.correct : classes.incorrect\n // );\n } else {\n el.parentElement.parentElement.classList.remove(classes.correct);\n el.parentElement.parentElement.classList.remove(classes.incorrect);\n }\n\n MQ.StaticMath(el);\n\n // For now, we're not going to be indexing response blocks\n // TODO go back to indexing once we support individual response correctness\n // indexEl.textContent = `R${idx + 1}`;\n indexEl.textContent = 'R';\n }\n });\n }\n\n renderMath(this.root);\n };\n\n countResponseOccurrences(expression) {\n const pattern = /\\{\\{response\\}\\}/g;\n const matches = expression.match(pattern);\n\n return matches ? matches.length : 0;\n }\n\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n const {config} = this.props.model;\n const {config: nextConfig = {}} = nextProps.model || {};\n // check if the note is the default one for prev language and change to the default one for new language\n // this check is necessary in order to diferanciate between default and authour defined note\n // and only change between languages for default ones\n if (\n config.note &&\n config.language &&\n config.language !== nextConfig.language &&\n config.note === translator.t('mathInline.primaryCorrectWithAlternates', {lng: config.language})\n ) {\n config.note = translator.t('mathInline.primaryCorrectWithAlternates', {lng: nextConfig.language});\n }\n\n if ((config.env && config.env.mode !== 'evaluate') || (nextConfig.env && nextConfig.env.mode !== 'evaluate')) {\n this.setState({...this.state.session, showCorrect: false});\n }\n\n if (nextConfig.alwaysShowCorrect) {\n this.setState({showCorrect: true});\n }\n\n if (this.countResponseOccurrences(config.expression) < this.countResponseOccurrences(nextConfig.expression)) {\n setTimeout(() => this.updateAria(), 100);\n }\n\n if (\n (config && config.responses && config.responses.length !== nextConfig.responses.length) ||\n (!config && nextConfig && nextConfig.responses) ||\n (config && nextConfig && config.expression !== nextConfig.expression)\n ) {\n const newAnswers = {};\n const answers = this.state.session.answers;\n\n let answerBlocks = 1; // assume one at least\n\n // build out local state model using responses declared in expression\n (nextConfig.expression || '').replace(REGEX, () => {\n newAnswers[`r${answerBlocks}`] = {\n value: (answers && answers[`r${answerBlocks}`] && answers[`r${answerBlocks}`].value) || '',\n };\n answerBlocks++;\n });\n\n this.setState(\n (state) => ({\n session: {\n ...state.session,\n completeAnswer: this.mqStatic && this.mqStatic.mathField.latex(),\n answers: newAnswers,\n },\n }),\n this.handleAnswerBlockDomUpdate,\n );\n }\n }\n\n shouldComponentUpdate(nextProps, nextState) {\n const sameModel = isEqual(this.props.model, nextProps.model);\n const sameState = isEqual(this.state, nextState);\n\n return !sameModel || !sameState;\n }\n\n componentDidMount() {\n this.handleAnswerBlockDomUpdate();\n this.updateAria();\n setTimeout(() => renderMath(this.root), 100);\n }\n\n componentDidUpdate() {\n this.handleAnswerBlockDomUpdate();\n }\n\n updateAria = () => {\n if (this.root) {\n // Update aria-hidden for .mq-selectable elements\n const selectableElements = this.root.querySelectorAll('.mq-selectable');\n selectableElements.forEach(elem => elem.setAttribute('aria-hidden', 'true'));\n\n // Update aria-label for textarea elements\n const textareaElements = this.root.querySelectorAll('textarea');\n textareaElements.forEach(elem => {\n elem.setAttribute('aria-label', 'Enter answer using math editor buttons or keyboard.');\n });\n }\n };\n\n onDone = () => {};\n\n onSimpleResponseChange = (response) => {\n this.setState((state) => ({session: {...state.session, response}}), this.callOnSessionChange);\n };\n\n onSubFieldFocus = (id) => {\n this.setState({activeAnswerBlock: id});\n };\n\n 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\n setInput = (input) => {\n this.input = input;\n };\n\n onClick = (data) => {\n const c = this.toNodeData(data);\n\n if (c.type === 'clear') {\n this.input.clear();\n } else if (c.type === 'command') {\n if (Array.isArray(c.value)) {\n c.value.forEach((vv) => {\n this.input.cmd(vv);\n });\n } else {\n this.input.cmd(c.value);\n }\n } else if (c.type === 'cursor') {\n this.input.keystroke(c.value);\n } else {\n this.input.write(c.value);\n }\n\n this.input.focus();\n };\n\n callOnSessionChange = () => {\n const {onSessionChange} = this.props;\n\n if (onSessionChange) {\n onSessionChange(this.state.session);\n }\n };\n\n toggleShowCorrect = (show) => {\n this.setState({showCorrect: show}, this.handleAnswerBlockDomUpdate);\n };\n\n subFieldChanged = (name, subfieldValue) => {\n updateSpans();\n\n if (name) {\n this.setState(\n (state) => ({\n session: {\n ...state.session,\n completeAnswer: this.mqStatic && this.mqStatic.mathField.latex(),\n answers: {\n ...state.session.answers,\n [name]: {value: subfieldValue},\n },\n },\n }),\n this.callOnSessionChange,\n );\n }\n };\n\n getFieldName = (changeField, fields) => {\n const {answers} = this.state.session;\n\n if (Object.keys(answers || {}).length) {\n const keys = Object.keys(answers);\n\n return keys.find((k) => {\n const tf = fields[k];\n\n return tf && tf.id == changeField.id;\n });\n }\n };\n\n onBlur = (e) => {\n const {relatedTarget, currentTarget} = e || {};\n\n function getParentWithRoleTooltip(element, depth = 0) {\n // only run this max 16 times\n if (!element || depth >= 16) return null;\n\n const parent = element.offsetParent;\n\n if (!parent) return null;\n\n if (parent.getAttribute('role') === 'tooltip') {\n return parent;\n }\n\n return getParentWithRoleTooltip(parent, depth + 1);\n }\n\n function getDeepChildDataKeypad(element, depth = 0) {\n // only run this max 4 times\n if (!element || depth >= 4) return null;\n\n const child = element?.children?.[0];\n\n if (!child) return null;\n\n if (child.attributes && child.attributes['data-keypad']) {\n return child;\n }\n\n return getDeepChildDataKeypad(child, depth + 1);\n }\n\n const parentWithTooltipRole = getParentWithRoleTooltip(relatedTarget);\n const childWithDataKeypad = parentWithTooltipRole ? getDeepChildDataKeypad(parentWithTooltipRole) : null;\n\n if (!relatedTarget || !currentTarget || !childWithDataKeypad?.attributes['data-keypad']) {\n this.setState({activeAnswerBlock: ''});\n }\n // else {\n // // Just for debugging purpose:\n // console.log('\\n\\nNew childWithDataKeypad', childWithDataKeypad);\n //\n // if (IS_SAFARI) {\n // // (IS_SAFARI && !relatedTarget?.offsetParent?.children[0]?.children[0]?.attributes?.['data-keypad'])\n // console.log('What was being used', relatedTarget?.offsetParent?.children[0]?.children[0]);\n // } else {\n // // (!IS_SAFARI && !relatedTarget?.offsetParent?.children[0]?.attributes?.['data-keypad']) ||\n // console.log('What was being used', relatedTarget?.offsetParent?.children[0]);\n // }\n // }\n };\n\n setTooltipRef(ref) {\n // Safari Hack: https://stackoverflow.com/a/42764495/5757635\n setTimeout(() => {\n if (ref && IS_SAFARI) {\n const div = document.querySelector(\"[role='tooltip']\");\n\n if (div) {\n const el = div.firstChild;\n el.setAttribute('tabindex', '-1');\n }\n }\n }, 1);\n }\n\n render() {\n const {model, classes} = this.props;\n const {activeAnswerBlock, showCorrect, session} = this.state;\n const {\n config,\n correctness,\n disabled,\n view,\n teacherInstructions,\n rationale,\n feedback,\n animationsDisabled,\n printMode,\n alwaysShowCorrect,\n language,\n } = model || {};\n\n if (!config) {\n return null;\n }\n\n const {\n showNote,\n note,\n prompt,\n responses,\n responseType,\n equationEditor,\n customKeys,\n env: {mode, role} = {},\n } = config || {};\n const displayNote = (showCorrect || (mode === 'view' && role === 'instructor')) && showNote && note;\n const emptyResponse = isEmpty(responses);\n const showCorrectAnswerToggle = !emptyResponse && correctness && correctness.correctness !== 'correct';\n const tooltipModeEnabled = disabled && correctness;\n const additionalKeys = generateAdditionalKeys(customKeys);\n const correct = correctness && correctness.correct;\n const staticLatex = prepareForStatic(model, this.state) || '';\n const viewMode = disabled && !correctness;\n const studentPrintMode = printMode && !alwaysShowCorrect;\n\n const printView = (\n <div className={classes.printContainer}>\n <mq.Static\n className={classes.static}\n ref={(mqStatic) => (this.mqStatic = mqStatic || this.mqStatic)}\n latex={staticLatex}\n onSubFieldChange={this.subFieldChanged}\n getFieldName={this.getFieldName}\n setInput={this.setInput}\n onSubFieldFocus={this.onSubFieldFocus}\n onBlur={this.onBlur}\n />\n </div>\n );\n\n const midContent = (\n <div className={classes.main}>\n {mode === 'gather' && <h2 className={classes.srOnly}>Math Equation Response Question</h2>}\n\n {viewMode &&\n teacherInstructions &&\n hasText(teacherInstructions) &&\n (!animationsDisabled ? (\n <Collapsible\n className={classes.collapsible}\n labels={{hidden: 'Show Teacher Instructions', visible: 'Hide Teacher Instructions'}}\n >\n <div dangerouslySetInnerHTML={{__html: teacherInstructions}}/>\n </Collapsible>\n ) : (\n <div dangerouslySetInnerHTML={{__html: teacherInstructions}}/>\n ))}\n\n {prompt && (\n <div className={classes.promptContainer}>\n <PreviewPrompt prompt={prompt}/>\n </div>\n )}\n\n {studentPrintMode ? (\n printView\n ) : (\n <Readable false>\n <div className={classes.inputAndKeypadContainer}>\n {responseType === ResponseTypes.simple && (\n <SimpleQuestionBlock\n onSimpleResponseChange={this.onSimpleResponseChange}\n showCorrect={showCorrect}\n emptyResponse={emptyResponse}\n model={model}\n session={session}\n />\n )}\n\n {responseType === ResponseTypes.advanced && (\n <div\n className={cx(classes.expression, {\n [classes.incorrect]: !emptyResponse && !correct && !showCorrect,\n [classes.correct]: !emptyResponse && (correct || showCorrect),\n [classes.showCorrectness]: !emptyResponse && disabled && correctness && !view,\n [classes.correctAnswerShown]: showCorrect,\n [classes.printCorrect]: printMode && alwaysShowCorrect,\n })}\n >\n <Tooltip\n ref={(ref) => this.setTooltipRef(ref)}\n interactive\n open={!!activeAnswerBlock}\n classes={{\n tooltip: classes.keypadTooltip,\n popper: classes.keypadTooltipPopper,\n }}\n title={Object.keys(session.answers).map(\n (answerId) =>\n (answerId === activeAnswerBlock && !(showCorrect || disabled) && (\n <div\n data-keypad={true}\n key={answerId}\n className={classes.responseContainer}\n style={{\n // marginTop: this.mqStatic && this.mqStatic.input.offsetHeight - 20,\n width: getKeyPadWidth(additionalKeys, equationEditor),\n }}\n >\n <HorizontalKeypad\n additionalKeys={additionalKeys}\n mode={equationEditor || DEFAULT_KEYPAD_VARIANT}\n onClick={this.onClick}\n />\n </div>\n )) ||\n null,\n )}\n >\n <mq.Static\n className={classes.static}\n ref={(mqStatic) => (this.mqStatic = mqStatic || this.mqStatic)}\n latex={staticLatex}\n onSubFieldChange={this.subFieldChanged}\n getFieldName={this.getFieldName}\n setInput={this.setInput}\n onSubFieldFocus={this.onSubFieldFocus}\n onBlur={this.onBlur}\n />\n </Tooltip>\n </div>\n )}\n </div>\n </Readable>\n )}\n\n {viewMode && displayNote && (\n <div className={classes.note} dangerouslySetInnerHTML={{__html: `<strong>Note:</strong> ${note}`}}/>\n )}\n\n {viewMode &&\n rationale &&\n hasText(rationale) &&\n (!animationsDisabled ? (\n <Collapsible labels={{hidden: 'Show Rationale', visible: 'Hide Rationale'}}>\n <div dangerouslySetInnerHTML={{__html: rationale}}/>\n </Collapsible>\n ) : (\n <div dangerouslySetInnerHTML={{__html: rationale}}/>\n ))}\n </div>\n );\n\n if (\n tooltipModeEnabled &&\n (showCorrectAnswerToggle ||\n (teacherInstructions && hasText(teacherInstructions)) ||\n (rationale && hasText(rationale)) ||\n feedback)\n ) {\n return (\n <Tooltip\n interactive\n classes={{\n tooltip: classes.tooltip,\n popper: classes.tooltipPopper,\n }}\n title={\n <div>\n <div className={classes.main}>\n {showCorrectAnswerToggle && (\n <CorrectAnswerToggle\n language={language}\n className={classes.toggle}\n show\n toggled={showCorrect}\n onToggle={this.toggleShowCorrect}\n />\n )}\n </div>\n\n {teacherInstructions && hasText(teacherInstructions) && (\n <Collapsible\n className={classes.collapsible}\n key=\"collapsible-teacher-instructions\"\n labels={{\n hidden: 'Show Teacher Instructions',\n visible: 'Hide Teacher Instructions',\n }}\n >\n <PreviewPrompt prompt={teacherInstructions}/>\n </Collapsible>\n )}\n {displayNote && hasText(note) && (\n <Collapsible\n className={classes.collapsible}\n key=\"collapsible-note\"\n labels={{\n hidden: translator.t('common:showNote', {lng: language}),\n visible: translator.t('common:hideNote', {lng: language}),\n }}\n >\n <PreviewPrompt prompt={note}/>\n </Collapsible>\n )}\n\n {rationale && hasText(rationale) && (\n <Collapsible\n className={classes.collapsible}\n key=\"collapsible-rationale\"\n labels={{\n hidden: 'Show Rationale',\n visible: 'Hide Rationale',\n }}\n >\n <PreviewPrompt prompt={rationale}/>\n </Collapsible>\n )}\n\n {feedback && <Feedback correctness={correctness.correctness} feedback={feedback}/>}\n </div>\n }\n >\n <div className={classes.mainContainer} ref={(r) => (this.root = r || this.root)}>\n {midContent}\n </div>\n </Tooltip>\n );\n }\n\n return (\n <div className={classes.mainContainer} ref={(r) => (this.root = r || this.root)}>\n {midContent}\n </div>\n );\n }\n}\n\nconst styles = (theme) => ({\n mainContainer: {\n color: color.text(),\n backgroundColor: color.background(),\n display: 'inline-block',\n },\n tooltip: {\n background: `${color.primaryLight()} !important`,\n color: color.text(),\n padding: theme.spacing.unit * 2,\n border: `1px solid ${color.secondary()}`,\n fontSize: '16px',\n '& :not(.MathJax) > table tr': {\n '&:nth-child(2n)': {\n backgroundColor: 'unset !important',\n },\n },\n },\n tooltipPopper: {\n opacity: 1,\n },\n keypadTooltip: {\n fontSize: 'initial',\n background: 'transparent',\n width: '600px',\n marginTop: 0,\n paddingTop: 0,\n },\n keypadTooltipPopper: {\n background: 'transparent',\n width: '650px',\n opacity: 1,\n },\n promptContainer: {\n marginBottom: theme.spacing.unit * 2,\n },\n main: {\n width: '100%',\n position: 'relative',\n backgroundColor: color.background(),\n color: color.text(),\n },\n title: {\n fontSize: '1.1rem',\n display: 'block',\n marginTop: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit,\n },\n note: {\n paddingBottom: theme.spacing.unit * 2,\n },\n collapsible: {\n marginBottom: theme.spacing.unit * 2,\n },\n responseContainer: {\n zIndex: 10,\n // position: 'absolute',\n // right: 0,\n minWidth: '400px',\n marginTop: theme.spacing.unit * 2,\n },\n expression: {\n maxWidth: 'fit-content',\n '& > .mq-math-mode': {\n '& > .mq-root-block': {\n '& > .mq-editable-field': {\n minWidth: '10px',\n margin: (theme.spacing.unit * 2) / 3,\n padding: theme.spacing.unit / 4,\n },\n },\n '& sup': {\n top: 0,\n },\n },\n },\n static: {\n '& > .mq-root-block': {\n '& > .mq-editable-field': {\n borderColor: color.text(),\n },\n },\n },\n inputAndKeypadContainer: {\n position: 'relative',\n '& .mq-overarrow-inner': {\n border: 'none !important',\n padding: '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-overarrow.mq-arrow-both': {\n minWidth: '1.23em',\n '& *': {\n lineHeight: '1 !important',\n },\n '&:before': {\n top: '-0.4em',\n left: '-1px',\n },\n '&:after': {\n top: '-2.4em',\n right: '-1px',\n },\n '&.mq-empty:after': {\n top: '-0.45em',\n },\n },\n '& .mq-overarrow.mq-arrow-right': {\n '&:before': {\n top: '-0.4em',\n right: '-1px',\n },\n },\n '& .mq-longdiv-inner': {\n borderTop: '1px solid !important',\n paddingTop: '1.5px !important',\n },\n '& .mq-parallelogram': {\n lineHeight: 0.85,\n },\n },\n showCorrectness: {\n border: '2px solid',\n },\n correctAnswerShown: {\n padding: theme.spacing.unit,\n letterSpacing: '0.5px',\n },\n printCorrect: {\n border: `2px solid ${color.correct()} !important`,\n },\n correct: {\n borderColor: `${color.correct()} !important`,\n },\n incorrect: {\n borderColor: `${color.incorrect()} !important`,\n },\n blockContainer: {\n margin: `${theme.spacing.unit}px !important`,\n display: 'inline-flex',\n border: '2px solid grey !important',\n },\n blockResponse: {\n flex: 2,\n color: 'grey',\n background: theme.palette.grey['A100'],\n fontSize: '0.8rem !important',\n padding: `${theme.spacing.unit / 2}px !important`,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n borderRight: `2px solid ${color.disabled()} !important`,\n },\n toggle: {\n color: color.text(),\n marginBottom: theme.spacing.unit * 2,\n },\n blockMath: {\n color: color.text(),\n backgroundColor: color.background(),\n padding: `${theme.spacing.unit / 2}px !important`,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n flex: 8,\n '& > .mq-math-mode': {\n '& > .mq-hasCursor': {\n '& > .mq-cursor': {\n display: 'none',\n },\n },\n },\n },\n printContainer: {\n marginBottom: theme.spacing.unit,\n pointerEvents: 'none',\n },\n srOnly: {\n position: 'absolute',\n left: '-10000px',\n top: 'auto',\n width: '1px',\n height: '1px',\n overflow: 'hidden',\n },\n});\n\nexport default withStyles(styles)(Main);\n"],"file":"main.js"}
package/lib/print.js DELETED
@@ -1,133 +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"] = 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 _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
15
-
16
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
17
-
18
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
19
-
20
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
21
-
22
- var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapNativeSuper"));
23
-
24
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
25
-
26
- var _react = _interopRequireDefault(require("react"));
27
-
28
- var _reactDom = _interopRequireDefault(require("react-dom"));
29
-
30
- var _debounce = _interopRequireDefault(require("lodash/debounce"));
31
-
32
- var _main = _interopRequireDefault(require("./main"));
33
-
34
- var _mathRenderingAccessible = require("@pie-lib/pie-toolbox/math-rendering-accessible");
35
-
36
- var _debug = _interopRequireDefault(require("debug"));
37
-
38
- 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); }; }
39
-
40
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
41
-
42
- function 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; }
43
-
44
- 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; }
45
-
46
- var log = (0, _debug["default"])('pie-element:math-inline:print');
47
- /**
48
- * Live in same package as main element - so we can access some of the shared comps!
49
- *
50
- * - update pslb to build print if src/print.js is there
51
- * - update demo el
52
- * - get configure/controller building
53
- */
54
-
55
- var preparePrintModel = function preparePrintModel(model, opts) {
56
- var instr = opts.role === 'instructor';
57
- model.prompt = model.promptEnabled !== false ? model.prompt : undefined;
58
- model.teacherInstructions = instr && model.teacherInstructionsEnabled !== false ? model.teacherInstructions : undefined;
59
- model.rationale = instr && model.rationaleEnabled !== false ? model.rationale : undefined;
60
- model.showTeacherInstructions = instr;
61
- model.alwaysShowCorrect = instr;
62
- model.printMode = true;
63
- model.feedback = undefined;
64
- model.expression = model.expression || '{{response}}';
65
- model.animationsDisabled = true;
66
- return _objectSpread(_objectSpread({}, model), {}, {
67
- disabled: true,
68
- config: _objectSpread(_objectSpread({}, model), {}, {
69
- env: {
70
- mode: instr ? 'evaluate' : model.mode,
71
- role: opts.role
72
- }
73
- })
74
- });
75
- };
76
-
77
- var MathInlinePrint = /*#__PURE__*/function (_HTMLElement) {
78
- (0, _inherits2["default"])(MathInlinePrint, _HTMLElement);
79
-
80
- var _super = _createSuper(MathInlinePrint);
81
-
82
- function MathInlinePrint() {
83
- var _this;
84
-
85
- (0, _classCallCheck2["default"])(this, MathInlinePrint);
86
- _this = _super.call(this);
87
- _this._options = null;
88
- _this._model = null;
89
- _this._session = [];
90
- _this._rerender = (0, _debounce["default"])(function () {
91
- if (_this._model && _this._session) {
92
- var printModel = preparePrintModel(_this._model, _this._options);
93
-
94
- var element = _this._options && /*#__PURE__*/_react["default"].createElement(_main["default"], {
95
- model: printModel,
96
- session: {}
97
- });
98
-
99
- _reactDom["default"].render(element, (0, _assertThisInitialized2["default"])(_this), function () {
100
- log('render complete - render math');
101
- (0, _mathRenderingAccessible.renderMath)((0, _assertThisInitialized2["default"])(_this));
102
- });
103
- } else {
104
- log('skip');
105
- }
106
- }, 50, {
107
- leading: false,
108
- trailing: true
109
- });
110
- return _this;
111
- }
112
-
113
- (0, _createClass2["default"])(MathInlinePrint, [{
114
- key: "options",
115
- set: function set(o) {
116
- this._options = o;
117
- }
118
- }, {
119
- key: "model",
120
- set: function set(s) {
121
- this._model = s;
122
-
123
- this._rerender();
124
- }
125
- }, {
126
- key: "connectedCallback",
127
- value: function connectedCallback() {}
128
- }]);
129
- return MathInlinePrint;
130
- }( /*#__PURE__*/(0, _wrapNativeSuper2["default"])(HTMLElement));
131
-
132
- exports["default"] = MathInlinePrint;
133
- //# sourceMappingURL=print.js.map
package/lib/print.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/print.js"],"names":["log","preparePrintModel","model","opts","instr","role","prompt","promptEnabled","undefined","teacherInstructions","teacherInstructionsEnabled","rationale","rationaleEnabled","showTeacherInstructions","alwaysShowCorrect","printMode","feedback","expression","animationsDisabled","disabled","config","env","mode","MathInlinePrint","_options","_model","_session","_rerender","printModel","element","React","createElement","Main","session","ReactDOM","render","leading","trailing","o","s","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,+BAAN,CAAZ;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAMC,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,KAAD,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MAAL,IAAe,MAAKC,QAAxB,EAAkC;AAChC,YAAME,UAAU,GAAG3B,iBAAiB,CAAC,MAAKwB,MAAN,EAAc,MAAKD,QAAnB,CAApC;;AAEA,YAAMK,OAAO,GACX,MAAKL,QAAL,iBACAM,kBAAMC,aAAN,CAAoBC,gBAApB,EAA0B;AACxB9B,UAAAA,KAAK,EAAE0B,UADiB;AAExBK,UAAAA,OAAO,EAAE;AAFe,SAA1B,CAFF;;AAOAC,6BAASC,MAAT,CAAgBN,OAAhB,kDAA+B,YAAM;AACnC7B,UAAAA,GAAG,CAAC,+BAAD,CAAH;AACA;AACD,SAHD;AAID,OAdD,MAcO;AACLA,QAAAA,GAAG,CAAC,MAAD,CAAH;AACD;AACF,KAnBc,EAoBf,EApBe,EAqBf;AAAEoC,MAAAA,OAAO,EAAE,KAAX;AAAkBC,MAAAA,QAAQ,EAAE;AAA5B,KArBe,CAAjB;AALY;AA4Bb;;;;SACD,aAAYC,CAAZ,EAAe;AACb,WAAKd,QAAL,GAAgBc,CAAhB;AACD;;;SAED,aAAUC,CAAV,EAAa;AACX,WAAKd,MAAL,GAAcc,CAAd;;AACA,WAAKZ,SAAL;AACD;;;WAED,6BAAoB,CAAE;;;kDAvCqBa,W","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport debounce from 'lodash/debounce';\nimport Main from './main';\nimport { renderMath } from '@pie-lib/pie-toolbox/math-rendering-accessible';\nimport debug from 'debug';\n\nconst log = debug('pie-element:math-inline:print');\n\n/**\n * Live in same package as main element - so we can access some of the shared comps!\n *\n * - update pslb to build print if src/print.js is there\n * - update demo el\n * - get configure/controller building\n */\n\nconst preparePrintModel = (model, opts) => {\n const instr = opts.role === 'instructor';\n\n model.prompt = model.promptEnabled !== false ? model.prompt : undefined;\n model.teacherInstructions =\n instr && model.teacherInstructionsEnabled !== false ? model.teacherInstructions : undefined;\n model.rationale = instr && model.rationaleEnabled !== false ? model.rationale : undefined;\n model.showTeacherInstructions = instr;\n model.alwaysShowCorrect = instr;\n model.printMode = true;\n model.feedback = undefined;\n model.expression = model.expression || '{{response}}';\n\n model.animationsDisabled = true;\n return {\n ...model,\n disabled: true,\n config: {\n ...model,\n env: { mode: instr ? 'evaluate' : model.mode, role: opts.role },\n },\n };\n};\n\nexport default class MathInlinePrint extends HTMLElement {\n constructor() {\n super();\n this._options = null;\n this._model = null;\n this._session = [];\n this._rerender = debounce(\n () => {\n if (this._model && this._session) {\n const printModel = preparePrintModel(this._model, this._options);\n\n const element =\n this._options &&\n React.createElement(Main, {\n model: printModel,\n session: {},\n });\n\n ReactDOM.render(element, this, () => {\n log('render complete - render math');\n renderMath(this);\n });\n } else {\n log('skip');\n }\n },\n 50,\n { leading: false, trailing: true },\n );\n }\n set options(o) {\n this._options = o;\n }\n\n set model(s) {\n this._model = s;\n this._rerender();\n }\n\n connectedCallback() {}\n}\n"],"file":"print.js"}
@@ -1,195 +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.SimpleQuestionBlockRaw = 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 _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
15
-
16
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
17
-
18
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
19
-
20
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
21
-
22
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
23
-
24
- var _react = _interopRequireDefault(require("react"));
25
-
26
- var _mathToolbar = require("@pie-lib/pie-toolbox/math-toolbar");
27
-
28
- var _mathInput = require("@pie-lib/pie-toolbox/math-input");
29
-
30
- var _classnames = _interopRequireDefault(require("classnames"));
31
-
32
- var _styles = require("@material-ui/core/styles");
33
-
34
- var _propTypes = _interopRequireDefault(require("prop-types"));
35
-
36
- var _renderUi = require("@pie-lib/pie-toolbox/render-ui");
37
-
38
- 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); }; }
39
-
40
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
41
-
42
- var SimpleQuestionBlockRaw = /*#__PURE__*/function (_React$Component) {
43
- (0, _inherits2["default"])(SimpleQuestionBlockRaw, _React$Component);
44
-
45
- var _super = _createSuper(SimpleQuestionBlockRaw);
46
-
47
- function SimpleQuestionBlockRaw(props) {
48
- var _this;
49
-
50
- (0, _classCallCheck2["default"])(this, SimpleQuestionBlockRaw);
51
- _this = _super.call(this, props);
52
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "mathToolBarContainsTarget", function (e) {
53
- return document.getElementById(_this.mathToolBarId).contains(e.target);
54
- });
55
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleClick", function (e) {
56
- try {
57
- if (!_this.mathToolBarContainsTarget(e)) {
58
- _this.setState({
59
- showKeypad: false
60
- });
61
- }
62
- } catch (e) {// console.log(e.toString());
63
- }
64
- });
65
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onFocus", function () {
66
- return _this.setState({
67
- showKeypad: true
68
- });
69
- });
70
- _this.state = {
71
- showKeypad: true
72
- };
73
- _this.mathToolBarId = "math-toolbar-".concat(new Date().getTime());
74
- return _this;
75
- }
76
-
77
- (0, _createClass2["default"])(SimpleQuestionBlockRaw, [{
78
- key: "componentDidMount",
79
- value: function componentDidMount() {
80
- window.addEventListener('click', this.handleClick);
81
- }
82
- }, {
83
- key: "componentWillUnmount",
84
- value: function componentWillUnmount() {
85
- window.removeEventListener('click', this.handleClick);
86
- }
87
- }, {
88
- key: "render",
89
- value: function render() {
90
- var _cx;
91
-
92
- var _this$props = this.props,
93
- classes = _this$props.classes,
94
- model = _this$props.model,
95
- showCorrect = _this$props.showCorrect,
96
- session = _this$props.session,
97
- emptyResponse = _this$props.emptyResponse,
98
- onSimpleResponseChange = _this$props.onSimpleResponseChange;
99
-
100
- var _ref = model || {},
101
- config = _ref.config,
102
- disabled = _ref.disabled,
103
- correctness = _ref.correctness;
104
-
105
- if (!config) {
106
- return;
107
- }
108
-
109
- var correct = correctness && correctness.correct;
110
- var responses = config.responses,
111
- equationEditor = config.equationEditor;
112
- return /*#__PURE__*/_react["default"].createElement("div", {
113
- className: classes.expression
114
- }, showCorrect || disabled ? /*#__PURE__*/_react["default"].createElement("div", {
115
- 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))
116
- }, /*#__PURE__*/_react["default"].createElement(_mathInput.mq.Static, {
117
- latex: showCorrect ? responses && responses.length && responses[0].answer : session.response || ''
118
- })) : /*#__PURE__*/_react["default"].createElement("div", {
119
- id: this.mathToolBarId
120
- }, /*#__PURE__*/_react["default"].createElement(_mathToolbar.MathToolbar, {
121
- classNames: {
122
- editor: classes.responseEditor
123
- },
124
- latex: session.response || '',
125
- keypadMode: equationEditor,
126
- onChange: onSimpleResponseChange,
127
- onDone: function onDone() {},
128
- onFocus: this.onFocus,
129
- controlledKeypad: true,
130
- showKeypad: this.state.showKeypad,
131
- hideDoneButton: true
132
- })));
133
- }
134
- }]);
135
- return SimpleQuestionBlockRaw;
136
- }(_react["default"].Component);
137
-
138
- exports.SimpleQuestionBlockRaw = SimpleQuestionBlockRaw;
139
- (0, _defineProperty2["default"])(SimpleQuestionBlockRaw, "propTypes", {
140
- classes: _propTypes["default"].object,
141
- onSimpleResponseChange: _propTypes["default"].func,
142
- model: _propTypes["default"].object.isRequired,
143
- emptyResponse: _propTypes["default"].bool,
144
- session: _propTypes["default"].object.isRequired,
145
- showCorrect: _propTypes["default"].bool
146
- });
147
- var SimpleQuestionBlock = (0, _styles.withStyles)(function (theme) {
148
- return {
149
- responseEditor: {
150
- display: 'flex',
151
- justifyContent: 'center',
152
- width: 'auto',
153
- maxWidth: 'fit-content',
154
- height: 'auto',
155
- textAlign: 'left',
156
- padding: theme.spacing.unit,
157
- '&.mq-math-mode': {
158
- border: "1px solid ".concat(_renderUi.color.primaryLight())
159
- }
160
- },
161
- expression: {
162
- marginTop: theme.spacing.unit * 2,
163
- marginBottom: theme.spacing.unit * 2,
164
- padding: theme.spacing.unit
165
- },
166
- "static": {
167
- color: _renderUi.color.text(),
168
- background: _renderUi.color.background(),
169
- border: "1px solid ".concat(_renderUi.color.primaryLight()),
170
- width: 'fit-content',
171
- fontSize: '1rem',
172
- padding: theme.spacing.unit / 2,
173
- '& > .mq-math-mode': {
174
- '& > .mq-hasCursor': {
175
- '& > .mq-cursor': {
176
- display: 'none'
177
- }
178
- }
179
- }
180
- },
181
- correct: {
182
- border: "2px solid ".concat(_renderUi.color.correct(), " !important"),
183
- padding: theme.spacing.unit,
184
- letterSpacing: '0.5px'
185
- },
186
- incorrect: {
187
- border: "2px solid ".concat(_renderUi.color.incorrect(), " !important"),
188
- padding: theme.spacing.unit,
189
- letterSpacing: '0.5px'
190
- }
191
- };
192
- })(SimpleQuestionBlockRaw);
193
- var _default = SimpleQuestionBlock;
194
- exports["default"] = _default;
195
- //# sourceMappingURL=simple-question-block.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/simple-question-block.jsx"],"names":["SimpleQuestionBlockRaw","props","e","document","getElementById","mathToolBarId","contains","target","mathToolBarContainsTarget","setState","showKeypad","state","Date","getTime","window","addEventListener","handleClick","removeEventListener","classes","model","showCorrect","session","emptyResponse","onSimpleResponseChange","config","disabled","correctness","correct","responses","equationEditor","expression","incorrect","length","answer","response","editor","responseEditor","onFocus","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;;;;;AAUX,kCAAYC,KAAZ,EAAmB;AAAA;;AAAA;AACjB,8BAAMA,KAAN;AADiB,kHAiBS,UAACC,CAAD;AAAA,aAAOC,QAAQ,CAACC,cAAT,CAAwB,MAAKC,aAA7B,EAA4CC,QAA5C,CAAqDJ,CAAC,CAACK,MAAvD,CAAP;AAAA,KAjBT;AAAA,oGAmBL,UAACL,CAAD,EAAO;AACnB,UAAI;AACF,YAAI,CAAC,MAAKM,yBAAL,CAA+BN,CAA/B,CAAL,EAAwC;AACtC,gBAAKO,QAAL,CAAc;AAAEC,YAAAA,UAAU,EAAE;AAAd,WAAd;AACD;AACF,OAJD,CAIE,OAAOR,CAAP,EAAU,CACV;AACD;AACF,KA3BkB;AAAA,gGA6BT;AAAA,aAAM,MAAKO,QAAL,CAAc;AAAEC,QAAAA,UAAU,EAAE;AAAd,OAAd,CAAN;AAAA,KA7BS;AAGjB,UAAKC,KAAL,GAAa;AACXD,MAAAA,UAAU,EAAE;AADD,KAAb;AAGA,UAAKL,aAAL,0BAAqC,IAAIO,IAAJ,GAAWC,OAAX,EAArC;AANiB;AAOlB;;;;WAED,6BAAoB;AAClBC,MAAAA,MAAM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MAAM,sBAAeC,gBAAMC,YAAN,EAAf;AADU;AARJ,KADiC;AAajD5B,IAAAA,UAAU,EAAE;AACV6B,MAAAA,SAAS,EAAEb,KAAK,CAACQ,OAAN,CAAcC,IAAd,GAAqB,CADtB;AAEVK,MAAAA,YAAY,EAAEd,KAAK,CAACQ,OAAN,CAAcC,IAAd,GAAqB,CAFzB;AAGVF,MAAAA,OAAO,EAAEP,KAAK,CAACQ,OAAN,CAAcC;AAHb,KAbqC;AAkBjD,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,KAlByC;AAiCjDpB,IAAAA,OAAO,EAAE;AACP6B,MAAAA,MAAM,sBAAeC,gBAAM9B,OAAN,EAAf,gBADC;AAEP0B,MAAAA,OAAO,EAAEP,KAAK,CAACQ,OAAN,CAAcC,IAFhB;AAGPS,MAAAA,aAAa,EAAE;AAHR,KAjCwC;AAsCjDjC,IAAAA,SAAS,EAAE;AACTyB,MAAAA,MAAM,sBAAeC,gBAAM1B,SAAN,EAAf,gBADG;AAETsB,MAAAA,OAAO,EAAEP,KAAK,CAACQ,OAAN,CAAcC,IAFd;AAGTS,MAAAA,aAAa,EAAE;AAHN;AAtCsC,GAAZ;AAAA,CAAX,EA2CxBhE,sBA3CwB,CAA5B;eA6Ce6C,mB","sourcesContent":["import React from 'react';\nimport { MathToolbar } from '@pie-lib/pie-toolbox/math-toolbar';\nimport { mq } from '@pie-lib/pie-toolbox/math-input';\nimport cx from 'classnames';\nimport { withStyles } from '@material-ui/core/styles';\nimport PropTypes from 'prop-types';\nimport { color } from '@pie-lib/pie-toolbox/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 constructor(props) {\n super(props);\n\n this.state = {\n showKeypad: true,\n };\n this.mathToolBarId = `math-toolbar-${new Date().getTime()}`;\n }\n\n componentDidMount() {\n window.addEventListener('click', this.handleClick);\n }\n\n componentWillUnmount() {\n window.removeEventListener('click', this.handleClick);\n }\n\n mathToolBarContainsTarget = (e) => document.getElementById(this.mathToolBarId).contains(e.target);\n\n handleClick = (e) => {\n try {\n if (!this.mathToolBarContainsTarget(e)) {\n this.setState({ showKeypad: false });\n }\n } catch (e) {\n // console.log(e.toString());\n }\n };\n\n onFocus = () => this.setState({ showKeypad: true });\n\n render() {\n const { classes, model, showCorrect, session, emptyResponse, onSimpleResponseChange } = this.props;\n const { config, disabled, correctness } = model || {};\n\n if (!config) {\n return;\n }\n\n const correct = correctness && correctness.correct;\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={showCorrect ? responses && responses.length && responses[0].answer : session.response || ''}\n />\n </div>\n ) : (\n <div id={this.mathToolBarId}>\n <MathToolbar\n classNames={{ editor: classes.responseEditor }}\n latex={session.response || ''}\n keypadMode={equationEditor}\n onChange={onSimpleResponseChange}\n onDone={() => {}}\n onFocus={this.onFocus}\n controlledKeypad={true}\n showKeypad={this.state.showKeypad}\n hideDoneButton={true}\n />\n </div>\n )}\n </div>\n );\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/lib/utils.js DELETED
@@ -1,12 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ResponseTypes = void 0;
7
- var ResponseTypes = {
8
- advanced: 'Advanced Multi',
9
- simple: 'Simple'
10
- };
11
- exports.ResponseTypes = ResponseTypes;
12
- //# sourceMappingURL=utils.js.map
package/lib/utils.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/utils.js"],"names":["ResponseTypes","advanced","simple"],"mappings":";;;;;;AAAO,IAAMA,aAAa,GAAG;AAC3BC,EAAAA,QAAQ,EAAE,gBADiB;AAE3BC,EAAAA,MAAM,EAAE;AAFmB,CAAtB","sourcesContent":["export const ResponseTypes = {\n advanced: 'Advanced Multi',\n simple: 'Simple',\n};\n"],"file":"utils.js"}