@pie-element/math-templated 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 (214) hide show
  1. package/dist/author/defaults.d.ts +174 -0
  2. package/dist/author/defaults.d.ts.map +1 -0
  3. package/dist/author/defaults.js +123 -0
  4. package/dist/author/design.d.ts +36 -0
  5. package/dist/author/design.d.ts.map +1 -0
  6. package/dist/author/design.js +494 -0
  7. package/dist/author/index.d.ts +43 -0
  8. package/dist/author/index.d.ts.map +1 -0
  9. package/dist/author/index.js +98 -0
  10. package/dist/author/markupUtils.d.ts +12 -0
  11. package/dist/author/markupUtils.d.ts.map +1 -0
  12. package/dist/author/markupUtils.js +10 -0
  13. package/dist/author/response.d.ts +42 -0
  14. package/dist/author/response.d.ts.map +1 -0
  15. package/dist/author/response.js +342 -0
  16. package/dist/author/utils.d.ts +10 -0
  17. package/dist/author/utils.d.ts.map +1 -0
  18. package/dist/author/utils.js +7 -0
  19. package/dist/controller/defaults.d.ts +30 -0
  20. package/dist/controller/defaults.d.ts.map +1 -0
  21. package/dist/controller/defaults.js +23 -0
  22. package/dist/controller/index.d.ts +38 -0
  23. package/dist/controller/index.d.ts.map +1 -0
  24. package/dist/controller/index.js +125 -0
  25. package/dist/delivery/index.d.ts +21 -0
  26. package/dist/delivery/index.d.ts.map +1 -0
  27. package/dist/delivery/index.js +51 -0
  28. package/dist/delivery/main.d.ts +40 -0
  29. package/dist/delivery/main.d.ts.map +1 -0
  30. package/dist/delivery/main.js +538 -0
  31. package/dist/index.d.ts +2 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.iife.d.ts +9 -0
  34. package/dist/index.iife.d.ts.map +1 -0
  35. package/dist/index.iife.js +224 -0
  36. package/dist/index.js +2 -0
  37. package/dist/math-templated.css +2 -0
  38. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_DataView.js +6 -0
  39. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Hash.js +16 -0
  40. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_ListCache.js +16 -0
  41. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Map.js +6 -0
  42. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_MapCache.js +16 -0
  43. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Promise.js +6 -0
  44. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Set.js +6 -0
  45. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_SetCache.js +11 -0
  46. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Stack.js +13 -0
  47. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Symbol.js +5 -0
  48. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Uint8Array.js +5 -0
  49. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_WeakMap.js +6 -0
  50. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_apply.js +12 -0
  51. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayEach.js +7 -0
  52. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayFilter.js +10 -0
  53. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayLikeKeys.js +15 -0
  54. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayMap.js +7 -0
  55. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayPush.js +7 -0
  56. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arraySome.js +7 -0
  57. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assignValue.js +10 -0
  58. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assocIndexOf.js +8 -0
  59. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssign.js +8 -0
  60. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignIn.js +8 -0
  61. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignValue.js +12 -0
  62. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseClone.js +57 -0
  63. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseCreate.js +14 -0
  64. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseFlatten.js +13 -0
  65. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGet.js +10 -0
  66. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGetAllKeys.js +9 -0
  67. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGetTag.js +10 -0
  68. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseHasIn.js +6 -0
  69. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsArguments.js +9 -0
  70. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsEqual.js +8 -0
  71. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsEqualDeep.js +30 -0
  72. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsMap.js +9 -0
  73. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsNative.js +11 -0
  74. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsSet.js +9 -0
  75. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsTypedArray.js +11 -0
  76. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseKeys.js +12 -0
  77. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseKeysIn.js +13 -0
  78. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_basePick.js +10 -0
  79. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_basePickBy.js +13 -0
  80. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseRest.js +9 -0
  81. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseSet.js +22 -0
  82. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseSetToString.js +14 -0
  83. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseTimes.js +7 -0
  84. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseToString.js +15 -0
  85. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseTrim.js +8 -0
  86. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseUnary.js +8 -0
  87. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cacheHas.js +6 -0
  88. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_castPath.js +10 -0
  89. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneArrayBuffer.js +8 -0
  90. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneBuffer.js +10 -0
  91. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneDataView.js +8 -0
  92. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneRegExp.js +8 -0
  93. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneSymbol.js +8 -0
  94. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneTypedArray.js +8 -0
  95. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copyArray.js +8 -0
  96. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copyObject.js +14 -0
  97. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copySymbols.js +8 -0
  98. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copySymbolsIn.js +8 -0
  99. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_coreJsData.js +5 -0
  100. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_defineProperty.js +10 -0
  101. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalArrays.js +35 -0
  102. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalByTag.js +35 -0
  103. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalObjects.js +32 -0
  104. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_flatRest.js +9 -0
  105. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_freeGlobal.js +4 -0
  106. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeys.js +9 -0
  107. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeysIn.js +9 -0
  108. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getMapData.js +8 -0
  109. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getNative.js +9 -0
  110. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getPrototype.js +5 -0
  111. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getRawTag.js +14 -0
  112. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getSymbols.js +10 -0
  113. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getSymbolsIn.js +11 -0
  114. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getTag.js +23 -0
  115. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getValue.js +6 -0
  116. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hasPath.js +18 -0
  117. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashClear.js +7 -0
  118. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashDelete.js +7 -0
  119. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashGet.js +13 -0
  120. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashHas.js +9 -0
  121. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashSet.js +9 -0
  122. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneArray.js +8 -0
  123. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneByTag.js +33 -0
  124. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneObject.js +9 -0
  125. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isFlattenable.js +10 -0
  126. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isIndex.js +8 -0
  127. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isIterateeCall.js +12 -0
  128. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isKey.js +11 -0
  129. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isKeyable.js +7 -0
  130. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isMasked.js +11 -0
  131. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isPrototype.js +8 -0
  132. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheClear.js +6 -0
  133. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheDelete.js +9 -0
  134. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheGet.js +8 -0
  135. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheHas.js +7 -0
  136. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheSet.js +8 -0
  137. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheClear.js +13 -0
  138. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheDelete.js +8 -0
  139. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheGet.js +7 -0
  140. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheHas.js +7 -0
  141. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheSet.js +8 -0
  142. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapToArray.js +9 -0
  143. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_memoizeCapped.js +11 -0
  144. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeCreate.js +5 -0
  145. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeys.js +5 -0
  146. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeysIn.js +8 -0
  147. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nodeUtil.js +9 -0
  148. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_objectToString.js +7 -0
  149. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_overArg.js +8 -0
  150. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_overRest.js +13 -0
  151. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_root.js +5 -0
  152. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setCacheAdd.js +7 -0
  153. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setCacheHas.js +6 -0
  154. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setToArray.js +9 -0
  155. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setToString.js +6 -0
  156. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_shortOut.js +14 -0
  157. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackClear.js +7 -0
  158. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackDelete.js +7 -0
  159. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackGet.js +6 -0
  160. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackHas.js +6 -0
  161. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackSet.js +16 -0
  162. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stringToPath.js +10 -0
  163. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_toKey.js +10 -0
  164. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_toSource.js +15 -0
  165. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_trimmedEndIndex.js +8 -0
  166. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/cloneDeep.js +8 -0
  167. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/constant.js +8 -0
  168. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/debounce.js +50 -0
  169. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/defaults.js +16 -0
  170. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/eq.js +6 -0
  171. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/flatten.js +7 -0
  172. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/hasIn.js +8 -0
  173. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/identity.js +6 -0
  174. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArguments.js +10 -0
  175. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArray.js +4 -0
  176. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArrayLike.js +8 -0
  177. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isBuffer.js +6 -0
  178. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isEmpty.js +21 -0
  179. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isEqual.js +7 -0
  180. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isFunction.js +11 -0
  181. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isLength.js +7 -0
  182. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isMap.js +7 -0
  183. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isObject.js +7 -0
  184. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isObjectLike.js +6 -0
  185. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isSet.js +7 -0
  186. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isSymbol.js +9 -0
  187. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isTypedArray.js +7 -0
  188. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keys.js +9 -0
  189. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keysIn.js +9 -0
  190. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/memoize.js +16 -0
  191. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/now.js +7 -0
  192. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/pick.js +8 -0
  193. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/stubArray.js +6 -0
  194. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/stubFalse.js +6 -0
  195. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/throttle.js +15 -0
  196. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/toNumber.js +19 -0
  197. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/toString.js +7 -0
  198. package/dist/print/index.d.ts +16 -0
  199. package/dist/print/index.d.ts.map +1 -0
  200. package/dist/print/index.js +47 -0
  201. package/package.json +80 -0
  202. package/src/author/defaults.ts +133 -0
  203. package/src/author/design.tsx +526 -0
  204. package/src/author/index.ts +195 -0
  205. package/src/author/markupUtils.tsx +55 -0
  206. package/src/author/response.tsx +397 -0
  207. package/src/author/utils.ts +24 -0
  208. package/src/controller/defaults.ts +31 -0
  209. package/src/controller/index.ts +294 -0
  210. package/src/delivery/index.ts +94 -0
  211. package/src/delivery/main.tsx +800 -0
  212. package/src/index.iife.ts +16 -0
  213. package/src/index.ts +1 -0
  214. package/src/print/index.tsx +99 -0
@@ -0,0 +1,526 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-elements/packages/math-templated/configure/src/design.jsx
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 React from 'react';
12
+ import PropTypes from 'prop-types';
13
+ import { styled } from '@mui/material/styles';
14
+ import Typography from '@mui/material/Typography';
15
+ import Select from '@mui/material/Select';
16
+ import MenuItem from '@mui/material/MenuItem';
17
+ import Info from '@mui/icons-material/Info';
18
+ import Tooltip from '@mui/material/Tooltip';
19
+ import { cloneDeep, pick, throttle } from 'lodash-es';
20
+ import { InputContainer, settings, layout } from '@pie-lib/config-ui';
21
+ import EditableHtml, { ALL_PLUGINS } from '@pie-lib/editable-html-tip-tap';
22
+ const { dropdown } = settings;
23
+
24
+ import Response from './response';
25
+ import { processMarkup, createSlateMarkup } from './markupUtils';
26
+ import { generateValidationMessage } from './utils';
27
+
28
+ const { Panel, toggle } = settings;
29
+
30
+ const StyledInputContainer: any = styled(InputContainer)(({ theme }) => ({
31
+ width: '100%',
32
+ paddingTop: theme.spacing(2),
33
+ marginBottom: theme.spacing(2),
34
+ }));
35
+
36
+ const StyledEditableHtml: any = styled(EditableHtml)({
37
+ width: '100%',
38
+ });
39
+
40
+ const ErrorText: any = styled('div')(({ theme }) => ({
41
+ color: theme.palette.error.main,
42
+ fontSize: '0.75rem',
43
+ marginTop: theme.spacing(1),
44
+ }));
45
+
46
+ const ResponseAreaError: any = styled('div')(({ theme }) => ({
47
+ color: theme.palette.error.main,
48
+ fontSize: '0.75rem',
49
+ marginBottom: theme.spacing(1),
50
+ }));
51
+
52
+ const StyledMarkup: any = styled(EditableHtml)(({ theme }) => ({
53
+ width: '100%',
54
+ marginTop: theme.spacing(2),
55
+ marginBottom: theme.spacing(3),
56
+ }));
57
+
58
+ const StyledSelectContainer: any = styled(InputContainer)(({ theme }) => ({
59
+ width: '100%',
60
+ marginTop: theme.spacing(2),
61
+ '& > *:not(label)': {
62
+ marginTop: theme.spacing(1),
63
+ },
64
+ marginBottom: theme.spacing(2),
65
+ }));
66
+
67
+ const StyledSelect: any = styled(Select)({
68
+ width: '100%',
69
+ });
70
+
71
+ const StyledTitle: any = styled(Typography)(({ theme }) => ({
72
+ fontSize: theme.typography.fontSize * 1.25,
73
+ fontWeight: 'bold',
74
+ }));
75
+
76
+ const TooltipContainer: any = styled('div')({
77
+ display: 'flex',
78
+ alignItems: 'center',
79
+ gap: '8px',
80
+ });
81
+
82
+ const StyledTooltip: any = styled(Tooltip)(({ theme }) => ({
83
+ '& .MuiTooltip-tooltip': {
84
+ fontSize: theme.typography.fontSize - 2,
85
+ whiteSpace: 'pre',
86
+ maxWidth: '500px',
87
+ },
88
+ }));
89
+
90
+ const createElementFromHTML = (htmlString) => {
91
+ const div = document.createElement('div');
92
+ div.innerHTML = htmlString.trim();
93
+
94
+ return div;
95
+ };
96
+
97
+ export class Design extends React.Component {
98
+ static propTypes = {
99
+ model: PropTypes.object.isRequired,
100
+ configuration: PropTypes.object.isRequired,
101
+ onModelChanged: PropTypes.func.isRequired,
102
+ onConfigurationChanged: PropTypes.func.isRequired,
103
+ imageSupport: PropTypes.shape({
104
+ add: PropTypes.func.isRequired,
105
+ delete: PropTypes.func.isRequired,
106
+ }),
107
+ uploadSoundSupport: PropTypes.object,
108
+ };
109
+
110
+ state = {};
111
+
112
+ componentDidMount() {
113
+ const {
114
+ model: { slateMarkup },
115
+ } = this.props;
116
+
117
+ this.setState({ markup: slateMarkup });
118
+ }
119
+
120
+ handleChange: any = (key, value) => {
121
+ const { onModelChanged, model } = this.props;
122
+ const updatedModel = cloneDeep(model);
123
+ updatedModel[key] = value;
124
+ onModelChanged(updatedModel);
125
+ };
126
+
127
+ onResponseChange: any = (response, index) => {
128
+ const { model, onModelChanged } = this.props;
129
+ const newModel = { ...model };
130
+
131
+ newModel.responses[index] = response;
132
+ onModelChanged(newModel);
133
+ };
134
+
135
+ onResponseDone: any = () => {
136
+ const { model, onModelChanged } = this.props;
137
+
138
+ onModelChanged({
139
+ ...model,
140
+ slateMarkup: createSlateMarkup(model.markup, model.responses),
141
+ });
142
+ };
143
+
144
+ onChangeResponse: any = (index, newVal) => {
145
+ const { model, onModelChanged } = this.props;
146
+ const { responses } = model;
147
+
148
+ if (!responses[index]) {
149
+ responses[index] = [{ answer: newVal || '', id: 'response' + index, allowSpaces: true }];
150
+ } else {
151
+ responses[index][0].answer = newVal || '';
152
+ }
153
+
154
+ onModelChanged({ ...model, responses });
155
+ };
156
+
157
+ onResponsesChanged: any = (responses) => {
158
+ this.props.onModelChanged({ ...this.props.model, responses });
159
+ };
160
+
161
+ onChange: any = (markup) => {
162
+ const {
163
+ model: { responses, validationDefault, allowTrailingZerosDefault, ignoreOrderDefault },
164
+ onModelChanged,
165
+ } = this.props;
166
+ const newResponses = {};
167
+ const domMarkup = createElementFromHTML(markup);
168
+ const responseAreas = domMarkup.querySelectorAll('[data-type="math_templated"]');
169
+
170
+ responseAreas.forEach((element, index) => {
171
+ const { value, index: dataIndex } = element.dataset;
172
+
173
+ if (!value) {
174
+ element.dataset.value = '';
175
+ }
176
+
177
+ newResponses[index] = responses[dataIndex] || {
178
+ allowSpaces: true,
179
+ validation: validationDefault || 'symbolic',
180
+ allowTrailingZeros: allowTrailingZerosDefault || false,
181
+ ignoreOrder: ignoreOrderDefault || false,
182
+ answer: '',
183
+ alternates: {},
184
+ };
185
+
186
+ element.dataset.index = index.toString();
187
+ });
188
+
189
+ const processedMarkup = processMarkup(markup);
190
+
191
+ const callback = () =>
192
+ onModelChanged({
193
+ ...this.props.model,
194
+ slateMarkup: domMarkup.innerHTML,
195
+ responses: newResponses,
196
+ markup: processedMarkup,
197
+ });
198
+
199
+ this.setState({ cachedResponses: undefined }, callback);
200
+ };
201
+
202
+ onHandleAreaChange = throttle(
203
+ (nodes) => {
204
+ const {
205
+ model: { responses },
206
+ onModelChanged,
207
+ } = this.props;
208
+ const { cachedResponses } = this.state;
209
+
210
+ if (!nodes) {
211
+ return;
212
+ }
213
+
214
+ const newChoices = responses ? cloneDeep(responses) : {};
215
+ const newCachedResponses = cachedResponses ? cloneDeep(cachedResponses) : {};
216
+
217
+ nodes.forEach((node) => {
218
+ const keyForNode = node.data.get('index');
219
+
220
+ if (!newChoices[keyForNode] && newCachedResponses[keyForNode]) {
221
+ Object.assign(newChoices, pick(newCachedResponses, keyForNode));
222
+
223
+ if (Object.prototype.hasOwnProperty.call(newCachedResponses, keyForNode)) {
224
+ delete newCachedResponses[keyForNode];
225
+ }
226
+ } else {
227
+ Object.assign(newCachedResponses, pick(newChoices, keyForNode));
228
+
229
+ if (Object.prototype.hasOwnProperty.call(newChoices, keyForNode)) {
230
+ delete newChoices[keyForNode];
231
+ }
232
+ }
233
+ });
234
+
235
+ const callback = () => onModelChanged({ ...this.props.model, responses: newChoices });
236
+
237
+ this.setState({ cachedResponses: newCachedResponses }, callback);
238
+ },
239
+ 500,
240
+ { trailing: false, leading: true },
241
+ );
242
+
243
+ onBlur: any = (e) => {
244
+ const { relatedTarget, currentTarget } = e || {};
245
+
246
+ function getParentWithRoleTooltip(element, depth = 0) {
247
+ // only run this max 16 times
248
+ if (!element || depth >= 16) return null;
249
+
250
+ const parent = element.offsetParent;
251
+
252
+ if (!parent) return null;
253
+
254
+ if (parent.getAttribute('role') === 'tooltip') {
255
+ return parent;
256
+ }
257
+
258
+ return getParentWithRoleTooltip(parent, depth + 1);
259
+ }
260
+
261
+ function getDeepChildDataKeypad(element, depth = 0) {
262
+ // only run this max 4 times
263
+ if (!element || depth >= 4) return null;
264
+
265
+ const child = element?.children?.[0];
266
+
267
+ if (!child) return null;
268
+
269
+ if (child.attributes && child.attributes['data-keypad']) {
270
+ return child;
271
+ }
272
+
273
+ return getDeepChildDataKeypad(child, depth + 1);
274
+ }
275
+
276
+ const parentWithTooltipRole = getParentWithRoleTooltip(relatedTarget);
277
+ const childWithDataKeypad = parentWithTooltipRole ? getDeepChildDataKeypad(parentWithTooltipRole) : null;
278
+
279
+ if (!relatedTarget || !currentTarget || !childWithDataKeypad?.attributes['data-keypad']) {
280
+ this.setState({ activeAnswerBlock: '' });
281
+ }
282
+ };
283
+
284
+ render() {
285
+ const { configuration, imageSupport, model, onConfigurationChanged, onModelChanged, uploadSoundSupport } =
286
+ this.props;
287
+
288
+ const {
289
+ baseInputConfiguration = {},
290
+ contentDimensions = {},
291
+ prompt = {},
292
+ rationale = {},
293
+ settingsPanelDisabled,
294
+ teacherInstructions = {},
295
+ language = {},
296
+ languageChoices = {},
297
+ spellCheck = {},
298
+ playerSpellCheck = {},
299
+ maxImageWidth = {},
300
+ maxImageHeight = {},
301
+ mathMlOptions = {},
302
+ template = {},
303
+ editSource = {},
304
+ ignoreOrder: cIgnoreOrder = {},
305
+ allowTrailingZeros: cAllowTrailingZeros = {},
306
+ partialScoring = {},
307
+ maxResponseAreas,
308
+ } = configuration || {};
309
+
310
+ const {
311
+ errors,
312
+ extraCSSRules,
313
+ promptEnabled,
314
+ rationaleEnabled,
315
+ spellCheckEnabled,
316
+ teacherInstructionsEnabled,
317
+ toolbarEditorPosition,
318
+ responses,
319
+ equationEditor,
320
+ } = model || {};
321
+
322
+ const {
323
+ prompt: promptError,
324
+ rationale: rationaleError,
325
+ responseAreas: responseAreasError,
326
+ teacherInstructions: teacherInstructionsError,
327
+ responses: responsesErrors = {},
328
+ } = errors || {};
329
+ const validationMessage = generateValidationMessage(configuration);
330
+
331
+ const panelSettings = {
332
+ 'language.enabled': language.settings && toggle(language.label, true),
333
+ language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options),
334
+ };
335
+
336
+ const panelProperties = {
337
+ teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
338
+ rationaleEnabled: rationale.settings && toggle(rationale.label),
339
+ promptEnabled: prompt.settings && toggle(prompt.label),
340
+ spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
341
+ playerSpellCheckEnabled: playerSpellCheck.settings && toggle(playerSpellCheck.label),
342
+ 'editSource.enabled': editSource?.settings && toggle(editSource.label, true),
343
+ partialScoring: partialScoring.settings && toggle(partialScoring.label),
344
+ };
345
+
346
+ const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
347
+ const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
348
+
349
+ const toolbarOpts = {
350
+ position: toolbarEditorPosition === 'top' ? 'top' : 'bottom',
351
+ };
352
+
353
+ const getPluginProps = (props = {}, baseInputConfiguration = {}) => ({
354
+ ...baseInputConfiguration,
355
+ ...props,
356
+ });
357
+
358
+ return (
359
+ <layout.ConfigLayout
360
+ extraCSSRules={extraCSSRules}
361
+ dimensions={contentDimensions}
362
+ hideSettings={settingsPanelDisabled}
363
+ settings={
364
+ <Panel
365
+ model={model}
366
+ configuration={configuration}
367
+ onChangeModel={(updatedModel) => onModelChanged(updatedModel)}
368
+ onChangeConfiguration={onConfigurationChanged}
369
+ groups={{
370
+ Settings: panelSettings,
371
+ Properties: panelProperties,
372
+ }}
373
+ />
374
+ }
375
+ >
376
+ {teacherInstructionsEnabled && (
377
+ <StyledInputContainer label={teacherInstructions.label}>
378
+ <StyledEditableHtml
379
+ markup={model.teacherInstructions || ''}
380
+ onChange={(value) => this.handleChange('teacherInstructions', value)}
381
+ imageSupport={imageSupport}
382
+ nonEmpty={false}
383
+ error={teacherInstructionsError}
384
+ toolbarOpts={toolbarOpts}
385
+ pluginProps={getPluginProps(teacherInstructions?.inputConfiguration, baseInputConfiguration)}
386
+ spellCheck={spellCheckEnabled}
387
+ maxImageWidth={(maxImageWidth && maxImageWidth.teacherInstructions) || defaultImageMaxWidth}
388
+ maxImageHeight={(maxImageHeight && maxImageHeight.teacherInstructions) || defaultImageMaxHeight}
389
+ uploadSoundSupport={uploadSoundSupport}
390
+ languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}
391
+ mathMlOptions={mathMlOptions}
392
+ />
393
+ {teacherInstructionsError && <ErrorText>{teacherInstructionsError}</ErrorText>}
394
+ </StyledInputContainer>
395
+ )}
396
+
397
+ {promptEnabled && (
398
+ <StyledInputContainer label={prompt.label}>
399
+ <StyledEditableHtml
400
+ markup={model.prompt}
401
+ onChange={(value) => this.handleChange('prompt', value)}
402
+ imageSupport={imageSupport}
403
+ nonEmpty={false}
404
+ disableUnderline
405
+ error={promptError}
406
+ toolbarOpts={toolbarOpts}
407
+ pluginProps={getPluginProps(teacherInstructions?.inputConfiguration, baseInputConfiguration)}
408
+ spellCheck={spellCheckEnabled}
409
+ maxImageWidth={defaultImageMaxWidth}
410
+ maxImageHeight={defaultImageMaxHeight}
411
+ uploadSoundSupport={uploadSoundSupport}
412
+ languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}
413
+ mathMlOptions={mathMlOptions}
414
+ />
415
+ {promptError && <ErrorText>{promptError}</ErrorText>}
416
+ </StyledInputContainer>
417
+ )}
418
+ <TooltipContainer>
419
+ <StyledTitle component={'div'}>Response Template</StyledTitle>
420
+ <StyledTooltip disableFocusListener disableTouchListener placement={'right'} title={validationMessage}>
421
+ <Info fontSize={'small'} color={'primary'} />
422
+ </StyledTooltip>
423
+ </TooltipContainer>
424
+ <StyledMarkup
425
+ activePlugins={ALL_PLUGINS}
426
+ toolbarOpts={{ position: 'top' }}
427
+ spellCheck={spellCheckEnabled}
428
+ pluginProps={getPluginProps(template?.inputConfiguration, baseInputConfiguration)}
429
+ responseAreaProps={{
430
+ type: 'math-templated',
431
+ respAreaToolbar: null,
432
+ error: () => responsesErrors,
433
+ onHandleAreaChange: this.onHandleAreaChange,
434
+ maxResponseAreas: maxResponseAreas,
435
+ }}
436
+ markup={model.slateMarkup}
437
+ onChange={this.onChange}
438
+ imageSupport={imageSupport}
439
+ disableImageAlignmentButtons={true}
440
+ onBlur={this.onBlur}
441
+ disabled={false}
442
+ highlightShape={false}
443
+ error={responseAreasError}
444
+ uploadSoundSupport={uploadSoundSupport}
445
+ languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}
446
+ mathMlOptions={mathMlOptions}
447
+ />
448
+ {responseAreasError && <ResponseAreaError>{responseAreasError}</ResponseAreaError>}
449
+
450
+ <StyledTitle>Define Response</StyledTitle>
451
+
452
+ <StyledSelectContainer label="Response Template Equation Editor">
453
+ <StyledSelect
454
+ MenuProps={{ transitionDuration: { enter: 225, exit: 195 } }}
455
+ onChange={(event) => this.handleChange('equationEditor', event.target.value)}
456
+ value={equationEditor}
457
+ >
458
+ <MenuItem value="non-negative-integers">Numeric - Non-Negative Integers</MenuItem>
459
+ <MenuItem value="integers">Numeric - Integers</MenuItem>
460
+ <MenuItem value="decimals">Numeric - Decimals</MenuItem>
461
+ <MenuItem value="fractions">Numeric - Fractions</MenuItem>
462
+ <MenuItem value={1}>Grade 1 - 2</MenuItem>
463
+ <MenuItem value={3}>Grade 3 - 5</MenuItem>
464
+ <MenuItem value={6}>Grade 6 - 7</MenuItem>
465
+ <MenuItem value={8}>Grade 8 - HS</MenuItem>
466
+ <MenuItem value={'geometry'}>Geometry</MenuItem>
467
+ <MenuItem value={'advanced-algebra'}>Advanced Algebra</MenuItem>
468
+ <MenuItem value={'statistics'}>Statistics</MenuItem>
469
+ <MenuItem value={'item-authoring'}>Item Authoring</MenuItem>
470
+ </StyledSelect>
471
+ </StyledSelectContainer>
472
+
473
+ {Object.keys(responses || {}).map((responseKey, idx) => {
474
+ const response = responses[idx];
475
+
476
+ if (response) {
477
+ return (
478
+ <Response
479
+ key={idx}
480
+ responseKey={idx}
481
+ mode={equationEditor}
482
+ response={response}
483
+ onResponseChange={this.onResponseChange}
484
+ onResponseDone={this.onResponseDone}
485
+ index={idx}
486
+ cIgnoreOrder={cIgnoreOrder}
487
+ cAllowTrailingZeros={cAllowTrailingZeros}
488
+ error={responsesErrors && responsesErrors[idx]}
489
+ />
490
+ );
491
+ }
492
+
493
+ return null;
494
+ })}
495
+
496
+ {rationaleEnabled && (
497
+ <StyledInputContainer label={rationale.label}>
498
+ <StyledEditableHtml
499
+ markup={model.rationale || ''}
500
+ onChange={(value) => this.handleChange('rationale', value)}
501
+ imageSupport={imageSupport}
502
+ nonEmpty={false}
503
+ error={rationaleError}
504
+ toolbarOpts={toolbarOpts}
505
+ pluginProps={getPluginProps(rationale?.inputConfiguration, {
506
+ ...baseInputConfiguration,
507
+ math: {
508
+ controlledKeypadMode: false,
509
+ },
510
+ })}
511
+ spellCheck={spellCheckEnabled}
512
+ maxImageWidth={(maxImageWidth && maxImageWidth.rationale) || defaultImageMaxWidth}
513
+ maxImageHeight={(maxImageHeight && maxImageHeight.rationale) || defaultImageMaxHeight}
514
+ uploadSoundSupport={uploadSoundSupport}
515
+ languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}
516
+ mathMlOptions={mathMlOptions}
517
+ />
518
+ {rationaleError && <ErrorText>{rationaleError}</ErrorText>}
519
+ </StyledInputContainer>
520
+ )}
521
+ </layout.ConfigLayout>
522
+ );
523
+ }
524
+ }
525
+
526
+ export default Design;