@pie-element/drag-in-the-blank 3.13.13 → 4.0.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 +17 -0
- package/configure/CHANGELOG.md +17 -0
- package/configure/lib/defaults.js +11 -1
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/main.js +16 -4
- package/configure/lib/main.js.map +1 -1
- package/configure/package.json +3 -3
- package/controller/CHANGELOG.md +17 -0
- package/controller/lib/index.js +1 -1
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +1 -1
- package/docs/config-schema.json +63 -0
- package/docs/config-schema.json.md +49 -1
- package/docs/pie-schema.json +21 -0
- package/docs/pie-schema.json.md +16 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,23 @@
|
|
|
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
|
+
# [4.0.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank@3.13.13...@pie-element/drag-in-the-blank@4.0.0) (2022-06-28)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### chore
|
|
10
|
+
|
|
11
|
+
* Merge master with develop. ([cdca48a](https://github.com/pie-framework/pie-elements/commit/cdca48abaa1d4179e4a961e13d171e14b7ed2444))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
* Image percent buttons were removed from toolbar.
|
|
17
|
+
New properties maxImageWidth and maxImageHeight were added.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
6
23
|
## [3.13.13](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank@3.13.12...@pie-element/drag-in-the-blank@3.13.13) (2022-06-13)
|
|
7
24
|
|
|
8
25
|
**Note:** Version bump only for package @pie-element/drag-in-the-blank
|
package/configure/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,23 @@
|
|
|
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
|
+
# [4.0.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank-configure@3.6.25...@pie-element/drag-in-the-blank-configure@4.0.0) (2022-06-28)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### chore
|
|
10
|
+
|
|
11
|
+
* Merge master with develop. ([cdca48a](https://github.com/pie-framework/pie-elements/commit/cdca48abaa1d4179e4a961e13d171e14b7ed2444))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
* Image percent buttons were removed from toolbar.
|
|
17
|
+
New properties maxImageWidth and maxImageHeight were added.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
6
23
|
## [3.6.25](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank-configure@3.6.24...@pie-element/drag-in-the-blank-configure@3.6.25) (2022-06-13)
|
|
7
24
|
|
|
8
25
|
**Note:** Version bump only for package @pie-element/drag-in-the-blank-configure
|
|
@@ -54,7 +54,17 @@ var _default = {
|
|
|
54
54
|
settings: true,
|
|
55
55
|
label: 'Teacher Instructions'
|
|
56
56
|
},
|
|
57
|
-
maxResponseAreas: 10
|
|
57
|
+
maxResponseAreas: 10,
|
|
58
|
+
maxImageWidth: {
|
|
59
|
+
teacherInstructions: 300,
|
|
60
|
+
prompt: 300,
|
|
61
|
+
rationale: 300
|
|
62
|
+
},
|
|
63
|
+
maxImageHeight: {
|
|
64
|
+
teacherInstructions: 300,
|
|
65
|
+
prompt: 300,
|
|
66
|
+
rationale: 300
|
|
67
|
+
}
|
|
58
68
|
}
|
|
59
69
|
};
|
|
60
70
|
exports["default"] = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/defaults.js"],"names":["model","disabled","mode","prompt","markup","choices","choicesPosition","correctResponse","duplicates","rationaleEnabled","promptEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","toolbarEditorPosition","configuration","spellCheck","label","settings","enabled","lockChoiceOrder","partialScoring","rationale","teacherInstructions","maxResponseAreas"],"mappings":";;;;;;eAAe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,QAAQ,EAAE,KADL;AAELC,IAAAA,IAAI,EAAE,QAFD;AAGLC,IAAAA,MAAM,EAAE,yCAHH;AAILC,IAAAA,MAAM,EAAE,EAJH;AAKLC,IAAAA,OAAO,EAAE,EALJ;AAMLC,IAAAA,eAAe,EAAE,OANZ;AAOLC,IAAAA,eAAe,EAAE,EAPZ;AAQLC,IAAAA,UAAU,EAAE,IARP;AASLC,IAAAA,gBAAgB,EAAE,IATb;AAULC,IAAAA,aAAa,EAAE,IAVV;AAWLC,IAAAA,0BAA0B,EAAE,IAXvB;AAYLC,IAAAA,0BAA0B,EAAE,IAZvB;AAaLC,IAAAA,qBAAqB,EAAE;AAblB,GADM;AAgBbC,EAAAA,aAAa,EAAE;AACbC,IAAAA,UAAU,EAAE;AACVC,MAAAA,KAAK,EAAE,YADG;AAEVC,MAAAA,QAAQ,EAAE,KAFA;AAGVC,MAAAA,OAAO,EAAC;AAHE,KADC;AAMbZ,IAAAA,eAAe,EAAE;AACfW,MAAAA,QAAQ,EAAE,IADK;AAEfD,MAAAA,KAAK,EAAE;AAFQ,KANJ;AAUbb,IAAAA,MAAM,EAAE;AACNc,MAAAA,QAAQ,EAAE,IADJ;AAEND,MAAAA,KAAK,EAAE;AAFD,KAVK;AAcbR,IAAAA,UAAU,EAAE;AACVS,MAAAA,QAAQ,EAAE,IADA;AAEVD,MAAAA,KAAK,EAAE;AAFG,KAdC;AAkBbG,IAAAA,eAAe,EAAE;AACfF,MAAAA,QAAQ,EAAE,IADK;AAEfD,MAAAA,KAAK,EAAE;AAFQ,KAlBJ;AAsBbI,IAAAA,cAAc,EAAE;AACdH,MAAAA,QAAQ,EAAE,KADI;AAEdD,MAAAA,KAAK,EAAE;AAFO,KAtBH;AA0BbK,IAAAA,SAAS,EAAE;AACTJ,MAAAA,QAAQ,EAAE,IADD;AAETD,MAAAA,KAAK,EAAE;AAFE,KA1BE;AA8BbM,IAAAA,mBAAmB,EAAE;AACnBL,MAAAA,QAAQ,EAAE,IADS;AAEnBD,MAAAA,KAAK,EAAE;AAFY,KA9BR;AAkCbO,IAAAA,gBAAgB,EAAE;
|
|
1
|
+
{"version":3,"sources":["../src/defaults.js"],"names":["model","disabled","mode","prompt","markup","choices","choicesPosition","correctResponse","duplicates","rationaleEnabled","promptEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","toolbarEditorPosition","configuration","spellCheck","label","settings","enabled","lockChoiceOrder","partialScoring","rationale","teacherInstructions","maxResponseAreas","maxImageWidth","maxImageHeight"],"mappings":";;;;;;eAAe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,QAAQ,EAAE,KADL;AAELC,IAAAA,IAAI,EAAE,QAFD;AAGLC,IAAAA,MAAM,EAAE,yCAHH;AAILC,IAAAA,MAAM,EAAE,EAJH;AAKLC,IAAAA,OAAO,EAAE,EALJ;AAMLC,IAAAA,eAAe,EAAE,OANZ;AAOLC,IAAAA,eAAe,EAAE,EAPZ;AAQLC,IAAAA,UAAU,EAAE,IARP;AASLC,IAAAA,gBAAgB,EAAE,IATb;AAULC,IAAAA,aAAa,EAAE,IAVV;AAWLC,IAAAA,0BAA0B,EAAE,IAXvB;AAYLC,IAAAA,0BAA0B,EAAE,IAZvB;AAaLC,IAAAA,qBAAqB,EAAE;AAblB,GADM;AAgBbC,EAAAA,aAAa,EAAE;AACbC,IAAAA,UAAU,EAAE;AACVC,MAAAA,KAAK,EAAE,YADG;AAEVC,MAAAA,QAAQ,EAAE,KAFA;AAGVC,MAAAA,OAAO,EAAC;AAHE,KADC;AAMbZ,IAAAA,eAAe,EAAE;AACfW,MAAAA,QAAQ,EAAE,IADK;AAEfD,MAAAA,KAAK,EAAE;AAFQ,KANJ;AAUbb,IAAAA,MAAM,EAAE;AACNc,MAAAA,QAAQ,EAAE,IADJ;AAEND,MAAAA,KAAK,EAAE;AAFD,KAVK;AAcbR,IAAAA,UAAU,EAAE;AACVS,MAAAA,QAAQ,EAAE,IADA;AAEVD,MAAAA,KAAK,EAAE;AAFG,KAdC;AAkBbG,IAAAA,eAAe,EAAE;AACfF,MAAAA,QAAQ,EAAE,IADK;AAEfD,MAAAA,KAAK,EAAE;AAFQ,KAlBJ;AAsBbI,IAAAA,cAAc,EAAE;AACdH,MAAAA,QAAQ,EAAE,KADI;AAEdD,MAAAA,KAAK,EAAE;AAFO,KAtBH;AA0BbK,IAAAA,SAAS,EAAE;AACTJ,MAAAA,QAAQ,EAAE,IADD;AAETD,MAAAA,KAAK,EAAE;AAFE,KA1BE;AA8BbM,IAAAA,mBAAmB,EAAE;AACnBL,MAAAA,QAAQ,EAAE,IADS;AAEnBD,MAAAA,KAAK,EAAE;AAFY,KA9BR;AAkCbO,IAAAA,gBAAgB,EAAE,EAlCL;AAmCbC,IAAAA,aAAa,EAAE;AACbF,MAAAA,mBAAmB,EAAE,GADR;AAEbnB,MAAAA,MAAM,EAAE,GAFK;AAGbkB,MAAAA,SAAS,EAAE;AAHE,KAnCF;AAwCbI,IAAAA,cAAc,EAAE;AACdH,MAAAA,mBAAmB,EAAE,GADP;AAEdnB,MAAAA,MAAM,EAAE,GAFM;AAGdkB,MAAAA,SAAS,EAAE;AAHG;AAxCH;AAhBF,C","sourcesContent":["export default {\n model: {\n disabled: false,\n mode: 'gather',\n prompt: 'Use the inputs to complete the sentence',\n markup: '',\n choices: [],\n choicesPosition: 'below',\n correctResponse: {},\n duplicates: true,\n rationaleEnabled: true,\n promptEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n toolbarEditorPosition: 'bottom',\n },\n configuration: {\n spellCheck: {\n label: 'Spellcheck',\n settings: false,\n enabled:true\n },\n choicesPosition: {\n settings: true,\n label: 'Choices Position'\n },\n prompt: {\n settings: true,\n label: 'Prompt'\n },\n duplicates: {\n settings: true,\n label: 'Duplicates'\n },\n lockChoiceOrder: {\n settings: true,\n label: 'Lock Choice Order'\n },\n partialScoring: {\n settings: false,\n label: 'Allow Partial Scoring'\n },\n rationale: {\n settings: true,\n label: 'Rationale'\n },\n teacherInstructions: {\n settings: true,\n label: 'Teacher Instructions'\n },\n maxResponseAreas: 10,\n maxImageWidth: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 300,\n },\n maxImageHeight: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 300,\n }\n }\n};\n"],"file":"defaults.js"}
|
package/configure/lib/main.js
CHANGED
|
@@ -215,7 +215,11 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
215
215
|
_ref$spellCheck = _ref.spellCheck,
|
|
216
216
|
spellCheck = _ref$spellCheck === void 0 ? {} : _ref$spellCheck,
|
|
217
217
|
maxChoices = _ref.maxChoices,
|
|
218
|
-
maxResponseAreas = _ref.maxResponseAreas
|
|
218
|
+
maxResponseAreas = _ref.maxResponseAreas,
|
|
219
|
+
_ref$maxImageWidth = _ref.maxImageWidth,
|
|
220
|
+
maxImageWidth = _ref$maxImageWidth === void 0 ? {} : _ref$maxImageWidth,
|
|
221
|
+
_ref$maxImageHeight = _ref.maxImageHeight,
|
|
222
|
+
maxImageHeight = _ref$maxImageHeight === void 0 ? {} : _ref$maxImageHeight;
|
|
219
223
|
|
|
220
224
|
var _ref2 = model || {},
|
|
221
225
|
rationaleEnabled = _ref2.rationaleEnabled,
|
|
@@ -231,6 +235,8 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
231
235
|
choicesError = _ref3.choicesError;
|
|
232
236
|
|
|
233
237
|
var validationMessage = (0, _utils.generateValidationMessage)(configuration);
|
|
238
|
+
var defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
|
|
239
|
+
var defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
|
|
234
240
|
|
|
235
241
|
switch (model.toolbarEditorPosition) {
|
|
236
242
|
case 'top':
|
|
@@ -279,7 +285,9 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
279
285
|
imageSupport: imageSupport,
|
|
280
286
|
nonEmpty: false,
|
|
281
287
|
toolbarOpts: toolbarOpts,
|
|
282
|
-
spellCheck: spellCheckEnabled
|
|
288
|
+
spellCheck: spellCheckEnabled,
|
|
289
|
+
maxImageWidth: maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth,
|
|
290
|
+
maxImageHeight: maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight
|
|
283
291
|
})), promptEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
284
292
|
label: prompt.label,
|
|
285
293
|
className: classes.promptHolder
|
|
@@ -291,7 +299,9 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
291
299
|
nonEmpty: false,
|
|
292
300
|
disableUnderline: true,
|
|
293
301
|
toolbarOpts: toolbarOpts,
|
|
294
|
-
spellCheck: spellCheckEnabled
|
|
302
|
+
spellCheck: spellCheckEnabled,
|
|
303
|
+
maxImageWidth: defaultImageMaxWidth,
|
|
304
|
+
maxImageHeight: defaultImageMaxHeight
|
|
295
305
|
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
296
306
|
className: classes.flexContainer
|
|
297
307
|
}, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
@@ -355,7 +365,9 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
355
365
|
onChange: this.onRationaleChanged,
|
|
356
366
|
imageSupport: imageSupport,
|
|
357
367
|
toolbarOpts: toolbarOpts,
|
|
358
|
-
spellCheck: spellCheckEnabled
|
|
368
|
+
spellCheck: spellCheckEnabled,
|
|
369
|
+
maxImageWidth: maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth,
|
|
370
|
+
maxImageHeight: maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight
|
|
359
371
|
})))));
|
|
360
372
|
}
|
|
361
373
|
}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/main.jsx"],"names":["dropdown","settings","toggle","Panel","styles","theme","promptHolder","width","paddingBottom","spacing","unit","marginBottom","prompt","paddingTop","markup","minHeight","design","choiceConfiguration","switchElement","justifyContent","margin","addButton","text","fontFamily","fontSize","lineHeight","color","tooltip","whiteSpace","maxWidth","errorText","padding","flexContainer","display","alignItems","Main","newVal","props","onModelChanged","model","rationale","teacherInstructions","slateMarkup","choices","correctResponse","domNode","ReactDOM","findDOMNode","classes","configuration","onConfigurationChanged","imageSupport","duplicates","partialScoring","lockChoiceOrder","choicesPosition","spellCheck","maxChoices","maxResponseAreas","rationaleEnabled","promptEnabled","teacherInstructionsEnabled","spellCheckEnabled","errors","toolbarOpts","responseAreasError","choicesError","validationMessage","toolbarEditorPosition","position","onModelChange","Settings","label","Properties","onTeacherInstructionsChanged","onPromptChanged","marginLeft","ALL_PLUGINS","type","options","onMarkupChanged","audio","disabled","video","onResponsesChanged","onRationaleChanged","React","Component","PropTypes","object","isRequired","disableSidePanel","bool","func","shape","add","Styled"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;;;;;;;AACA,IAAQA,QAAR,GAAoCC,kBAApC,CAAQD,QAAR;AAAA,IAAkBE,MAAlB,GAAoCD,kBAApC,CAAkBC,MAAlB;AAAA,IAA0BC,KAA1B,GAAoCF,kBAApC,CAA0BE,KAA1B;;AAEA,IAAMC,MAAM,GAAG,SAATA,MAAS,CAAAC,KAAK;AAAA,SAAK;AACvBC,IAAAA,YAAY,EAAE;AACZC,MAAAA,KAAK,EAAE,MADK;AAEZC,MAAAA,aAAa,EAAEH,KAAK,CAACI,OAAN,CAAcC,IA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AiBC,UANT;AAOjBvC,EAAAA,YAAY,EAAEqC,sBAAUM,KAAV,CAAgB;AAC5BC,IAAAA,GAAG,EAAEP,sBAAUK,IAAV,CAAeH,UADQ;AAE5B,cAAQF,sBAAUK,IAAV,CAAeH;AAFK,GAAhB;AAPG,C;AAwPrB,IAAMM,MAAM,GAAG,wBAAW5F,MAAX,EAAmB+B,IAAnB,CAAf;;eAEe,2BAAgB6D,MAAhB,C","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport PropTypes from 'prop-types';\nimport EditableHtml, { ALL_PLUGINS } from '@pie-lib/editable-html';\nimport { InputContainer, layout, settings } from '@pie-lib/config-ui';\nimport { withDragContext } from '@pie-lib/drag';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport { withStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport Info from '@material-ui/icons/Info';\nimport Tooltip from '@material-ui/core/Tooltip';\n\nimport Choices from './choices';\nimport { createSlateMarkup } from './markupUtils';\nimport {generateValidationMessage} from '../utils';\nconst { dropdown, toggle, Panel } = settings;\n\nconst styles = theme => ({\n promptHolder: {\n width: '100%',\n paddingBottom: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit * 2\n },\n prompt: {\n paddingTop: theme.spacing.unit * 2,\n width: '100%'\n },\n markup: {\n minHeight: '235px',\n paddingTop: theme.spacing.unit * 2,\n width: '100%',\n '& [data-slate-editor=\"true\"]': {\n minHeight: '235px'\n }\n },\n design: {\n paddingTop: theme.spacing.unit * 3\n },\n choiceConfiguration: {\n paddingTop: theme.spacing.unit * 2,\n paddingBottom: theme.spacing.unit * 2\n },\n switchElement: {\n justifyContent: 'space-between',\n margin: 0\n },\n addButton: {\n float: 'right'\n },\n text: {\n fontFamily: 'Cerebri Sans',\n fontSize: '16px',\n lineHeight: '19px',\n color: '#495B8F'\n },\n tooltip: {\n fontSize: '12px',\n whiteSpace: 'pre',\n maxWidth: '500px',\n },\n errorText: {\n fontSize: '12px',\n color: 'red',\n padding: '5px 0'\n },\n flexContainer: {\n display: 'flex',\n alignItems: 'end'\n }\n});\n\nexport class Main extends React.Component {\n static propTypes = {\n configuration: PropTypes.object.isRequired,\n model: PropTypes.object.isRequired,\n disableSidePanel: PropTypes.bool,\n onModelChanged: PropTypes.func.isRequired,\n onConfigurationChanged: PropTypes.func.isRequired,\n classes: PropTypes.object.isRequired,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired\n })\n };\n\n state = {};\n\n componentDidUpdate() {\n // eslint-disable-next-line\n const domNode = ReactDOM.findDOMNode(this);\n\n renderMath(domNode);\n }\n\n onModelChange = newVal => {\n this.props.onModelChanged({\n ...this.props.model,\n ...newVal\n });\n };\n\n onPromptChanged = prompt => {\n this.props.onModelChanged({\n ...this.props.model,\n prompt\n });\n };\n\n onRationaleChanged = rationale => {\n this.props.onModelChanged({\n ...this.props.model,\n rationale\n });\n };\n\n onTeacherInstructionsChanged = teacherInstructions => {\n this.props.onModelChanged({\n ...this.props.model,\n teacherInstructions\n });\n };\n\n onMarkupChanged = slateMarkup => {\n this.props.onModelChanged({\n ...this.props.model,\n slateMarkup\n });\n };\n\n onResponsesChanged = choices => {\n const {\n model: { correctResponse, markup }\n } = this.props;\n const slateMarkup = createSlateMarkup(markup, choices, correctResponse);\n\n this.props.onModelChanged({\n ...this.props.model,\n slateMarkup,\n choices\n });\n };\n\n render() {\n const {\n classes,\n model,\n configuration,\n onConfigurationChanged,\n imageSupport\n } = this.props;\n const {\n duplicates = {},\n prompt = {},\n partialScoring = {},\n lockChoiceOrder = {},\n rationale = {},\n teacherInstructions = {},\n choicesPosition = {},\n spellCheck = {},\n maxChoices,\n maxResponseAreas\n } = configuration || {};\n const { rationaleEnabled, promptEnabled, teacherInstructionsEnabled, spellCheckEnabled, errors } =\n model || {};\n const toolbarOpts = {};\n\n const { responseAreasError, choicesError } = errors || {};\n const validationMessage = generateValidationMessage(configuration);\n\n switch (model.toolbarEditorPosition) {\n case 'top':\n toolbarOpts.position = 'top';\n break;\n default:\n toolbarOpts.position = 'bottom';\n break;\n }\n return (\n <div className={classes.design}>\n <layout.ConfigLayout\n settings={\n <Panel\n model={model}\n configuration={configuration}\n onChangeModel={model => this.onModelChange(model)}\n onChangeConfiguration={configuration =>\n onConfigurationChanged(configuration, true)\n }\n groups={{\n Settings: {\n partialScoring:\n partialScoring.settings && toggle(partialScoring.label),\n duplicates: duplicates.settings && toggle(duplicates.label),\n lockChoiceOrder:\n lockChoiceOrder.settings && toggle(lockChoiceOrder.label),\n choicesPosition:\n choicesPosition.settings &&\n dropdown(choicesPosition.label, [\n 'above',\n 'below',\n 'left',\n 'right'\n ])\n },\n Properties: {\n teacherInstructionsEnabled:\n teacherInstructions.settings &&\n toggle(teacherInstructions.label),\n rationaleEnabled:\n rationale.settings && toggle(rationale.label),\n spellCheckEnabled:\n spellCheck.settings && toggle(spellCheck.label),\n promptEnabled: prompt.settings && toggle(prompt.label)\n }\n }}\n />\n }\n >\n <div>\n {teacherInstructionsEnabled && (\n <InputContainer\n label={teacherInstructions.label}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.teacherInstructions || ''}\n onChange={this.onTeacherInstructionsChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n />\n </InputContainer>\n )}\n {promptEnabled && (\n <InputContainer\n label={prompt.label}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.prompt}\n onChange={this.onPromptChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n disableUnderline\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n />\n </InputContainer>\n )}\n <div className={classes.flexContainer}>\n <Typography className={classes.text}>\n Define Template, Choices, and Correct Responses\n </Typography>\n <Tooltip\n classes={{tooltip: classes.tooltip}}\n disableFocusListener\n disableTouchListener\n placement={'right'}\n title={validationMessage}\n >\n <Info fontSize={'small'} color={'primary'} style={{marginLeft: '5px'}}/>\n </Tooltip>\n </div>\n {responseAreasError && <div className={classes.errorText}>{responseAreasError}</div>}\n {choicesError && <div className={classes.errorText}>{choicesError}</div>}\n <EditableHtml\n activePlugins={ALL_PLUGINS}\n toolbarOpts={{ position: 'top' }}\n responseAreaProps={{\n type: 'drag-in-the-blank',\n options: {\n duplicates: model.duplicates\n },\n maxResponseAreas: maxResponseAreas,\n }}\n className={classes.markup}\n markup={model.slateMarkup}\n onChange={this.onMarkupChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n disableUnderline\n pluginProps={{\n audio: { disabled: true },\n video: { disabled: true }\n }}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n />\n <Choices\n model={model}\n duplicates={model.duplicates}\n onChange={this.onResponsesChanged}\n toolbarOpts={toolbarOpts}\n maxChoices={maxChoices}\n />\n {rationaleEnabled && (\n <InputContainer\n label={rationale.label}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.rationale || ''}\n onChange={this.onRationaleChanged}\n imageSupport={imageSupport}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n />\n </InputContainer>\n )}\n </div>\n </layout.ConfigLayout>\n </div>\n );\n }\n}\n\nconst Styled = withStyles(styles)(Main);\n\nexport default withDragContext(Styled);\n"],"file":"main.js"}
|
|
1
|
+
{"version":3,"sources":["../src/main.jsx"],"names":["dropdown","settings","toggle","Panel","styles","theme","promptHolder","width","paddingBottom","spacing","unit","marginBottom","prompt","paddingTop","markup","minHeight","design","choiceConfiguration","switchElement","justifyContent","margin","addButton","text","fontFamily","fontSize","lineHeight","color","tooltip","whiteSpace","maxWidth","errorText","padding","flexContainer","display","alignItems","Main","newVal","props","onModelChanged","model","rationale","teacherInstructions","slateMarkup","choices","correctResponse","domNode","ReactDOM","findDOMNode","classes","configuration","onConfigurationChanged","imageSupport","duplicates","partialScoring","lockChoiceOrder","choicesPosition","spellCheck","maxChoices","maxResponseAreas","maxImageWidth","maxImageHeight","rationaleEnabled","promptEnabled","teacherInstructionsEnabled","spellCheckEnabled","errors","toolbarOpts","responseAreasError","choicesError","validationMessage","defaultImageMaxWidth","defaultImageMaxHeight","toolbarEditorPosition","position","onModelChange","Settings","label","Properties","onTeacherInstructionsChanged","onPromptChanged","marginLeft","ALL_PLUGINS","type","options","onMarkupChanged","audio","disabled","video","onResponsesChanged","onRationaleChanged","React","Component","PropTypes","object","isRequired","disableSidePanel","bool","func","shape","add","Styled"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;;;;;;;AACA,IAAQA,QAAR,GAAoCC,kBAApC,CAAQD,QAAR;AAAA,IAAkBE,MAAlB,GAAoCD,kBAApC,CAAkBC,MAAlB;AAAA,IAA0BC,KAA1B,GAAoCF,kBAApC,CAA0BE,KAA1B;;AAEA,IAAMC,MAAM,GAAG,SAATA,MAAS,CAAAC,KAAK;AAAA,SAAK;AACvBC,IAAAA,YAAY,EAAE;AACZC,MAAAA,KAAK,EAAE,MADK;AAEZC,MAAAA,aAAa,EAAEH,KAAK,CAACI,OAAN,CAAcC,IAAd,GAAqB,CAFxB;AAGZC,MAAAA,YAAY,EAAEN,KAAK,CAACI,OAAN,CAAcC,IAAd,GAAqB;AAHvB,KADS;AAMvBE,IAAAA,MAAM,EAAE;AACNC,MAAAA,UAAU,EAAER,KAAK,CAACI,OAAN,CAAcC,IAAd,GAAqB,CAD3B;AAENH,MAAAA,KAAK,EAAE;AAFD,KANe;AAUvBO,IAAAA,MAAM,EAAE;AACNC,MAAAA,SAAS,EAAE,OADL;AAENF,MAAAA,UAAU,EAAER,KAAK,CAACI,OAAN,CAAcC,IAAd,GAAqB,CAF3B;AAGNH,MAAAA,KAAK,EAAE,MAHD;AAIN,sCAAgC;AAC9BQ,QAAAA,SAAS,EAAE;AADmB;AAJ1B,KAV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c,EAAEsD,sBAAUK,IAAV,CAAeH,UAJd;AAKjB5C,EAAAA,sBAAsB,EAAE0C,sBAAUK,IAAV,CAAeH,UALtB;AAMjB9C,EAAAA,OAAO,EAAE4C,sBAAUC,MAAV,CAAiBC,UANT;AAOjB3C,EAAAA,YAAY,EAAEyC,sBAAUM,KAAV,CAAgB;AAC5BC,IAAAA,GAAG,EAAEP,sBAAUK,IAAV,CAAeH,UADQ;AAE5B,cAAQF,sBAAUK,IAAV,CAAeH;AAFK,GAAhB;AAPG,C;AAmQrB,IAAMM,MAAM,GAAG,wBAAWhG,MAAX,EAAmB+B,IAAnB,CAAf;;eAEe,2BAAgBiE,MAAhB,C","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport PropTypes from 'prop-types';\nimport EditableHtml, { ALL_PLUGINS } from '@pie-lib/editable-html';\nimport { InputContainer, layout, settings } from '@pie-lib/config-ui';\nimport { withDragContext } from '@pie-lib/drag';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport { withStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport Info from '@material-ui/icons/Info';\nimport Tooltip from '@material-ui/core/Tooltip';\n\nimport Choices from './choices';\nimport { createSlateMarkup } from './markupUtils';\nimport {generateValidationMessage} from '../utils';\nconst { dropdown, toggle, Panel } = settings;\n\nconst styles = theme => ({\n promptHolder: {\n width: '100%',\n paddingBottom: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit * 2\n },\n prompt: {\n paddingTop: theme.spacing.unit * 2,\n width: '100%'\n },\n markup: {\n minHeight: '235px',\n paddingTop: theme.spacing.unit * 2,\n width: '100%',\n '& [data-slate-editor=\"true\"]': {\n minHeight: '235px'\n }\n },\n design: {\n paddingTop: theme.spacing.unit * 3\n },\n choiceConfiguration: {\n paddingTop: theme.spacing.unit * 2,\n paddingBottom: theme.spacing.unit * 2\n },\n switchElement: {\n justifyContent: 'space-between',\n margin: 0\n },\n addButton: {\n float: 'right'\n },\n text: {\n fontFamily: 'Cerebri Sans',\n fontSize: '16px',\n lineHeight: '19px',\n color: '#495B8F'\n },\n tooltip: {\n fontSize: '12px',\n whiteSpace: 'pre',\n maxWidth: '500px',\n },\n errorText: {\n fontSize: '12px',\n color: 'red',\n padding: '5px 0'\n },\n flexContainer: {\n display: 'flex',\n alignItems: 'end'\n }\n});\n\nexport class Main extends React.Component {\n static propTypes = {\n configuration: PropTypes.object.isRequired,\n model: PropTypes.object.isRequired,\n disableSidePanel: PropTypes.bool,\n onModelChanged: PropTypes.func.isRequired,\n onConfigurationChanged: PropTypes.func.isRequired,\n classes: PropTypes.object.isRequired,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired\n })\n };\n\n state = {};\n\n componentDidUpdate() {\n // eslint-disable-next-line\n const domNode = ReactDOM.findDOMNode(this);\n\n renderMath(domNode);\n }\n\n onModelChange = newVal => {\n this.props.onModelChanged({\n ...this.props.model,\n ...newVal\n });\n };\n\n onPromptChanged = prompt => {\n this.props.onModelChanged({\n ...this.props.model,\n prompt\n });\n };\n\n onRationaleChanged = rationale => {\n this.props.onModelChanged({\n ...this.props.model,\n rationale\n });\n };\n\n onTeacherInstructionsChanged = teacherInstructions => {\n this.props.onModelChanged({\n ...this.props.model,\n teacherInstructions\n });\n };\n\n onMarkupChanged = slateMarkup => {\n this.props.onModelChanged({\n ...this.props.model,\n slateMarkup\n });\n };\n\n onResponsesChanged = choices => {\n const {\n model: { correctResponse, markup }\n } = this.props;\n const slateMarkup = createSlateMarkup(markup, choices, correctResponse);\n\n this.props.onModelChanged({\n ...this.props.model,\n slateMarkup,\n choices\n });\n };\n\n render() {\n const {\n classes,\n model,\n configuration,\n onConfigurationChanged,\n imageSupport\n } = this.props;\n const {\n duplicates = {},\n prompt = {},\n partialScoring = {},\n lockChoiceOrder = {},\n rationale = {},\n teacherInstructions = {},\n choicesPosition = {},\n spellCheck = {},\n maxChoices,\n maxResponseAreas,\n maxImageWidth = {},\n maxImageHeight = {}\n } = configuration || {};\n const { rationaleEnabled, promptEnabled, teacherInstructionsEnabled, spellCheckEnabled, errors } =\n model || {};\n const toolbarOpts = {};\n\n const { responseAreasError, choicesError } = errors || {};\n const validationMessage = generateValidationMessage(configuration);\n\n const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;\n const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;\n\n switch (model.toolbarEditorPosition) {\n case 'top':\n toolbarOpts.position = 'top';\n break;\n default:\n toolbarOpts.position = 'bottom';\n break;\n }\n return (\n <div className={classes.design}>\n <layout.ConfigLayout\n settings={\n <Panel\n model={model}\n configuration={configuration}\n onChangeModel={model => this.onModelChange(model)}\n onChangeConfiguration={configuration =>\n onConfigurationChanged(configuration, true)\n }\n groups={{\n Settings: {\n partialScoring:\n partialScoring.settings && toggle(partialScoring.label),\n duplicates: duplicates.settings && toggle(duplicates.label),\n lockChoiceOrder:\n lockChoiceOrder.settings && toggle(lockChoiceOrder.label),\n choicesPosition:\n choicesPosition.settings &&\n dropdown(choicesPosition.label, [\n 'above',\n 'below',\n 'left',\n 'right'\n ])\n },\n Properties: {\n teacherInstructionsEnabled:\n teacherInstructions.settings &&\n toggle(teacherInstructions.label),\n rationaleEnabled:\n rationale.settings && toggle(rationale.label),\n spellCheckEnabled:\n spellCheck.settings && toggle(spellCheck.label),\n promptEnabled: prompt.settings && toggle(prompt.label)\n }\n }}\n />\n }\n >\n <div>\n {teacherInstructionsEnabled && (\n <InputContainer\n label={teacherInstructions.label}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.teacherInstructions || ''}\n onChange={this.onTeacherInstructionsChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n maxImageWidth={maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth}\n maxImageHeight={maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight}\n />\n </InputContainer>\n )}\n {promptEnabled && (\n <InputContainer\n label={prompt.label}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.prompt}\n onChange={this.onPromptChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n disableUnderline\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n maxImageWidth={defaultImageMaxWidth}\n maxImageHeight={defaultImageMaxHeight}\n />\n </InputContainer>\n )}\n <div className={classes.flexContainer}>\n <Typography className={classes.text}>\n Define Template, Choices, and Correct Responses\n </Typography>\n <Tooltip\n classes={{tooltip: classes.tooltip}}\n disableFocusListener\n disableTouchListener\n placement={'right'}\n title={validationMessage}\n >\n <Info fontSize={'small'} color={'primary'} style={{marginLeft: '5px'}}/>\n </Tooltip>\n </div>\n {responseAreasError && <div className={classes.errorText}>{responseAreasError}</div>}\n {choicesError && <div className={classes.errorText}>{choicesError}</div>}\n <EditableHtml\n activePlugins={ALL_PLUGINS}\n toolbarOpts={{ position: 'top' }}\n responseAreaProps={{\n type: 'drag-in-the-blank',\n options: {\n duplicates: model.duplicates\n },\n maxResponseAreas: maxResponseAreas,\n }}\n className={classes.markup}\n markup={model.slateMarkup}\n onChange={this.onMarkupChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n disableUnderline\n pluginProps={{\n audio: { disabled: true },\n video: { disabled: true }\n }}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n />\n <Choices\n model={model}\n duplicates={model.duplicates}\n onChange={this.onResponsesChanged}\n toolbarOpts={toolbarOpts}\n maxChoices={maxChoices}\n />\n {rationaleEnabled && (\n <InputContainer\n label={rationale.label}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.rationale || ''}\n onChange={this.onRationaleChanged}\n imageSupport={imageSupport}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n maxImageWidth={maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth}\n maxImageHeight={maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight}\n />\n </InputContainer>\n )}\n </div>\n </layout.ConfigLayout>\n </div>\n );\n }\n}\n\nconst Styled = withStyles(styles)(Main);\n\nexport default withDragContext(Styled);\n"],"file":"main.js"}
|
package/configure/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/drag-in-the-blank-configure",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"private": true,
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "src/index.js",
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
"@material-ui/core": "^3.9.2",
|
|
9
9
|
"@material-ui/icons": "^3.0.1",
|
|
10
10
|
"@pie-framework/pie-configure-events": "^1.2.0",
|
|
11
|
-
"@pie-lib/config-ui": "^
|
|
11
|
+
"@pie-lib/config-ui": "^11.0.1",
|
|
12
12
|
"@pie-lib/drag": "^1.1.52",
|
|
13
|
-
"@pie-lib/editable-html": "^
|
|
13
|
+
"@pie-lib/editable-html": "^8.1.0",
|
|
14
14
|
"@pie-lib/math-rendering": "^2.4.3",
|
|
15
15
|
"debug": "^3.1.0",
|
|
16
16
|
"lodash": "^4.17.15",
|
package/controller/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,23 @@
|
|
|
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
|
+
# [4.0.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank-controller@3.3.22...@pie-element/drag-in-the-blank-controller@4.0.0) (2022-06-28)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### chore
|
|
10
|
+
|
|
11
|
+
* Merge master with develop. ([cdca48a](https://github.com/pie-framework/pie-elements/commit/cdca48abaa1d4179e4a961e13d171e14b7ed2444))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
* Image percent buttons were removed from toolbar.
|
|
17
|
+
New properties maxImageWidth and maxImageHeight were added.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
6
23
|
## [3.3.22](https://github.com/pie-framework/pie-elements/compare/@pie-element/drag-in-the-blank-controller@3.3.21...@pie-element/drag-in-the-blank-controller@3.3.22) (2022-05-16)
|
|
7
24
|
|
|
8
25
|
**Note:** Version bump only for package @pie-element/drag-in-the-blank-controller
|
package/controller/lib/index.js
CHANGED
|
@@ -245,7 +245,7 @@ var validate = function validate() {
|
|
|
245
245
|
maxChoices = config.maxChoices,
|
|
246
246
|
maxResponseAreas = config.maxResponseAreas;
|
|
247
247
|
var errors = {};
|
|
248
|
-
var nbOfResponseAreas = (markup.match(/\{\{(\d+)\}\}/g) || []).length;
|
|
248
|
+
var nbOfResponseAreas = ((markup || '').match(/\{\{(\d+)\}\}/g) || []).length;
|
|
249
249
|
var nbOfChoices = (choices || []).length;
|
|
250
250
|
|
|
251
251
|
if (nbOfResponseAreas > maxResponseAreas) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["normalize","question","rationaleEnabled","promptEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","model","session","env","updateSession","Promise","resolve","normalizedQuestion","feedback","mode","responses","allCorrectResponses","possibleResponses","numberOfPossibleResponses","correctResponses","undefined","value","i","result","obj","choices","key","answer","filter","choice","lockChoiceOrder","out","prompt","disabled","responseCorrect","getScore","role","rationale","teacherInstructions","config","maxScore","Object","keys","correctResponse","length","correctCount","total","str","toFixed","parseFloat","outcome","partialScoringEnabled","partialScoring","enabled","score","empty","createCorrectResponseSession","id","validate","markup","minChoices","maxChoices","maxResponseAreas","errors","nbOfResponseAreas","match","nbOfChoices","responseAreasError","choicesError"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;AAEO,IAAMA,SAAS,GAAG,SAAZA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AACzC,OAAO,IAAI,EAAZ,EAAgBmB,MAApC;;AAEA,MAAIoB,iBAAiB,GAAGF,gBAAxB,EAA0C;AACxCC,IAAAA,MAAM,CAACI,kBAAP,0BAA4CL,gBAA5C;AACD,GAFD,MAEO,IAAIE,iBAAiB,GAAG,CAAxB,EAA2B;AAChCD,IAAAA,MAAM,CAACI,kBAAP,GAA4B,mDAA5B;AACD;;AAED,MAAID,WAAW,GAAGN,UAAlB,EAA8B;AAC5BG,IAAAA,MAAM,CAACK,YAAP,sCAAkDR,UAAlD;AACD,GAFD,MAEO,IAAIM,WAAW,GAAGL,UAAlB,EAA8B;AACnCE,IAAAA,MAAM,CAACK,YAAP,0BAAsCP,UAAtC;AACD;;AAED,SAAOE,MAAP;AACD,CArBM","sourcesContent":["import reduce from 'lodash/reduce';\nimport isEmpty from 'lodash/isEmpty';\nimport { getAllCorrectResponses, choiceIsEmpty } from './utils';\nimport { lockChoices, getShuffledChoices, partialScoring } from '@pie-lib/controller-utils';\n\nexport const normalize = question => ({\n rationaleEnabled: true,\n promptEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n ...question,\n});\n\n/**\n *\n * @param {*} question\n * @param {*} session\n * @param {*} env\n * @param {*} updateSession - optional - a function that will set the properties passed into it on the session.\n */\nexport function model(question, session, env, updateSession) {\n return new Promise(async resolve => {\n const normalizedQuestion = normalize(question);\n let feedback = {};\n\n if (env.mode === 'evaluate') {\n const responses = getAllCorrectResponses(normalizedQuestion) || {};\n const allCorrectResponses = responses.possibleResponses;\n const numberOfPossibleResponses = responses.numberOfPossibleResponses || 0;\n let correctResponses = undefined;\n const { value } = session || {};\n\n for (let i = 0; i < numberOfPossibleResponses; i++) {\n const result = reduce(allCorrectResponses, (obj, choices, key) => {\n const answer = (value && value[key]) || '';\n\n obj.feedback[key] = choices[i] === answer;\n\n if (obj.feedback[key]) {\n obj.correctResponses += 1;\n }\n\n return obj;\n }, { correctResponses: 0, feedback: {} });\n\n if (correctResponses === undefined || result.correctResponses > correctResponses) {\n correctResponses = result.correctResponses;\n feedback = result.feedback;\n }\n\n if (result.correctResponses === numberOfPossibleResponses) {\n break;\n }\n }\n }\n\n let choices = normalizedQuestion.choices && normalizedQuestion.choices.filter(choice => !choiceIsEmpty(choice));\n\n const lockChoiceOrder = lockChoices(normalizedQuestion, session, env);\n\n if (!lockChoiceOrder) {\n choices = await getShuffledChoices(choices, session, updateSession, 'id');\n }\n\n const out = {\n ...normalizedQuestion,\n prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,\n choices,\n feedback,\n mode: env.mode,\n disabled: env.mode !== 'gather',\n responseCorrect:\n env.mode === 'evaluate'\n ? getScore(normalizedQuestion, session) === 1\n : undefined,\n };\n\n if (\n env.role === 'instructor' &&\n (env.mode === 'view' || env.mode === 'evaluate')\n ) {\n out.rationale = normalizedQuestion.rationaleEnabled ? normalizedQuestion.rationale : null;\n out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled ? normalizedQuestion.teacherInstructions : null;\n } else {\n out.rationale = null;\n out.teacherInstructions = null;\n }\n\n resolve(out);\n });\n}\n\nexport const getScore = (config, session) => {\n const responses = getAllCorrectResponses(config);\n const allCorrectResponses = responses.possibleResponses;\n const maxScore = Object.keys(config.correctResponse).length;\n const numberOfPossibleResponses = responses.numberOfPossibleResponses || 0;\n let correctCount = 0;\n const { value } = session || {};\n\n for (let i = 0; i < numberOfPossibleResponses; i++) {\n const result = reduce(allCorrectResponses, (total, choices, key) => {\n const answer = (value && value[key]) || '';\n\n if (choices[i] === answer) {\n return total;\n }\n\n return total - 1;\n }, maxScore);\n\n if (result > correctCount) {\n correctCount = result;\n }\n\n if (result === maxScore) {\n break;\n }\n }\n\n const str = maxScore ? (correctCount / maxScore).toFixed(2) : 0;\n\n return parseFloat(str);\n};\n\n/**\n *\n * The score is partial by default for checkbox mode, allOrNothing for radio mode.\n * To disable partial scoring for checkbox mode you either set model.partialScoring = false or env.partialScoring =\n * false. the value in `env` will override the value in `model`.\n * @param {Object} model - the main model\n * @param {boolean} model.partialScoring - is partial scoring enabled (if undefined set to to true)\n * @param {*} session\n * @param {Object} env\n * @param {boolean} env.partialScoring - is partial scoring enabled (if undefined default to true) This overrides\n * `model.partialScoring`.\n */\nexport function outcome(model, session, env = {}) {\n return new Promise(resolve => {\n const partialScoringEnabled = partialScoring.enabled(model, env);\n const score = getScore(model, session);\n\n resolve({\n score: partialScoringEnabled ? score : score === 1 ? 1 : 0,\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 resolve({\n value: question.correctResponse,\n id: '1'\n });\n } else {\n resolve(null);\n }\n });\n};\n\nexport const validate = (model = {}, config = {}) => {\n const { choices, markup } = model;\n const { minChoices = 2, maxChoices, maxResponseAreas } = config;\n const errors = {};\n\n const nbOfResponseAreas = (markup.match(/\\{\\{(\\d+)\\}\\}/g) || []).length;\n const nbOfChoices = (choices || []).length;\n\n if (nbOfResponseAreas > maxResponseAreas) {\n errors.responseAreasError = `No more than ${maxResponseAreas} response areas should be defined.`;\n } else if (nbOfResponseAreas < 1) {\n errors.responseAreasError = 'There should be at least 1 response area defined.';\n }\n\n if (nbOfChoices < minChoices) {\n errors.choicesError = `There should be at least ${minChoices} choices defined.`;\n } else if (nbOfChoices > maxChoices) {\n errors.choicesError = `No more than ${maxChoices} choices should be defined.`;\n }\n\n return errors;\n};\n"],"file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":["normalize","question","rationaleEnabled","promptEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","model","session","env","updateSession","Promise","resolve","normalizedQuestion","feedback","mode","responses","allCorrectResponses","possibleResponses","numberOfPossibleResponses","correctResponses","undefined","value","i","result","obj","choices","key","answer","filter","choice","lockChoiceOrder","out","prompt","disabled","responseCorrect","getScore","role","rationale","teacherInstructions","config","maxScore","Object","keys","correctResponse","length","correctCount","total","str","toFixed","parseFloat","outcome","partialScoringEnabled","partialScoring","enabled","score","empty","createCorrectResponseSession","id","validate","markup","minChoices","maxChoices","maxResponseAreas","errors","nbOfResponseAreas","match","nbOfChoices","responseAreasError","choicesError"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;AAEO,IAAMA,SAAS,GAAG,SAAZA,SAAY,CAAAC,QAAQ;AAAA;AAC/BC,IAAAA,gBAAgB,EAAE,IADa;AAE/BC,IAAAA,aAAa,EAAE,IAFgB;AAG/BC,IAAAA,0BAA0B,EAAE,IAHG;AAI/BC,IAAAA,0BAA0B,EAAE;AAJG,KAK5BJ,QAL4B;AAAA,CAA1B;AAQP;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AACO,SAASK,KAAT,CAAeL,QAAf,EAAyBM,OAAzB,EAAkCC,GAAlC,EAAuCC,aAAvC,EAAsD;AAC3D,SAAO,IAAIC,OAAJ;AAAA,6FAAY,iBAAMC,OAAN;AAAA;AAAA;AAAA;AAAA;AAAA;AACXC,cAAAA,kBADW,GACUZ,SAAS,CAACC,QAAD,CADnB;AAEbY,cAAAA,QAFa,GAEF,EAFE;;AAIjB,kBAAIL,GAAG,CAACM,IAAJ,KAAa,UAAjB,EAA6B;AAAA;AAC3B,sBAAMC,SAAS,GAAG,mCAAuBH,kBAAvB,KAA8C,EAAhE;AACA,sBAAMI,mBAAmB,GAAGD,SAAS,CAACE,iBAAtC;AACA,sBAAMC,yBAAyB,GAAGH,SAAS,CAACG,yBAAV,IAAuC,CAAzE;AACA,sBAAIC,gBAAgB,GAAGC,SAAvB;;AACA,8BAAkBb,OAAO,IAAI,EAA7B;AAAA,sBAAQc,KAAR,SAAQA,KAAR;;AAL2B,6CAOlBC,CAPkB;AAQzB,wBAAMC,MAAM,GAAG,wBAAOP,mBAAP,EAA4B,UAACQ,GAAD,EAAMC,OAAN,EAAeC,GAAf,EAAuB;AAChE,0BAAMC,MAAM,GAAIN,KAAK,IAAIA,KAAK,CA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zD,CAAwBsB,UAAxB;AAAA,MAAoCC,gBAApC,GAAyDvB,MAAzD,CAAoCuB,gBAApC;AACA,MAAMC,MAAM,GAAG,EAAf;AAEA,MAAMC,iBAAiB,GAAG,CAAC,CAACL,MAAM,IAAI,EAAX,EAAeM,KAAf,CAAqB,gBAArB,KAA0C,EAA3C,EAA+CrB,MAAzE;AACA,MAAMsB,WAAW,GAAG,CAACzC,OAAO,IAAI,EAAZ,EAAgBmB,MAApC;;AAEA,MAAIoB,iBAAiB,GAAGF,gBAAxB,EAA0C;AACxCC,IAAAA,MAAM,CAACI,kBAAP,0BAA4CL,gBAA5C;AACD,GAFD,MAEO,IAAIE,iBAAiB,GAAG,CAAxB,EAA2B;AAChCD,IAAAA,MAAM,CAACI,kBAAP,GAA4B,mDAA5B;AACD;;AAED,MAAID,WAAW,GAAGN,UAAlB,EAA8B;AAC5BG,IAAAA,MAAM,CAACK,YAAP,sCAAkDR,UAAlD;AACD,GAFD,MAEO,IAAIM,WAAW,GAAGL,UAAlB,EAA8B;AACnCE,IAAAA,MAAM,CAACK,YAAP,0BAAsCP,UAAtC;AACD;;AAED,SAAOE,MAAP;AACD,CArBM","sourcesContent":["import reduce from 'lodash/reduce';\nimport isEmpty from 'lodash/isEmpty';\nimport { getAllCorrectResponses, choiceIsEmpty } from './utils';\nimport { lockChoices, getShuffledChoices, partialScoring } from '@pie-lib/controller-utils';\n\nexport const normalize = question => ({\n rationaleEnabled: true,\n promptEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n ...question,\n});\n\n/**\n *\n * @param {*} question\n * @param {*} session\n * @param {*} env\n * @param {*} updateSession - optional - a function that will set the properties passed into it on the session.\n */\nexport function model(question, session, env, updateSession) {\n return new Promise(async resolve => {\n const normalizedQuestion = normalize(question);\n let feedback = {};\n\n if (env.mode === 'evaluate') {\n const responses = getAllCorrectResponses(normalizedQuestion) || {};\n const allCorrectResponses = responses.possibleResponses;\n const numberOfPossibleResponses = responses.numberOfPossibleResponses || 0;\n let correctResponses = undefined;\n const { value } = session || {};\n\n for (let i = 0; i < numberOfPossibleResponses; i++) {\n const result = reduce(allCorrectResponses, (obj, choices, key) => {\n const answer = (value && value[key]) || '';\n\n obj.feedback[key] = choices[i] === answer;\n\n if (obj.feedback[key]) {\n obj.correctResponses += 1;\n }\n\n return obj;\n }, { correctResponses: 0, feedback: {} });\n\n if (correctResponses === undefined || result.correctResponses > correctResponses) {\n correctResponses = result.correctResponses;\n feedback = result.feedback;\n }\n\n if (result.correctResponses === numberOfPossibleResponses) {\n break;\n }\n }\n }\n\n let choices = normalizedQuestion.choices && normalizedQuestion.choices.filter(choice => !choiceIsEmpty(choice));\n\n const lockChoiceOrder = lockChoices(normalizedQuestion, session, env);\n\n if (!lockChoiceOrder) {\n choices = await getShuffledChoices(choices, session, updateSession, 'id');\n }\n\n const out = {\n ...normalizedQuestion,\n prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,\n choices,\n feedback,\n mode: env.mode,\n disabled: env.mode !== 'gather',\n responseCorrect:\n env.mode === 'evaluate'\n ? getScore(normalizedQuestion, session) === 1\n : undefined,\n };\n\n if (\n env.role === 'instructor' &&\n (env.mode === 'view' || env.mode === 'evaluate')\n ) {\n out.rationale = normalizedQuestion.rationaleEnabled ? normalizedQuestion.rationale : null;\n out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled ? normalizedQuestion.teacherInstructions : null;\n } else {\n out.rationale = null;\n out.teacherInstructions = null;\n }\n\n resolve(out);\n });\n}\n\nexport const getScore = (config, session) => {\n const responses = getAllCorrectResponses(config);\n const allCorrectResponses = responses.possibleResponses;\n const maxScore = Object.keys(config.correctResponse).length;\n const numberOfPossibleResponses = responses.numberOfPossibleResponses || 0;\n let correctCount = 0;\n const { value } = session || {};\n\n for (let i = 0; i < numberOfPossibleResponses; i++) {\n const result = reduce(allCorrectResponses, (total, choices, key) => {\n const answer = (value && value[key]) || '';\n\n if (choices[i] === answer) {\n return total;\n }\n\n return total - 1;\n }, maxScore);\n\n if (result > correctCount) {\n correctCount = result;\n }\n\n if (result === maxScore) {\n break;\n }\n }\n\n const str = maxScore ? (correctCount / maxScore).toFixed(2) : 0;\n\n return parseFloat(str);\n};\n\n/**\n *\n * The score is partial by default for checkbox mode, allOrNothing for radio mode.\n * To disable partial scoring for checkbox mode you either set model.partialScoring = false or env.partialScoring =\n * false. the value in `env` will override the value in `model`.\n * @param {Object} model - the main model\n * @param {boolean} model.partialScoring - is partial scoring enabled (if undefined set to to true)\n * @param {*} session\n * @param {Object} env\n * @param {boolean} env.partialScoring - is partial scoring enabled (if undefined default to true) This overrides\n * `model.partialScoring`.\n */\nexport function outcome(model, session, env = {}) {\n return new Promise(resolve => {\n const partialScoringEnabled = partialScoring.enabled(model, env);\n const score = getScore(model, session);\n\n resolve({\n score: partialScoringEnabled ? score : score === 1 ? 1 : 0,\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 resolve({\n value: question.correctResponse,\n id: '1'\n });\n } else {\n resolve(null);\n }\n });\n};\n\nexport const validate = (model = {}, config = {}) => {\n const { choices, markup } = model;\n const { minChoices = 2, maxChoices, maxResponseAreas } = config;\n const errors = {};\n\n const nbOfResponseAreas = ((markup || '').match(/\\{\\{(\\d+)\\}\\}/g) || []).length;\n const nbOfChoices = (choices || []).length;\n\n if (nbOfResponseAreas > maxResponseAreas) {\n errors.responseAreasError = `No more than ${maxResponseAreas} response areas should be defined.`;\n } else if (nbOfResponseAreas < 1) {\n errors.responseAreasError = 'There should be at least 1 response area defined.';\n }\n\n if (nbOfChoices < minChoices) {\n errors.choicesError = `There should be at least ${minChoices} choices defined.`;\n } else if (nbOfChoices > maxChoices) {\n errors.choicesError = `No more than ${maxChoices} choices should be defined.`;\n }\n\n return errors;\n};\n"],"file":"index.js"}
|
package/controller/package.json
CHANGED
package/docs/config-schema.json
CHANGED
|
@@ -146,6 +146,48 @@
|
|
|
146
146
|
"type": "number",
|
|
147
147
|
"title": "maxResponseAreas"
|
|
148
148
|
},
|
|
149
|
+
"maxImageWidth": {
|
|
150
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
151
|
+
"type": "object",
|
|
152
|
+
"properties": {
|
|
153
|
+
"teacherInstructions": {
|
|
154
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
155
|
+
"type": "number",
|
|
156
|
+
"title": "teacherInstructions"
|
|
157
|
+
},
|
|
158
|
+
"prompt": {
|
|
159
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
160
|
+
"type": "number",
|
|
161
|
+
"title": "prompt"
|
|
162
|
+
},
|
|
163
|
+
"rationale": {
|
|
164
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
165
|
+
"type": "number",
|
|
166
|
+
"title": "rationale"
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
"maxImageHeight": {
|
|
171
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
172
|
+
"type": "object",
|
|
173
|
+
"properties": {
|
|
174
|
+
"teacherInstructions": {
|
|
175
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
176
|
+
"type": "number",
|
|
177
|
+
"title": "teacherInstructions"
|
|
178
|
+
},
|
|
179
|
+
"prompt": {
|
|
180
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
181
|
+
"type": "number",
|
|
182
|
+
"title": "prompt"
|
|
183
|
+
},
|
|
184
|
+
"rationale": {
|
|
185
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
186
|
+
"type": "number",
|
|
187
|
+
"title": "rationale"
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
},
|
|
149
191
|
"showPrompt": {
|
|
150
192
|
"description": "Determines whether prompt field will be displayed or not",
|
|
151
193
|
"default": true,
|
|
@@ -181,6 +223,27 @@
|
|
|
181
223
|
"title": "label"
|
|
182
224
|
}
|
|
183
225
|
}
|
|
226
|
+
},
|
|
227
|
+
"ConfigureMaxImageDimensionsProp": {
|
|
228
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
229
|
+
"type": "object",
|
|
230
|
+
"properties": {
|
|
231
|
+
"teacherInstructions": {
|
|
232
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
233
|
+
"type": "number",
|
|
234
|
+
"title": "teacherInstructions"
|
|
235
|
+
},
|
|
236
|
+
"prompt": {
|
|
237
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
238
|
+
"type": "number",
|
|
239
|
+
"title": "prompt"
|
|
240
|
+
},
|
|
241
|
+
"rationale": {
|
|
242
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
243
|
+
"type": "number",
|
|
244
|
+
"title": "rationale"
|
|
245
|
+
}
|
|
246
|
+
}
|
|
184
247
|
}
|
|
185
248
|
},
|
|
186
249
|
"$schema": "http://json-schema.org/draft-07/schema#"
|
|
@@ -110,6 +110,38 @@ Maximum number of choices
|
|
|
110
110
|
|
|
111
111
|
Maximum number of response areas
|
|
112
112
|
|
|
113
|
+
# `maxImageWidth` (object)
|
|
114
|
+
|
|
115
|
+
Properties of the `maxImageWidth` object:
|
|
116
|
+
|
|
117
|
+
## `teacherInstructions` (number)
|
|
118
|
+
|
|
119
|
+
Indicates the max dimension for images in teacher instructions
|
|
120
|
+
|
|
121
|
+
## `prompt` (number)
|
|
122
|
+
|
|
123
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
124
|
+
|
|
125
|
+
## `rationale` (number)
|
|
126
|
+
|
|
127
|
+
Indicates the max dimension for images in rationale
|
|
128
|
+
|
|
129
|
+
# `maxImageHeight` (object)
|
|
130
|
+
|
|
131
|
+
Properties of the `maxImageHeight` object:
|
|
132
|
+
|
|
133
|
+
## `teacherInstructions` (number)
|
|
134
|
+
|
|
135
|
+
Indicates the max dimension for images in teacher instructions
|
|
136
|
+
|
|
137
|
+
## `prompt` (number)
|
|
138
|
+
|
|
139
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
140
|
+
|
|
141
|
+
## `rationale` (number)
|
|
142
|
+
|
|
143
|
+
Indicates the max dimension for images in rationale
|
|
144
|
+
|
|
113
145
|
# `showPrompt` (boolean)
|
|
114
146
|
|
|
115
147
|
Determines whether prompt field will be displayed or not
|
|
@@ -144,4 +176,20 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
144
176
|
|
|
145
177
|
### `label` (string)
|
|
146
178
|
|
|
147
|
-
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
179
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
180
|
+
|
|
181
|
+
## `ConfigureMaxImageDimensionsProp` (object)
|
|
182
|
+
|
|
183
|
+
Properties of the `ConfigureMaxImageDimensionsProp` object:
|
|
184
|
+
|
|
185
|
+
### `teacherInstructions` (number)
|
|
186
|
+
|
|
187
|
+
Indicates the max dimension for images in teacher instructions
|
|
188
|
+
|
|
189
|
+
### `prompt` (number)
|
|
190
|
+
|
|
191
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
192
|
+
|
|
193
|
+
### `rationale` (number)
|
|
194
|
+
|
|
195
|
+
Indicates the max dimension for images in rationale
|
package/docs/pie-schema.json
CHANGED
|
@@ -182,6 +182,27 @@
|
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
},
|
|
185
|
+
"ConfigureMaxImageDimensionsProp": {
|
|
186
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
187
|
+
"type": "object",
|
|
188
|
+
"properties": {
|
|
189
|
+
"teacherInstructions": {
|
|
190
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
191
|
+
"type": "number",
|
|
192
|
+
"title": "teacherInstructions"
|
|
193
|
+
},
|
|
194
|
+
"prompt": {
|
|
195
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
196
|
+
"type": "number",
|
|
197
|
+
"title": "prompt"
|
|
198
|
+
},
|
|
199
|
+
"rationale": {
|
|
200
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
201
|
+
"type": "number",
|
|
202
|
+
"title": "rationale"
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
},
|
|
185
206
|
"Choice": {
|
|
186
207
|
"title": "Choice",
|
|
187
208
|
"type": "object",
|
package/docs/pie-schema.json.md
CHANGED
|
@@ -130,6 +130,22 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
130
130
|
|
|
131
131
|
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
132
132
|
|
|
133
|
+
## `ConfigureMaxImageDimensionsProp` (object)
|
|
134
|
+
|
|
135
|
+
Properties of the `ConfigureMaxImageDimensionsProp` object:
|
|
136
|
+
|
|
137
|
+
### `teacherInstructions` (number)
|
|
138
|
+
|
|
139
|
+
Indicates the max dimension for images in teacher instructions
|
|
140
|
+
|
|
141
|
+
### `prompt` (number)
|
|
142
|
+
|
|
143
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
144
|
+
|
|
145
|
+
### `rationale` (number)
|
|
146
|
+
|
|
147
|
+
Indicates the max dimension for images in rationale
|
|
148
|
+
|
|
133
149
|
## `Choice` (object)
|
|
134
150
|
|
|
135
151
|
Properties of the `Choice` object:
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"repository": "pie-framework/pie-elements",
|
|
7
|
-
"version": "
|
|
7
|
+
"version": "4.0.0",
|
|
8
8
|
"description": "",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"author": "",
|
|
27
27
|
"license": "ISC",
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "ff92cee6f9a7bf3f3dc75dbafd2263710f0a6b3d",
|
|
29
29
|
"main": "lib/index.js",
|
|
30
30
|
"module": "src/index.js"
|
|
31
31
|
}
|