@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,122 @@
|
|
|
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 _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
|
|
12
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
|
+
|
|
14
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
+
|
|
16
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
+
|
|
18
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
19
|
+
|
|
20
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
21
|
+
|
|
22
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
23
|
+
|
|
24
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
|
+
|
|
26
|
+
var _react = _interopRequireDefault(require("react"));
|
|
27
|
+
|
|
28
|
+
var _styles = require("@material-ui/core/styles");
|
|
29
|
+
|
|
30
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
31
|
+
|
|
32
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
33
|
+
|
|
34
|
+
var _appendCssRules = _interopRequireDefault(require("./append-css-rules"));
|
|
35
|
+
|
|
36
|
+
var _excluded = ["children", "className", "classes", "fontSizeFactor"],
|
|
37
|
+
_excluded2 = ["extraCSSRules"];
|
|
38
|
+
|
|
39
|
+
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); }; }
|
|
40
|
+
|
|
41
|
+
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; } }
|
|
42
|
+
|
|
43
|
+
var UiLayout = /*#__PURE__*/function (_AppendCSSRules) {
|
|
44
|
+
(0, _inherits2["default"])(UiLayout, _AppendCSSRules);
|
|
45
|
+
|
|
46
|
+
var _super = _createSuper(UiLayout);
|
|
47
|
+
|
|
48
|
+
function UiLayout(props) {
|
|
49
|
+
var _this;
|
|
50
|
+
|
|
51
|
+
(0, _classCallCheck2["default"])(this, UiLayout);
|
|
52
|
+
_this = _super.call(this, props);
|
|
53
|
+
_this.classesSheet = document.createElement('style');
|
|
54
|
+
return _this;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
(0, _createClass2["default"])(UiLayout, [{
|
|
58
|
+
key: "computeStyle",
|
|
59
|
+
value: function computeStyle(fontSizeFactor) {
|
|
60
|
+
var getFontSize = function getFontSize(element) {
|
|
61
|
+
return parseFloat(getComputedStyle(element).fontSize);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
var rootFontSize = getFontSize(document.documentElement);
|
|
65
|
+
var bodyFontSize = getFontSize(document.body);
|
|
66
|
+
var effectiveFontSize = Math.max(rootFontSize, bodyFontSize);
|
|
67
|
+
return fontSizeFactor !== 1 ? {
|
|
68
|
+
fontSize: "".concat(effectiveFontSize * fontSizeFactor, "px")
|
|
69
|
+
} : null;
|
|
70
|
+
}
|
|
71
|
+
}, {
|
|
72
|
+
key: "render",
|
|
73
|
+
value: function render() {
|
|
74
|
+
var _this$props = this.props,
|
|
75
|
+
children = _this$props.children,
|
|
76
|
+
className = _this$props.className,
|
|
77
|
+
classes = _this$props.classes,
|
|
78
|
+
fontSizeFactor = _this$props.fontSizeFactor,
|
|
79
|
+
rest = (0, _objectWithoutProperties2["default"])(_this$props, _excluded);
|
|
80
|
+
var finalClass = (0, _classnames["default"])(className, classes.extraCSSRules, classes.uiLayoutContainer);
|
|
81
|
+
var extraCSSRules = rest.extraCSSRules,
|
|
82
|
+
restProps = (0, _objectWithoutProperties2["default"])(rest, _excluded2);
|
|
83
|
+
var style = this.computeStyle(fontSizeFactor);
|
|
84
|
+
return /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({
|
|
85
|
+
className: finalClass
|
|
86
|
+
}, restProps, style && {
|
|
87
|
+
style: style
|
|
88
|
+
}), children);
|
|
89
|
+
}
|
|
90
|
+
}]);
|
|
91
|
+
return UiLayout;
|
|
92
|
+
}(_appendCssRules["default"]);
|
|
93
|
+
|
|
94
|
+
(0, _defineProperty2["default"])(UiLayout, "propTypes", {
|
|
95
|
+
classes: _propTypes["default"].object,
|
|
96
|
+
className: _propTypes["default"].string,
|
|
97
|
+
children: _propTypes["default"].array,
|
|
98
|
+
extraCSSRules: _propTypes["default"].shape({
|
|
99
|
+
names: _propTypes["default"].arrayOf(_propTypes["default"].string),
|
|
100
|
+
rules: _propTypes["default"].string
|
|
101
|
+
}),
|
|
102
|
+
fontSizeFactor: _propTypes["default"].number
|
|
103
|
+
});
|
|
104
|
+
(0, _defineProperty2["default"])(UiLayout, "defaultProps", {
|
|
105
|
+
extraCSSRules: {},
|
|
106
|
+
fontSizeFactor: 1
|
|
107
|
+
});
|
|
108
|
+
var styles = {
|
|
109
|
+
extraCSSRules: {},
|
|
110
|
+
// need this because some browsers set their own style on table
|
|
111
|
+
uiLayoutContainer: {
|
|
112
|
+
'& table, th, td': {
|
|
113
|
+
fontSize: 'inherit'
|
|
114
|
+
/* Ensure table elements inherit font size */
|
|
115
|
+
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
var Styled = (0, _styles.withStyles)(styles)(UiLayout);
|
|
120
|
+
var _default = Styled;
|
|
121
|
+
exports["default"] = _default;
|
|
122
|
+
//# sourceMappingURL=ui-layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ui-layout.jsx"],"names":["UiLayout","props","classesSheet","document","createElement","fontSizeFactor","getFontSize","element","parseFloat","getComputedStyle","fontSize","rootFontSize","documentElement","bodyFontSize","body","effectiveFontSize","Math","max","children","className","classes","rest","finalClass","extraCSSRules","uiLayoutContainer","restProps","style","computeStyle","AppendCSSRules","PropTypes","object","string","array","shape","names","arrayOf","rules","number","styles","Styled"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;IAEMA,Q;;;;;AAiBJ,oBAAYC,KAAZ,EAAmB;AAAA;;AAAA;AACjB,8BAAMA,KAAN;AACA,UAAKC,YAAL,GAAoBC,QAAQ,CAACC,aAAT,CAAuB,OAAvB,CAApB;AAFiB;AAGlB;;;;WAED,sBAAaC,cAAb,EAA6B;AAC3B,UAAMC,WAAW,GAAG,SAAdA,WAAc,CAACC,OAAD;AAAA,eAAaC,UAAU,CAACC,gBAAgB,CAACF,OAAD,CAAhB,CAA0BG,QAA3B,CAAvB;AAAA,OAApB;;AAEA,UAAMC,YAAY,GAAGL,WAAW,CAACH,QAAQ,CAACS,eAAV,CAAhC;AACA,UAAMC,YAAY,GAAGP,WAAW,CAACH,QAAQ,CAACW,IAAV,CAAhC;AACA,UAAMC,iBAAiB,GAAGC,IAAI,CAACC,GAAL,CAASN,YAAT,EAAuBE,YAAvB,CAA1B;AAEA,aAAOR,cAAc,KAAK,CAAnB,GAAuB;AAAEK,QAAAA,QAAQ,YAAKK,iBAAiB,GAAGV,cAAzB;AAAV,OAAvB,GAAiF,IAAxF;AACD;;;WAED,kBAAS;AACP,wBAAkE,KAAKJ,KAAvE;AAAA,UAAQiB,QAAR,eAAQA,QAAR;AAAA,UAAkBC,SAAlB,eAAkBA,SAAlB;AAAA,UAA6BC,OAA7B,eAA6BA,OAA7B;AAAA,UAAsCf,cAAtC,eAAsCA,cAAtC;AAAA,UAAyDgB,IAAzD;AAEA,UAAMC,UAAU,GAAG,4BAAWH,SAAX,EAAsBC,OAAO,CAACG,aAA9B,EAA6CH,OAAO,CAACI,iBAArD,CAAnB;AACA,UAAQD,aAAR,GAAwCF,IAAxC,CAAQE,aAAR;AAAA,UAA0BE,SAA1B,6CAAwCJ,IAAxC;AACA,UAAMK,KAAK,GAAG,KAAKC,YAAL,CAAkBtB,cAAlB,CAAd;AAEA,0BACE;AAAK,QAAA,SAAS,EAAEiB;AAAhB,SAAgCG,SAAhC,EAAgDC,KAAK,IAAI;AAAEA,QAAAA,KAAK,EAALA;AAAF,OAAzD,GACGR,QADH,CADF;AAKD;;;EA5CoBU,0B;;iCAAjB5B,Q,eACe;AACjBoB,EAAAA,OAAO,EAAES,sBAAUC,MADF;AAEjBX,EAAAA,SAAS,EAAEU,sBAAUE,MAFJ;AAGjBb,EAAAA,QAAQ,EAAEW,sBAAUG,KAHH;AAIjBT,EAAAA,aAAa,EAAEM,sBAAUI,KAAV,CAAgB;AAC7BC,IAAAA,KAAK,EAAEL,sBAAUM,OAAV,CAAkBN,sBAAUE,MAA5B,CADsB;AAE7BK,IAAAA,KAAK,EAAEP,sBAAUE;AAFY,GAAhB,CAJE;AAQjB1B,EAAAA,cAAc,EAAEwB,sBAAUQ;AART,C;iCADfrC,Q,kBAYkB;AACpBuB,EAAAA,aAAa,EAAE,EADK;AAEpBlB,EAAAA,cAAc,EAAE;AAFI,C;AAmCxB,IAAMiC,MAAM,GAAG;AACbf,EAAAA,aAAa,EAAE,EADF;AAEb;AACAC,EAAAA,iBAAiB,EAAE;AACjB,uBAAmB;AACjBd,MAAAA,QAAQ,EAAE;AAAU;;AADH;AADF;AAHN,CAAf;AAUA,IAAM6B,MAAM,GAAG,wBAAWD,MAAX,EAAmBtC,QAAnB,CAAf;eAEeuC,M","sourcesContent":["import React from 'react';\nimport { withStyles } from '@material-ui/core/styles';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport AppendCSSRules from './append-css-rules';\n\nclass UiLayout extends AppendCSSRules {\n static propTypes = {\n classes: PropTypes.object,\n className: PropTypes.string,\n children: PropTypes.array,\n extraCSSRules: PropTypes.shape({\n names: PropTypes.arrayOf(PropTypes.string),\n rules: PropTypes.string,\n }),\n fontSizeFactor: PropTypes.number,\n };\n\n static defaultProps = {\n extraCSSRules: {},\n fontSizeFactor: 1,\n };\n\n constructor(props) {\n super(props);\n this.classesSheet = document.createElement('style');\n }\n\n computeStyle(fontSizeFactor) {\n const getFontSize = (element) => parseFloat(getComputedStyle(element).fontSize);\n\n const rootFontSize = getFontSize(document.documentElement);\n const bodyFontSize = getFontSize(document.body);\n const effectiveFontSize = Math.max(rootFontSize, bodyFontSize);\n\n return fontSizeFactor !== 1 ? { fontSize: `${effectiveFontSize * fontSizeFactor}px` } : null;\n }\n\n render() {\n const { children, className, classes, fontSizeFactor, ...rest } = this.props;\n\n const finalClass = classNames(className, classes.extraCSSRules, classes.uiLayoutContainer);\n const { extraCSSRules, ...restProps } = rest;\n const style = this.computeStyle(fontSizeFactor);\n\n return (\n <div className={finalClass} {...restProps} {...(style && { style })}>\n {children}\n </div>\n );\n }\n}\n\nconst styles = {\n extraCSSRules: {},\n // need this because some browsers set their own style on table\n uiLayoutContainer: {\n '& table, th, td': {\n fontSize: 'inherit' /* Ensure table elements inherit font size */,\n },\n },\n};\n\nconst Styled = withStyles(styles)(UiLayout);\n\nexport default Styled;\n"],"file":"ui-layout.js"}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports["default"] = void 0;
|
|
11
|
+
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
|
+
|
|
16
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
17
|
+
|
|
18
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
19
|
+
|
|
20
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
21
|
+
|
|
22
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
23
|
+
|
|
24
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
25
|
+
|
|
26
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
27
|
+
|
|
28
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
29
|
+
|
|
30
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
31
|
+
|
|
32
|
+
var React = _interopRequireWildcard(require("react"));
|
|
33
|
+
|
|
34
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
35
|
+
|
|
36
|
+
var _Button = _interopRequireDefault(require("@material-ui/core/Button"));
|
|
37
|
+
|
|
38
|
+
var _styles = require("@material-ui/core/styles");
|
|
39
|
+
|
|
40
|
+
var _Restore = _interopRequireDefault(require("@material-ui/icons/Restore"));
|
|
41
|
+
|
|
42
|
+
var _Undo = _interopRequireDefault(require("@material-ui/icons/Undo"));
|
|
43
|
+
|
|
44
|
+
var _excluded = ["classes"];
|
|
45
|
+
|
|
46
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
47
|
+
|
|
48
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
49
|
+
|
|
50
|
+
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); }; }
|
|
51
|
+
|
|
52
|
+
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; } }
|
|
53
|
+
|
|
54
|
+
var styles = function styles(theme) {
|
|
55
|
+
return {
|
|
56
|
+
wrapper: {
|
|
57
|
+
display: 'flex',
|
|
58
|
+
flexDirection: 'column'
|
|
59
|
+
},
|
|
60
|
+
resetUndoContainer: {
|
|
61
|
+
display: 'flex',
|
|
62
|
+
alignItems: 'center',
|
|
63
|
+
justifyContent: 'center'
|
|
64
|
+
},
|
|
65
|
+
icon: {
|
|
66
|
+
width: '24px',
|
|
67
|
+
height: '24px',
|
|
68
|
+
color: 'gray',
|
|
69
|
+
marginRight: theme.spacing.unit
|
|
70
|
+
},
|
|
71
|
+
buttonContainer: {
|
|
72
|
+
display: 'flex',
|
|
73
|
+
alignItems: 'center',
|
|
74
|
+
marginLeft: theme.spacing.unit * 3,
|
|
75
|
+
marginRight: theme.spacing.unit * 3
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* HOC that adds undo and reset functionality for session values
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
var withUndoReset = function withUndoReset(WrappedComponent) {
|
|
85
|
+
var WithUndoReset = /*#__PURE__*/function (_React$Component) {
|
|
86
|
+
(0, _inherits2["default"])(WithUndoReset, _React$Component);
|
|
87
|
+
|
|
88
|
+
var _super = _createSuper(WithUndoReset);
|
|
89
|
+
|
|
90
|
+
function WithUndoReset(props) {
|
|
91
|
+
var _this;
|
|
92
|
+
|
|
93
|
+
(0, _classCallCheck2["default"])(this, WithUndoReset);
|
|
94
|
+
_this = _super.call(this, props);
|
|
95
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onSessionChange", function (session) {
|
|
96
|
+
_this.setState(function (state) {
|
|
97
|
+
return {
|
|
98
|
+
session: session,
|
|
99
|
+
changes: [].concat((0, _toConsumableArray2["default"])(state.changes), [session])
|
|
100
|
+
};
|
|
101
|
+
}, function () {
|
|
102
|
+
return _this.props.onSessionChange(session);
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onUndo", function () {
|
|
106
|
+
_this.setState(function (state) {
|
|
107
|
+
var newChanges = (0, _toConsumableArray2["default"])(state.changes);
|
|
108
|
+
newChanges.pop();
|
|
109
|
+
return {
|
|
110
|
+
changes: newChanges,
|
|
111
|
+
session: newChanges.length ? newChanges[newChanges.length - 1] : state.sessionInitialValues
|
|
112
|
+
};
|
|
113
|
+
}, function () {
|
|
114
|
+
return _this.props.onSessionChange(_this.state.session);
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onReset", function () {
|
|
118
|
+
_this.setState(function (state) {
|
|
119
|
+
return {
|
|
120
|
+
session: state.sessionInitialValues,
|
|
121
|
+
changes: []
|
|
122
|
+
};
|
|
123
|
+
}, function () {
|
|
124
|
+
return _this.props.onSessionChange(_this.state.sessionInitialValues);
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
_this.state = {
|
|
128
|
+
sessionInitialValues: JSON.parse(JSON.stringify(props.session)),
|
|
129
|
+
session: props.session,
|
|
130
|
+
changes: []
|
|
131
|
+
};
|
|
132
|
+
return _this;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
(0, _createClass2["default"])(WithUndoReset, [{
|
|
136
|
+
key: "render",
|
|
137
|
+
value: function render() {
|
|
138
|
+
var _this$props = this.props,
|
|
139
|
+
classes = _this$props.classes,
|
|
140
|
+
rest = (0, _objectWithoutProperties2["default"])(_this$props, _excluded);
|
|
141
|
+
var _this$state = this.state,
|
|
142
|
+
changes = _this$state.changes,
|
|
143
|
+
session = _this$state.session;
|
|
144
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
145
|
+
className: classes.wrapper
|
|
146
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
147
|
+
className: classes.resetUndoContainer
|
|
148
|
+
}, /*#__PURE__*/React.createElement(_Button["default"], {
|
|
149
|
+
className: classes.buttonContainer,
|
|
150
|
+
color: "primary",
|
|
151
|
+
disabled: changes.length === 0,
|
|
152
|
+
onClick: this.onUndo
|
|
153
|
+
}, /*#__PURE__*/React.createElement(_Undo["default"], {
|
|
154
|
+
className: classes.icon
|
|
155
|
+
}), " Undo"), /*#__PURE__*/React.createElement(_Button["default"], {
|
|
156
|
+
className: classes.buttonContainer,
|
|
157
|
+
color: "primary",
|
|
158
|
+
disabled: changes.length === 0,
|
|
159
|
+
onClick: this.onReset
|
|
160
|
+
}, /*#__PURE__*/React.createElement(_Restore["default"], {
|
|
161
|
+
className: classes.icon
|
|
162
|
+
}), " Start Over")), /*#__PURE__*/React.createElement(WrappedComponent, (0, _extends2["default"])({}, rest, {
|
|
163
|
+
session: session,
|
|
164
|
+
onSessionChange: this.onSessionChange
|
|
165
|
+
})));
|
|
166
|
+
}
|
|
167
|
+
}]);
|
|
168
|
+
return WithUndoReset;
|
|
169
|
+
}(React.Component);
|
|
170
|
+
|
|
171
|
+
(0, _defineProperty2["default"])(WithUndoReset, "propTypes", {
|
|
172
|
+
classes: _propTypes["default"].object,
|
|
173
|
+
session: _propTypes["default"].object,
|
|
174
|
+
onSessionChange: _propTypes["default"].func
|
|
175
|
+
});
|
|
176
|
+
return (0, _styles.withStyles)(styles)(WithUndoReset);
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
var _default = withUndoReset;
|
|
180
|
+
exports["default"] = _default;
|
|
181
|
+
//# sourceMappingURL=withUndoReset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/withUndoReset.jsx"],"names":["styles","theme","wrapper","display","flexDirection","resetUndoContainer","alignItems","justifyContent","icon","width","height","color","marginRight","spacing","unit","buttonContainer","marginLeft","withUndoReset","WrappedComponent","WithUndoReset","props","session","setState","state","changes","onSessionChange","newChanges","pop","length","sessionInitialValues","JSON","parse","stringify","classes","rest","onUndo","onReset","React","Component","PropTypes","object","func"],"mappings":"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","sourcesContent":["import * as React from 'react';\nimport PropTypes from 'prop-types';\nimport Button from '@material-ui/core/Button';\nimport { withStyles } from '@material-ui/core/styles';\nimport Restore from '@material-ui/icons/Restore';\nimport Undo from '@material-ui/icons/Undo';\n\nconst styles = (theme) => ({\n wrapper: {\n display: 'flex',\n flexDirection: 'column',\n },\n resetUndoContainer: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n },\n icon: {\n width: '24px',\n height: '24px',\n color: 'gray',\n marginRight: theme.spacing.unit,\n },\n buttonContainer: {\n display: 'flex',\n alignItems: 'center',\n marginLeft: theme.spacing.unit * 3,\n marginRight: theme.spacing.unit * 3,\n },\n});\n\n/**\n * HOC that adds undo and reset functionality for session values\n */\nconst withUndoReset = (WrappedComponent) => {\n class WithUndoReset extends React.Component {\n static propTypes = {\n classes: PropTypes.object,\n session: PropTypes.object,\n onSessionChange: PropTypes.func,\n };\n\n constructor(props) {\n super(props);\n\n this.state = {\n sessionInitialValues: JSON.parse(JSON.stringify(props.session)),\n session: props.session,\n changes: [],\n };\n }\n\n onSessionChange = (session) => {\n this.setState(\n (state) => ({ session, changes: [...state.changes, session] }),\n () => this.props.onSessionChange(session),\n );\n };\n\n onUndo = () => {\n this.setState(\n (state) => {\n const newChanges = [...state.changes];\n\n newChanges.pop();\n\n return {\n changes: newChanges,\n session: newChanges.length ? newChanges[newChanges.length - 1] : state.sessionInitialValues,\n };\n },\n () => this.props.onSessionChange(this.state.session),\n );\n };\n\n onReset = () => {\n this.setState(\n (state) => ({ session: state.sessionInitialValues, changes: [] }),\n () => this.props.onSessionChange(this.state.sessionInitialValues),\n );\n };\n\n render() {\n const { classes, ...rest } = this.props;\n const { changes, session } = this.state;\n\n return (\n <div className={classes.wrapper}>\n <div className={classes.resetUndoContainer}>\n <Button\n className={classes.buttonContainer}\n color=\"primary\"\n disabled={changes.length === 0}\n onClick={this.onUndo}\n >\n <Undo className={classes.icon} /> Undo\n </Button>\n <Button\n className={classes.buttonContainer}\n color=\"primary\"\n disabled={changes.length === 0}\n onClick={this.onReset}\n >\n <Restore className={classes.icon} /> Start Over\n </Button>\n </div>\n <WrappedComponent {...rest} session={session} onSessionChange={this.onSessionChange} />\n </div>\n );\n }\n }\n\n return withStyles(styles)(WithUndoReset);\n};\n\nexport default withUndoReset;\n"],"file":"withUndoReset.js"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pie-lib/render-ui",
|
|
3
|
+
"version": "4.32.3",
|
|
4
|
+
"description": "Some shared ui elements when rendering - but not worthy of their own package yet.",
|
|
5
|
+
"module": "src/index.js",
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./esm/index.js",
|
|
10
|
+
"require": "./lib/index.js",
|
|
11
|
+
"default": "./esm/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@material-ui/core": "^3.8.3",
|
|
20
|
+
"@material-ui/icons": "^3.0.2",
|
|
21
|
+
"@pie-lib/icons": "^2.21.2",
|
|
22
|
+
"@pie-lib/math-rendering": "^3.19.2",
|
|
23
|
+
"@pie-lib/test-utils": "^0.19.3",
|
|
24
|
+
"classnames": "^2.2.6",
|
|
25
|
+
"debug": "^4.1.1",
|
|
26
|
+
"lodash": "^4.17.11",
|
|
27
|
+
"prop-types": "^15.7.2",
|
|
28
|
+
"react-transition-group": "^2.5.2"
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"@pie-lib/test-utils": "beta",
|
|
32
|
+
"react": "^16.8.1",
|
|
33
|
+
"react-dom": "^16.8.1"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"react": "^16.8.1",
|
|
37
|
+
"react-dom": "^16.8.1"
|
|
38
|
+
},
|
|
39
|
+
"gitHead": "8a327571bd64249e4c88c0c8e750d16d6213f535"
|
|
40
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Prompt with Custom tag renders with custom tag "span" correctly renders 1`] = `
|
|
4
|
+
<PreviewPrompt
|
|
5
|
+
className="prompt"
|
|
6
|
+
classes={
|
|
7
|
+
Object {
|
|
8
|
+
"label": "PreviewPrompt-label-4",
|
|
9
|
+
"legend": "PreviewPrompt-legend-2",
|
|
10
|
+
"prompt": "PreviewPrompt-prompt-1",
|
|
11
|
+
"promptTable": "PreviewPrompt-promptTable-5",
|
|
12
|
+
"rationale": "PreviewPrompt-rationale-3",
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
onClick={[Function]}
|
|
16
|
+
prompt="Which of these northern European countries are EU members? <math><mstack><msrow><mn>111</mn></msrow><msline/></mstack></math>"
|
|
17
|
+
tagName="span"
|
|
18
|
+
/>
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
exports[`Prompt without Custom tag default class with markup renders 1`] = `
|
|
22
|
+
<PreviewPrompt
|
|
23
|
+
className=""
|
|
24
|
+
classes={
|
|
25
|
+
Object {
|
|
26
|
+
"label": "PreviewPrompt-label-4",
|
|
27
|
+
"legend": "PreviewPrompt-legend-2",
|
|
28
|
+
"prompt": "PreviewPrompt-prompt-1",
|
|
29
|
+
"promptTable": "PreviewPrompt-promptTable-5",
|
|
30
|
+
"rationale": "PreviewPrompt-rationale-3",
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
onClick={[Function]}
|
|
34
|
+
prompt="Which of these northern European countries are EU members? <math><mstack><msrow><mn>111</mn></msrow><msline/></mstack></math>"
|
|
35
|
+
tagName=""
|
|
36
|
+
/>
|
|
37
|
+
`;
|
package/configure/node_modules/@pie-lib/render-ui/src/__tests__/__snapshots__/purpose.test.jsx.snap
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Purpose renders fine renders child unaltered 1`] = `
|
|
4
|
+
<Purpose
|
|
5
|
+
purpose="passage"
|
|
6
|
+
>
|
|
7
|
+
<div
|
|
8
|
+
data-pie-purpose="passage"
|
|
9
|
+
key=".0"
|
|
10
|
+
>
|
|
11
|
+
text
|
|
12
|
+
</div>
|
|
13
|
+
</Purpose>
|
|
14
|
+
`;
|
|
15
|
+
|
|
16
|
+
exports[`Purpose renders fine renders child unaltered without purpose prop 1`] = `
|
|
17
|
+
<Purpose>
|
|
18
|
+
<div
|
|
19
|
+
key=".0"
|
|
20
|
+
>
|
|
21
|
+
text
|
|
22
|
+
</div>
|
|
23
|
+
</Purpose>
|
|
24
|
+
`;
|
|
25
|
+
|
|
26
|
+
exports[`Purpose renders fine renders children unaltered 1`] = `
|
|
27
|
+
<Purpose
|
|
28
|
+
purpose="something"
|
|
29
|
+
>
|
|
30
|
+
<div
|
|
31
|
+
data-pie-purpose="something"
|
|
32
|
+
key=".0"
|
|
33
|
+
>
|
|
34
|
+
<div>
|
|
35
|
+
text1
|
|
36
|
+
</div>
|
|
37
|
+
<div>
|
|
38
|
+
text2
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
</Purpose>
|
|
42
|
+
`;
|
package/configure/node_modules/@pie-lib/render-ui/src/__tests__/__snapshots__/readable.test.jsx.snap
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Readable renders fine renders child unaltered 1`] = `
|
|
4
|
+
<Readable>
|
|
5
|
+
<div
|
|
6
|
+
data-pie-readable={true}
|
|
7
|
+
key=".0"
|
|
8
|
+
>
|
|
9
|
+
text
|
|
10
|
+
</div>
|
|
11
|
+
</Readable>
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
exports[`Readable renders fine renders children unaltered 1`] = `
|
|
15
|
+
<Readable>
|
|
16
|
+
<div
|
|
17
|
+
data-pie-readable={true}
|
|
18
|
+
key=".0"
|
|
19
|
+
>
|
|
20
|
+
<div>
|
|
21
|
+
text1
|
|
22
|
+
</div>
|
|
23
|
+
<div>
|
|
24
|
+
text2
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
</Readable>
|
|
28
|
+
`;
|
|
29
|
+
|
|
30
|
+
exports[`Readable renders fine renders even with specific true tag 1`] = `
|
|
31
|
+
<Readable
|
|
32
|
+
false={true}
|
|
33
|
+
>
|
|
34
|
+
<div
|
|
35
|
+
data-pie-readable={false}
|
|
36
|
+
key=".0"
|
|
37
|
+
>
|
|
38
|
+
<div>
|
|
39
|
+
text1
|
|
40
|
+
</div>
|
|
41
|
+
<div>
|
|
42
|
+
text2
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</Readable>
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
exports[`Readable renders fine renders with false tag 1`] = `
|
|
49
|
+
<Readable
|
|
50
|
+
false={true}
|
|
51
|
+
>
|
|
52
|
+
<div
|
|
53
|
+
data-pie-readable={false}
|
|
54
|
+
key=".0"
|
|
55
|
+
>
|
|
56
|
+
<div>
|
|
57
|
+
text1
|
|
58
|
+
</div>
|
|
59
|
+
<div>
|
|
60
|
+
text2
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
</Readable>
|
|
64
|
+
`;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`response-indicators snapshot - no feedback 1`] = `
|
|
4
|
+
<div>
|
|
5
|
+
<span
|
|
6
|
+
onClick={[Function]}
|
|
7
|
+
>
|
|
8
|
+
<div>
|
|
9
|
+
correct
|
|
10
|
+
</div>
|
|
11
|
+
</span>
|
|
12
|
+
</div>
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
exports[`response-indicators snapshot - with feedback 1`] = `
|
|
16
|
+
<div
|
|
17
|
+
className="RawIndicator-responseIndicator-1"
|
|
18
|
+
>
|
|
19
|
+
<span
|
|
20
|
+
onClick={[Function]}
|
|
21
|
+
>
|
|
22
|
+
<div>
|
|
23
|
+
correct
|
|
24
|
+
</div>
|
|
25
|
+
</span>
|
|
26
|
+
</div>
|
|
27
|
+
`;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { v } from '../color';
|
|
2
|
+
describe('v', () => {
|
|
3
|
+
it.each`
|
|
4
|
+
args | expected
|
|
5
|
+
${['text', 'black']} | ${'var(--pie-text, black)'}
|
|
6
|
+
${['primary-text', 'text', 'black']} | ${'var(--pie-primary-text, var(--pie-text, black))'}
|
|
7
|
+
${['black']} | ${'black'}
|
|
8
|
+
${['#00ff00']} | ${'#00ff00'}
|
|
9
|
+
`('$args => $expected', ({ args, expected }) => {
|
|
10
|
+
expect(v('pie')(...args)).toEqual(expected);
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { hasMedia } from '../has-media'; // Assuming you have a hasMedia function
|
|
3
|
+
|
|
4
|
+
describe('hasMedia', () => {
|
|
5
|
+
it.each`
|
|
6
|
+
input | expected
|
|
7
|
+
${'<img src="image.jpg" />'} | ${true}
|
|
8
|
+
${'<audio src="audio.mp3" />'} | ${true}
|
|
9
|
+
${'<div><img src="image.jpg" /></div>'} | ${true}
|
|
10
|
+
${'<div><audio src="audio.mp3" /></div>'} | ${true}
|
|
11
|
+
${'<div>No media here</div>'} | ${false}
|
|
12
|
+
${'<div></div>'} | ${false}
|
|
13
|
+
${' '} | ${false}
|
|
14
|
+
${null} | ${false}
|
|
15
|
+
`('$input -> $expected', ({ input, expected }) => {
|
|
16
|
+
const output = hasMedia(input);
|
|
17
|
+
|
|
18
|
+
expect(output).toEqual(expected);
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { hasText } from '../has-text';
|
|
3
|
+
|
|
4
|
+
describe('has-text', () => {
|
|
5
|
+
it.each`
|
|
6
|
+
input | expected
|
|
7
|
+
${'<div>Rationale</div>'} | ${true}
|
|
8
|
+
${'Rationale'} | ${true}
|
|
9
|
+
${'<div>hi</div>'} | ${true}
|
|
10
|
+
${'<div>hi'} | ${true}
|
|
11
|
+
${'<div></div>'} | ${false}
|
|
12
|
+
${'<div> </div>'} | ${false}
|
|
13
|
+
${'<div><br /> </div>'} | ${false}
|
|
14
|
+
${' '} | ${false}
|
|
15
|
+
${null} | ${false}
|
|
16
|
+
`('$input -> $expected', ({ input, expected }) => {
|
|
17
|
+
const output = hasText(input);
|
|
18
|
+
|
|
19
|
+
expect(output).toEqual(expected);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import HtmlAndMath from '../html-and-math';
|
|
2
|
+
import { shallow } from 'enzyme';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
describe('html-and-math', () => {
|
|
6
|
+
const mkWrapper = (extras) => {
|
|
7
|
+
const props = {
|
|
8
|
+
html: '<p>hi</p>',
|
|
9
|
+
...extras,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
return shallow(<HtmlAndMath {...props} />, {
|
|
13
|
+
disableLifecycleMethods: true,
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
describe('render', () => {
|
|
18
|
+
it('renders', () => {
|
|
19
|
+
const w = mkWrapper();
|
|
20
|
+
|
|
21
|
+
expect(w).toMatchSnapshot();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
});
|