@pie-element/ebsr 10.7.3-next.9 → 12.0.1-esmbeta.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 (284) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/configure/CHANGELOG.md +16 -0
  3. package/configure/node_modules/@pie-element/multiple-choice/CHANGELOG.json +1972 -0
  4. package/configure/node_modules/@pie-element/multiple-choice/CHANGELOG.md +4186 -0
  5. package/configure/node_modules/@pie-element/multiple-choice/LICENSE.md +5 -0
  6. package/configure/node_modules/@pie-element/multiple-choice/PRINT.md +35 -0
  7. package/configure/node_modules/@pie-element/multiple-choice/README.md +56 -0
  8. package/configure/node_modules/@pie-element/multiple-choice/choice.png +0 -0
  9. package/configure/node_modules/@pie-element/multiple-choice/configure/CHANGELOG.json +1387 -0
  10. package/configure/node_modules/@pie-element/multiple-choice/configure/CHANGELOG.md +3332 -0
  11. package/configure/node_modules/@pie-element/multiple-choice/configure/lib/defaults.js +202 -0
  12. package/configure/node_modules/@pie-element/multiple-choice/configure/lib/defaults.js.map +1 -0
  13. package/configure/node_modules/@pie-element/multiple-choice/configure/lib/index.js +248 -0
  14. package/configure/node_modules/@pie-element/multiple-choice/configure/lib/index.js.map +1 -0
  15. package/configure/node_modules/@pie-element/multiple-choice/configure/lib/main.js +597 -0
  16. package/configure/node_modules/@pie-element/multiple-choice/configure/lib/main.js.map +1 -0
  17. package/configure/node_modules/@pie-element/multiple-choice/configure/lib/utils.js +18 -0
  18. package/configure/node_modules/@pie-element/multiple-choice/configure/lib/utils.js.map +1 -0
  19. package/configure/node_modules/@pie-element/multiple-choice/configure/package.json +20 -0
  20. package/configure/node_modules/@pie-element/multiple-choice/controller/CHANGELOG.json +527 -0
  21. package/configure/node_modules/@pie-element/multiple-choice/controller/CHANGELOG.md +2297 -0
  22. package/configure/node_modules/@pie-element/multiple-choice/controller/lib/defaults.js +34 -0
  23. package/configure/node_modules/@pie-element/multiple-choice/controller/lib/defaults.js.map +1 -0
  24. package/configure/node_modules/@pie-element/multiple-choice/controller/lib/index.js +346 -0
  25. package/configure/node_modules/@pie-element/multiple-choice/controller/lib/index.js.map +1 -0
  26. package/configure/node_modules/@pie-element/multiple-choice/controller/lib/utils.js +28 -0
  27. package/configure/node_modules/@pie-element/multiple-choice/controller/lib/utils.js.map +1 -0
  28. package/configure/node_modules/@pie-element/multiple-choice/controller/package.json +15 -0
  29. package/configure/node_modules/@pie-element/multiple-choice/docs/config-schema.json +2993 -0
  30. package/configure/node_modules/@pie-element/multiple-choice/docs/config-schema.json.md +2217 -0
  31. package/configure/node_modules/@pie-element/multiple-choice/docs/demo/config.js +8 -0
  32. package/configure/node_modules/@pie-element/multiple-choice/docs/demo/generate.js +61 -0
  33. package/configure/node_modules/@pie-element/multiple-choice/docs/demo/index.html +1 -0
  34. package/configure/node_modules/@pie-element/multiple-choice/docs/demo/session.js +7 -0
  35. package/configure/node_modules/@pie-element/multiple-choice/docs/pie-schema.json +1332 -0
  36. package/configure/node_modules/@pie-element/multiple-choice/docs/pie-schema.json.md +1015 -0
  37. package/configure/node_modules/@pie-element/multiple-choice/esm/configure.css +847 -0
  38. package/configure/node_modules/@pie-element/multiple-choice/esm/configure.js +1218 -0
  39. package/configure/node_modules/@pie-element/multiple-choice/esm/configure.js.map +1 -0
  40. package/configure/node_modules/@pie-element/multiple-choice/esm/controller.css +847 -0
  41. package/configure/node_modules/@pie-element/multiple-choice/esm/controller.js +324 -0
  42. package/configure/node_modules/@pie-element/multiple-choice/esm/controller.js.map +1 -0
  43. package/configure/node_modules/@pie-element/multiple-choice/esm/element.css +847 -0
  44. package/configure/node_modules/@pie-element/multiple-choice/esm/element.js +3287 -0
  45. package/configure/node_modules/@pie-element/multiple-choice/esm/element.js.map +1 -0
  46. package/configure/node_modules/@pie-element/multiple-choice/esm/print.css +847 -0
  47. package/configure/node_modules/@pie-element/multiple-choice/esm/print.js +3017 -0
  48. package/configure/node_modules/@pie-element/multiple-choice/esm/print.js.map +1 -0
  49. package/configure/node_modules/@pie-element/multiple-choice/lib/choice-input.js +427 -0
  50. package/configure/node_modules/@pie-element/multiple-choice/lib/choice-input.js.map +1 -0
  51. package/configure/node_modules/@pie-element/multiple-choice/lib/choice.js +252 -0
  52. package/configure/node_modules/@pie-element/multiple-choice/lib/choice.js.map +1 -0
  53. package/configure/node_modules/@pie-element/multiple-choice/lib/feedback-tick.js +174 -0
  54. package/configure/node_modules/@pie-element/multiple-choice/lib/feedback-tick.js.map +1 -0
  55. package/configure/node_modules/@pie-element/multiple-choice/lib/index.js +388 -0
  56. package/configure/node_modules/@pie-element/multiple-choice/lib/index.js.map +1 -0
  57. package/configure/node_modules/@pie-element/multiple-choice/lib/main.js +108 -0
  58. package/configure/node_modules/@pie-element/multiple-choice/lib/main.js.map +1 -0
  59. package/configure/node_modules/@pie-element/multiple-choice/lib/multiple-choice.js +469 -0
  60. package/configure/node_modules/@pie-element/multiple-choice/lib/multiple-choice.js.map +1 -0
  61. package/configure/node_modules/@pie-element/multiple-choice/lib/print.js +129 -0
  62. package/configure/node_modules/@pie-element/multiple-choice/lib/print.js.map +1 -0
  63. package/configure/node_modules/@pie-element/multiple-choice/lib/session-updater.js +48 -0
  64. package/configure/node_modules/@pie-element/multiple-choice/lib/session-updater.js.map +1 -0
  65. package/configure/node_modules/@pie-element/multiple-choice/module/configure.js +1 -0
  66. package/configure/node_modules/@pie-element/multiple-choice/module/controller.js +3472 -0
  67. package/configure/node_modules/@pie-element/multiple-choice/module/demo.js +86 -0
  68. package/configure/node_modules/@pie-element/multiple-choice/module/element.js +1 -0
  69. package/configure/node_modules/@pie-element/multiple-choice/module/index.html +21 -0
  70. package/configure/node_modules/@pie-element/multiple-choice/module/index.js +2 -0
  71. package/configure/node_modules/@pie-element/multiple-choice/module/manifest.json +10 -0
  72. package/configure/node_modules/@pie-element/multiple-choice/module/print-demo.js +124 -0
  73. package/configure/node_modules/@pie-element/multiple-choice/module/print.html +18 -0
  74. package/configure/node_modules/@pie-element/multiple-choice/module/print.js +1 -0
  75. package/configure/node_modules/@pie-element/multiple-choice/package.json +53 -0
  76. package/configure/node_modules/@pie-lib/correct-answer-toggle/CHANGELOG.json +1 -0
  77. package/configure/node_modules/@pie-lib/correct-answer-toggle/CHANGELOG.md +898 -0
  78. package/configure/node_modules/@pie-lib/correct-answer-toggle/NEXT.CHANGELOG.json +1 -0
  79. package/configure/node_modules/@pie-lib/correct-answer-toggle/esm/index.js +262 -0
  80. package/configure/node_modules/@pie-lib/correct-answer-toggle/esm/index.js.map +1 -0
  81. package/configure/node_modules/@pie-lib/correct-answer-toggle/lib/expander.js +88 -0
  82. package/configure/node_modules/@pie-lib/correct-answer-toggle/lib/expander.js.map +1 -0
  83. package/configure/node_modules/@pie-lib/correct-answer-toggle/lib/index.js +181 -0
  84. package/configure/node_modules/@pie-lib/correct-answer-toggle/lib/index.js.map +1 -0
  85. package/configure/node_modules/@pie-lib/correct-answer-toggle/lib/styles.js +66 -0
  86. package/configure/node_modules/@pie-lib/correct-answer-toggle/lib/styles.js.map +1 -0
  87. package/configure/node_modules/@pie-lib/correct-answer-toggle/package.json +44 -0
  88. package/configure/node_modules/@pie-lib/correct-answer-toggle/src/__tests__/index.test.jsx +99 -0
  89. package/configure/node_modules/@pie-lib/correct-answer-toggle/src/expander.jsx +61 -0
  90. package/configure/node_modules/@pie-lib/correct-answer-toggle/src/index.jsx +98 -0
  91. package/configure/node_modules/@pie-lib/correct-answer-toggle/src/styles.js +61 -0
  92. package/configure/node_modules/@pie-lib/icons/CHANGELOG.json +1 -0
  93. package/configure/node_modules/@pie-lib/icons/CHANGELOG.md +539 -0
  94. package/configure/node_modules/@pie-lib/icons/NEXT.CHANGELOG.json +1 -0
  95. package/configure/node_modules/@pie-lib/icons/esm/index.js +1153 -0
  96. package/configure/node_modules/@pie-lib/icons/esm/index.js.map +1 -0
  97. package/configure/node_modules/@pie-lib/icons/lib/correct-icon.js +89 -0
  98. package/configure/node_modules/@pie-lib/icons/lib/correct-icon.js.map +1 -0
  99. package/configure/node_modules/@pie-lib/icons/lib/correct-response-icon.js +153 -0
  100. package/configure/node_modules/@pie-lib/icons/lib/correct-response-icon.js.map +1 -0
  101. package/configure/node_modules/@pie-lib/icons/lib/icon-base.js +206 -0
  102. package/configure/node_modules/@pie-lib/icons/lib/icon-base.js.map +1 -0
  103. package/configure/node_modules/@pie-lib/icons/lib/icon-root.js +130 -0
  104. package/configure/node_modules/@pie-lib/icons/lib/icon-root.js.map +1 -0
  105. package/configure/node_modules/@pie-lib/icons/lib/incorrect-icon.js +92 -0
  106. package/configure/node_modules/@pie-lib/icons/lib/incorrect-icon.js.map +1 -0
  107. package/configure/node_modules/@pie-lib/icons/lib/index.js +72 -0
  108. package/configure/node_modules/@pie-lib/icons/lib/index.js.map +1 -0
  109. package/configure/node_modules/@pie-lib/icons/lib/instructions-icon.js +229 -0
  110. package/configure/node_modules/@pie-lib/icons/lib/instructions-icon.js.map +1 -0
  111. package/configure/node_modules/@pie-lib/icons/lib/learn-more-icon.js +145 -0
  112. package/configure/node_modules/@pie-lib/icons/lib/learn-more-icon.js.map +1 -0
  113. package/configure/node_modules/@pie-lib/icons/lib/nothing-submitted-icon.js +183 -0
  114. package/configure/node_modules/@pie-lib/icons/lib/nothing-submitted-icon.js.map +1 -0
  115. package/configure/node_modules/@pie-lib/icons/lib/partially-correct-icon.js +82 -0
  116. package/configure/node_modules/@pie-lib/icons/lib/partially-correct-icon.js.map +1 -0
  117. package/configure/node_modules/@pie-lib/icons/lib/show-rationale-icon.js +206 -0
  118. package/configure/node_modules/@pie-lib/icons/lib/show-rationale-icon.js.map +1 -0
  119. package/configure/node_modules/@pie-lib/icons/lib/sized.js +41 -0
  120. package/configure/node_modules/@pie-lib/icons/lib/sized.js.map +1 -0
  121. package/configure/node_modules/@pie-lib/icons/package.json +35 -0
  122. package/configure/node_modules/@pie-lib/icons/src/__tests__/index.test.js +3 -0
  123. package/configure/node_modules/@pie-lib/icons/src/correct-icon.jsx +64 -0
  124. package/configure/node_modules/@pie-lib/icons/src/correct-response-icon.jsx +121 -0
  125. package/configure/node_modules/@pie-lib/icons/src/icon-base.jsx +158 -0
  126. package/configure/node_modules/@pie-lib/icons/src/icon-root.jsx +76 -0
  127. package/configure/node_modules/@pie-lib/icons/src/incorrect-icon.jsx +61 -0
  128. package/configure/node_modules/@pie-lib/icons/src/index.js +19 -0
  129. package/configure/node_modules/@pie-lib/icons/src/instructions-icon.jsx +189 -0
  130. package/configure/node_modules/@pie-lib/icons/src/learn-more-icon.jsx +107 -0
  131. package/configure/node_modules/@pie-lib/icons/src/nothing-submitted-icon.jsx +130 -0
  132. package/configure/node_modules/@pie-lib/icons/src/partially-correct-icon.jsx +49 -0
  133. package/configure/node_modules/@pie-lib/icons/src/show-rationale-icon.jsx +152 -0
  134. package/configure/node_modules/@pie-lib/icons/src/sized.jsx +25 -0
  135. package/configure/node_modules/@pie-lib/math-rendering/CHANGELOG.json +1 -0
  136. package/configure/node_modules/@pie-lib/math-rendering/CHANGELOG.md +775 -0
  137. package/configure/node_modules/@pie-lib/math-rendering/NEXT.CHANGELOG.json +1 -0
  138. package/configure/node_modules/@pie-lib/math-rendering/esm/index.js +690 -0
  139. package/configure/node_modules/@pie-lib/math-rendering/esm/index.js.map +1 -0
  140. package/configure/node_modules/@pie-lib/math-rendering/lib/index.js +38 -0
  141. package/configure/node_modules/@pie-lib/math-rendering/lib/index.js.map +1 -0
  142. package/configure/node_modules/@pie-lib/math-rendering/lib/mml-to-latex.js +15 -0
  143. package/configure/node_modules/@pie-lib/math-rendering/lib/mml-to-latex.js.map +1 -0
  144. package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/chtml.js +296 -0
  145. package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/chtml.js.map +1 -0
  146. package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/index.js +23 -0
  147. package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/index.js.map +1 -0
  148. package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/mml.js +109 -0
  149. package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/mml.js.map +1 -0
  150. package/configure/node_modules/@pie-lib/math-rendering/lib/normalization.js +95 -0
  151. package/configure/node_modules/@pie-lib/math-rendering/lib/normalization.js.map +1 -0
  152. package/configure/node_modules/@pie-lib/math-rendering/lib/render-math.js +438 -0
  153. package/configure/node_modules/@pie-lib/math-rendering/lib/render-math.js.map +1 -0
  154. package/configure/node_modules/@pie-lib/math-rendering/package.json +28 -0
  155. package/configure/node_modules/@pie-lib/math-rendering/src/__tests__/mml-to-latex.test.js +14 -0
  156. package/configure/node_modules/@pie-lib/math-rendering/src/__tests__/normalization.test.js +50 -0
  157. package/configure/node_modules/@pie-lib/math-rendering/src/__tests__/render-math.test.js +155 -0
  158. package/configure/node_modules/@pie-lib/math-rendering/src/index.js +5 -0
  159. package/configure/node_modules/@pie-lib/math-rendering/src/mml-to-latex.js +2 -0
  160. package/configure/node_modules/@pie-lib/math-rendering/src/mstack/__tests__/__snapshots__/chtml.test.js.snap +9 -0
  161. package/configure/node_modules/@pie-lib/math-rendering/src/mstack/__tests__/chtml.test.js +104 -0
  162. package/configure/node_modules/@pie-lib/math-rendering/src/mstack/chtml.js +220 -0
  163. package/configure/node_modules/@pie-lib/math-rendering/src/mstack/index.js +13 -0
  164. package/configure/node_modules/@pie-lib/math-rendering/src/mstack/mml.js +24 -0
  165. package/configure/node_modules/@pie-lib/math-rendering/src/normalization.js +69 -0
  166. package/configure/node_modules/@pie-lib/math-rendering/src/render-math.js +387 -0
  167. package/configure/node_modules/@pie-lib/render-ui/CHANGELOG.json +1 -0
  168. package/configure/node_modules/@pie-lib/render-ui/CHANGELOG.md +1026 -0
  169. package/configure/node_modules/@pie-lib/render-ui/NEXT.CHANGELOG.json +1 -0
  170. package/configure/node_modules/@pie-lib/render-ui/esm/index.js +1616 -0
  171. package/configure/node_modules/@pie-lib/render-ui/esm/index.js.map +1 -0
  172. package/configure/node_modules/@pie-lib/render-ui/lib/append-css-rules.js +88 -0
  173. package/configure/node_modules/@pie-lib/render-ui/lib/append-css-rules.js.map +1 -0
  174. package/configure/node_modules/@pie-lib/render-ui/lib/assets/enableAudioAutoplayImage.js +9 -0
  175. package/configure/node_modules/@pie-lib/render-ui/lib/assets/enableAudioAutoplayImage.js.map +1 -0
  176. package/configure/node_modules/@pie-lib/render-ui/lib/collapsible/index.js +135 -0
  177. package/configure/node_modules/@pie-lib/render-ui/lib/collapsible/index.js.map +1 -0
  178. package/configure/node_modules/@pie-lib/render-ui/lib/color.js +344 -0
  179. package/configure/node_modules/@pie-lib/render-ui/lib/color.js.map +1 -0
  180. package/configure/node_modules/@pie-lib/render-ui/lib/feedback.js +150 -0
  181. package/configure/node_modules/@pie-lib/render-ui/lib/feedback.js.map +1 -0
  182. package/configure/node_modules/@pie-lib/render-ui/lib/has-media.js +27 -0
  183. package/configure/node_modules/@pie-lib/render-ui/lib/has-media.js.map +1 -0
  184. package/configure/node_modules/@pie-lib/render-ui/lib/has-text.js +28 -0
  185. package/configure/node_modules/@pie-lib/render-ui/lib/has-text.js.map +1 -0
  186. package/configure/node_modules/@pie-lib/render-ui/lib/html-and-math.js +74 -0
  187. package/configure/node_modules/@pie-lib/render-ui/lib/html-and-math.js.map +1 -0
  188. package/configure/node_modules/@pie-lib/render-ui/lib/index.js +136 -0
  189. package/configure/node_modules/@pie-lib/render-ui/lib/index.js.map +1 -0
  190. package/configure/node_modules/@pie-lib/render-ui/lib/input-container.js +60 -0
  191. package/configure/node_modules/@pie-lib/render-ui/lib/input-container.js.map +1 -0
  192. package/configure/node_modules/@pie-lib/render-ui/lib/preview-layout.js +145 -0
  193. package/configure/node_modules/@pie-lib/render-ui/lib/preview-layout.js.map +1 -0
  194. package/configure/node_modules/@pie-lib/render-ui/lib/preview-prompt.js +321 -0
  195. package/configure/node_modules/@pie-lib/render-ui/lib/preview-prompt.js.map +1 -0
  196. package/configure/node_modules/@pie-lib/render-ui/lib/purpose.js +28 -0
  197. package/configure/node_modules/@pie-lib/render-ui/lib/purpose.js.map +1 -0
  198. package/configure/node_modules/@pie-lib/render-ui/lib/readable.js +28 -0
  199. package/configure/node_modules/@pie-lib/render-ui/lib/readable.js.map +1 -0
  200. package/configure/node_modules/@pie-lib/render-ui/lib/response-indicators.js +151 -0
  201. package/configure/node_modules/@pie-lib/render-ui/lib/response-indicators.js.map +1 -0
  202. package/configure/node_modules/@pie-lib/render-ui/lib/ui-layout.js +122 -0
  203. package/configure/node_modules/@pie-lib/render-ui/lib/ui-layout.js.map +1 -0
  204. package/configure/node_modules/@pie-lib/render-ui/lib/withUndoReset.js +181 -0
  205. package/configure/node_modules/@pie-lib/render-ui/lib/withUndoReset.js.map +1 -0
  206. package/configure/node_modules/@pie-lib/render-ui/package.json +40 -0
  207. package/configure/node_modules/@pie-lib/render-ui/src/__tests__/__snapshots__/html-and-math.test.js.snap +11 -0
  208. package/configure/node_modules/@pie-lib/render-ui/src/__tests__/__snapshots__/preview-prompt.test.jsx.snap +37 -0
  209. package/configure/node_modules/@pie-lib/render-ui/src/__tests__/__snapshots__/purpose.test.jsx.snap +42 -0
  210. package/configure/node_modules/@pie-lib/render-ui/src/__tests__/__snapshots__/readable.test.jsx.snap +64 -0
  211. package/configure/node_modules/@pie-lib/render-ui/src/__tests__/__snapshots__/response-indicators.test.jsx.snap +27 -0
  212. package/configure/node_modules/@pie-lib/render-ui/src/__tests__/color.test.js +12 -0
  213. package/configure/node_modules/@pie-lib/render-ui/src/__tests__/has-media.test.js +20 -0
  214. package/configure/node_modules/@pie-lib/render-ui/src/__tests__/has-text.test.js +21 -0
  215. package/configure/node_modules/@pie-lib/render-ui/src/__tests__/html-and-math.test.js +24 -0
  216. package/configure/node_modules/@pie-lib/render-ui/src/__tests__/preview-prompt.test.jsx +56 -0
  217. package/configure/node_modules/@pie-lib/render-ui/src/__tests__/purpose.test.jsx +47 -0
  218. package/configure/node_modules/@pie-lib/render-ui/src/__tests__/readable.test.jsx +64 -0
  219. package/configure/node_modules/@pie-lib/render-ui/src/__tests__/response-indicators.test.jsx +16 -0
  220. package/configure/node_modules/@pie-lib/render-ui/src/__tests__/ui-layout.test.jsx +34 -0
  221. package/configure/node_modules/@pie-lib/render-ui/src/__tests__/withUndoReset.test.jsx +254 -0
  222. package/configure/node_modules/@pie-lib/render-ui/src/append-css-rules.js +51 -0
  223. package/configure/node_modules/@pie-lib/render-ui/src/assets/enableAudioAutoplayImage.js +1 -0
  224. package/configure/node_modules/@pie-lib/render-ui/src/collapsible/__tests__/__snapshots__/index.test.jsx.snap +18 -0
  225. package/configure/node_modules/@pie-lib/render-ui/src/collapsible/__tests__/index.test.jsx +13 -0
  226. package/configure/node_modules/@pie-lib/render-ui/src/collapsible/index.jsx +64 -0
  227. package/configure/node_modules/@pie-lib/render-ui/src/color.js +121 -0
  228. package/configure/node_modules/@pie-lib/render-ui/src/feedback.jsx +99 -0
  229. package/configure/node_modules/@pie-lib/render-ui/src/has-media.js +16 -0
  230. package/configure/node_modules/@pie-lib/render-ui/src/has-text.js +18 -0
  231. package/configure/node_modules/@pie-lib/render-ui/src/html-and-math.js +21 -0
  232. package/configure/node_modules/@pie-lib/render-ui/src/index.js +35 -0
  233. package/configure/node_modules/@pie-lib/render-ui/src/input-container.jsx +41 -0
  234. package/configure/node_modules/@pie-lib/render-ui/src/preview-layout.jsx +95 -0
  235. package/configure/node_modules/@pie-lib/render-ui/src/preview-prompt.jsx +254 -0
  236. package/configure/node_modules/@pie-lib/render-ui/src/purpose.jsx +17 -0
  237. package/configure/node_modules/@pie-lib/render-ui/src/readable.jsx +19 -0
  238. package/configure/node_modules/@pie-lib/render-ui/src/response-indicators.jsx +89 -0
  239. package/configure/node_modules/@pie-lib/render-ui/src/ui-layout.jsx +66 -0
  240. package/configure/node_modules/@pie-lib/render-ui/src/withUndoReset.jsx +116 -0
  241. package/configure/node_modules/@pie-lib/test-utils/CHANGELOG.json +1 -0
  242. package/configure/node_modules/@pie-lib/test-utils/CHANGELOG.md +410 -0
  243. package/configure/node_modules/@pie-lib/test-utils/NEXT.CHANGELOG.json +1 -0
  244. package/configure/node_modules/@pie-lib/test-utils/esm/index.js +39 -0
  245. package/configure/node_modules/@pie-lib/test-utils/esm/index.js.map +1 -0
  246. package/configure/node_modules/@pie-lib/test-utils/lib/index.js +40 -0
  247. package/configure/node_modules/@pie-lib/test-utils/lib/index.js.map +1 -0
  248. package/configure/node_modules/@pie-lib/test-utils/package.json +25 -0
  249. package/configure/node_modules/@pie-lib/test-utils/src/__tests__/index.test.js +45 -0
  250. package/configure/node_modules/@pie-lib/test-utils/src/index.js +18 -0
  251. package/configure/node_modules/@pie-lib/translator/CHANGELOG.json +1 -0
  252. package/configure/node_modules/@pie-lib/translator/CHANGELOG.md +282 -0
  253. package/configure/node_modules/@pie-lib/translator/NEXT.CHANGELOG.json +1 -0
  254. package/configure/node_modules/@pie-lib/translator/esm/index.js +257 -0
  255. package/configure/node_modules/@pie-lib/translator/esm/index.js.map +1 -0
  256. package/configure/node_modules/@pie-lib/translator/lib/en.js +102 -0
  257. package/configure/node_modules/@pie-lib/translator/lib/en.js.map +1 -0
  258. package/configure/node_modules/@pie-lib/translator/lib/es.js +102 -0
  259. package/configure/node_modules/@pie-lib/translator/lib/es.js.map +1 -0
  260. package/configure/node_modules/@pie-lib/translator/lib/index.js +69 -0
  261. package/configure/node_modules/@pie-lib/translator/lib/index.js.map +1 -0
  262. package/configure/node_modules/@pie-lib/translator/package.json +25 -0
  263. package/configure/node_modules/@pie-lib/translator/src/en.js +99 -0
  264. package/configure/node_modules/@pie-lib/translator/src/es.js +99 -0
  265. package/configure/node_modules/@pie-lib/translator/src/index.js +43 -0
  266. package/configure/package.json +3 -3
  267. package/controller/CHANGELOG.md +16 -0
  268. package/controller/package.json +3 -3
  269. package/esm/configure.js +38602 -0
  270. package/esm/configure.js.map +1 -0
  271. package/esm/controller.js +3358 -0
  272. package/esm/controller.js.map +1 -0
  273. package/esm/element.js +2203 -0
  274. package/esm/element.js.map +1 -0
  275. package/esm/package.json +4 -0
  276. package/esm/print.js +4090 -0
  277. package/esm/print.js.map +1 -0
  278. package/module/controller.js +4973 -2252
  279. package/module/element.js +1 -1
  280. package/module/index.html +1 -1
  281. package/module/manifest.json +1 -1
  282. package/module/print.html +1 -1
  283. package/module/print.js +1 -1
  284. package/package.json +24 -6
@@ -0,0 +1,50 @@
1
+ import React from 'react';
2
+ import debug from 'debug';
3
+ import { BracketTypes, wrapMath, unWrapMath } from '../normalization';
4
+
5
+ const log = debug('@pie-lib:math-rendering:test:normalization');
6
+
7
+ describe('normalization', () => {
8
+ describe('unWrapMath', () => {
9
+ const assertUnWrap = (html, expected, wrapType) => {
10
+ it(`innerHTML: ${html} is unWrapped to: ${expected} with wrapType: ${wrapType}`, () => {
11
+ const out = unWrapMath(html);
12
+
13
+ expect(out).toEqual({
14
+ unwrapped: expected,
15
+ wrapType: wrapType,
16
+ });
17
+ });
18
+ };
19
+
20
+ assertUnWrap('$$<$$', '<', BracketTypes.DOLLAR);
21
+ assertUnWrap('$<$', '<', BracketTypes.DOLLAR);
22
+ assertUnWrap('\\(<\\)', '<', BracketTypes.ROUND_BRACKETS);
23
+ assertUnWrap('\\[<\\]', '<', BracketTypes.ROUND_BRACKETS);
24
+ assertUnWrap('latex', 'latex', BracketTypes.ROUND_BRACKETS);
25
+ assertUnWrap('\\displaystyle foo', 'foo', BracketTypes.ROUND_BRACKETS);
26
+ });
27
+
28
+ describe('wrapMath', () => {
29
+ const assertWrap = (latex, expectedHtml, wrapper) => {
30
+ wrapper = wrapper || BracketTypes.ROUND_BRACKETS;
31
+ it(`${latex} is wrapped to: ${expectedHtml}`, () => {
32
+ const out = wrapMath(latex, wrapper);
33
+
34
+ log('out: ', out);
35
+
36
+ expect(out).toEqual(expectedHtml);
37
+ });
38
+ };
39
+
40
+ assertWrap('latex', '\\(latex\\)', BracketTypes.ROUND_BRACKETS);
41
+ assertWrap('latex', '\\(latex\\)', BracketTypes.SQUARE_BRACKETS);
42
+ assertWrap('latex', '$latex$', BracketTypes.DOLLAR);
43
+ assertWrap('latex', '$latex$', BracketTypes.DOUBLE_DOLLAR);
44
+
45
+ /**
46
+ * Note that when this is converted to html it get's escaped - but that's an issue with the slate html-serializer.
47
+ */
48
+ assertWrap('<', '\\(<\\)');
49
+ });
50
+ });
@@ -0,0 +1,155 @@
1
+ import React from 'react';
2
+ import { mount } from 'enzyme';
3
+ import renderMath, { fixMathElement } from '../render-math';
4
+ import _ from 'lodash';
5
+
6
+ jest.mock(
7
+ 'mathjax-full/js/mathjax',
8
+ () => ({
9
+ mathjax: {
10
+ document: jest.fn().mockReturnThis(),
11
+ findMath: jest.fn().mockReturnThis(),
12
+ compile: jest.fn().mockReturnThis(),
13
+ getMetrics: jest.fn().mockReturnThis(),
14
+ typeset: jest.fn().mockReturnThis(),
15
+ updateDocument: jest.fn().mockReturnThis(),
16
+ clear: jest.fn().mockReturnThis(),
17
+ handlers: {
18
+ handlesDocument: jest.fn().mockReturnThis(),
19
+ },
20
+ handleRetriesFor: jest.fn().mockImplementation((callback) => callback()),
21
+ },
22
+ }),
23
+ {
24
+ virtual: false,
25
+ },
26
+ );
27
+
28
+ jest.mock('mathjax-full/js/input/mathml', () => {
29
+ const mock = jest.fn().mockReturnThis();
30
+ mock.setMmlFactory = jest.fn();
31
+ return {
32
+ MathML: () => mock,
33
+ };
34
+ });
35
+
36
+ jest.mock('mathjax-full/js/input/tex', () => ({
37
+ TeX: jest.fn(),
38
+ }));
39
+ jest.mock('mathjax-full/js/core/MmlTree/MmlFactory', () => {
40
+ const instance = {
41
+ setMmlFactory: jest.fn(),
42
+ defaultNodes: {},
43
+ };
44
+ return {
45
+ MmlFactory: () => instance,
46
+ };
47
+ });
48
+
49
+ const mockMathInstance = {
50
+ document: jest.fn().mockReturnThis(),
51
+ findMath: jest.fn().mockReturnThis(),
52
+ compile: jest.fn().mockReturnThis(),
53
+ enrich: jest.fn().mockReturnThis(),
54
+ addMenu: jest.fn().mockReturnThis(),
55
+ attachSpeech: jest.fn().mockReturnThis(),
56
+ assistiveMml: jest.fn().mockReturnThis(),
57
+ getMetrics: jest.fn().mockReturnThis(),
58
+ typeset: jest.fn().mockReturnThis(),
59
+ updateDocument: jest.fn().mockReturnValue({
60
+ math: {
61
+ list: undefined,
62
+ },
63
+ clear: jest.fn().mockReturnThis(),
64
+ }),
65
+ clear: jest.fn().mockReturnThis(),
66
+ handlers: {
67
+ handlesDocument: jest.fn().mockReturnThis(),
68
+ },
69
+ handleRetriesFor: jest.fn().mockImplementation((callback) => callback()),
70
+ };
71
+
72
+ const mockHtml = {
73
+ findMath: jest.fn().mockReturnValue(mockMathInstance),
74
+ };
75
+
76
+ const mockEnrichHandlerInstance = {
77
+ create: jest.fn().mockImplementation(() => mockHtml),
78
+ };
79
+
80
+ jest.mock('mathjax-full/js/a11y/semantic-enrich', () => {
81
+ return {
82
+ EnrichHandler: () => mockEnrichHandlerInstance,
83
+ };
84
+ });
85
+
86
+ jest.mock('mathjax-full/js/a11y/assistive-mml', () => {
87
+ return {
88
+ AssistiveMmlHandler: () => {},
89
+ };
90
+ });
91
+
92
+ jest.mock('mathjax-full/js/ui/menu/MenuHandler', () => {
93
+ return {
94
+ MenuHandler: () => {},
95
+ };
96
+ });
97
+
98
+ jest.mock('mathjax-full/js/output/chtml', () => ({
99
+ CHTML: jest.fn(),
100
+ }));
101
+
102
+ jest.mock('mathjax-full/js/adaptors/browserAdaptor', () => ({
103
+ browserAdaptor: jest.fn(),
104
+ }));
105
+
106
+ jest.mock('mathjax-full/js/handlers/html', () => ({
107
+ RegisterHTMLHandler: jest.fn(),
108
+ }));
109
+
110
+ jest.mock('mathjax-full/js/core/MmlTree/SerializedMmlVisitor', () => ({
111
+ SerializedMmlVisitor: jest.fn(),
112
+ }));
113
+
114
+ describe('render-math', () => {
115
+ it('calls classFactory.create once', () => {
116
+ const div = document.createElement('div');
117
+
118
+ _.times(10).forEach((i) => renderMath(div));
119
+
120
+ expect(mockEnrichHandlerInstance.create).toHaveBeenCalledTimes(1);
121
+ });
122
+
123
+ it('calls MathJax render', () => {
124
+ const div = document.createElement('div');
125
+
126
+ renderMath(div);
127
+ expect(mockEnrichHandlerInstance.create).toHaveBeenCalledTimes(1);
128
+ expect(mockHtml.findMath).toHaveBeenCalledWith({ elements: [div] });
129
+ });
130
+
131
+ it('call render math for an array of elements', () => {
132
+ const divOne = document.createElement('div');
133
+ const divTwo = document.createElement('div');
134
+
135
+ renderMath([divOne, divTwo]);
136
+
137
+ expect(mockEnrichHandlerInstance.create).toHaveBeenCalledTimes(1);
138
+ expect(mockHtml.findMath).toHaveBeenCalledWith({
139
+ elements: [divOne, divTwo],
140
+ });
141
+ });
142
+
143
+ it('wraps the math containing element the right way', () => {
144
+ const wrapper = mount(
145
+ <div>
146
+ <span data-latex="">{'420\\text{ cm}=4.2\\text{ meters}'}</span>
147
+ </div>,
148
+ );
149
+ const spanElem = wrapper.instance();
150
+
151
+ fixMathElement(spanElem);
152
+
153
+ expect(spanElem.textContent).toEqual('\\(420\\text{ cm}=4.2\\text{ meters}\\)');
154
+ });
155
+ });
@@ -0,0 +1,5 @@
1
+ import renderMath from './render-math';
2
+ import mmlToLatex from './mml-to-latex';
3
+ import { wrapMath, unWrapMath } from './normalization';
4
+
5
+ export { renderMath, wrapMath, unWrapMath, mmlToLatex };
@@ -0,0 +1,2 @@
1
+ import { MathMLToLaTeX } from '@pie-framework/mathml-to-latex';
2
+ export default (mathml) => MathMLToLaTeX.convert(mathml);
@@ -0,0 +1,9 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`chtml implicit one row 1`] = `"<table><tr><td></td><td>1</td></tr></table>"`;
4
+
5
+ exports[`chtml one row 1`] = `"<table><tr><td></td><td>1</td></tr></table>"`;
6
+
7
+ exports[`chtml two rows 1`] = `"<table><tr><td></td><td>1</td></tr><tr><td></td><td>2</td></tr></table>"`;
8
+
9
+ exports[`chtml two rows with operator 1`] = `"<table><tr><td></td><td>1</td></tr><tr><td class=\\"inner\\">mo:+</td><td>2</td></tr></table>"`;
@@ -0,0 +1,104 @@
1
+ import { getStackData, Line, Row, CHTMLmstack } from '../chtml';
2
+ // import { CHTMLWrapper, instance } from 'mathjax-full/js/output/chtml/Wrapper';
3
+ import { JSDOM } from 'jsdom';
4
+
5
+ jest.mock('mathjax-full/js/output/chtml/Wrapper', () => {
6
+ const instance = {
7
+ adaptor: {
8
+ document: {
9
+ createElement: jest.fn(),
10
+ },
11
+ },
12
+ standardCHTMLnode: jest.fn(),
13
+ };
14
+
15
+ return {
16
+ instance,
17
+ CHTMLWrapper: class {
18
+ constructor() {
19
+ this.adaptor = { document: { createElement: jest.fn() } };
20
+ this.document = {};
21
+ // return instance;
22
+ }
23
+ },
24
+ };
25
+ });
26
+
27
+ const node = (kind, extras) => ({ kind, childNodes: [], ...extras });
28
+
29
+ const textNode = (text) => node('text', { text, node: { kind: 'text', text } });
30
+ const mn = (text) => node('mn', { childNodes: [textNode(text)] });
31
+ const mo = (text) =>
32
+ node('mo', {
33
+ childNodes: [textNode(text)],
34
+ });
35
+
36
+ const mco = (text) => ({
37
+ ...mo(text),
38
+
39
+ toCHTML: (n) => {
40
+ const t = `mo:${text}`;
41
+ n.textContent = t;
42
+ },
43
+ });
44
+
45
+ const msrow = (...childNodes) => node('msrow', { childNodes });
46
+ const mstack = (...rows) => node('mstack', { childNodes: rows });
47
+ const msline = () => node('msline');
48
+ describe('getStackData', () => {
49
+ it.each`
50
+ input | expected
51
+ ${mstack(msrow(mo('+'), mn('111')))} | ${[new Row(['1', '1', '1'], mo('+'))]}
52
+ ${mstack(msrow(mn('111')))} | ${[new Row(['1', '1', '1'])]}
53
+ ${mstack(msrow(mn('1'), mn('1')))} | ${[new Row(['1', '1'])]}
54
+ ${mstack(msrow(mn('1')), mn('1'))} | ${[new Row(['1']), new Row(['1'])]}
55
+ ${mstack(msline())} | ${[new Line()]}
56
+ ${mstack(mn('1'), msline(), msrow(mo('+'), mn('1')))} | ${[new Row(['1']), new Line(), new Row(['1'], mo('+'))]}
57
+ ${mstack(mn('1'), mn('1'))} | ${[new Row(['1']), new Row(['1'])]}
58
+ `('$input => $expected', ({ input, expected }) => {
59
+ const d = getStackData(input);
60
+ // console.log('d:', d);
61
+ // console.log('e:', expected);
62
+ expect({ ...d }).toEqual({ ...expected });
63
+ });
64
+ });
65
+
66
+ describe('Row', () => {
67
+ describe('pad', () => {
68
+ it.each`
69
+ cols | count | expected
70
+ ${[]} | ${0} | ${[]}
71
+ ${[1]} | ${1} | ${[1]}
72
+ ${[1]} | ${2} | ${['__pad__', 1]}
73
+ ${[1]} | ${3} | ${['__pad__', '__pad__', 1]}
74
+ `('pads to the right', ({ cols, count, expected }) => {
75
+ const r = new Row(cols);
76
+ const p = r.pad(count, 'right');
77
+ expect(p).toEqual(expected);
78
+ });
79
+ });
80
+ });
81
+
82
+ describe.each`
83
+ label | tree
84
+ ${'one row'} | ${[msrow(mn('1'))]}
85
+ ${'implicit one row'} | ${[mn('1')]}
86
+ ${'two rows'} | ${[msrow(mn('1')), msrow(mn('2'))]}
87
+ ${'two rows with operator'} | ${[msrow(mn('1')), msrow(mco('+'), mn('2'))]}
88
+ `('chtml', ({ label, tree }) => {
89
+ let html;
90
+
91
+ beforeEach(() => {
92
+ const chtml = new CHTMLmstack({}, {});
93
+ const dom = new JSDOM(`<!DOCTYPE html><body></body>`);
94
+ chtml.standardCHTMLnode = (parent) => parent;
95
+ chtml.ce = dom.window.document.createElement.bind(dom.window.document);
96
+ chtml.childNodes = tree;
97
+ chtml.toCHTML(dom.window.document.body);
98
+ html = dom.window.document.body.innerHTML;
99
+ });
100
+
101
+ it(label, () => {
102
+ expect(html).toMatchSnapshot();
103
+ });
104
+ });
@@ -0,0 +1,220 @@
1
+ import { CHTMLWrapper } from 'mathjax-full/js/output/chtml/Wrapper';
2
+ import _ from 'lodash';
3
+
4
+ const reduceText = (acc, n) => {
5
+ if (n.node && n.node.kind === 'text') {
6
+ acc += n.node.text;
7
+ }
8
+ return acc;
9
+ };
10
+
11
+ export class Line {
12
+ constructor() {
13
+ this.kind = 'line';
14
+ }
15
+
16
+ get columns() {
17
+ return [];
18
+ }
19
+ }
20
+
21
+ export class Row {
22
+ constructor(columns, operator) {
23
+ this.kind = 'row';
24
+ this.operator = operator;
25
+ this.columns = columns;
26
+ }
27
+
28
+ pad(count, direction = 'right') {
29
+ if (count < this.columns.length) {
30
+ throw new Error('no');
31
+ }
32
+
33
+ const diff = count - this.columns.length;
34
+
35
+ const padding = _.times(diff).map(() => '__pad__');
36
+ return direction === 'right' ? [...padding, ...this.columns] : [...this.columns, ...padding];
37
+ }
38
+ }
39
+
40
+ const mathNodeToCharArray = (mn) => {
41
+ const text = mn.childNodes.reduce(reduceText, '');
42
+ return text.split('');
43
+ };
44
+
45
+ /**
46
+ * Convert child a column entry
47
+ * @param {*} child
48
+ * @return an array of column content
49
+ */
50
+ const toColumnArray = (child) => {
51
+ if (!child || !child.kind) {
52
+ return [];
53
+ }
54
+
55
+ if (child.kind === 'msrow') {
56
+ throw new Error('msrow in msrow?');
57
+ }
58
+
59
+ if (child.kind === 'mo') {
60
+ // We are going to treat this operator as a text array.
61
+ // It's probably going to be a decimal point
62
+ // eslint-disable-next-line no-console
63
+ console.warn('mo that is not 1st node in msrow?');
64
+ return mathNodeToCharArray(child);
65
+ // throw new Error('mo must be first child of msrow');
66
+ }
67
+
68
+ if (child.kind === 'mn') {
69
+ return mathNodeToCharArray(child);
70
+ }
71
+
72
+ if (child.toCHTML) {
73
+ return child;
74
+ }
75
+ };
76
+
77
+ /**
78
+ * convert mstack chtml childNodes into a Row
79
+ * @param child chtml child node of mstack
80
+ * @return Row | Line
81
+ */
82
+ const rowStack = (child) => {
83
+ if (!child || !child.kind) {
84
+ return;
85
+ }
86
+
87
+ if (child.kind === 'msrow') {
88
+ if (!child.childNodes || child.childNodes.length === 0) {
89
+ return new Row([]);
90
+ }
91
+ const f = _.first(child.childNodes);
92
+ const nodes = f && f.kind === 'mo' ? _.tail(child.childNodes) : child.childNodes;
93
+
94
+ const columns = _.flatten(nodes.map(toColumnArray));
95
+
96
+ return new Row(columns, f.kind === 'mo' ? f : undefined);
97
+ }
98
+
99
+ if (child.kind === 'mn') {
100
+ const columns = mathNodeToCharArray(child);
101
+ return new Row(columns, undefined);
102
+ }
103
+
104
+ if (child.kind === 'mo') {
105
+ // eslint-disable-next-line no-console
106
+ console.warn('mo on its own row?');
107
+ return new Row([], child);
108
+ }
109
+
110
+ if (child.kind === 'msline') {
111
+ return new Line();
112
+ }
113
+
114
+ if (child.toCHTML) {
115
+ return new Row([child]);
116
+ }
117
+ };
118
+
119
+ /** convert MathJax chtml tree to Row[]
120
+ * @param mstack the root of the mathjax chtml tree
121
+ * @return Row[]
122
+ */
123
+
124
+ export const getStackData = (mstack) => {
125
+ if (!mstack || !mstack.childNodes) {
126
+ return [];
127
+ }
128
+ return _.compact(mstack.childNodes.map(rowStack));
129
+ };
130
+
131
+ export class CHTMLmstack extends CHTMLWrapper {
132
+ constructor(factory, node, parent = null) {
133
+ super(factory, node, parent);
134
+
135
+ this.ce = this.adaptor.document.createElement.bind(this.adaptor.document);
136
+ }
137
+
138
+ toCHTML(parent) {
139
+ const chtml = this.standardCHTMLnode(parent);
140
+
141
+ const stackData = getStackData(this);
142
+
143
+ // console.log('stackData', stackData);
144
+ const maxCols = stackData.reduce((acc, r) => {
145
+ if (r && r.columns.length > acc) {
146
+ acc = r.columns.length;
147
+ }
148
+ return acc;
149
+ }, 0);
150
+
151
+ const table = this.ce('table');
152
+ chtml.appendChild(table);
153
+
154
+ stackData.forEach((row) => {
155
+ const tr = this.ce('tr');
156
+ table.appendChild(tr);
157
+
158
+ if (row.kind === 'row') {
159
+ const td = this.ce('td');
160
+ tr.appendChild(td);
161
+ if (row.operator && row.operator.toCHTML) {
162
+ td.setAttribute('class', 'inner');
163
+ row.operator.toCHTML(td);
164
+ } else {
165
+ td.textContent = '';
166
+ }
167
+
168
+ // align right for now:
169
+ const cols = row.pad(maxCols, 'right');
170
+ cols.forEach((c) => {
171
+ const t = this.ce('td');
172
+ tr.appendChild(t);
173
+ if (c === '__pad__') {
174
+ t.textContent = '';
175
+ } else if (typeof c === 'string') {
176
+ t.textContent = c;
177
+ } else if (c.kind === 'none') {
178
+ t.textContent = '';
179
+ } else if (c.toCHTML) {
180
+ t.setAttribute('class', 'inner');
181
+ c.toCHTML(t);
182
+ }
183
+ });
184
+ } else if (row.kind === 'line') {
185
+ const td = this.ce('td');
186
+ tr.appendChild(td);
187
+ td.setAttribute('colspan', maxCols + 1);
188
+ td.setAttribute('class', 'mjx-line');
189
+ td.textContent = '';
190
+ }
191
+ });
192
+ }
193
+ }
194
+ CHTMLmstack.styles = {
195
+ 'mjx-mstack > table': {
196
+ 'line-height': 'initial',
197
+ border: 'solid 0px red',
198
+ 'border-spacing': '0em',
199
+ 'border-collapse': 'separate',
200
+ },
201
+ 'mjx-mstack > table > tr': {
202
+ 'line-height': 'initial',
203
+ },
204
+ 'mjx-mstack > table > tr > td': {
205
+ // padding: '1.2rem',
206
+ border: 'solid 0px blue',
207
+ 'font-family': 'sans-serif',
208
+ 'line-height': 'initial',
209
+ },
210
+ 'mjx-mstack > table > tr > td.inner': {
211
+ 'font-family': 'inherit',
212
+ },
213
+ 'mjx-mstack > table > tr > .mjx-line': {
214
+ padding: 0,
215
+ 'border-top': 'solid 1px black',
216
+ },
217
+ '.TEX-A': {
218
+ 'font-family': 'MJXZERO, MJXTEX !important',
219
+ },
220
+ };
@@ -0,0 +1,13 @@
1
+ import { CHTMLmstack } from './chtml';
2
+ import { MmlNone, MmlMsline, MmlMstack, MmlMsrow } from './mml';
3
+
4
+ export const chtmlNodes = {
5
+ mstack: CHTMLmstack,
6
+ };
7
+
8
+ export const mmlNodes = {
9
+ mstack: MmlMstack,
10
+ msline: MmlMsline,
11
+ msrow: MmlMsrow,
12
+ none: MmlNone,
13
+ };
@@ -0,0 +1,24 @@
1
+ import { AbstractMmlNode } from 'mathjax-full/js/core/MmlTree/MmlNode';
2
+
3
+ export class MmlNone extends AbstractMmlNode {
4
+ get kind() {
5
+ return 'none';
6
+ }
7
+ }
8
+
9
+ export class MmlMstack extends AbstractMmlNode {
10
+ get kind() {
11
+ return 'mstack';
12
+ }
13
+ }
14
+
15
+ export class MmlMsrow extends AbstractMmlNode {
16
+ get kind() {
17
+ return 'msrow';
18
+ }
19
+ }
20
+ export class MmlMsline extends AbstractMmlNode {
21
+ get kind() {
22
+ return 'msline';
23
+ }
24
+ }
@@ -0,0 +1,69 @@
1
+ export const BracketTypes = {};
2
+
3
+ BracketTypes.ROUND_BRACKETS = 'round_brackets';
4
+ BracketTypes.SQUARE_BRACKETS = 'square_brackets';
5
+ BracketTypes.DOLLAR = 'dollar';
6
+ BracketTypes.DOUBLE_DOLLAR = 'double_dollar';
7
+
8
+ const PAIRS = {
9
+ [BracketTypes.ROUND_BRACKETS]: ['\\(', '\\)'],
10
+ [BracketTypes.SQUARE_BRACKETS]: ['\\[', '\\]'],
11
+ [BracketTypes.DOLLAR]: ['$', '$'],
12
+ [BracketTypes.DOUBLE_DOLLAR]: ['$$', '$$'],
13
+ };
14
+
15
+ export const wrapMath = (content, wrapType) => {
16
+ if (wrapType === BracketTypes.SQUARE_BRACKETS) {
17
+ console.warn('\\[...\\] is not supported yet'); // eslint-disable-line
18
+ wrapType = BracketTypes.ROUND_BRACKETS;
19
+ }
20
+ if (wrapType === BracketTypes.DOUBLE_DOLLAR) {
21
+ console.warn('$$...$$ is not supported yet'); // eslint-disable-line
22
+ wrapType = BracketTypes.DOLLAR;
23
+ }
24
+
25
+ const [start, end] = PAIRS[wrapType] || PAIRS[BracketTypes.ROUND_BRACKETS];
26
+ return `${start}${content}${end}`;
27
+ };
28
+
29
+ export const unWrapMath = (content) => {
30
+ const displayStyleIndex = content.indexOf('\\displaystyle');
31
+ if (displayStyleIndex !== -1) {
32
+ console.warn('\\displaystyle is not supported - removing'); // eslint-disable-line
33
+ content = content.replace('\\displaystyle', '').trim();
34
+ }
35
+
36
+ if (content.startsWith('$$') && content.endsWith('$$')) {
37
+ console.warn('$$ syntax is not yet supported'); // eslint-disable-line
38
+ return {
39
+ unwrapped: content.substring(2, content.length - 2),
40
+ wrapType: BracketTypes.DOLLAR,
41
+ };
42
+ }
43
+ if (content.startsWith('$') && content.endsWith('$')) {
44
+ return {
45
+ unwrapped: content.substring(1, content.length - 1),
46
+ wrapType: BracketTypes.DOLLAR,
47
+ };
48
+ }
49
+
50
+ if (content.startsWith('\\[') && content.endsWith('\\]')) {
51
+ console.warn('\\[..\\] syntax is not yet supported'); // eslint-disable-line
52
+ return {
53
+ unwrapped: content.substring(2, content.length - 2),
54
+ wrapType: BracketTypes.ROUND_BRACKETS,
55
+ };
56
+ }
57
+
58
+ if (content.startsWith('\\(') && content.endsWith('\\)')) {
59
+ return {
60
+ unwrapped: content.substring(2, content.length - 2),
61
+ wrapType: BracketTypes.ROUND_BRACKETS,
62
+ };
63
+ }
64
+
65
+ return {
66
+ unwrapped: content,
67
+ wrapType: BracketTypes.ROUND_BRACKETS,
68
+ };
69
+ };