@pie-element/rubric 6.0.2-esm.0 → 6.2.0-mui-update.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/CHANGELOG.md +19 -0
- package/configure/CHANGELOG.md +19 -0
- package/configure/lib/defaults.js +2 -3
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/index.js +90 -152
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/main.js +90 -149
- package/configure/lib/main.js.map +1 -1
- package/configure/package.json +10 -7
- package/configure/src/index.js +12 -2
- package/configure/src/main.jsx +11 -13
- package/controller/CHANGELOG.md +16 -0
- package/controller/lib/defaults.js +2 -3
- package/controller/lib/defaults.js.map +1 -1
- package/controller/lib/index.js +15 -28
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +1 -1
- package/lib/index.js +38 -80
- package/lib/index.js.map +1 -1
- package/lib/main.js +184 -244
- package/lib/main.js.map +1 -1
- package/lib/print.js +41 -84
- package/lib/print.js.map +1 -1
- package/package.json +11 -25
- package/src/__tests__/__snapshots__/rubric-view.test.jsx.snap +2350 -1524
- package/src/index.js +14 -3
- package/src/main.jsx +100 -93
- package/src/print.js +13 -2
- package/LICENSE.md +0 -5
- package/configure/lib/pie-toolbox-rubric/authoring.js +0 -573
- package/configure/lib/pie-toolbox-rubric/authoring.js.map +0 -1
- package/configure/lib/pie-toolbox-rubric/index.js +0 -24
- package/configure/lib/pie-toolbox-rubric/index.js.map +0 -1
- package/configure/lib/pie-toolbox-rubric/point-menu.js +0 -172
- package/configure/lib/pie-toolbox-rubric/point-menu.js.map +0 -1
- package/configure/src/pie-toolbox-rubric/authoring.jsx +0 -449
- package/configure/src/pie-toolbox-rubric/index.js +0 -9
- package/configure/src/pie-toolbox-rubric/point-menu.jsx +0 -94
- package/esm/configure.css +0 -847
- package/esm/configure.js +0 -11976
- package/esm/configure.js.map +0 -1
- package/esm/controller.css +0 -847
- package/esm/controller.js +0 -68
- package/esm/controller.js.map +0 -1
- package/esm/element.css +0 -847
- package/esm/element.js +0 -263
- package/esm/element.js.map +0 -1
- package/esm/print.css +0 -847
- package/esm/print.js +0 -298
- package/esm/print.js.map +0 -1
- package/module/configure.js +0 -1
- package/module/controller.js +0 -113
- package/module/demo.js +0 -33
- package/module/element.js +0 -1
- package/module/index.html +0 -21
- package/module/manifest.json +0 -10
- package/module/print-demo.js +0 -71
- package/module/print.html +0 -18
- package/module/print.js +0 -1
package/lib/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/main.jsx"],"names":["RubricType","PropTypes","shape","excludeZero","bool","points","arrayOf","string","sampleAnswers","animationsDisabled","Rubric","props","index","value","state","rubricOpen","linkPrefix","toggleRubric","bind","setState","model","classes","extraCSSRules","rubricList","slice","reverse","map","desc","length","pointsLabel","listColumn","titleText","text","__html","fontWeight","root","hiddenScreenReader","rubricToggle","e","key","chevronStyle","React","Component","object","isRequired","styles","theme","color","backgroundColor","background","borderCollapse","padding","textAlign","marginBottom","marginTop","lineHeight","display","flexDirection","alignItems","listColumnItem","fontSize","margin","paddingBottom","cursor","userSelect","typography","tertiary","transition","marginLeft","alignSelf","position","width","height","overflow","clip","border","whiteSpace"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEO,IAAMA,UAAU,GAAGC,sBAAUC,KAAV,CAAgB;AACxCC,EAAAA,WAAW,EAAEF,sBAAUG,IADiB;AAExCC,EAAAA,MAAM,EAAEJ,sBAAUK,OAAV,CAAkBL,sBAAUM,MAA5B,CAFgC;AAGxCC,EAAAA,aAAa,EAAEP,sBAAUK,OAAV,CAAkBL,sBAAUM,MAA5B,CAHyB;AAIxCE,EAAAA,kBAAkB,EAAER,sBAAUG;AAJU,CAAhB,CAAnB;;;;IAODM,M;;;;;AAGJ,kBAAYC,KAAZ,EAAmB;AAAA;;AAAA;AACjB,8BAAMA,KAAN;AADiB,+FAFV,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AA,QAAQ,EAAE,MAFD;AAGT1B,MAAAA,UAAU,EAAE,KAHH;AAIT2B,MAAAA,MAAM,EAAE,CAJC;AAKTC,MAAAA,aAAa,EAAE;AALN,KA/Bc;AAsCzBzB,IAAAA,YAAY,EAAE;AACZmB,MAAAA,OAAO,EAAE,MADG;AAEZE,MAAAA,UAAU,EAAE,QAFA;AAGZK,MAAAA,MAAM,EAAE,SAHI;AAIZC,MAAAA,UAAU,EAAE,MAJA;AAKZJ,MAAAA,QAAQ,EAAEd,KAAK,CAACmB,UAAN,CAAiBL,QALf;AAMZ1B,MAAAA,UAAU,EAAE,KANA;AAOZa,MAAAA,KAAK,EAAEA,gBAAMmB,QAAN,EAPK;AAQZL,MAAAA,MAAM,EAAE;AARI,KAtCW;AAgDzBrB,IAAAA,YAAY,EAAE;AACZgB,MAAAA,OAAO,EAAE,aADG;AAEZW,MAAAA,UAAU,EAAE,gBAFA;AAGZC,MAAAA,UAAU,EAAE,CAHA;AAIZC,MAAAA,SAAS,EAAE;AAJC,KAhDW;AAsDzBjC,IAAAA,kBAAkB,EAAE;AAClBkC,MAAAA,QAAQ,EAAE,UADQ;AAElBC,MAAAA,KAAK,EAAE,KAFW;AAGlBC,MAAAA,MAAM,EAAE,KAHU;AAIlBrB,MAAAA,OAAO,EAAE,CAJS;AAKlBU,MAAAA,MAAM,EAAE,MALU;AAMlBY,MAAAA,QAAQ,EAAE,QANQ;AAOlBC,MAAAA,IAAI,EAAE,eAPY;AAQlBC,MAAAA,MAAM,EAAE,CARU;AASlBC,MAAAA,UAAU,EAAE;AATM;AAtDK,GAAZ;AAAA,CAAf;;eAmEe,wBAAW/B,MAAX,EAAmBnC,MAAnB,C","sourcesContent":["import React from 'react';\nimport { withStyles } from '@material-ui/core/styles';\nimport ListItem from '@material-ui/core/ListItem';\nimport List from '@material-ui/core/List';\nimport Collapse from '@material-ui/core/Collapse';\nimport { color, UiLayout } from '@pie-lib/render-ui';\nimport PropTypes from 'prop-types';\n\nexport const RubricType = PropTypes.shape({\n excludeZero: PropTypes.bool,\n points: PropTypes.arrayOf(PropTypes.string),\n sampleAnswers: PropTypes.arrayOf(PropTypes.string),\n animationsDisabled: PropTypes.bool,\n});\n\nclass Rubric extends React.Component {\n dudUrl = 'javascript:;';\n\n constructor(props) {\n super(props);\n this.state = {\n rubricOpen: false,\n linkPrefix: 'Show',\n };\n this.toggleRubric = this.toggleRubric.bind(this);\n }\n\n static propTypes = {\n classes: PropTypes.object.isRequired,\n model: PropTypes.object.isRequired,\n animationsDisabled: PropTypes.bool,\n value: RubricType,\n };\n\n toggleRubric() {\n this.setState({ rubricOpen: !this.state.rubricOpen });\n this.setState({ linkPrefix: this.state.rubricOpen ? 'Show' : 'Hide' });\n }\n\n shouldRenderPoint = (index, value) => {\n if (!value.excludeZero) {\n return true;\n } else {\n return index !== 0;\n }\n };\n\n render() {\n const { model, value, classes } = this.props;\n let { animationsDisabled } = this.props;\n animationsDisabled = animationsDisabled || value.animationsDisabled;\n\n if (value && value.points) {\n const { extraCSSRules } = model || {};\n const { points, sampleAnswers } = value;\n\n const rubricList = (\n <List component=\"nav\">\n {points\n .slice(0)\n .reverse()\n .map((desc, index) => {\n index = points.length - index - 1;\n const pointsLabel = value.excludeZero ? index + 1 : index;\n\n return (\n <React.Fragment key={index}>\n <ListItem key={`P${index}`} className={classes.listColumn}>\n <h3 className={classes.titleText}>\n {pointsLabel === 1 ? `${pointsLabel} PT` : `${pointsLabel} PTS`}\n </h3>\n <div className={classes.text} dangerouslySetInnerHTML={{ __html: desc }} />\n </ListItem>\n\n {sampleAnswers && sampleAnswers[index] && (\n <ListItem key={`S${index}`} className={classes.listColumn}>\n <h4 className={classes.titleText} style={{ fontWeight: 'normal' }}>\n Sample Answer\n </h4>\n <div className={classes.text} dangerouslySetInnerHTML={{ __html: sampleAnswers[index] }} />\n </ListItem>\n )}\n </React.Fragment>\n );\n })}\n </List>\n );\n\n return (\n <UiLayout extraCSSRules={extraCSSRules} className={classes.root}>\n {/* screen reader only heading for navigation as per PD-5057 */}\n <h2 className={classes.hiddenScreenReader}>Rubric</h2>\n {!animationsDisabled ? (\n <React.Fragment>\n <h2\n id={'rubric-toggle'}\n className={classes.rubricToggle}\n tabIndex={0}\n role=\"button\"\n aria-expanded={this.state.rubricOpen}\n onClick={this.toggleRubric}\n onKeyPress={(e) => {\n if (e.key === 'Enter' || e.key === ' ') this.toggleRubric();\n }}\n >\n {this.state.linkPrefix} Rubric\n <span className={classes.chevronStyle} aria-hidden=\"true\">\n {this.state.rubricOpen ? (\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <polyline points=\"18 15 12 9 6 15\"></polyline>\n </svg>\n ) : (\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <polyline points=\"6 9 12 15 18 9\"></polyline>\n </svg>\n )}\n </span>\n </h2>\n <Collapse in={this.state.rubricOpen} timeout=\"auto\">\n {rubricList}\n </Collapse>\n </React.Fragment>\n ) : (\n rubricList\n )}\n </UiLayout>\n );\n } else {\n return null;\n }\n }\n}\n\nconst styles = (theme) => ({\n root: {\n color: color.text(),\n backgroundColor: color.background(),\n // apply styles to tables to match the rest of the UI\n '&:not(.MathJax) table': {\n borderCollapse: 'collapse',\n },\n '&:not(.MathJax) table td, &:not(.MathJax) table th': {\n padding: '8px 12px',\n textAlign: 'left',\n },\n // reset paragraph margins and line-height inside lists to override client styles\n '& ul p, & ol p': {\n marginBottom: 0,\n marginTop: 0,\n lineHeight: 'normal',\n },\n },\n listColumn: {\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'flex-start',\n padding: '12px 0px',\n },\n listColumnItem: {\n padding: 0,\n },\n text: {\n color: color.text(),\n },\n titleText: {\n color: color.text(),\n fontSize: '16px',\n fontWeight: '700',\n margin: 0,\n paddingBottom: '6px',\n },\n rubricToggle: {\n display: 'flex',\n alignItems: 'center',\n cursor: 'pointer',\n userSelect: 'none',\n fontSize: theme.typography.fontSize,\n fontWeight: '500',\n color: color.tertiary(),\n margin: 0,\n },\n chevronStyle: {\n display: 'inline-flex',\n transition: 'transform 0.2s',\n marginLeft: 2,\n alignSelf: 'center',\n },\n hiddenScreenReader: {\n position: 'absolute',\n width: '1px',\n height: '1px',\n padding: 0,\n margin: '-1px',\n overflow: 'hidden',\n clip: 'rect(0,0,0,0)',\n border: 0,\n whiteSpace: 'nowrap',\n },\n});\n\nexport default withStyles(styles)(Rubric);\n"],"file":"main.js"}
|
|
1
|
+
{"version":3,"file":"main.js","names":["_react","_interopRequireDefault","require","_styles","_ListItem","_List","_Collapse","_renderUi","_propTypes","StyledUiLayout","styled","UiLayout","theme","color","text","backgroundColor","background","borderCollapse","padding","textAlign","marginBottom","marginTop","lineHeight","StyledListItem","ListItem","display","flexDirection","alignItems","Text","TitleText","fontSize","fontWeight","margin","paddingBottom","SampleTitleText","RubricToggle","cursor","userSelect","typography","tertiary","ChevronStyle","transition","marginLeft","alignSelf","HiddenScreenReader","position","width","height","overflow","clip","border","whiteSpace","RubricType","exports","PropTypes","shape","excludeZero","bool","points","arrayOf","string","sampleAnswers","animationsDisabled","Rubric","React","Component","constructor","props","_defineProperty2","default","index","value","state","rubricOpen","linkPrefix","toggleRubric","bind","setState","render","model","extraCSSRules","rubricList","createElement","component","slice","reverse","map","desc","length","pointsLabel","Fragment","key","dangerouslySetInnerHTML","__html","id","tabIndex","role","onClick","onKeyPress","e","viewBox","fill","stroke","strokeWidth","strokeLinecap","strokeLinejoin","in","timeout","enter","exit","object","isRequired","_default"],"sources":["../src/main.jsx"],"sourcesContent":["import React from 'react';\nimport { styled } from '@mui/material/styles';\nimport ListItem from '@mui/material/ListItem';\nimport List from '@mui/material/List';\nimport Collapse from '@mui/material/Collapse';\nimport { color, UiLayout } from '@pie-lib/render-ui';\nimport PropTypes from 'prop-types';\n\nconst StyledUiLayout = styled(UiLayout)(({ theme }) => ({\n color: color.text(),\n backgroundColor: color.background(),\n // apply styles to tables to match the rest of the UI\n '&:not(.MathJax) table': {\n borderCollapse: 'collapse',\n },\n '&:not(.MathJax) table td, &:not(.MathJax) table th': {\n padding: '8px 12px',\n textAlign: 'left',\n },\n // reset paragraph margins and line-height inside lists to override client styles\n '& ul p, & ol p': {\n marginBottom: 0,\n marginTop: 0,\n lineHeight: 'normal',\n },\n}));\n\nconst StyledListItem = styled(ListItem)({\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'flex-start',\n padding: '12px 0px',\n});\n\nconst Text = styled('div')({\n color: color.text(),\n});\n\nconst TitleText = styled('h3')({\n color: color.text(),\n fontSize: '16px',\n fontWeight: '700',\n margin: 0,\n paddingBottom: '6px',\n});\n\nconst SampleTitleText = styled('h4')({\n color: color.text(),\n fontSize: '16px',\n fontWeight: 'normal',\n margin: 0,\n paddingBottom: '6px',\n});\n\nconst RubricToggle = styled('h2')(({ theme }) => ({\n display: 'flex',\n alignItems: 'center',\n cursor: 'pointer',\n userSelect: 'none',\n fontSize: theme.typography.fontSize,\n fontWeight: '500',\n color: color.tertiary(),\n margin: 0,\n}));\n\nconst ChevronStyle = styled('span')({\n display: 'inline-flex',\n transition: 'transform 0.2s',\n marginLeft: 2,\n alignSelf: 'center',\n});\n\nconst HiddenScreenReader = styled('h2')({\n position: 'absolute',\n width: '1px',\n height: '1px',\n padding: 0,\n margin: '-1px',\n overflow: 'hidden',\n clip: 'rect(0,0,0,0)',\n border: 0,\n whiteSpace: 'nowrap',\n});\n\nexport const RubricType = PropTypes.shape({\n excludeZero: PropTypes.bool,\n points: PropTypes.arrayOf(PropTypes.string),\n sampleAnswers: PropTypes.arrayOf(PropTypes.string),\n animationsDisabled: PropTypes.bool,\n});\n\nclass Rubric extends React.Component {\n dudUrl = 'javascript:;';\n\n constructor(props) {\n super(props);\n this.state = {\n rubricOpen: false,\n linkPrefix: 'Show',\n };\n this.toggleRubric = this.toggleRubric.bind(this);\n }\n\n static propTypes = {\n model: PropTypes.object.isRequired,\n animationsDisabled: PropTypes.bool,\n value: RubricType,\n };\n\n toggleRubric() {\n this.setState({ rubricOpen: !this.state.rubricOpen });\n this.setState({ linkPrefix: this.state.rubricOpen ? 'Show' : 'Hide' });\n }\n\n shouldRenderPoint = (index, value) => {\n if (!value.excludeZero) {\n return true;\n } else {\n return index !== 0;\n }\n };\n\n render() {\n const { model, value } = this.props;\n let { animationsDisabled } = this.props;\n animationsDisabled = animationsDisabled || value.animationsDisabled;\n\n if (value && value.points) {\n const { extraCSSRules } = model || {};\n const { points, sampleAnswers } = value;\n\n const rubricList = (\n <List component=\"nav\">\n {points\n .slice(0)\n .reverse()\n .map((desc, index) => {\n index = points.length - index - 1;\n const pointsLabel = value.excludeZero ? index + 1 : index;\n\n return (\n <React.Fragment key={index}>\n <StyledListItem key={`P${index}`}>\n <TitleText>\n {pointsLabel === 1 ? `${pointsLabel} PT` : `${pointsLabel} PTS`}\n </TitleText>\n <Text dangerouslySetInnerHTML={{ __html: desc }} />\n </StyledListItem>\n\n {sampleAnswers && sampleAnswers[index] && (\n <StyledListItem key={`S${index}`}>\n <SampleTitleText>\n Sample Answer\n </SampleTitleText>\n <Text dangerouslySetInnerHTML={{ __html: sampleAnswers[index] }} />\n </StyledListItem>\n )}\n </React.Fragment>\n );\n })}\n </List>\n );\n\n return (\n <StyledUiLayout extraCSSRules={extraCSSRules}>\n {/* screen reader only heading for navigation as per PD-5057 */}\n <HiddenScreenReader>Rubric</HiddenScreenReader>\n {!animationsDisabled ? (\n <React.Fragment>\n <RubricToggle\n id={'rubric-toggle'}\n tabIndex={0}\n role=\"button\"\n aria-expanded={this.state.rubricOpen}\n onClick={this.toggleRubric}\n onKeyPress={(e) => {\n if (e.key === 'Enter' || e.key === ' ') this.toggleRubric();\n }}\n >\n {this.state.linkPrefix} Rubric\n <ChevronStyle aria-hidden=\"true\">\n {this.state.rubricOpen ? (\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <polyline points=\"18 15 12 9 6 15\"></polyline>\n </svg>\n ) : (\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <polyline points=\"6 9 12 15 18 9\"></polyline>\n </svg>\n )}\n </ChevronStyle>\n </RubricToggle>\n <Collapse in={this.state.rubricOpen} timeout={{ enter: 225, exit: 195 }}>\n {rubricList}\n </Collapse>\n </React.Fragment>\n ) : (\n rubricList\n )}\n </StyledUiLayout>\n );\n } else {\n return null;\n }\n }\n}\n\nexport default Rubric;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,KAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,SAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAP,sBAAA,CAAAC,OAAA;AAEA,MAAMO,cAAc,GAAG,IAAAC,cAAM,EAACC,kBAAQ,CAAC,CAAC,CAAC;EAAEC;AAAM,CAAC,MAAM;EACtDC,KAAK,EAAEA,eAAK,CAACC,IAAI,CAAC,CAAC;EACnBC,eAAe,EAAEF,eAAK,CAACG,UAAU,CAAC,CAAC;EACnC;EACA,uBAAuB,EAAE;IACvBC,cAAc,EAAE;EAClB,CAAC;EACD,oDAAoD,EAAE;IACpDC,OAAO,EAAE,UAAU;IACnBC,SAAS,EAAE;EACb,CAAC;EACD;EAC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MAAE,GACrE5B,UACO,CACI,CAAC,GAEjBA,UAEY,CAAC;IAErB,CAAC,MAAM;MACL,OAAO,IAAI;IACb;EACF;AACF;AAAC,IAAAb,gBAAA,CAAAC,OAAA,EApIKN,MAAM,eAYS;EACjBgB,KAAK,EAAEzB,kBAAS,CAACwD,MAAM,CAACC,UAAU;EAClCjD,kBAAkB,EAAER,kBAAS,CAACG,IAAI;EAClCc,KAAK,EAAEnB;AACT,CAAC;AAAA,IAAA4D,QAAA,GAAA3D,OAAA,CAAAgB,OAAA,GAsHYN,MAAM","ignoreList":[]}
|
package/lib/print.js
CHANGED
|
@@ -1,85 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
exports
|
|
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
|
-
|
|
7
|
+
exports.default = void 0;
|
|
26
8
|
var _react = _interopRequireDefault(require("react"));
|
|
27
|
-
|
|
28
|
-
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
29
|
-
|
|
9
|
+
var _client = require("react-dom/client");
|
|
30
10
|
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
31
|
-
|
|
32
11
|
var _main = _interopRequireDefault(require("./main"));
|
|
33
|
-
|
|
34
12
|
var _mathRendering = require("@pie-lib/math-rendering");
|
|
35
|
-
|
|
36
13
|
var _debug = _interopRequireDefault(require("debug"));
|
|
37
|
-
|
|
38
|
-
|
|
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:rubric:print');
|
|
47
|
-
|
|
48
|
-
var preparePrintModel = function preparePrintModel(model, opts) {
|
|
49
|
-
var instr = opts.role === 'instructor';
|
|
50
|
-
|
|
14
|
+
const log = (0, _debug.default)('pie-element:rubric:print');
|
|
15
|
+
const preparePrintModel = (model, opts) => {
|
|
16
|
+
const instr = opts.role === 'instructor';
|
|
51
17
|
if (!instr) {
|
|
52
18
|
return {};
|
|
53
19
|
}
|
|
54
|
-
|
|
55
|
-
|
|
20
|
+
model.value = {
|
|
21
|
+
...model
|
|
22
|
+
};
|
|
56
23
|
model.mode = 'evaluate';
|
|
57
24
|
model.animationsDisabled = true;
|
|
58
25
|
return model;
|
|
59
26
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
var element = _this._options && /*#__PURE__*/_react["default"].createElement(_main["default"], _objectSpread({}, printModel));
|
|
79
|
-
|
|
80
|
-
_reactDom["default"].render(element, (0, _assertThisInitialized2["default"])(_this), function () {
|
|
27
|
+
class RubricPrint extends HTMLElement {
|
|
28
|
+
constructor() {
|
|
29
|
+
super();
|
|
30
|
+
this._options = null;
|
|
31
|
+
this._model = null;
|
|
32
|
+
this._session = [];
|
|
33
|
+
this._root = null;
|
|
34
|
+
this._rerender = (0, _debounce.default)(() => {
|
|
35
|
+
if (this._model && this._session) {
|
|
36
|
+
const printModel = preparePrintModel(this._model, this._options);
|
|
37
|
+
const element = this._options && /*#__PURE__*/_react.default.createElement(_main.default, {
|
|
38
|
+
...printModel
|
|
39
|
+
});
|
|
40
|
+
if (!this._root) {
|
|
41
|
+
this._root = (0, _client.createRoot)(this);
|
|
42
|
+
}
|
|
43
|
+
this._root.render(element);
|
|
44
|
+
queueMicrotask(() => {
|
|
81
45
|
log('render complete - render math');
|
|
82
|
-
(0, _mathRendering.renderMath)(
|
|
46
|
+
(0, _mathRendering.renderMath)(this);
|
|
83
47
|
});
|
|
84
48
|
} else {
|
|
85
49
|
log('skip');
|
|
@@ -88,27 +52,20 @@ var RubricPrint = /*#__PURE__*/function (_HTMLElement) {
|
|
|
88
52
|
leading: false,
|
|
89
53
|
trailing: true
|
|
90
54
|
});
|
|
91
|
-
return _this;
|
|
92
55
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
this._rerender();
|
|
56
|
+
set options(o) {
|
|
57
|
+
this._options = o;
|
|
58
|
+
}
|
|
59
|
+
set model(s) {
|
|
60
|
+
this._model = s;
|
|
61
|
+
this._rerender();
|
|
62
|
+
}
|
|
63
|
+
connectedCallback() {}
|
|
64
|
+
disconnectedCallback() {
|
|
65
|
+
if (this._root) {
|
|
66
|
+
this._root.unmount();
|
|
105
67
|
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}]);
|
|
110
|
-
return RubricPrint;
|
|
111
|
-
}( /*#__PURE__*/(0, _wrapNativeSuper2["default"])(HTMLElement));
|
|
112
|
-
|
|
113
|
-
exports["default"] = RubricPrint;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.default = RubricPrint;
|
|
114
71
|
//# sourceMappingURL=print.js.map
|
package/lib/print.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"print.js","names":["_react","_interopRequireDefault","require","_client","_debounce","_main","_mathRendering","_debug","log","debug","preparePrintModel","model","opts","instr","role","value","mode","animationsDisabled","RubricPrint","HTMLElement","constructor","_options","_model","_session","_root","_rerender","debounce","printModel","element","React","createElement","Main","createRoot","render","queueMicrotask","renderMath","leading","trailing","options","o","s","connectedCallback","disconnectedCallback","unmount","exports","default"],"sources":["../src/print.js"],"sourcesContent":["import React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport debounce from 'lodash/debounce';\nimport Main from './main';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport debug from 'debug';\n\nconst log = debug('pie-element:rubric:print');\n\nconst preparePrintModel = (model, opts) => {\n const instr = opts.role === 'instructor';\n\n if (!instr) {\n return {};\n }\n\n model.value = { ...model };\n model.mode = 'evaluate';\n model.animationsDisabled = true;\n\n return model;\n};\n\nexport default class RubricPrint extends HTMLElement {\n constructor() {\n super();\n this._options = null;\n this._model = null;\n this._session = [];\n this._root = null;\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 ...printModel,\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(element);\n queueMicrotask(() => {\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 disconnectedCallback() {\n if (this._root) {\n this._root.unmount();\n }\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,KAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAN,sBAAA,CAAAC,OAAA;AAEA,MAAMM,GAAG,GAAG,IAAAC,cAAK,EAAC,0BAA0B,CAAC;AAE7C,MAAMC,iBAAiB,GAAGA,CAACC,KAAK,EAAEC,IAAI,KAAK;EACzC,MAAMC,KAAK,GAAGD,IAAI,CAACE,IAAI,KAAK,YAAY;EAExC,IAAI,CAACD,KAAK,EAAE;IACV,OAAO,CAAC,CAAC;EACX;EAEAF,KAAK,CAACI,KAAK,GAAG;IAAE,GAAGJ;EAAM,CAAC;EAC1BA,KAAK,CA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ClB,MAAM,GAAGkB,CAAC;IACf,IAAI,CAACf,SAAS,CAAC,CAAC;EAClB;EAEAgB,iBAAiBA,CAAA,EAAG,CAAC;EAErBC,oBAAoBA,CAAA,EAAG;IACrB,IAAI,IAAI,CAAClB,KAAK,EAAE;MACd,IAAI,CAACA,KAAK,CAACmB,OAAO,CAAC,CAAC;IACtB;EACF;AACF;AAACC,OAAA,CAAAC,OAAA,GAAA3B,WAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/rubric",
|
|
3
|
-
"version": "6.0
|
|
3
|
+
"version": "6.2.0-mui-update.0",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"module": "src/index.js",
|
|
6
6
|
"description": "Rubric Scoring Interaction",
|
|
@@ -9,37 +9,23 @@
|
|
|
9
9
|
"access": "public"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@
|
|
13
|
-
"@
|
|
14
|
-
"@
|
|
12
|
+
"@emotion/react": "^11.14.0",
|
|
13
|
+
"@emotion/style": "^0.8.0",
|
|
14
|
+
"@mui/icons-material": "^7.3.4",
|
|
15
|
+
"@mui/material": "^7.3.4",
|
|
16
|
+
"@pie-lib/math-rendering": "3.33.1-mui-update.0",
|
|
17
|
+
"@pie-lib/render-ui": "4.42.1-mui-update.0",
|
|
15
18
|
"prop-types": "^15.7.2"
|
|
16
19
|
},
|
|
17
20
|
"author": "pie framework developers",
|
|
18
21
|
"license": "ISC",
|
|
19
|
-
"gitHead": "
|
|
22
|
+
"gitHead": "0e14ff981bcdc8a89a0e58484026496701bfdbc3",
|
|
20
23
|
"scripts": {
|
|
21
24
|
"postpublish": "../../scripts/postpublish"
|
|
22
25
|
},
|
|
23
26
|
"exports": {
|
|
24
|
-
".":
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"default": "./esm/element.js"
|
|
28
|
-
},
|
|
29
|
-
"./configure": {
|
|
30
|
-
"import": "./esm/configure.js",
|
|
31
|
-
"require": "./configure/lib/index.js",
|
|
32
|
-
"default": "./esm/configure.js"
|
|
33
|
-
},
|
|
34
|
-
"./controller": {
|
|
35
|
-
"import": "./esm/controller.js",
|
|
36
|
-
"require": "./controller/lib/index.js",
|
|
37
|
-
"default": "./esm/controller.js"
|
|
38
|
-
},
|
|
39
|
-
"./print": {
|
|
40
|
-
"import": "./esm/print.js",
|
|
41
|
-
"require": "./lib/print.js",
|
|
42
|
-
"default": "./esm/print.js"
|
|
43
|
-
}
|
|
27
|
+
".": "./src/index.js",
|
|
28
|
+
"./print": "./src/print.js",
|
|
29
|
+
"./configure/lib": "./configure/lib/index.js"
|
|
44
30
|
}
|
|
45
31
|
}
|