@pie-element/explicit-constructed-response 11.1.1 → 11.1.2-next.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/configure.js +2 -0
- package/controller.js +1 -0
- package/dist/_virtual/_rolldown/runtime.js +4 -0
- package/dist/author/alternateResponses.d.ts +34 -0
- package/dist/author/alternateResponses.js +113 -0
- package/dist/author/alternateSection.d.ts +58 -0
- package/dist/author/alternateSection.js +213 -0
- package/dist/author/defaults.d.ts +186 -0
- package/dist/author/defaults.js +128 -0
- package/dist/author/ecr-toolbar.d.ts +41 -0
- package/dist/author/ecr-toolbar.js +100 -0
- package/dist/author/index.d.ts +42 -0
- package/dist/author/index.js +96 -0
- package/dist/author/main.d.ts +38 -0
- package/dist/author/main.js +291 -0
- package/dist/author/markupUtils.d.ts +14 -0
- package/dist/author/markupUtils.js +13 -0
- package/dist/author/utils.d.ts +9 -0
- package/dist/author/utils.js +7 -0
- package/dist/browser/author/index.js +3378 -0
- package/dist/browser/author/index.js.map +1 -0
- package/dist/browser/browser-BC3WygxE.js +360 -0
- package/dist/browser/browser-BC3WygxE.js.map +1 -0
- package/dist/browser/controller/index.js +4152 -0
- package/dist/browser/controller/index.js.map +1 -0
- package/dist/browser/delivery/index.js +96 -0
- package/dist/browser/delivery/index.js.map +1 -0
- package/dist/browser/dist-D5D48-XD.js +45656 -0
- package/dist/browser/dist-D5D48-XD.js.map +1 -0
- package/dist/browser/dist-D9ARZhQk.js +1426 -0
- package/dist/browser/dist-D9ARZhQk.js.map +1 -0
- package/dist/browser/explicit-constructed-response.css +2 -0
- package/dist/browser/main-B4lD1zyg.js +959 -0
- package/dist/browser/main-B4lD1zyg.js.map +1 -0
- package/dist/browser/print/index.js +40 -0
- package/dist/browser/print/index.js.map +1 -0
- package/dist/controller/defaults.d.ts +25 -0
- package/dist/controller/defaults.js +19 -0
- package/dist/controller/index.d.ts +64 -0
- package/dist/controller/index.js +139 -0
- package/dist/delivery/index.d.ts +20 -0
- package/dist/delivery/index.js +66 -0
- package/dist/delivery/main.d.ts +48 -0
- package/dist/delivery/main.js +115 -0
- package/dist/explicit-constructed-response.css +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.iife.d.ts +8 -0
- package/dist/index.iife.js +393 -0
- package/dist/index.js +2 -0
- package/dist/node_modules/.bun/he@1.2.0/node_modules/he/he.js +3993 -0
- package/dist/print/index.d.ts +15 -0
- package/dist/print/index.js +40 -0
- package/dist/runtime-support.d.ts +12 -0
- package/dist/runtime-support.js +12 -0
- package/package.json +94 -26
- package/CHANGELOG.json +0 -1102
- package/CHANGELOG.md +0 -2187
- package/LICENSE.md +0 -5
- package/README.md +0 -1
- package/configure/CHANGELOG.json +0 -652
- package/configure/CHANGELOG.md +0 -1928
- package/configure/lib/alternateResponses.js +0 -199
- package/configure/lib/alternateResponses.js.map +0 -1
- package/configure/lib/alternateSection.js +0 -329
- package/configure/lib/alternateSection.js.map +0 -1
- package/configure/lib/defaults.js +0 -184
- package/configure/lib/defaults.js.map +0 -1
- package/configure/lib/ecr-toolbar.js +0 -181
- package/configure/lib/ecr-toolbar.js.map +0 -1
- package/configure/lib/index.js +0 -161
- package/configure/lib/index.js.map +0 -1
- package/configure/lib/main.js +0 -514
- package/configure/lib/main.js.map +0 -1
- package/configure/lib/markupUtils.js +0 -70
- package/configure/lib/markupUtils.js.map +0 -1
- package/configure/lib/utils.js +0 -15
- package/configure/lib/utils.js.map +0 -1
- package/configure/package.json +0 -22
- package/controller/CHANGELOG.json +0 -517
- package/controller/CHANGELOG.md +0 -1344
- package/controller/lib/defaults.js +0 -23
- package/controller/lib/defaults.js.map +0 -1
- package/controller/lib/index.js +0 -368
- package/controller/lib/index.js.map +0 -1
- package/controller/package.json +0 -18
- package/docs/config-schema.json +0 -2629
- package/docs/config-schema.json.md +0 -1941
- package/docs/demo/config.js +0 -8
- package/docs/demo/generate.js +0 -20
- package/docs/demo/index.html +0 -1
- package/docs/demo/session.js +0 -10
- package/docs/pie-schema.json +0 -1130
- package/docs/pie-schema.json.md +0 -814
- package/lib/index.js +0 -91
- package/lib/index.js.map +0 -1
- package/lib/main.js +0 -205
- package/lib/main.js.map +0 -1
- package/lib/print.js +0 -71
- package/lib/print.js.map +0 -1
- package/module/configure.js +0 -1
- package/module/controller.js +0 -6534
- package/module/demo.js +0 -45
- package/module/element.js +0 -1
- package/module/index.html +0 -21
- package/module/manifest.json +0 -18
- package/module/print-demo.js +0 -83
- package/module/print.html +0 -18
- package/module/print.js +0 -1
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import e from "react";
|
|
2
|
+
import t from "prop-types";
|
|
3
|
+
import { debounce as n, isEmpty as r, isEqual as i } from "@pie-element/shared-lodash";
|
|
4
|
+
import a from "@pie-lib/correct-answer-toggle";
|
|
5
|
+
import { ConstructedResponse as o } from "@pie-lib/mask-markup";
|
|
6
|
+
import * as s from "@pie-lib/render-ui";
|
|
7
|
+
import { Collapsible as c, PreviewPrompt as l, UiLayout as u, color as d, hasMedia as f, hasText as p } from "@pie-lib/render-ui";
|
|
8
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
9
|
+
import { styled as g } from "@mui/material/styles";
|
|
10
|
+
import _ from "@pie-lib/translator";
|
|
11
|
+
//#region src/delivery/main.tsx
|
|
12
|
+
function v(e) {
|
|
13
|
+
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
14
|
+
}
|
|
15
|
+
function y(e, t) {
|
|
16
|
+
return !e || v(e) ? e : v(e.default) ? e.default : t && v(e[t]) ? e[t] : t && v(e[t]?.default) ? e[t].default : e;
|
|
17
|
+
}
|
|
18
|
+
var b = y(u, "UiLayout") || y(T.UiLayout, "UiLayout"), x = y(l, "PreviewPrompt") || y(T.PreviewPrompt, "PreviewPrompt"), S = y(c, "Collapsible") || y(T.Collapsible, "Collapsible"), C = s, w = C.default, T = w && typeof w == "object" ? w : C, { translator: E } = _, D = g(b)(({ alwaysShowCorrect: e }) => ({
|
|
19
|
+
color: d.text(),
|
|
20
|
+
backgroundColor: d.background(),
|
|
21
|
+
...e && { "& *": { borderColor: `${d.text()} !important` } }
|
|
22
|
+
})), O = g("div")(({ theme: e }) => ({ marginBottom: e.spacing(2) })), k = g("div")(({ theme: e }) => ({ marginBottom: e.spacing(2) })), A = g("h2")({
|
|
23
|
+
position: "absolute",
|
|
24
|
+
left: "-10000px",
|
|
25
|
+
top: "auto",
|
|
26
|
+
width: "1px",
|
|
27
|
+
height: "1px",
|
|
28
|
+
overflow: "hidden"
|
|
29
|
+
}), j = class extends e.Component {
|
|
30
|
+
static propTypes = {
|
|
31
|
+
alwaysShowCorrect: t.bool,
|
|
32
|
+
animationsDisabled: t.bool,
|
|
33
|
+
disabled: t.bool,
|
|
34
|
+
displayType: t.string,
|
|
35
|
+
feedback: t.object,
|
|
36
|
+
language: t.string,
|
|
37
|
+
markup: t.string,
|
|
38
|
+
maxLengthPerChoice: t.array,
|
|
39
|
+
maxLengthPerChoiceEnabled: t.bool,
|
|
40
|
+
mode: t.string,
|
|
41
|
+
note: t.string,
|
|
42
|
+
onChange: t.func,
|
|
43
|
+
playerSpellCheckEnabled: t.bool,
|
|
44
|
+
prompt: t.string,
|
|
45
|
+
rationale: t.string,
|
|
46
|
+
role: t.string,
|
|
47
|
+
showNote: t.bool,
|
|
48
|
+
teacherInstructions: t.string,
|
|
49
|
+
value: t.object,
|
|
50
|
+
responseAreaInputConfiguration: t.object,
|
|
51
|
+
model: t.object.isRequired
|
|
52
|
+
};
|
|
53
|
+
static defaultProps = { value: {} };
|
|
54
|
+
state = { showCorrectAnswer: this.props.alwaysShowCorrect || !1 };
|
|
55
|
+
getChangeSession = (e) => e && e.every((e, t, n) => e === n[0] && e === 1) ? this.props.onChange : n(this.props.onChange, 200, { maxWait: 200 });
|
|
56
|
+
UNSAFE_componentWillReceiveProps(e) {
|
|
57
|
+
let { maxLengthPerChoice: t, language: n } = this.props, { note: a } = this.props;
|
|
58
|
+
r(e.feedback) && this.setState({ showCorrectAnswer: !1 }), e.alwaysShowCorrect && this.setState({ showCorrectAnswer: !0 }), t && !i(t, e.maxLengthPerChoice) && (this.changeSession = this.getChangeSession(e.maxLengthPerChoice)), a && n && n !== e.language && a === E.t("common:commonCorrectAnswerWithAlternates", { lng: n }) && (a = E.t("common:commonCorrectAnswerWithAlternates", { lng: e.language }));
|
|
59
|
+
}
|
|
60
|
+
toggleShowCorrect = () => {
|
|
61
|
+
this.setState({ showCorrectAnswer: !this.state.showCorrectAnswer });
|
|
62
|
+
};
|
|
63
|
+
changeSession = this.getChangeSession(this.props.maxLengthPerChoice);
|
|
64
|
+
onChange = (e) => {
|
|
65
|
+
this.changeSession(e);
|
|
66
|
+
};
|
|
67
|
+
render() {
|
|
68
|
+
let { showCorrectAnswer: e } = this.state, { alwaysShowCorrect: t, animationsDisabled: n, mode: r, displayType: i, role: s, language: c, maxLengthPerChoice: l, maxLengthPerChoiceEnabled: u, note: d, playerSpellCheckEnabled: g, prompt: _, rationale: v, showNote: y, teacherInstructions: b, responseAreaInputConfiguration: C, model: w, value: T } = this.props, { extraCSSRules: E } = w || {}, j = (e || r === "view" && s === "instructor") && y && d, M = /* @__PURE__ */ m(x, {
|
|
69
|
+
defaultClassName: "teacher-instructions",
|
|
70
|
+
prompt: b
|
|
71
|
+
}), N = /* @__PURE__ */ m(x, { prompt: v }), P = v && (p(v) || f(v)), F = b && (p(b) || f(b));
|
|
72
|
+
return /* @__PURE__ */ h(D, {
|
|
73
|
+
extraCSSRules: E,
|
|
74
|
+
alwaysShowCorrect: t,
|
|
75
|
+
style: { display: `${i}` },
|
|
76
|
+
children: [
|
|
77
|
+
r === "gather" && /* @__PURE__ */ m(A, { children: "Fill in the Blank Question" }),
|
|
78
|
+
F && /* @__PURE__ */ m(k, { children: n ? M : /* @__PURE__ */ m(S, {
|
|
79
|
+
labels: {
|
|
80
|
+
hidden: "Show Teacher Instructions",
|
|
81
|
+
visible: "Hide Teacher Instructions"
|
|
82
|
+
},
|
|
83
|
+
children: M
|
|
84
|
+
}) }),
|
|
85
|
+
_ && /* @__PURE__ */ m(x, { prompt: _ }),
|
|
86
|
+
!t && r === "evaluate" && /* @__PURE__ */ m(a, {
|
|
87
|
+
show: !0,
|
|
88
|
+
toggled: e,
|
|
89
|
+
onToggle: this.toggleShowCorrect,
|
|
90
|
+
language: c
|
|
91
|
+
}),
|
|
92
|
+
/* @__PURE__ */ m(o, {
|
|
93
|
+
...this.props,
|
|
94
|
+
onChange: this.onChange,
|
|
95
|
+
showCorrectAnswer: e,
|
|
96
|
+
value: T,
|
|
97
|
+
maxLength: l,
|
|
98
|
+
adjustedLimit: u,
|
|
99
|
+
spellCheck: g,
|
|
100
|
+
pluginProps: C
|
|
101
|
+
}),
|
|
102
|
+
j && /* @__PURE__ */ m(O, { dangerouslySetInnerHTML: { __html: d } }),
|
|
103
|
+
P && /* @__PURE__ */ m(k, { children: n ? N : /* @__PURE__ */ m(S, {
|
|
104
|
+
labels: {
|
|
105
|
+
hidden: "Show Rationale",
|
|
106
|
+
visible: "Hide Rationale"
|
|
107
|
+
},
|
|
108
|
+
children: N
|
|
109
|
+
}) })
|
|
110
|
+
]
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
//#endregion
|
|
115
|
+
export { j as default };
|