@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.
- package/CHANGELOG.md +44 -0
- package/configure/CHANGELOG.md +16 -0
- package/configure/node_modules/@pie-element/multiple-choice/CHANGELOG.json +1972 -0
- package/configure/node_modules/@pie-element/multiple-choice/CHANGELOG.md +4186 -0
- package/configure/node_modules/@pie-element/multiple-choice/LICENSE.md +5 -0
- package/configure/node_modules/@pie-element/multiple-choice/PRINT.md +35 -0
- package/configure/node_modules/@pie-element/multiple-choice/README.md +56 -0
- package/configure/node_modules/@pie-element/multiple-choice/choice.png +0 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/CHANGELOG.json +1387 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/CHANGELOG.md +3332 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/defaults.js +202 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/defaults.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/index.js +248 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/main.js +597 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/main.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/utils.js +18 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/utils.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/package.json +20 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/CHANGELOG.json +527 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/CHANGELOG.md +2297 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/defaults.js +34 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/defaults.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/index.js +346 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/utils.js +28 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/utils.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/package.json +15 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/config-schema.json +2993 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/config-schema.json.md +2217 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/demo/config.js +8 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/demo/generate.js +61 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/demo/index.html +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/demo/session.js +7 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/pie-schema.json +1332 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/pie-schema.json.md +1015 -0
- package/configure/node_modules/@pie-element/multiple-choice/esm/configure.css +847 -0
- package/configure/node_modules/@pie-element/multiple-choice/esm/configure.js +1218 -0
- package/configure/node_modules/@pie-element/multiple-choice/esm/configure.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/esm/controller.css +847 -0
- package/configure/node_modules/@pie-element/multiple-choice/esm/controller.js +324 -0
- package/configure/node_modules/@pie-element/multiple-choice/esm/controller.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/esm/element.css +847 -0
- package/configure/node_modules/@pie-element/multiple-choice/esm/element.js +3287 -0
- package/configure/node_modules/@pie-element/multiple-choice/esm/element.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/esm/print.css +847 -0
- package/configure/node_modules/@pie-element/multiple-choice/esm/print.js +3017 -0
- package/configure/node_modules/@pie-element/multiple-choice/esm/print.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/choice-input.js +427 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/choice-input.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/choice.js +252 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/choice.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/feedback-tick.js +174 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/feedback-tick.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/index.js +388 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/main.js +108 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/main.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/multiple-choice.js +469 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/multiple-choice.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/print.js +129 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/print.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/session-updater.js +48 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/session-updater.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/module/configure.js +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/module/controller.js +3472 -0
- package/configure/node_modules/@pie-element/multiple-choice/module/demo.js +86 -0
- package/configure/node_modules/@pie-element/multiple-choice/module/element.js +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/module/index.html +21 -0
- package/configure/node_modules/@pie-element/multiple-choice/module/index.js +2 -0
- package/configure/node_modules/@pie-element/multiple-choice/module/manifest.json +10 -0
- package/configure/node_modules/@pie-element/multiple-choice/module/print-demo.js +124 -0
- package/configure/node_modules/@pie-element/multiple-choice/module/print.html +18 -0
- package/configure/node_modules/@pie-element/multiple-choice/module/print.js +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/package.json +53 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/CHANGELOG.md +898 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/NEXT.CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/esm/index.js +262 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/esm/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/lib/expander.js +88 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/lib/expander.js.map +1 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/lib/index.js +181 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/lib/styles.js +66 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/lib/styles.js.map +1 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/package.json +44 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/src/__tests__/index.test.jsx +99 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/src/expander.jsx +61 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/src/index.jsx +98 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/src/styles.js +61 -0
- package/configure/node_modules/@pie-lib/icons/CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-lib/icons/CHANGELOG.md +539 -0
- package/configure/node_modules/@pie-lib/icons/NEXT.CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-lib/icons/esm/index.js +1153 -0
- package/configure/node_modules/@pie-lib/icons/esm/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/lib/correct-icon.js +89 -0
- package/configure/node_modules/@pie-lib/icons/lib/correct-icon.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/lib/correct-response-icon.js +153 -0
- package/configure/node_modules/@pie-lib/icons/lib/correct-response-icon.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/lib/icon-base.js +206 -0
- package/configure/node_modules/@pie-lib/icons/lib/icon-base.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/lib/icon-root.js +130 -0
- package/configure/node_modules/@pie-lib/icons/lib/icon-root.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/lib/incorrect-icon.js +92 -0
- package/configure/node_modules/@pie-lib/icons/lib/incorrect-icon.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/lib/index.js +72 -0
- package/configure/node_modules/@pie-lib/icons/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/lib/instructions-icon.js +229 -0
- package/configure/node_modules/@pie-lib/icons/lib/instructions-icon.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/lib/learn-more-icon.js +145 -0
- package/configure/node_modules/@pie-lib/icons/lib/learn-more-icon.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/lib/nothing-submitted-icon.js +183 -0
- package/configure/node_modules/@pie-lib/icons/lib/nothing-submitted-icon.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/lib/partially-correct-icon.js +82 -0
- package/configure/node_modules/@pie-lib/icons/lib/partially-correct-icon.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/lib/show-rationale-icon.js +206 -0
- package/configure/node_modules/@pie-lib/icons/lib/show-rationale-icon.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/lib/sized.js +41 -0
- package/configure/node_modules/@pie-lib/icons/lib/sized.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/package.json +35 -0
- package/configure/node_modules/@pie-lib/icons/src/__tests__/index.test.js +3 -0
- package/configure/node_modules/@pie-lib/icons/src/correct-icon.jsx +64 -0
- package/configure/node_modules/@pie-lib/icons/src/correct-response-icon.jsx +121 -0
- package/configure/node_modules/@pie-lib/icons/src/icon-base.jsx +158 -0
- package/configure/node_modules/@pie-lib/icons/src/icon-root.jsx +76 -0
- package/configure/node_modules/@pie-lib/icons/src/incorrect-icon.jsx +61 -0
- package/configure/node_modules/@pie-lib/icons/src/index.js +19 -0
- package/configure/node_modules/@pie-lib/icons/src/instructions-icon.jsx +189 -0
- package/configure/node_modules/@pie-lib/icons/src/learn-more-icon.jsx +107 -0
- package/configure/node_modules/@pie-lib/icons/src/nothing-submitted-icon.jsx +130 -0
- package/configure/node_modules/@pie-lib/icons/src/partially-correct-icon.jsx +49 -0
- package/configure/node_modules/@pie-lib/icons/src/show-rationale-icon.jsx +152 -0
- package/configure/node_modules/@pie-lib/icons/src/sized.jsx +25 -0
- package/configure/node_modules/@pie-lib/math-rendering/CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/CHANGELOG.md +775 -0
- package/configure/node_modules/@pie-lib/math-rendering/NEXT.CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/esm/index.js +690 -0
- package/configure/node_modules/@pie-lib/math-rendering/esm/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/index.js +38 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/mml-to-latex.js +15 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/mml-to-latex.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/chtml.js +296 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/chtml.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/index.js +23 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/mml.js +109 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/mml.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/normalization.js +95 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/normalization.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/render-math.js +438 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/render-math.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/package.json +28 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/__tests__/mml-to-latex.test.js +14 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/__tests__/normalization.test.js +50 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/__tests__/render-math.test.js +155 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/index.js +5 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/mml-to-latex.js +2 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/mstack/__tests__/__snapshots__/chtml.test.js.snap +9 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/mstack/__tests__/chtml.test.js +104 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/mstack/chtml.js +220 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/mstack/index.js +13 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/mstack/mml.js +24 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/normalization.js +69 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/render-math.js +387 -0
- package/configure/node_modules/@pie-lib/render-ui/CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-lib/render-ui/CHANGELOG.md +1026 -0
- package/configure/node_modules/@pie-lib/render-ui/NEXT.CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-lib/render-ui/esm/index.js +1616 -0
- package/configure/node_modules/@pie-lib/render-ui/esm/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/append-css-rules.js +88 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/append-css-rules.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/assets/enableAudioAutoplayImage.js +9 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/assets/enableAudioAutoplayImage.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/collapsible/index.js +135 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/collapsible/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/color.js +344 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/color.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/feedback.js +150 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/feedback.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/has-media.js +27 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/has-media.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/has-text.js +28 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/has-text.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/html-and-math.js +74 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/html-and-math.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/index.js +136 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/input-container.js +60 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/input-container.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/preview-layout.js +145 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/preview-layout.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/preview-prompt.js +321 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/preview-prompt.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/purpose.js +28 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/purpose.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/readable.js +28 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/readable.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/response-indicators.js +151 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/response-indicators.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/ui-layout.js +122 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/ui-layout.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/withUndoReset.js +181 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/withUndoReset.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/package.json +40 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/__snapshots__/html-and-math.test.js.snap +11 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/__snapshots__/preview-prompt.test.jsx.snap +37 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/__snapshots__/purpose.test.jsx.snap +42 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/__snapshots__/readable.test.jsx.snap +64 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/__snapshots__/response-indicators.test.jsx.snap +27 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/color.test.js +12 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/has-media.test.js +20 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/has-text.test.js +21 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/html-and-math.test.js +24 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/preview-prompt.test.jsx +56 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/purpose.test.jsx +47 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/readable.test.jsx +64 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/response-indicators.test.jsx +16 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/ui-layout.test.jsx +34 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/withUndoReset.test.jsx +254 -0
- package/configure/node_modules/@pie-lib/render-ui/src/append-css-rules.js +51 -0
- package/configure/node_modules/@pie-lib/render-ui/src/assets/enableAudioAutoplayImage.js +1 -0
- package/configure/node_modules/@pie-lib/render-ui/src/collapsible/__tests__/__snapshots__/index.test.jsx.snap +18 -0
- package/configure/node_modules/@pie-lib/render-ui/src/collapsible/__tests__/index.test.jsx +13 -0
- package/configure/node_modules/@pie-lib/render-ui/src/collapsible/index.jsx +64 -0
- package/configure/node_modules/@pie-lib/render-ui/src/color.js +121 -0
- package/configure/node_modules/@pie-lib/render-ui/src/feedback.jsx +99 -0
- package/configure/node_modules/@pie-lib/render-ui/src/has-media.js +16 -0
- package/configure/node_modules/@pie-lib/render-ui/src/has-text.js +18 -0
- package/configure/node_modules/@pie-lib/render-ui/src/html-and-math.js +21 -0
- package/configure/node_modules/@pie-lib/render-ui/src/index.js +35 -0
- package/configure/node_modules/@pie-lib/render-ui/src/input-container.jsx +41 -0
- package/configure/node_modules/@pie-lib/render-ui/src/preview-layout.jsx +95 -0
- package/configure/node_modules/@pie-lib/render-ui/src/preview-prompt.jsx +254 -0
- package/configure/node_modules/@pie-lib/render-ui/src/purpose.jsx +17 -0
- package/configure/node_modules/@pie-lib/render-ui/src/readable.jsx +19 -0
- package/configure/node_modules/@pie-lib/render-ui/src/response-indicators.jsx +89 -0
- package/configure/node_modules/@pie-lib/render-ui/src/ui-layout.jsx +66 -0
- package/configure/node_modules/@pie-lib/render-ui/src/withUndoReset.jsx +116 -0
- package/configure/node_modules/@pie-lib/test-utils/CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-lib/test-utils/CHANGELOG.md +410 -0
- package/configure/node_modules/@pie-lib/test-utils/NEXT.CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-lib/test-utils/esm/index.js +39 -0
- package/configure/node_modules/@pie-lib/test-utils/esm/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/test-utils/lib/index.js +40 -0
- package/configure/node_modules/@pie-lib/test-utils/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/test-utils/package.json +25 -0
- package/configure/node_modules/@pie-lib/test-utils/src/__tests__/index.test.js +45 -0
- package/configure/node_modules/@pie-lib/test-utils/src/index.js +18 -0
- package/configure/node_modules/@pie-lib/translator/CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-lib/translator/CHANGELOG.md +282 -0
- package/configure/node_modules/@pie-lib/translator/NEXT.CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-lib/translator/esm/index.js +257 -0
- package/configure/node_modules/@pie-lib/translator/esm/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/translator/lib/en.js +102 -0
- package/configure/node_modules/@pie-lib/translator/lib/en.js.map +1 -0
- package/configure/node_modules/@pie-lib/translator/lib/es.js +102 -0
- package/configure/node_modules/@pie-lib/translator/lib/es.js.map +1 -0
- package/configure/node_modules/@pie-lib/translator/lib/index.js +69 -0
- package/configure/node_modules/@pie-lib/translator/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/translator/package.json +25 -0
- package/configure/node_modules/@pie-lib/translator/src/en.js +99 -0
- package/configure/node_modules/@pie-lib/translator/src/es.js +99 -0
- package/configure/node_modules/@pie-lib/translator/src/index.js +43 -0
- package/configure/package.json +3 -3
- package/controller/CHANGELOG.md +16 -0
- package/controller/package.json +3 -3
- package/esm/configure.js +38602 -0
- package/esm/configure.js.map +1 -0
- package/esm/controller.js +3358 -0
- package/esm/controller.js.map +1 -0
- package/esm/element.js +2203 -0
- package/esm/element.js.map +1 -0
- package/esm/package.json +4 -0
- package/esm/print.js +4090 -0
- package/esm/print.js.map +1 -0
- package/module/controller.js +4973 -2252
- package/module/element.js +1 -1
- package/module/index.html +1 -1
- package/module/manifest.json +1 -1
- package/module/print.html +1 -1
- package/module/print.js +1 -1
- package/package.json +24 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[]
|
|
@@ -0,0 +1,690 @@
|
|
|
1
|
+
import { mathjax } from 'mathjax-full/js/mathjax';
|
|
2
|
+
import { MathJax } from 'mathjax-full/js/components/global';
|
|
3
|
+
import { AssistiveMmlHandler } from 'mathjax-full/js/a11y/assistive-mml';
|
|
4
|
+
import { EnrichHandler } from 'mathjax-full/js/a11y/semantic-enrich';
|
|
5
|
+
import { MenuHandler } from 'mathjax-full/js/ui/menu/MenuHandler';
|
|
6
|
+
import { FindMathML } from 'mathjax-full/js/input/mathml/FindMathML';
|
|
7
|
+
import { MathML } from 'mathjax-full/js/input/mathml';
|
|
8
|
+
import { TeX } from 'mathjax-full/js/input/tex';
|
|
9
|
+
import { CHTML } from 'mathjax-full/js/output/chtml';
|
|
10
|
+
import { RegisterHTMLHandler } from 'mathjax-full/js/handlers/html';
|
|
11
|
+
import { browserAdaptor } from 'mathjax-full/js/adaptors/browserAdaptor';
|
|
12
|
+
import { AllPackages } from 'mathjax-full/js/input/tex/AllPackages';
|
|
13
|
+
import { engineReady } from 'speech-rule-engine/js/common/system';
|
|
14
|
+
import { CHTMLWrapper } from 'mathjax-full/js/output/chtml/Wrapper';
|
|
15
|
+
import _ from 'lodash';
|
|
16
|
+
import { AbstractMmlNode } from 'mathjax-full/js/core/MmlTree/MmlNode';
|
|
17
|
+
import debug from 'debug';
|
|
18
|
+
import { MmlFactory } from 'mathjax-full/js/core/MmlTree/MmlFactory';
|
|
19
|
+
import { SerializedMmlVisitor } from 'mathjax-full/js/core/MmlTree/SerializedMmlVisitor';
|
|
20
|
+
import { CHTMLWrapperFactory } from 'mathjax-full/js/output/chtml/WrapperFactory';
|
|
21
|
+
import { CHTMLmspace } from 'mathjax-full/js/output/chtml/Wrappers/mspace';
|
|
22
|
+
import { HTMLDomStrings } from 'mathjax-full/js/handlers/html/HTMLDomStrings';
|
|
23
|
+
import { MathMLToLaTeX } from '@pie-framework/mathml-to-latex';
|
|
24
|
+
|
|
25
|
+
function _extends() {
|
|
26
|
+
_extends = Object.assign || function (target) {
|
|
27
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
28
|
+
var source = arguments[i];
|
|
29
|
+
|
|
30
|
+
for (var key in source) {
|
|
31
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
32
|
+
target[key] = source[key];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return target;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
return _extends.apply(this, arguments);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const reduceText = (acc, n) => {
|
|
44
|
+
if (n.node && n.node.kind === 'text') {
|
|
45
|
+
acc += n.node.text;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return acc;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
class Line {
|
|
52
|
+
constructor() {
|
|
53
|
+
this.kind = 'line';
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
get columns() {
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
class Row {
|
|
62
|
+
constructor(columns, operator) {
|
|
63
|
+
this.kind = 'row';
|
|
64
|
+
this.operator = operator;
|
|
65
|
+
this.columns = columns;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
pad(count, direction = 'right') {
|
|
69
|
+
if (count < this.columns.length) {
|
|
70
|
+
throw new Error('no');
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const diff = count - this.columns.length;
|
|
74
|
+
|
|
75
|
+
const padding = _.times(diff).map(() => '__pad__');
|
|
76
|
+
|
|
77
|
+
return direction === 'right' ? [...padding, ...this.columns] : [...this.columns, ...padding];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const mathNodeToCharArray = mn => {
|
|
83
|
+
const text = mn.childNodes.reduce(reduceText, '');
|
|
84
|
+
return text.split('');
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Convert child a column entry
|
|
88
|
+
* @param {*} child
|
|
89
|
+
* @return an array of column content
|
|
90
|
+
*/
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
const toColumnArray = child => {
|
|
94
|
+
if (!child || !child.kind) {
|
|
95
|
+
return [];
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (child.kind === 'msrow') {
|
|
99
|
+
throw new Error('msrow in msrow?');
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (child.kind === 'mo') {
|
|
103
|
+
// We are going to treat this operator as a text array.
|
|
104
|
+
// It's probably going to be a decimal point
|
|
105
|
+
// eslint-disable-next-line no-console
|
|
106
|
+
console.warn('mo that is not 1st node in msrow?');
|
|
107
|
+
return mathNodeToCharArray(child); // throw new Error('mo must be first child of msrow');
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (child.kind === 'mn') {
|
|
111
|
+
return mathNodeToCharArray(child);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (child.toCHTML) {
|
|
115
|
+
return child;
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* convert mstack chtml childNodes into a Row
|
|
120
|
+
* @param child chtml child node of mstack
|
|
121
|
+
* @return Row | Line
|
|
122
|
+
*/
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
const rowStack = child => {
|
|
126
|
+
if (!child || !child.kind) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (child.kind === 'msrow') {
|
|
131
|
+
if (!child.childNodes || child.childNodes.length === 0) {
|
|
132
|
+
return new Row([]);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const f = _.first(child.childNodes);
|
|
136
|
+
|
|
137
|
+
const nodes = f && f.kind === 'mo' ? _.tail(child.childNodes) : child.childNodes;
|
|
138
|
+
|
|
139
|
+
const columns = _.flatten(nodes.map(toColumnArray));
|
|
140
|
+
|
|
141
|
+
return new Row(columns, f.kind === 'mo' ? f : undefined);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (child.kind === 'mn') {
|
|
145
|
+
const columns = mathNodeToCharArray(child);
|
|
146
|
+
return new Row(columns, undefined);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (child.kind === 'mo') {
|
|
150
|
+
// eslint-disable-next-line no-console
|
|
151
|
+
console.warn('mo on its own row?');
|
|
152
|
+
return new Row([], child);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (child.kind === 'msline') {
|
|
156
|
+
return new Line();
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (child.toCHTML) {
|
|
160
|
+
return new Row([child]);
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
/** convert MathJax chtml tree to Row[]
|
|
164
|
+
* @param mstack the root of the mathjax chtml tree
|
|
165
|
+
* @return Row[]
|
|
166
|
+
*/
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
const getStackData = mstack => {
|
|
170
|
+
if (!mstack || !mstack.childNodes) {
|
|
171
|
+
return [];
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return _.compact(mstack.childNodes.map(rowStack));
|
|
175
|
+
};
|
|
176
|
+
class CHTMLmstack extends CHTMLWrapper {
|
|
177
|
+
constructor(factory, node, parent = null) {
|
|
178
|
+
super(factory, node, parent);
|
|
179
|
+
this.ce = this.adaptor.document.createElement.bind(this.adaptor.document);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
toCHTML(parent) {
|
|
183
|
+
const chtml = this.standardCHTMLnode(parent);
|
|
184
|
+
const stackData = getStackData(this); // console.log('stackData', stackData);
|
|
185
|
+
|
|
186
|
+
const maxCols = stackData.reduce((acc, r) => {
|
|
187
|
+
if (r && r.columns.length > acc) {
|
|
188
|
+
acc = r.columns.length;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return acc;
|
|
192
|
+
}, 0);
|
|
193
|
+
const table = this.ce('table');
|
|
194
|
+
chtml.appendChild(table);
|
|
195
|
+
stackData.forEach(row => {
|
|
196
|
+
const tr = this.ce('tr');
|
|
197
|
+
table.appendChild(tr);
|
|
198
|
+
|
|
199
|
+
if (row.kind === 'row') {
|
|
200
|
+
const td = this.ce('td');
|
|
201
|
+
tr.appendChild(td);
|
|
202
|
+
|
|
203
|
+
if (row.operator && row.operator.toCHTML) {
|
|
204
|
+
td.setAttribute('class', 'inner');
|
|
205
|
+
row.operator.toCHTML(td);
|
|
206
|
+
} else {
|
|
207
|
+
td.textContent = '';
|
|
208
|
+
} // align right for now:
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
const cols = row.pad(maxCols, 'right');
|
|
212
|
+
cols.forEach(c => {
|
|
213
|
+
const t = this.ce('td');
|
|
214
|
+
tr.appendChild(t);
|
|
215
|
+
|
|
216
|
+
if (c === '__pad__') {
|
|
217
|
+
t.textContent = '';
|
|
218
|
+
} else if (typeof c === 'string') {
|
|
219
|
+
t.textContent = c;
|
|
220
|
+
} else if (c.kind === 'none') {
|
|
221
|
+
t.textContent = '';
|
|
222
|
+
} else if (c.toCHTML) {
|
|
223
|
+
t.setAttribute('class', 'inner');
|
|
224
|
+
c.toCHTML(t);
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
} else if (row.kind === 'line') {
|
|
228
|
+
const td = this.ce('td');
|
|
229
|
+
tr.appendChild(td);
|
|
230
|
+
td.setAttribute('colspan', maxCols + 1);
|
|
231
|
+
td.setAttribute('class', 'mjx-line');
|
|
232
|
+
td.textContent = '';
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
}
|
|
238
|
+
CHTMLmstack.styles = {
|
|
239
|
+
'mjx-mstack > table': {
|
|
240
|
+
'line-height': 'initial',
|
|
241
|
+
border: 'solid 0px red',
|
|
242
|
+
'border-spacing': '0em',
|
|
243
|
+
'border-collapse': 'separate'
|
|
244
|
+
},
|
|
245
|
+
'mjx-mstack > table > tr': {
|
|
246
|
+
'line-height': 'initial'
|
|
247
|
+
},
|
|
248
|
+
'mjx-mstack > table > tr > td': {
|
|
249
|
+
// padding: '1.2rem',
|
|
250
|
+
border: 'solid 0px blue',
|
|
251
|
+
'font-family': 'sans-serif',
|
|
252
|
+
'line-height': 'initial'
|
|
253
|
+
},
|
|
254
|
+
'mjx-mstack > table > tr > td.inner': {
|
|
255
|
+
'font-family': 'inherit'
|
|
256
|
+
},
|
|
257
|
+
'mjx-mstack > table > tr > .mjx-line': {
|
|
258
|
+
padding: 0,
|
|
259
|
+
'border-top': 'solid 1px black'
|
|
260
|
+
},
|
|
261
|
+
'.TEX-A': {
|
|
262
|
+
'font-family': 'MJXZERO, MJXTEX !important'
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
class MmlNone extends AbstractMmlNode {
|
|
267
|
+
get kind() {
|
|
268
|
+
return 'none';
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
}
|
|
272
|
+
class MmlMstack extends AbstractMmlNode {
|
|
273
|
+
get kind() {
|
|
274
|
+
return 'mstack';
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
}
|
|
278
|
+
class MmlMsrow extends AbstractMmlNode {
|
|
279
|
+
get kind() {
|
|
280
|
+
return 'msrow';
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
}
|
|
284
|
+
class MmlMsline extends AbstractMmlNode {
|
|
285
|
+
get kind() {
|
|
286
|
+
return 'msline';
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
const chtmlNodes = {
|
|
292
|
+
mstack: CHTMLmstack
|
|
293
|
+
};
|
|
294
|
+
const mmlNodes = {
|
|
295
|
+
mstack: MmlMstack,
|
|
296
|
+
msline: MmlMsline,
|
|
297
|
+
msrow: MmlMsrow,
|
|
298
|
+
none: MmlNone
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
const BracketTypes = {};
|
|
302
|
+
BracketTypes.ROUND_BRACKETS = 'round_brackets';
|
|
303
|
+
BracketTypes.SQUARE_BRACKETS = 'square_brackets';
|
|
304
|
+
BracketTypes.DOLLAR = 'dollar';
|
|
305
|
+
BracketTypes.DOUBLE_DOLLAR = 'double_dollar';
|
|
306
|
+
const PAIRS = {
|
|
307
|
+
[BracketTypes.ROUND_BRACKETS]: ['\\(', '\\)'],
|
|
308
|
+
[BracketTypes.SQUARE_BRACKETS]: ['\\[', '\\]'],
|
|
309
|
+
[BracketTypes.DOLLAR]: ['$', '$'],
|
|
310
|
+
[BracketTypes.DOUBLE_DOLLAR]: ['$$', '$$']
|
|
311
|
+
};
|
|
312
|
+
const wrapMath = (content, wrapType) => {
|
|
313
|
+
if (wrapType === BracketTypes.SQUARE_BRACKETS) {
|
|
314
|
+
console.warn('\\[...\\] is not supported yet'); // eslint-disable-line
|
|
315
|
+
|
|
316
|
+
wrapType = BracketTypes.ROUND_BRACKETS;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
if (wrapType === BracketTypes.DOUBLE_DOLLAR) {
|
|
320
|
+
console.warn('$$...$$ is not supported yet'); // eslint-disable-line
|
|
321
|
+
|
|
322
|
+
wrapType = BracketTypes.DOLLAR;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
const [start, end] = PAIRS[wrapType] || PAIRS[BracketTypes.ROUND_BRACKETS];
|
|
326
|
+
return `${start}${content}${end}`;
|
|
327
|
+
};
|
|
328
|
+
const unWrapMath = content => {
|
|
329
|
+
const displayStyleIndex = content.indexOf('\\displaystyle');
|
|
330
|
+
|
|
331
|
+
if (displayStyleIndex !== -1) {
|
|
332
|
+
console.warn('\\displaystyle is not supported - removing'); // eslint-disable-line
|
|
333
|
+
|
|
334
|
+
content = content.replace('\\displaystyle', '').trim();
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
if (content.startsWith('$$') && content.endsWith('$$')) {
|
|
338
|
+
console.warn('$$ syntax is not yet supported'); // eslint-disable-line
|
|
339
|
+
|
|
340
|
+
return {
|
|
341
|
+
unwrapped: content.substring(2, content.length - 2),
|
|
342
|
+
wrapType: BracketTypes.DOLLAR
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
if (content.startsWith('$') && content.endsWith('$')) {
|
|
347
|
+
return {
|
|
348
|
+
unwrapped: content.substring(1, content.length - 1),
|
|
349
|
+
wrapType: BracketTypes.DOLLAR
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
if (content.startsWith('\\[') && content.endsWith('\\]')) {
|
|
354
|
+
console.warn('\\[..\\] syntax is not yet supported'); // eslint-disable-line
|
|
355
|
+
|
|
356
|
+
return {
|
|
357
|
+
unwrapped: content.substring(2, content.length - 2),
|
|
358
|
+
wrapType: BracketTypes.ROUND_BRACKETS
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
if (content.startsWith('\\(') && content.endsWith('\\)')) {
|
|
363
|
+
return {
|
|
364
|
+
unwrapped: content.substring(2, content.length - 2),
|
|
365
|
+
wrapType: BracketTypes.ROUND_BRACKETS
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
return {
|
|
370
|
+
unwrapped: content,
|
|
371
|
+
wrapType: BracketTypes.ROUND_BRACKETS
|
|
372
|
+
};
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
if (typeof window !== 'undefined') {
|
|
376
|
+
RegisterHTMLHandler(browserAdaptor());
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
let sreReady = false;
|
|
380
|
+
engineReady().then(() => {
|
|
381
|
+
sreReady = true;
|
|
382
|
+
}); // import pkg from '../../package.json';
|
|
383
|
+
const visitor = new SerializedMmlVisitor();
|
|
384
|
+
|
|
385
|
+
const toMMl = node => visitor.visitTree(node);
|
|
386
|
+
|
|
387
|
+
const log = debug('pie-lib:math-rendering');
|
|
388
|
+
const NEWLINE_BLOCK_REGEX = /\\embed\{newLine\}\[\]/g;
|
|
389
|
+
const NEWLINE_LATEX = '\\newline ';
|
|
390
|
+
|
|
391
|
+
const getGlobal = () => {
|
|
392
|
+
// TODO does it make sense to use version?
|
|
393
|
+
// const key = `${pkg.name}@${pkg.version.split('.')[0]}`;
|
|
394
|
+
// It looks like Ed made this change when he switched from mathjax3 to mathjax-full
|
|
395
|
+
// I think it was supposed to make sure version 1 (using mathjax3) is not used
|
|
396
|
+
// in combination with version 2 (using mathjax-full)
|
|
397
|
+
// TODO higher level wrappers use this instance of math-rendering, and if 2 different instances are used, math rendering is not working
|
|
398
|
+
// so I will hardcode this for now until a better solution is found
|
|
399
|
+
const key = '@pie-lib/math-rendering@2';
|
|
400
|
+
|
|
401
|
+
if (typeof window !== 'undefined') {
|
|
402
|
+
if (!window[key]) {
|
|
403
|
+
window[key] = {};
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
return window[key];
|
|
407
|
+
} else {
|
|
408
|
+
return {};
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
/** Add temporary support for a global singleDollar override
|
|
412
|
+
* <code>
|
|
413
|
+
* // This will enable single dollar rendering
|
|
414
|
+
* window.pie = window.pie || {};
|
|
415
|
+
* window.pie.mathRendering = {useSingleDollar: true };
|
|
416
|
+
* </code>
|
|
417
|
+
*/
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
const defaultOpts = () => getGlobal().opts || {};
|
|
421
|
+
|
|
422
|
+
const fixMathElement = element => {
|
|
423
|
+
if (element.dataset.mathHandled) {
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
let property = 'innerText';
|
|
428
|
+
|
|
429
|
+
if (element.textContent) {
|
|
430
|
+
property = 'textContent';
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
if (element[property]) {
|
|
434
|
+
element[property] = wrapMath(unWrapMath(element[property]).unwrapped); // because mathquill doesn't understand line breaks, sometimes we end up with custom elements on prompts/rationale/etc.
|
|
435
|
+
// we need to replace the custom embedded elements with valid latex that Mathjax can understand
|
|
436
|
+
|
|
437
|
+
element[property] = element[property].replace(NEWLINE_BLOCK_REGEX, NEWLINE_LATEX);
|
|
438
|
+
element.dataset.mathHandled = true;
|
|
439
|
+
}
|
|
440
|
+
};
|
|
441
|
+
const fixMathElements = (el = document) => {
|
|
442
|
+
const mathElements = el.querySelectorAll('[data-latex]');
|
|
443
|
+
mathElements.forEach(item => fixMathElement(item));
|
|
444
|
+
};
|
|
445
|
+
|
|
446
|
+
const adjustMathMLStyle = (el = document) => {
|
|
447
|
+
const nodes = el.querySelectorAll('math');
|
|
448
|
+
nodes.forEach(node => node.setAttribute('displaystyle', 'true'));
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
class myFindMathML extends FindMathML {
|
|
452
|
+
processMath(set) {
|
|
453
|
+
const adaptor = this.adaptor;
|
|
454
|
+
|
|
455
|
+
for (const mml of Array.from(set)) {
|
|
456
|
+
if (adaptor.kind(adaptor.parent(mml)) === 'mjx-assistive-mml') {
|
|
457
|
+
set.delete(mml);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
return super.processMath(set);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
const createMathMLInstance = (opts, docProvided = document) => {
|
|
467
|
+
opts = opts || defaultOpts();
|
|
468
|
+
|
|
469
|
+
if (opts.useSingleDollar) {
|
|
470
|
+
// eslint-disable-next-line
|
|
471
|
+
console.warn('[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)');
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
const packages = AllPackages.filter(name => name !== 'bussproofs'); // Bussproofs needs an output jax
|
|
475
|
+
// The autoload extension predefines all the macros from the extensions that haven't been loaded already
|
|
476
|
+
// so that they automatically load the needed extension when they are first used
|
|
477
|
+
|
|
478
|
+
packages.push('autoload');
|
|
479
|
+
const macros = {
|
|
480
|
+
parallelogram: '\\lower.2em{\\Huge\\unicode{x25B1}}',
|
|
481
|
+
overarc: '\\overparen',
|
|
482
|
+
napprox: '\\not\\approx',
|
|
483
|
+
longdiv: '\\enclose{longdiv}'
|
|
484
|
+
};
|
|
485
|
+
const texConfig = opts.useSingleDollar ? {
|
|
486
|
+
packages,
|
|
487
|
+
macros,
|
|
488
|
+
inlineMath: [['$', '$'], ['\\(', '\\)']],
|
|
489
|
+
processEscapes: true
|
|
490
|
+
} : {
|
|
491
|
+
packages,
|
|
492
|
+
macros
|
|
493
|
+
};
|
|
494
|
+
const mmlConfig = {
|
|
495
|
+
parseError: function (node) {
|
|
496
|
+
// function to process parsing errors
|
|
497
|
+
// eslint-disable-next-line no-console
|
|
498
|
+
console.log('error:', node);
|
|
499
|
+
this.error(this.adaptor.textContent(node).replace(/\n.*/g, ''));
|
|
500
|
+
},
|
|
501
|
+
FindMathML: new myFindMathML()
|
|
502
|
+
};
|
|
503
|
+
let cachedMathjax;
|
|
504
|
+
|
|
505
|
+
if (MathJax && MathJax.version !== mathjax.version) {
|
|
506
|
+
// handling other MathJax version on the page
|
|
507
|
+
// replacing it temporarily with the version we have
|
|
508
|
+
window.MathJax._ = window.MathJax._ || {};
|
|
509
|
+
window.MathJax.config = window.MathJax.config || {};
|
|
510
|
+
cachedMathjax = window.MathJax;
|
|
511
|
+
Object.assign(MathJax, mathjax);
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
const fontURL = `https://unpkg.com/mathjax-full@${mathjax.version}/ts/output/chtml/fonts/tex-woff-v2`;
|
|
515
|
+
const htmlConfig = {
|
|
516
|
+
fontURL,
|
|
517
|
+
wrapperFactory: new CHTMLWrapperFactory(_extends({}, CHTMLWrapperFactory.defaultNodes, chtmlNodes))
|
|
518
|
+
};
|
|
519
|
+
const mml = new MathML(mmlConfig);
|
|
520
|
+
const customMmlFactory = new MmlFactory(_extends({}, MmlFactory.defaultNodes, mmlNodes));
|
|
521
|
+
const classFactory = EnrichHandler(MenuHandler(AssistiveMmlHandler(mathjax.handlers.handlesDocument(docProvided))), mml);
|
|
522
|
+
const html = classFactory.create(docProvided, {
|
|
523
|
+
compileError: (mj, math, err) => {
|
|
524
|
+
// eslint-disable-next-line no-console
|
|
525
|
+
console.log('bad math?:', math); // eslint-disable-next-line no-console
|
|
526
|
+
|
|
527
|
+
console.error(err);
|
|
528
|
+
},
|
|
529
|
+
typesetError: function (doc, math, err) {
|
|
530
|
+
// eslint-disable-next-line no-console
|
|
531
|
+
console.log('typeset error'); // eslint-disable-next-line no-console
|
|
532
|
+
|
|
533
|
+
console.error(err);
|
|
534
|
+
doc.typesetError(math, err);
|
|
535
|
+
},
|
|
536
|
+
sre: {
|
|
537
|
+
speech: 'deep'
|
|
538
|
+
},
|
|
539
|
+
enrichSpeech: 'deep',
|
|
540
|
+
InputJax: [new TeX(texConfig), mml],
|
|
541
|
+
OutputJax: new CHTML(htmlConfig),
|
|
542
|
+
DomStrings: new HTMLDomStrings({
|
|
543
|
+
skipHtmlTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code', 'annotation', 'annotation-xml', 'mjx-assistive-mml', 'mjx-container']
|
|
544
|
+
})
|
|
545
|
+
}); // Note: we must set this *after* mathjax.document (no idea why)
|
|
546
|
+
|
|
547
|
+
mml.setMmlFactory(customMmlFactory);
|
|
548
|
+
|
|
549
|
+
if (cachedMathjax) {
|
|
550
|
+
// if we have a cached version, we replace it here
|
|
551
|
+
window.MathJax = cachedMathjax;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
return html;
|
|
555
|
+
};
|
|
556
|
+
|
|
557
|
+
let enrichSpeechInitialized = false;
|
|
558
|
+
|
|
559
|
+
const bootstrap = opts => {
|
|
560
|
+
if (typeof window === 'undefined') {
|
|
561
|
+
return {
|
|
562
|
+
Typeset: () => ({})
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
const html = createMathMLInstance(opts);
|
|
567
|
+
return {
|
|
568
|
+
version: mathjax.version,
|
|
569
|
+
html: html,
|
|
570
|
+
Typeset: function (...elements) {
|
|
571
|
+
const attemptRender = (temporary = false) => {
|
|
572
|
+
var _updatedDocument$math, _updatedDocument$math2;
|
|
573
|
+
|
|
574
|
+
let updatedDocument = this.html.findMath(elements.length ? {
|
|
575
|
+
elements
|
|
576
|
+
} : {}).compile();
|
|
577
|
+
|
|
578
|
+
if (!temporary && sreReady) {
|
|
579
|
+
updatedDocument = updatedDocument.enrich();
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
updatedDocument = updatedDocument.getMetrics().typeset().assistiveMml().attachSpeech().addMenu().updateDocument();
|
|
583
|
+
|
|
584
|
+
if (!enrichSpeechInitialized && typeof ((_updatedDocument$math = updatedDocument.math.list) == null ? void 0 : (_updatedDocument$math2 = _updatedDocument$math.next) == null ? void 0 : _updatedDocument$math2.data) === 'object') {
|
|
585
|
+
enrichSpeechInitialized = true;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
try {
|
|
589
|
+
const list = updatedDocument.math.list;
|
|
590
|
+
|
|
591
|
+
if (list) {
|
|
592
|
+
for (let item = list.next; typeof item.data !== 'symbol'; item = item.next) {
|
|
593
|
+
const mathMl = toMMl(item.data.root);
|
|
594
|
+
const parsedMathMl = mathMl.replaceAll('\n', '');
|
|
595
|
+
item.data.typesetRoot.setAttribute('data-mathml', parsedMathMl);
|
|
596
|
+
item.data.typesetRoot.setAttribute('tabindex', '-1');
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
} catch (e) {
|
|
600
|
+
// eslint-disable-next-line no-console
|
|
601
|
+
console.error(e.toString());
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
updatedDocument.clear();
|
|
605
|
+
};
|
|
606
|
+
|
|
607
|
+
if (!enrichSpeechInitialized) {
|
|
608
|
+
attemptRender(true);
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
mathjax.handleRetriesFor(() => {
|
|
612
|
+
attemptRender();
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
};
|
|
616
|
+
};
|
|
617
|
+
|
|
618
|
+
const renderMath = (el, renderOpts) => {
|
|
619
|
+
var _getGlobal$instance, _getGlobal$instance2;
|
|
620
|
+
|
|
621
|
+
if (window && window.MathJax && window.MathJax.customKey && window.MathJax.customKey == '@pie-lib/math-rendering-accessible@1') {
|
|
622
|
+
return;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
const isString = typeof el === 'string';
|
|
626
|
+
let executeOn = document.body;
|
|
627
|
+
|
|
628
|
+
if (isString) {
|
|
629
|
+
const div = document.createElement('div');
|
|
630
|
+
div.innerHTML = el;
|
|
631
|
+
executeOn = div;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
fixMathElements(executeOn);
|
|
635
|
+
adjustMathMLStyle(executeOn);
|
|
636
|
+
|
|
637
|
+
if (isString) {
|
|
638
|
+
const html = createMathMLInstance(undefined, executeOn);
|
|
639
|
+
const updatedDocument = html.findMath().compile().getMetrics().typeset().updateDocument();
|
|
640
|
+
const list = updatedDocument.math.list;
|
|
641
|
+
const item = list.next;
|
|
642
|
+
|
|
643
|
+
if (!item) {
|
|
644
|
+
return '';
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
const mathMl = toMMl(item.data.root);
|
|
648
|
+
const parsedMathMl = mathMl.replaceAll('\n', '');
|
|
649
|
+
return parsedMathMl;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
if (!getGlobal().instance) {
|
|
653
|
+
getGlobal().instance = bootstrap(renderOpts);
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
if (!el) {
|
|
657
|
+
log('el is undefined');
|
|
658
|
+
return;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
if (el instanceof Element && (_getGlobal$instance = getGlobal().instance) != null && _getGlobal$instance.Typeset) {
|
|
662
|
+
getGlobal().instance.Typeset(el);
|
|
663
|
+
} else if (el.length && (_getGlobal$instance2 = getGlobal().instance) != null && _getGlobal$instance2.Typeset) {
|
|
664
|
+
const arr = Array.from(el);
|
|
665
|
+
getGlobal().instance.Typeset(...arr);
|
|
666
|
+
}
|
|
667
|
+
};
|
|
668
|
+
/**
|
|
669
|
+
* This style is added to overried default styling of mjx-mspace Mathjax tag
|
|
670
|
+
* In mathjax src code \newline latex gets parsed to <mjx-mspace></mjx-mspace>,
|
|
671
|
+
* but has the default style
|
|
672
|
+
* 'mjx-mspace': {
|
|
673
|
+
"display": 'in-line',
|
|
674
|
+
"text-align": 'left'
|
|
675
|
+
} which prevents it from showing as a newline value
|
|
676
|
+
*/
|
|
677
|
+
|
|
678
|
+
|
|
679
|
+
CHTMLmspace.styles = {
|
|
680
|
+
'mjx-mspace': {
|
|
681
|
+
display: 'block',
|
|
682
|
+
'text-align': 'center',
|
|
683
|
+
height: '5px'
|
|
684
|
+
}
|
|
685
|
+
};
|
|
686
|
+
|
|
687
|
+
var mmlToLatex = (mathml => MathMLToLaTeX.convert(mathml));
|
|
688
|
+
|
|
689
|
+
export { mmlToLatex, renderMath, unWrapMath, wrapMath };
|
|
690
|
+
//# sourceMappingURL=index.js.map
|