@pie-element/charting 2.7.29 → 2.7.30
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 +8 -0
- package/configure/CHANGELOG.md +8 -0
- package/configure/lib/charting-config.js +1 -0
- package/configure/lib/charting-config.js.map +1 -1
- package/configure/lib/defaults.js +0 -1
- package/configure/lib/defaults.js.map +1 -1
- package/configure/package.json +4 -4
- package/controller/CHANGELOG.md +8 -0
- package/controller/lib/index.js +1 -2
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +1 -1
- package/docs/demo/generate.js +0 -6
- package/docs/demo/session.js +0 -3
- package/docs/pie-schema.json +0 -42
- package/docs/pie-schema.json.md +0 -4
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [2.7.30](https://github.com/pie-framework/pie-elements/compare/@pie-element/charting@2.7.29...@pie-element/charting@2.7.30) (2022-05-30)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @pie-element/charting
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [2.7.29](https://github.com/pie-framework/pie-elements/compare/@pie-element/charting@2.7.28...@pie-element/charting@2.7.29) (2022-05-16)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @pie-element/charting
|
package/configure/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [2.1.49](https://github.com/pie-framework/pie-elements/compare/@pie-element/charting-configure@2.1.48...@pie-element/charting-configure@2.1.49) (2022-05-30)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @pie-element/charting-configure
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [2.1.48](https://github.com/pie-framework/pie-elements/compare/@pie-element/charting-configure@2.1.47...@pie-element/charting-configure@2.1.48) (2022-05-16)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @pie-element/charting-configure
|
|
@@ -98,6 +98,7 @@ var ChartingConfig = /*#__PURE__*/function (_React$Component) {
|
|
|
98
98
|
component: "div",
|
|
99
99
|
type: "body1"
|
|
100
100
|
}, /*#__PURE__*/React.createElement("span", null, "Use the tools below to set background shapes")), /*#__PURE__*/React.createElement(_charting.Chart, {
|
|
101
|
+
defineChart: true,
|
|
101
102
|
chartType: model.chartType,
|
|
102
103
|
size: model.graph,
|
|
103
104
|
domain: model.domain,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/charting-config.jsx"],"names":["styles","theme","container","marginTop","spacing","unit","marginBottom","display","flex","column","ChartingConfig","data","props","onChange","model","classes","charts","chartType","graph","domain","range","title","changeData","categoryDefaultLabel","React","Component","PropTypes","object","isRequired","func","array"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAAAC,KAAK;AAAA,SAAK;AACvBC,IAAAA,SAAS,EAAE;AACTC,MAAAA,SAAS,EAAEF,KAAK,CAACG,OAAN,CAAcC,IAAd,GAAqB,CADvB;AAETC,MAAAA,YAAY,EAAEL,KAAK,CAACG,OAAN,CAAcC,IAAd,GAAqB,CAF1B;AAGTE,MAAAA,OAAO,EAAE,MAHA;AAITC,MAAAA,IAAI,EAAE;AAJG,KADY;AAOvBC,IAAAA,MAAM,EAAE;AACND,MAAAA,IAAI,EAAE;AADA;AAPe,GAAL;AAAA,CAApB;;IAYaE,c;;;;;;;;;;;;;;;mGAQE,UAAAC,IAAI;AAAA,aAAI,MAAKC,KAAL,CAAWC,QAAX,iCAAyB,MAAKD,KAAL,CAAWE,KAApC;AAA2CH,QAAAA,IAAI,EAAJA;AAA3C,SAAJ;AAAA,K;;;;;;WAEjB,kBAAS;AACP,wBAAmC,KAAKC,KAAxC;AAAA,UAAQG,OAAR,eAAQA,OAAR;AAAA,UAAiBD,KAAjB,eAAiBA,KAAjB;AAAA,UAAwBE,MAAxB,eAAwBA,MAAxB;AAEA,0BACE,yEAGE;AAAK,QAAA,SAAS,EAAED,OAAO,CAACb;AAAxB,sBACE;AAAK,QAAA,SAAS,EAAEa,OAAO,CAACN,MAAxB;AAAgC,QAAA,GAAG,EAAC;AAApC,sBACE,oBAAC,sBAAD;AAAY,QAAA,SAAS,EAAC,KAAtB;AAA4B,QAAA,IAAI,EAAC;AAAjC,sBACE,iFADF,CADF,eAKE,oBAAC,eAAD;AACE,QAAA,SAAS,EAAEK,KAAK,CAACG,
|
|
1
|
+
{"version":3,"sources":["../src/charting-config.jsx"],"names":["styles","theme","container","marginTop","spacing","unit","marginBottom","display","flex","column","ChartingConfig","data","props","onChange","model","classes","charts","chartType","graph","domain","range","title","changeData","categoryDefaultLabel","React","Component","PropTypes","object","isRequired","func","array"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAAAC,KAAK;AAAA,SAAK;AACvBC,IAAAA,SAAS,EAAE;AACTC,MAAAA,SAAS,EAAEF,KAAK,CAACG,OAAN,CAAcC,IAAd,GAAqB,CADvB;AAETC,MAAAA,YAAY,EAAEL,KAAK,CAACG,OAAN,CAAcC,IAAd,GAAqB,CAF1B;AAGTE,MAAAA,OAAO,EAAE,MAHA;AAITC,MAAAA,IAAI,EAAE;AAJG,KADY;AAOvBC,IAAAA,MAAM,EAAE;AACND,MAAAA,IAAI,EAAE;AADA;AAPe,GAAL;AAAA,CAApB;;IAYa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AAiBC,UAFP;AAGjBf,EAAAA,QAAQ,EAAEa,sBAAUG,IAAV,CAAeD,UAHR;AAIjBZ,EAAAA,MAAM,EAAEU,sBAAUI;AAJD,C;;eA4CN,wBAAW9B,MAAX,EAAmBU,cAAnB,C","sourcesContent":["import * as React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport { Chart } from '@pie-lib/charting';\n\nimport Typography from '@material-ui/core/Typography';\n\nconst styles = theme => ({\n container: {\n marginTop: theme.spacing.unit * 3,\n marginBottom: theme.spacing.unit * 3,\n display: 'flex',\n flex: 1,\n },\n column: {\n flex: 1\n }\n});\n\nexport class ChartingConfig extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n model: PropTypes.object.isRequired,\n onChange: PropTypes.func.isRequired,\n charts: PropTypes.array\n };\n\n changeData = data => this.props.onChange({ ...this.props.model, data });\n\n render() {\n const { classes, model, charts } = this.props;\n\n return (\n <div>\n Define Graph Attributes\n\n <div className={classes.container}>\n <div className={classes.column} key=\"graph\">\n <Typography component=\"div\" type=\"body1\">\n <span>Use the tools below to set background shapes</span>\n </Typography>\n\n <Chart\n defineChart={true}\n chartType={model.chartType}\n size={model.graph}\n domain={model.domain}\n range={model.range}\n charts={charts}\n data={model.data}\n title={model.title}\n onDataChange={this.changeData}\n editCategoryEnabled={true}\n addCategoryEnabled={true}\n categoryDefaultLabel={model.categoryDefaultLabel}\n />\n </div>\n\n </div>\n </div>\n );\n }\n}\n\nexport default withStyles(styles)(ChartingConfig);\n"],"file":"charting-config.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/defaults.js"],"names":["model","addCategoryEnabled","categoryDefaultLabel","chartType","correctAnswer","data","domain","label","editCategoryEnabled","graph","width","height","prompt","promptEnabled","rationale","range","max","min","scoringType","title","rationaleEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","configuration","spellCheck","settings","enabled","studentInstructions","teacherInstructions"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;
|
|
1
|
+
{"version":3,"sources":["../src/defaults.js"],"names":["model","addCategoryEnabled","categoryDefaultLabel","chartType","correctAnswer","data","domain","label","editCategoryEnabled","graph","width","height","prompt","promptEnabled","rationale","range","max","min","scoringType","title","rationaleEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","configuration","spellCheck","settings","enabled","studentInstructions","teacherInstructions"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;eAEe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,kBAAkB,EAAE,IADf;AAELC,IAAAA,oBAAoB,EAAE,UAFjB;AAGLC,IAAAA,SAAS,EAAE,WAHN;AAILC,IAAAA,aAAa,EAAE,EAJV;AAKLC,IAAAA,IAAI,EAAE,EALD;AAMLC,IAAAA,MAAM,EAAE;AACNC,MAAAA,KAAK,EAAE;AADD,KANH;AASLC,IAAAA,mBAAmB,EAAE,IAThB;AAULC,IAAAA,KAAK,EAAE;AACLC,MAAAA,KAAK,EAAE,GADF;AAELC,MAAAA,MAAM,EAAE;AAFH,KAVF;AAcLC,IAAAA,MAAM,EAAE,sBAdH;AAeLC,IAAAA,aAAa,EAAE,IAfV;AAgBLC,IAAAA,SAAS,EAAE,sBAhBN;AAiBLC,IAAAA,KAAK,EAAE;AACLR,MAAAA,KAAK,EAAE,QADF;AAELS,MAAAA,GAAG,EAAE,GAFA;AAGLC,MAAAA,GAAG,EAAE;AAHA,KAjBF;AAsBLC,IAAAA,WAAW,EAAE,gBAtBR;AAuBLC,IAAAA,KAAK,EAAE,kBAvBF;AAwBLC,IAAAA,gBAAgB,EAAE,IAxBb;AAyBLC,IAAAA,0BAA0B,EAAE,IAzBvB;AA0BLC,IAAAA,0BAA0B,EAAE;AA1BvB,GADM;AA6BbC,EAAAA,aAAa,EAAE;AACbC,IAAAA,UAAU,EAAE;AACVjB,MAAAA,KAAK,EAAE,YADG;AAEVkB,MAAAA,QAAQ,EAAC,KAFC;AAGVC,MAAAA,OAAO,EAAC;AAHE,KADC;AAMbd,IAAAA,MAAM,EAAE;AACNa,MAAAA,QAAQ,EAAE,IADJ;AAENlB,MAAAA,KAAK,EAAE;AAFD,KANK;AAUbO,IAAAA,SAAS,EAAE;AACTW,MAAAA,QAAQ,EAAE,IADD;AAETlB,MAAAA,KAAK,EAAE;AAFE,KAVE;AAcbW,IAAAA,WAAW,EAAE;AACXO,MAAAA,QAAQ,EAAE,KADC;AAEXlB,MAAAA,KAAK,EAAE;AAFI,KAdA;AAkBboB,IAAAA,mBAAmB,EAAE;AACnBF,MAAAA,QAAQ,EAAE,KADS;AAEnBlB,MAAAA,KAAK,EAAE;AAFY,KAlBR;AAsBbqB,IAAAA,mBAAmB,EAAE;AACnBH,MAAAA,QAAQ,EAAE,IADS;AAEnBlB,MAAAA,KAAK,EAAE;AAFY,KAtBR;AA0BbY,IAAAA,KAAK,EAAE;AACLM,MAAAA,QAAQ,EAAE,KADL;AAELlB,MAAAA,KAAK,EAAE;AAFF;AA1BM;AA7BF,C","sourcesContent":["/**\n * NOTE: There's no functionality described for graphTitle,\n * rationale, scoringType, studentInstructions, teacherInstructions\n * so there's no implementation (they are only added in model)\n */\n\n\n// const createCategory = (label, value) => ({\n// label,\n// value,\n// interactive: true,\n// editable: true,\n// deletable: true\n// });\n\nexport default {\n model: {\n addCategoryEnabled: true,\n categoryDefaultLabel: 'Category',\n chartType: 'lineCross',\n correctAnswer: {},\n data: [],\n domain: {\n label: 'Fruits',\n },\n editCategoryEnabled: true,\n graph: {\n width: 480,\n height: 480\n },\n prompt: 'Here goes item stem!',\n promptEnabled: true,\n rationale: 'Rationale goes here!',\n range: {\n label: 'Amount',\n max: 5.5,\n min: 0,\n },\n scoringType: 'all or nothing',\n title: 'This is a chart!',\n rationaleEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n },\n configuration: {\n spellCheck: {\n label: 'Spellcheck',\n settings:false,\n enabled:true\n },\n prompt: {\n settings: true,\n label: 'Item Stem'\n },\n rationale: {\n settings: true,\n label: 'Rationale'\n },\n scoringType: {\n settings: false,\n label: 'Scoring Type'\n },\n studentInstructions: {\n settings: false,\n label: 'Student Instructions'\n },\n teacherInstructions: {\n settings: true,\n label: 'Teacher Instructions'\n },\n title: {\n settings: false,\n label: 'Graph Title'\n }\n }\n};\n"],"file":"defaults.js"}
|
package/configure/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/charting-configure",
|
|
3
3
|
"private": true,
|
|
4
|
-
"version": "2.1.
|
|
4
|
+
"version": "2.1.49",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "src/index.js",
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@material-ui/core": "^3.9.2",
|
|
11
11
|
"@pie-framework/pie-configure-events": "^1.2.0",
|
|
12
|
-
"@pie-lib/charting": "^4.5.
|
|
13
|
-
"@pie-lib/config-ui": "^10.13.
|
|
14
|
-
"@pie-lib/editable-html": "^7.22.
|
|
12
|
+
"@pie-lib/charting": "^4.5.16",
|
|
13
|
+
"@pie-lib/config-ui": "^10.13.2",
|
|
14
|
+
"@pie-lib/editable-html": "^7.22.5",
|
|
15
15
|
"classnames": "^2.2.5",
|
|
16
16
|
"debug": "^4.1.1",
|
|
17
17
|
"prop-types": "^15.6.2",
|
package/controller/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [2.2.23](https://github.com/pie-framework/pie-elements/compare/@pie-element/charting-controller@2.2.22...@pie-element/charting-controller@2.2.23) (2022-05-30)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @pie-element/charting-controller
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [2.2.22](https://github.com/pie-framework/pie-elements/compare/@pie-element/charting-controller@2.2.21...@pie-element/charting-controller@2.2.22) (2022-01-10)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @pie-element/charting-controller
|
package/controller/lib/index.js
CHANGED
|
@@ -187,8 +187,7 @@ var filterCategories = function filterCategories(categories, editable) {
|
|
|
187
187
|
return categories ? categories.map(function (category) {
|
|
188
188
|
return _objectSpread(_objectSpread({}, category), {}, {
|
|
189
189
|
deletable: false,
|
|
190
|
-
editable: editable
|
|
191
|
-
initial: true
|
|
190
|
+
editable: editable
|
|
192
191
|
});
|
|
193
192
|
}) : [];
|
|
194
193
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["log","lowerCase","string","toLowerCase","checkLabelsEquality","givenAnswerLabel","correctAnswerLabel","setCorrectness","answers","partialScoring","map","answer","correctness","value","label","normalize","question","addCategoryEnabled","editCategoryEnabled","promptEnabled","rationaleEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","getScore","session","env","correctAnswer","data","initialData","scoringType","isPartialScoring","enabled","undefined","correctAnswers","defaultAnswers","filterCategories","result","maxScore","score","scoreForLabelAndValueEditable","corrAnswer","forEach","index","defaultAnswer","editable","interactive","length","slice","parseFloat","toFixed","categories","category","deletable","initial","model","Promise","resolve","normalizedQuestion","categoryDefaultLabel","chartType","domain","graph","prompt","range","rationale","title","teacherInstructions","correctInfo","base","size","disabled","mode","correctedAnswer","rest","role","outcome","empty","createCorrectResponseSession","id"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAEA;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,kCAAN,CAAZ;;AAEA,IAAMC,SAAS,GAAG,SAAZA,SAAY,CAAAC,MAAM;AAAA,SAAI,CAACA,MAAM,IAAI,EAAX,EAAeC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AAa,YAA5C,EAA0D;AACxD,UAAQhD,aAAR,GAA0BV,QAA1B,CAAQU,aAAR;AAEA8B,MAAAA,OAAO,CAAC;AACN7C,QAAAA,MAAM,EAAEe,aAAa,IAAIA,aAAa,CAACC,IADjC;AAENmD,QAAAA,EAAE,EAAE;AAFE,OAAD,CAAP;AAID,KAPD,MAOO;AACL,aAAOtB,OAAO,CAAC,IAAD,CAAd;AACD;AACF,GAXM,CAAP;AAYD,CAbM","sourcesContent":["import debug from 'debug';\nimport isEmpty from 'lodash/isEmpty';\n\nimport { partialScoring } from '@pie-lib/controller-utils';\n\nconst log = debug('@pie-element:graphing:controller');\n\nconst lowerCase = string => (string || '').toLowerCase();\n\nexport const checkLabelsEquality = (givenAnswerLabel, correctAnswerLabel) =>\n lowerCase(givenAnswerLabel) === lowerCase(correctAnswerLabel);\n\nexport const setCorrectness = (answers, partialScoring) => answers ? answers.map(answer => ({\n ...answer,\n correctness: {\n value: partialScoring ? 'incorrect' : 'correct',\n label: partialScoring ? 'incorrect' : 'correct'\n }\n})) : [];\n\n\nexport const normalize = question => ({\n addCategoryEnabled: true,\n editCategoryEnabled: true,\n promptEnabled: true,\n rationaleEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n ...question,\n});\n\nexport const getScore = (question, session, env = {}) => {\n const { correctAnswer, data: initialData = [], scoringType, editCategoryEnabled } = question;\n\n const isPartialScoring = partialScoring.enabled(\n { partialScoring: scoringType !== undefined ? scoringType === 'partial scoring' : scoringType },\n env\n );\n\n const { data: correctAnswers = [] } = correctAnswer || {};\n const defaultAnswers = filterCategories(initialData, editCategoryEnabled);\n\n let answers = setCorrectness((session && session.answer) || defaultAnswers, isPartialScoring);\n\n let result = 0;\n\n if (isPartialScoring) {\n // if score type is \"partial scoring\"\n // maxScore is calculated based on the correct response\n // score is calculated based on the given response\n let maxScore = 0;\n let score = 0;\n\n const scoreForLabelAndValueEditable = (answer, corrAnswer) => {\n const { value, label } = answer;\n\n maxScore += 2;\n\n if (value === corrAnswer.value) {\n score += 1;\n answer.correctness.value = 'correct';\n }\n\n if (checkLabelsEquality(label, corrAnswer.label)) {\n score += 1;\n answer.correctness.label = 'correct';\n }\n };\n\n // if given answer has more categories than the correct answers, the \"extra\" will be ignored\n correctAnswers.forEach((corrAnswer, index) => {\n const defaultAnswer = defaultAnswers[index];\n const answer = answers[index];\n\n // if there is a corresponding category at the same position in the given answer\n if (answer) {\n // if there is a corresponding category at the same position in the default answer\n if (defaultAnswer) {\n // if category's label (in default answer) was not editable\n // it means that this category values only one point (only the value can be changed)\n if (!defaultAnswer.editable && answer.interactive) {\n maxScore += 1;\n\n if (answer.value === corrAnswer.value) {\n score += 1;\n answer.correctness.value = 'correct';\n }\n answer.correctness.label = 'correct';\n\n // if category's label (in default answer) was editable\n // it means that this category values 2 points (both label and value can be changed)\n } else if (defaultAnswer.editable && answer.interactive) {\n scoreForLabelAndValueEditable(answer, corrAnswer);\n } else if (!answer.interactive) {\n answer.correctness.value = 'correct';\n answer.correctness.label = 'correct';\n }\n } else {\n // if there is not a corresponding category at the same position in the default answer\n scoreForLabelAndValueEditable(answer, corrAnswer);\n }\n } else {\n // if there is not a corresponding category at the same position in the given answer\n // it means that the given answer has less categories than the correct answer\n maxScore += 2;\n }\n });\n\n result = maxScore ? score / maxScore : 0;\n } else {\n // if scoring type is \"all or nothing\"\n // the length on correct answers and length of given answer have to match\n result = correctAnswers.length === answers.length ? 1 : 0;\n\n if (result) {\n // if there is at least one difference between the correct answer and the given answer\n // the result will be incorrect\n correctAnswers.forEach((corrAnswer, index) => {\n const { value, label } = answers[index];\n\n if (value !== corrAnswer.value) {\n result = 0;\n answers[index].correctness.value = 'incorrect';\n }\n if (lowerCase(label) !== lowerCase(corrAnswer.label)) {\n result = 0;\n answers[index].correctness.label = 'incorrect';\n }\n });\n } else {\n answers = [\n ...answers.slice(0, correctAnswers.length),\n ...setCorrectness(answers.slice(correctAnswers.length), true)\n ];\n }\n }\n\n return {\n score: parseFloat(result.toFixed(2)),\n answers\n };\n};\n\nexport const filterCategories = (categories, editable) => categories ? categories.map(category => ({\n ...category,\n deletable: false,\n editable,\n initial: true\n})) : [];\n\nexport function model(question, session, env) {\n return new Promise(resolve => {\n const normalizedQuestion = normalize(question);\n const {\n addCategoryEnabled,\n categoryDefaultLabel,\n chartType,\n data,\n domain,\n editCategoryEnabled,\n graph,\n prompt,\n promptEnabled,\n range,\n rationale,\n title,\n rationaleEnabled,\n teacherInstructions,\n teacherInstructionsEnabled,\n correctAnswer,\n scoringType\n } = normalizedQuestion;\n\n const correctInfo = { correctness: 'incorrect', score: '0%' };\n\n const base = {\n addCategoryEnabled,\n categoryDefaultLabel,\n chartType,\n data: filterCategories(data, editCategoryEnabled),\n domain,\n editCategoryEnabled,\n graph,\n prompt: promptEnabled ? prompt : null,\n range,\n rationale,\n title,\n size: graph,\n correctness: correctInfo,\n disabled: env.mode !== 'gather',\n scoringType\n };\n\n const answers = filterCategories(getScore(normalizedQuestion, session, env).answers, false);\n\n if (env.mode === 'view') {\n base.correctedAnswer = answers.map(({correctness, ...rest}) => {\n return { ...rest, interactive: false };\n });\n\n base.addCategoryEnabled = false;\n }\n\n if (env.mode === 'evaluate') {\n base.correctedAnswer = answers;\n base.correctAnswer = correctAnswer;\n base.addCategoryEnabled = false;\n }\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n base.rationale = rationaleEnabled ? rationale : null;\n base.teacherInstructions = teacherInstructionsEnabled ? teacherInstructions : null;\n } else {\n base.rationale = null;\n base.teacherInstructions = null;\n }\n\n log('base: ', base);\n resolve(base);\n });\n}\n\nexport function outcome(model, session, env) {\n return new Promise(resolve => {\n resolve({\n score: getScore(model, session, env).score,\n empty: !session || isEmpty(session)\n });\n });\n}\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise(resolve => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { correctAnswer } = question;\n\n resolve({\n answer: correctAnswer && correctAnswer.data,\n id: '1'\n });\n } else {\n return resolve(null);\n }\n });\n};\n"],"file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":["log","lowerCase","string","toLowerCase","checkLabelsEquality","givenAnswerLabel","correctAnswerLabel","setCorrectness","answers","partialScoring","map","answer","correctness","value","label","normalize","question","addCategoryEnabled","editCategoryEnabled","promptEnabled","rationaleEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","getScore","session","env","correctAnswer","data","initialData","scoringType","isPartialScoring","enabled","undefined","correctAnswers","defaultAnswers","filterCategories","result","maxScore","score","scoreForLabelAndValueEditable","corrAnswer","forEach","index","defaultAnswer","editable","interactive","length","slice","parseFloat","toFixed","categories","category","deletable","model","Promise","resolve","normalizedQuestion","categoryDefaultLabel","chartType","domain","graph","prompt","range","rationale","title","teacherInstructions","correctInfo","base","size","disabled","mode","correctedAnswer","rest","role","outcome","empty","createCorrectResponseSession","id"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAEA;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,kCAAN,CAAZ;;AAEA,IAAMC,SAAS,GAAG,SAAZA,SAAY,CAAAC,MAAM;AAAA,SAAI,CAACA,MAAM,IAAI,EAAX,EAAeC,WAAf,EAAJ;AAAA,CAAxB;;AAEO,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAsB,CAACC,gBAAD,EAAmBC,kBAAnB;AAAA,SACjCL,SAAS,CAACI,gBAAD,CAAT,KAAgCJ,SAAS,CAACK,kBAAD,CADR;AAAA,CAA5B;;;;AAGA,IAAMC,cAAc,GAAG,SAAjBA,cAAiB,CAACC,OAAD,EAAUC,cAAV;AAAA,SAA6BD,OAAO,GAAGA,OAAO,CAACE,GAAR,CAAY,UAAAC,MAAM;AAAA,2CAClFA,MADkF;AAErFC,MAAAA,WAAW,EAAE;AACXC,QAAAA,KAAK,EAAEJ,cAAc,GAAG,WAAH,GAAiB,SAD3B;AAEXK,QAAAA,KAAK,EAAEL,cAAc,GAAG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I,CAACF,mBAAL,GAA2B,IAA3B;AACD;;AAEDjE,IAAAA,GAAG,CAAC,QAAD,EAAWmE,IAAX,CAAH;AACAZ,IAAAA,OAAO,CAACY,IAAD,CAAP;AACD,GApEM,CAAP;AAqED;;AAEM,SAASO,OAAT,CAAiBrB,KAAjB,EAAwB7B,OAAxB,EAAiCC,GAAjC,EAAsC;AAC3C,SAAO,IAAI6B,OAAJ,CAAY,UAAAC,OAAO,EAAI;AAC5BA,IAAAA,OAAO,CAAC;AACNjB,MAAAA,KAAK,EAAEf,QAAQ,CAAC8B,KAAD,EAAQ7B,OAAR,EAAiBC,GAAjB,CAAR,CAA8Ba,KAD/B;AAENqC,MAAAA,KAAK,EAAE,CAACnD,OAAD,IAAY,yBAAQA,OAAR;AAFb,KAAD,CAAP;AAID,GALM,CAAP;AAMD;;AAEM,IAAMoD,4BAA4B,GAAG,SAA/BA,4BAA+B,CAAC5D,QAAD,EAAWS,GAAX,EAAmB;AAC7D,SAAO,IAAI6B,OAAJ,CAAY,UAAAC,OAAO,EAAI;AAC5B,QAAI9B,GAAG,CAAC6C,IAAJ,KAAa,UAAb,IAA2B7C,GAAG,CAACgD,IAAJ,KAAa,YAA5C,EAA0D;AACxD,UAAQ/C,aAAR,GAA0BV,QAA1B,CAAQU,aAAR;AAEA6B,MAAAA,OAAO,CAAC;AACN5C,QAAAA,MAAM,EAAEe,aAAa,IAAIA,aAAa,CAACC,IADjC;AAENkD,QAAAA,EAAE,EAAE;AAFE,OAAD,CAAP;AAID,KAPD,MAOO;AACL,aAAOtB,OAAO,CAAC,IAAD,CAAd;AACD;AACF,GAXM,CAAP;AAYD,CAbM","sourcesContent":["import debug from 'debug';\nimport isEmpty from 'lodash/isEmpty';\n\nimport { partialScoring } from '@pie-lib/controller-utils';\n\nconst log = debug('@pie-element:graphing:controller');\n\nconst lowerCase = string => (string || '').toLowerCase();\n\nexport const checkLabelsEquality = (givenAnswerLabel, correctAnswerLabel) =>\n lowerCase(givenAnswerLabel) === lowerCase(correctAnswerLabel);\n\nexport const setCorrectness = (answers, partialScoring) => answers ? answers.map(answer => ({\n ...answer,\n correctness: {\n value: partialScoring ? 'incorrect' : 'correct',\n label: partialScoring ? 'incorrect' : 'correct'\n }\n})) : [];\n\n\nexport const normalize = question => ({\n addCategoryEnabled: true,\n editCategoryEnabled: true,\n promptEnabled: true,\n rationaleEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n ...question,\n});\n\nexport const getScore = (question, session, env = {}) => {\n const { correctAnswer, data: initialData = [], scoringType, editCategoryEnabled } = question;\n\n const isPartialScoring = partialScoring.enabled(\n { partialScoring: scoringType !== undefined ? scoringType === 'partial scoring' : scoringType },\n env\n );\n\n const { data: correctAnswers = [] } = correctAnswer || {};\n const defaultAnswers = filterCategories(initialData, editCategoryEnabled);\n\n let answers = setCorrectness((session && session.answer) || defaultAnswers, isPartialScoring);\n\n let result = 0;\n\n if (isPartialScoring) {\n // if score type is \"partial scoring\"\n // maxScore is calculated based on the correct response\n // score is calculated based on the given response\n let maxScore = 0;\n let score = 0;\n\n const scoreForLabelAndValueEditable = (answer, corrAnswer) => {\n const { value, label } = answer;\n\n maxScore += 2;\n\n if (value === corrAnswer.value) {\n score += 1;\n answer.correctness.value = 'correct';\n }\n\n if (checkLabelsEquality(label, corrAnswer.label)) {\n score += 1;\n answer.correctness.label = 'correct';\n }\n };\n\n // if given answer has more categories than the correct answers, the \"extra\" will be ignored\n correctAnswers.forEach((corrAnswer, index) => {\n const defaultAnswer = defaultAnswers[index];\n const answer = answers[index];\n\n // if there is a corresponding category at the same position in the given answer\n if (answer) {\n // if there is a corresponding category at the same position in the default answer\n if (defaultAnswer) {\n // if category's label (in default answer) was not editable\n // it means that this category values only one point (only the value can be changed)\n if (!defaultAnswer.editable && answer.interactive) {\n maxScore += 1;\n\n if (answer.value === corrAnswer.value) {\n score += 1;\n answer.correctness.value = 'correct';\n }\n answer.correctness.label = 'correct';\n\n // if category's label (in default answer) was editable\n // it means that this category values 2 points (both label and value can be changed)\n } else if (defaultAnswer.editable && answer.interactive) {\n scoreForLabelAndValueEditable(answer, corrAnswer);\n } else if (!answer.interactive) {\n answer.correctness.value = 'correct';\n answer.correctness.label = 'correct';\n }\n } else {\n // if there is not a corresponding category at the same position in the default answer\n scoreForLabelAndValueEditable(answer, corrAnswer);\n }\n } else {\n // if there is not a corresponding category at the same position in the given answer\n // it means that the given answer has less categories than the correct answer\n maxScore += 2;\n }\n });\n\n result = maxScore ? score / maxScore : 0;\n } else {\n // if scoring type is \"all or nothing\"\n // the length on correct answers and length of given answer have to match\n result = correctAnswers.length === answers.length ? 1 : 0;\n\n if (result) {\n // if there is at least one difference between the correct answer and the given answer\n // the result will be incorrect\n correctAnswers.forEach((corrAnswer, index) => {\n const { value, label } = answers[index];\n\n if (value !== corrAnswer.value) {\n result = 0;\n answers[index].correctness.value = 'incorrect';\n }\n if (lowerCase(label) !== lowerCase(corrAnswer.label)) {\n result = 0;\n answers[index].correctness.label = 'incorrect';\n }\n });\n } else {\n answers = [\n ...answers.slice(0, correctAnswers.length),\n ...setCorrectness(answers.slice(correctAnswers.length), true)\n ];\n }\n }\n\n return {\n score: parseFloat(result.toFixed(2)),\n answers\n };\n};\n\nexport const filterCategories = (categories, editable) => categories ? categories.map(category => ({\n ...category,\n deletable: false,\n editable\n})) : [];\n\nexport function model(question, session, env) {\n return new Promise(resolve => {\n const normalizedQuestion = normalize(question);\n const {\n addCategoryEnabled,\n categoryDefaultLabel,\n chartType,\n data,\n domain,\n editCategoryEnabled,\n graph,\n prompt,\n promptEnabled,\n range,\n rationale,\n title,\n rationaleEnabled,\n teacherInstructions,\n teacherInstructionsEnabled,\n correctAnswer,\n scoringType\n } = normalizedQuestion;\n\n const correctInfo = { correctness: 'incorrect', score: '0%' };\n\n const base = {\n addCategoryEnabled,\n categoryDefaultLabel,\n chartType,\n data: filterCategories(data, editCategoryEnabled),\n domain,\n editCategoryEnabled,\n graph,\n prompt: promptEnabled ? prompt : null,\n range,\n rationale,\n title,\n size: graph,\n correctness: correctInfo,\n disabled: env.mode !== 'gather',\n scoringType\n };\n\n const answers = filterCategories(getScore(normalizedQuestion, session, env).answers, false);\n\n if (env.mode === 'view') {\n base.correctedAnswer = answers.map(({correctness, ...rest}) => {\n return { ...rest, interactive: false };\n });\n\n base.addCategoryEnabled = false;\n }\n\n if (env.mode === 'evaluate') {\n base.correctedAnswer = answers;\n base.correctAnswer = correctAnswer;\n base.addCategoryEnabled = false;\n }\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n base.rationale = rationaleEnabled ? rationale : null;\n base.teacherInstructions = teacherInstructionsEnabled ? teacherInstructions : null;\n } else {\n base.rationale = null;\n base.teacherInstructions = null;\n }\n\n log('base: ', base);\n resolve(base);\n });\n}\n\nexport function outcome(model, session, env) {\n return new Promise(resolve => {\n resolve({\n score: getScore(model, session, env).score,\n empty: !session || isEmpty(session)\n });\n });\n}\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise(resolve => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { correctAnswer } = question;\n\n resolve({\n answer: correctAnswer && correctAnswer.data,\n id: '1'\n });\n } else {\n return resolve(null);\n }\n });\n};\n"],"file":"index.js"}
|
package/controller/package.json
CHANGED
package/docs/demo/generate.js
CHANGED
|
@@ -10,7 +10,6 @@ exports.model = (id, element) => ({
|
|
|
10
10
|
{
|
|
11
11
|
label: 'A',
|
|
12
12
|
value: 1,
|
|
13
|
-
initial: true,
|
|
14
13
|
interactive: false,
|
|
15
14
|
editable: true,
|
|
16
15
|
deletable: true
|
|
@@ -18,7 +17,6 @@ exports.model = (id, element) => ({
|
|
|
18
17
|
{
|
|
19
18
|
label: 'B',
|
|
20
19
|
value: 1,
|
|
21
|
-
initial: true,
|
|
22
20
|
interactive: true,
|
|
23
21
|
editable: true,
|
|
24
22
|
deletable: true
|
|
@@ -26,7 +24,6 @@ exports.model = (id, element) => ({
|
|
|
26
24
|
{
|
|
27
25
|
label: 'C',
|
|
28
26
|
value: 1,
|
|
29
|
-
initial: true,
|
|
30
27
|
interactive: true,
|
|
31
28
|
editable: true,
|
|
32
29
|
deletable: true
|
|
@@ -37,7 +34,6 @@ exports.model = (id, element) => ({
|
|
|
37
34
|
{
|
|
38
35
|
label: 'A',
|
|
39
36
|
value: 1,
|
|
40
|
-
initial: true,
|
|
41
37
|
interactive: false,
|
|
42
38
|
editable: true,
|
|
43
39
|
deletable: true
|
|
@@ -45,7 +41,6 @@ exports.model = (id, element) => ({
|
|
|
45
41
|
{
|
|
46
42
|
label: 'B',
|
|
47
43
|
value: 1,
|
|
48
|
-
initial: true,
|
|
49
44
|
interactive: true,
|
|
50
45
|
editable: true,
|
|
51
46
|
deletable: true
|
|
@@ -53,7 +48,6 @@ exports.model = (id, element) => ({
|
|
|
53
48
|
{
|
|
54
49
|
label: 'D',
|
|
55
50
|
value: 2,
|
|
56
|
-
initial: true,
|
|
57
51
|
interactive: true,
|
|
58
52
|
editable: true,
|
|
59
53
|
deletable: true
|
package/docs/demo/session.js
CHANGED
|
@@ -6,7 +6,6 @@ module.exports = [
|
|
|
6
6
|
// {
|
|
7
7
|
// label: 'A',
|
|
8
8
|
// value: 1,
|
|
9
|
-
// initial: true,
|
|
10
9
|
// interactive: false,
|
|
11
10
|
// editable: true,
|
|
12
11
|
// deletable: true
|
|
@@ -14,7 +13,6 @@ module.exports = [
|
|
|
14
13
|
// {
|
|
15
14
|
// label: 'B',
|
|
16
15
|
// value: 1,
|
|
17
|
-
// initial: true,
|
|
18
16
|
// interactive: true,
|
|
19
17
|
// editable: true,
|
|
20
18
|
// deletable: true
|
|
@@ -22,7 +20,6 @@ module.exports = [
|
|
|
22
20
|
// {
|
|
23
21
|
// label: 'C',
|
|
24
22
|
// value: 1,
|
|
25
|
-
// initial: true,
|
|
26
23
|
// interactive: true,
|
|
27
24
|
// editable: true,
|
|
28
25
|
// deletable: true
|
package/docs/pie-schema.json
CHANGED
|
@@ -52,11 +52,6 @@
|
|
|
52
52
|
"type": "number",
|
|
53
53
|
"title": "value"
|
|
54
54
|
},
|
|
55
|
-
"initial": {
|
|
56
|
-
"description": "Indicates if category is default category",
|
|
57
|
-
"type": "boolean",
|
|
58
|
-
"title": "initial"
|
|
59
|
-
},
|
|
60
55
|
"interactive": {
|
|
61
56
|
"description": "Indicates if category label & value are interactive",
|
|
62
57
|
"type": "boolean",
|
|
@@ -104,7 +99,6 @@
|
|
|
104
99
|
"correctness",
|
|
105
100
|
"deletable",
|
|
106
101
|
"editable",
|
|
107
|
-
"initial",
|
|
108
102
|
"interactive",
|
|
109
103
|
"label",
|
|
110
104
|
"value"
|
|
@@ -128,11 +122,6 @@
|
|
|
128
122
|
"type": "number",
|
|
129
123
|
"title": "value"
|
|
130
124
|
},
|
|
131
|
-
"initial": {
|
|
132
|
-
"description": "Indicates if category is default category",
|
|
133
|
-
"type": "boolean",
|
|
134
|
-
"title": "initial"
|
|
135
|
-
},
|
|
136
125
|
"interactive": {
|
|
137
126
|
"description": "Indicates if category label & value are interactive",
|
|
138
127
|
"type": "boolean",
|
|
@@ -180,7 +169,6 @@
|
|
|
180
169
|
"correctness",
|
|
181
170
|
"deletable",
|
|
182
171
|
"editable",
|
|
183
|
-
"initial",
|
|
184
172
|
"interactive",
|
|
185
173
|
"label",
|
|
186
174
|
"value"
|
|
@@ -214,11 +202,6 @@
|
|
|
214
202
|
"type": "number",
|
|
215
203
|
"title": "value"
|
|
216
204
|
},
|
|
217
|
-
"initial": {
|
|
218
|
-
"description": "Indicates if category is default category",
|
|
219
|
-
"type": "boolean",
|
|
220
|
-
"title": "initial"
|
|
221
|
-
},
|
|
222
205
|
"interactive": {
|
|
223
206
|
"description": "Indicates if category label & value are interactive",
|
|
224
207
|
"type": "boolean",
|
|
@@ -266,7 +249,6 @@
|
|
|
266
249
|
"correctness",
|
|
267
250
|
"deletable",
|
|
268
251
|
"editable",
|
|
269
|
-
"initial",
|
|
270
252
|
"interactive",
|
|
271
253
|
"label",
|
|
272
254
|
"value"
|
|
@@ -290,11 +272,6 @@
|
|
|
290
272
|
"type": "number",
|
|
291
273
|
"title": "value"
|
|
292
274
|
},
|
|
293
|
-
"initial": {
|
|
294
|
-
"description": "Indicates if category is default category",
|
|
295
|
-
"type": "boolean",
|
|
296
|
-
"title": "initial"
|
|
297
|
-
},
|
|
298
275
|
"interactive": {
|
|
299
276
|
"description": "Indicates if category label & value are interactive",
|
|
300
277
|
"type": "boolean",
|
|
@@ -342,7 +319,6 @@
|
|
|
342
319
|
"correctness",
|
|
343
320
|
"deletable",
|
|
344
321
|
"editable",
|
|
345
|
-
"initial",
|
|
346
322
|
"interactive",
|
|
347
323
|
"label",
|
|
348
324
|
"value"
|
|
@@ -605,11 +581,6 @@
|
|
|
605
581
|
"type": "number",
|
|
606
582
|
"title": "value"
|
|
607
583
|
},
|
|
608
|
-
"initial": {
|
|
609
|
-
"description": "Indicates if category is default category",
|
|
610
|
-
"type": "boolean",
|
|
611
|
-
"title": "initial"
|
|
612
|
-
},
|
|
613
584
|
"interactive": {
|
|
614
585
|
"description": "Indicates if category label & value are interactive",
|
|
615
586
|
"type": "boolean",
|
|
@@ -657,7 +628,6 @@
|
|
|
657
628
|
"correctness",
|
|
658
629
|
"deletable",
|
|
659
630
|
"editable",
|
|
660
|
-
"initial",
|
|
661
631
|
"interactive",
|
|
662
632
|
"label",
|
|
663
633
|
"value"
|
|
@@ -681,11 +651,6 @@
|
|
|
681
651
|
"type": "number",
|
|
682
652
|
"title": "value"
|
|
683
653
|
},
|
|
684
|
-
"initial": {
|
|
685
|
-
"description": "Indicates if category is default category",
|
|
686
|
-
"type": "boolean",
|
|
687
|
-
"title": "initial"
|
|
688
|
-
},
|
|
689
654
|
"interactive": {
|
|
690
655
|
"description": "Indicates if category label & value are interactive",
|
|
691
656
|
"type": "boolean",
|
|
@@ -733,7 +698,6 @@
|
|
|
733
698
|
"correctness",
|
|
734
699
|
"deletable",
|
|
735
700
|
"editable",
|
|
736
|
-
"initial",
|
|
737
701
|
"interactive",
|
|
738
702
|
"label",
|
|
739
703
|
"value"
|
|
@@ -763,11 +727,6 @@
|
|
|
763
727
|
"type": "number",
|
|
764
728
|
"title": "value"
|
|
765
729
|
},
|
|
766
|
-
"initial": {
|
|
767
|
-
"description": "Indicates if category is default category",
|
|
768
|
-
"type": "boolean",
|
|
769
|
-
"title": "initial"
|
|
770
|
-
},
|
|
771
730
|
"interactive": {
|
|
772
731
|
"description": "Indicates if category label & value are interactive",
|
|
773
732
|
"type": "boolean",
|
|
@@ -815,7 +774,6 @@
|
|
|
815
774
|
"correctness",
|
|
816
775
|
"deletable",
|
|
817
776
|
"editable",
|
|
818
|
-
"initial",
|
|
819
777
|
"interactive",
|
|
820
778
|
"label",
|
|
821
779
|
"value"
|
package/docs/pie-schema.json.md
CHANGED
|
@@ -229,10 +229,6 @@ Indicates category label
|
|
|
229
229
|
|
|
230
230
|
Indicates category value
|
|
231
231
|
|
|
232
|
-
### `initial` (boolean, required)
|
|
233
|
-
|
|
234
|
-
Indicates if category is default category
|
|
235
|
-
|
|
236
232
|
### `interactive` (boolean, required)
|
|
237
233
|
|
|
238
234
|
Indicates if category label & value are interactive
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"repository": "pie-framework/pie-elements",
|
|
7
|
-
"version": "2.7.
|
|
7
|
+
"version": "2.7.30",
|
|
8
8
|
"description": "",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@material-ui/core": "^3.9.2",
|
|
15
15
|
"@pie-framework/pie-player-events": "^0.1.0",
|
|
16
|
-
"@pie-lib/charting": "^4.5.
|
|
17
|
-
"@pie-lib/correct-answer-toggle": "^2.3.
|
|
18
|
-
"@pie-lib/math-rendering": "^2.4.
|
|
19
|
-
"@pie-lib/render-ui": "^4.12.
|
|
16
|
+
"@pie-lib/charting": "^4.5.16",
|
|
17
|
+
"@pie-lib/correct-answer-toggle": "^2.3.38",
|
|
18
|
+
"@pie-lib/math-rendering": "^2.4.2",
|
|
19
|
+
"@pie-lib/render-ui": "^4.12.8",
|
|
20
20
|
"classnames": "^2.2.5",
|
|
21
21
|
"debug": "^4.1.1",
|
|
22
22
|
"lodash": "^4.17.15",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"author": "",
|
|
27
27
|
"license": "ISC",
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "3f3d6edc68890098821978ebd5a8b90da31ab222",
|
|
29
29
|
"main": "lib/index.js",
|
|
30
30
|
"module": "src/index.js"
|
|
31
31
|
}
|