@pie-element/multi-trait-rubric 8.1.1 → 8.1.2-next.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.
Files changed (213) hide show
  1. package/configure.js +2 -0
  2. package/controller.js +1 -0
  3. package/dist/author/common.d.ts +90 -0
  4. package/dist/author/common.js +275 -0
  5. package/dist/author/defaults.d.ts +153 -0
  6. package/dist/author/defaults.js +113 -0
  7. package/dist/author/index.d.ts +22 -0
  8. package/dist/author/index.js +89 -0
  9. package/dist/author/main.d.ts +43 -0
  10. package/dist/author/main.js +249 -0
  11. package/dist/author/modals.d.ts +94 -0
  12. package/dist/author/modals.js +171 -0
  13. package/dist/author/scale.d.ts +46 -0
  14. package/dist/author/scale.js +280 -0
  15. package/dist/author/trait.d.ts +70 -0
  16. package/dist/author/trait.js +202 -0
  17. package/dist/author/traitsHeader.d.ts +28 -0
  18. package/dist/author/traitsHeader.js +172 -0
  19. package/dist/author/utils.d.ts +10 -0
  20. package/dist/author/utils.js +41 -0
  21. package/dist/browser/Typography-CdgSBeUZ.js +8984 -0
  22. package/dist/browser/Typography-CdgSBeUZ.js.map +1 -0
  23. package/dist/browser/author/index.js +42899 -0
  24. package/dist/browser/author/index.js.map +1 -0
  25. package/dist/browser/controller/index.js +70 -0
  26. package/dist/browser/controller/index.js.map +1 -0
  27. package/dist/browser/delivery/index.js +523 -0
  28. package/dist/browser/delivery/index.js.map +1 -0
  29. package/dist/browser/multi-trait-rubric.css +2 -0
  30. package/dist/controller/defaults.d.ts +20 -0
  31. package/dist/controller/defaults.js +14 -0
  32. package/dist/controller/index.d.ts +26 -0
  33. package/dist/controller/index.js +57 -0
  34. package/dist/controller/utils.d.ts +9 -0
  35. package/dist/controller/utils.js +4 -0
  36. package/dist/delivery/index.d.ts +17 -0
  37. package/dist/delivery/index.js +37 -0
  38. package/dist/delivery/main.d.ts +15 -0
  39. package/dist/delivery/main.js +95 -0
  40. package/dist/delivery/scale.d.ts +17 -0
  41. package/dist/delivery/scale.js +175 -0
  42. package/dist/delivery/trait.d.ts +27 -0
  43. package/dist/delivery/trait.js +44 -0
  44. package/dist/index.d.ts +1 -0
  45. package/dist/index.iife.d.ts +8 -0
  46. package/dist/index.iife.js +145 -0
  47. package/dist/index.js +2 -0
  48. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js +6 -0
  49. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Hash.js +16 -0
  50. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_ListCache.js +16 -0
  51. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Map.js +6 -0
  52. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_MapCache.js +16 -0
  53. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js +6 -0
  54. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Set.js +6 -0
  55. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Stack.js +14 -0
  56. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js +5 -0
  57. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Uint8Array.js +5 -0
  58. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js +6 -0
  59. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayEach.js +7 -0
  60. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayFilter.js +10 -0
  61. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayLikeKeys.js +15 -0
  62. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayPush.js +7 -0
  63. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assignValue.js +10 -0
  64. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assocIndexOf.js +8 -0
  65. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssign.js +8 -0
  66. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignIn.js +8 -0
  67. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignValue.js +12 -0
  68. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseClone.js +57 -0
  69. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseCreate.js +14 -0
  70. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetAllKeys.js +9 -0
  71. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js +10 -0
  72. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js +9 -0
  73. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMap.js +9 -0
  74. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js +11 -0
  75. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsSet.js +9 -0
  76. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js +11 -0
  77. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js +12 -0
  78. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeysIn.js +13 -0
  79. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js +7 -0
  80. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTrim.js +8 -0
  81. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js +8 -0
  82. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneArrayBuffer.js +8 -0
  83. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneBuffer.js +10 -0
  84. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneDataView.js +8 -0
  85. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneRegExp.js +8 -0
  86. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneSymbol.js +8 -0
  87. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneTypedArray.js +8 -0
  88. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyArray.js +8 -0
  89. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyObject.js +14 -0
  90. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbols.js +8 -0
  91. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbolsIn.js +8 -0
  92. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js +5 -0
  93. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_defineProperty.js +10 -0
  94. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js +4 -0
  95. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeys.js +9 -0
  96. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeysIn.js +9 -0
  97. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getMapData.js +8 -0
  98. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js +9 -0
  99. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getPrototype.js +5 -0
  100. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js +14 -0
  101. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbols.js +10 -0
  102. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbolsIn.js +11 -0
  103. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js +23 -0
  104. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js +6 -0
  105. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashClear.js +7 -0
  106. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashDelete.js +7 -0
  107. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashGet.js +13 -0
  108. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashHas.js +9 -0
  109. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashSet.js +9 -0
  110. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneArray.js +8 -0
  111. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneByTag.js +33 -0
  112. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneObject.js +9 -0
  113. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js +8 -0
  114. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKeyable.js +7 -0
  115. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js +11 -0
  116. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js +8 -0
  117. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheClear.js +6 -0
  118. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheDelete.js +9 -0
  119. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheGet.js +8 -0
  120. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheHas.js +7 -0
  121. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheSet.js +8 -0
  122. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheClear.js +13 -0
  123. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheDelete.js +8 -0
  124. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheGet.js +7 -0
  125. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheHas.js +7 -0
  126. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheSet.js +8 -0
  127. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeCreate.js +5 -0
  128. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js +5 -0
  129. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeysIn.js +8 -0
  130. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js +9 -0
  131. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js +7 -0
  132. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js +8 -0
  133. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_root.js +5 -0
  134. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackClear.js +7 -0
  135. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackDelete.js +7 -0
  136. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackGet.js +6 -0
  137. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackHas.js +6 -0
  138. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackSet.js +16 -0
  139. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js +15 -0
  140. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_trimmedEndIndex.js +8 -0
  141. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/cloneDeep.js +8 -0
  142. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/debounce.js +50 -0
  143. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/eq.js +6 -0
  144. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js +10 -0
  145. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArray.js +4 -0
  146. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js +8 -0
  147. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js +6 -0
  148. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js +21 -0
  149. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js +11 -0
  150. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isLength.js +7 -0
  151. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isMap.js +7 -0
  152. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js +7 -0
  153. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js +6 -0
  154. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSet.js +7 -0
  155. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSymbol.js +9 -0
  156. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js +7 -0
  157. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keys.js +9 -0
  158. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keysIn.js +9 -0
  159. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/now.js +7 -0
  160. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubArray.js +6 -0
  161. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js +6 -0
  162. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/toNumber.js +19 -0
  163. package/package.json +80 -14
  164. package/CHANGELOG.json +0 -1
  165. package/CHANGELOG.md +0 -1584
  166. package/LICENSE.md +0 -5
  167. package/README.md +0 -55
  168. package/configure/CHANGELOG.json +0 -1
  169. package/configure/CHANGELOG.md +0 -1479
  170. package/configure/lib/common.js +0 -424
  171. package/configure/lib/common.js.map +0 -1
  172. package/configure/lib/defaults.js +0 -184
  173. package/configure/lib/defaults.js.map +0 -1
  174. package/configure/lib/index.js +0 -157
  175. package/configure/lib/index.js.map +0 -1
  176. package/configure/lib/main.js +0 -454
  177. package/configure/lib/main.js.map +0 -1
  178. package/configure/lib/modals.js +0 -206
  179. package/configure/lib/modals.js.map +0 -1
  180. package/configure/lib/scale.js +0 -478
  181. package/configure/lib/scale.js.map +0 -1
  182. package/configure/lib/trait.js +0 -275
  183. package/configure/lib/trait.js.map +0 -1
  184. package/configure/lib/traitsHeader.js +0 -235
  185. package/configure/lib/traitsHeader.js.map +0 -1
  186. package/configure/lib/utils.js +0 -87
  187. package/configure/lib/utils.js.map +0 -1
  188. package/configure/package.json +0 -24
  189. package/controller/CHANGELOG.json +0 -1
  190. package/controller/CHANGELOG.md +0 -911
  191. package/controller/lib/defaults.js +0 -18
  192. package/controller/lib/defaults.js.map +0 -1
  193. package/controller/lib/index.js +0 -158
  194. package/controller/lib/index.js.map +0 -1
  195. package/controller/lib/utils.js +0 -11
  196. package/controller/lib/utils.js.map +0 -1
  197. package/controller/package.json +0 -14
  198. package/docs/config-schema.json +0 -1628
  199. package/docs/config-schema.json.md +0 -1202
  200. package/docs/demo/config.js +0 -8
  201. package/docs/demo/generate.js +0 -117
  202. package/docs/demo/index.html +0 -1
  203. package/docs/demo/session.js +0 -6
  204. package/docs/pie-schema.json +0 -861
  205. package/docs/pie-schema.json.md +0 -614
  206. package/lib/index.js +0 -54
  207. package/lib/index.js.map +0 -1
  208. package/lib/main.js +0 -123
  209. package/lib/main.js.map +0 -1
  210. package/lib/scale.js +0 -248
  211. package/lib/scale.js.map +0 -1
  212. package/lib/trait.js +0 -83
  213. package/lib/trait.js.map +0 -1
@@ -1,18 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _default = exports.default = {
8
- addScaleEnabled: true,
9
- description: false,
10
- excludeZero: false,
11
- halfScoring: false,
12
- maxPointsEnabled: true,
13
- pointLabels: true,
14
- scales: [],
15
- standards: false,
16
- visibleToStudent: true
17
- };
18
- //# sourceMappingURL=defaults.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"defaults.js","names":["addScaleEnabled","description","excludeZero","halfScoring","maxPointsEnabled","pointLabels","scales","standards","visibleToStudent"],"sources":["../src/defaults.js"],"sourcesContent":["export default {\n addScaleEnabled: true,\n description: false,\n excludeZero: false,\n halfScoring: false,\n maxPointsEnabled: true,\n pointLabels: true,\n scales: [],\n standards: false,\n visibleToStudent: true,\n};\n"],"mappings":";;;;;;iCAAe;EACbA,eAAe,EAAE,IAAI;EACrBC,WAAW,EAAE,KAAK;EAClBC,WAAW,EAAE,KAAK;EAClBC,WAAW,EAAE,KAAK;EAClBC,gBAAgB,EAAE,IAAI;EACtBC,WAAW,EAAE,IAAI;EACjBC,MAAM,EAAE,EAAE;EACVC,SAAS,EAAE,KAAK;EAChBC,gBAAgB,EAAE;AACpB,CAAC","ignoreList":[]}
@@ -1,158 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.createCorrectResponseSession = void 0;
8
- exports.createDefaultModel = createDefaultModel;
9
- exports.getScore = void 0;
10
- exports.model = model;
11
- exports.normalize = void 0;
12
- exports.outcome = outcome;
13
- exports.validate = void 0;
14
- var _defaults = _interopRequireDefault(require("./defaults"));
15
- var _utils = require("./utils");
16
- function createDefaultModel(model = {}) {
17
- return new Promise(resolve => resolve({
18
- ..._defaults.default,
19
- ...model
20
- }));
21
- }
22
- const normalize = question => ({
23
- ..._defaults.default,
24
- ...question
25
- });
26
-
27
- /**
28
- *
29
- * @param {*} question
30
- * @param {*} session
31
- * @param {*} env
32
- */
33
- exports.normalize = normalize;
34
- async function model(question, session, env) {
35
- const normalizedQuestion = normalize(question);
36
- if (!env.role || env.role === 'student') {
37
- normalizedQuestion.visible = normalizedQuestion.visibleToStudent;
38
- } else {
39
- normalizedQuestion.visible = true;
40
- }
41
-
42
- // todo update pie-ui instead of parsing this here:
43
- const {
44
- scales,
45
- excludeZero
46
- } = normalizedQuestion || {};
47
- const parsedScales = (scales || []).map(scale => ({
48
- ...scale,
49
- excludeZero
50
- }));
51
- return {
52
- ...normalizedQuestion,
53
- scales: parsedScales
54
- };
55
- }
56
- const getScore = () => 0;
57
-
58
- /**
59
- * @param {Object} model - the main model
60
- * @param {*} session
61
- * @param {Object} env
62
- */
63
- exports.getScore = getScore;
64
- function outcome() {
65
- return new Promise(resolve => resolve({
66
- score: 0,
67
- empty: true
68
- }));
69
- }
70
- const createCorrectResponseSession = (question, env) => {
71
- return new Promise(resolve => {
72
- if (env.mode !== 'evaluate' && env.role === 'instructor') {
73
- resolve({
74
- id: '1'
75
- });
76
- } else {
77
- resolve(null);
78
- }
79
- });
80
- };
81
-
82
- // IMPORTANT! If you make any changes to this function, please make sure you also update complex-rubric/controller/validateMultiTraitRubric function!“.
83
- exports.createCorrectResponseSession = createCorrectResponseSession;
84
- const validate = (model, config) => {
85
- const {
86
- scales,
87
- description = false,
88
- pointLabels = false
89
- } = model;
90
- const errors = {};
91
- const traitsErrors = {};
92
- const scorePointsErrors = {};
93
- (scales || []).forEach((scale, scaleIndex) => {
94
- const {
95
- traits = []
96
- } = scale;
97
- const {
98
- scorePointsLabels = []
99
- } = scale;
100
- const scaleErrors = {};
101
- const scorePointsLabelsErrors = {};
102
- if (pointLabels) {
103
- scorePointsLabels.forEach((scorePointLabel, scoreIndex) => {
104
- if (!scorePointLabel || scorePointLabel === '<div></div>') {
105
- scorePointsLabelsErrors[scoreIndex] = 'Points labels should not be empty.';
106
- } else {
107
- const identicalScorePointLabel = scorePointsLabels.slice(scoreIndex + 1).some(s => (0, _utils.markupToText)(s) === (0, _utils.markupToText)(scorePointLabel));
108
- if (identicalScorePointLabel) {
109
- scorePointsLabelsErrors[scoreIndex] = 'Points labels should be unique.';
110
- }
111
- }
112
- });
113
- }
114
- if (Object.keys(scorePointsLabelsErrors).length > 0) {
115
- scorePointsErrors[scaleIndex] = scorePointsLabelsErrors;
116
- }
117
- traits.forEach((trait, traitIndex) => {
118
- if (!trait.name || trait.name === '<div></div>') {
119
- scaleErrors[traitIndex] = {
120
- name: 'Trait names should not be empty.'
121
- };
122
- } else {
123
- const identicalTraitName = traits.slice(traitIndex + 1).some(t => (0, _utils.markupToText)(t.name) === (0, _utils.markupToText)(trait.name));
124
- if (identicalTraitName) {
125
- scaleErrors[traitIndex] = {
126
- name: 'Trait names should be unique.'
127
- };
128
- }
129
- }
130
- if (description && (!trait.description || trait.description === '<div></div>')) {
131
- scaleErrors[traitIndex] = {
132
- ...scaleErrors[traitIndex],
133
- description: 'Trait description should not be empty'
134
- };
135
- } else {
136
- const identicalTraitDescr = traits.slice(traitIndex + 1).some(t => (0, _utils.markupToText)(t.description) === (0, _utils.markupToText)(trait.description));
137
- if (description && identicalTraitDescr) {
138
- scaleErrors[traitIndex] = {
139
- ...scaleErrors[traitIndex],
140
- description: 'Trait descriptions should be unique.'
141
- };
142
- }
143
- }
144
- });
145
- if (Object.keys(scaleErrors).length > 0) {
146
- traitsErrors[scaleIndex] = scaleErrors;
147
- }
148
- });
149
- if (Object.keys(traitsErrors).length > 0) {
150
- errors.traitsErrors = traitsErrors;
151
- }
152
- if (Object.keys(scorePointsErrors).length > 0) {
153
- errors.scorePointsErrors = scorePointsErrors;
154
- }
155
- return errors;
156
- };
157
- exports.validate = validate;
158
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["_defaults","_interopRequireDefault","require","_utils","createDefaultModel","model","Promise","resolve","defaults","normalize","question","exports","session","env","normalizedQuestion","role","visible","visibleToStudent","scales","excludeZero","parsedScales","map","scale","getScore","outcome","score","empty","createCorrectResponseSession","mode","id","validate","config","description","pointLabels","errors","traitsErrors","scorePointsErrors","forEach","scaleIndex","traits","scorePointsLabels","scaleErrors","scorePointsLabelsErrors","scorePointLabel","scoreIndex","identicalScorePointLabel","slice","some","s","markupToText","Object","keys","length","trait","traitIndex","name","identicalTraitName","t","identicalTraitDescr"],"sources":["../src/index.js"],"sourcesContent":["import defaults from './defaults';\nimport { markupToText } from './utils';\n\nexport function createDefaultModel(model = {}) {\n return new Promise((resolve) => resolve({ ...defaults, ...model }));\n}\n\nexport const normalize = (question) => ({ ...defaults, ...question });\n\n/**\n *\n * @param {*} question\n * @param {*} session\n * @param {*} env\n */\nexport async function model(question, session, env) {\n const normalizedQuestion = normalize(question);\n\n if (!env.role || env.role === 'student') {\n normalizedQuestion.visible = normalizedQuestion.visibleToStudent;\n } else {\n normalizedQuestion.visible = true;\n }\n\n // todo update pie-ui instead of parsing this here:\n const { scales, excludeZero } = normalizedQuestion || {};\n const parsedScales = (scales || []).map((scale) => ({ ...scale, excludeZero }));\n\n return {\n ...normalizedQuestion,\n scales: parsedScales,\n };\n}\n\nexport const getScore = () => 0;\n\n/**\n * @param {Object} model - the main model\n * @param {*} session\n * @param {Object} env\n */\nexport function outcome() {\n return new Promise((resolve) => resolve({ score: 0, empty: true }));\n}\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n resolve({ id: '1' });\n } else {\n resolve(null);\n }\n });\n};\n\n// IMPORTANT! If you make any changes to this function, please make sure you also update complex-rubric/controller/validateMultiTraitRubric function!“.\nexport const validate = (model, config) => {\n const { scales, description = false, pointLabels = false } = model;\n const errors = {};\n const traitsErrors = {};\n const scorePointsErrors = {};\n\n (scales || []).forEach((scale, scaleIndex) => {\n const { traits = [] } = scale;\n const { scorePointsLabels = [] } = scale;\n const scaleErrors = {};\n const scorePointsLabelsErrors = {};\n\n if (pointLabels) {\n scorePointsLabels.forEach((scorePointLabel, scoreIndex) => {\n if (!scorePointLabel || scorePointLabel === '<div></div>') {\n scorePointsLabelsErrors[scoreIndex] = 'Points labels should not be empty.';\n } else {\n const identicalScorePointLabel = scorePointsLabels\n .slice(scoreIndex + 1)\n .some((s) => markupToText(s) === markupToText(scorePointLabel));\n\n if (identicalScorePointLabel) {\n scorePointsLabelsErrors[scoreIndex] = 'Points labels should be unique.';\n }\n }\n });\n }\n\n if (Object.keys(scorePointsLabelsErrors).length > 0) {\n scorePointsErrors[scaleIndex] = scorePointsLabelsErrors;\n }\n\n traits.forEach((trait, traitIndex) => {\n if (!trait.name || trait.name === '<div></div>') {\n scaleErrors[traitIndex] = { name: 'Trait names should not be empty.' };\n } else {\n const identicalTraitName = traits\n .slice(traitIndex + 1)\n .some((t) => markupToText(t.name) === markupToText(trait.name));\n\n if (identicalTraitName) {\n scaleErrors[traitIndex] = { name: 'Trait names should be unique.' };\n }\n }\n if (description && (!trait.description || trait.description === '<div></div>')) {\n scaleErrors[traitIndex] = { ...scaleErrors[traitIndex], description: 'Trait description should not be empty' };\n } else {\n const identicalTraitDescr = traits\n .slice(traitIndex + 1)\n .some((t) => markupToText(t.description) === markupToText(trait.description));\n\n if (description && identicalTraitDescr) {\n scaleErrors[traitIndex] = { ...scaleErrors[traitIndex], description: 'Trait descriptions should be unique.' };\n }\n }\n });\n if (Object.keys(scaleErrors).length > 0) {\n traitsErrors[scaleIndex] = scaleErrors;\n }\n });\n\n if (Object.keys(traitsErrors).length > 0) {\n errors.traitsErrors = traitsErrors;\n }\n\n if (Object.keys(scorePointsErrors).length > 0) {\n errors.scorePointsErrors = scorePointsErrors;\n }\n\n return errors;\n};\n"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEO,SAASE,kBAAkBA,CAACC,KAAK,GAAG,CAAC,CAAC,EAAE;EAC7C,OAAO,IAAIC,OAAO,CAAEC,OAAO,IAAKA,OAAO,CAAC;IAAE,GAAGC,iBAAQ;IAAE,GAAGH;EAAM,CAAC,CAAC,CAAC;AACrE;AAEO,MAAMI,SAAS,GAAIC,QAAQ,KAAM;EAAE,GAAGF,iBAAQ;EAAE,GAAGE;AAAS,CAAC,CAAC;;AAErE;AACA;AACA;AACA;AACA;AACA;AALAC,OAAA,CAAAF,SAAA,GAAAA,SAAA;AAMO,eAAeJ,KAAKA,CAACK,QAAQ,EAAEE,OAAO,EAAEC,GAAG,EAAE;EAClD,MAAMC,kBAAkB,GAAGL,SAAS,CAACC,QAAQ,CAAC;EAE9C,IAAI,CAACG,GAAG,CAACE,IAAI,IAAIF,GAAG,CAACE,IAAI,KAAK,SAAS,EAAE;IACvCD,kBAAkB,CAACE,OAAO,GAAGF,kBAAkB,CAACG,gBAAgB;EAClE,CAAC,MAAM;IACLH,kBAAkB,CAACE,OAAO,GAAG,IAAI;EACnC;;EAEA;EACA,MAAM;IAAEE,MAAM;IAAEC;EAAY,CAAC,GAAGL,kBAAkB,IAAI,CAAC,CAAC;EACxD,MAAMM,YAAY,GAAG,CAACF,MAAM,IAAI,EAAE,EAAEG,GAAG,CAAEC,KAAK,KAAM;IAAE,GAAGA,KAAK;IAAEH;EAAY,CAAC,CAAC,CAAC;EAE/E,OAAO;IACL,GAAGL,kBAAkB;IACrBI,MAAM,EAAEE;EACV,CAAC;AACH;AAEO,MAAMG,QAAQ,GAAGA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qB,KAAK,CAACrB,WAAW,KAAK,aAAa,CAAC,EAAE;QAC9ES,WAAW,CAACa,UAAU,CAAC,GAAG;UAAE,GAAGb,WAAW,CAACa,UAAU,CAAC;UAAEtB,WAAW,EAAE;QAAwC,CAAC;MAChH,CAAC,MAAM;QACL,MAAM0B,mBAAmB,GAAGnB,MAAM,CAC/BO,KAAK,CAACQ,UAAU,GAAG,CAAC,CAAC,CACrBP,IAAI,CAAEU,CAAC,IAAK,IAAAR,mBAAY,EAACQ,CAAC,CAACzB,WAAW,CAAC,KAAK,IAAAiB,mBAAY,EAACI,KAAK,CAACrB,WAAW,CAAC,CAAC;QAE/E,IAAIA,WAAW,IAAI0B,mBAAmB,EAAE;UACtCjB,WAAW,CAACa,UAAU,CAAC,GAAG;YAAE,GAAGb,WAAW,CAACa,UAAU,CAAC;YAAEtB,WAAW,EAAE;UAAuC,CAAC;QAC/G;MACF;IACF,CAAC,CAAC;IACF,IAAIkB,MAAM,CAACC,IAAI,CAACV,WAAW,CAAC,CAACW,MAAM,GAAG,CAAC,EAAE;MACvCjB,YAAY,CAACG,UAAU,CAAC,GAAGG,WAAW;IACxC;EACF,CAAC,CAAC;EAEF,IAAIS,MAAM,CAACC,IAAI,CAAChB,YAAY,CAAC,CAACiB,MAAM,GAAG,CAAC,EAAE;IACxClB,MAAM,CAACC,YAAY,GAAGA,YAAY;EACpC;EAEA,IAAIe,MAAM,CAACC,IAAI,CAACf,iBAAiB,CAAC,CAACgB,MAAM,GAAG,CAAC,EAAE;IAC7ClB,MAAM,CAACE,iBAAiB,GAAGA,iBAAiB;EAC9C;EAEA,OAAOF,MAAM;AACf,CAAC;AAACvB,OAAA,CAAAmB,QAAA,GAAAA,QAAA","ignoreList":[]}
@@ -1,11 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.markupToText = void 0;
7
- const markupToText = s => {
8
- return (s || '').replace(/(<([^>]+)>)/ig, '');
9
- };
10
- exports.markupToText = markupToText;
11
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","names":["markupToText","s","replace","exports"],"sources":["../src/utils.js"],"sourcesContent":["export const markupToText = (s) => {\n return (s || '').replace(/(<([^>]+)>)/ig, '');\n};\n"],"mappings":";;;;;;AAAO,MAAMA,YAAY,GAAIC,CAAC,IAAK;EAC/B,OAAO,CAACA,CAAC,IAAI,EAAE,EAAEC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC;AACjD,CAAC;AAACC,OAAA,CAAAH,YAAA,GAAAA,YAAA","ignoreList":[]}
@@ -1,14 +0,0 @@
1
- {
2
- "name": "@pie-element/multi-trait-rubric-controller",
3
- "private": true,
4
- "version": "6.0.3",
5
- "description": "",
6
- "main": "lib/index.js",
7
- "module": "src/index.js",
8
- "author": "",
9
- "license": "ISC",
10
- "dependencies": {
11
- "debug": "^4.1.1",
12
- "lodash-es": "^4.17.23"
13
- }
14
- }