@pie-element/number-line 0.1.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 (352) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +11 -0
  2. package/dist/author/arrows.d.ts +29 -0
  3. package/dist/author/arrows.d.ts.map +1 -0
  4. package/dist/author/arrows.js +69 -0
  5. package/dist/author/card-bar.d.ts +21 -0
  6. package/dist/author/card-bar.d.ts.map +1 -0
  7. package/dist/author/card-bar.js +41 -0
  8. package/dist/author/defaults.d.ts +179 -0
  9. package/dist/author/defaults.d.ts.map +1 -0
  10. package/dist/author/defaults.js +144 -0
  11. package/dist/author/domain.d.ts +16 -0
  12. package/dist/author/domain.d.ts.map +1 -0
  13. package/dist/author/domain.js +53 -0
  14. package/dist/author/index.d.ts +24 -0
  15. package/dist/author/index.d.ts.map +1 -0
  16. package/dist/author/index.js +89 -0
  17. package/dist/author/main.d.ts +45 -0
  18. package/dist/author/main.d.ts.map +1 -0
  19. package/dist/author/main.js +482 -0
  20. package/dist/author/number-text-field.d.ts +14 -0
  21. package/dist/author/number-text-field.d.ts.map +1 -0
  22. package/dist/author/number-text-field.js +11 -0
  23. package/dist/author/point-config.d.ts +26 -0
  24. package/dist/author/point-config.d.ts.map +1 -0
  25. package/dist/author/point-config.js +69 -0
  26. package/dist/author/size.d.ts +25 -0
  27. package/dist/author/size.d.ts.map +1 -0
  28. package/dist/author/size.js +48 -0
  29. package/dist/author/ticks.d.ts +23 -0
  30. package/dist/author/ticks.d.ts.map +1 -0
  31. package/dist/author/ticks.js +115 -0
  32. package/dist/author/utils.d.ts +10 -0
  33. package/dist/author/utils.d.ts.map +1 -0
  34. package/dist/author/utils.js +4 -0
  35. package/dist/controller/defaults.d.ts +59 -0
  36. package/dist/controller/defaults.d.ts.map +1 -0
  37. package/dist/controller/defaults.js +50 -0
  38. package/dist/controller/index.d.ts +34 -0
  39. package/dist/controller/index.d.ts.map +1 -0
  40. package/dist/controller/index.js +170 -0
  41. package/dist/controller/tickUtils.d.ts +21 -0
  42. package/dist/controller/tickUtils.d.ts.map +1 -0
  43. package/dist/controller/tickUtils.js +254 -0
  44. package/dist/controller/utils.d.ts +10 -0
  45. package/dist/controller/utils.d.ts.map +1 -0
  46. package/dist/controller/utils.js +68 -0
  47. package/dist/delivery/data-converter.d.ts +65 -0
  48. package/dist/delivery/data-converter.d.ts.map +1 -0
  49. package/dist/delivery/data-converter.js +70 -0
  50. package/dist/delivery/draggable/index.d.ts +34 -0
  51. package/dist/delivery/draggable/index.d.ts.map +1 -0
  52. package/dist/delivery/draggable/index.js +39 -0
  53. package/dist/delivery/index.d.ts +36 -0
  54. package/dist/delivery/index.d.ts.map +1 -0
  55. package/dist/delivery/index.js +109 -0
  56. package/dist/delivery/number-line/colors.d.ts +12 -0
  57. package/dist/delivery/number-line/colors.d.ts.map +1 -0
  58. package/dist/delivery/number-line/colors.js +5 -0
  59. package/dist/delivery/number-line/feedback.d.ts +20 -0
  60. package/dist/delivery/number-line/feedback.d.ts.map +1 -0
  61. package/dist/delivery/number-line/feedback.js +57 -0
  62. package/dist/delivery/number-line/graph/arrow.d.ts +31 -0
  63. package/dist/delivery/number-line/graph/arrow.d.ts.map +1 -0
  64. package/dist/delivery/number-line/graph/arrow.js +27 -0
  65. package/dist/delivery/number-line/graph/elements/base.d.ts +17 -0
  66. package/dist/delivery/number-line/graph/elements/base.d.ts.map +1 -0
  67. package/dist/delivery/number-line/graph/elements/base.js +11 -0
  68. package/dist/delivery/number-line/graph/elements/builder.d.ts +34 -0
  69. package/dist/delivery/number-line/graph/elements/builder.d.ts.map +1 -0
  70. package/dist/delivery/number-line/graph/elements/builder.js +30 -0
  71. package/dist/delivery/number-line/graph/elements/line.d.ts +52 -0
  72. package/dist/delivery/number-line/graph/elements/line.d.ts.map +1 -0
  73. package/dist/delivery/number-line/graph/elements/line.js +189 -0
  74. package/dist/delivery/number-line/graph/elements/point.d.ts +44 -0
  75. package/dist/delivery/number-line/graph/elements/point.d.ts.map +1 -0
  76. package/dist/delivery/number-line/graph/elements/point.js +127 -0
  77. package/dist/delivery/number-line/graph/elements/ray.d.ts +44 -0
  78. package/dist/delivery/number-line/graph/elements/ray.d.ts.map +1 -0
  79. package/dist/delivery/number-line/graph/elements/ray.js +130 -0
  80. package/dist/delivery/number-line/graph/index.d.ts +60 -0
  81. package/dist/delivery/number-line/graph/index.d.ts.map +1 -0
  82. package/dist/delivery/number-line/graph/index.js +196 -0
  83. package/dist/delivery/number-line/graph/line.d.ts +47 -0
  84. package/dist/delivery/number-line/graph/line.d.ts.map +1 -0
  85. package/dist/delivery/number-line/graph/line.js +27 -0
  86. package/dist/delivery/number-line/graph/stacks.d.ts +11 -0
  87. package/dist/delivery/number-line/graph/stacks.d.ts.map +1 -0
  88. package/dist/delivery/number-line/graph/stacks.js +40 -0
  89. package/dist/delivery/number-line/graph/tick-utils.d.ts +74 -0
  90. package/dist/delivery/number-line/graph/tick-utils.d.ts.map +1 -0
  91. package/dist/delivery/number-line/graph/tick-utils.js +297 -0
  92. package/dist/delivery/number-line/graph/ticks.d.ts +47 -0
  93. package/dist/delivery/number-line/graph/ticks.d.ts.map +1 -0
  94. package/dist/delivery/number-line/graph/ticks.js +115 -0
  95. package/dist/delivery/number-line/index.d.ts +36 -0
  96. package/dist/delivery/number-line/index.d.ts.map +1 -0
  97. package/dist/delivery/number-line/index.js +218 -0
  98. package/dist/delivery/number-line/point-chooser/button.d.ts +32 -0
  99. package/dist/delivery/number-line/point-chooser/button.d.ts.map +1 -0
  100. package/dist/delivery/number-line/point-chooser/button.js +36 -0
  101. package/dist/delivery/number-line/point-chooser/img.d.ts +11 -0
  102. package/dist/delivery/number-line/point-chooser/img.d.ts.map +1 -0
  103. package/dist/delivery/number-line/point-chooser/img.js +4 -0
  104. package/dist/delivery/number-line/point-chooser/index.d.ts +38 -0
  105. package/dist/delivery/number-line/point-chooser/index.d.ts.map +1 -0
  106. package/dist/delivery/number-line/point-chooser/index.js +154 -0
  107. package/dist/delivery/number-line/point-chooser/styles.d.ts +193 -0
  108. package/dist/delivery/number-line/point-chooser/styles.d.ts.map +1 -0
  109. package/dist/delivery/number-line/transitions/fade.d.ts +35 -0
  110. package/dist/delivery/number-line/transitions/fade.d.ts.map +1 -0
  111. package/dist/delivery/number-line/transitions/fade.js +75 -0
  112. package/dist/delivery/number-line/transitions/index.d.ts +11 -0
  113. package/dist/delivery/number-line/transitions/index.d.ts.map +1 -0
  114. package/dist/index.d.ts +2 -0
  115. package/dist/index.d.ts.map +1 -0
  116. package/dist/index.iife.d.ts +9 -0
  117. package/dist/index.iife.d.ts.map +1 -0
  118. package/dist/index.iife.js +201 -0
  119. package/dist/index.js +2 -0
  120. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_DataView.js +6 -0
  121. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Hash.js +16 -0
  122. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_ListCache.js +16 -0
  123. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Map.js +6 -0
  124. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_MapCache.js +16 -0
  125. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Promise.js +6 -0
  126. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Set.js +6 -0
  127. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_SetCache.js +11 -0
  128. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Stack.js +13 -0
  129. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Symbol.js +5 -0
  130. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Uint8Array.js +5 -0
  131. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_WeakMap.js +6 -0
  132. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_apply.js +12 -0
  133. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayEach.js +7 -0
  134. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayFilter.js +10 -0
  135. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayIncludes.js +7 -0
  136. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayIncludesWith.js +7 -0
  137. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayLikeKeys.js +15 -0
  138. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayMap.js +7 -0
  139. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayPush.js +7 -0
  140. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arraySome.js +7 -0
  141. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assignMergeValue.js +8 -0
  142. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assignValue.js +10 -0
  143. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assocIndexOf.js +8 -0
  144. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssign.js +8 -0
  145. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignIn.js +8 -0
  146. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignValue.js +12 -0
  147. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseClone.js +57 -0
  148. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseCreate.js +14 -0
  149. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseFindIndex.js +7 -0
  150. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseFor.js +5 -0
  151. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGet.js +10 -0
  152. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGetAllKeys.js +9 -0
  153. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGetTag.js +10 -0
  154. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseHasIn.js +6 -0
  155. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIndexOf.js +9 -0
  156. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsArguments.js +9 -0
  157. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsEqual.js +8 -0
  158. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsEqualDeep.js +30 -0
  159. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsMap.js +9 -0
  160. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsMatch.js +26 -0
  161. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsNaN.js +6 -0
  162. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsNative.js +11 -0
  163. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsSet.js +9 -0
  164. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsTypedArray.js +11 -0
  165. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIteratee.js +11 -0
  166. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseKeys.js +12 -0
  167. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseKeysIn.js +13 -0
  168. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseMatches.js +12 -0
  169. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseMatchesProperty.js +17 -0
  170. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseMerge.js +19 -0
  171. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseMergeDeep.js +31 -0
  172. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_basePickBy.js +13 -0
  173. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseProperty.js +8 -0
  174. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_basePropertyDeep.js +9 -0
  175. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseRest.js +9 -0
  176. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseSet.js +22 -0
  177. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseSetToString.js +14 -0
  178. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseTimes.js +7 -0
  179. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseToString.js +15 -0
  180. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseTrim.js +8 -0
  181. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseUnary.js +8 -0
  182. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseUniq.js +27 -0
  183. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cacheHas.js +6 -0
  184. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_castPath.js +10 -0
  185. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneArrayBuffer.js +8 -0
  186. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneBuffer.js +10 -0
  187. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneDataView.js +8 -0
  188. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneRegExp.js +8 -0
  189. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneSymbol.js +8 -0
  190. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneTypedArray.js +8 -0
  191. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copyArray.js +8 -0
  192. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copyObject.js +14 -0
  193. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copySymbols.js +8 -0
  194. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copySymbolsIn.js +8 -0
  195. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_coreJsData.js +5 -0
  196. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_createAssigner.js +15 -0
  197. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_createBaseFor.js +12 -0
  198. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_createFind.js +19 -0
  199. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_createSet.js +9 -0
  200. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_defineProperty.js +10 -0
  201. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalArrays.js +35 -0
  202. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalByTag.js +35 -0
  203. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalObjects.js +32 -0
  204. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_freeGlobal.js +4 -0
  205. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeys.js +9 -0
  206. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeysIn.js +9 -0
  207. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getMapData.js +8 -0
  208. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getMatchData.js +16 -0
  209. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getNative.js +9 -0
  210. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getPrototype.js +5 -0
  211. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getRawTag.js +14 -0
  212. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getSymbols.js +10 -0
  213. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getSymbolsIn.js +11 -0
  214. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getTag.js +23 -0
  215. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getValue.js +6 -0
  216. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hasPath.js +18 -0
  217. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashClear.js +7 -0
  218. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashDelete.js +7 -0
  219. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashGet.js +13 -0
  220. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashHas.js +9 -0
  221. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashSet.js +9 -0
  222. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneArray.js +8 -0
  223. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneByTag.js +33 -0
  224. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneObject.js +9 -0
  225. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isIndex.js +8 -0
  226. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isIterateeCall.js +12 -0
  227. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isKey.js +11 -0
  228. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isKeyable.js +7 -0
  229. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isMasked.js +11 -0
  230. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isPrototype.js +8 -0
  231. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isStrictComparable.js +7 -0
  232. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheClear.js +6 -0
  233. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheDelete.js +9 -0
  234. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheGet.js +8 -0
  235. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheHas.js +7 -0
  236. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheSet.js +8 -0
  237. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheClear.js +13 -0
  238. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheDelete.js +8 -0
  239. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheGet.js +7 -0
  240. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheHas.js +7 -0
  241. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheSet.js +8 -0
  242. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapToArray.js +9 -0
  243. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_matchesStrictComparable.js +8 -0
  244. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_memoizeCapped.js +11 -0
  245. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeCreate.js +5 -0
  246. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeys.js +5 -0
  247. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeysIn.js +8 -0
  248. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nodeUtil.js +9 -0
  249. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_objectToString.js +7 -0
  250. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_overArg.js +8 -0
  251. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_overRest.js +13 -0
  252. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_root.js +5 -0
  253. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_safeGet.js +6 -0
  254. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setCacheAdd.js +7 -0
  255. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setCacheHas.js +6 -0
  256. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setToArray.js +9 -0
  257. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setToString.js +6 -0
  258. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_shortOut.js +14 -0
  259. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackClear.js +7 -0
  260. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackDelete.js +7 -0
  261. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackGet.js +6 -0
  262. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackHas.js +6 -0
  263. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackSet.js +16 -0
  264. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_strictIndexOf.js +7 -0
  265. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stringToPath.js +10 -0
  266. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_toKey.js +10 -0
  267. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_toSource.js +15 -0
  268. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_trimmedEndIndex.js +8 -0
  269. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/cloneDeep.js +8 -0
  270. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/constant.js +8 -0
  271. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/eq.js +6 -0
  272. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/find.js +6 -0
  273. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/findIndex.js +13 -0
  274. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/get.js +8 -0
  275. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/hasIn.js +8 -0
  276. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/identity.js +6 -0
  277. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArguments.js +10 -0
  278. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArray.js +4 -0
  279. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArrayLike.js +8 -0
  280. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArrayLikeObject.js +8 -0
  281. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isBuffer.js +6 -0
  282. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isEmpty.js +21 -0
  283. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isEqual.js +7 -0
  284. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isEqualWith.js +9 -0
  285. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isFunction.js +11 -0
  286. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isLength.js +7 -0
  287. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isMap.js +7 -0
  288. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isNumber.js +9 -0
  289. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isObject.js +7 -0
  290. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isObjectLike.js +6 -0
  291. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isPlainObject.js +14 -0
  292. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isSet.js +7 -0
  293. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isSymbol.js +9 -0
  294. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isTypedArray.js +7 -0
  295. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keys.js +9 -0
  296. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keysIn.js +9 -0
  297. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/memoize.js +16 -0
  298. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/merge.js +8 -0
  299. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/negate.js +17 -0
  300. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/noop.js +4 -0
  301. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/omitBy.js +9 -0
  302. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/pickBy.js +16 -0
  303. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/property.js +10 -0
  304. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/stubArray.js +6 -0
  305. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/stubFalse.js +6 -0
  306. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/toFinite.js +8 -0
  307. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/toInteger.js +8 -0
  308. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/toNumber.js +19 -0
  309. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/toPlainObject.js +8 -0
  310. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/toString.js +7 -0
  311. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/uniqWith.js +7 -0
  312. package/package.json +77 -0
  313. package/src/author/arrows.tsx +87 -0
  314. package/src/author/card-bar.tsx +70 -0
  315. package/src/author/defaults.ts +127 -0
  316. package/src/author/domain.tsx +79 -0
  317. package/src/author/index.ts +199 -0
  318. package/src/author/main.tsx +777 -0
  319. package/src/author/number-text-field.tsx +28 -0
  320. package/src/author/point-config.tsx +93 -0
  321. package/src/author/size.tsx +74 -0
  322. package/src/author/ticks.tsx +272 -0
  323. package/src/author/utils.ts +16 -0
  324. package/src/controller/defaults.ts +40 -0
  325. package/src/controller/index.ts +437 -0
  326. package/src/controller/tickUtils.ts +324 -0
  327. package/src/controller/utils.ts +159 -0
  328. package/src/delivery/data-converter.ts +88 -0
  329. package/src/delivery/draggable/index.ts +116 -0
  330. package/src/delivery/index.ts +225 -0
  331. package/src/delivery/number-line/colors.ts +15 -0
  332. package/src/delivery/number-line/feedback.tsx +85 -0
  333. package/src/delivery/number-line/graph/arrow.tsx +43 -0
  334. package/src/delivery/number-line/graph/elements/base.ts +20 -0
  335. package/src/delivery/number-line/graph/elements/builder.ts +37 -0
  336. package/src/delivery/number-line/graph/elements/line.tsx +259 -0
  337. package/src/delivery/number-line/graph/elements/point.tsx +219 -0
  338. package/src/delivery/number-line/graph/elements/ray.tsx +168 -0
  339. package/src/delivery/number-line/graph/index.tsx +258 -0
  340. package/src/delivery/number-line/graph/line.tsx +33 -0
  341. package/src/delivery/number-line/graph/stacks.ts +82 -0
  342. package/src/delivery/number-line/graph/tick-utils.ts +369 -0
  343. package/src/delivery/number-line/graph/ticks.tsx +189 -0
  344. package/src/delivery/number-line/index.tsx +385 -0
  345. package/src/delivery/number-line/point-chooser/button.tsx +54 -0
  346. package/src/delivery/number-line/point-chooser/img.ts +11 -0
  347. package/src/delivery/number-line/point-chooser/index.tsx +200 -0
  348. package/src/delivery/number-line/point-chooser/styles.ts +86 -0
  349. package/src/delivery/number-line/transitions/fade.tsx +100 -0
  350. package/src/delivery/number-line/transitions/index.ts +12 -0
  351. package/src/index.iife.ts +16 -0
  352. package/src/index.ts +1 -0
@@ -0,0 +1,437 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-elements/packages/number-line/controller/src/index.js
4
+ * @auto-generated
5
+ *
6
+ * This file is automatically synced from pie-elements and converted to TypeScript.
7
+ * Manual edits will be overwritten on next sync.
8
+ * To make changes, edit the upstream JavaScript file and run sync again.
9
+ */
10
+
11
+ import { cloneDeep, find, isEmpty, isEqualWith, merge, omitBy } from 'lodash-es';
12
+ import { getFeedbackForCorrectness } from '@pie-element/shared-feedback';
13
+ import { partialScoring } from '@pie-element/shared-controller-utils';
14
+ import * as math from 'mathjs';
15
+
16
+ import defaults from './defaults.js';
17
+ import { reloadTicksData } from './utils.js';
18
+
19
+ const score = (number) => {
20
+ return {
21
+ score: {
22
+ scaled: number,
23
+ },
24
+ };
25
+ };
26
+
27
+ const getPartialScore = (corrected, ps) => {
28
+ const { correct } = corrected;
29
+ const rule = ps.find((r) => r.numberOfCorrect === correct.length);
30
+
31
+ if (rule) {
32
+ return 1.0 * (rule.scorePercentage / 100);
33
+ } else {
34
+ return 0;
35
+ }
36
+ };
37
+
38
+ const accumulateAnswer = (correctResponse) => (total, answer) => {
39
+ const isCorrectResponse = correctResponse.some((cr) => matches(cr)(answer));
40
+ return total + (isCorrectResponse ? 1 : 0);
41
+ };
42
+
43
+ /**
44
+ * Generates detailed trace log for scoring evaluation
45
+ * @param {Object} model - the question model
46
+ * @param {Object} session - the student session
47
+ * @param {Object} env - the environment
48
+ * @returns {Array} traceLog - array of trace messages
49
+ */
50
+ export const getLogTrace = (model, session, env) => {
51
+ const traceLog = [];
52
+
53
+ const studentAnswers = session?.answer || [];
54
+ const correctResponse = model?.correctResponse || [];
55
+
56
+ if (!studentAnswers.length) {
57
+ return ['Student did not interact with the number line.'];
58
+ }
59
+
60
+ const corrected = getCorrected(studentAnswers, cloneDeep(correctResponse));
61
+ const { correct, incorrect, notInAnswer, noCorrectResponse } = corrected;
62
+
63
+ if (noCorrectResponse) {
64
+ return ['No correct response is defined for this item.'];
65
+ }
66
+
67
+ const correctCount = correct.length;
68
+ const incorrectCount = incorrect.length;
69
+ const missingCount = notInAnswer.length;
70
+
71
+ if (correctCount > 0) {
72
+ traceLog.push(`${correctCount} object(s) correctly placed.`);
73
+ }
74
+
75
+ if (incorrectCount > 0) {
76
+ traceLog.push(`${incorrectCount} incorrect object(s) placed.`);
77
+ }
78
+
79
+ if (missingCount > 0) {
80
+ traceLog.push(`${missingCount} expected object(s) were not placed.`);
81
+ }
82
+
83
+ const studentAnswersCopy = [...studentAnswers];
84
+ const correctResponseCopy = [...correctResponse];
85
+
86
+ correct.forEach((index) => {
87
+ const answer = studentAnswersCopy[index];
88
+ const objectType = answer?.type || 'object';
89
+ traceLog.push(`${objectType.charAt(0).toUpperCase() + objectType.slice(1)} at position ${answer.domainPosition} is correct.`);
90
+ });
91
+
92
+ incorrect.forEach((index) => {
93
+ const answer = studentAnswersCopy[index];
94
+ const objectType = answer?.type || 'object';
95
+ traceLog.push(`${objectType.charAt(0).toUpperCase() + objectType.slice(1)} at position ${answer.domainPosition} does not match the expected response.`);
96
+ });
97
+
98
+ notInAnswer.forEach((expectedObject) => {
99
+ const objectType = expectedObject?.type || 'object';
100
+ traceLog.push(`Expected ${objectType} at position ${expectedObject.domainPosition} was not placed by the student.`);
101
+ });
102
+
103
+ const partialScoringEnabled = partialScoring.enabled(model, env);
104
+
105
+ if (partialScoringEnabled) {
106
+ traceLog.push('Score calculated using partial scoring.');
107
+ traceLog.push(`Partial scoring is based on the number of correct objects, with deductions for extras.`);
108
+ } else {
109
+ traceLog.push('Score calculated using all-or-nothing scoring.');
110
+ }
111
+
112
+ const total = correctResponse.length || 1;
113
+ const extraPlacements =
114
+ studentAnswers.length > total ? studentAnswers.length - total : 0;
115
+
116
+ if (extraPlacements > 0) {
117
+ traceLog.push(
118
+ `${extraPlacements} extra object(s) beyond the required amount were placed and deducted.`,
119
+ );
120
+ }
121
+
122
+ const rawScore = Math.max(0, (correctCount - extraPlacements) / total);
123
+ const finalScore = partialScoringEnabled ? rawScore : rawScore === 1 ? 1 : 0;
124
+
125
+ traceLog.push(`Final score: ${finalScore}.`);
126
+
127
+ return traceLog;
128
+ };
129
+
130
+
131
+ /**
132
+ */
133
+ export function outcome(model, session, env) {
134
+ return new Promise((resolve) => {
135
+ if (!session || isEmpty(session)) {
136
+ resolve({ score: 0, empty: true, logTrace: ['Student did not interact with the number line.'] });
137
+ } else {
138
+ const partialScoringEnabled = partialScoring.enabled(model, env);
139
+ const numCorrect = (session.answer || []).reduce(accumulateAnswer(model.correctResponse), 0);
140
+
141
+ let total = model.correctResponse.length;
142
+ let numIncorrect = 0;
143
+
144
+ if ((session.answer || []).length > total) {
145
+ numIncorrect = (session.answer || []).length - total;
146
+ }
147
+
148
+ if (total === 0) {
149
+ total = 1;
150
+ }
151
+
152
+ let score = numCorrect < 0 ? 0 : (numCorrect - numIncorrect) / total;
153
+
154
+ if (score < 0) {
155
+ score = 0;
156
+ }
157
+
158
+ resolve({
159
+ score: partialScoringEnabled ? score : score === 1 ? 1 : 0,
160
+ logTrace: getLogTrace(model, session, env)
161
+ });
162
+ }
163
+ });
164
+ }
165
+
166
+ export function getScore(question, session) {
167
+ return new Promise((resolve) => {
168
+ if (!session || isEmpty(session)) {
169
+ resolve({ score: { scaled: 0 } });
170
+ } else {
171
+ session.answer = session.answer || [];
172
+
173
+ const corrected = getCorrected(session.answer, cloneDeep(question.correctResponse));
174
+
175
+ const correctness = getCorrectness(corrected);
176
+
177
+ if (correctness === 'correct') {
178
+ resolve(score(1.0));
179
+ } else if (correctness === 'incorrect') {
180
+ resolve(score(0.0));
181
+ } else if (correctness === 'partial') {
182
+ const { allowPartialScoring, partialScoring } = question;
183
+ const ps = (partialScoring || []).filter((o) => !isEmpty(o));
184
+ const canDoPartialScoring = allowPartialScoring && ps.length > 0;
185
+ if (canDoPartialScoring) {
186
+ resolve(score(getPartialScore(corrected, ps)));
187
+ } else {
188
+ resolve(score(0.0));
189
+ }
190
+ } else {
191
+ resolve({ score: { scaled: -1 } });
192
+ }
193
+ }
194
+ });
195
+ }
196
+
197
+ export const CLOSE_TO_PRECISION = 3;
198
+
199
+ export const closeTo = (a, b, precision) => {
200
+ precision = precision || 5;
201
+ const expectedDiff = Math.pow(10, -precision) / 2;
202
+ const receivedDiff = Math.abs(a - b);
203
+ const close = receivedDiff <= expectedDiff;
204
+ return close;
205
+ };
206
+
207
+ const matches = (a) => (v) => {
208
+ return isEqualWith(a, v, (v, ov) => {
209
+ if (typeof v === 'number' && typeof ov === 'number') {
210
+ return closeTo(v, ov, CLOSE_TO_PRECISION);
211
+ }
212
+ });
213
+ };
214
+
215
+ export const getCorrected = (answer, correctResponse) => {
216
+ if (isEmpty(correctResponse) && answer.length > 0) {
217
+ return {
218
+ correct: [],
219
+ incorrect: [],
220
+ notInAnswer: [],
221
+ noCorrectResponse: true,
222
+ };
223
+ }
224
+
225
+ return answer.reduce(
226
+ (acc, a, index) => {
227
+ const { correct, incorrect, notInAnswer } = acc;
228
+
229
+ const match = find(notInAnswer, matches(a));
230
+ if (match) {
231
+ correct.push(index);
232
+ notInAnswer.splice(notInAnswer.indexOf(match), 1);
233
+ } else {
234
+ incorrect.push(index);
235
+ }
236
+
237
+ return {
238
+ correct: correct,
239
+ incorrect: incorrect,
240
+ notInAnswer: notInAnswer,
241
+ };
242
+ },
243
+ {
244
+ correct: [],
245
+ incorrect: [],
246
+ notInAnswer: correctResponse,
247
+ },
248
+ );
249
+ };
250
+
251
+ export const getCorrectness = (corrected) => {
252
+ const { incorrect, correct, notInAnswer, noCorrectResponse } = corrected;
253
+
254
+ if (noCorrectResponse) {
255
+ return 'unknown';
256
+ }
257
+
258
+ if (incorrect.length === 0 && correct.length === 0) {
259
+ return 'unanswered';
260
+ }
261
+
262
+ if (incorrect.length === 0 && notInAnswer.length === 0) {
263
+ return 'correct';
264
+ }
265
+
266
+ if (incorrect.length > 0 || notInAnswer.length > 0) {
267
+ if (correct.length > 0) {
268
+ return 'partial';
269
+ } else {
270
+ return 'incorrect';
271
+ }
272
+ }
273
+
274
+ return 'unknown';
275
+ };
276
+
277
+ /**
278
+ * A sample of a normalize function see:
279
+ * https://github.com/pie-framework/pie-elements/issues/21
280
+ */
281
+ export function normalize(question) {
282
+ const feedback = merge(defaults.feedback, question.feedback);
283
+
284
+ return { ...defaults, ...question, feedback };
285
+ }
286
+
287
+ export function createDefaultModel(model = {}) {
288
+ return new Promise((resolve) => {
289
+ const out = {
290
+ ...model,
291
+ graph: {
292
+ ...defaults.graph,
293
+ ...model.graph,
294
+ },
295
+ colorContrast: 'black_on_white',
296
+ };
297
+
298
+ resolve(omitBy(out, (v) => !v));
299
+ });
300
+ }
301
+
302
+ // this function is duplicated in configure; at some point, use the same shared function
303
+ const updateTicks = (model) => {
304
+ const { graph: { domain, labelStep, ticks = {} } = {} } = model;
305
+ const { minor, major } = ticks;
306
+
307
+ if (domain) {
308
+ domain.min = Number((domain.min || 0).toFixed(2));
309
+ domain.max = Number((domain.max || 0).toFixed(2));
310
+ }
311
+
312
+ if (labelStep && typeof labelStep === 'string' && labelStep.match(/^[1-9][0-9]*\/[1-9][0-9]*$/g)) {
313
+ model.graph.fraction = true;
314
+ ticks.tickIntervalType = 'Fraction';
315
+
316
+ // update the ticks frequency and label value to match the label step if needed
317
+ const step = math.evaluate(labelStep);
318
+
319
+ if (step !== major) {
320
+ ticks.major = step;
321
+ ticks.minor = step / (major / minor);
322
+ }
323
+ }
324
+
325
+ return model;
326
+ };
327
+
328
+ export async function model(question, session, env) {
329
+ if (!question) {
330
+ throw new Error('question is null');
331
+ }
332
+
333
+ const normalizedQuestion = await normalize(question);
334
+ const normalizedModel = updateTicks(normalizedQuestion);
335
+ // this function is also called in configure, it is a duplicate to maintain consistency and correctness
336
+ const graph = reloadTicksData(normalizedModel.graph);
337
+
338
+ if (graph) {
339
+ const evaluateMode = env.mode === 'evaluate';
340
+
341
+ const correctResponse = cloneDeep(normalizedQuestion.correctResponse);
342
+ const corrected = evaluateMode && getCorrected(session ? session.answer || [] : [], correctResponse);
343
+ const correctness = evaluateMode && getCorrectness(corrected);
344
+
345
+ const { exhibitOnly } = graph;
346
+ const disabled = env.mode !== 'gather' || exhibitOnly === true;
347
+ let teacherInstructions = null;
348
+
349
+ if (env.role === 'instructor' && (env.mode === 'view' || evaluateMode)) {
350
+ teacherInstructions = normalizedQuestion.teacherInstructions;
351
+ }
352
+
353
+ const feedbackMessage = evaluateMode
354
+ ? await getFeedbackForCorrectness(correctness, normalizedQuestion.feedback)
355
+ : undefined;
356
+
357
+ const out = {
358
+ prompt: normalizedQuestion.prompt,
359
+ teacherInstructions,
360
+ graph,
361
+ disabled,
362
+ corrected,
363
+ correctResponse:
364
+ evaluateMode && ['unanswered', 'correct'].indexOf(correctness) === -1 && normalizedQuestion.correctResponse,
365
+ feedback: feedbackMessage && {
366
+ type: correctness,
367
+ message: feedbackMessage,
368
+ },
369
+ colorContrast: (env.accessibility && env.accessibility.colorContrast) || 'black_on_white',
370
+ language: normalizedQuestion.language,
371
+ extraCSSRules: normalizedQuestion.extraCSSRules,
372
+ };
373
+ return omitBy(out, (v) => !v);
374
+ } else {
375
+ throw new Error('graph is undefined');
376
+ }
377
+ }
378
+
379
+ export const createCorrectResponseSession = (question, env) => {
380
+ return new Promise((resolve) => {
381
+ if (env.mode !== 'evaluate' && env.role === 'instructor') {
382
+ const { correctResponse: answer } = question;
383
+
384
+ resolve({
385
+ answer,
386
+ id: '1',
387
+ });
388
+ } else {
389
+ resolve(null);
390
+ }
391
+ });
392
+ };
393
+
394
+ // remove all html tags
395
+ const getInnerText = (html) => (html || '').replaceAll(/<[^>]*>/g, '');
396
+
397
+ // remove all html tags except img, iframe and source tag for audio
398
+ const getContent = (html) => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');
399
+
400
+ export const validate = (model = {}, config = {}) => {
401
+ const { graph, correctResponse } = model || {};
402
+ const { maxMaxElements = 20, numberLineDimensions: { min: minWidth = 200, max: maxWidth = 800 } = {} } = config || {};
403
+ const { width, domain, maxNumberOfPoints } = graph || {};
404
+ const { min, max } = domain || {};
405
+ const errors = {};
406
+
407
+ ['teacherInstructions', 'prompt'].forEach((field) => {
408
+ if (config[field]?.required && !getContent(model[field])) {
409
+ errors[field] = 'This field is required.';
410
+ }
411
+ });
412
+
413
+ if (width < minWidth || width > maxWidth) {
414
+ errors.widthError = `Width should be a value between ${minWidth} and ${maxWidth}.`;
415
+ }
416
+
417
+ const MIN_DOMAIN = -100000;
418
+ const MAX_DOMAIN = 100000;
419
+
420
+ if (min < MIN_DOMAIN || min > MAX_DOMAIN || max < MIN_DOMAIN || max > MAX_DOMAIN) {
421
+ errors.domainError = `Min and max values must both be in the range [${MIN_DOMAIN}, ${MAX_DOMAIN}].`;
422
+ }
423
+
424
+ if (min >= max) {
425
+ errors.maxError = 'Max value must be greater than min value.';
426
+ }
427
+
428
+ if (maxNumberOfPoints < 1 || maxNumberOfPoints > maxMaxElements) {
429
+ errors.pointsError = `Max number of elements should be between 1 and ${maxMaxElements}.`;
430
+ }
431
+
432
+ if (correctResponse && correctResponse.length === 0) {
433
+ errors.correctResponseError = 'The correct answer should include at least one number line object.';
434
+ }
435
+
436
+ return errors;
437
+ };