@pie-element/ebsr 11.0.0 → 12.0.1-esmbeta.1
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 +22 -0
- package/configure/CHANGELOG.md +8 -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 +8 -0
- package/controller/package.json +3 -3
- package/esm/configure.js +40550 -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,202 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
/** NOTE: teacherInstructions, studentInstructions, rationale & scoringType
|
|
9
|
+
* functionalities are not defined yet - the value for those can belong to
|
|
10
|
+
* model or to configure
|
|
11
|
+
*/
|
|
12
|
+
var _default = {
|
|
13
|
+
model: {
|
|
14
|
+
choiceMode: 'checkbox',
|
|
15
|
+
choicePrefix: 'letters',
|
|
16
|
+
choices: [],
|
|
17
|
+
choicesLayout: 'vertical',
|
|
18
|
+
feedbackEnabled: false,
|
|
19
|
+
gridColumns: 2,
|
|
20
|
+
lockChoiceOrder: true,
|
|
21
|
+
partialScoring: true,
|
|
22
|
+
prompt: '',
|
|
23
|
+
promptEnabled: true,
|
|
24
|
+
rationale: '',
|
|
25
|
+
rationaleEnabled: true,
|
|
26
|
+
scoringType: 'auto',
|
|
27
|
+
studentInstructionsEnabled: true,
|
|
28
|
+
teacherInstructions: '',
|
|
29
|
+
teacherInstructionsEnabled: true,
|
|
30
|
+
toolbarEditorPosition: 'bottom',
|
|
31
|
+
selectedAnswerBackgroundColor: 'initial',
|
|
32
|
+
keyboardEventsEnabled: false
|
|
33
|
+
},
|
|
34
|
+
configuration: {
|
|
35
|
+
baseInputConfiguration: {
|
|
36
|
+
audio: {
|
|
37
|
+
disabled: false
|
|
38
|
+
},
|
|
39
|
+
video: {
|
|
40
|
+
disabled: false
|
|
41
|
+
},
|
|
42
|
+
image: {
|
|
43
|
+
disabled: false
|
|
44
|
+
},
|
|
45
|
+
textAlign: {
|
|
46
|
+
disabled: true
|
|
47
|
+
},
|
|
48
|
+
showParagraphs: {
|
|
49
|
+
disabled: false
|
|
50
|
+
},
|
|
51
|
+
separateParagraphs: {
|
|
52
|
+
disabled: true
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
choices: {
|
|
56
|
+
inputConfiguration: {
|
|
57
|
+
audio: {
|
|
58
|
+
disabled: false
|
|
59
|
+
},
|
|
60
|
+
video: {
|
|
61
|
+
disabled: false
|
|
62
|
+
},
|
|
63
|
+
image: {
|
|
64
|
+
disabled: false
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
spellCheck: {
|
|
69
|
+
label: 'Spellcheck',
|
|
70
|
+
settings: false,
|
|
71
|
+
enabled: true
|
|
72
|
+
},
|
|
73
|
+
choicesLayout: {
|
|
74
|
+
settings: false,
|
|
75
|
+
label: 'Choices Layout'
|
|
76
|
+
},
|
|
77
|
+
gridColumns: {
|
|
78
|
+
label: 'Grid columns'
|
|
79
|
+
},
|
|
80
|
+
answerChoiceCount: 0,
|
|
81
|
+
addChoiceButton: {
|
|
82
|
+
settings: true,
|
|
83
|
+
label: 'Add a Choice'
|
|
84
|
+
},
|
|
85
|
+
choiceMode: {
|
|
86
|
+
settings: true,
|
|
87
|
+
label: 'Response Type'
|
|
88
|
+
},
|
|
89
|
+
choicePrefix: {
|
|
90
|
+
settings: true,
|
|
91
|
+
label: 'Choice Labels'
|
|
92
|
+
},
|
|
93
|
+
deleteChoice: {
|
|
94
|
+
settings: true
|
|
95
|
+
},
|
|
96
|
+
feedback: {
|
|
97
|
+
settings: true,
|
|
98
|
+
label: 'Feedback'
|
|
99
|
+
},
|
|
100
|
+
prompt: {
|
|
101
|
+
settings: true,
|
|
102
|
+
label: 'Prompt',
|
|
103
|
+
inputConfiguration: {
|
|
104
|
+
audio: {
|
|
105
|
+
disabled: false
|
|
106
|
+
},
|
|
107
|
+
video: {
|
|
108
|
+
disabled: false
|
|
109
|
+
},
|
|
110
|
+
image: {
|
|
111
|
+
disabled: false
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
required: false
|
|
115
|
+
},
|
|
116
|
+
lockChoiceOrder: {
|
|
117
|
+
settings: true,
|
|
118
|
+
label: 'Lock Choice Order'
|
|
119
|
+
},
|
|
120
|
+
partialScoring: {
|
|
121
|
+
settings: false,
|
|
122
|
+
label: 'Allow Partial Scoring'
|
|
123
|
+
},
|
|
124
|
+
rationale: {
|
|
125
|
+
settings: true,
|
|
126
|
+
label: 'Rationale',
|
|
127
|
+
inputConfiguration: {
|
|
128
|
+
audio: {
|
|
129
|
+
disabled: true
|
|
130
|
+
},
|
|
131
|
+
video: {
|
|
132
|
+
disabled: true
|
|
133
|
+
},
|
|
134
|
+
image: {
|
|
135
|
+
disabled: false
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
required: false
|
|
139
|
+
},
|
|
140
|
+
scoringType: {
|
|
141
|
+
settings: false,
|
|
142
|
+
label: 'Scoring Type'
|
|
143
|
+
},
|
|
144
|
+
studentInstructions: {
|
|
145
|
+
settings: false,
|
|
146
|
+
label: 'Student Instructions'
|
|
147
|
+
},
|
|
148
|
+
teacherInstructions: {
|
|
149
|
+
settings: true,
|
|
150
|
+
label: 'Teacher Instructions',
|
|
151
|
+
inputConfiguration: {
|
|
152
|
+
audio: {
|
|
153
|
+
disabled: false
|
|
154
|
+
},
|
|
155
|
+
video: {
|
|
156
|
+
disabled: false
|
|
157
|
+
},
|
|
158
|
+
image: {
|
|
159
|
+
disabled: false
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
required: false
|
|
163
|
+
},
|
|
164
|
+
toolbarEditorPosition: {
|
|
165
|
+
settings: false,
|
|
166
|
+
label: 'Toolbar Editor Position'
|
|
167
|
+
},
|
|
168
|
+
minAnswerChoices: 2,
|
|
169
|
+
maxAnswerChoices: 5,
|
|
170
|
+
maxImageWidth: {
|
|
171
|
+
teacherInstructions: 300,
|
|
172
|
+
prompt: 300,
|
|
173
|
+
rationale: 636,
|
|
174
|
+
choices: 900
|
|
175
|
+
},
|
|
176
|
+
maxImageHeight: {
|
|
177
|
+
teacherInstructions: 300,
|
|
178
|
+
prompt: 300,
|
|
179
|
+
rationale: 300,
|
|
180
|
+
choices: 300
|
|
181
|
+
},
|
|
182
|
+
withRubric: {
|
|
183
|
+
settings: false,
|
|
184
|
+
label: 'Add Rubric'
|
|
185
|
+
},
|
|
186
|
+
mathMlOptions: {
|
|
187
|
+
mmlOutput: false,
|
|
188
|
+
mmlEditing: false
|
|
189
|
+
},
|
|
190
|
+
language: {
|
|
191
|
+
settings: false,
|
|
192
|
+
label: 'Specify Language',
|
|
193
|
+
enabled: false
|
|
194
|
+
},
|
|
195
|
+
languageChoices: {
|
|
196
|
+
label: 'Language Choices',
|
|
197
|
+
options: []
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
exports["default"] = _default;
|
|
202
|
+
//# sourceMappingURL=defaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/defaults.js"],"names":["model","choiceMode","choicePrefix","choices","choicesLayout","feedbackEnabled","gridColumns","lockChoiceOrder","partialScoring","prompt","promptEnabled","rationale","rationaleEnabled","scoringType","studentInstructionsEnabled","teacherInstructions","teacherInstructionsEnabled","toolbarEditorPosition","selectedAnswerBackgroundColor","keyboardEventsEnabled","configuration","baseInputConfiguration","audio","disabled","video","image","textAlign","showParagraphs","separateParagraphs","inputConfiguration","spellCheck","label","settings","enabled","answerChoiceCount","addChoiceButton","deleteChoice","feedback","required","studentInstructions","minAnswerChoices","maxAnswerChoices","maxImageWidth","maxImageHeight","withRubric","mathMlOptions","mmlOutput","mmlEditing","language","languageChoices","options"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;eACe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,UAAU,EAAE,UADP;AAELC,IAAAA,YAAY,EAAE,SAFT;AAGLC,IAAAA,OAAO,EAAE,EAHJ;AAILC,IAAAA,aAAa,EAAE,UAJV;AAKLC,IAAAA,eAAe,EAAE,KALZ;AAMLC,IAAAA,WAAW,EAAE,CANR;AAOLC,IAAAA,eAAe,EAAE,IAPZ;AAQLC,IAAAA,cAAc,EAAE,IARX;AASLC,IAAAA,MAAM,EAAE,EATH;AAULC,IAAAA,aAAa,EAAE,IAVV;AAWLC,IAAAA,SAAS,EAAE,EAXN;AAYLC,IAAAA,gBAAgB,EAAE,IAZb;AAaLC,IAAAA,WAAW,EAAE,MAbR;AAcLC,IAAAA,0BAA0B,EAAE,IAdvB;AAeLC,IAAAA,mBAAmB,EAAE,EAfhB;AAgBLC,IAAAA,0BAA0B,EAAE,IAhBvB;AAiBLC,IAAAA,qBAAqB,EAAE,QAjBlB;AAkBLC,IAAAA,6BAA6B,EAAE,SAlB1B;AAmBLC,IAAAA,qBAAqB,EAAE;AAnBlB,GADM;AAsBbC,EAAAA,aAAa,EAAE;AACbC,IAAAA,sBAAsB,EAAE;AACtBC,MAAAA,KAAK,EAAE;AAAEC,QAAAA,QAAQ,EAAE;AAAZ,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A,QAAQ,EAAE,KADF;AAERD,MAAAA,KAAK,EAAE,kBAFC;AAGRE,MAAAA,OAAO,EAAE;AAHD,KAxHG;AA6HbgB,IAAAA,eAAe,EAAE;AACflB,MAAAA,KAAK,EAAE,kBADQ;AAEfmB,MAAAA,OAAO,EAAE;AAFM;AA7HJ;AAtBF,C","sourcesContent":["/** NOTE: teacherInstructions, studentInstructions, rationale & scoringType\n * functionalities are not defined yet - the value for those can belong to\n * model or to configure\n */\nexport default {\n model: {\n choiceMode: 'checkbox',\n choicePrefix: 'letters',\n choices: [],\n choicesLayout: 'vertical',\n feedbackEnabled: false,\n gridColumns: 2,\n lockChoiceOrder: true,\n partialScoring: true,\n prompt: '',\n promptEnabled: true,\n rationale: '',\n rationaleEnabled: true,\n scoringType: 'auto',\n studentInstructionsEnabled: true,\n teacherInstructions: '',\n teacherInstructionsEnabled: true,\n toolbarEditorPosition: 'bottom',\n selectedAnswerBackgroundColor: 'initial',\n keyboardEventsEnabled: false,\n },\n configuration: {\n baseInputConfiguration: {\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n textAlign: { disabled: true },\n showParagraphs: { disabled: false },\n separateParagraphs: { disabled: true },\n },\n choices: {\n inputConfiguration: {\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n },\n },\n spellCheck: {\n label: 'Spellcheck',\n settings: false,\n enabled: true,\n },\n choicesLayout: {\n settings: false,\n label: 'Choices Layout',\n },\n gridColumns: {\n label: 'Grid columns',\n },\n answerChoiceCount: 0,\n addChoiceButton: {\n settings: true,\n label: 'Add a Choice',\n },\n choiceMode: {\n settings: true,\n label: 'Response Type',\n },\n choicePrefix: {\n settings: true,\n label: 'Choice Labels',\n },\n deleteChoice: {\n settings: true,\n },\n feedback: {\n settings: true,\n label: 'Feedback',\n },\n prompt: {\n settings: true,\n label: 'Prompt',\n inputConfiguration: {\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n },\n required: false,\n },\n lockChoiceOrder: {\n settings: true,\n label: 'Lock Choice Order',\n },\n partialScoring: {\n settings: false,\n label: 'Allow Partial Scoring',\n },\n rationale: {\n settings: true,\n label: 'Rationale',\n inputConfiguration: {\n audio: { disabled: true },\n video: { disabled: true },\n image: { disabled: false },\n },\n required: false,\n },\n scoringType: {\n settings: false,\n label: 'Scoring Type',\n },\n studentInstructions: {\n settings: false,\n label: 'Student Instructions',\n },\n teacherInstructions: {\n settings: true,\n label: 'Teacher Instructions',\n inputConfiguration: {\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n },\n required: false,\n },\n toolbarEditorPosition: {\n settings: false,\n label: 'Toolbar Editor Position',\n },\n minAnswerChoices: 2,\n maxAnswerChoices: 5,\n maxImageWidth: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 636,\n choices: 900,\n },\n maxImageHeight: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 300,\n choices: 300,\n },\n withRubric: {\n settings: false,\n label: 'Add Rubric',\n },\n mathMlOptions: {\n mmlOutput: false,\n mmlEditing: false,\n },\n language: {\n settings: false,\n label: 'Specify Language',\n enabled: false,\n },\n languageChoices: {\n label: 'Language Choices',\n options: [],\n },\n },\n};\n"],"file":"defaults.js"}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
|
|
14
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
15
|
+
|
|
16
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
+
|
|
18
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
19
|
+
|
|
20
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
21
|
+
|
|
22
|
+
var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapNativeSuper"));
|
|
23
|
+
|
|
24
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
|
+
|
|
26
|
+
var _react = _interopRequireDefault(require("react"));
|
|
27
|
+
|
|
28
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
29
|
+
|
|
30
|
+
var _debug = _interopRequireDefault(require("debug"));
|
|
31
|
+
|
|
32
|
+
var _pieConfigureEvents = require("@pie-framework/pie-configure-events");
|
|
33
|
+
|
|
34
|
+
var _main = _interopRequireDefault(require("./main"));
|
|
35
|
+
|
|
36
|
+
var _configUi = require("@pie-lib/config-ui");
|
|
37
|
+
|
|
38
|
+
var _defaults = _interopRequireDefault(require("lodash/defaults"));
|
|
39
|
+
|
|
40
|
+
var _defaults2 = _interopRequireDefault(require("./defaults"));
|
|
41
|
+
|
|
42
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
43
|
+
|
|
44
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
45
|
+
|
|
46
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
47
|
+
|
|
48
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
49
|
+
|
|
50
|
+
var log = (0, _debug["default"])('multiple-choice:configure');
|
|
51
|
+
|
|
52
|
+
var generateFormattedChoices = function generateFormattedChoices(choices) {
|
|
53
|
+
var choiceCount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
54
|
+
|
|
55
|
+
if (!choices || choices.length === 0) {
|
|
56
|
+
var formattedChoices = [];
|
|
57
|
+
|
|
58
|
+
for (var i = 0; i < choiceCount; i++) {
|
|
59
|
+
formattedChoices.push({
|
|
60
|
+
value: "".concat(i),
|
|
61
|
+
label: '',
|
|
62
|
+
feedback: {
|
|
63
|
+
type: 'none',
|
|
64
|
+
value: ''
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return formattedChoices;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return choices;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
var prepareCustomizationObject = function prepareCustomizationObject(config, model) {
|
|
76
|
+
var configuration = (0, _defaults["default"])(config, _defaults2["default"].configuration);
|
|
77
|
+
return {
|
|
78
|
+
configuration: configuration,
|
|
79
|
+
model: _objectSpread(_objectSpread({}, model), {}, {
|
|
80
|
+
choices: generateFormattedChoices(model && model.choices || [], configuration && configuration.answerChoiceCount)
|
|
81
|
+
})
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
var MultipleChoice = /*#__PURE__*/function (_HTMLElement) {
|
|
86
|
+
(0, _inherits2["default"])(MultipleChoice, _HTMLElement);
|
|
87
|
+
|
|
88
|
+
var _super = _createSuper(MultipleChoice);
|
|
89
|
+
|
|
90
|
+
function MultipleChoice() {
|
|
91
|
+
var _this;
|
|
92
|
+
|
|
93
|
+
(0, _classCallCheck2["default"])(this, MultipleChoice);
|
|
94
|
+
_this = _super.call(this);
|
|
95
|
+
_this._model = MultipleChoice.createDefaultModel();
|
|
96
|
+
_this._configuration = _defaults2["default"].configuration;
|
|
97
|
+
_this.onModelChanged = _this.onModelChanged.bind((0, _assertThisInitialized2["default"])(_this));
|
|
98
|
+
_this.onConfigurationChanged = _this.onConfigurationChanged.bind((0, _assertThisInitialized2["default"])(_this));
|
|
99
|
+
return _this;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
(0, _createClass2["default"])(MultipleChoice, [{
|
|
103
|
+
key: "model",
|
|
104
|
+
set: function set(s) {
|
|
105
|
+
this._model = MultipleChoice.createDefaultModel(s);
|
|
106
|
+
|
|
107
|
+
this._render();
|
|
108
|
+
}
|
|
109
|
+
}, {
|
|
110
|
+
key: "configuration",
|
|
111
|
+
set: function set(c) {
|
|
112
|
+
var _newConfiguration$lan,
|
|
113
|
+
_this2 = this;
|
|
114
|
+
|
|
115
|
+
var info = prepareCustomizationObject(c, this._model);
|
|
116
|
+
this.onModelChanged(info.model);
|
|
117
|
+
|
|
118
|
+
var newConfiguration = _objectSpread(_objectSpread({}, _defaults2["default"].configuration), info.configuration);
|
|
119
|
+
|
|
120
|
+
this._configuration = newConfiguration; // if language:enabled is true, then the corresponding default item model should include a language value;
|
|
121
|
+
// if it is false, then the language field should be omitted from the item model.
|
|
122
|
+
// if a default item model includes a language value (e.g., en_US) and the corresponding authoring view settings have language:settings = true,
|
|
123
|
+
// then (a) language:enabled should also be true, and (b) that default language value should be represented in languageChoices[] (as a key).
|
|
124
|
+
|
|
125
|
+
if (newConfiguration !== null && newConfiguration !== void 0 && (_newConfiguration$lan = newConfiguration.language) !== null && _newConfiguration$lan !== void 0 && _newConfiguration$lan.enabled) {
|
|
126
|
+
var _newConfiguration$lan2, _newConfiguration$lan3;
|
|
127
|
+
|
|
128
|
+
if (newConfiguration !== null && newConfiguration !== void 0 && (_newConfiguration$lan2 = newConfiguration.languageChoices) !== null && _newConfiguration$lan2 !== void 0 && (_newConfiguration$lan3 = _newConfiguration$lan2.options) !== null && _newConfiguration$lan3 !== void 0 && _newConfiguration$lan3.length) {
|
|
129
|
+
this._model.language = newConfiguration === null || newConfiguration === void 0 ? void 0 : newConfiguration.languageChoices.options[0].value;
|
|
130
|
+
}
|
|
131
|
+
} else if (newConfiguration.language.settings && this._model.language) {
|
|
132
|
+
this._configuration.language.enabled = true;
|
|
133
|
+
|
|
134
|
+
if (!this._configuration.languageChoices.options || !this._configuration.languageChoices.options.length) {
|
|
135
|
+
this._configuration.languageChoices.options = [];
|
|
136
|
+
} // check if the language is already included in the languageChoices.options array
|
|
137
|
+
// and if not, then add it.
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
if (!this._configuration.languageChoices.options.find(function (option) {
|
|
141
|
+
return option.value === _this2._model.language;
|
|
142
|
+
})) {
|
|
143
|
+
this._configuration.languageChoices.options.push({
|
|
144
|
+
value: this._model.language,
|
|
145
|
+
label: this._model.language
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
} else {
|
|
149
|
+
delete this._model.language;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
this._render();
|
|
153
|
+
}
|
|
154
|
+
}, {
|
|
155
|
+
key: "disableSidePanel",
|
|
156
|
+
set: function set(s) {
|
|
157
|
+
this._disableSidePanel = s;
|
|
158
|
+
|
|
159
|
+
this._render();
|
|
160
|
+
}
|
|
161
|
+
}, {
|
|
162
|
+
key: "dispatchModelUpdated",
|
|
163
|
+
value: function dispatchModelUpdated(reset) {
|
|
164
|
+
var resetValue = !!reset;
|
|
165
|
+
this.dispatchEvent(new _pieConfigureEvents.ModelUpdatedEvent(this._model, resetValue));
|
|
166
|
+
}
|
|
167
|
+
}, {
|
|
168
|
+
key: "onModelChanged",
|
|
169
|
+
value: function onModelChanged(m, reset) {
|
|
170
|
+
this._model = m;
|
|
171
|
+
|
|
172
|
+
this._render();
|
|
173
|
+
|
|
174
|
+
this.dispatchModelUpdated(reset);
|
|
175
|
+
}
|
|
176
|
+
}, {
|
|
177
|
+
key: "onConfigurationChanged",
|
|
178
|
+
value: function onConfigurationChanged(c) {
|
|
179
|
+
this._configuration = prepareCustomizationObject(c, this._model).configuration;
|
|
180
|
+
|
|
181
|
+
if (this._model) {
|
|
182
|
+
this.onModelChanged(this._model);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
this._render();
|
|
186
|
+
}
|
|
187
|
+
/** @param {done, progress, file} handler */
|
|
188
|
+
|
|
189
|
+
}, {
|
|
190
|
+
key: "insertImage",
|
|
191
|
+
value: function insertImage(handler) {
|
|
192
|
+
this.dispatchEvent(new _pieConfigureEvents.InsertImageEvent(handler));
|
|
193
|
+
}
|
|
194
|
+
}, {
|
|
195
|
+
key: "onDeleteImage",
|
|
196
|
+
value: function onDeleteImage(src, done) {
|
|
197
|
+
this.dispatchEvent(new _pieConfigureEvents.DeleteImageEvent(src, done));
|
|
198
|
+
}
|
|
199
|
+
}, {
|
|
200
|
+
key: "insertSound",
|
|
201
|
+
value: function insertSound(handler) {
|
|
202
|
+
this.dispatchEvent(new _pieConfigureEvents.InsertSoundEvent(handler));
|
|
203
|
+
}
|
|
204
|
+
}, {
|
|
205
|
+
key: "onDeleteSound",
|
|
206
|
+
value: function onDeleteSound(src, done) {
|
|
207
|
+
this.dispatchEvent(new _pieConfigureEvents.DeleteSoundEvent(src, done));
|
|
208
|
+
}
|
|
209
|
+
}, {
|
|
210
|
+
key: "_render",
|
|
211
|
+
value: function _render() {
|
|
212
|
+
log('_render');
|
|
213
|
+
|
|
214
|
+
var element = /*#__PURE__*/_react["default"].createElement(_main["default"], {
|
|
215
|
+
model: this._model,
|
|
216
|
+
configuration: this._configuration,
|
|
217
|
+
onModelChanged: this.onModelChanged,
|
|
218
|
+
onConfigurationChanged: this.onConfigurationChanged,
|
|
219
|
+
disableSidePanel: this._disableSidePanel,
|
|
220
|
+
imageSupport: {
|
|
221
|
+
add: this.insertImage.bind(this),
|
|
222
|
+
"delete": this.onDeleteImage.bind(this)
|
|
223
|
+
},
|
|
224
|
+
uploadSoundSupport: {
|
|
225
|
+
add: this.insertSound.bind(this),
|
|
226
|
+
"delete": this.onDeleteSound.bind(this)
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
_reactDom["default"].render(element, this);
|
|
231
|
+
}
|
|
232
|
+
}]);
|
|
233
|
+
return MultipleChoice;
|
|
234
|
+
}( /*#__PURE__*/(0, _wrapNativeSuper2["default"])(HTMLElement));
|
|
235
|
+
|
|
236
|
+
exports["default"] = MultipleChoice;
|
|
237
|
+
(0, _defineProperty2["default"])(MultipleChoice, "createDefaultModel", function () {
|
|
238
|
+
var model = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
239
|
+
|
|
240
|
+
var normalizedModel = _configUi.choiceUtils.normalizeChoices(_objectSpread(_objectSpread(_objectSpread({}, _defaults2["default"].model), model), {}, {
|
|
241
|
+
choices: generateFormattedChoices(model && model.choices || [])
|
|
242
|
+
})); // This is used for offering support for old models which have the property "verticalMode"
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
normalizedModel.choicesLayout = model.choicesLayout || model.verticalMode === false && 'horizontal' || _defaults2["default"].model.choicesLayout;
|
|
246
|
+
return normalizedModel;
|
|
247
|
+
});
|
|
248
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":["log","generateFormattedChoices","choices","choiceCount","length","formattedChoices","i","push","value","label","feedback","type","prepareCustomizationObject","config","model","configuration","sensibleDefaults","answerChoiceCount","MultipleChoice","_model","createDefaultModel","_configuration","onModelChanged","bind","onConfigurationChanged","s","_render","c","info","newConfiguration","language","enabled","languageChoices","options","settings","find","option","_disableSidePanel","reset","resetValue","dispatchEvent","ModelUpdatedEvent","m","dispatchModelUpdated","handler","InsertImageEvent","src","done","DeleteImageEvent","InsertSoundEvent","DeleteSoundEvent","element","React","createElement","Main","disableSidePanel","imageSupport","add","insertImage","onDeleteImage","uploadSoundSupport","insertSound","onDeleteSound","ReactDOM","render","HTMLElement","normalizedModel","utils","normalizeChoices","choicesLayout","verticalMode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAQA;;AACA;;AACA;;AAEA;;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,2BAAN,CAAZ;;AAEA,IAAMC,wBAAwB,GAAG,SAA3BA,wBAA2B,CAACC,OAAD,EAA8B;AAAA,MAApBC,WAAoB,uEAAN,CAAM;;AAC7D,MAAI,CAACD,OAAD,IAAYA,OAAO,CAACE,MAAR,KAAmB,CAAnC,EAAsC;AACpC,QAAIC,gBAAgB,GAAG,EAAvB;;AAEA,SAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGH,WAApB,EAAiCG,CAAC,EAAlC,EAAsC;AACpCD,MAAAA,gBAAgB,CAACE,IAAjB,CAAsB;AACpBC,QAAAA,KAAK,YAAKF,CAAL,CADe;AAEpBG,QAAAA,KAAK,EAAE,EAFa;AAGpBC,QAAAA,QAAQ,EAAE;AACRC,UAAAA,IAAI,EAAE,MADE;AAERH,UAAAA,KAAK,EAAE;AAFC;AAHU,OAAtB;AAQD;;AAED,WAAOH,gBAAP;AACD;;AAED,SAAOH,OAAP;AACD,CAnBD;;AAqBA,IAAMU,0BAA0B,GAAG,SAA7B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A,sBAJS;AAKtC+B,QAAAA,gBAAgB,EAAE,KAAKlB,iBALe;AAMtCmB,QAAAA,YAAY,EAAE;AACZC,UAAAA,GAAG,EAAE,KAAKC,WAAL,CAAiBnC,IAAjB,CAAsB,IAAtB,CADO;AAEZ,oBAAQ,KAAKoC,aAAL,CAAmBpC,IAAnB,CAAwB,IAAxB;AAFI,SANwB;AAUtCqC,QAAAA,kBAAkB,EAAE;AAClBH,UAAAA,GAAG,EAAE,KAAKI,WAAL,CAAiBtC,IAAjB,CAAsB,IAAtB,CADa;AAElB,oBAAQ,KAAKuC,aAAL,CAAmBvC,IAAnB,CAAwB,IAAxB;AAFU;AAVkB,OAA1B,CAAd;;AAgBAwC,2BAASC,MAAT,CAAgBb,OAAhB,EAAyB,IAAzB;AACD;;;kDAtIyCc,W;;;iCAAvB/C,c,wBACS,YAAgB;AAAA,MAAfJ,KAAe,uEAAP,EAAO;;AAC1C,MAAMoD,eAAe,GAAGC,sBAAMC,gBAAN,+CACnBpD,sBAAiBF,KADE,GAEnBA,KAFmB;AAGtBZ,IAAAA,OAAO,EAAED,wBAAwB,CAAEa,KAAK,IAAIA,KAAK,CAACZ,OAAhB,IAA4B,EAA7B;AAHX,KAAxB,CAD0C,CAO1C;;;AACAgE,EAAAA,eAAe,CAACG,aAAhB,GACEvD,KAAK,CAACuD,aAAN,IAAwBvD,KAAK,CAACwD,YAAN,KAAuB,KAAvB,IAAgC,YAAxD,IAAyEtD,sBAAiBF,KAAjB,CAAuBuD,aADlG;AAGA,SAAOH,eAAP;AACD,C","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport debug from 'debug';\nimport {\n DeleteImageEvent,\n InsertImageEvent,\n ModelUpdatedEvent,\n InsertSoundEvent,\n DeleteSoundEvent,\n} from '@pie-framework/pie-configure-events';\n\nimport Main from './main';\nimport { choiceUtils as utils } from '@pie-lib/config-ui';\nimport defaults from 'lodash/defaults';\n\nimport sensibleDefaults from './defaults';\n\nconst log = debug('multiple-choice:configure');\n\nconst generateFormattedChoices = (choices, choiceCount = 0) => {\n if (!choices || choices.length === 0) {\n let formattedChoices = [];\n\n for (let i = 0; i < choiceCount; i++) {\n formattedChoices.push({\n value: `${i}`,\n label: '',\n feedback: {\n type: 'none',\n value: '',\n },\n });\n }\n\n return formattedChoices;\n }\n\n return choices;\n};\n\nconst prepareCustomizationObject = (config, model) => {\n const configuration = defaults(config, sensibleDefaults.configuration);\n\n return {\n configuration,\n model: {\n ...model,\n choices: generateFormattedChoices(\n (model && model.choices) || [],\n configuration && configuration.answerChoiceCount,\n ),\n },\n };\n};\n\nexport default class MultipleChoice extends HTMLElement {\n static createDefaultModel = (model = {}) => {\n const normalizedModel = utils.normalizeChoices({\n ...sensibleDefaults.model,\n ...model,\n choices: generateFormattedChoices((model && model.choices) || []),\n });\n\n // This is used for offering support for old models which have the property \"verticalMode\"\n normalizedModel.choicesLayout =\n model.choicesLayout || (model.verticalMode === false && 'horizontal') || sensibleDefaults.model.choicesLayout;\n\n return normalizedModel;\n };\n\n constructor() {\n super();\n this._model = MultipleChoice.createDefaultModel();\n this._configuration = sensibleDefaults.configuration;\n this.onModelChanged = this.onModelChanged.bind(this);\n this.onConfigurationChanged = this.onConfigurationChanged.bind(this);\n }\n\n set model(s) {\n this._model = MultipleChoice.createDefaultModel(s);\n\n this._render();\n }\n\n set configuration(c) {\n const info = prepareCustomizationObject(c, this._model);\n\n this.onModelChanged(info.model);\n\n const newConfiguration = {\n ...sensibleDefaults.configuration,\n ...info.configuration,\n };\n this._configuration = newConfiguration;\n\n // if language:enabled is true, then the corresponding default item model should include a language value;\n // if it is false, then the language field should be omitted from the item model.\n // if a default item model includes a language value (e.g., en_US) and the corresponding authoring view settings have language:settings = true,\n // then (a) language:enabled should also be true, and (b) that default language value should be represented in languageChoices[] (as a key).\n if (newConfiguration?.language?.enabled) {\n if (newConfiguration?.languageChoices?.options?.length) {\n this._model.language = newConfiguration?.languageChoices.options[0].value;\n }\n } else if (newConfiguration.language.settings && this._model.language) {\n this._configuration.language.enabled = true;\n\n if (!this._configuration.languageChoices.options || !this._configuration.languageChoices.options.length) {\n this._configuration.languageChoices.options = [];\n }\n\n // check if the language is already included in the languageChoices.options array\n // and if not, then add it.\n if (!this._configuration.languageChoices.options.find((option) => option.value === this._model.language)) {\n this._configuration.languageChoices.options.push({\n value: this._model.language,\n label: this._model.language,\n });\n }\n } else {\n delete this._model.language;\n }\n\n this._render();\n }\n\n set disableSidePanel(s) {\n this._disableSidePanel = s;\n this._render();\n }\n\n dispatchModelUpdated(reset) {\n const resetValue = !!reset;\n\n this.dispatchEvent(new ModelUpdatedEvent(this._model, resetValue));\n }\n\n onModelChanged(m, reset) {\n this._model = m;\n this._render();\n\n this.dispatchModelUpdated(reset);\n }\n\n onConfigurationChanged(c) {\n this._configuration = prepareCustomizationObject(c, this._model).configuration;\n\n if (this._model) {\n this.onModelChanged(this._model);\n }\n\n this._render();\n }\n\n /** @param {done, progress, file} handler */\n insertImage(handler) {\n this.dispatchEvent(new InsertImageEvent(handler));\n }\n\n onDeleteImage(src, done) {\n this.dispatchEvent(new DeleteImageEvent(src, done));\n }\n\n insertSound(handler) {\n this.dispatchEvent(new InsertSoundEvent(handler));\n }\n\n onDeleteSound(src, done) {\n this.dispatchEvent(new DeleteSoundEvent(src, done));\n }\n\n _render() {\n log('_render');\n let element = React.createElement(Main, {\n model: this._model,\n configuration: this._configuration,\n onModelChanged: this.onModelChanged,\n onConfigurationChanged: this.onConfigurationChanged,\n disableSidePanel: this._disableSidePanel,\n imageSupport: {\n add: this.insertImage.bind(this),\n delete: this.onDeleteImage.bind(this),\n },\n uploadSoundSupport: {\n add: this.insertSound.bind(this),\n delete: this.onDeleteSound.bind(this),\n },\n });\n\n ReactDOM.render(element, this);\n }\n}\n"],"file":"index.js"}
|